From xen-changelog-bounces@lists.xen.org Mon Apr 02 12:55:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 12:55:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEgms-0002m1-R3; Mon, 02 Apr 2012 12:55:10 +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 1SEgmr-0002lu-Q8
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 12:55:10 +0000
Received: from [85.158.139.83:34542] by server-11.bemta-5.messagelabs.com id
	3C/11-12959-CA1A97F4; Mon, 02 Apr 2012 12:55:08 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1333371305!10803780!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8188 invoked from network); 2 Apr 2012 12:55:07 -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;
	2 Apr 2012 12:55: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 1SEgmm-00057l-6K
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 12:55:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEgml-00086e-Sk
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 12:55:03 +0000
Message-Id: <E1SEgml-00086e-Sk@xenbits.xen.org>
Date: Mon, 02 Apr 2012 12: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] pcifront: consolidate 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1333370872 -7200
# Node ID f523a98343a9e20e88cde7a6af9cf7e4415ec57d
# Parent  80a3bc79579e55efaece795656a0c08d854f8280
pcifront: consolidate messages

Primarily the code should exclusively use dev_{err,warn,info}().

Additionally remove some redundant information, adjust the wording in
a few cases, and do some other benign cleanup.

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


diff -r 80a3bc79579e -r f523a98343a9 drivers/xen/pcifront/pci_op.c
--- a/drivers/xen/pcifront/pci_op.c	Wed Mar 28 15:21:23 2012 +0200
+++ b/drivers/xen/pcifront/pci_op.c	Mon Apr 02 14:47:52 2012 +0200
@@ -15,11 +15,11 @@
 static int verbose_request = 0;
 module_param(verbose_request, int, 0644);
 
-#ifdef __ia64__
 static void pcifront_init_sd(struct pcifront_sd *sd,
 			     unsigned int domain, unsigned int bus,
 			     struct pcifront_device *pdev)
 {
+#ifdef __ia64__
 	int err, i, j, k, len, root_num, res_count;
 	struct acpi_resource res;
 	unsigned int d, b, byte;
@@ -66,7 +66,8 @@ static void pcifront_init_sd(struct pcif
 		return; /* No resources, nothing to do */
 
 	if (magic != (sizeof(res) * 2) + 1) {
-		printk(KERN_WARNING "pcifront: resource magic mismatch\n");
+		dev_warn(&pdev->xdev->dev,
+			 "pcifront: resource magic mismatch\n");
 		return;
 	}
 
@@ -104,9 +105,9 @@ static void pcifront_init_sd(struct pcif
 		err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str,
 				   "%s", buf);
 		if (err != 1) {
-			printk(KERN_WARNING "pcifront: error reading "
-			       "resource %d on bus %04x:%02x\n",
-			       j, domain, bus);
+			dev_warn(&pdev->xdev->dev,
+				 "pcifront: error reading resource %d on bus %04x:%02x\n",
+				 j, domain, bus);
 			continue;
 		}
 
@@ -128,8 +129,11 @@ static void pcifront_init_sd(struct pcif
 		sd->windows++;
 	}
 	kfree(buf);
+#else
+	sd->domain = domain;
+	sd->pdev = pdev;
+#endif
 }
-#endif
 
 static int errno_to_pcibios_err(int errno)
 {
@@ -215,8 +219,7 @@ static int do_pci_op(struct pcifront_dev
 	*/
 	if (test_bit(_XEN_PCIB_active, 
 			(unsigned long*)&pdev->sh_info->flags)) {
-		dev_err(&pdev->xdev->dev, 
-			"schedule aer pcifront service\n");
+		dev_info(&pdev->xdev->dev, "schedule aer pcifront service\n");
 		schedule_pcifront_aer_op(pdev);
 	}
 
@@ -230,9 +233,9 @@ static int do_pci_op(struct pcifront_dev
 
 /* Access to this function is spinlocked in drivers/pci/access.c */
 static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn,
-			     int where, int size, u32 * val)
+			     int where, int size, u32 *val)
 {
-	int err = 0;
+	int err;
 	struct xen_pci_op op = {
 		.cmd    = XEN_PCI_OP_conf_read,
 		.domain = pci_domain_nr(bus),
@@ -245,24 +248,24 @@ static int pcifront_bus_read(struct pci_
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
 	if (verbose_request)
-		dev_info(&pdev->xdev->dev,
-			 "read dev=%04x:%02x:%02x.%01x - offset %x size %d\n",
-			 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
-			 PCI_FUNC(devfn), where, size);
+		dev_info(&pdev->xdev->dev, "read %02x.%u offset %x size %d\n",
+			 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size);
 
 	err = do_pci_op(pdev, &op);
 
 	if (likely(!err)) {
 		if (verbose_request)
-			dev_info(&pdev->xdev->dev, "read got back value %x\n",
-				 op.value);
+			dev_info(&pdev->xdev->dev, "read %02x.%u = %x\n",
+				 PCI_SLOT(devfn), PCI_FUNC(devfn), op.value);
 
 		*val = op.value;
 	} else if (err == -ENODEV) {
 		/* No device here, pretend that it just returned 0 */
 		err = 0;
 		*val = 0;
-	}
+	} else if (verbose_request)
+		dev_info(&pdev->xdev->dev, "read %02x.%u -> %d\n",
+			 PCI_SLOT(devfn), PCI_FUNC(devfn), err);
 
 	return errno_to_pcibios_err(err);
 }
@@ -285,15 +288,13 @@ static int pcifront_bus_write(struct pci
 
 	if (verbose_request)
 		dev_info(&pdev->xdev->dev,
-			 "write dev=%04x:%02x:%02x.%01x - "
-			 "offset %x size %d val %x\n",
-			 pci_domain_nr(bus), bus->number,
+			 "write %02x.%u offset %x size %d val %x\n",
 			 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val);
 
 	return errno_to_pcibios_err(do_pci_op(pdev, &op));
 }
 
-struct pci_ops pcifront_bus_ops = {
+static struct pci_ops pcifront_bus_ops = {
 	.read = pcifront_bus_read,
 	.write = pcifront_bus_write,
 };
@@ -315,8 +316,9 @@ int pci_frontend_enable_msix(struct pci_
 	struct pcifront_sd *sd = dev->bus->sysdata;
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
-	if (nvec > SH_INFO_MAX_VEC) {
-		printk("too much vector for pci frontend%x\n", nvec);
+	if (nvec < 0 || nvec > SH_INFO_MAX_VEC) {
+		dev_err(&dev->dev, "too many (%d) vectors for pci frontend\n",
+			nvec);
 		return -EINVAL;
 	}
 
@@ -330,22 +332,20 @@ int pci_frontend_enable_msix(struct pci_
 	if (!err) {
 		if (!op.value) {
 			/* we get the result */
-			for ( i = 0; i < nvec; i++)
+			for (i = 0; i < nvec; i++)
 				entries[i].vector = op.msix_entries[i].vector;
-			return 0;
+		} else {
+			dev_err(&dev->dev, "enable MSI-X => %#x\n", op.value);
+			err = op.value;
 		}
-		else {
-            printk("enable msix get value %x\n", op.value);
-			return op.value;
-		}
+	} else {
+		dev_err(&dev->dev, "enable MSI-X -> %d\n", err);
+		err = -EINVAL;
 	}
-	else {
-        printk("enable msix get err %x\n", err);
-		return err;
-	}
+	return err;
 }
 
-void pci_frontend_disable_msix(struct pci_dev* dev)
+void pci_frontend_disable_msix(struct pci_dev *dev)
 {
 	int err;
 	struct xen_pci_op op = {
@@ -361,7 +361,7 @@ void pci_frontend_disable_msix(struct pc
 
 	/* What should do for error ? */
 	if (err)
-		printk("pci_disable_msix get err %x\n", err);
+		dev_err(&dev->dev, "disable MSI-X -> %d\n", err);
 }
 
 int pci_frontend_enable_msi(struct pci_dev *dev)
@@ -377,18 +377,16 @@ int pci_frontend_enable_msi(struct pci_d
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
 	err = do_pci_op(pdev, &op);
-	if (likely(!err)) {
+	if (likely(!err))
 		dev->irq = op.value;
-	}
 	else {
-		printk("pci frontend enable msi failed for dev %x:%x \n",
-				op.bus, op.devfn);
+		dev_err(&dev->dev, "enable MSI -> %d\n", err);
 		err = -EINVAL;
 	}
 	return err;
 }
 
-void pci_frontend_disable_msi(struct pci_dev* dev)
+void pci_frontend_disable_msi(struct pci_dev *dev)
 {
 	int err;
 	struct xen_pci_op op = {
@@ -401,16 +399,10 @@ void pci_frontend_disable_msi(struct pci
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
 	err = do_pci_op(pdev, &op);
-	if (err == XEN_PCI_ERR_dev_not_found) {
-		/* XXX No response from backend, what shall we do? */
-		printk("get no response from backend for disable MSI\n");
-		return;
-	}
 	if (likely(!err))
 		dev->irq = op.value;
 	else
-		/* how can pciback notify us fail? */
-		printk("get fake response frombackend \n");
+		dev_err(&dev->dev, "disable MSI -> %d\n", err);
 }
 #endif /* CONFIG_PCI_MSI */
 
@@ -436,18 +428,17 @@ int __devinit pcifront_scan_root(struct 
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
-	struct pcifront_sd *sd = NULL;
-	struct pci_bus_entry *bus_entry = NULL;
+	struct pcifront_sd *sd;
+	struct pci_bus_entry *bus_entry;
 	int err = 0;
 
 #ifndef CONFIG_PCI_DOMAINS
 	if (domain != 0) {
 		dev_err(&pdev->xdev->dev,
-			"PCI Root in non-zero PCI Domain! domain=%d\n", domain);
+			"PCI root in non-zero domain %x!\n", domain);
 		dev_err(&pdev->xdev->dev,
 			"Please compile with CONFIG_PCI_DOMAINS\n");
-		err = -EINVAL;
-		goto err_out;
+		return -EINVAL;
 	}
 #endif
 
@@ -500,7 +491,7 @@ int __devinit pcifront_rescan_root(struc
 #ifndef CONFIG_PCI_DOMAINS
 	if (domain != 0) {
 		dev_err(&pdev->xdev->dev,
-			"PCI Root in non-zero PCI Domain! domain=%d\n", domain);
+			"PCI root in non-zero domain %x\n", domain);
 		dev_err(&pdev->xdev->dev,
 			"Please compile with CONFIG_PCI_DOMAINS\n");
 		return -EINVAL;
@@ -529,8 +520,9 @@ int __devinit pcifront_rescan_root(struc
 
 		d = pci_scan_single_device(b, devfn);
 		if (d)
-			dev_info(&pdev->xdev->dev, "New device on "
-				 "%04x:%02x:%02x.%02x found.\n", domain, bus,
+			dev_info(&pdev->xdev->dev,
+				 "New device on %04x:%02x:%02x.%u\n",
+				 domain, bus,
 				 PCI_SLOT(devfn), PCI_FUNC(devfn));
 	}
 
@@ -586,7 +578,7 @@ static pci_ers_result_t pcifront_common_
 	int flag = 0;
 
 	dev_dbg(&pdev->xdev->dev, 
-		"pcifront AER process: cmd %x (bus:%x, devfn%x)",
+		"pcifront AER process: cmd %x (bus %x devfn %x)",
 		cmd, bus, devfn);
 	result = PCI_ERS_RESULT_NONE;
 
@@ -619,8 +611,9 @@ static pci_ers_result_t pcifront_common_
 					break;
 				default:
 					dev_err(&pdev->xdev->dev,
-						"bad request in aer recovery operation!\n");
-
+						"bad request %x in aer recovery operation!\n",
+						cmd);
+					break;
 				}
 			}
 		}
diff -r 80a3bc79579e -r f523a98343a9 include/xen/pcifront.h
--- a/include/xen/pcifront.h	Wed Mar 28 15:21:23 2012 +0200
+++ b/include/xen/pcifront.h	Mon Apr 02 14:47:52 2012 +0200
@@ -26,14 +26,6 @@ pcifront_get_pdev(struct pcifront_sd *sd
 	return sd->pdev;
 }
 
-static inline void pcifront_init_sd(struct pcifront_sd *sd,
-				    unsigned int domain, unsigned int bus,
-				    struct pcifront_device *pdev)
-{
-	sd->domain = domain;
-	sd->pdev = pdev;
-}
-
 #if defined(CONFIG_PCI_DOMAINS)
 static inline int pci_domain_nr(struct pci_bus *bus)
 {

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 12:55:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 12:55:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEgms-0002m1-R3; Mon, 02 Apr 2012 12:55:10 +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 1SEgmr-0002lu-Q8
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 12:55:10 +0000
Received: from [85.158.139.83:34542] by server-11.bemta-5.messagelabs.com id
	3C/11-12959-CA1A97F4; Mon, 02 Apr 2012 12:55:08 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1333371305!10803780!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8188 invoked from network); 2 Apr 2012 12:55:07 -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;
	2 Apr 2012 12:55: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 1SEgmm-00057l-6K
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 12:55:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEgml-00086e-Sk
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 12:55:03 +0000
Message-Id: <E1SEgml-00086e-Sk@xenbits.xen.org>
Date: Mon, 02 Apr 2012 12: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] pcifront: consolidate 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1333370872 -7200
# Node ID f523a98343a9e20e88cde7a6af9cf7e4415ec57d
# Parent  80a3bc79579e55efaece795656a0c08d854f8280
pcifront: consolidate messages

Primarily the code should exclusively use dev_{err,warn,info}().

Additionally remove some redundant information, adjust the wording in
a few cases, and do some other benign cleanup.

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


diff -r 80a3bc79579e -r f523a98343a9 drivers/xen/pcifront/pci_op.c
--- a/drivers/xen/pcifront/pci_op.c	Wed Mar 28 15:21:23 2012 +0200
+++ b/drivers/xen/pcifront/pci_op.c	Mon Apr 02 14:47:52 2012 +0200
@@ -15,11 +15,11 @@
 static int verbose_request = 0;
 module_param(verbose_request, int, 0644);
 
-#ifdef __ia64__
 static void pcifront_init_sd(struct pcifront_sd *sd,
 			     unsigned int domain, unsigned int bus,
 			     struct pcifront_device *pdev)
 {
+#ifdef __ia64__
 	int err, i, j, k, len, root_num, res_count;
 	struct acpi_resource res;
 	unsigned int d, b, byte;
@@ -66,7 +66,8 @@ static void pcifront_init_sd(struct pcif
 		return; /* No resources, nothing to do */
 
 	if (magic != (sizeof(res) * 2) + 1) {
-		printk(KERN_WARNING "pcifront: resource magic mismatch\n");
+		dev_warn(&pdev->xdev->dev,
+			 "pcifront: resource magic mismatch\n");
 		return;
 	}
 
@@ -104,9 +105,9 @@ static void pcifront_init_sd(struct pcif
 		err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str,
 				   "%s", buf);
 		if (err != 1) {
-			printk(KERN_WARNING "pcifront: error reading "
-			       "resource %d on bus %04x:%02x\n",
-			       j, domain, bus);
+			dev_warn(&pdev->xdev->dev,
+				 "pcifront: error reading resource %d on bus %04x:%02x\n",
+				 j, domain, bus);
 			continue;
 		}
 
@@ -128,8 +129,11 @@ static void pcifront_init_sd(struct pcif
 		sd->windows++;
 	}
 	kfree(buf);
+#else
+	sd->domain = domain;
+	sd->pdev = pdev;
+#endif
 }
-#endif
 
 static int errno_to_pcibios_err(int errno)
 {
@@ -215,8 +219,7 @@ static int do_pci_op(struct pcifront_dev
 	*/
 	if (test_bit(_XEN_PCIB_active, 
 			(unsigned long*)&pdev->sh_info->flags)) {
-		dev_err(&pdev->xdev->dev, 
-			"schedule aer pcifront service\n");
+		dev_info(&pdev->xdev->dev, "schedule aer pcifront service\n");
 		schedule_pcifront_aer_op(pdev);
 	}
 
@@ -230,9 +233,9 @@ static int do_pci_op(struct pcifront_dev
 
 /* Access to this function is spinlocked in drivers/pci/access.c */
 static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn,
-			     int where, int size, u32 * val)
+			     int where, int size, u32 *val)
 {
-	int err = 0;
+	int err;
 	struct xen_pci_op op = {
 		.cmd    = XEN_PCI_OP_conf_read,
 		.domain = pci_domain_nr(bus),
@@ -245,24 +248,24 @@ static int pcifront_bus_read(struct pci_
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
 	if (verbose_request)
-		dev_info(&pdev->xdev->dev,
-			 "read dev=%04x:%02x:%02x.%01x - offset %x size %d\n",
-			 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
-			 PCI_FUNC(devfn), where, size);
+		dev_info(&pdev->xdev->dev, "read %02x.%u offset %x size %d\n",
+			 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size);
 
 	err = do_pci_op(pdev, &op);
 
 	if (likely(!err)) {
 		if (verbose_request)
-			dev_info(&pdev->xdev->dev, "read got back value %x\n",
-				 op.value);
+			dev_info(&pdev->xdev->dev, "read %02x.%u = %x\n",
+				 PCI_SLOT(devfn), PCI_FUNC(devfn), op.value);
 
 		*val = op.value;
 	} else if (err == -ENODEV) {
 		/* No device here, pretend that it just returned 0 */
 		err = 0;
 		*val = 0;
-	}
+	} else if (verbose_request)
+		dev_info(&pdev->xdev->dev, "read %02x.%u -> %d\n",
+			 PCI_SLOT(devfn), PCI_FUNC(devfn), err);
 
 	return errno_to_pcibios_err(err);
 }
@@ -285,15 +288,13 @@ static int pcifront_bus_write(struct pci
 
 	if (verbose_request)
 		dev_info(&pdev->xdev->dev,
-			 "write dev=%04x:%02x:%02x.%01x - "
-			 "offset %x size %d val %x\n",
-			 pci_domain_nr(bus), bus->number,
+			 "write %02x.%u offset %x size %d val %x\n",
 			 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val);
 
 	return errno_to_pcibios_err(do_pci_op(pdev, &op));
 }
 
-struct pci_ops pcifront_bus_ops = {
+static struct pci_ops pcifront_bus_ops = {
 	.read = pcifront_bus_read,
 	.write = pcifront_bus_write,
 };
@@ -315,8 +316,9 @@ int pci_frontend_enable_msix(struct pci_
 	struct pcifront_sd *sd = dev->bus->sysdata;
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
-	if (nvec > SH_INFO_MAX_VEC) {
-		printk("too much vector for pci frontend%x\n", nvec);
+	if (nvec < 0 || nvec > SH_INFO_MAX_VEC) {
+		dev_err(&dev->dev, "too many (%d) vectors for pci frontend\n",
+			nvec);
 		return -EINVAL;
 	}
 
@@ -330,22 +332,20 @@ int pci_frontend_enable_msix(struct pci_
 	if (!err) {
 		if (!op.value) {
 			/* we get the result */
-			for ( i = 0; i < nvec; i++)
+			for (i = 0; i < nvec; i++)
 				entries[i].vector = op.msix_entries[i].vector;
-			return 0;
+		} else {
+			dev_err(&dev->dev, "enable MSI-X => %#x\n", op.value);
+			err = op.value;
 		}
-		else {
-            printk("enable msix get value %x\n", op.value);
-			return op.value;
-		}
+	} else {
+		dev_err(&dev->dev, "enable MSI-X -> %d\n", err);
+		err = -EINVAL;
 	}
-	else {
-        printk("enable msix get err %x\n", err);
-		return err;
-	}
+	return err;
 }
 
-void pci_frontend_disable_msix(struct pci_dev* dev)
+void pci_frontend_disable_msix(struct pci_dev *dev)
 {
 	int err;
 	struct xen_pci_op op = {
@@ -361,7 +361,7 @@ void pci_frontend_disable_msix(struct pc
 
 	/* What should do for error ? */
 	if (err)
-		printk("pci_disable_msix get err %x\n", err);
+		dev_err(&dev->dev, "disable MSI-X -> %d\n", err);
 }
 
 int pci_frontend_enable_msi(struct pci_dev *dev)
@@ -377,18 +377,16 @@ int pci_frontend_enable_msi(struct pci_d
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
 	err = do_pci_op(pdev, &op);
-	if (likely(!err)) {
+	if (likely(!err))
 		dev->irq = op.value;
-	}
 	else {
-		printk("pci frontend enable msi failed for dev %x:%x \n",
-				op.bus, op.devfn);
+		dev_err(&dev->dev, "enable MSI -> %d\n", err);
 		err = -EINVAL;
 	}
 	return err;
 }
 
-void pci_frontend_disable_msi(struct pci_dev* dev)
+void pci_frontend_disable_msi(struct pci_dev *dev)
 {
 	int err;
 	struct xen_pci_op op = {
@@ -401,16 +399,10 @@ void pci_frontend_disable_msi(struct pci
 	struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
 	err = do_pci_op(pdev, &op);
-	if (err == XEN_PCI_ERR_dev_not_found) {
-		/* XXX No response from backend, what shall we do? */
-		printk("get no response from backend for disable MSI\n");
-		return;
-	}
 	if (likely(!err))
 		dev->irq = op.value;
 	else
-		/* how can pciback notify us fail? */
-		printk("get fake response frombackend \n");
+		dev_err(&dev->dev, "disable MSI -> %d\n", err);
 }
 #endif /* CONFIG_PCI_MSI */
 
@@ -436,18 +428,17 @@ int __devinit pcifront_scan_root(struct 
 				 unsigned int domain, unsigned int bus)
 {
 	struct pci_bus *b;
-	struct pcifront_sd *sd = NULL;
-	struct pci_bus_entry *bus_entry = NULL;
+	struct pcifront_sd *sd;
+	struct pci_bus_entry *bus_entry;
 	int err = 0;
 
 #ifndef CONFIG_PCI_DOMAINS
 	if (domain != 0) {
 		dev_err(&pdev->xdev->dev,
-			"PCI Root in non-zero PCI Domain! domain=%d\n", domain);
+			"PCI root in non-zero domain %x!\n", domain);
 		dev_err(&pdev->xdev->dev,
 			"Please compile with CONFIG_PCI_DOMAINS\n");
-		err = -EINVAL;
-		goto err_out;
+		return -EINVAL;
 	}
 #endif
 
@@ -500,7 +491,7 @@ int __devinit pcifront_rescan_root(struc
 #ifndef CONFIG_PCI_DOMAINS
 	if (domain != 0) {
 		dev_err(&pdev->xdev->dev,
-			"PCI Root in non-zero PCI Domain! domain=%d\n", domain);
+			"PCI root in non-zero domain %x\n", domain);
 		dev_err(&pdev->xdev->dev,
 			"Please compile with CONFIG_PCI_DOMAINS\n");
 		return -EINVAL;
@@ -529,8 +520,9 @@ int __devinit pcifront_rescan_root(struc
 
 		d = pci_scan_single_device(b, devfn);
 		if (d)
-			dev_info(&pdev->xdev->dev, "New device on "
-				 "%04x:%02x:%02x.%02x found.\n", domain, bus,
+			dev_info(&pdev->xdev->dev,
+				 "New device on %04x:%02x:%02x.%u\n",
+				 domain, bus,
 				 PCI_SLOT(devfn), PCI_FUNC(devfn));
 	}
 
@@ -586,7 +578,7 @@ static pci_ers_result_t pcifront_common_
 	int flag = 0;
 
 	dev_dbg(&pdev->xdev->dev, 
-		"pcifront AER process: cmd %x (bus:%x, devfn%x)",
+		"pcifront AER process: cmd %x (bus %x devfn %x)",
 		cmd, bus, devfn);
 	result = PCI_ERS_RESULT_NONE;
 
@@ -619,8 +611,9 @@ static pci_ers_result_t pcifront_common_
 					break;
 				default:
 					dev_err(&pdev->xdev->dev,
-						"bad request in aer recovery operation!\n");
-
+						"bad request %x in aer recovery operation!\n",
+						cmd);
+					break;
 				}
 			}
 		}
diff -r 80a3bc79579e -r f523a98343a9 include/xen/pcifront.h
--- a/include/xen/pcifront.h	Wed Mar 28 15:21:23 2012 +0200
+++ b/include/xen/pcifront.h	Mon Apr 02 14:47:52 2012 +0200
@@ -26,14 +26,6 @@ pcifront_get_pdev(struct pcifront_sd *sd
 	return sd->pdev;
 }
 
-static inline void pcifront_init_sd(struct pcifront_sd *sd,
-				    unsigned int domain, unsigned int bus,
-				    struct pcifront_device *pdev)
-{
-	sd->domain = domain;
-	sd->pdev = pdev;
-}
-
 #if defined(CONFIG_PCI_DOMAINS)
 static inline int pci_domain_nr(struct pci_bus *bus)
 {

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 16:55:12 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 16:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEkX5-0007Mz-C9; Mon, 02 Apr 2012 16:55:07 +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 1SEkX4-0007Mt-58
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 16:55:06 +0000
Received: from [85.158.143.99:38968] by server-2.bemta-4.messagelabs.com id
	35/D5-17550-9E9D97F4; Mon, 02 Apr 2012 16:55:05 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-2.tower-216.messagelabs.com!1333385703!23422996!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7022 invoked from network); 2 Apr 2012 16:55:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Apr 2012 16:55:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkX1-0008Sv-AQ
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 16:55:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkX1-0005v4-5P
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 16:55:03 +0000
Date: Mon, 02 Apr 2012 16:55:03 +0000
Message-Id: <E1SEkX1-0005v4-5P@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-traditional/passthrough:
	adjust MSI-X device cleanup (bug 1809)
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 29996060f617f9a363559fb8ae6bce590c45180e
Author: Jan Beulich <JBeulich@suse.com>
Date:   Mon Apr 2 17:35:36 2012 +0100

    qemu-traditional/passthrough: adjust MSI-X device cleanup (bug 1809)
    
    To address http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1809,
    pt_unregister_regions() also needs to use the newly introduced
    _pt_iomem_helper() instead of calling xc_domain_memory_mapping()
    directly, to take into consideration the hole created for the MSI-X
    table.
    
    For this to work, two calls in unregister_real_device() need to be
    swapped, since otherwise we'd have
    
    unregister_real_device()
      -> pt_config_delete()
        -> pt_msix_delete() (frees [and fails to clear] ->msix)
      -> pt_unregister_regions()
        -> _pt_iomem_helper() (with the patch below)
          -> has_msix_mapping() (uses ->msix)
    
    And to be certain to prevent (catch) further/future use-after-free
    instances, let's also clear dev->msix in pt_msix_delete().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Yongjie Ren <yongjie.ren@intel.com>
    Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/pass-through.c |   14 ++++++--------
 hw/pt-msi.c       |    1 +
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/hw/pass-through.c b/hw/pass-through.c
index dbe8804..f832c5a 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -1969,11 +1969,9 @@ static void pt_unregister_regions(struct pt_dev *assigned_device)
         if ( type == PCI_ADDRESS_SPACE_MEM ||
              type == PCI_ADDRESS_SPACE_MEM_PREFETCH )
         {
-            ret = xc_domain_memory_mapping(xc_handle, domid,
-                    assigned_device->bases[i].e_physbase >> XC_PAGE_SHIFT,
-                    assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT,
-                    (e_size+XC_PAGE_SIZE-1) >> XC_PAGE_SHIFT,
-                    DPCI_REMOVE_MAPPING);
+            ret = _pt_iomem_helper(assigned_device, i,
+                                   assigned_device->bases[i].e_physbase,
+                                   e_size, DPCI_REMOVE_MAPPING);
             if ( ret != 0 )
             {
                 PT_LOG("Error: remove old mem mapping failed!\n");
@@ -4393,12 +4391,12 @@ static int unregister_real_device(int devfn)
         }
     }
 
-    /* delete all emulated config registers */
-    pt_config_delete(assigned_device);
-
     /* unregister real device's MMIO/PIO BARs */
     pt_unregister_regions(assigned_device);
 
+    /* delete all emulated config registers */
+    pt_config_delete(assigned_device);
+
     pt_iomul_free(assigned_device);
 
     /* mark this devfn as free */
diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index f95f6c0..70c4023 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -627,4 +627,5 @@ void pt_msix_delete(struct pt_dev *dev)
 
 
     free(dev->msix);
+    dev->msix = NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 16:55:12 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 16:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEkX5-0007Mz-C9; Mon, 02 Apr 2012 16:55:07 +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 1SEkX4-0007Mt-58
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 16:55:06 +0000
Received: from [85.158.143.99:38968] by server-2.bemta-4.messagelabs.com id
	35/D5-17550-9E9D97F4; Mon, 02 Apr 2012 16:55:05 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-2.tower-216.messagelabs.com!1333385703!23422996!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7022 invoked from network); 2 Apr 2012 16:55:04 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Apr 2012 16:55:04 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkX1-0008Sv-AQ
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 16:55:03 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkX1-0005v4-5P
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 16:55:03 +0000
Date: Mon, 02 Apr 2012 16:55:03 +0000
Message-Id: <E1SEkX1-0005v4-5P@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-traditional/passthrough:
	adjust MSI-X device cleanup (bug 1809)
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 29996060f617f9a363559fb8ae6bce590c45180e
Author: Jan Beulich <JBeulich@suse.com>
Date:   Mon Apr 2 17:35:36 2012 +0100

    qemu-traditional/passthrough: adjust MSI-X device cleanup (bug 1809)
    
    To address http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1809,
    pt_unregister_regions() also needs to use the newly introduced
    _pt_iomem_helper() instead of calling xc_domain_memory_mapping()
    directly, to take into consideration the hole created for the MSI-X
    table.
    
    For this to work, two calls in unregister_real_device() need to be
    swapped, since otherwise we'd have
    
    unregister_real_device()
      -> pt_config_delete()
        -> pt_msix_delete() (frees [and fails to clear] ->msix)
      -> pt_unregister_regions()
        -> _pt_iomem_helper() (with the patch below)
          -> has_msix_mapping() (uses ->msix)
    
    And to be certain to prevent (catch) further/future use-after-free
    instances, let's also clear dev->msix in pt_msix_delete().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Yongjie Ren <yongjie.ren@intel.com>
    Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/pass-through.c |   14 ++++++--------
 hw/pt-msi.c       |    1 +
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/hw/pass-through.c b/hw/pass-through.c
index dbe8804..f832c5a 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -1969,11 +1969,9 @@ static void pt_unregister_regions(struct pt_dev *assigned_device)
         if ( type == PCI_ADDRESS_SPACE_MEM ||
              type == PCI_ADDRESS_SPACE_MEM_PREFETCH )
         {
-            ret = xc_domain_memory_mapping(xc_handle, domid,
-                    assigned_device->bases[i].e_physbase >> XC_PAGE_SHIFT,
-                    assigned_device->bases[i].access.maddr >> XC_PAGE_SHIFT,
-                    (e_size+XC_PAGE_SIZE-1) >> XC_PAGE_SHIFT,
-                    DPCI_REMOVE_MAPPING);
+            ret = _pt_iomem_helper(assigned_device, i,
+                                   assigned_device->bases[i].e_physbase,
+                                   e_size, DPCI_REMOVE_MAPPING);
             if ( ret != 0 )
             {
                 PT_LOG("Error: remove old mem mapping failed!\n");
@@ -4393,12 +4391,12 @@ static int unregister_real_device(int devfn)
         }
     }
 
-    /* delete all emulated config registers */
-    pt_config_delete(assigned_device);
-
     /* unregister real device's MMIO/PIO BARs */
     pt_unregister_regions(assigned_device);
 
+    /* delete all emulated config registers */
+    pt_config_delete(assigned_device);
+
     pt_iomul_free(assigned_device);
 
     /* mark this devfn as free */
diff --git a/hw/pt-msi.c b/hw/pt-msi.c
index f95f6c0..70c4023 100644
--- a/hw/pt-msi.c
+++ b/hw/pt-msi.c
@@ -627,4 +627,5 @@ void pt_msix_delete(struct pt_dev *dev)
 
 
     free(dev->msix);
+    dev->msix = NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 17:11:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 17:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEkma-00086n-AT; Mon, 02 Apr 2012 17:11:08 +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 1SEkmZ-00086c-1I
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:07 +0000
Received: from [85.158.143.99:35396] by server-3.bemta-4.messagelabs.com id
	04/B3-05853-AADD97F4; Mon, 02 Apr 2012 17:11:06 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-12.tower-216.messagelabs.com!1333386664!16732922!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24741 invoked from network); 2 Apr 2012 17:11:05 -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;
	2 Apr 2012 17:11:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmW-0000F7-9F
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmV-0006Mi-O4
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:03 +0000
Date: Mon, 02 Apr 2012 17:11:03 +0000
Message-Id: <E1SEkmV-0006Mi-O4@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 1307e42a4b3c1102d75401bc0cffb4eb6c9b7a38
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Mon Apr 2 17:54:08 2012 +0100

    qemu-xen-traditional: use O_DIRECT to open disk images for IDE
    
    [ Major performance fix. -iwj ]
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 xenstore.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xenstore.c b/xenstore.c
index 4c483e2..ac90366 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_CACHE_WB; /* snapshot and write-back */
+            flags = BDRV_O_NOCACHE;
             is_readonly = 0;
             if (pasprintf(&buf, "%s/mode", bpath) == -1)
                 continue;
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 17:11:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 17:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEkma-00086n-AT; Mon, 02 Apr 2012 17:11:08 +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 1SEkmZ-00086c-1I
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:07 +0000
Received: from [85.158.143.99:35396] by server-3.bemta-4.messagelabs.com id
	04/B3-05853-AADD97F4; Mon, 02 Apr 2012 17:11:06 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-12.tower-216.messagelabs.com!1333386664!16732922!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24741 invoked from network); 2 Apr 2012 17:11:05 -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;
	2 Apr 2012 17:11:05 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmW-0000F7-9F
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmV-0006Mi-O4
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:03 +0000
Date: Mon, 02 Apr 2012 17:11:03 +0000
Message-Id: <E1SEkmV-0006Mi-O4@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 1307e42a4b3c1102d75401bc0cffb4eb6c9b7a38
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Mon Apr 2 17:54:08 2012 +0100

    qemu-xen-traditional: use O_DIRECT to open disk images for IDE
    
    [ Major performance fix. -iwj ]
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 xenstore.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xenstore.c b/xenstore.c
index 4c483e2..ac90366 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_CACHE_WB; /* snapshot and write-back */
+            flags = BDRV_O_NOCACHE;
             is_readonly = 0;
             if (pasprintf(&buf, "%s/mode", bpath) == -1)
                 continue;
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 17:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 17: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 1SEkmk-00087a-DK; Mon, 02 Apr 2012 17:11:18 +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 1SEkmj-00087P-0D
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:17 +0000
Received: from [85.158.143.99:35863] by server-1.bemta-4.messagelabs.com id
	E0/13-20925-4BDD97F4; Mon, 02 Apr 2012 17:11:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-216.messagelabs.com!1333386674!15617306!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4408 invoked from network); 2 Apr 2012 17:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Apr 2012 17:11:15 -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 1SEkmg-0000FF-Gs
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmg-0006NF-By
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:14 +0000
Date: Mon, 02 Apr 2012 17:11:14 +0000
Message-Id: <E1SEkmg-0006NF-By@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-xen-traditional: use
	O_DIRECT to open disk images with QDISK
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 0efae2f1fe8f72628c58b3683f62725a613fcec3
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Mon Apr 2 17:54:36 2012 +0100

    qemu-xen-traditional: use O_DIRECT to open disk images with QDISK
    
    Also enable batch_maps, use_aio and disable syncwrite.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 hw/xen_disk.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 6aebb77..b1d6985 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -46,11 +46,11 @@
 
 /* ------------------------------------------------------------- */
 
-static int syncwrite    = 1;
-static int batch_maps   = 0;
+static int syncwrite    = 0;
+static int batch_maps   = 1;
 
 static int max_requests = 32;
-static int use_aio      = 0;
+static int use_aio      = 1;
 
 /* ------------------------------------------------------------- */
 
@@ -617,12 +617,13 @@ static int blk_init(struct XenDevice *xendev)
 	return -1;
 
     /* read-only ? */
+    qflags = BDRV_O_NOCACHE;
     if (strcmp(blkdev->mode, "w") == 0) {
 	mode   = O_RDWR;
-	qflags = BDRV_O_RDWR;
+	qflags |= BDRV_O_RDWR;
     } else {
 	mode   = O_RDONLY;
-	qflags = BDRV_O_RDONLY;
+	qflags |= BDRV_O_RDONLY;
 	info  |= VDISK_READONLY;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 17:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 17: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 1SEkmk-00087a-DK; Mon, 02 Apr 2012 17:11:18 +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 1SEkmj-00087P-0D
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:17 +0000
Received: from [85.158.143.99:35863] by server-1.bemta-4.messagelabs.com id
	E0/13-20925-4BDD97F4; Mon, 02 Apr 2012 17:11:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-216.messagelabs.com!1333386674!15617306!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4408 invoked from network); 2 Apr 2012 17:11:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Apr 2012 17:11:15 -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 1SEkmg-0000FF-Gs
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmg-0006NF-By
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:14 +0000
Date: Mon, 02 Apr 2012 17:11:14 +0000
Message-Id: <E1SEkmg-0006NF-By@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-xen-traditional: use
	O_DIRECT to open disk images with QDISK
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 0efae2f1fe8f72628c58b3683f62725a613fcec3
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Mon Apr 2 17:54:36 2012 +0100

    qemu-xen-traditional: use O_DIRECT to open disk images with QDISK
    
    Also enable batch_maps, use_aio and disable syncwrite.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 hw/xen_disk.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 6aebb77..b1d6985 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -46,11 +46,11 @@
 
 /* ------------------------------------------------------------- */
 
-static int syncwrite    = 1;
-static int batch_maps   = 0;
+static int syncwrite    = 0;
+static int batch_maps   = 1;
 
 static int max_requests = 32;
-static int use_aio      = 0;
+static int use_aio      = 1;
 
 /* ------------------------------------------------------------- */
 
@@ -617,12 +617,13 @@ static int blk_init(struct XenDevice *xendev)
 	return -1;
 
     /* read-only ? */
+    qflags = BDRV_O_NOCACHE;
     if (strcmp(blkdev->mode, "w") == 0) {
 	mode   = O_RDWR;
-	qflags = BDRV_O_RDWR;
+	qflags |= BDRV_O_RDWR;
     } else {
 	mode   = O_RDONLY;
-	qflags = BDRV_O_RDONLY;
+	qflags |= BDRV_O_RDONLY;
 	info  |= VDISK_READONLY;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 17:11:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 17:11:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEkmu-00088d-GL; Mon, 02 Apr 2012 17:11:28 +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 1SEkmt-00088P-7m
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:27 +0000
Received: from [85.158.143.99:36397] by server-1.bemta-4.messagelabs.com id
	BE/23-20925-EBDD97F4; Mon, 02 Apr 2012 17:11:26 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-216.messagelabs.com!1333386684!21664137!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31955 invoked from network); 2 Apr 2012 17:11:25 -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 Apr 2012 17:11:25 -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 1SEkmq-0000FM-Lt
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmq-0006Nb-KG
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:24 +0000
Date: Mon, 02 Apr 2012 17:11:24 +0000
Message-Id: <E1SEkmq-0006Nb-KG@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-xen-traditional: QDISK
	fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit f0fad5549f8103fc0130d3121eb5f7913c5bc2a9
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Mon Apr 2 17:55:05 2012 +0100

    qemu-xen-traditional: QDISK fixes
    
    - if ioreq->postsync call bdrv_flush when the operation is actually
      completed;
    - do not increment aio_inflight when not submitting any operations.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 hw/xen_disk.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index b1d6985..5db58ac 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -382,6 +382,8 @@ static void qemu_aio_complete(void *opaque, int ret)
     ioreq->aio_inflight--;
     if (ioreq->aio_inflight > 0)
         return;
+    if (ioreq->postsync)
+	bdrv_flush(ioreq->blkdev->bs);
 
     ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
     ioreq_unmap(ioreq);
@@ -409,9 +411,9 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
 	break;
     case BLKIF_OP_WRITE:
     case BLKIF_OP_WRITE_BARRIER:
-        ioreq->aio_inflight++;
         if (!ioreq->req.nr_segments)
             break;
+        ioreq->aio_inflight++;
         bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE,
                         &ioreq->v, ioreq->v.size / BLOCK_SIZE,
                         qemu_aio_complete, ioreq);
@@ -421,8 +423,6 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
 	goto err;
     }
 
-    if (ioreq->postsync)
-	bdrv_flush(blkdev->bs); /* FIXME: aio_flush() ??? */
     qemu_aio_complete(ioreq, 0);
 
     return 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 17:11:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 17:11:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SEkmu-00088d-GL; Mon, 02 Apr 2012 17:11:28 +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 1SEkmt-00088P-7m
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:27 +0000
Received: from [85.158.143.99:36397] by server-1.bemta-4.messagelabs.com id
	BE/23-20925-EBDD97F4; Mon, 02 Apr 2012 17:11:26 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-216.messagelabs.com!1333386684!21664137!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31955 invoked from network); 2 Apr 2012 17:11:25 -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 Apr 2012 17:11:25 -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 1SEkmq-0000FM-Lt
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SEkmq-0006Nb-KG
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 17:11:24 +0000
Date: Mon, 02 Apr 2012 17:11:24 +0000
Message-Id: <E1SEkmq-0006Nb-KG@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-xen-traditional: QDISK
	fixes
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit f0fad5549f8103fc0130d3121eb5f7913c5bc2a9
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Mon Apr 2 17:55:05 2012 +0100

    qemu-xen-traditional: QDISK fixes
    
    - if ioreq->postsync call bdrv_flush when the operation is actually
      completed;
    - do not increment aio_inflight when not submitting any operations.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 hw/xen_disk.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index b1d6985..5db58ac 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -382,6 +382,8 @@ static void qemu_aio_complete(void *opaque, int ret)
     ioreq->aio_inflight--;
     if (ioreq->aio_inflight > 0)
         return;
+    if (ioreq->postsync)
+	bdrv_flush(ioreq->blkdev->bs);
 
     ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
     ioreq_unmap(ioreq);
@@ -409,9 +411,9 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
 	break;
     case BLKIF_OP_WRITE:
     case BLKIF_OP_WRITE_BARRIER:
-        ioreq->aio_inflight++;
         if (!ioreq->req.nr_segments)
             break;
+        ioreq->aio_inflight++;
         bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE,
                         &ioreq->v, ioreq->v.size / BLOCK_SIZE,
                         qemu_aio_complete, ioreq);
@@ -421,8 +423,6 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
 	goto err;
     }
 
-    if (ioreq->postsync)
-	bdrv_flush(blkdev->bs); /* FIXME: aio_flush() ??? */
     qemu_aio_complete(ioreq, 0);
 
     return 0;
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 20:55:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 20:55: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 1SEoHR-00012w-A3; Mon, 02 Apr 2012 20:55: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 1SEoHQ-00012f-M6
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:12 +0000
Received: from [85.158.143.99:57013] by server-2.bemta-4.messagelabs.com id
	3E/7D-17550-F221A7F4; Mon, 02 Apr 2012 20:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1333400109!21955071!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20840 invoked from network); 2 Apr 2012 20:55: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;
	2 Apr 2012 20: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 1SEoHN-00033V-Bb
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHN-00034T-6C
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Message-Id: <E1SEoHN-00034T-6C@xenbits.xen.org>
Date: Mon, 02 Apr 2012 20:55:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: missing unlock in GIC error path
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333360445 -3600
# Node ID 0346309b3c3f89f6aaac096f23b07a082cd736b4
# Parent  64b69baaaf2fd274fe9daa46108fa6facd7ead5d
arm: missing unlock in GIC error path

Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 64b69baaaf2f -r 0346309b3c3f xen/arch/arm/gic.c
--- a/xen/arch/arm/gic.c	Mon Apr 02 10:54:04 2012 +0100
+++ b/xen/arch/arm/gic.c	Mon Apr 02 10:54:05 2012 +0100
@@ -149,6 +149,7 @@ static int gic_route_irq(unsigned int ir
 
     if ( desc->action != NULL )
     {
+        spin_unlock(&gic.lock);
         spin_unlock(&desc->lock);
         return -EBUSY;
     }

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 20:55:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 20:55: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 1SEoHR-00012w-A3; Mon, 02 Apr 2012 20:55: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 1SEoHQ-00012f-M6
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:12 +0000
Received: from [85.158.143.99:57013] by server-2.bemta-4.messagelabs.com id
	3E/7D-17550-F221A7F4; Mon, 02 Apr 2012 20:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1333400109!21955071!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20840 invoked from network); 2 Apr 2012 20:55: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;
	2 Apr 2012 20: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 1SEoHN-00033V-Bb
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHN-00034T-6C
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Message-Id: <E1SEoHN-00034T-6C@xenbits.xen.org>
Date: Mon, 02 Apr 2012 20:55:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: missing unlock in GIC error path
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333360445 -3600
# Node ID 0346309b3c3f89f6aaac096f23b07a082cd736b4
# Parent  64b69baaaf2fd274fe9daa46108fa6facd7ead5d
arm: missing unlock in GIC error path

Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 64b69baaaf2f -r 0346309b3c3f xen/arch/arm/gic.c
--- a/xen/arch/arm/gic.c	Mon Apr 02 10:54:04 2012 +0100
+++ b/xen/arch/arm/gic.c	Mon Apr 02 10:54:05 2012 +0100
@@ -149,6 +149,7 @@ static int gic_route_irq(unsigned int ir
 
     if ( desc->action != NULL )
     {
+        spin_unlock(&gic.lock);
         spin_unlock(&desc->lock);
         return -EBUSY;
     }

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 20:55:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 20:55: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 1SEoHR-00012r-7U; Mon, 02 Apr 2012 20:55: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 1SEoHQ-00012e-DU
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:12 +0000
Received: from [85.158.139.83:59117] by server-12.bemta-5.messagelabs.com id
	13/0D-05587-F221A7F4; Mon, 02 Apr 2012 20:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1333400109!22136799!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23007 invoked from network); 2 Apr 2012 20:55:10 -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;
	2 Apr 2012 20: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 1SEoHN-00033S-3Y
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHM-00034E-LU
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:08 +0000
Message-Id: <E1SEoHM-00034E-LU@xenbits.xen.org>
Date: Mon, 02 Apr 2012 20:55:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: remove code that sets current
	to itself
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333360444 -3600
# Node ID 64b69baaaf2fd274fe9daa46108fa6facd7ead5d
# Parent  1088c8557a46ab28e509bb9482e2a73a21590df8
arm: remove code that sets current to itself

Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 1088c8557a46 -r 64b69baaaf2f xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Fri Mar 30 21:05:54 2012 +0100
+++ b/xen/arch/arm/smpboot.c	Mon Apr 02 10:54:04 2012 +0100
@@ -108,7 +108,6 @@ void __cpuinit start_secondary(unsigned 
     gic_init_secondary_cpu();
 
     set_current(idle_vcpu[cpuid]);
-    this_cpu(curr_vcpu) = current;
 
     /* Run local notifiers */
     notify_cpu_starting(cpuid);

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 20:55:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 20:55: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 1SEoHR-00012r-7U; Mon, 02 Apr 2012 20:55: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 1SEoHQ-00012e-DU
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:12 +0000
Received: from [85.158.139.83:59117] by server-12.bemta-5.messagelabs.com id
	13/0D-05587-F221A7F4; Mon, 02 Apr 2012 20:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1333400109!22136799!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23007 invoked from network); 2 Apr 2012 20:55:10 -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;
	2 Apr 2012 20: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 1SEoHN-00033S-3Y
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHM-00034E-LU
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:08 +0000
Message-Id: <E1SEoHM-00034E-LU@xenbits.xen.org>
Date: Mon, 02 Apr 2012 20:55:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: remove code that sets current
	to itself
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333360444 -3600
# Node ID 64b69baaaf2fd274fe9daa46108fa6facd7ead5d
# Parent  1088c8557a46ab28e509bb9482e2a73a21590df8
arm: remove code that sets current to itself

Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 1088c8557a46 -r 64b69baaaf2f xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Fri Mar 30 21:05:54 2012 +0100
+++ b/xen/arch/arm/smpboot.c	Mon Apr 02 10:54:04 2012 +0100
@@ -108,7 +108,6 @@ void __cpuinit start_secondary(unsigned 
     gic_init_secondary_cpu();
 
     set_current(idle_vcpu[cpuid]);
-    this_cpu(curr_vcpu) = current;
 
     /* Run local notifiers */
     notify_cpu_starting(cpuid);

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 20:55:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 20: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 1SEoHT-00013U-F0; Mon, 02 Apr 2012 20:55:15 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHS-00013A-2B
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:14 +0000
Received: from [85.158.143.35:38905] by server-1.bemta-4.messagelabs.com id
	E0/EC-20925-1321A7F4; Mon, 02 Apr 2012 20:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1333400110!14339945!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20541 invoked from network); 2 Apr 2012 20:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Apr 2012 20: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 1SEoHN-00033Y-W3
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHN-00034i-Nd
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Message-Id: <E1SEoHN-00034i-Nd@xenbits.xen.org>
Date: Mon, 02 Apr 2012 20:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Use HTPIDR to point to per-CPU
	state
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333360445 -3600
# Node ID d90c658de78ac5c50f1b9c175167c9f94e683829
# Parent  0346309b3c3f89f6aaac096f23b07a082cd736b4
arm: Use HTPIDR to point to per-CPU state

Rather than having the per-VCPU stack contain a pointer to the
per-PCPU state, use the CPU's hypervisor thread ID register for that.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
[ s/cpuid/id in set_processor_id -- ijc ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 0346309b3c3f -r d90c658de78a xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/setup.c	Mon Apr 02 10:54:05 2012 +0100
@@ -167,7 +167,7 @@ void __init start_xen(unsigned long boot
 
     percpu_init_areas();
     set_processor_id(0); /* needed early, for smp_processor_id() */
-    __set_current((struct vcpu *)0xfffff000); /* debug sanity */
+    set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;
 
     smp_prepare_cpus(cpus);
diff -r 0346309b3c3f -r d90c658de78a xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/smpboot.c	Mon Apr 02 10:54:05 2012 +0100
@@ -49,6 +49,9 @@ static bool_t cpu_is_dead = 0;
 /* Number of non-boot CPUs ready to enter C */
 unsigned long __initdata ready_cpus = 0;
 
+/* ID of the PCPU we're running on */
+DEFINE_PER_CPU(unsigned int, cpu_id);
+
 void __init
 smp_prepare_cpus (unsigned int max_cpus)
 {
@@ -102,8 +105,6 @@ void __cpuinit start_secondary(unsigned 
     /* Setup Hyp vector base */
     WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
 
-    dprintk(XENLOG_DEBUG, "CPU %li awake.\n", cpuid);
-
     mmu_init_secondary_cpu();
     gic_init_secondary_cpu();
 
@@ -119,7 +120,7 @@ void __cpuinit start_secondary(unsigned 
 
     local_irq_enable();
 
-    dprintk(XENLOG_DEBUG, "CPU %li booted.\n", cpuid);
+    dprintk(XENLOG_DEBUG, "CPU %u booted.\n", smp_processor_id());
 
     startup_cpu_idle_loop();
 }
diff -r 0346309b3c3f -r d90c658de78a xen/include/asm-arm/cpregs.h
--- a/xen/include/asm-arm/cpregs.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/asm-arm/cpregs.h	Mon Apr 02 10:54:05 2012 +0100
@@ -198,6 +198,7 @@
 /* CP15 CR13:  */
 #define FCSEIDR         p15,0,c13,c0,0  /* FCSE Process ID Register */
 #define CONTEXTIDR      p15,0,c13,c0,1  /* Context ID Register */
+#define HTPIDR          p15,4,c13,c0,2  /* Hyp. Software Thread ID Register */
 
 /* CP15 CR14:  */
 #define CNTPCT          p15,0,c14       /* Time counter value */
diff -r 0346309b3c3f -r d90c658de78a xen/include/asm-arm/current.h
--- a/xen/include/asm-arm/current.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/asm-arm/current.h	Mon Apr 02 10:54:05 2012 +0100
@@ -11,17 +11,16 @@
 
 struct vcpu;
 
-/*
- * Which VCPU is "current" on this PCPU.
- */
+/* Which VCPU is "current" on this PCPU. */
 DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 
+#define current            (this_cpu(curr_vcpu))
+#define set_current(vcpu)  do { current = (vcpu); } while (0)
+
+/* Per-VCPU state that lives at the top of the stack */
 struct cpu_info {
     struct cpu_user_regs guest_cpu_user_regs;
     unsigned long elr;
-    /* The following are valid iff this VCPU is current */
-    unsigned int processor_id;
-    unsigned long per_cpu_offset;
     unsigned int pad;
 };
 
@@ -31,22 +30,6 @@ static inline struct cpu_info *get_cpu_i
     return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
 }
 
-#define get_processor_id()    (get_cpu_info()->processor_id)
-#define set_processor_id(id)  do {                                      \
-    struct cpu_info *ci__ = get_cpu_info();                             \
-    ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
-} while (0)
-
-#define get_current()         (this_cpu(curr_vcpu))
-#define __set_current(vcpu)   (this_cpu(curr_vcpu) = (vcpu))
-#define set_current(vcpu)     do {                                      \
-    int cpu = get_processor_id();                                       \
-    vcpu->arch.cpu_info->processor_id = cpu;                            \
-    vcpu->arch.cpu_info->per_cpu_offset = __per_cpu_offset[cpu];        \
-    __set_current(vcpu);                                                \
-} while (0)
-#define current               (get_current())
-
 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
 
 #define switch_stack_and_jump(stack, fn)                                \
diff -r 0346309b3c3f -r d90c658de78a xen/include/asm-arm/percpu.h
--- a/xen/include/asm-arm/percpu.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/asm-arm/percpu.h	Mon Apr 02 10:54:05 2012 +0100
@@ -5,7 +5,6 @@
 extern char __per_cpu_start[], __per_cpu_data_end[];
 extern unsigned long __per_cpu_offset[NR_CPUS];
 void percpu_init_areas(void);
-#endif
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
@@ -16,10 +15,18 @@ void percpu_init_areas(void);
 #define per_cpu(var, cpu)  \
     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
 #define __get_cpu_var(var) \
-    (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset))
+    (*RELOC_HIDE(&per_cpu__##var, READ_CP32(HTPIDR)))
 
 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
 
+DECLARE_PER_CPU(unsigned int, cpu_id);
+#define get_processor_id()    (this_cpu(cpu_id))
+#define set_processor_id(id)  do {                      \
+    WRITE_CP32(__per_cpu_offset[id], HTPIDR);           \
+    this_cpu(cpu_id) = (id);                            \
+} while(0)
+#endif
+
 #endif /* __ARM_PERCPU_H__ */
 /*
  * Local variables:

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

From xen-changelog-bounces@lists.xen.org Mon Apr 02 20:55:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Apr 2012 20: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 1SEoHT-00013U-F0; Mon, 02 Apr 2012 20:55:15 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHS-00013A-2B
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:14 +0000
Received: from [85.158.143.35:38905] by server-1.bemta-4.messagelabs.com id
	E0/EC-20925-1321A7F4; Mon, 02 Apr 2012 20:55:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1333400110!14339945!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20541 invoked from network); 2 Apr 2012 20:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Apr 2012 20: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 1SEoHN-00033Y-W3
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SEoHN-00034i-Nd
	for xen-changelog@lists.xensource.com; Mon, 02 Apr 2012 20:55:09 +0000
Message-Id: <E1SEoHN-00034i-Nd@xenbits.xen.org>
Date: Mon, 02 Apr 2012 20:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: Use HTPIDR to point to per-CPU
	state
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333360445 -3600
# Node ID d90c658de78ac5c50f1b9c175167c9f94e683829
# Parent  0346309b3c3f89f6aaac096f23b07a082cd736b4
arm: Use HTPIDR to point to per-CPU state

Rather than having the per-VCPU stack contain a pointer to the
per-PCPU state, use the CPU's hypervisor thread ID register for that.

Signed-off-by: Tim Deegan <tim@xen.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
[ s/cpuid/id in set_processor_id -- ijc ]
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 0346309b3c3f -r d90c658de78a xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/setup.c	Mon Apr 02 10:54:05 2012 +0100
@@ -167,7 +167,7 @@ void __init start_xen(unsigned long boot
 
     percpu_init_areas();
     set_processor_id(0); /* needed early, for smp_processor_id() */
-    __set_current((struct vcpu *)0xfffff000); /* debug sanity */
+    set_current((struct vcpu *)0xfffff000); /* debug sanity */
     idle_vcpu[0] = current;
 
     smp_prepare_cpus(cpus);
diff -r 0346309b3c3f -r d90c658de78a xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/smpboot.c	Mon Apr 02 10:54:05 2012 +0100
@@ -49,6 +49,9 @@ static bool_t cpu_is_dead = 0;
 /* Number of non-boot CPUs ready to enter C */
 unsigned long __initdata ready_cpus = 0;
 
+/* ID of the PCPU we're running on */
+DEFINE_PER_CPU(unsigned int, cpu_id);
+
 void __init
 smp_prepare_cpus (unsigned int max_cpus)
 {
@@ -102,8 +105,6 @@ void __cpuinit start_secondary(unsigned 
     /* Setup Hyp vector base */
     WRITE_CP32((uint32_t) hyp_traps_vector, HVBAR);
 
-    dprintk(XENLOG_DEBUG, "CPU %li awake.\n", cpuid);
-
     mmu_init_secondary_cpu();
     gic_init_secondary_cpu();
 
@@ -119,7 +120,7 @@ void __cpuinit start_secondary(unsigned 
 
     local_irq_enable();
 
-    dprintk(XENLOG_DEBUG, "CPU %li booted.\n", cpuid);
+    dprintk(XENLOG_DEBUG, "CPU %u booted.\n", smp_processor_id());
 
     startup_cpu_idle_loop();
 }
diff -r 0346309b3c3f -r d90c658de78a xen/include/asm-arm/cpregs.h
--- a/xen/include/asm-arm/cpregs.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/asm-arm/cpregs.h	Mon Apr 02 10:54:05 2012 +0100
@@ -198,6 +198,7 @@
 /* CP15 CR13:  */
 #define FCSEIDR         p15,0,c13,c0,0  /* FCSE Process ID Register */
 #define CONTEXTIDR      p15,0,c13,c0,1  /* Context ID Register */
+#define HTPIDR          p15,4,c13,c0,2  /* Hyp. Software Thread ID Register */
 
 /* CP15 CR14:  */
 #define CNTPCT          p15,0,c14       /* Time counter value */
diff -r 0346309b3c3f -r d90c658de78a xen/include/asm-arm/current.h
--- a/xen/include/asm-arm/current.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/asm-arm/current.h	Mon Apr 02 10:54:05 2012 +0100
@@ -11,17 +11,16 @@
 
 struct vcpu;
 
-/*
- * Which VCPU is "current" on this PCPU.
- */
+/* Which VCPU is "current" on this PCPU. */
 DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 
+#define current            (this_cpu(curr_vcpu))
+#define set_current(vcpu)  do { current = (vcpu); } while (0)
+
+/* Per-VCPU state that lives at the top of the stack */
 struct cpu_info {
     struct cpu_user_regs guest_cpu_user_regs;
     unsigned long elr;
-    /* The following are valid iff this VCPU is current */
-    unsigned int processor_id;
-    unsigned long per_cpu_offset;
     unsigned int pad;
 };
 
@@ -31,22 +30,6 @@ static inline struct cpu_info *get_cpu_i
     return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info));
 }
 
-#define get_processor_id()    (get_cpu_info()->processor_id)
-#define set_processor_id(id)  do {                                      \
-    struct cpu_info *ci__ = get_cpu_info();                             \
-    ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
-} while (0)
-
-#define get_current()         (this_cpu(curr_vcpu))
-#define __set_current(vcpu)   (this_cpu(curr_vcpu) = (vcpu))
-#define set_current(vcpu)     do {                                      \
-    int cpu = get_processor_id();                                       \
-    vcpu->arch.cpu_info->processor_id = cpu;                            \
-    vcpu->arch.cpu_info->per_cpu_offset = __per_cpu_offset[cpu];        \
-    __set_current(vcpu);                                                \
-} while (0)
-#define current               (get_current())
-
 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
 
 #define switch_stack_and_jump(stack, fn)                                \
diff -r 0346309b3c3f -r d90c658de78a xen/include/asm-arm/percpu.h
--- a/xen/include/asm-arm/percpu.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/asm-arm/percpu.h	Mon Apr 02 10:54:05 2012 +0100
@@ -5,7 +5,6 @@
 extern char __per_cpu_start[], __per_cpu_data_end[];
 extern unsigned long __per_cpu_offset[NR_CPUS];
 void percpu_init_areas(void);
-#endif
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
@@ -16,10 +15,18 @@ void percpu_init_areas(void);
 #define per_cpu(var, cpu)  \
     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
 #define __get_cpu_var(var) \
-    (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset))
+    (*RELOC_HIDE(&per_cpu__##var, READ_CP32(HTPIDR)))
 
 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
 
+DECLARE_PER_CPU(unsigned int, cpu_id);
+#define get_processor_id()    (this_cpu(cpu_id))
+#define set_processor_id(id)  do {                      \
+    WRITE_CP32(__per_cpu_offset[id], HTPIDR);           \
+    this_cpu(cpu_id) = (id);                            \
+} while(0)
+#endif
+
 #endif /* __ARM_PERCPU_H__ */
 /*
  * Local variables:

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 14:55:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 14:55: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 1SF58Y-0007Fx-Uq; Tue, 03 Apr 2012 14:55:10 +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 1SF58X-0007Fb-DR
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:09 +0000
Received: from [85.158.139.83:60975] by server-1.bemta-5.messagelabs.com id
	94/72-28458-C4F0B7F4; Tue, 03 Apr 2012 14:55:08 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-2.tower-182.messagelabs.com!1333464905!22308807!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27162 invoked from network); 3 Apr 2012 14:55:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 14:55:07 -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 1SF58T-0008Ew-0a
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SF58S-0003dQ-Nd
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:04 +0000
Date: Tue, 03 Apr 2012 14:55:04 +0000
Message-Id: <E1SF58S-0003dQ-Nd@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] xen: introduce an event channel
	for buffered io event notifications
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit a5af89a7d40dee39a8836b03504f4076573b26bf
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Apr 3 15:42:39 2012 +0100

    xen: introduce an event channel for buffered io event notifications
    
    Use the newly [November 2011] introduced HVM_PARAM_BUFIOREQ_EVTCHN to
    receive notifications for buffered io events.  After the first
    notification is received leave the event channel masked and setup a
    timer to process the rest of the batch.  Once we have completed
    processing the batch, unmask the event channel and delete the timer.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 i386-dm/helper2.c |   41 +++++++++++++++++++++++++++++++++++------
 1 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c
index 648449c..c6d049c 100644
--- a/i386-dm/helper2.c
+++ b/i386-dm/helper2.c
@@ -111,12 +111,15 @@ int send_vcpu = 0;
 
 //the evtchn port for polling the notification,
 evtchn_port_t *ioreq_local_port;
+/* evtchn local port for buffered io */
+evtchn_port_t bufioreq_local_port;
 
 CPUX86State *cpu_x86_init(const char *cpu_model)
 {
     CPUX86State *env;
     static int inited;
     int i, rc;
+    unsigned long bufioreq_evtchn;
 
     env = qemu_mallocz(sizeof(CPUX86State));
     if (!env)
@@ -154,6 +157,19 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
             }
             ioreq_local_port[i] = rc;
         }
+        rc = xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_EVTCHN,
+                &bufioreq_evtchn);
+        if (rc < 0) {
+            fprintf(logfile, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN error=%d\n",
+                    errno);
+            return NULL;
+        }
+        rc = xc_evtchn_bind_interdomain(xce_handle, domid, (uint32_t)bufioreq_evtchn);
+        if (rc == -1) {
+            fprintf(logfile, "bind interdomain ioctl error %d\n", errno);
+            return NULL;
+        }
+        bufioreq_local_port = rc;
     }
 
     return env;
@@ -263,6 +279,12 @@ static ioreq_t *cpu_get_ioreq(void)
     evtchn_port_t port;
 
     port = xc_evtchn_pending(xce_handle);
+    if (port == bufioreq_local_port) {
+        qemu_mod_timer(buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock(rt_clock));
+        return NULL;
+    }
+ 
     if (port != -1) {
         for ( i = 0; i < vcpus; i++ )
             if ( ioreq_local_port[i] == port )
@@ -459,14 +481,16 @@ static void __handle_ioreq(CPUState *env, ioreq_t *req)
     }
 }
 
-static void __handle_buffered_iopage(CPUState *env)
+static int __handle_buffered_iopage(CPUState *env)
 {
     buf_ioreq_t *buf_req = NULL;
     ioreq_t req;
     int qw;
 
     if (!buffered_io_page)
-        return;
+        return 0;
+
+    memset(&req, 0x00, sizeof(req));
 
     while (buffered_io_page->read_pointer !=
            buffered_io_page->write_pointer) {
@@ -493,15 +517,21 @@ static void __handle_buffered_iopage(CPUState *env)
         xen_mb();
         buffered_io_page->read_pointer += qw ? 2 : 1;
     }
+
+    return req.count;
 }
 
 static void handle_buffered_io(void *opaque)
 {
     CPUState *env = opaque;
 
-    __handle_buffered_iopage(env);
-    qemu_mod_timer(buffered_io_timer, BUFFER_IO_MAX_DELAY +
-		   qemu_get_clock(rt_clock));
+    if (__handle_buffered_iopage(env)) {
+        qemu_mod_timer(buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock(rt_clock));
+    } else {
+        qemu_del_timer(buffered_io_timer);
+        xc_evtchn_unmask(xce_handle, bufioreq_local_port);
+    }
 }
 
 static void cpu_handle_ioreq(void *opaque)
@@ -561,7 +591,6 @@ int main_loop(void)
 
     buffered_io_timer = qemu_new_timer(rt_clock, handle_buffered_io,
 				       cpu_single_env);
-    qemu_mod_timer(buffered_io_timer, qemu_get_clock(rt_clock));
 
     if (evtchn_fd != -1)
         qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, env);
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 14:55:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 14:55: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 1SF58Y-0007Fx-Uq; Tue, 03 Apr 2012 14:55:10 +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 1SF58X-0007Fb-DR
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:09 +0000
Received: from [85.158.139.83:60975] by server-1.bemta-5.messagelabs.com id
	94/72-28458-C4F0B7F4; Tue, 03 Apr 2012 14:55:08 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-2.tower-182.messagelabs.com!1333464905!22308807!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27162 invoked from network); 3 Apr 2012 14:55:07 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 14:55:07 -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 1SF58T-0008Ew-0a
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:05 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SF58S-0003dQ-Nd
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:04 +0000
Date: Tue, 03 Apr 2012 14:55:04 +0000
Message-Id: <E1SF58S-0003dQ-Nd@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] xen: introduce an event channel
	for buffered io event notifications
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit a5af89a7d40dee39a8836b03504f4076573b26bf
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Apr 3 15:42:39 2012 +0100

    xen: introduce an event channel for buffered io event notifications
    
    Use the newly [November 2011] introduced HVM_PARAM_BUFIOREQ_EVTCHN to
    receive notifications for buffered io events.  After the first
    notification is received leave the event channel masked and setup a
    timer to process the rest of the batch.  Once we have completed
    processing the batch, unmask the event channel and delete the timer.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 i386-dm/helper2.c |   41 +++++++++++++++++++++++++++++++++++------
 1 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/i386-dm/helper2.c b/i386-dm/helper2.c
index 648449c..c6d049c 100644
--- a/i386-dm/helper2.c
+++ b/i386-dm/helper2.c
@@ -111,12 +111,15 @@ int send_vcpu = 0;
 
 //the evtchn port for polling the notification,
 evtchn_port_t *ioreq_local_port;
+/* evtchn local port for buffered io */
+evtchn_port_t bufioreq_local_port;
 
 CPUX86State *cpu_x86_init(const char *cpu_model)
 {
     CPUX86State *env;
     static int inited;
     int i, rc;
+    unsigned long bufioreq_evtchn;
 
     env = qemu_mallocz(sizeof(CPUX86State));
     if (!env)
@@ -154,6 +157,19 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
             }
             ioreq_local_port[i] = rc;
         }
+        rc = xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_EVTCHN,
+                &bufioreq_evtchn);
+        if (rc < 0) {
+            fprintf(logfile, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN error=%d\n",
+                    errno);
+            return NULL;
+        }
+        rc = xc_evtchn_bind_interdomain(xce_handle, domid, (uint32_t)bufioreq_evtchn);
+        if (rc == -1) {
+            fprintf(logfile, "bind interdomain ioctl error %d\n", errno);
+            return NULL;
+        }
+        bufioreq_local_port = rc;
     }
 
     return env;
@@ -263,6 +279,12 @@ static ioreq_t *cpu_get_ioreq(void)
     evtchn_port_t port;
 
     port = xc_evtchn_pending(xce_handle);
+    if (port == bufioreq_local_port) {
+        qemu_mod_timer(buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock(rt_clock));
+        return NULL;
+    }
+ 
     if (port != -1) {
         for ( i = 0; i < vcpus; i++ )
             if ( ioreq_local_port[i] == port )
@@ -459,14 +481,16 @@ static void __handle_ioreq(CPUState *env, ioreq_t *req)
     }
 }
 
-static void __handle_buffered_iopage(CPUState *env)
+static int __handle_buffered_iopage(CPUState *env)
 {
     buf_ioreq_t *buf_req = NULL;
     ioreq_t req;
     int qw;
 
     if (!buffered_io_page)
-        return;
+        return 0;
+
+    memset(&req, 0x00, sizeof(req));
 
     while (buffered_io_page->read_pointer !=
            buffered_io_page->write_pointer) {
@@ -493,15 +517,21 @@ static void __handle_buffered_iopage(CPUState *env)
         xen_mb();
         buffered_io_page->read_pointer += qw ? 2 : 1;
     }
+
+    return req.count;
 }
 
 static void handle_buffered_io(void *opaque)
 {
     CPUState *env = opaque;
 
-    __handle_buffered_iopage(env);
-    qemu_mod_timer(buffered_io_timer, BUFFER_IO_MAX_DELAY +
-		   qemu_get_clock(rt_clock));
+    if (__handle_buffered_iopage(env)) {
+        qemu_mod_timer(buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock(rt_clock));
+    } else {
+        qemu_del_timer(buffered_io_timer);
+        xc_evtchn_unmask(xce_handle, bufioreq_local_port);
+    }
 }
 
 static void cpu_handle_ioreq(void *opaque)
@@ -561,7 +591,6 @@ int main_loop(void)
 
     buffered_io_timer = qemu_new_timer(rt_clock, handle_buffered_io,
 				       cpu_single_env);
-    qemu_mod_timer(buffered_io_timer, qemu_get_clock(rt_clock));
 
     if (evtchn_fd != -1)
         qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, env);
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 14:55:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 14:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SF58i-0007HM-1a; Tue, 03 Apr 2012 14:55:20 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SF58g-0007Gz-Qt
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:19 +0000
Received: from [85.158.138.51:47695] by server-10.bemta-3.messagelabs.com id
	B7/55-15637-65F0B7F4; Tue, 03 Apr 2012 14:55:18 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-174.messagelabs.com!1333464916!20538338!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26709 invoked from network); 3 Apr 2012 14:55:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 14:55:17 -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 1SF58d-0008Ez-E1
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SF58d-0003ec-48
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:15 +0000
Date: Tue, 03 Apr 2012 14:55:15 +0000
Message-Id: <E1SF58d-0003ec-48@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] timers: use INT64_MAX as max
	expiration
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 82db8de16530f016809264d3179823999d702849
Author: Yang Zhang <yang.z.zhang@Intel.com>
Date:   Tue Apr 3 15:44:48 2012 +0100

    timers: use INT64_MAX as max expiration
    
    Currently, the max expiration time is 2147483647ns(INT32_MAX ns). This
    is enough when guest is busy, but when guest is idle, the next timer
    will be later than INT32_MAX ns. And those meaningless alarm will harm
    the pkg C-state.
    
    PS: Since the overflow will not happen with the expression((delta /
    1000) + (delta % 1000 > 0 ? 1 : 0)), so i also removed the comments"
    To avoid problems with overflow limit this to 2^32."
    
    Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
    Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 vl.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/vl.c b/vl.c
index be8587a..d30cb2c 100644
--- a/vl.c
+++ b/vl.c
@@ -1410,8 +1410,7 @@ static int64_t qemu_next_deadline(void)
         delta = active_timers[QEMU_TIMER_VIRTUAL]->expire_time -
                      qemu_get_clock(vm_clock);
     } else {
-        /* To avoid problems with overflow limit this to 2^32.  */
-        delta = INT32_MAX;
+        delta = INT64_MAX;
     }
 
     if (delta < 0)
@@ -1427,9 +1426,11 @@ static uint64_t qemu_next_deadline_dyntick(void)
     int64_t rtdelta;
 
     if (use_icount)
-        delta = INT32_MAX;
-    else
-        delta = (qemu_next_deadline() + 999) / 1000;
+        delta = INT64_MAX;
+    else {
+        delta = qemu_next_deadline();
+        delta = (delta / 1000) + (delta % 1000 > 0 ? 1 : 0);
+    }
 
     if (active_timers[QEMU_TIMER_REALTIME]) {
         rtdelta = (active_timers[QEMU_TIMER_REALTIME]->expire_time -
@@ -3872,8 +3873,8 @@ int main_loop(void)
                     env->icount_decr.u16.low = 0;
                     env->icount_extra = 0;
                     count = qemu_next_deadline();
-                    count = (count + (1 << icount_time_shift) - 1)
-                            >> icount_time_shift;
+                    count = (count >> icount_time_shift) +
+                        ((count & ((1 << icount_time_shift) - 1)) > 0 ? 1 : 0);
                     qemu_icount += count;
                     decr = (count > 0xffff) ? 0xffff : count;
                     count -= decr;
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 14:55:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 14:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SF58i-0007HM-1a; Tue, 03 Apr 2012 14:55:20 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SF58g-0007Gz-Qt
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:19 +0000
Received: from [85.158.138.51:47695] by server-10.bemta-3.messagelabs.com id
	B7/55-15637-65F0B7F4; Tue, 03 Apr 2012 14:55:18 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-174.messagelabs.com!1333464916!20538338!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26709 invoked from network); 3 Apr 2012 14:55:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 14:55:17 -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 1SF58d-0008Ez-E1
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SF58d-0003ec-48
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 14:55:15 +0000
Date: Tue, 03 Apr 2012 14:55:15 +0000
Message-Id: <E1SF58d-0003ec-48@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] timers: use INT64_MAX as max
	expiration
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 82db8de16530f016809264d3179823999d702849
Author: Yang Zhang <yang.z.zhang@Intel.com>
Date:   Tue Apr 3 15:44:48 2012 +0100

    timers: use INT64_MAX as max expiration
    
    Currently, the max expiration time is 2147483647ns(INT32_MAX ns). This
    is enough when guest is busy, but when guest is idle, the next timer
    will be later than INT32_MAX ns. And those meaningless alarm will harm
    the pkg C-state.
    
    PS: Since the overflow will not happen with the expression((delta /
    1000) + (delta % 1000 > 0 ? 1 : 0)), so i also removed the comments"
    To avoid problems with overflow limit this to 2^32."
    
    Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
    Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 vl.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/vl.c b/vl.c
index be8587a..d30cb2c 100644
--- a/vl.c
+++ b/vl.c
@@ -1410,8 +1410,7 @@ static int64_t qemu_next_deadline(void)
         delta = active_timers[QEMU_TIMER_VIRTUAL]->expire_time -
                      qemu_get_clock(vm_clock);
     } else {
-        /* To avoid problems with overflow limit this to 2^32.  */
-        delta = INT32_MAX;
+        delta = INT64_MAX;
     }
 
     if (delta < 0)
@@ -1427,9 +1426,11 @@ static uint64_t qemu_next_deadline_dyntick(void)
     int64_t rtdelta;
 
     if (use_icount)
-        delta = INT32_MAX;
-    else
-        delta = (qemu_next_deadline() + 999) / 1000;
+        delta = INT64_MAX;
+    else {
+        delta = qemu_next_deadline();
+        delta = (delta / 1000) + (delta % 1000 > 0 ? 1 : 0);
+    }
 
     if (active_timers[QEMU_TIMER_REALTIME]) {
         rtdelta = (active_timers[QEMU_TIMER_REALTIME]->expire_time -
@@ -3872,8 +3873,8 @@ int main_loop(void)
                     env->icount_decr.u16.low = 0;
                     env->icount_extra = 0;
                     count = qemu_next_deadline();
-                    count = (count + (1 << icount_time_shift) - 1)
-                            >> icount_time_shift;
+                    count = (count >> icount_time_shift) +
+                        ((count & ((1 << icount_time_shift) - 1)) > 0 ? 1 : 0);
                     qemu_icount += count;
                     decr = (count > 0xffff) ? 0xffff : count;
                     count -= decr;
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF5-0000bO-0A; Tue, 03 Apr 2012 20:22: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 1SFAF3-0000ai-7b
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Received: from [85.158.143.35:42555] by server-3.bemta-4.messagelabs.com id
	90/E9-05853-4FB5B7F4; Tue, 03 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1333484530!8421613!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31113 invoked from network); 3 Apr 2012 20:22:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAF0-00040R-8d
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF0-0003FX-0c
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Message-Id: <E1SFAF0-0003FX-0c@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] device tree: print a warning if a
	node is nested too deep
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381844 -3600
# Node ID ac66eedfd9878173a2b8d4e1e81236857a819319
# Parent  5cbe2ab76a9cb4880cd0354cb3e3111930d985ee
device tree: print a warning if a node is nested too deep

Since device_tree_for_each_node() is called before printk() works, a
variable is used to switch between using early_printk() and printk().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 5cbe2ab76a9c -r ac66eedfd987 xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Apr 02 16:50:43 2012 +0100
+++ b/xen/common/device_tree.c	Mon Apr 02 16:50:44 2012 +0100
@@ -23,6 +23,10 @@
 struct dt_early_info __initdata early_info;
 void *device_tree_flattened;
 
+/* Some device tree functions may be called both before and after the
+   console is initialized. */
+static void (*dt_printk)(const char *fmt, ...) = early_printk;
+
 bool_t device_tree_node_matches(const void *fdt, int node, const char *match)
 {
     const char *name;
@@ -90,6 +94,11 @@ u32 device_tree_get_u32(const void *fdt,
  * @fdt: flat device tree.
  * @func: function to call for each node.
  * @data: data to pass to @func.
+ *
+ * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored.
+ *
+ * Returns 0 if all nodes were iterated over successfully.  If @func
+ * returns a negative value, that value is returned immediately.
  */
 int device_tree_for_each_node(const void *fdt,
                               device_tree_node_func func, void *data)
@@ -104,13 +113,19 @@ int device_tree_for_each_node(const void
           node >=0 && depth >= 0;
           node = fdt_next_node(fdt, node, &depth) )
     {
+        const char *name = fdt_get_name(fdt, node, NULL);
+
         if ( depth >= DEVICE_TREE_MAX_DEPTH )
+        {
+            dt_printk("Warning: device tree node `%s' is nested too deep\n",
+                      name);
             continue;
+        }
 
         address_cells[depth] = device_tree_get_u32(fdt, node, "#address-cells");
         size_cells[depth] = device_tree_get_u32(fdt, node, "#size-cells");
 
-        ret = func(fdt, node, fdt_get_name(fdt, node, NULL), depth,
+        ret = func(fdt, node, name, depth,
                    address_cells[depth-1], size_cells[depth-1], data);
         if ( ret < 0 )
             return ret;
@@ -253,6 +268,8 @@ size_t __init device_tree_early_init(con
     device_tree_for_each_node((void *)fdt, early_scan_node, NULL);
     early_print_info();
 
+    dt_printk = printk;
+
     return fdt_totalsize(fdt);
 }
 

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF5-0000bO-0A; Tue, 03 Apr 2012 20:22: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 1SFAF3-0000ai-7b
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Received: from [85.158.143.35:42555] by server-3.bemta-4.messagelabs.com id
	90/E9-05853-4FB5B7F4; Tue, 03 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1333484530!8421613!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31113 invoked from network); 3 Apr 2012 20:22:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAF0-00040R-8d
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF0-0003FX-0c
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Message-Id: <E1SFAF0-0003FX-0c@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] device tree: print a warning if a
	node is nested too deep
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381844 -3600
# Node ID ac66eedfd9878173a2b8d4e1e81236857a819319
# Parent  5cbe2ab76a9cb4880cd0354cb3e3111930d985ee
device tree: print a warning if a node is nested too deep

Since device_tree_for_each_node() is called before printk() works, a
variable is used to switch between using early_printk() and printk().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 5cbe2ab76a9c -r ac66eedfd987 xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Apr 02 16:50:43 2012 +0100
+++ b/xen/common/device_tree.c	Mon Apr 02 16:50:44 2012 +0100
@@ -23,6 +23,10 @@
 struct dt_early_info __initdata early_info;
 void *device_tree_flattened;
 
+/* Some device tree functions may be called both before and after the
+   console is initialized. */
+static void (*dt_printk)(const char *fmt, ...) = early_printk;
+
 bool_t device_tree_node_matches(const void *fdt, int node, const char *match)
 {
     const char *name;
@@ -90,6 +94,11 @@ u32 device_tree_get_u32(const void *fdt,
  * @fdt: flat device tree.
  * @func: function to call for each node.
  * @data: data to pass to @func.
+ *
+ * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored.
+ *
+ * Returns 0 if all nodes were iterated over successfully.  If @func
+ * returns a negative value, that value is returned immediately.
  */
 int device_tree_for_each_node(const void *fdt,
                               device_tree_node_func func, void *data)
@@ -104,13 +113,19 @@ int device_tree_for_each_node(const void
           node >=0 && depth >= 0;
           node = fdt_next_node(fdt, node, &depth) )
     {
+        const char *name = fdt_get_name(fdt, node, NULL);
+
         if ( depth >= DEVICE_TREE_MAX_DEPTH )
+        {
+            dt_printk("Warning: device tree node `%s' is nested too deep\n",
+                      name);
             continue;
+        }
 
         address_cells[depth] = device_tree_get_u32(fdt, node, "#address-cells");
         size_cells[depth] = device_tree_get_u32(fdt, node, "#size-cells");
 
-        ret = func(fdt, node, fdt_get_name(fdt, node, NULL), depth,
+        ret = func(fdt, node, name, depth,
                    address_cells[depth-1], size_cells[depth-1], data);
         if ( ret < 0 )
             return ret;
@@ -253,6 +268,8 @@ size_t __init device_tree_early_init(con
     device_tree_for_each_node((void *)fdt, early_scan_node, NULL);
     early_print_info();
 
+    dt_printk = printk;
+
     return fdt_totalsize(fdt);
 }
 

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF5-0000bT-2e; Tue, 03 Apr 2012 20:22: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 1SFAF3-0000as-Tj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from [85.158.138.51:17539] by server-4.bemta-3.messagelabs.com id
	2E/96-16467-5FB5B7F4; Tue, 03 Apr 2012 20:22:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1333484531!20693151!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30596 invoked from network); 3 Apr 2012 20:22: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;
	3 Apr 2012 20: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 1SFAF1-00040X-5p
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF1-0003G4-1J
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Message-Id: <E1SFAF1-0003G4-1J@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: add some missing options to
	misc/xen-command-line.markdown
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332778199 -3600
# Node ID aa2d6abb5a85e607fb397bc4f77458fce8097c24
# Parent  f253a0119b1a25b4582b19607c7e3af58167f420
docs: add some missing options to misc/xen-command-line.markdown

These were mostly ones from xen/arch/x86/boot/cmdline.S which are handled early
and therefore do not use the usual infrastructure and so got missed in the
initial trawl.

The document now contains (AFAICT) every still valid option which was
previously documented at:
http://wiki.xen.org/wiki?title=Xen_Hypervisor_Boot_Options&oldid=1379

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


diff -r f253a0119b1a -r aa2d6abb5a85 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:40 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:59 2012 +0100
@@ -96,6 +96,10 @@ from the MP tables.
 Finally, any of the boolean false options can be used to disable ACPI
 usage entirely.
 
+Because responsiblity for ACPI processing is shared between Xen and
+the domain 0 kernel this option is automatically propagated to the
+domain 0 command line
+
 ### acpi\_apic\_instance
 > `= <integer>`
 
@@ -103,7 +107,15 @@ Specify which ACPI MADT table to parse f
 than one is present.
 
 ### acpi\_pstate\_strict
+
 ### acpi\_skip\_timer\_override
+
+Instruct Xen to ignore timer-interrupt override.
+
+Because responsiblity for ACPI processing is shared between Xen and
+the domain 0 kernel this option is automatically propagated to the
+domain 0 command line
+
 ### acpi\_sleep
 ### additional\_cpus
 ### allowsuperpage
@@ -300,8 +312,26 @@ Pin dom0 vcpus to their respective pcpus
 ### dom\_rid\_bits
 ### e820-mtrr-clip
 ### e820-verbose
+
+### edd (x86)
+> `= off | on | skipmbr`
+
+Control retrieval of Extended Disc Data (EDD) from the BIOS during
+boot.
+
+### edid (x86)
+> `= no | force`
+
+Either force retrieval of monitor EDID information via VESA DDC, or
+disable it (edid=no). This option should not normally be required
+except for debugging purposes.
+
 ### efi\_print
 ### extra\_guest\_irqs
+> `= <number>`
+
+Increase the number of PIRQs available for the guest. The default is 32. 
+
 ### flask\_enabled
 ### flask\_enforcing
 ### font
@@ -381,6 +411,15 @@ Specify what Xen should do in the event 
 dom0, while 'fatal' causes Xen to print diagnostics and then hang.
 
 ### noapic
+
+Instruct Xen to ignore any IOAPICs that are present in the system, and
+instead continue to use the legacy PIC. This is _not_ recommended with
+pvops type kernels.
+
+Because responsiblity for APIC setup is shared between Xen and the
+domain 0 kernel this option is automatically propagated to the domain
+0 command line.
+
 ### nofxsr
 ### noirqbalance
 > `= <boolean>`
@@ -394,6 +433,12 @@ IRQ routing issues.
 Ignore the local APIC on a uniprocessor system, even if enabled by the
 BIOS.  This option will accept value.
 
+### no-real-mode (x86)
+
+Do not execute real-mode bootstrap code when booting Xen. This option
+should not be used except for debugging. It will effectively disable
+the vga option, which relies on real mode to set the video mode.
+
 ### noreboot
 > `= <boolean>`
 

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000cT-D6; Tue, 03 Apr 2012 20:22:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-0000bV-KJ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from [85.158.139.83:55770] by server-11.bemta-5.messagelabs.com id
	41/97-12959-6FB5B7F4; Tue, 03 Apr 2012 20:22:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1333484532!22295670!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25611 invoked from network); 3 Apr 2012 20:22: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;
	3 Apr 2012 20: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 1SFAF1-00040a-Mv
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF1-0003GM-IE
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Message-Id: <E1SFAF1-0003GM-IE@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: spelling and typoes in
	misc/xen-command-line.markdown
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332778273 -3600
# Node ID ac0fcd6eeef789d004b88551c3651c1962a2a674
# Parent  aa2d6abb5a85e607fb397bc4f77458fce8097c24
docs: spelling and typoes in misc/xen-command-line.markdown

Run a spell checker over the doc and fix the typos and spelling it uncovers
(including a few I just added myself).

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


diff -r aa2d6abb5a85 -r ac0fcd6eeef7 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:59 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Mon Mar 26 17:11:13 2012 +0100
@@ -5,7 +5,7 @@
   arch trees, and some options are currently separate from their
   legacy versions.  Please remove this notice when complete.**
 
-This document coveres the command line options which the Xen
+This document covers the command line options which the Xen
 Hypervisor.
 
 ## Types of parameter
@@ -38,7 +38,7 @@ Enable synchronous console mode
 ### Integer (`<integer>`)
 
 An integer parameter will default to decimal and may be prefixed with
-a `-` for negative numbers.  Alternativly, a hexidecimal number may be
+a `-` for negative numbers.  Alternatively, a hexadecimal number may be
 used by prefixing the number with `0x`, or an octal number may be used
 if a leading `0` is present.
 
@@ -56,7 +56,7 @@ Without a size suffix, the default will 
 ### String
 
 Many parameters are more complicated and require more intricate
-configuration.  The detailed description of each individual paramter
+configuration.  The detailed description of each individual parameter
 specify which values are valid.
 
 ### List
@@ -96,7 +96,7 @@ from the MP tables.
 Finally, any of the boolean false options can be used to disable ACPI
 usage entirely.
 
-Because responsiblity for ACPI processing is shared between Xen and
+Because responsibility for ACPI processing is shared between Xen and
 the domain 0 kernel this option is automatically propagated to the
 domain 0 command line
 
@@ -112,7 +112,7 @@ than one is present.
 
 Instruct Xen to ignore timer-interrupt override.
 
-Because responsiblity for ACPI processing is shared between Xen and
+Because responsibility for ACPI processing is shared between Xen and
 the domain 0 kernel this option is automatically propagated to the
 domain 0 command line
 
@@ -178,7 +178,7 @@ Both option `com1` and `com2` follow the
 * `pci` indicates that Xen should scan the PCI bus for the UART,
   avoiding Intel AMT devices.
 * `amt` indicated that Xen should scan the PCI bus for the UART,
-  including Intel AMT devices if presetn.
+  including Intel AMT devices if present.
 
 A typical setup for most situations might be `com1=115200,8n1`
 
@@ -200,10 +200,10 @@ Specify which console(s) Xen should use.
 `vga` indicates that Xen should try and use the vga graphics adapter.
 
 `com1` and `com2` indicates that Xen should use serial ports 1 and 2
-respectivly.  Optionally, these arguments may be followed by an `H` or
+respectively.  Optionally, these arguments may be followed by an `H` or
 `L`.  `H` indicates that transmitted characters will have their MSB
-set, while recieved characters must have their MSB set.  `L` indicates
-the converse; transmitted and recieved characters will have their MSB
+set, while received characters must have their MSB set.  `L` indicates
+the converse; transmitted and received characters will have their MSB
 cleared.  This allows a single port to be shared by two subsystems
 (e.g. console and debugger).
 
@@ -255,7 +255,7 @@ console during dom0 boot.
 
 > Default: `4G`
 
-Specify the maximum address to allocate certain strucutres, if used in
+Specify the maximum address to allocate certain structures, if used in
 combination with the `low_crashinfo` command line option.
 
 ### crashkernel
@@ -274,7 +274,7 @@ Specify the bit width of the DMA heap.
 ### dom0\_max\_vcpus
 > `= <integer>`
 
-Specifiy the maximum number of vcpus to give to dom0.  This defaults
+Specify the maximum number of vcpus to give to dom0.  This defaults
 to the number of pcpus on the host.
 
 ### dom0\_mem (ia64)
@@ -345,7 +345,9 @@ Increase the number of PIRQs available f
 Set the logging level for Xen guests.  Any log message with equal more
 more importance will be printed.
 
-The optional `<rate-limited level>` options instructs which severities should be rate limited.
+The optional `<rate-limited level>` option instructs which severities
+should be rate limited.
+
 ### hap\_1gb
 ### hap\_2mb
 ### hpetbroadcast
@@ -373,7 +375,7 @@ all.
 Set the logging level for Xen.  Any log message with equal more more
 importance will be printed.
 
-The optional `<rate-limited level>` options instructs which severities
+The optional `<rate-limited level>` option instructs which severities
 should be rate limited.
 
 ### low\_crashinfo
@@ -383,7 +385,7 @@ should be rate limited.
 
 This option is only useful for hosts with a 32bit dom0 kernel, wishing
 to use kexec functionality in the case of a crash.  It represents
-which data structures should be deliberatly allocated in low memory,
+which data structures should be deliberately allocated in low memory,
 so the crash kernel may find find them.  Should be used in combination
 with `crashinfo_maxaddr`.
 
@@ -416,7 +418,7 @@ Instruct Xen to ignore any IOAPICs that 
 instead continue to use the legacy PIC. This is _not_ recommended with
 pvops type kernels.
 
-Because responsiblity for APIC setup is shared between Xen and the
+Because responsibility for APIC setup is shared between Xen and the
 domain 0 kernel this option is automatically propagated to the domain
 0 command line.
 
@@ -474,7 +476,7 @@ Choose the default scheduler.
 ### serial\_tx\_buffer
 > `= <size>`
 
-Set the serial tramsit buffer size.  Defaults to 16kB.
+Set the serial transmit buffer size.  Defaults to 16kB.
 
 ### smep
 ### snb\_igd\_quirk
@@ -526,7 +528,7 @@ with the specified width, height and dep
 
 `mode-<mode>` instructs Xen to use a specific mode, as shown with the
 `ask` option.  (N.B menu modes are displayed in hex, so `<mode>`
-should be a hexidecimal number)
+should be a hexadecimal number)
 
 The optional `keep` parameter causes Xen to continue using the vga
 console even after dom0 has been started.  The default behaviour is to

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF5-0000bT-2e; Tue, 03 Apr 2012 20:22: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 1SFAF3-0000as-Tj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from [85.158.138.51:17539] by server-4.bemta-3.messagelabs.com id
	2E/96-16467-5FB5B7F4; Tue, 03 Apr 2012 20:22:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1333484531!20693151!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30596 invoked from network); 3 Apr 2012 20:22: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;
	3 Apr 2012 20: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 1SFAF1-00040X-5p
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF1-0003G4-1J
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Message-Id: <E1SFAF1-0003G4-1J@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: add some missing options to
	misc/xen-command-line.markdown
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332778199 -3600
# Node ID aa2d6abb5a85e607fb397bc4f77458fce8097c24
# Parent  f253a0119b1a25b4582b19607c7e3af58167f420
docs: add some missing options to misc/xen-command-line.markdown

These were mostly ones from xen/arch/x86/boot/cmdline.S which are handled early
and therefore do not use the usual infrastructure and so got missed in the
initial trawl.

The document now contains (AFAICT) every still valid option which was
previously documented at:
http://wiki.xen.org/wiki?title=Xen_Hypervisor_Boot_Options&oldid=1379

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


diff -r f253a0119b1a -r aa2d6abb5a85 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:40 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:59 2012 +0100
@@ -96,6 +96,10 @@ from the MP tables.
 Finally, any of the boolean false options can be used to disable ACPI
 usage entirely.
 
+Because responsiblity for ACPI processing is shared between Xen and
+the domain 0 kernel this option is automatically propagated to the
+domain 0 command line
+
 ### acpi\_apic\_instance
 > `= <integer>`
 
@@ -103,7 +107,15 @@ Specify which ACPI MADT table to parse f
 than one is present.
 
 ### acpi\_pstate\_strict
+
 ### acpi\_skip\_timer\_override
+
+Instruct Xen to ignore timer-interrupt override.
+
+Because responsiblity for ACPI processing is shared between Xen and
+the domain 0 kernel this option is automatically propagated to the
+domain 0 command line
+
 ### acpi\_sleep
 ### additional\_cpus
 ### allowsuperpage
@@ -300,8 +312,26 @@ Pin dom0 vcpus to their respective pcpus
 ### dom\_rid\_bits
 ### e820-mtrr-clip
 ### e820-verbose
+
+### edd (x86)
+> `= off | on | skipmbr`
+
+Control retrieval of Extended Disc Data (EDD) from the BIOS during
+boot.
+
+### edid (x86)
+> `= no | force`
+
+Either force retrieval of monitor EDID information via VESA DDC, or
+disable it (edid=no). This option should not normally be required
+except for debugging purposes.
+
 ### efi\_print
 ### extra\_guest\_irqs
+> `= <number>`
+
+Increase the number of PIRQs available for the guest. The default is 32. 
+
 ### flask\_enabled
 ### flask\_enforcing
 ### font
@@ -381,6 +411,15 @@ Specify what Xen should do in the event 
 dom0, while 'fatal' causes Xen to print diagnostics and then hang.
 
 ### noapic
+
+Instruct Xen to ignore any IOAPICs that are present in the system, and
+instead continue to use the legacy PIC. This is _not_ recommended with
+pvops type kernels.
+
+Because responsiblity for APIC setup is shared between Xen and the
+domain 0 kernel this option is automatically propagated to the domain
+0 command line.
+
 ### nofxsr
 ### noirqbalance
 > `= <boolean>`
@@ -394,6 +433,12 @@ IRQ routing issues.
 Ignore the local APIC on a uniprocessor system, even if enabled by the
 BIOS.  This option will accept value.
 
+### no-real-mode (x86)
+
+Do not execute real-mode bootstrap code when booting Xen. This option
+should not be used except for debugging. It will effectively disable
+the vga option, which relies on real mode to set the video mode.
+
 ### noreboot
 > `= <boolean>`
 

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF6-0000bu-55; Tue, 03 Apr 2012 20:22: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 1SFAF4-0000ai-MH
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from [85.158.143.99:41993] by server-3.bemta-4.messagelabs.com id
	85/E9-05853-6FB5B7F4; Tue, 03 Apr 2012 20:22:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1333484532!21898322!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11332 invoked from network); 3 Apr 2012 20:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAF2-00040d-AR
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF2-0003Gb-2u
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Message-Id: <E1SFAF2-0003Gb-2u@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document some more 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1333382565 -3600
# Node ID aeb637d0ecf64e26f24d1e01f98ec6403eec5f59
# Parent  ac0fcd6eeef789d004b88551c3651c1962a2a674
docs: Document some more hypercalls

Some of these could probably do with some review from people who know
what these hypercalls actually do.

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



diff -r ac0fcd6eeef7 -r aeb637d0ecf6 xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h	Mon Mar 26 17:11:13 2012 +0100
+++ b/xen/include/public/arch-x86/xen.h	Mon Apr 02 17:02:45 2012 +0100
@@ -65,6 +65,11 @@ typedef unsigned long xen_pfn_t;
  * SEGMENT DESCRIPTOR TABLES
  */
 /*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_gdt(const xen_pfn_t frames[], unsigned int entries);
+ * `
+ */
+/*
  * A number of GDT entries are reserved by Xen. These are not situated at the
  * 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,
@@ -83,6 +88,13 @@ typedef unsigned long xen_ulong_t;
 
 /*
  * ` enum neg_errnoval
+ * ` HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp);
+ * `
+ * Sets the stack segment and pointer for the current vcpu.
+ */
+
+/*
+ * ` enum neg_errnoval
  * ` HYPERVISOR_set_trap_table(const struct trap_info traps[]);
  * `
  */
@@ -183,6 +195,24 @@ typedef struct arch_shared_info arch_sha
 #endif /* !__ASSEMBLY__ */
 
 /*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_fpu_taskswitch(int set);
+ * `
+ * Sets (if set!=0) or clears (if set==0) CR0.TS.
+ */
+
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_debugreg(int regno, unsigned long value);
+ *
+ * ` unsigned long
+ * ` HYPERVISOR_get_debugreg(int regno);
+ * For 0<=reg<=7, returns the debug register value.
+ * For other values of reg, returns ((unsigned long)-EINVAL).
+ * (Unfortunately, this interface is defective.)
+ */
+
+/*
  * Prefix forces emulation of some non-trapping instructions.
  * Currently only CPUID.
  */
diff -r ac0fcd6eeef7 -r aeb637d0ecf6 xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h	Mon Mar 26 17:11:13 2012 +0100
+++ b/xen/include/public/arch-x86_64.h	Mon Apr 02 17:02:45 2012 +0100
@@ -25,3 +25,19 @@
  */
 
 #include "arch-x86/xen.h"
+
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_callbacks(unsigned long event_selector,
+ * `                          unsigned long event_address,
+ * `                          unsigned long failsafe_selector,
+ * `                          unsigned long failsafe_address);
+ * `
+ * Register for callbacks on events.  When an event (from an event
+ * channel) occurs, event_address is used as the value of eip.
+ *
+ * A similar callback occurs if the segment selectors are invalid.
+ * failsafe_address is used as the value of eip.
+ *
+ * On x86_64, event_selector and failsafe_selector are ignored (???).
+ */
diff -r ac0fcd6eeef7 -r aeb637d0ecf6 xen/include/public/platform.h
--- a/xen/include/public/platform.h	Mon Mar 26 17:11:13 2012 +0100
+++ b/xen/include/public/platform.h	Mon Apr 02 17:02:45 2012 +0100
@@ -504,6 +504,10 @@ struct xenpf_core_parking {
 typedef struct xenpf_core_parking xenpf_core_parking_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_core_parking_t);
 
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_platform_op(const struct xen_platform_op*);
+ */
 struct xen_platform_op {
     uint32_t cmd;
     uint32_t interface_version; /* XENPF_INTERFACE_VERSION */

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000cT-D6; Tue, 03 Apr 2012 20:22:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-0000bV-KJ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from [85.158.139.83:55770] by server-11.bemta-5.messagelabs.com id
	41/97-12959-6FB5B7F4; Tue, 03 Apr 2012 20:22:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1333484532!22295670!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25611 invoked from network); 3 Apr 2012 20:22: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;
	3 Apr 2012 20: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 1SFAF1-00040a-Mv
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF1-0003GM-IE
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:11 +0000
Message-Id: <E1SFAF1-0003GM-IE@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: spelling and typoes in
	misc/xen-command-line.markdown
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332778273 -3600
# Node ID ac0fcd6eeef789d004b88551c3651c1962a2a674
# Parent  aa2d6abb5a85e607fb397bc4f77458fce8097c24
docs: spelling and typoes in misc/xen-command-line.markdown

Run a spell checker over the doc and fix the typos and spelling it uncovers
(including a few I just added myself).

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


diff -r aa2d6abb5a85 -r ac0fcd6eeef7 docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:59 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Mon Mar 26 17:11:13 2012 +0100
@@ -5,7 +5,7 @@
   arch trees, and some options are currently separate from their
   legacy versions.  Please remove this notice when complete.**
 
-This document coveres the command line options which the Xen
+This document covers the command line options which the Xen
 Hypervisor.
 
 ## Types of parameter
@@ -38,7 +38,7 @@ Enable synchronous console mode
 ### Integer (`<integer>`)
 
 An integer parameter will default to decimal and may be prefixed with
-a `-` for negative numbers.  Alternativly, a hexidecimal number may be
+a `-` for negative numbers.  Alternatively, a hexadecimal number may be
 used by prefixing the number with `0x`, or an octal number may be used
 if a leading `0` is present.
 
@@ -56,7 +56,7 @@ Without a size suffix, the default will 
 ### String
 
 Many parameters are more complicated and require more intricate
-configuration.  The detailed description of each individual paramter
+configuration.  The detailed description of each individual parameter
 specify which values are valid.
 
 ### List
@@ -96,7 +96,7 @@ from the MP tables.
 Finally, any of the boolean false options can be used to disable ACPI
 usage entirely.
 
-Because responsiblity for ACPI processing is shared between Xen and
+Because responsibility for ACPI processing is shared between Xen and
 the domain 0 kernel this option is automatically propagated to the
 domain 0 command line
 
@@ -112,7 +112,7 @@ than one is present.
 
 Instruct Xen to ignore timer-interrupt override.
 
-Because responsiblity for ACPI processing is shared between Xen and
+Because responsibility for ACPI processing is shared between Xen and
 the domain 0 kernel this option is automatically propagated to the
 domain 0 command line
 
@@ -178,7 +178,7 @@ Both option `com1` and `com2` follow the
 * `pci` indicates that Xen should scan the PCI bus for the UART,
   avoiding Intel AMT devices.
 * `amt` indicated that Xen should scan the PCI bus for the UART,
-  including Intel AMT devices if presetn.
+  including Intel AMT devices if present.
 
 A typical setup for most situations might be `com1=115200,8n1`
 
@@ -200,10 +200,10 @@ Specify which console(s) Xen should use.
 `vga` indicates that Xen should try and use the vga graphics adapter.
 
 `com1` and `com2` indicates that Xen should use serial ports 1 and 2
-respectivly.  Optionally, these arguments may be followed by an `H` or
+respectively.  Optionally, these arguments may be followed by an `H` or
 `L`.  `H` indicates that transmitted characters will have their MSB
-set, while recieved characters must have their MSB set.  `L` indicates
-the converse; transmitted and recieved characters will have their MSB
+set, while received characters must have their MSB set.  `L` indicates
+the converse; transmitted and received characters will have their MSB
 cleared.  This allows a single port to be shared by two subsystems
 (e.g. console and debugger).
 
@@ -255,7 +255,7 @@ console during dom0 boot.
 
 > Default: `4G`
 
-Specify the maximum address to allocate certain strucutres, if used in
+Specify the maximum address to allocate certain structures, if used in
 combination with the `low_crashinfo` command line option.
 
 ### crashkernel
@@ -274,7 +274,7 @@ Specify the bit width of the DMA heap.
 ### dom0\_max\_vcpus
 > `= <integer>`
 
-Specifiy the maximum number of vcpus to give to dom0.  This defaults
+Specify the maximum number of vcpus to give to dom0.  This defaults
 to the number of pcpus on the host.
 
 ### dom0\_mem (ia64)
@@ -345,7 +345,9 @@ Increase the number of PIRQs available f
 Set the logging level for Xen guests.  Any log message with equal more
 more importance will be printed.
 
-The optional `<rate-limited level>` options instructs which severities should be rate limited.
+The optional `<rate-limited level>` option instructs which severities
+should be rate limited.
+
 ### hap\_1gb
 ### hap\_2mb
 ### hpetbroadcast
@@ -373,7 +375,7 @@ all.
 Set the logging level for Xen.  Any log message with equal more more
 importance will be printed.
 
-The optional `<rate-limited level>` options instructs which severities
+The optional `<rate-limited level>` option instructs which severities
 should be rate limited.
 
 ### low\_crashinfo
@@ -383,7 +385,7 @@ should be rate limited.
 
 This option is only useful for hosts with a 32bit dom0 kernel, wishing
 to use kexec functionality in the case of a crash.  It represents
-which data structures should be deliberatly allocated in low memory,
+which data structures should be deliberately allocated in low memory,
 so the crash kernel may find find them.  Should be used in combination
 with `crashinfo_maxaddr`.
 
@@ -416,7 +418,7 @@ Instruct Xen to ignore any IOAPICs that 
 instead continue to use the legacy PIC. This is _not_ recommended with
 pvops type kernels.
 
-Because responsiblity for APIC setup is shared between Xen and the
+Because responsibility for APIC setup is shared between Xen and the
 domain 0 kernel this option is automatically propagated to the domain
 0 command line.
 
@@ -474,7 +476,7 @@ Choose the default scheduler.
 ### serial\_tx\_buffer
 > `= <size>`
 
-Set the serial tramsit buffer size.  Defaults to 16kB.
+Set the serial transmit buffer size.  Defaults to 16kB.
 
 ### smep
 ### snb\_igd\_quirk
@@ -526,7 +528,7 @@ with the specified width, height and dep
 
 `mode-<mode>` instructs Xen to use a specific mode, as shown with the
 `ask` option.  (N.B menu modes are displayed in hex, so `<mode>`
-should be a hexidecimal number)
+should be a hexadecimal number)
 
 The optional `keep` parameter causes Xen to continue using the vga
 console even after dom0 has been started.  The default behaviour is to

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF6-0000bu-55; Tue, 03 Apr 2012 20:22: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 1SFAF4-0000ai-MH
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from [85.158.143.99:41993] by server-3.bemta-4.messagelabs.com id
	85/E9-05853-6FB5B7F4; Tue, 03 Apr 2012 20:22:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1333484532!21898322!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11332 invoked from network); 3 Apr 2012 20:22:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAF2-00040d-AR
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF2-0003Gb-2u
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Message-Id: <E1SFAF2-0003Gb-2u@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document some more 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1333382565 -3600
# Node ID aeb637d0ecf64e26f24d1e01f98ec6403eec5f59
# Parent  ac0fcd6eeef789d004b88551c3651c1962a2a674
docs: Document some more hypercalls

Some of these could probably do with some review from people who know
what these hypercalls actually do.

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



diff -r ac0fcd6eeef7 -r aeb637d0ecf6 xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h	Mon Mar 26 17:11:13 2012 +0100
+++ b/xen/include/public/arch-x86/xen.h	Mon Apr 02 17:02:45 2012 +0100
@@ -65,6 +65,11 @@ typedef unsigned long xen_pfn_t;
  * SEGMENT DESCRIPTOR TABLES
  */
 /*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_gdt(const xen_pfn_t frames[], unsigned int entries);
+ * `
+ */
+/*
  * A number of GDT entries are reserved by Xen. These are not situated at the
  * 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,
@@ -83,6 +88,13 @@ typedef unsigned long xen_ulong_t;
 
 /*
  * ` enum neg_errnoval
+ * ` HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp);
+ * `
+ * Sets the stack segment and pointer for the current vcpu.
+ */
+
+/*
+ * ` enum neg_errnoval
  * ` HYPERVISOR_set_trap_table(const struct trap_info traps[]);
  * `
  */
@@ -183,6 +195,24 @@ typedef struct arch_shared_info arch_sha
 #endif /* !__ASSEMBLY__ */
 
 /*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_fpu_taskswitch(int set);
+ * `
+ * Sets (if set!=0) or clears (if set==0) CR0.TS.
+ */
+
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_debugreg(int regno, unsigned long value);
+ *
+ * ` unsigned long
+ * ` HYPERVISOR_get_debugreg(int regno);
+ * For 0<=reg<=7, returns the debug register value.
+ * For other values of reg, returns ((unsigned long)-EINVAL).
+ * (Unfortunately, this interface is defective.)
+ */
+
+/*
  * Prefix forces emulation of some non-trapping instructions.
  * Currently only CPUID.
  */
diff -r ac0fcd6eeef7 -r aeb637d0ecf6 xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h	Mon Mar 26 17:11:13 2012 +0100
+++ b/xen/include/public/arch-x86_64.h	Mon Apr 02 17:02:45 2012 +0100
@@ -25,3 +25,19 @@
  */
 
 #include "arch-x86/xen.h"
+
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_set_callbacks(unsigned long event_selector,
+ * `                          unsigned long event_address,
+ * `                          unsigned long failsafe_selector,
+ * `                          unsigned long failsafe_address);
+ * `
+ * Register for callbacks on events.  When an event (from an event
+ * channel) occurs, event_address is used as the value of eip.
+ *
+ * A similar callback occurs if the segment selectors are invalid.
+ * failsafe_address is used as the value of eip.
+ *
+ * On x86_64, event_selector and failsafe_selector are ignored (???).
+ */
diff -r ac0fcd6eeef7 -r aeb637d0ecf6 xen/include/public/platform.h
--- a/xen/include/public/platform.h	Mon Mar 26 17:11:13 2012 +0100
+++ b/xen/include/public/platform.h	Mon Apr 02 17:02:45 2012 +0100
@@ -504,6 +504,10 @@ struct xenpf_core_parking {
 typedef struct xenpf_core_parking xenpf_core_parking_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_core_parking_t);
 
+/*
+ * ` enum neg_errnoval
+ * ` HYPERVISOR_platform_op(const struct xen_platform_op*);
+ */
 struct xen_platform_op {
     uint32_t cmd;
     uint32_t interface_version; /* XENPF_INTERFACE_VERSION */

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF3-0000ax-Pe; Tue, 03 Apr 2012 20:22: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 1SFAF2-0000ah-LO
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from [85.158.139.83:37371] by server-7.bemta-5.messagelabs.com id
	C8/7D-16195-3FB5B7F4; Tue, 03 Apr 2012 20:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1333484529!18411440!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9908 invoked from network); 3 Apr 2012 20:22:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAEz-00040L-AJ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAEy-0003F0-W7
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Message-Id: <E1SFAEy-0003F0-W7@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: use bootargs for the command
	line
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381842 -3600
# Node ID ed36e57043941bdeb733559fec9b0d630beb6557
# Parent  ce659898b2dfc04dc7f54b52d1c5582fa45ea520
arm: use bootargs for the command line

Use the /chosen node's bootargs parameter for the Xen command line.
Parse it early on before the serial console is setup.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ce659898b2df -r ed36e5704394 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/arch/arm/setup.c	Mon Apr 02 16:50:42 2012 +0100
@@ -152,6 +152,8 @@ void __init start_xen(unsigned long boot
         + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
     fdt_size = device_tree_early_init(fdt);
 
+    cmdline_parse(device_tree_bootargs(fdt));
+
     setup_pagetables(boot_phys_offset);
 
 #ifdef EARLY_UART_ADDRESS
diff -r ce659898b2df -r ed36e5704394 xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/common/device_tree.c	Mon Apr 02 16:50:42 2012 +0100
@@ -118,6 +118,26 @@ int device_tree_for_each_node(const void
     return 0;
 }
 
+/**
+ * device_tree_bootargs - return the bootargs (the Xen command line)
+ * @fdt flat device tree.
+ */
+const char *device_tree_bootargs(const void *fdt)
+{
+    int node; 
+    const struct fdt_property *prop;
+
+    node = fdt_path_offset(fdt, "/chosen");
+    if ( node < 0 )
+        return NULL;
+
+    prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    if ( prop == NULL )
+        return NULL;
+
+    return prop->data;
+}
+
 static int dump_node(const void *fdt, int node, const char *name, int depth,
                      u32 address_cells, u32 size_cells, void *data)
 {
diff -r ce659898b2df -r ed36e5704394 xen/include/xen/device_tree.h
--- a/xen/include/xen/device_tree.h	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/include/xen/device_tree.h	Mon Apr 02 16:50:42 2012 +0100
@@ -49,6 +49,7 @@ u32 device_tree_get_u32(const void *fdt,
 bool_t device_tree_node_matches(const void *fdt, int node, const char *match);
 int device_tree_for_each_node(const void *fdt,
                               device_tree_node_func func, void *data);
+const char *device_tree_bootargs(const void *fdt);
 void device_tree_dump(const void *fdt);
 
 #endif

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000ce-Hw; Tue, 03 Apr 2012 20:22: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 1SFAF6-0000ag-7B
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Received: from [85.158.143.99:38202] by server-2.bemta-4.messagelabs.com id
	4A/2A-17550-7FB5B7F4; Tue, 03 Apr 2012 20:22:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1333484533!18829171!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11849 invoked from network); 3 Apr 2012 20:22: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;
	3 Apr 2012 20:22: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 1SFAF3-00040j-6g
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF3-0003H5-5M
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Message-Id: <E1SFAF3-0003H5-5M@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: provide a command to set the
	saved configuration for a running domain
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <Ian.Campbell@citrix.com>
# Date 1333382824 -3600
# Node ID 40efd7d36d469668e4cf86f3c1f0d7db7566254d
# Parent  c7054515e12e839254b5ee5aff24a01141554d52
xl: provide a command to set the saved configuration for a running domain

Pickup this new configuration on reboot.

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


diff -r c7054515e12e -r 40efd7d36d46 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Mar 27 11:36:54 2012 +0100
+++ b/docs/man/xl.pod.1	Mon Apr 02 17:07:04 2012 +0100
@@ -148,6 +148,31 @@ soon as it is run.
 
 =back
 
+=item B<config-update> B<domid> [I<configfile>] [I<OPTIONS>]
+
+Update the saved configuration for a running domain. This has no
+immediate effect but will be applied when the guest is next
+restarted. This command is useful to ensure that runtime modifications
+made to the guest will be preserved when the guest is restarted.
+
+I<configfile> has to be an absolute path to a file.
+
+B<OPTIONS>
+
+=over 4 
+
+=item B<-f=FILE>, B<--defconfig=FILE>
+
+Use the given configuration file.
+
+=item B<key=value>
+
+It is possible to pass I<key=value> pairs on the command line to provide
+options as if they were written in the configuration file; these override
+whatever is in the I<configfile>.
+
+=back
+
 =item B<console> [I<OPTIONS>] I<domain-id>
 
 Attach to domain I<domain-id>'s console.  If you've set up your domains to
diff -r c7054515e12e -r 40efd7d36d46 tools/libxl/xl.h
--- a/tools/libxl/xl.h	Tue Mar 27 11:36:54 2012 +0100
+++ b/tools/libxl/xl.h	Mon Apr 02 17:07:04 2012 +0100
@@ -50,6 +50,7 @@ int main_reboot(int argc, char **argv);
 int main_list(int argc, char **argv);
 int main_list_vm(int argc, char **argv);
 int main_create(int argc, char **argv);
+int main_config_update(int argc, char **argv);
 int main_button_press(int argc, char **argv);
 int main_vcpupin(int argc, char **argv);
 int main_vcpuset(int argc, char **argv);
diff -r c7054515e12e -r 40efd7d36d46 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Mar 27 11:36:54 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Mon Apr 02 17:07:04 2012 +0100
@@ -1206,11 +1206,31 @@ skip_vfb:
     xlu_cfg_destroy(config);
 }
 
+static void reload_domain_config(libxl_ctx *ctx, uint32_t domid,
+                                 uint8_t **config_data, int *config_len)
+{
+    uint8_t *t_data;
+    int ret, t_len;
+
+    ret = libxl_userdata_retrieve(ctx, domid, "xl", &t_data, &t_len);
+    if (ret) {
+        LOG("failed to retrieve guest configuration (rc=%d). "
+            "reusing old configuration", ret);
+        return;
+    }
+
+    free(*config_data);
+    *config_data = t_data;
+    *config_len = t_len;
+}
+
 /* Returns 1 if domain should be restarted,
  * 2 if domain should be renamed then restarted, or 0 */
 static int handle_domain_death(libxl_ctx *ctx, uint32_t domid,
                                libxl_event *event,
+                               uint8_t **config_data, int *config_len,
                                libxl_domain_config *d_config)
+
 {
     int restart = 0;
     libxl_action_on_shutdown action;
@@ -1265,10 +1285,13 @@ static int handle_domain_death(libxl_ctx
         break;
 
     case LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME:
+        reload_domain_config(ctx, domid, config_data, config_len);
         restart = 2;
         break;
 
     case LIBXL_ACTION_ON_SHUTDOWN_RESTART:
+        reload_domain_config(ctx, domid, config_data, config_len);
+
         restart = 1;
         /* fall-through */
     case LIBXL_ACTION_ON_SHUTDOWN_DESTROY:
@@ -1753,7 +1776,9 @@ start:
             LOG("Domain %d has shut down, reason code %d 0x%x", domid,
                 event->u.domain_shutdown.shutdown_reason,
                 event->u.domain_shutdown.shutdown_reason);
-            switch (handle_domain_death(ctx, domid, event, &d_config)) {
+            switch (handle_domain_death(ctx, domid, event,
+                                        (uint8_t **)&config_data, &config_len,
+                                        &d_config)) {
             case 2:
                 if (!preserve_domain(ctx, domid, event, &d_config)) {
                     /* If we fail then exit leaving the old domain in place. */
@@ -1790,6 +1815,12 @@ start:
                     d_config.c_info.name = strdup(common_domname);
                 }
 
+                /* Reparse the configuration in case it has changed */
+                libxl_domain_config_dispose(&d_config);
+                memset(&d_config, 0, sizeof(d_config));
+                parse_config_data(config_file, config_data, config_len,
+                                  &d_config);
+
                 /*
                  * XXX FIXME: If this sleep is not there then domain
                  * re-creation fails sometimes.
@@ -3399,6 +3430,120 @@ int main_create(int argc, char **argv)
     return 0;
 }
 
+int main_config_update(int argc, char **argv)
+{
+    const char *filename = NULL;
+    char *p;
+    char extra_config[1024];
+    void *config_data = 0;
+    int config_len = 0;
+    libxl_domain_config d_config;
+    int opt, rc;
+    int option_index = 0;
+    int debug = 0;
+    static struct option long_options[] = {
+        {"help", 0, 0, 'h'},
+        {"defconfig", 1, 0, 'f'},
+        {0, 0, 0, 0}
+    };
+
+    if (argc < 2) {
+        fprintf(stderr, "xl config-update requires a domain argument\n");
+        help("config-update");
+        exit(1);
+    }
+
+    find_domain(argv[1]);
+    argc--; argv++;
+
+    if (argv[1] && argv[1][0] != '-' && !strchr(argv[1], '=')) {
+        filename = argv[1];
+        argc--; argv++;
+    }
+
+    while (1) {
+        opt = getopt_long(argc, argv, "dhqf:", long_options, &option_index);
+        if (opt == -1)
+            break;
+
+        switch (opt) {
+        case 'd':
+            debug = 1;
+            break;
+        case 'f':
+            filename = optarg;
+            break;
+        case 'h':
+            help("create");
+            return 0;
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
+            break;
+        }
+    }
+
+    extra_config[0] = '\0';
+    for (p = extra_config; optind < argc; optind++) {
+        if (strchr(argv[optind], '=') != NULL) {
+            p += snprintf(p, sizeof(extra_config) - (p - extra_config),
+                "%s\n", argv[optind]);
+        } else if (!filename) {
+            filename = argv[optind];
+        } else {
+            help("create");
+            return 2;
+        }
+    }
+    if (filename) {
+        free(config_data);  config_data = 0;
+        rc = libxl_read_file_contents(ctx, filename,
+                                      &config_data, &config_len);
+        if (rc) { fprintf(stderr, "Failed to read config file: %s: %s\n",
+                           filename, strerror(errno)); return ERROR_FAIL; }
+        if (strlen(extra_config)) {
+            if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) {
+                fprintf(stderr, "Failed to attach extra configration\n");
+                exit(1);
+            }
+            /* allocate space for the extra config plus two EOLs plus \0 */
+            config_data = realloc(config_data, config_len
+                + strlen(extra_config) + 2 + 1);
+            if (!config_data) {
+                fprintf(stderr, "Failed to realloc config_data\n");
+                exit(1);
+            }
+            config_len += sprintf(config_data + config_len, "\n%s\n",
+                extra_config);
+        }
+    } else {
+        fprintf(stderr, "Config file not specified\n");
+        exit(1);
+    }
+
+    memset(&d_config, 0x00, sizeof(d_config));
+
+    parse_config_data(filename, config_data, config_len, &d_config);
+
+    if (debug || dryrun_only)
+        printf_info(default_output_format, -1, &d_config);
+
+    if (!dryrun_only) {
+        fprintf(stderr, "setting dom%d configuration\n", domid);
+        rc = libxl_userdata_store(ctx, domid, "xl",
+                                   config_data, config_len);
+        if (rc) {
+            fprintf(stderr, "failed to update configuration\n");
+            exit(1);
+        }
+    }
+
+    libxl_domain_config_dispose(&d_config);
+
+    free(config_data);
+
+    return 0;
+}
+
 static void button_press(const char *p, const char *b)
 {
     libxl_trigger trigger;
@@ -3921,7 +4066,6 @@ static int sched_credit_domain_set(int d
 {
     int rc;
 
-    
     rc = libxl_sched_credit_domain_set(ctx, domid, scinfo);
     if (rc)
         fprintf(stderr, "libxl_sched_credit_domain_set failed.\n");
diff -r c7054515e12e -r 40efd7d36d46 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Tue Mar 27 11:36:54 2012 +0100
+++ b/tools/libxl/xl_cmdtable.c	Mon Apr 02 17:07:04 2012 +0100
@@ -32,6 +32,15 @@ struct cmd_spec cmd_table[] = {
       "-d                      Enable debug messages.\n"
       "-e                      Do not wait in the background for the death of the domain."
     },
+    { "config-update",
+      &main_config_update, 1,
+      "Update a running domain's saved configuration, used when rebuilding "
+      "the domain after reboot",
+      "<Domain> <ConfigFile> [options] [vars]",
+      "-h                      Print this help.\n"
+      "-f FILE, --defconfig=FILE\n                     Use the given configuration file.\n"
+      "-d                      Enable debug messages.\n"
+    },
     { "list",
       &main_list, 0,
       "List information about 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 Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF3-0000b2-Rx; Tue, 03 Apr 2012 20:22: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 1SFAF2-0000ag-HO
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from [85.158.143.35:42528] by server-2.bemta-4.messagelabs.com id
	0F/1A-17550-3FB5B7F4; Tue, 03 Apr 2012 20:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1333484529!8421611!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31009 invoked from network); 3 Apr 2012 20:22:10 -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;
	3 Apr 2012 20: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 1SFAEy-00040I-Nr
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAEy-0003El-D3
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:08 +0000
Message-Id: <E1SFAEy-0003El-D3@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] device tree,
	arm: supply a flat device tree to dom0
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381842 -3600
# Node ID ce659898b2dfc04dc7f54b52d1c5582fa45ea520
# Parent  d90c658de78ac5c50f1b9c175167c9f94e683829
device tree,arm: supply a flat device tree to dom0

Build a flat device tree for dom0 based on the one supplied to Xen.
The following changes are made:

  * In the /chosen node, the xen,dom0-bootargs parameter is renamed to
    bootargs.

  * In all memory nodes, the reg parameters are adjusted to reflect
    the amount of memory dom0 can use.  The p2m is updated using this
    info.

Support for passing ATAGS to dom0 is removed.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[ removed device_tree_dump call -- ijc ]
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d90c658de78a -r ce659898b2df xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/domain_build.c	Mon Apr 02 16:50:42 2012 +0100
@@ -6,6 +6,10 @@
 #include <xen/sched.h>
 #include <asm/irq.h>
 #include <asm/regs.h>
+#include <xen/errno.h>
+#include <xen/device_tree.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/guest_access.h>
 
 #include "gic.h"
 #include "kernel.h"
@@ -13,6 +17,13 @@
 static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
 
+/*
+ * Amount of extra space required to dom0's device tree.  No new nodes
+ * are added (yet) but one terminating reserve map entry (16 bytes) is
+ * added.
+ */
+#define DOM0_FDT_EXTRA_SIZE (sizeof(struct fdt_reserve_entry))
+
 struct vcpu *__init alloc_dom0_vcpu0(void)
 {
     if ( opt_dom0_max_vcpus == 0 )
@@ -28,43 +39,205 @@ struct vcpu *__init alloc_dom0_vcpu0(voi
     return alloc_vcpu(dom0, 0, 0);
 }
 
-extern void guest_mode_entry(void);
+static int set_memory_reg(struct domain *d, struct kernel_info *kinfo,
+                          const void *fdt, const u32 *cell, int len,
+                          int address_cells, int size_cells, u32 *new_cell)
+{
+    int reg_size = (address_cells + size_cells) * sizeof(*cell);
+    int l = 0;
+    u64 start;
+    u64 size;
 
-static void setup_linux_atag(paddr_t tags, paddr_t ram_s, paddr_t ram_e)
+    while ( kinfo->unassigned_mem > 0 && l + reg_size <= len
+            && kinfo->mem.nr_banks < NR_MEM_BANKS )
+    {
+        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        if ( size > kinfo->unassigned_mem )
+            size = kinfo->unassigned_mem;
+        device_tree_set_reg(&new_cell, address_cells, size_cells, start, size);
+
+        printk("Populate P2M %#llx->%#llx\n", start, start + size);
+        p2m_populate_ram(d, start, start + size);
+        kinfo->mem.bank[kinfo->mem.nr_banks].start = start;
+        kinfo->mem.bank[kinfo->mem.nr_banks].size = size;
+        kinfo->mem.nr_banks++;
+        kinfo->unassigned_mem -= size;
+
+        l += reg_size;
+    }
+
+    return l;
+}
+
+static int write_properties(struct domain *d, struct kernel_info *kinfo,
+                            const void *fdt,
+                            int node, const char *name, int depth,
+                            u32 address_cells, u32 size_cells)
 {
-    paddr_t ma = gvirt_to_maddr(tags);
-    void *map = map_domain_page(ma>>PAGE_SHIFT);
-    void *p = map + (tags & (PAGE_SIZE - 1));
-    char cmdline[] = "earlyprintk=xenboot console=ttyAMA1 root=/dev/mmcblk0 debug rw";
+    int prop;
 
-    /* not enough room on this page for all the tags */
-    BUG_ON(PAGE_SIZE - (tags & (PAGE_SIZE - 1)) < 8 * sizeof(uint32_t));
+    for ( prop = fdt_first_property_offset(fdt, node);
+          prop >= 0;
+          prop = fdt_next_property_offset(fdt, prop) )
+    {
+        const struct fdt_property *p;
+        const char *prop_name;
+        const char *prop_data;
+        int prop_len;
+        char *new_data = NULL;
 
-#define TAG(type, val) *(type*)p = val; p+= sizeof(type)
+        p = fdt_get_property_by_offset(fdt, prop, NULL);
+        prop_name = fdt_string(fdt, fdt32_to_cpu(p->nameoff));
+        prop_data = p->data;
+        prop_len  = fdt32_to_cpu(p->len);
 
-    /* ATAG_CORE */
-    TAG(uint32_t, 2);
-    TAG(uint32_t, 0x54410001);
+        /*
+         * In chosen node: replace bootargs with value from
+         * xen,dom0-bootargs.
+         */
+        if ( device_tree_node_matches(fdt, node, "chosen") )
+        {
+            if ( strcmp(prop_name, "bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
+                prop_name = "bootargs";
+        }
+        /*
+         * In a memory node: adjust reg property.
+         */
+        else if ( device_tree_node_matches(fdt, node, "memory") )
+        {
+            if ( strcmp(prop_name, "reg") == 0 )
+            {
+                new_data = xzalloc_bytes(prop_len);
+                if ( new_data  == NULL )
+                    return -FDT_ERR_XEN(ENOMEM);
 
-    /* ATAG_MEM */
-    TAG(uint32_t, 4);
-    TAG(uint32_t, 0x54410002);
-    TAG(uint32_t, (ram_e - ram_s) & 0xFFFFFFFF);
-    TAG(uint32_t, ram_s & 0xFFFFFFFF);
+                prop_len = set_memory_reg(d, kinfo, fdt,
+                                          (u32 *)prop_data, prop_len,
+                                          address_cells, size_cells,
+                                          (u32 *)new_data);
+                prop_data = new_data;
+            }
+        }
 
-    /* ATAG_CMDLINE */
-    TAG(uint32_t, 2 + ((strlen(cmdline) + 4) >> 2));
-    TAG(uint32_t, 0x54410009);
-    memcpy(p, cmdline, strlen(cmdline) + 1);
-    p += ((strlen(cmdline) + 4) >> 2) << 2;
+        /*
+         * TODO: Should call map_mmio_regions() for all devices in the
+         * tree that have a "reg" parameter (except cpus).  This
+         * requires looking into the parent node's "ranges" property
+         * to translate the bus address in the "reg" value into
+         * physical addresses.  Regions also need to be rounded up to
+         * whole pages.
+         */
 
-    /* ATAG_NONE */
-    TAG(uint32_t, 0);
-    TAG(uint32_t, 0);
+        fdt_property(kinfo->fdt, prop_name, prop_data, prop_len);
 
-#undef TAG
+        xfree(new_data);
+    }
 
-    unmap_domain_page(map);
+    if ( prop == -FDT_ERR_NOTFOUND )
+        return 0;
+    return prop;
+}
+
+static int write_nodes(struct domain *d, struct kernel_info *kinfo,
+                       const void *fdt)
+{
+    int node;
+    int depth = 0, last_depth = -1;
+    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
+    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
+    int ret;
+
+    for ( node = 0, depth = 0;
+          node >= 0 && depth >= 0;
+          node = fdt_next_node(fdt, node, &depth) )
+    {
+        const char *name;
+
+        name = fdt_get_name(fdt, node, NULL);
+
+        if ( depth >= DEVICE_TREE_MAX_DEPTH )
+        {
+            printk("warning: node `%s' is nested too deep\n", name);
+            continue;
+        }
+
+        while ( last_depth-- >= depth )
+            fdt_end_node(kinfo->fdt);
+
+        address_cells[depth] = device_tree_get_u32(fdt, node, "#address-cells");
+        size_cells[depth] = device_tree_get_u32(fdt, node, "#size-cells");
+
+        fdt_begin_node(kinfo->fdt, name);
+
+        ret = write_properties(d, kinfo, fdt, node, name, depth,
+                               address_cells[depth-1], size_cells[depth-1]);
+        if ( ret < 0 )
+            return ret;
+
+        last_depth = depth;
+    }
+
+    while ( last_depth-- >= 0 )
+        fdt_end_node(kinfo->fdt);
+
+    return 0;
+}
+
+static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
+{
+    void *fdt;
+    int new_size;
+    int ret;
+
+    fdt = device_tree_flattened;
+
+    new_size = fdt_totalsize(fdt) + DOM0_FDT_EXTRA_SIZE;
+    kinfo->fdt = xmalloc_bytes(new_size);
+    if ( kinfo->fdt == NULL )
+        return -ENOMEM;
+
+    ret = fdt_create(kinfo->fdt, new_size);
+    if ( ret < 0 )
+        goto err;
+
+    fdt_finish_reservemap(kinfo->fdt);
+
+    ret = write_nodes(d, kinfo, fdt);
+    if ( ret < 0 )
+        goto err;
+
+    ret = fdt_finish(kinfo->fdt);
+    if ( ret < 0 )
+        goto err;
+
+    /*
+     * Put the device tree at the beginning of the first bank.  It
+     * must be below 4 GiB.
+     */
+    kinfo->dtb_paddr = kinfo->mem.bank[0].start + 0x100;
+    if ( kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt) > (1ull << 32) )
+    {
+        printk("Not enough memory below 4 GiB for the device tree.");
+        ret = -FDT_ERR_XEN(EINVAL);
+        goto err;
+    }
+
+    return 0;
+
+  err:
+    printk("Device tree generation failed (%d).\n", ret);
+    xfree(kinfo->fdt);
+    return -EINVAL;
+}
+
+static void dtb_load(struct kernel_info *kinfo)
+{
+    void * __user dtb_virt = (void *)(u32)kinfo->dtb_paddr;
+
+    raw_copy_to_guest(dtb_virt, kinfo->fdt, fdt_totalsize(kinfo->fdt));
+    xfree(kinfo->fdt);
 }
 
 int construct_dom0(struct domain *d)
@@ -82,22 +255,20 @@ int construct_dom0(struct domain *d)
 
     printk("*** LOADING DOMAIN 0 ***\n");
 
-    /* 128M at 2G physical */
-    /* TODO size and location from DT. */
-    kinfo.ram_start = 0x80000000;
-    kinfo.ram_end   = 0x88000000;
-
-    rc = kernel_prepare(&kinfo);
-    if (rc < 0)
-        return rc;
-
     d->max_pages = ~0U;
 
     if ( (rc = p2m_alloc_table(d)) != 0 )
         return rc;
 
-    printk("Populate P2M %#llx->%#llx\n", kinfo.ram_start, kinfo.ram_end);
-    p2m_populate_ram(d, kinfo.ram_start, kinfo.ram_end);
+    kinfo.unassigned_mem = 0x08000000; /* XXX */
+
+    rc = prepare_dtb(d, &kinfo);
+    if ( rc < 0 )
+        return rc;
+
+    rc = kernel_prepare(&kinfo);
+    if ( rc < 0 )
+        return rc;
 
     printk("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x18000000ULL, 0x1BFFFFFFULL);
     map_mmio_regions(d, 0x18000000, 0x1BFFFFFF, 0x18000000);
@@ -125,13 +296,12 @@ int construct_dom0(struct domain *d)
     /* Enable second stage translation */
     WRITE_CP32(READ_CP32(HCR) | HCR_VM, HCR); isb();
 
-    /* The following load uses domain's p2m */
+    /* The following loads use the domain's p2m */
     p2m_load_VTTBR(d);
 
+    dtb_load(&kinfo);
     kernel_load(&kinfo);
 
-    setup_linux_atag(kinfo.ram_start + 0x100, kinfo.ram_start, kinfo.ram_end);
-
     clear_bit(_VPF_down, &v->pause_flags);
 
     memset(regs, 0, sizeof(*regs));
@@ -153,7 +323,7 @@ int construct_dom0(struct domain *d)
 
     regs->r0 = 0; /* SBZ */
     regs->r1 = 2272; /* Machine NR: Versatile Express */
-    regs->r2 = kinfo.ram_start + 0x100; /* ATAGS */
+    regs->r2 = kinfo.dtb_paddr;
 
     WRITE_CP32(SCTLR_BASE, SCTLR);
 
diff -r d90c658de78a -r ce659898b2df xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/kernel.c	Mon Apr 02 16:50:42 2012 +0100
@@ -121,7 +121,7 @@ static int kernel_try_zimage_prepare(str
      * at 32k from start of RAM.
      */
     if (start == 0)
-        info->zimage.load_addr = info->ram_start + 0x8000;
+        info->zimage.load_addr = info->mem.bank[0].start + 0x8000;
     else
         info->zimage.load_addr = start;
     info->zimage.len = end - start;
diff -r d90c658de78a -r ce659898b2df xen/arch/arm/kernel.h
--- a/xen/arch/arm/kernel.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/kernel.h	Mon Apr 02 16:50:42 2012 +0100
@@ -7,11 +7,15 @@
 #define __ARCH_ARM_KERNEL_H__
 
 #include <xen/libelf.h>
+#include <xen/device_tree.h>
 
 struct kernel_info {
+    void *fdt; /* flat device tree */
+    paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
+    struct dt_mem_info mem;
+
+    paddr_t dtb_paddr;
     paddr_t entry;
-    paddr_t ram_start;
-    paddr_t ram_end;
 
     void *kernel_img;
     unsigned kernel_order;
diff -r d90c658de78a -r ce659898b2df xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/common/device_tree.c	Mon Apr 02 16:50:42 2012 +0100
@@ -23,7 +23,7 @@
 struct dt_early_info __initdata early_info;
 void *device_tree_flattened;
 
-static bool_t __init node_matches(const void *fdt, int node, const char *match)
+bool_t device_tree_node_matches(const void *fdt, int node, const char *match)
 {
     const char *name;
     size_t match_len;
@@ -48,16 +48,33 @@ static void __init get_val(const u32 **c
     }
 }
 
-static void __init get_register(const u32 **cell,
-                                u32 address_cells, u32 size_cells,
-                                u64 *start, u64 *size)
+void device_tree_get_reg(const u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 *start, u64 *size)
 {
     get_val(cell, address_cells, start);
     get_val(cell, size_cells, size);
 }
 
-static u32 __init prop_by_name_u32(const void *fdt, int node,
-                                   const char *prop_name)
+static void set_val(u32 **cell, u32 cells, u64 val)
+{
+    u32 c = cells;
+
+    while ( c-- )
+    {
+        (*cell)[c] = cpu_to_fdt32(val);
+        val >>= 32;
+    }
+    (*cell) += cells;
+}
+
+void device_tree_set_reg(u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 start, u64 size)
+{
+    set_val(cell, address_cells, start);
+    set_val(cell, size_cells, size);
+}
+
+u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name)
 {
     const struct fdt_property *prop;
 
@@ -68,8 +85,6 @@ static u32 __init prop_by_name_u32(const
     return fdt32_to_cpu(*(uint32_t*)prop->data);
 }
 
-#define MAX_DEPTH 16
-
 /**
  * device_tree_for_each_node - iterate over all device tree nodes
  * @fdt: flat device tree.
@@ -81,19 +96,19 @@ int device_tree_for_each_node(const void
 {
     int node;
     int depth;
-    u32 address_cells[MAX_DEPTH];
-    u32 size_cells[MAX_DEPTH];
+    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
+    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
     int ret;
 
     for ( node = 0, depth = 0;
           node >=0 && depth >= 0;
           node = fdt_next_node(fdt, node, &depth) )
     {
-        if ( depth >= MAX_DEPTH )
+        if ( depth >= DEVICE_TREE_MAX_DEPTH )
             continue;
 
-        address_cells[depth] = prop_by_name_u32(fdt, node, "#address-cells");
-        size_cells[depth] = prop_by_name_u32(fdt, node, "#size-cells");
+        address_cells[depth] = device_tree_get_u32(fdt, node, "#address-cells");
+        size_cells[depth] = device_tree_get_u32(fdt, node, "#size-cells");
 
         ret = func(fdt, node, fdt_get_name(fdt, node, NULL), depth,
                    address_cells[depth-1], size_cells[depth-1], data);
@@ -106,7 +121,7 @@ int device_tree_for_each_node(const void
 static int dump_node(const void *fdt, int node, const char *name, int depth,
                      u32 address_cells, u32 size_cells, void *data)
 {
-    char prefix[2*MAX_DEPTH + 1] = "";
+    char prefix[2*DEVICE_TREE_MAX_DEPTH + 1] = "";
     int i;
     int prop;
 
@@ -172,7 +187,7 @@ static void __init process_memory_node(c
 
     for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ )
     {
-        get_register(&cell, address_cells, size_cells, &start, &size);
+        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
         early_info.mem.bank[early_info.mem.nr_banks].start = start;
         early_info.mem.bank[early_info.mem.nr_banks].size = size;
         early_info.mem.nr_banks++;
@@ -184,7 +199,7 @@ static int __init early_scan_node(const 
                                   u32 address_cells, u32 size_cells,
                                   void *data)
 {
-    if ( node_matches(fdt, node, "memory") )
+    if ( device_tree_node_matches(fdt, node, "memory") )
         process_memory_node(fdt, node, name, address_cells, size_cells);
 
     return 0;
diff -r d90c658de78a -r ce659898b2df xen/include/xen/device_tree.h
--- a/xen/include/xen/device_tree.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/xen/device_tree.h	Mon Apr 02 16:50:42 2012 +0100
@@ -12,6 +12,8 @@
 
 #include <xen/types.h>
 
+#define DEVICE_TREE_MAX_DEPTH 16
+
 #define NR_MEM_BANKS 8
 
 struct membank {
@@ -39,6 +41,12 @@ extern void *device_tree_flattened;
 size_t device_tree_early_init(const void *fdt);
 paddr_t device_tree_get_xen_paddr(void);
 
+void device_tree_get_reg(const u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 *start, u64 *size);
+void device_tree_set_reg(u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 start, u64 size);
+u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name);
+bool_t device_tree_node_matches(const void *fdt, int node, const char *match);
 int device_tree_for_each_node(const void *fdt,
                               device_tree_node_func func, void *data);
 void device_tree_dump(const void *fdt);
diff -r d90c658de78a -r ce659898b2df xen/include/xen/libfdt/libfdt_env.h
--- a/xen/include/xen/libfdt/libfdt_env.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/xen/libfdt/libfdt_env.h	Mon Apr 02 16:50:42 2012 +0100
@@ -13,4 +13,7 @@
 #define fdt64_to_cpu(x) be64_to_cpu(x)
 #define cpu_to_fdt64(x) cpu_to_be64(x)
 
+/* Xen-specific libfdt error code. */
+#define FDT_ERR_XEN(err) (FDT_ERR_MAX + (err))
+
 #endif /* _LIBFDT_ENV_H */

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000cO-AD; Tue, 03 Apr 2012 20:22: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 1SFAF5-0000ag-Kj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from [85.158.143.35:31888] by server-2.bemta-4.messagelabs.com id
	C8/2A-17550-7FB5B7F4; Tue, 03 Apr 2012 20:22:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1333484533!5534770!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1084 invoked from network); 3 Apr 2012 20:22:14 -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;
	3 Apr 2012 20:22: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 1SFAF2-00040g-NH
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF2-0003Gq-Iq
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Message-Id: <E1SFAF2-0003Gq-Iq@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] README: Document optional ocaml
	dependencies
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332844614 -3600
# Node ID c7054515e12e839254b5ee5aff24a01141554d52
# Parent  aeb637d0ecf64e26f24d1e01f98ec6403eec5f59
README: Document optional ocaml dependencies

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


diff -r aeb637d0ecf6 -r c7054515e12e README
--- a/README	Mon Apr 02 17:02:45 2012 +0100
+++ b/README	Tue Mar 27 11:36:54 2012 +0100
@@ -61,6 +61,13 @@ provided by your OS distributor:
     * ACPI ASL compiler (iasl)
     * markdown
 
+In addition to the above there are a number of optional build
+prerequisites. Omitting these will cause the related features to be
+disabled at compile time:
+    * Development install of Ocaml (e.g. ocaml-nox and
+      ocaml-findlib). Required to build ocaml components which
+      includes the alternative ocaml xenstored.
+
 Second, you need to acquire a suitable kernel for use in domain 0. If
 possible you should use a kernel provided by your OS distributor. If
 no suitable kernel is available from your OS distributor then refer to

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF6-0000bz-7e; Tue, 03 Apr 2012 20: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 1SFAF5-0000aj-1p
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from [85.158.139.83:55682] by server-4.bemta-5.messagelabs.com id
	1D/72-10788-4FB5B7F4; Tue, 03 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1333484530!22376666!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23508 invoked from network); 3 Apr 2012 20:22:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAEz-00040O-L2
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAEz-0003FF-GN
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Message-Id: <E1SFAEz-0003FF-GN@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: add dom0_mem command line
	argument
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381843 -3600
# Node ID 5cbe2ab76a9cb4880cd0354cb3e3111930d985ee
# Parent  ed36e57043941bdeb733559fec9b0d630beb6557
arm: add dom0_mem command line argument

Add a simple dom0_mem command line argument.  It's not as flexible as
the x86 equivalent (the 'max' and 'min' prefixes are not supported).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ed36e5704394 -r 5cbe2ab76a9c xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/arch/arm/domain_build.c	Mon Apr 02 16:50:43 2012 +0100
@@ -17,6 +17,17 @@
 static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
 
+#define DOM0_MEM_DEFAULT 0x8000000 /* 128 MiB */
+static u64 __initdata dom0_mem = DOM0_MEM_DEFAULT;
+
+static void __init parse_dom0_mem(const char *s)
+{
+    dom0_mem = parse_size_and_unit(s, &s);
+    if ( dom0_mem == 0 )
+        dom0_mem = DOM0_MEM_DEFAULT;
+}
+custom_param("dom0_mem", parse_dom0_mem);
+
 /*
  * Amount of extra space required to dom0's device tree.  No new nodes
  * are added (yet) but one terminating reserve map entry (16 bytes) is
@@ -191,6 +202,8 @@ static int prepare_dtb(struct domain *d,
     int new_size;
     int ret;
 
+    kinfo->unassigned_mem = dom0_mem;
+
     fdt = device_tree_flattened;
 
     new_size = fdt_totalsize(fdt) + DOM0_FDT_EXTRA_SIZE;
@@ -260,8 +273,6 @@ int construct_dom0(struct domain *d)
     if ( (rc = p2m_alloc_table(d)) != 0 )
         return rc;
 
-    kinfo.unassigned_mem = 0x08000000; /* XXX */
-
     rc = prepare_dtb(d, &kinfo);
     if ( rc < 0 )
         return rc;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF3-0000ax-Pe; Tue, 03 Apr 2012 20:22: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 1SFAF2-0000ah-LO
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from [85.158.139.83:37371] by server-7.bemta-5.messagelabs.com id
	C8/7D-16195-3FB5B7F4; Tue, 03 Apr 2012 20:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1333484529!18411440!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9908 invoked from network); 3 Apr 2012 20:22:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAEz-00040L-AJ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAEy-0003F0-W7
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Message-Id: <E1SFAEy-0003F0-W7@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: use bootargs for the command
	line
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381842 -3600
# Node ID ed36e57043941bdeb733559fec9b0d630beb6557
# Parent  ce659898b2dfc04dc7f54b52d1c5582fa45ea520
arm: use bootargs for the command line

Use the /chosen node's bootargs parameter for the Xen command line.
Parse it early on before the serial console is setup.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ce659898b2df -r ed36e5704394 xen/arch/arm/setup.c
--- a/xen/arch/arm/setup.c	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/arch/arm/setup.c	Mon Apr 02 16:50:42 2012 +0100
@@ -152,6 +152,8 @@ void __init start_xen(unsigned long boot
         + (atag_paddr & ((1 << SECOND_SHIFT) - 1));
     fdt_size = device_tree_early_init(fdt);
 
+    cmdline_parse(device_tree_bootargs(fdt));
+
     setup_pagetables(boot_phys_offset);
 
 #ifdef EARLY_UART_ADDRESS
diff -r ce659898b2df -r ed36e5704394 xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/common/device_tree.c	Mon Apr 02 16:50:42 2012 +0100
@@ -118,6 +118,26 @@ int device_tree_for_each_node(const void
     return 0;
 }
 
+/**
+ * device_tree_bootargs - return the bootargs (the Xen command line)
+ * @fdt flat device tree.
+ */
+const char *device_tree_bootargs(const void *fdt)
+{
+    int node; 
+    const struct fdt_property *prop;
+
+    node = fdt_path_offset(fdt, "/chosen");
+    if ( node < 0 )
+        return NULL;
+
+    prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    if ( prop == NULL )
+        return NULL;
+
+    return prop->data;
+}
+
 static int dump_node(const void *fdt, int node, const char *name, int depth,
                      u32 address_cells, u32 size_cells, void *data)
 {
diff -r ce659898b2df -r ed36e5704394 xen/include/xen/device_tree.h
--- a/xen/include/xen/device_tree.h	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/include/xen/device_tree.h	Mon Apr 02 16:50:42 2012 +0100
@@ -49,6 +49,7 @@ u32 device_tree_get_u32(const void *fdt,
 bool_t device_tree_node_matches(const void *fdt, int node, const char *match);
 int device_tree_for_each_node(const void *fdt,
                               device_tree_node_func func, void *data);
+const char *device_tree_bootargs(const void *fdt);
 void device_tree_dump(const void *fdt);
 
 #endif

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000ce-Hw; Tue, 03 Apr 2012 20:22: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 1SFAF6-0000ag-7B
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Received: from [85.158.143.99:38202] by server-2.bemta-4.messagelabs.com id
	4A/2A-17550-7FB5B7F4; Tue, 03 Apr 2012 20:22:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1333484533!18829171!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11849 invoked from network); 3 Apr 2012 20:22: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;
	3 Apr 2012 20:22: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 1SFAF3-00040j-6g
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF3-0003H5-5M
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Message-Id: <E1SFAF3-0003H5-5M@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: provide a command to set the
	saved configuration for a running domain
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <Ian.Campbell@citrix.com>
# Date 1333382824 -3600
# Node ID 40efd7d36d469668e4cf86f3c1f0d7db7566254d
# Parent  c7054515e12e839254b5ee5aff24a01141554d52
xl: provide a command to set the saved configuration for a running domain

Pickup this new configuration on reboot.

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


diff -r c7054515e12e -r 40efd7d36d46 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Tue Mar 27 11:36:54 2012 +0100
+++ b/docs/man/xl.pod.1	Mon Apr 02 17:07:04 2012 +0100
@@ -148,6 +148,31 @@ soon as it is run.
 
 =back
 
+=item B<config-update> B<domid> [I<configfile>] [I<OPTIONS>]
+
+Update the saved configuration for a running domain. This has no
+immediate effect but will be applied when the guest is next
+restarted. This command is useful to ensure that runtime modifications
+made to the guest will be preserved when the guest is restarted.
+
+I<configfile> has to be an absolute path to a file.
+
+B<OPTIONS>
+
+=over 4 
+
+=item B<-f=FILE>, B<--defconfig=FILE>
+
+Use the given configuration file.
+
+=item B<key=value>
+
+It is possible to pass I<key=value> pairs on the command line to provide
+options as if they were written in the configuration file; these override
+whatever is in the I<configfile>.
+
+=back
+
 =item B<console> [I<OPTIONS>] I<domain-id>
 
 Attach to domain I<domain-id>'s console.  If you've set up your domains to
diff -r c7054515e12e -r 40efd7d36d46 tools/libxl/xl.h
--- a/tools/libxl/xl.h	Tue Mar 27 11:36:54 2012 +0100
+++ b/tools/libxl/xl.h	Mon Apr 02 17:07:04 2012 +0100
@@ -50,6 +50,7 @@ int main_reboot(int argc, char **argv);
 int main_list(int argc, char **argv);
 int main_list_vm(int argc, char **argv);
 int main_create(int argc, char **argv);
+int main_config_update(int argc, char **argv);
 int main_button_press(int argc, char **argv);
 int main_vcpupin(int argc, char **argv);
 int main_vcpuset(int argc, char **argv);
diff -r c7054515e12e -r 40efd7d36d46 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Mar 27 11:36:54 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Mon Apr 02 17:07:04 2012 +0100
@@ -1206,11 +1206,31 @@ skip_vfb:
     xlu_cfg_destroy(config);
 }
 
+static void reload_domain_config(libxl_ctx *ctx, uint32_t domid,
+                                 uint8_t **config_data, int *config_len)
+{
+    uint8_t *t_data;
+    int ret, t_len;
+
+    ret = libxl_userdata_retrieve(ctx, domid, "xl", &t_data, &t_len);
+    if (ret) {
+        LOG("failed to retrieve guest configuration (rc=%d). "
+            "reusing old configuration", ret);
+        return;
+    }
+
+    free(*config_data);
+    *config_data = t_data;
+    *config_len = t_len;
+}
+
 /* Returns 1 if domain should be restarted,
  * 2 if domain should be renamed then restarted, or 0 */
 static int handle_domain_death(libxl_ctx *ctx, uint32_t domid,
                                libxl_event *event,
+                               uint8_t **config_data, int *config_len,
                                libxl_domain_config *d_config)
+
 {
     int restart = 0;
     libxl_action_on_shutdown action;
@@ -1265,10 +1285,13 @@ static int handle_domain_death(libxl_ctx
         break;
 
     case LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME:
+        reload_domain_config(ctx, domid, config_data, config_len);
         restart = 2;
         break;
 
     case LIBXL_ACTION_ON_SHUTDOWN_RESTART:
+        reload_domain_config(ctx, domid, config_data, config_len);
+
         restart = 1;
         /* fall-through */
     case LIBXL_ACTION_ON_SHUTDOWN_DESTROY:
@@ -1753,7 +1776,9 @@ start:
             LOG("Domain %d has shut down, reason code %d 0x%x", domid,
                 event->u.domain_shutdown.shutdown_reason,
                 event->u.domain_shutdown.shutdown_reason);
-            switch (handle_domain_death(ctx, domid, event, &d_config)) {
+            switch (handle_domain_death(ctx, domid, event,
+                                        (uint8_t **)&config_data, &config_len,
+                                        &d_config)) {
             case 2:
                 if (!preserve_domain(ctx, domid, event, &d_config)) {
                     /* If we fail then exit leaving the old domain in place. */
@@ -1790,6 +1815,12 @@ start:
                     d_config.c_info.name = strdup(common_domname);
                 }
 
+                /* Reparse the configuration in case it has changed */
+                libxl_domain_config_dispose(&d_config);
+                memset(&d_config, 0, sizeof(d_config));
+                parse_config_data(config_file, config_data, config_len,
+                                  &d_config);
+
                 /*
                  * XXX FIXME: If this sleep is not there then domain
                  * re-creation fails sometimes.
@@ -3399,6 +3430,120 @@ int main_create(int argc, char **argv)
     return 0;
 }
 
+int main_config_update(int argc, char **argv)
+{
+    const char *filename = NULL;
+    char *p;
+    char extra_config[1024];
+    void *config_data = 0;
+    int config_len = 0;
+    libxl_domain_config d_config;
+    int opt, rc;
+    int option_index = 0;
+    int debug = 0;
+    static struct option long_options[] = {
+        {"help", 0, 0, 'h'},
+        {"defconfig", 1, 0, 'f'},
+        {0, 0, 0, 0}
+    };
+
+    if (argc < 2) {
+        fprintf(stderr, "xl config-update requires a domain argument\n");
+        help("config-update");
+        exit(1);
+    }
+
+    find_domain(argv[1]);
+    argc--; argv++;
+
+    if (argv[1] && argv[1][0] != '-' && !strchr(argv[1], '=')) {
+        filename = argv[1];
+        argc--; argv++;
+    }
+
+    while (1) {
+        opt = getopt_long(argc, argv, "dhqf:", long_options, &option_index);
+        if (opt == -1)
+            break;
+
+        switch (opt) {
+        case 'd':
+            debug = 1;
+            break;
+        case 'f':
+            filename = optarg;
+            break;
+        case 'h':
+            help("create");
+            return 0;
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
+            break;
+        }
+    }
+
+    extra_config[0] = '\0';
+    for (p = extra_config; optind < argc; optind++) {
+        if (strchr(argv[optind], '=') != NULL) {
+            p += snprintf(p, sizeof(extra_config) - (p - extra_config),
+                "%s\n", argv[optind]);
+        } else if (!filename) {
+            filename = argv[optind];
+        } else {
+            help("create");
+            return 2;
+        }
+    }
+    if (filename) {
+        free(config_data);  config_data = 0;
+        rc = libxl_read_file_contents(ctx, filename,
+                                      &config_data, &config_len);
+        if (rc) { fprintf(stderr, "Failed to read config file: %s: %s\n",
+                           filename, strerror(errno)); return ERROR_FAIL; }
+        if (strlen(extra_config)) {
+            if (config_len > INT_MAX - (strlen(extra_config) + 2 + 1)) {
+                fprintf(stderr, "Failed to attach extra configration\n");
+                exit(1);
+            }
+            /* allocate space for the extra config plus two EOLs plus \0 */
+            config_data = realloc(config_data, config_len
+                + strlen(extra_config) + 2 + 1);
+            if (!config_data) {
+                fprintf(stderr, "Failed to realloc config_data\n");
+                exit(1);
+            }
+            config_len += sprintf(config_data + config_len, "\n%s\n",
+                extra_config);
+        }
+    } else {
+        fprintf(stderr, "Config file not specified\n");
+        exit(1);
+    }
+
+    memset(&d_config, 0x00, sizeof(d_config));
+
+    parse_config_data(filename, config_data, config_len, &d_config);
+
+    if (debug || dryrun_only)
+        printf_info(default_output_format, -1, &d_config);
+
+    if (!dryrun_only) {
+        fprintf(stderr, "setting dom%d configuration\n", domid);
+        rc = libxl_userdata_store(ctx, domid, "xl",
+                                   config_data, config_len);
+        if (rc) {
+            fprintf(stderr, "failed to update configuration\n");
+            exit(1);
+        }
+    }
+
+    libxl_domain_config_dispose(&d_config);
+
+    free(config_data);
+
+    return 0;
+}
+
 static void button_press(const char *p, const char *b)
 {
     libxl_trigger trigger;
@@ -3921,7 +4066,6 @@ static int sched_credit_domain_set(int d
 {
     int rc;
 
-    
     rc = libxl_sched_credit_domain_set(ctx, domid, scinfo);
     if (rc)
         fprintf(stderr, "libxl_sched_credit_domain_set failed.\n");
diff -r c7054515e12e -r 40efd7d36d46 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Tue Mar 27 11:36:54 2012 +0100
+++ b/tools/libxl/xl_cmdtable.c	Mon Apr 02 17:07:04 2012 +0100
@@ -32,6 +32,15 @@ struct cmd_spec cmd_table[] = {
       "-d                      Enable debug messages.\n"
       "-e                      Do not wait in the background for the death of the domain."
     },
+    { "config-update",
+      &main_config_update, 1,
+      "Update a running domain's saved configuration, used when rebuilding "
+      "the domain after reboot",
+      "<Domain> <ConfigFile> [options] [vars]",
+      "-h                      Print this help.\n"
+      "-f FILE, --defconfig=FILE\n                     Use the given configuration file.\n"
+      "-d                      Enable debug messages.\n"
+    },
     { "list",
       &main_list, 0,
       "List information about 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 Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000cO-AD; Tue, 03 Apr 2012 20:22: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 1SFAF5-0000ag-Kj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from [85.158.143.35:31888] by server-2.bemta-4.messagelabs.com id
	C8/2A-17550-7FB5B7F4; Tue, 03 Apr 2012 20:22:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1333484533!5534770!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1084 invoked from network); 3 Apr 2012 20:22:14 -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;
	3 Apr 2012 20:22: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 1SFAF2-00040g-NH
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF2-0003Gq-Iq
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Message-Id: <E1SFAF2-0003Gq-Iq@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] README: Document optional ocaml
	dependencies
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332844614 -3600
# Node ID c7054515e12e839254b5ee5aff24a01141554d52
# Parent  aeb637d0ecf64e26f24d1e01f98ec6403eec5f59
README: Document optional ocaml dependencies

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


diff -r aeb637d0ecf6 -r c7054515e12e README
--- a/README	Mon Apr 02 17:02:45 2012 +0100
+++ b/README	Tue Mar 27 11:36:54 2012 +0100
@@ -61,6 +61,13 @@ provided by your OS distributor:
     * ACPI ASL compiler (iasl)
     * markdown
 
+In addition to the above there are a number of optional build
+prerequisites. Omitting these will cause the related features to be
+disabled at compile time:
+    * Development install of Ocaml (e.g. ocaml-nox and
+      ocaml-findlib). Required to build ocaml components which
+      includes the alternative ocaml xenstored.
+
 Second, you need to acquire a suitable kernel for use in domain 0. If
 possible you should use a kernel provided by your OS distributor. If
 no suitable kernel is available from your OS distributor then refer to

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF3-0000b2-Rx; Tue, 03 Apr 2012 20:22: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 1SFAF2-0000ag-HO
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:12 +0000
Received: from [85.158.143.35:42528] by server-2.bemta-4.messagelabs.com id
	0F/1A-17550-3FB5B7F4; Tue, 03 Apr 2012 20:22:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1333484529!8421611!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31009 invoked from network); 3 Apr 2012 20:22:10 -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;
	3 Apr 2012 20: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 1SFAEy-00040I-Nr
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAEy-0003El-D3
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:08 +0000
Message-Id: <E1SFAEy-0003El-D3@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] device tree,
	arm: supply a flat device tree to dom0
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381842 -3600
# Node ID ce659898b2dfc04dc7f54b52d1c5582fa45ea520
# Parent  d90c658de78ac5c50f1b9c175167c9f94e683829
device tree,arm: supply a flat device tree to dom0

Build a flat device tree for dom0 based on the one supplied to Xen.
The following changes are made:

  * In the /chosen node, the xen,dom0-bootargs parameter is renamed to
    bootargs.

  * In all memory nodes, the reg parameters are adjusted to reflect
    the amount of memory dom0 can use.  The p2m is updated using this
    info.

Support for passing ATAGS to dom0 is removed.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[ removed device_tree_dump call -- ijc ]
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r d90c658de78a -r ce659898b2df xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/domain_build.c	Mon Apr 02 16:50:42 2012 +0100
@@ -6,6 +6,10 @@
 #include <xen/sched.h>
 #include <asm/irq.h>
 #include <asm/regs.h>
+#include <xen/errno.h>
+#include <xen/device_tree.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/guest_access.h>
 
 #include "gic.h"
 #include "kernel.h"
@@ -13,6 +17,13 @@
 static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
 
+/*
+ * Amount of extra space required to dom0's device tree.  No new nodes
+ * are added (yet) but one terminating reserve map entry (16 bytes) is
+ * added.
+ */
+#define DOM0_FDT_EXTRA_SIZE (sizeof(struct fdt_reserve_entry))
+
 struct vcpu *__init alloc_dom0_vcpu0(void)
 {
     if ( opt_dom0_max_vcpus == 0 )
@@ -28,43 +39,205 @@ struct vcpu *__init alloc_dom0_vcpu0(voi
     return alloc_vcpu(dom0, 0, 0);
 }
 
-extern void guest_mode_entry(void);
+static int set_memory_reg(struct domain *d, struct kernel_info *kinfo,
+                          const void *fdt, const u32 *cell, int len,
+                          int address_cells, int size_cells, u32 *new_cell)
+{
+    int reg_size = (address_cells + size_cells) * sizeof(*cell);
+    int l = 0;
+    u64 start;
+    u64 size;
 
-static void setup_linux_atag(paddr_t tags, paddr_t ram_s, paddr_t ram_e)
+    while ( kinfo->unassigned_mem > 0 && l + reg_size <= len
+            && kinfo->mem.nr_banks < NR_MEM_BANKS )
+    {
+        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        if ( size > kinfo->unassigned_mem )
+            size = kinfo->unassigned_mem;
+        device_tree_set_reg(&new_cell, address_cells, size_cells, start, size);
+
+        printk("Populate P2M %#llx->%#llx\n", start, start + size);
+        p2m_populate_ram(d, start, start + size);
+        kinfo->mem.bank[kinfo->mem.nr_banks].start = start;
+        kinfo->mem.bank[kinfo->mem.nr_banks].size = size;
+        kinfo->mem.nr_banks++;
+        kinfo->unassigned_mem -= size;
+
+        l += reg_size;
+    }
+
+    return l;
+}
+
+static int write_properties(struct domain *d, struct kernel_info *kinfo,
+                            const void *fdt,
+                            int node, const char *name, int depth,
+                            u32 address_cells, u32 size_cells)
 {
-    paddr_t ma = gvirt_to_maddr(tags);
-    void *map = map_domain_page(ma>>PAGE_SHIFT);
-    void *p = map + (tags & (PAGE_SIZE - 1));
-    char cmdline[] = "earlyprintk=xenboot console=ttyAMA1 root=/dev/mmcblk0 debug rw";
+    int prop;
 
-    /* not enough room on this page for all the tags */
-    BUG_ON(PAGE_SIZE - (tags & (PAGE_SIZE - 1)) < 8 * sizeof(uint32_t));
+    for ( prop = fdt_first_property_offset(fdt, node);
+          prop >= 0;
+          prop = fdt_next_property_offset(fdt, prop) )
+    {
+        const struct fdt_property *p;
+        const char *prop_name;
+        const char *prop_data;
+        int prop_len;
+        char *new_data = NULL;
 
-#define TAG(type, val) *(type*)p = val; p+= sizeof(type)
+        p = fdt_get_property_by_offset(fdt, prop, NULL);
+        prop_name = fdt_string(fdt, fdt32_to_cpu(p->nameoff));
+        prop_data = p->data;
+        prop_len  = fdt32_to_cpu(p->len);
 
-    /* ATAG_CORE */
-    TAG(uint32_t, 2);
-    TAG(uint32_t, 0x54410001);
+        /*
+         * In chosen node: replace bootargs with value from
+         * xen,dom0-bootargs.
+         */
+        if ( device_tree_node_matches(fdt, node, "chosen") )
+        {
+            if ( strcmp(prop_name, "bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
+                prop_name = "bootargs";
+        }
+        /*
+         * In a memory node: adjust reg property.
+         */
+        else if ( device_tree_node_matches(fdt, node, "memory") )
+        {
+            if ( strcmp(prop_name, "reg") == 0 )
+            {
+                new_data = xzalloc_bytes(prop_len);
+                if ( new_data  == NULL )
+                    return -FDT_ERR_XEN(ENOMEM);
 
-    /* ATAG_MEM */
-    TAG(uint32_t, 4);
-    TAG(uint32_t, 0x54410002);
-    TAG(uint32_t, (ram_e - ram_s) & 0xFFFFFFFF);
-    TAG(uint32_t, ram_s & 0xFFFFFFFF);
+                prop_len = set_memory_reg(d, kinfo, fdt,
+                                          (u32 *)prop_data, prop_len,
+                                          address_cells, size_cells,
+                                          (u32 *)new_data);
+                prop_data = new_data;
+            }
+        }
 
-    /* ATAG_CMDLINE */
-    TAG(uint32_t, 2 + ((strlen(cmdline) + 4) >> 2));
-    TAG(uint32_t, 0x54410009);
-    memcpy(p, cmdline, strlen(cmdline) + 1);
-    p += ((strlen(cmdline) + 4) >> 2) << 2;
+        /*
+         * TODO: Should call map_mmio_regions() for all devices in the
+         * tree that have a "reg" parameter (except cpus).  This
+         * requires looking into the parent node's "ranges" property
+         * to translate the bus address in the "reg" value into
+         * physical addresses.  Regions also need to be rounded up to
+         * whole pages.
+         */
 
-    /* ATAG_NONE */
-    TAG(uint32_t, 0);
-    TAG(uint32_t, 0);
+        fdt_property(kinfo->fdt, prop_name, prop_data, prop_len);
 
-#undef TAG
+        xfree(new_data);
+    }
 
-    unmap_domain_page(map);
+    if ( prop == -FDT_ERR_NOTFOUND )
+        return 0;
+    return prop;
+}
+
+static int write_nodes(struct domain *d, struct kernel_info *kinfo,
+                       const void *fdt)
+{
+    int node;
+    int depth = 0, last_depth = -1;
+    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
+    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
+    int ret;
+
+    for ( node = 0, depth = 0;
+          node >= 0 && depth >= 0;
+          node = fdt_next_node(fdt, node, &depth) )
+    {
+        const char *name;
+
+        name = fdt_get_name(fdt, node, NULL);
+
+        if ( depth >= DEVICE_TREE_MAX_DEPTH )
+        {
+            printk("warning: node `%s' is nested too deep\n", name);
+            continue;
+        }
+
+        while ( last_depth-- >= depth )
+            fdt_end_node(kinfo->fdt);
+
+        address_cells[depth] = device_tree_get_u32(fdt, node, "#address-cells");
+        size_cells[depth] = device_tree_get_u32(fdt, node, "#size-cells");
+
+        fdt_begin_node(kinfo->fdt, name);
+
+        ret = write_properties(d, kinfo, fdt, node, name, depth,
+                               address_cells[depth-1], size_cells[depth-1]);
+        if ( ret < 0 )
+            return ret;
+
+        last_depth = depth;
+    }
+
+    while ( last_depth-- >= 0 )
+        fdt_end_node(kinfo->fdt);
+
+    return 0;
+}
+
+static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
+{
+    void *fdt;
+    int new_size;
+    int ret;
+
+    fdt = device_tree_flattened;
+
+    new_size = fdt_totalsize(fdt) + DOM0_FDT_EXTRA_SIZE;
+    kinfo->fdt = xmalloc_bytes(new_size);
+    if ( kinfo->fdt == NULL )
+        return -ENOMEM;
+
+    ret = fdt_create(kinfo->fdt, new_size);
+    if ( ret < 0 )
+        goto err;
+
+    fdt_finish_reservemap(kinfo->fdt);
+
+    ret = write_nodes(d, kinfo, fdt);
+    if ( ret < 0 )
+        goto err;
+
+    ret = fdt_finish(kinfo->fdt);
+    if ( ret < 0 )
+        goto err;
+
+    /*
+     * Put the device tree at the beginning of the first bank.  It
+     * must be below 4 GiB.
+     */
+    kinfo->dtb_paddr = kinfo->mem.bank[0].start + 0x100;
+    if ( kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt) > (1ull << 32) )
+    {
+        printk("Not enough memory below 4 GiB for the device tree.");
+        ret = -FDT_ERR_XEN(EINVAL);
+        goto err;
+    }
+
+    return 0;
+
+  err:
+    printk("Device tree generation failed (%d).\n", ret);
+    xfree(kinfo->fdt);
+    return -EINVAL;
+}
+
+static void dtb_load(struct kernel_info *kinfo)
+{
+    void * __user dtb_virt = (void *)(u32)kinfo->dtb_paddr;
+
+    raw_copy_to_guest(dtb_virt, kinfo->fdt, fdt_totalsize(kinfo->fdt));
+    xfree(kinfo->fdt);
 }
 
 int construct_dom0(struct domain *d)
@@ -82,22 +255,20 @@ int construct_dom0(struct domain *d)
 
     printk("*** LOADING DOMAIN 0 ***\n");
 
-    /* 128M at 2G physical */
-    /* TODO size and location from DT. */
-    kinfo.ram_start = 0x80000000;
-    kinfo.ram_end   = 0x88000000;
-
-    rc = kernel_prepare(&kinfo);
-    if (rc < 0)
-        return rc;
-
     d->max_pages = ~0U;
 
     if ( (rc = p2m_alloc_table(d)) != 0 )
         return rc;
 
-    printk("Populate P2M %#llx->%#llx\n", kinfo.ram_start, kinfo.ram_end);
-    p2m_populate_ram(d, kinfo.ram_start, kinfo.ram_end);
+    kinfo.unassigned_mem = 0x08000000; /* XXX */
+
+    rc = prepare_dtb(d, &kinfo);
+    if ( rc < 0 )
+        return rc;
+
+    rc = kernel_prepare(&kinfo);
+    if ( rc < 0 )
+        return rc;
 
     printk("Map CS2 MMIO regions 1:1 in the P2M %#llx->%#llx\n", 0x18000000ULL, 0x1BFFFFFFULL);
     map_mmio_regions(d, 0x18000000, 0x1BFFFFFF, 0x18000000);
@@ -125,13 +296,12 @@ int construct_dom0(struct domain *d)
     /* Enable second stage translation */
     WRITE_CP32(READ_CP32(HCR) | HCR_VM, HCR); isb();
 
-    /* The following load uses domain's p2m */
+    /* The following loads use the domain's p2m */
     p2m_load_VTTBR(d);
 
+    dtb_load(&kinfo);
     kernel_load(&kinfo);
 
-    setup_linux_atag(kinfo.ram_start + 0x100, kinfo.ram_start, kinfo.ram_end);
-
     clear_bit(_VPF_down, &v->pause_flags);
 
     memset(regs, 0, sizeof(*regs));
@@ -153,7 +323,7 @@ int construct_dom0(struct domain *d)
 
     regs->r0 = 0; /* SBZ */
     regs->r1 = 2272; /* Machine NR: Versatile Express */
-    regs->r2 = kinfo.ram_start + 0x100; /* ATAGS */
+    regs->r2 = kinfo.dtb_paddr;
 
     WRITE_CP32(SCTLR_BASE, SCTLR);
 
diff -r d90c658de78a -r ce659898b2df xen/arch/arm/kernel.c
--- a/xen/arch/arm/kernel.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/kernel.c	Mon Apr 02 16:50:42 2012 +0100
@@ -121,7 +121,7 @@ static int kernel_try_zimage_prepare(str
      * at 32k from start of RAM.
      */
     if (start == 0)
-        info->zimage.load_addr = info->ram_start + 0x8000;
+        info->zimage.load_addr = info->mem.bank[0].start + 0x8000;
     else
         info->zimage.load_addr = start;
     info->zimage.len = end - start;
diff -r d90c658de78a -r ce659898b2df xen/arch/arm/kernel.h
--- a/xen/arch/arm/kernel.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/arch/arm/kernel.h	Mon Apr 02 16:50:42 2012 +0100
@@ -7,11 +7,15 @@
 #define __ARCH_ARM_KERNEL_H__
 
 #include <xen/libelf.h>
+#include <xen/device_tree.h>
 
 struct kernel_info {
+    void *fdt; /* flat device tree */
+    paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
+    struct dt_mem_info mem;
+
+    paddr_t dtb_paddr;
     paddr_t entry;
-    paddr_t ram_start;
-    paddr_t ram_end;
 
     void *kernel_img;
     unsigned kernel_order;
diff -r d90c658de78a -r ce659898b2df xen/common/device_tree.c
--- a/xen/common/device_tree.c	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/common/device_tree.c	Mon Apr 02 16:50:42 2012 +0100
@@ -23,7 +23,7 @@
 struct dt_early_info __initdata early_info;
 void *device_tree_flattened;
 
-static bool_t __init node_matches(const void *fdt, int node, const char *match)
+bool_t device_tree_node_matches(const void *fdt, int node, const char *match)
 {
     const char *name;
     size_t match_len;
@@ -48,16 +48,33 @@ static void __init get_val(const u32 **c
     }
 }
 
-static void __init get_register(const u32 **cell,
-                                u32 address_cells, u32 size_cells,
-                                u64 *start, u64 *size)
+void device_tree_get_reg(const u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 *start, u64 *size)
 {
     get_val(cell, address_cells, start);
     get_val(cell, size_cells, size);
 }
 
-static u32 __init prop_by_name_u32(const void *fdt, int node,
-                                   const char *prop_name)
+static void set_val(u32 **cell, u32 cells, u64 val)
+{
+    u32 c = cells;
+
+    while ( c-- )
+    {
+        (*cell)[c] = cpu_to_fdt32(val);
+        val >>= 32;
+    }
+    (*cell) += cells;
+}
+
+void device_tree_set_reg(u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 start, u64 size)
+{
+    set_val(cell, address_cells, start);
+    set_val(cell, size_cells, size);
+}
+
+u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name)
 {
     const struct fdt_property *prop;
 
@@ -68,8 +85,6 @@ static u32 __init prop_by_name_u32(const
     return fdt32_to_cpu(*(uint32_t*)prop->data);
 }
 
-#define MAX_DEPTH 16
-
 /**
  * device_tree_for_each_node - iterate over all device tree nodes
  * @fdt: flat device tree.
@@ -81,19 +96,19 @@ int device_tree_for_each_node(const void
 {
     int node;
     int depth;
-    u32 address_cells[MAX_DEPTH];
-    u32 size_cells[MAX_DEPTH];
+    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
+    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
     int ret;
 
     for ( node = 0, depth = 0;
           node >=0 && depth >= 0;
           node = fdt_next_node(fdt, node, &depth) )
     {
-        if ( depth >= MAX_DEPTH )
+        if ( depth >= DEVICE_TREE_MAX_DEPTH )
             continue;
 
-        address_cells[depth] = prop_by_name_u32(fdt, node, "#address-cells");
-        size_cells[depth] = prop_by_name_u32(fdt, node, "#size-cells");
+        address_cells[depth] = device_tree_get_u32(fdt, node, "#address-cells");
+        size_cells[depth] = device_tree_get_u32(fdt, node, "#size-cells");
 
         ret = func(fdt, node, fdt_get_name(fdt, node, NULL), depth,
                    address_cells[depth-1], size_cells[depth-1], data);
@@ -106,7 +121,7 @@ int device_tree_for_each_node(const void
 static int dump_node(const void *fdt, int node, const char *name, int depth,
                      u32 address_cells, u32 size_cells, void *data)
 {
-    char prefix[2*MAX_DEPTH + 1] = "";
+    char prefix[2*DEVICE_TREE_MAX_DEPTH + 1] = "";
     int i;
     int prop;
 
@@ -172,7 +187,7 @@ static void __init process_memory_node(c
 
     for ( i = 0; i < banks && early_info.mem.nr_banks < NR_MEM_BANKS; i++ )
     {
-        get_register(&cell, address_cells, size_cells, &start, &size);
+        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
         early_info.mem.bank[early_info.mem.nr_banks].start = start;
         early_info.mem.bank[early_info.mem.nr_banks].size = size;
         early_info.mem.nr_banks++;
@@ -184,7 +199,7 @@ static int __init early_scan_node(const 
                                   u32 address_cells, u32 size_cells,
                                   void *data)
 {
-    if ( node_matches(fdt, node, "memory") )
+    if ( device_tree_node_matches(fdt, node, "memory") )
         process_memory_node(fdt, node, name, address_cells, size_cells);
 
     return 0;
diff -r d90c658de78a -r ce659898b2df xen/include/xen/device_tree.h
--- a/xen/include/xen/device_tree.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/xen/device_tree.h	Mon Apr 02 16:50:42 2012 +0100
@@ -12,6 +12,8 @@
 
 #include <xen/types.h>
 
+#define DEVICE_TREE_MAX_DEPTH 16
+
 #define NR_MEM_BANKS 8
 
 struct membank {
@@ -39,6 +41,12 @@ extern void *device_tree_flattened;
 size_t device_tree_early_init(const void *fdt);
 paddr_t device_tree_get_xen_paddr(void);
 
+void device_tree_get_reg(const u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 *start, u64 *size);
+void device_tree_set_reg(u32 **cell, u32 address_cells, u32 size_cells,
+                         u64 start, u64 size);
+u32 device_tree_get_u32(const void *fdt, int node, const char *prop_name);
+bool_t device_tree_node_matches(const void *fdt, int node, const char *match);
 int device_tree_for_each_node(const void *fdt,
                               device_tree_node_func func, void *data);
 void device_tree_dump(const void *fdt);
diff -r d90c658de78a -r ce659898b2df xen/include/xen/libfdt/libfdt_env.h
--- a/xen/include/xen/libfdt/libfdt_env.h	Mon Apr 02 10:54:05 2012 +0100
+++ b/xen/include/xen/libfdt/libfdt_env.h	Mon Apr 02 16:50:42 2012 +0100
@@ -13,4 +13,7 @@
 #define fdt64_to_cpu(x) be64_to_cpu(x)
 #define cpu_to_fdt64(x) cpu_to_be64(x)
 
+/* Xen-specific libfdt error code. */
+#define FDT_ERR_XEN(err) (FDT_ERR_MAX + (err))
+
 #endif /* _LIBFDT_ENV_H */

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF6-0000bz-7e; Tue, 03 Apr 2012 20: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 1SFAF5-0000aj-1p
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from [85.158.139.83:55682] by server-4.bemta-5.messagelabs.com id
	1D/72-10788-4FB5B7F4; Tue, 03 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1333484530!22376666!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23508 invoked from network); 3 Apr 2012 20:22:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20: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 1SFAEz-00040O-L2
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAEz-0003FF-GN
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:09 +0000
Message-Id: <E1SFAEz-0003FF-GN@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] arm: add dom0_mem command line
	argument
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333381843 -3600
# Node ID 5cbe2ab76a9cb4880cd0354cb3e3111930d985ee
# Parent  ed36e57043941bdeb733559fec9b0d630beb6557
arm: add dom0_mem command line argument

Add a simple dom0_mem command line argument.  It's not as flexible as
the x86 equivalent (the 'max' and 'min' prefixes are not supported).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r ed36e5704394 -r 5cbe2ab76a9c xen/arch/arm/domain_build.c
--- a/xen/arch/arm/domain_build.c	Mon Apr 02 16:50:42 2012 +0100
+++ b/xen/arch/arm/domain_build.c	Mon Apr 02 16:50:43 2012 +0100
@@ -17,6 +17,17 @@
 static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
 
+#define DOM0_MEM_DEFAULT 0x8000000 /* 128 MiB */
+static u64 __initdata dom0_mem = DOM0_MEM_DEFAULT;
+
+static void __init parse_dom0_mem(const char *s)
+{
+    dom0_mem = parse_size_and_unit(s, &s);
+    if ( dom0_mem == 0 )
+        dom0_mem = DOM0_MEM_DEFAULT;
+}
+custom_param("dom0_mem", parse_dom0_mem);
+
 /*
  * Amount of extra space required to dom0's device tree.  No new nodes
  * are added (yet) but one terminating reserve map entry (16 bytes) is
@@ -191,6 +202,8 @@ static int prepare_dtb(struct domain *d,
     int new_size;
     int ret;
 
+    kinfo->unassigned_mem = dom0_mem;
+
     fdt = device_tree_flattened;
 
     new_size = fdt_totalsize(fdt) + DOM0_FDT_EXTRA_SIZE;
@@ -260,8 +273,6 @@ int construct_dom0(struct domain *d)
     if ( (rc = p2m_alloc_table(d)) != 0 )
         return rc;
 
-    kinfo.unassigned_mem = 0x08000000; /* XXX */
-
     rc = prepare_dtb(d, &kinfo);
     if ( rc < 0 )
         return rc;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000cp-Kh; Tue, 03 Apr 2012 20:22: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 1SFAF6-0000ai-Sj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from [85.158.143.35:31925] by server-3.bemta-4.messagelabs.com id
	4C/E9-05853-8FB5B7F4; Tue, 03 Apr 2012 20:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1333484534!3997745!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10661 invoked from network); 3 Apr 2012 20:22:15 -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;
	3 Apr 2012 20:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-00040p-7d
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-0003HZ-6R
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Message-Id: <E1SFAF4-0003HZ-6R@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Handle non-ballooned,
	zero slackmem properly for pci passthru
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1333383751 -3600
# Node ID 86f9fd67152ba4c5bb3870f9b95ae304809eab86
# Parent  eb12efa7be28bdfd55a51e1603571b1f57305a98
libxl: Handle non-ballooned, zero slackmem properly for pci passthru

The e820_sanitize() function in libxl_pci.c expects one of its arguments to
be non-zero; but since a recent changeset, it can typically expect *to be*
zero.  Since the zero case is handled properly, just remove the check.

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


diff -r eb12efa7be28 -r 86f9fd67152b tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Mar 27 13:52:51 2012 +0100
+++ b/tools/libxl/libxl_pci.c	Mon Apr 02 17:22:31 2012 +0100
@@ -1177,7 +1177,7 @@ static int e820_sanitize(libxl_ctx *ctx,
     uint32_t i, idx = 0, nr;
     struct e820entry e820[E820MAX];
 
-    if (!src || !map_limitkb || !balloon_kb || !nr_entries)
+    if (!src || !map_limitkb || !nr_entries)
         return ERROR_INVAL;
 
     nr = *nr_entries;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF7-0000cp-Kh; Tue, 03 Apr 2012 20:22: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 1SFAF6-0000ai-Sj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from [85.158.143.35:31925] by server-3.bemta-4.messagelabs.com id
	4C/E9-05853-8FB5B7F4; Tue, 03 Apr 2012 20:22:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1333484534!3997745!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10661 invoked from network); 3 Apr 2012 20:22:15 -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;
	3 Apr 2012 20:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-00040p-7d
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-0003HZ-6R
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Message-Id: <E1SFAF4-0003HZ-6R@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Handle non-ballooned,
	zero slackmem properly for pci passthru
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1333383751 -3600
# Node ID 86f9fd67152ba4c5bb3870f9b95ae304809eab86
# Parent  eb12efa7be28bdfd55a51e1603571b1f57305a98
libxl: Handle non-ballooned, zero slackmem properly for pci passthru

The e820_sanitize() function in libxl_pci.c expects one of its arguments to
be non-zero; but since a recent changeset, it can typically expect *to be*
zero.  Since the zero case is handled properly, just remove the check.

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


diff -r eb12efa7be28 -r 86f9fd67152b tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Mar 27 13:52:51 2012 +0100
+++ b/tools/libxl/libxl_pci.c	Mon Apr 02 17:22:31 2012 +0100
@@ -1177,7 +1177,7 @@ static int e820_sanitize(libxl_ctx *ctx,
     uint32_t i, idx = 0, nr;
     struct e820entry e820[E820MAX];
 
-    if (!src || !map_limitkb || !balloon_kb || !nr_entries)
+    if (!src || !map_limitkb || !nr_entries)
         return ERROR_INVAL;
 
     nr = *nr_entries;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF8-0000eO-OY; Tue, 03 Apr 2012 20: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 1SFAF7-0000cN-Ph
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from [85.158.143.99:42039] by server-1.bemta-4.messagelabs.com id
	B7/07-20925-9FB5B7F4; Tue, 03 Apr 2012 20:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1333484533!21636273!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10775 invoked from network); 3 Apr 2012 20:22:14 -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 Apr 2012 20:22: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 1SFAF3-00040m-NW
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF3-0003HK-MJ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Message-Id: <E1SFAF3-0003HK-MJ@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: do not include xenctrl.h
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332852771 -3600
# Node ID eb12efa7be28bdfd55a51e1603571b1f57305a98
# Parent  40efd7d36d469668e4cf86f3c1f0d7db7566254d
xl: do not include xenctrl.h

Toolstacks which use libxl should not need to use libxc.

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


diff -r 40efd7d36d46 -r eb12efa7be28 tools/libxl/xl.c
--- a/tools/libxl/xl.c	Mon Apr 02 17:07:04 2012 +0100
+++ b/tools/libxl/xl.c	Tue Mar 27 13:52:51 2012 +0100
@@ -26,7 +26,6 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <inttypes.h>
-#include <xenctrl.h>
 
 #include "libxl.h"
 #include "libxl_utils.h"

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF8-0000eO-OY; Tue, 03 Apr 2012 20: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 1SFAF7-0000cN-Ph
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from [85.158.143.99:42039] by server-1.bemta-4.messagelabs.com id
	B7/07-20925-9FB5B7F4; Tue, 03 Apr 2012 20:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1333484533!21636273!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10775 invoked from network); 3 Apr 2012 20:22:14 -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 Apr 2012 20:22: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 1SFAF3-00040m-NW
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF3-0003HK-MJ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:13 +0000
Message-Id: <E1SFAF3-0003HK-MJ@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: do not include xenctrl.h
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332852771 -3600
# Node ID eb12efa7be28bdfd55a51e1603571b1f57305a98
# Parent  40efd7d36d469668e4cf86f3c1f0d7db7566254d
xl: do not include xenctrl.h

Toolstacks which use libxl should not need to use libxc.

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


diff -r 40efd7d36d46 -r eb12efa7be28 tools/libxl/xl.c
--- a/tools/libxl/xl.c	Mon Apr 02 17:07:04 2012 +0100
+++ b/tools/libxl/xl.c	Tue Mar 27 13:52:51 2012 +0100
@@ -26,7 +26,6 @@
 #include <fcntl.h>
 #include <ctype.h>
 #include <inttypes.h>
-#include <xenctrl.h>
 
 #include "libxl.h"
 #include "libxl_utils.h"

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF9-0000fC-0O; Tue, 03 Apr 2012 20:22: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 1SFAF7-0000ai-RC
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from [85.158.143.35:31957] by server-3.bemta-4.messagelabs.com id
	9F/E9-05853-9FB5B7F4; Tue, 03 Apr 2012 20:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1333484530!11722207!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24537 invoked from network); 3 Apr 2012 20:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF0-00040U-It
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF0-0003Fp-Hb
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Message-Id: <E1SFAF0-0003Fp-Hb@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: wrap
	misc/xen-command-line.markdown to 80 columns
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332778180 -3600
# Node ID f253a0119b1a25b4582b19607c7e3af58167f420
# Parent  ac66eedfd9878173a2b8d4e1e81236857a819319
docs: wrap misc/xen-command-line.markdown to 80 columns

Makes it more readable as a text document.

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


diff -r ac66eedfd987 -r f253a0119b1a docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Mon Apr 02 16:50:44 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:40 2012 +0100
@@ -1,12 +1,17 @@
 # Xen Hypervisor Command Line Options
 
-**This document is still a work in progress.  There are currently some command line options listed twice, and they are defined in separate arch trees, and some options are currently separate from their legacy versions.  Please remove this notice when complete.**
+**This document is still a work in progress.  There are currently some
+  command line options listed twice, and they are defined in separate
+  arch trees, and some options are currently separate from their
+  legacy versions.  Please remove this notice when complete.**
 
-This document coveres the command line options which the Xen Hypervisor.
+This document coveres the command line options which the Xen
+Hypervisor.
 
 ## Types of parameter
 
-Most parameters take the form `option=value`.  Different options on the command line should be space delimited.
+Most parameters take the form `option=value`.  Different options on
+the command line should be space delimited.
 
 ### Boolean (`<boolean>`)
 
@@ -16,7 +21,8 @@ All boolean option may be explicitly ena
 They may be explicitly disabled using a `value` of
 > `no`, `off`, `false`, `disable` or `0`
 
-In addition, a boolean option may be enabled by simply stating its name, and may be disabled by prefixing its name with `no-`.
+In addition, a boolean option may be enabled by simply stating its
+name, and may be disabled by prefixing its name with `no-`.
 
 ####Examples
 
@@ -31,7 +37,10 @@ Enable synchronous console mode
 
 ### Integer (`<integer>`)
 
-An integer parameter will default to decimal and may be prefixed with a `-` for negative numbers.  Alternativly, a hexidecimal number may be used by prefixing the number with `0x`, or an octal number may be used if a leading `0` is present.
+An integer parameter will default to decimal and may be prefixed with
+a `-` for negative numbers.  Alternativly, a hexidecimal number may be
+used by prefixing the number with `0x`, or an octal number may be used
+if a leading `0` is present.
 
 ### Size (`<size>`)
 
@@ -46,7 +55,9 @@ Without a size suffix, the default will 
 
 ### String
 
-Many parameters are more complicated and require more intricate configuration.  The detailed description of each individual paramter specify which values are valid.
+Many parameters are more complicated and require more intricate
+configuration.  The detailed description of each individual paramter
+specify which values are valid.
 
 ### List
 
@@ -54,7 +65,8 @@ Some options take a comma separated list
 
 ### Combination
 
-Some parameters act as combinations of the above, most commonly a mix of Boolean and String.  These are noted in the relevant sections.
+Some parameters act as combinations of the above, most commonly a mix
+of Boolean and String.  These are noted in the relevant sections.
 
 ## Parameter details
 
@@ -63,20 +75,32 @@ Some parameters act as combinations of t
 
 **String**, or **Boolean** to disable.
 
-The `acpi` option is used to control a set of four related boolean flags; `acpi_force`, `acpi_ht`, `acpi_noirq` and `acpi_disabled`.
+The `acpi` option is used to control a set of four related boolean
+flags; `acpi_force`, `acpi_ht`, `acpi_noirq` and `acpi_disabled`.
 
-By default, Xen will scan the DMI data and blacklist certain systems which are known to have broken ACPI setups.  Providing `acpi=force` will cause Xen to ignore the blacklist and attempt to use all ACPI features.
+By default, Xen will scan the DMI data and blacklist certain systems
+which are known to have broken ACPI setups.  Providing `acpi=force`
+will cause Xen to ignore the blacklist and attempt to use all ACPI
+features.
 
-Using `acpi=ht` causes Xen to parse the ACPI tables enough to enumerate all CPUs, but will not use other ACPI features.  This is not common, and only has an effect if your system is blacklisted.
+Using `acpi=ht` causes Xen to parse the ACPI tables enough to
+enumerate all CPUs, but will not use other ACPI features.  This is not
+common, and only has an effect if your system is blacklisted.
 
-The `acpi=noirq` option causes Xen to not parse the ACPI MADT table looking for IO-APIC entries.  This is also not common, and any system which requries this option to function should be blacklisted.  Additionally, this will not prevent Xen from finding IO-APIC entries from the MP tables.
+The `acpi=noirq` option causes Xen to not parse the ACPI MADT table
+looking for IO-APIC entries.  This is also not common, and any system
+which requries this option to function should be blacklisted.
+Additionally, this will not prevent Xen from finding IO-APIC entries
+from the MP tables.
 
-Finally, any of the boolean false options can be used to disable ACPI usage entirely.
+Finally, any of the boolean false options can be used to disable ACPI
+usage entirely.
 
 ### acpi\_apic\_instance
 > `= <integer>`
 
-Specify which ACPI MADT table to parse for APIC information, if more than one is present.
+Specify which ACPI MADT table to parse for APIC information, if more
+than one is present.
 
 ### acpi\_pstate\_strict
 ### acpi\_skip\_timer\_override
@@ -86,7 +110,9 @@ Specify which ACPI MADT table to parse f
 ### apic
 > `= summit | bigsmp | default`
 
-Override Xen's logic for choosing the APIC driver.  By default, if there are more than 8 CPUs, Xen will switch to `bigsmp` over `default`.
+Override Xen's logic for choosing the APIC driver.  By default, if
+there are more than 8 CPUs, Xen will switch to `bigsmp` over
+`default`.
 
 ### apic\_verbosity
 > `= verbose | debug`
@@ -98,7 +124,10 @@ Increase the verbosity of the APIC code 
 ### badpage
 > `= List of [ <integer> | <integer>-<integer> ]`
 
-Specify that certain pages, or certain ranges of pages contain bad bytes and should not be used.  For example, if your memory tester says that byte `0x12345678` is bad, you would place `badpage=0x12345` on Xen's command line.
+Specify that certain pages, or certain ranges of pages contain bad
+bytes and should not be used.  For example, if your memory tester says
+that byte `0x12345678` is bad, you would place `badpage=0x12345` on
+Xen's command line.
 
 ### bootscrub
 ### cachesize
@@ -108,9 +137,11 @@ Specify that certain pages, or certain r
 
 Both option `com1` and `com2` follow the same format.
 
-* `<baud>` may be either an integer baud rate, or the string `auto` if the bootloader or other earlier firmware has already set it up.
+* `<baud>` may be either an integer baud rate, or the string `auto` if
+  the bootloader or other earlier firmware has already set it up.
 * Optionally, a clock speed measured in hz can be specified.
-* `DPS` represents the number of data bits, the parity, and the number of stop bits.
+* `DPS` represents the number of data bits, the parity, and the number
+  of stop bits.
 
   `D` is an integer between 5 and 8 for the number of data bits.
 
@@ -124,12 +155,18 @@ Both option `com1` and `com2` follow the
 
   `S` is an integer 1 or 2 for the number of stop bits.
 
-* `<io-base>` is an integer which specifies the IO base port for UART registers.
-* `<irq> ` is the IRQ number to use, or `0` to use the UART in poll mode only.
-* `<port-bdf>` is the PCI location of the UART, in `<bus>:<device>.<function>` notation.
-* `<bridge-bdf>` is the PCI bridge behind which is the UART, in `<bus>:<device>.<function>` notation.
-* `pci` indicates that Xen should scan the PCI bus for the UART, avoiding Intel AMT devices.
-* `amt` indicated that Xen should scan the PCI bus for the UART, including Intel AMT devices if presetn.
+* `<io-base>` is an integer which specifies the IO base port for UART
+  registers.
+* `<irq>` is the IRQ number to use, or `0` to use the UART in poll
+  mode only.
+* `<port-bdf>` is the PCI location of the UART, in
+  `<bus>:<device>.<function>` notation.
+* `<bridge-bdf>` is the PCI bridge behind which is the UART, in
+  `<bus>:<device>.<function>` notation.
+* `pci` indicates that Xen should scan the PCI bus for the UART,
+  avoiding Intel AMT devices.
+* `amt` indicated that Xen should scan the PCI bus for the UART,
+  including Intel AMT devices if presetn.
 
 A typical setup for most situations might be `com1=115200,8n1`
 
@@ -150,9 +187,16 @@ Specify which console(s) Xen should use.
 
 `vga` indicates that Xen should try and use the vga graphics adapter.
 
-`com1` and `com2` indicates that Xen should use serial ports 1 and 2 respectivly.  Optionally, these arguments may be followed by an `H` or `L`.  `H` indicates that transmitted characters will have their MSB set, while recieved characters must have their MSB set.  `L` indicates the converse; transmitted and recieved characters will have their MSB cleared.  This allows a single port to be shared by two subsystems (e.g. console and debugger).
+`com1` and `com2` indicates that Xen should use serial ports 1 and 2
+respectivly.  Optionally, these arguments may be followed by an `H` or
+`L`.  `H` indicates that transmitted characters will have their MSB
+set, while recieved characters must have their MSB set.  `L` indicates
+the converse; transmitted and recieved characters will have their MSB
+cleared.  This allows a single port to be shared by two subsystems
+(e.g. console and debugger).
 
-`none` indicates that Xen should not use a console.  This option only makes sense on its own.
+`none` indicates that Xen should not use a console.  This option only
+makes sense on its own.
 
 ### console\_timestamps
 > `= <boolean>`
@@ -166,16 +210,22 @@ Flag to indicate whether include a times
 
 > Default: `false`
 
-Flag to indicate whether all guest console output should be copied into the console ring buffer.
+Flag to indicate whether all guest console output should be copied
+into the console ring buffer.
 
 ### conswitch
 > `= <switch char>[,x]`
 
 > Default `conswitch=a`
 
-Specify which character should be used to switch serial input between Xen and dom0.  The required sequence is CTRL-&lt;switch char&gt; three times.
+Specify which character should be used to switch serial input between
+Xen and dom0.  The required sequence is CTRL-&lt;switch char&gt; three
+times.
 
-The optional trailing `x` indicates that Xen should not automatically switch the console input to dom0 during boot.  Any other value, including omission, causes Xen to automatically switch to the dom0 console during dom0 boot.
+The optional trailing `x` indicates that Xen should not automatically
+switch the console input to dom0 during boot.  Any other value,
+including omission, causes Xen to automatically switch to the dom0
+console during dom0 boot.
 
 ### contig\_mem
 ### cpu\_type
@@ -193,7 +243,8 @@ The optional trailing `x` indicates that
 
 > Default: `4G`
 
-Specify the maximum address to allocate certain strucutres, if used in combination with the `low_crashinfo` command line option.
+Specify the maximum address to allocate certain strucutres, if used in
+combination with the `low_crashinfo` command line option.
 
 ### crashkernel
 ### credit2\_balance\_over
@@ -211,7 +262,8 @@ Specify the bit width of the DMA heap.
 ### dom0\_max\_vcpus
 > `= <integer>`
 
-Specifiy the maximum number of vcpus to give to dom0.  This defaults to the number of pcpus on the host.
+Specifiy the maximum number of vcpus to give to dom0.  This defaults
+to the number of pcpus on the host.
 
 ### dom0\_mem (ia64)
 > `= <size>`
@@ -260,7 +312,8 @@ Pin dom0 vcpus to their respective pcpus
 
 > Default: `guest_loglvl=none/warning`
 
-Set the logging level for Xen guests.  Any log message with equal more more importance will be printed.
+Set the logging level for Xen guests.  Any log message with equal more
+more importance will be printed.
 
 The optional `<rate-limited level>` options instructs which severities should be rate limited.
 ### hap\_1gb
@@ -276,7 +329,9 @@ The optional `<rate-limited level>` opti
 ### irq\_vector\_map
 ### lapic
 
-Force the use of use of the local APIC on a uniprocessor system, even if left disabled by the BIOS.  This option will accept any value at all.
+Force the use of use of the local APIC on a uniprocessor system, even
+if left disabled by the BIOS.  This option will accept any value at
+all.
 
 ### lapic\_timer\_c2\_ok
 ### ler
@@ -285,16 +340,22 @@ Force the use of use of the local APIC o
 
 > Default: `loglvl=warning`
 
-Set the logging level for Xen.  Any log message with equal more more importance will be printed.
+Set the logging level for Xen.  Any log message with equal more more
+importance will be printed.
 
-The optional `<rate-limited level>` options instructs which severities should be rate limited.
+The optional `<rate-limited level>` options instructs which severities
+should be rate limited.
 
 ### low\_crashinfo
 > `= none | min | all`
 
 > Default: `none` if not specified at all, or to `min` if `low\_crashinfo` is present without qualification.
 
-This option is only useful for hosts with a 32bit dom0 kernel, wishing to use kexec functionality in the case of a crash.  It represents which data structures should be deliberatly allocated in low memory, so the crash kernel may find find them.  Should be used in combination with `crashinfo_maxaddr`.
+This option is only useful for hosts with a 32bit dom0 kernel, wishing
+to use kexec functionality in the case of a crash.  It represents
+which data structures should be deliberatly allocated in low memory,
+so the crash kernel may find find them.  Should be used in combination
+with `crashinfo_maxaddr`.
 
 ### max\_cstate
 ### max\_gsi\_irqs
@@ -306,7 +367,8 @@ This option is only useful for hosts wit
 ### mem
 > `= <size>`
 
-Specifies the maximum address of physical RAM.  Any RAM beyond this limit is ignored by Xen.
+Specifies the maximum address of physical RAM.  Any RAM beyond this
+limit is ignored by Xen.
 
 ### mmcfg
 ### nmi
@@ -314,29 +376,37 @@ Specifies the maximum address of physica
 
 > Default: `nmi=fatal`
 
-Specify what Xen should do in the event of an NMI parity or I/O error.  `ignore` discards the error; `dom0` causes Xen to report the error to dom0, while 'fatal' causes Xen to print diagnostics and then hang.
+Specify what Xen should do in the event of an NMI parity or I/O error.
+`ignore` discards the error; `dom0` causes Xen to report the error to
+dom0, while 'fatal' causes Xen to print diagnostics and then hang.
 
 ### noapic
 ### nofxsr
 ### noirqbalance
 > `= <boolean>`
 
-Disable software IRQ balancing and affinity. This can be used on systems such as Dell 1850/2850 that have workarounds in hardware for IRQ routing issues.
+Disable software IRQ balancing and affinity. This can be used on
+systems such as Dell 1850/2850 that have workarounds in hardware for
+IRQ routing issues.
 
 ### nolapic
 
-Ignore the local APIC on a uniprocessor system, even if enabled by the BIOS.  This option will accept value.
+Ignore the local APIC on a uniprocessor system, even if enabled by the
+BIOS.  This option will accept value.
 
 ### noreboot
 > `= <boolean>`
 
-Do not automatically reboot after an error.  This is useful for catching debug output.  Defaults to automatically reboot after 5 seconds.
+Do not automatically reboot after an error.  This is useful for
+catching debug output.  Defaults to automatically reboot after 5
+seconds.
 
 ### noserialnumber
 ### nosmp
 > `= <boolean>`
 
-Disable SMP support.  No secondary processors will be booted.  Defaults to booting secondary processors.
+Disable SMP support.  No secondary processors will be booted.
+Defaults to booting secondary processors.
 
 ### nr\_irqs
 ### numa
@@ -360,6 +430,7 @@ Choose the default scheduler.
 > `= <size>`
 
 Set the serial tramsit buffer size.  Defaults to 16kB.
+
 ### smep
 ### snb\_igd\_quirk
 ### sync\_console
@@ -367,7 +438,8 @@ Set the serial tramsit buffer size.  Def
 
 > Default: `false`
 
-Flag to force synchronous console output.  Useful for debugging, but not suitable for production environments due to incurred overhead.
+Flag to force synchronous console output.  Useful for debugging, but
+not suitable for production environments due to incurred overhead.
 
 ### tboot
 ### tbuf\_size
@@ -395,17 +467,25 @@ Specify the per-cpu trace buffer size in
 ### vga
 > `= ( ask | current | text-80x<rows> | gfx-<width>x<height>x<depth> | mode-<mode> )[,keep]`
 
-`ask` causes Xen to display a menu of available modes and request the user to choose one of them.
+`ask` causes Xen to display a menu of available modes and request the
+user to choose one of them.
 
-`current` causes Xen to use the graphics adapter in its current state, without further setup.
+`current` causes Xen to use the graphics adapter in its current state,
+without further setup.
 
-`text-80x<rows>` instructs Xen to set up text mode.  Valid values for `<rows>` are `25, 28, 30, 34, 43, 50, 80`
+`text-80x<rows>` instructs Xen to set up text mode.  Valid values for
+`<rows>` are `25, 28, 30, 34, 43, 50, 80`
 
-`gfx-<width>x<height>x<depth>` instructs Xen to set up graphics mode with the specified width, height and depth.
+`gfx-<width>x<height>x<depth>` instructs Xen to set up graphics mode
+with the specified width, height and depth.
 
-`mode-<mode>` instructs Xen to use a specific mode, as shown with the `ask` option.  (N.B menu modes are displayed in hex, so `<mode>` should be a hexidecimal number)
+`mode-<mode>` instructs Xen to use a specific mode, as shown with the
+`ask` option.  (N.B menu modes are displayed in hex, so `<mode>`
+should be a hexidecimal number)
 
-The optional `keep` parameter causes Xen to continue using the vga console even after dom0 has been started.  The default behaviour is to relinquish control to dom0.
+The optional `keep` parameter causes Xen to continue using the vga
+console even after dom0 has been started.  The default behaviour is to
+relinquish control to dom0.
 
 ### vpid
 ### vpmu
@@ -416,14 +496,16 @@ The optional `keep` parameter causes Xen
 
 > Default: `false`
 
-Run an NMI watchdog on each processor.  If a processor is stuck for longer than the watchdog\_timeout, a panic occurs.
+Run an NMI watchdog on each processor.  If a processor is stuck for
+longer than the watchdog\_timeout, a panic occurs.
 
 ### watchdog\_timeout
 > `= <integer>`
 
 > Default: `5`
 
-Set the NMI watchdog timeout in seconds.  Specifying `0` will turn off the watchdog.
+Set the NMI watchdog timeout in seconds.  Specifying `0` will turn off
+the watchdog.
 
 ### x2apic
 ### x2apic\_phys

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAF9-0000fC-0O; Tue, 03 Apr 2012 20:22: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 1SFAF7-0000ai-RC
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from [85.158.143.35:31957] by server-3.bemta-4.messagelabs.com id
	9F/E9-05853-9FB5B7F4; Tue, 03 Apr 2012 20:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1333484530!11722207!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24537 invoked from network); 3 Apr 2012 20:22:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF0-00040U-It
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF0-0003Fp-Hb
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:10 +0000
Message-Id: <E1SFAF0-0003Fp-Hb@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: wrap
	misc/xen-command-line.markdown to 80 columns
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332778180 -3600
# Node ID f253a0119b1a25b4582b19607c7e3af58167f420
# Parent  ac66eedfd9878173a2b8d4e1e81236857a819319
docs: wrap misc/xen-command-line.markdown to 80 columns

Makes it more readable as a text document.

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


diff -r ac66eedfd987 -r f253a0119b1a docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Mon Apr 02 16:50:44 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Mon Mar 26 17:09:40 2012 +0100
@@ -1,12 +1,17 @@
 # Xen Hypervisor Command Line Options
 
-**This document is still a work in progress.  There are currently some command line options listed twice, and they are defined in separate arch trees, and some options are currently separate from their legacy versions.  Please remove this notice when complete.**
+**This document is still a work in progress.  There are currently some
+  command line options listed twice, and they are defined in separate
+  arch trees, and some options are currently separate from their
+  legacy versions.  Please remove this notice when complete.**
 
-This document coveres the command line options which the Xen Hypervisor.
+This document coveres the command line options which the Xen
+Hypervisor.
 
 ## Types of parameter
 
-Most parameters take the form `option=value`.  Different options on the command line should be space delimited.
+Most parameters take the form `option=value`.  Different options on
+the command line should be space delimited.
 
 ### Boolean (`<boolean>`)
 
@@ -16,7 +21,8 @@ All boolean option may be explicitly ena
 They may be explicitly disabled using a `value` of
 > `no`, `off`, `false`, `disable` or `0`
 
-In addition, a boolean option may be enabled by simply stating its name, and may be disabled by prefixing its name with `no-`.
+In addition, a boolean option may be enabled by simply stating its
+name, and may be disabled by prefixing its name with `no-`.
 
 ####Examples
 
@@ -31,7 +37,10 @@ Enable synchronous console mode
 
 ### Integer (`<integer>`)
 
-An integer parameter will default to decimal and may be prefixed with a `-` for negative numbers.  Alternativly, a hexidecimal number may be used by prefixing the number with `0x`, or an octal number may be used if a leading `0` is present.
+An integer parameter will default to decimal and may be prefixed with
+a `-` for negative numbers.  Alternativly, a hexidecimal number may be
+used by prefixing the number with `0x`, or an octal number may be used
+if a leading `0` is present.
 
 ### Size (`<size>`)
 
@@ -46,7 +55,9 @@ Without a size suffix, the default will 
 
 ### String
 
-Many parameters are more complicated and require more intricate configuration.  The detailed description of each individual paramter specify which values are valid.
+Many parameters are more complicated and require more intricate
+configuration.  The detailed description of each individual paramter
+specify which values are valid.
 
 ### List
 
@@ -54,7 +65,8 @@ Some options take a comma separated list
 
 ### Combination
 
-Some parameters act as combinations of the above, most commonly a mix of Boolean and String.  These are noted in the relevant sections.
+Some parameters act as combinations of the above, most commonly a mix
+of Boolean and String.  These are noted in the relevant sections.
 
 ## Parameter details
 
@@ -63,20 +75,32 @@ Some parameters act as combinations of t
 
 **String**, or **Boolean** to disable.
 
-The `acpi` option is used to control a set of four related boolean flags; `acpi_force`, `acpi_ht`, `acpi_noirq` and `acpi_disabled`.
+The `acpi` option is used to control a set of four related boolean
+flags; `acpi_force`, `acpi_ht`, `acpi_noirq` and `acpi_disabled`.
 
-By default, Xen will scan the DMI data and blacklist certain systems which are known to have broken ACPI setups.  Providing `acpi=force` will cause Xen to ignore the blacklist and attempt to use all ACPI features.
+By default, Xen will scan the DMI data and blacklist certain systems
+which are known to have broken ACPI setups.  Providing `acpi=force`
+will cause Xen to ignore the blacklist and attempt to use all ACPI
+features.
 
-Using `acpi=ht` causes Xen to parse the ACPI tables enough to enumerate all CPUs, but will not use other ACPI features.  This is not common, and only has an effect if your system is blacklisted.
+Using `acpi=ht` causes Xen to parse the ACPI tables enough to
+enumerate all CPUs, but will not use other ACPI features.  This is not
+common, and only has an effect if your system is blacklisted.
 
-The `acpi=noirq` option causes Xen to not parse the ACPI MADT table looking for IO-APIC entries.  This is also not common, and any system which requries this option to function should be blacklisted.  Additionally, this will not prevent Xen from finding IO-APIC entries from the MP tables.
+The `acpi=noirq` option causes Xen to not parse the ACPI MADT table
+looking for IO-APIC entries.  This is also not common, and any system
+which requries this option to function should be blacklisted.
+Additionally, this will not prevent Xen from finding IO-APIC entries
+from the MP tables.
 
-Finally, any of the boolean false options can be used to disable ACPI usage entirely.
+Finally, any of the boolean false options can be used to disable ACPI
+usage entirely.
 
 ### acpi\_apic\_instance
 > `= <integer>`
 
-Specify which ACPI MADT table to parse for APIC information, if more than one is present.
+Specify which ACPI MADT table to parse for APIC information, if more
+than one is present.
 
 ### acpi\_pstate\_strict
 ### acpi\_skip\_timer\_override
@@ -86,7 +110,9 @@ Specify which ACPI MADT table to parse f
 ### apic
 > `= summit | bigsmp | default`
 
-Override Xen's logic for choosing the APIC driver.  By default, if there are more than 8 CPUs, Xen will switch to `bigsmp` over `default`.
+Override Xen's logic for choosing the APIC driver.  By default, if
+there are more than 8 CPUs, Xen will switch to `bigsmp` over
+`default`.
 
 ### apic\_verbosity
 > `= verbose | debug`
@@ -98,7 +124,10 @@ Increase the verbosity of the APIC code 
 ### badpage
 > `= List of [ <integer> | <integer>-<integer> ]`
 
-Specify that certain pages, or certain ranges of pages contain bad bytes and should not be used.  For example, if your memory tester says that byte `0x12345678` is bad, you would place `badpage=0x12345` on Xen's command line.
+Specify that certain pages, or certain ranges of pages contain bad
+bytes and should not be used.  For example, if your memory tester says
+that byte `0x12345678` is bad, you would place `badpage=0x12345` on
+Xen's command line.
 
 ### bootscrub
 ### cachesize
@@ -108,9 +137,11 @@ Specify that certain pages, or certain r
 
 Both option `com1` and `com2` follow the same format.
 
-* `<baud>` may be either an integer baud rate, or the string `auto` if the bootloader or other earlier firmware has already set it up.
+* `<baud>` may be either an integer baud rate, or the string `auto` if
+  the bootloader or other earlier firmware has already set it up.
 * Optionally, a clock speed measured in hz can be specified.
-* `DPS` represents the number of data bits, the parity, and the number of stop bits.
+* `DPS` represents the number of data bits, the parity, and the number
+  of stop bits.
 
   `D` is an integer between 5 and 8 for the number of data bits.
 
@@ -124,12 +155,18 @@ Both option `com1` and `com2` follow the
 
   `S` is an integer 1 or 2 for the number of stop bits.
 
-* `<io-base>` is an integer which specifies the IO base port for UART registers.
-* `<irq> ` is the IRQ number to use, or `0` to use the UART in poll mode only.
-* `<port-bdf>` is the PCI location of the UART, in `<bus>:<device>.<function>` notation.
-* `<bridge-bdf>` is the PCI bridge behind which is the UART, in `<bus>:<device>.<function>` notation.
-* `pci` indicates that Xen should scan the PCI bus for the UART, avoiding Intel AMT devices.
-* `amt` indicated that Xen should scan the PCI bus for the UART, including Intel AMT devices if presetn.
+* `<io-base>` is an integer which specifies the IO base port for UART
+  registers.
+* `<irq>` is the IRQ number to use, or `0` to use the UART in poll
+  mode only.
+* `<port-bdf>` is the PCI location of the UART, in
+  `<bus>:<device>.<function>` notation.
+* `<bridge-bdf>` is the PCI bridge behind which is the UART, in
+  `<bus>:<device>.<function>` notation.
+* `pci` indicates that Xen should scan the PCI bus for the UART,
+  avoiding Intel AMT devices.
+* `amt` indicated that Xen should scan the PCI bus for the UART,
+  including Intel AMT devices if presetn.
 
 A typical setup for most situations might be `com1=115200,8n1`
 
@@ -150,9 +187,16 @@ Specify which console(s) Xen should use.
 
 `vga` indicates that Xen should try and use the vga graphics adapter.
 
-`com1` and `com2` indicates that Xen should use serial ports 1 and 2 respectivly.  Optionally, these arguments may be followed by an `H` or `L`.  `H` indicates that transmitted characters will have their MSB set, while recieved characters must have their MSB set.  `L` indicates the converse; transmitted and recieved characters will have their MSB cleared.  This allows a single port to be shared by two subsystems (e.g. console and debugger).
+`com1` and `com2` indicates that Xen should use serial ports 1 and 2
+respectivly.  Optionally, these arguments may be followed by an `H` or
+`L`.  `H` indicates that transmitted characters will have their MSB
+set, while recieved characters must have their MSB set.  `L` indicates
+the converse; transmitted and recieved characters will have their MSB
+cleared.  This allows a single port to be shared by two subsystems
+(e.g. console and debugger).
 
-`none` indicates that Xen should not use a console.  This option only makes sense on its own.
+`none` indicates that Xen should not use a console.  This option only
+makes sense on its own.
 
 ### console\_timestamps
 > `= <boolean>`
@@ -166,16 +210,22 @@ Flag to indicate whether include a times
 
 > Default: `false`
 
-Flag to indicate whether all guest console output should be copied into the console ring buffer.
+Flag to indicate whether all guest console output should be copied
+into the console ring buffer.
 
 ### conswitch
 > `= <switch char>[,x]`
 
 > Default `conswitch=a`
 
-Specify which character should be used to switch serial input between Xen and dom0.  The required sequence is CTRL-&lt;switch char&gt; three times.
+Specify which character should be used to switch serial input between
+Xen and dom0.  The required sequence is CTRL-&lt;switch char&gt; three
+times.
 
-The optional trailing `x` indicates that Xen should not automatically switch the console input to dom0 during boot.  Any other value, including omission, causes Xen to automatically switch to the dom0 console during dom0 boot.
+The optional trailing `x` indicates that Xen should not automatically
+switch the console input to dom0 during boot.  Any other value,
+including omission, causes Xen to automatically switch to the dom0
+console during dom0 boot.
 
 ### contig\_mem
 ### cpu\_type
@@ -193,7 +243,8 @@ The optional trailing `x` indicates that
 
 > Default: `4G`
 
-Specify the maximum address to allocate certain strucutres, if used in combination with the `low_crashinfo` command line option.
+Specify the maximum address to allocate certain strucutres, if used in
+combination with the `low_crashinfo` command line option.
 
 ### crashkernel
 ### credit2\_balance\_over
@@ -211,7 +262,8 @@ Specify the bit width of the DMA heap.
 ### dom0\_max\_vcpus
 > `= <integer>`
 
-Specifiy the maximum number of vcpus to give to dom0.  This defaults to the number of pcpus on the host.
+Specifiy the maximum number of vcpus to give to dom0.  This defaults
+to the number of pcpus on the host.
 
 ### dom0\_mem (ia64)
 > `= <size>`
@@ -260,7 +312,8 @@ Pin dom0 vcpus to their respective pcpus
 
 > Default: `guest_loglvl=none/warning`
 
-Set the logging level for Xen guests.  Any log message with equal more more importance will be printed.
+Set the logging level for Xen guests.  Any log message with equal more
+more importance will be printed.
 
 The optional `<rate-limited level>` options instructs which severities should be rate limited.
 ### hap\_1gb
@@ -276,7 +329,9 @@ The optional `<rate-limited level>` opti
 ### irq\_vector\_map
 ### lapic
 
-Force the use of use of the local APIC on a uniprocessor system, even if left disabled by the BIOS.  This option will accept any value at all.
+Force the use of use of the local APIC on a uniprocessor system, even
+if left disabled by the BIOS.  This option will accept any value at
+all.
 
 ### lapic\_timer\_c2\_ok
 ### ler
@@ -285,16 +340,22 @@ Force the use of use of the local APIC o
 
 > Default: `loglvl=warning`
 
-Set the logging level for Xen.  Any log message with equal more more importance will be printed.
+Set the logging level for Xen.  Any log message with equal more more
+importance will be printed.
 
-The optional `<rate-limited level>` options instructs which severities should be rate limited.
+The optional `<rate-limited level>` options instructs which severities
+should be rate limited.
 
 ### low\_crashinfo
 > `= none | min | all`
 
 > Default: `none` if not specified at all, or to `min` if `low\_crashinfo` is present without qualification.
 
-This option is only useful for hosts with a 32bit dom0 kernel, wishing to use kexec functionality in the case of a crash.  It represents which data structures should be deliberatly allocated in low memory, so the crash kernel may find find them.  Should be used in combination with `crashinfo_maxaddr`.
+This option is only useful for hosts with a 32bit dom0 kernel, wishing
+to use kexec functionality in the case of a crash.  It represents
+which data structures should be deliberatly allocated in low memory,
+so the crash kernel may find find them.  Should be used in combination
+with `crashinfo_maxaddr`.
 
 ### max\_cstate
 ### max\_gsi\_irqs
@@ -306,7 +367,8 @@ This option is only useful for hosts wit
 ### mem
 > `= <size>`
 
-Specifies the maximum address of physical RAM.  Any RAM beyond this limit is ignored by Xen.
+Specifies the maximum address of physical RAM.  Any RAM beyond this
+limit is ignored by Xen.
 
 ### mmcfg
 ### nmi
@@ -314,29 +376,37 @@ Specifies the maximum address of physica
 
 > Default: `nmi=fatal`
 
-Specify what Xen should do in the event of an NMI parity or I/O error.  `ignore` discards the error; `dom0` causes Xen to report the error to dom0, while 'fatal' causes Xen to print diagnostics and then hang.
+Specify what Xen should do in the event of an NMI parity or I/O error.
+`ignore` discards the error; `dom0` causes Xen to report the error to
+dom0, while 'fatal' causes Xen to print diagnostics and then hang.
 
 ### noapic
 ### nofxsr
 ### noirqbalance
 > `= <boolean>`
 
-Disable software IRQ balancing and affinity. This can be used on systems such as Dell 1850/2850 that have workarounds in hardware for IRQ routing issues.
+Disable software IRQ balancing and affinity. This can be used on
+systems such as Dell 1850/2850 that have workarounds in hardware for
+IRQ routing issues.
 
 ### nolapic
 
-Ignore the local APIC on a uniprocessor system, even if enabled by the BIOS.  This option will accept value.
+Ignore the local APIC on a uniprocessor system, even if enabled by the
+BIOS.  This option will accept value.
 
 ### noreboot
 > `= <boolean>`
 
-Do not automatically reboot after an error.  This is useful for catching debug output.  Defaults to automatically reboot after 5 seconds.
+Do not automatically reboot after an error.  This is useful for
+catching debug output.  Defaults to automatically reboot after 5
+seconds.
 
 ### noserialnumber
 ### nosmp
 > `= <boolean>`
 
-Disable SMP support.  No secondary processors will be booted.  Defaults to booting secondary processors.
+Disable SMP support.  No secondary processors will be booted.
+Defaults to booting secondary processors.
 
 ### nr\_irqs
 ### numa
@@ -360,6 +430,7 @@ Choose the default scheduler.
 > `= <size>`
 
 Set the serial tramsit buffer size.  Defaults to 16kB.
+
 ### smep
 ### snb\_igd\_quirk
 ### sync\_console
@@ -367,7 +438,8 @@ Set the serial tramsit buffer size.  Def
 
 > Default: `false`
 
-Flag to force synchronous console output.  Useful for debugging, but not suitable for production environments due to incurred overhead.
+Flag to force synchronous console output.  Useful for debugging, but
+not suitable for production environments due to incurred overhead.
 
 ### tboot
 ### tbuf\_size
@@ -395,17 +467,25 @@ Specify the per-cpu trace buffer size in
 ### vga
 > `= ( ask | current | text-80x<rows> | gfx-<width>x<height>x<depth> | mode-<mode> )[,keep]`
 
-`ask` causes Xen to display a menu of available modes and request the user to choose one of them.
+`ask` causes Xen to display a menu of available modes and request the
+user to choose one of them.
 
-`current` causes Xen to use the graphics adapter in its current state, without further setup.
+`current` causes Xen to use the graphics adapter in its current state,
+without further setup.
 
-`text-80x<rows>` instructs Xen to set up text mode.  Valid values for `<rows>` are `25, 28, 30, 34, 43, 50, 80`
+`text-80x<rows>` instructs Xen to set up text mode.  Valid values for
+`<rows>` are `25, 28, 30, 34, 43, 50, 80`
 
-`gfx-<width>x<height>x<depth>` instructs Xen to set up graphics mode with the specified width, height and depth.
+`gfx-<width>x<height>x<depth>` instructs Xen to set up graphics mode
+with the specified width, height and depth.
 
-`mode-<mode>` instructs Xen to use a specific mode, as shown with the `ask` option.  (N.B menu modes are displayed in hex, so `<mode>` should be a hexidecimal number)
+`mode-<mode>` instructs Xen to use a specific mode, as shown with the
+`ask` option.  (N.B menu modes are displayed in hex, so `<mode>`
+should be a hexidecimal number)
 
-The optional `keep` parameter causes Xen to continue using the vga console even after dom0 has been started.  The default behaviour is to relinquish control to dom0.
+The optional `keep` parameter causes Xen to continue using the vga
+console even after dom0 has been started.  The default behaviour is to
+relinquish control to dom0.
 
 ### vpid
 ### vpmu
@@ -416,14 +496,16 @@ The optional `keep` parameter causes Xen
 
 > Default: `false`
 
-Run an NMI watchdog on each processor.  If a processor is stuck for longer than the watchdog\_timeout, a panic occurs.
+Run an NMI watchdog on each processor.  If a processor is stuck for
+longer than the watchdog\_timeout, a panic occurs.
 
 ### watchdog\_timeout
 > `= <integer>`
 
 > Default: `5`
 
-Set the NMI watchdog timeout in seconds.  Specifying `0` will turn off the watchdog.
+Set the NMI watchdog timeout in seconds.  Specifying `0` will turn off
+the watchdog.
 
 ### x2apic
 ### x2apic\_phys

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAFA-0000hO-FY; Tue, 03 Apr 2012 20:22: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 1SFAF8-0000ai-JE
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from [85.158.143.99:42117] by server-3.bemta-4.messagelabs.com id
	81/F9-05853-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1333484536!21298479!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27559 invoked from network); 3 Apr 2012 20:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-000411-AZ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-0003IX-9I
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Message-Id: <E1SFAF6-0003IX-9I@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document vcpu-pinning in guest
	config 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Dario Faggioli <raistlin@linux.it>
# Date 1333384986 -3600
# Node ID 4aa9e1d759e0f1a682a3cb4391c5c4be3bb59c6d
# Parent  cafb9a2d51d63e41a1a154d2d0e7c43ec67e4b34
docs: Document vcpu-pinning in guest config file

Chageset 54000bca7a6a didn't affect xl.cfg.pod.5 properly.

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


diff -r cafb9a2d51d6 -r 4aa9e1d759e0 docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Mar 26 15:22:18 2012 +0200
+++ b/docs/man/xl.cfg.pod.5	Mon Apr 02 17:43:06 2012 +0100
@@ -105,6 +105,13 @@ Allow the guest to bring up a maximum of
 `vcpus=N` is less than `maxvcpus=M` then the first `N` vcpus will be
 created online and the remainder will be offline.
 
+=item B<cpus="CPU-LIST">
+
+List of which cpus the guest is allowed to use. Default behavior is
+`all cpus`. A list of cpus may be specified as follows: `cpus="0-3,5,^1"`
+(all vcpus will run on cpus 0,2,3,5), or `cpus=["2", "3"]` (all vcpus
+will run on cpus 2 and 3).
+
 =item B<memory=MBYTES>
 
 Start the guest with MBYTES megabytes of RAM.

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20: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 1SFAFA-0000hO-FY; Tue, 03 Apr 2012 20:22: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 1SFAF8-0000ai-JE
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from [85.158.143.99:42117] by server-3.bemta-4.messagelabs.com id
	81/F9-05853-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1333484536!21298479!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27559 invoked from network); 3 Apr 2012 20:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-000411-AZ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-0003IX-9I
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Message-Id: <E1SFAF6-0003IX-9I@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Document vcpu-pinning in guest
	config 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Dario Faggioli <raistlin@linux.it>
# Date 1333384986 -3600
# Node ID 4aa9e1d759e0f1a682a3cb4391c5c4be3bb59c6d
# Parent  cafb9a2d51d63e41a1a154d2d0e7c43ec67e4b34
docs: Document vcpu-pinning in guest config file

Chageset 54000bca7a6a didn't affect xl.cfg.pod.5 properly.

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


diff -r cafb9a2d51d6 -r 4aa9e1d759e0 docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Mar 26 15:22:18 2012 +0200
+++ b/docs/man/xl.cfg.pod.5	Mon Apr 02 17:43:06 2012 +0100
@@ -105,6 +105,13 @@ Allow the guest to bring up a maximum of
 `vcpus=N` is less than `maxvcpus=M` then the first `N` vcpus will be
 created online and the remainder will be offline.
 
+=item B<cpus="CPU-LIST">
+
+List of which cpus the guest is allowed to use. Default behavior is
+`all cpus`. A list of cpus may be specified as follows: `cpus="0-3,5,^1"`
+(all vcpus will run on cpus 0,2,3,5), or `cpus=["2", "3"]` (all vcpus
+will run on cpus 2 and 3).
+
 =item B<memory=MBYTES>
 
 Start the guest with MBYTES megabytes of RAM.

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000hf-LH; Tue, 03 Apr 2012 20:22: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 1SFAF9-0000ai-2d
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:19 +0000
Received: from [85.158.143.99:38316] by server-3.bemta-4.messagelabs.com id
	C2/F9-05853-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1333484537!22228412!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4894 invoked from network); 3 Apr 2012 20:22:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-000414-R8
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-0003Im-PL
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Message-Id: <E1SFAF6-0003Im-PL@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Remove qemu-upstream HowTo,
	and link to the wiki page.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1333385107 -3600
# Node ID caae1f9d7cf1f23480ed83fcc988ea0f148b8a67
# Parent  4aa9e1d759e0f1a682a3cb4391c5c4be3bb59c6d
docs: Remove qemu-upstream HowTo, and link to the wiki page.

Instead of having twice the same HowTo in tree and in the wiki, the one in tree
will become a link to the wiki.

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


diff -r 4aa9e1d759e0 -r caae1f9d7cf1 docs/misc/qemu-upstream_howto_use_it.markdown
--- a/docs/misc/qemu-upstream_howto_use_it.markdown	Mon Apr 02 17:43:06 2012 +0100
+++ b/docs/misc/qemu-upstream_howto_use_it.markdown	Mon Apr 02 17:45:07 2012 +0100
@@ -1,130 +1,12 @@
 Using Upstream QEMU with Xen
 ============================
 
-Note
-----
+If you want to build with the QEMU unstable tree, follow the wiki page:
+  [http://wiki.xen.org/wiki/QEMU_Upstream]()
 
-All these steps will become unnecessary after the patches to integrate
-SeaBIOS/QEMU into the Xen build system have been applied.
-
-
-How to build it
----------------
-
-### SeaBIOS
-
-The new device-model needs a different BIOS, SeaBIOS. Clone the repository from:
-
-  - [git://git.qemu.org/seabios.git]()
-  - [http://git.qemu.org/git/seabios.git]()
-
-Put the `.config` file in the appendix at the root of `seabios.git`
-and build SeaBIOS by typing `make`.
-
-In the xen-unstable source tree, add the file `.config` with
-`SEABIOS_DIR = /path/to/seabios.git`.
-To build hvmloader with SeaBIOS, you probably need to `make -C tools/firmware
-clean` first and then `make tools`, to use the new SEABIOS_DIR parameter.
-
-
-### QEMU
-
-Get QEMU upstream source from:
-
-  - [git://xenbits.xensource.com/qemu-upstream-unstable.git]()
-  - [http://xenbits.xensource.com/git-http/qemu-upstream-unstable.git]()
-
-To configure QEMU upstream with support for Xen:
-
-    ./configure --enable-xen --target-list=i386-softmmu --extra-cflags="-I$path_to_xen_source/tools/include -I$path_to_xen_source/tools/libxc -I$path_to_xen_source/tools/xenstore" --extra-ldflags="-L$path_to_xen_source/tools/libxc -L$path_to_xen_source/tools/xenstore"
-
-You can also use other several options such as `--disable-kvm`.
-
-
-How to use QEMU upstream
-------------------------
-
-Only `xl` supports QEMU upstream.
-
-To actually use it, add or change this in your VM configuration file:
+Otherwise, QEMU/SeaBIOS is now integrated into the build system, so you just
+have to specify the device model version in an `xl` config file:
 
     device_model_version = 'qemu-xen'
-    device_model_override = '/path/to/qemu/i386-softmmu/qemu'
 
-NB: In the `qemu-upstream` repository, the default binary name has been
-renamed to `qemu-system-i386`.
-
-
-Appendix
-------
-
-### `.config` file for SeaBIOS
-
-    #
-    # General Features
-    #
-    # CONFIG_COREBOOT is not set
-    CONFIG_XEN=y
-    CONFIG_THREADS=y
-    CONFIG_THREAD_OPTIONROMS=y
-    CONFIG_RELOCATE_INIT=y
-    CONFIG_BOOTMENU=y
-    CONFIG_BOOTMENU_WAIT=1000
-    # CONFIG_BOOTSPLASH is not set
-    CONFIG_BOOTORDER=y
-    #
-    # Hardware support
-    #
-    CONFIG_ATA=y
-    CONFIG_ATA_DMA=y
-    CONFIG_ATA_PIO32=y
-    CONFIG_AHCI=y
-    CONFIG_VIRTIO_BLK=y
-    CONFIG_FLOPPY=y
-    CONFIG_PS2PORT=y
-    CONFIG_USB=y
-    CONFIG_USB_UHCI=y
-    CONFIG_USB_OHCI=y
-    CONFIG_USB_EHCI=y
-    CONFIG_USB_MSC=y
-    CONFIG_USB_HUB=y
-    CONFIG_USB_KEYBOARD=y
-    CONFIG_USB_MOUSE=y
-    CONFIG_SERIAL=y
-    CONFIG_LPT=y
-    # CONFIG_EXTRA_PCI_ROOTS is not set
-    # CONFIG_USE_SMM is not set
-    CONFIG_MTRR_INIT=y
-    #
-    # BIOS interfaces
-    #
-    CONFIG_DRIVES=y
-    # CONFIG_CDROM_BOOT is not set
-    CONFIG_PCIBIOS=y
-    CONFIG_APMBIOS=y
-    CONFIG_PNPBIOS=y
-    CONFIG_OPTIONROMS=y
-    # CONFIG_OPTIONROMS_DEPLOYED is not set
-    CONFIG_OPTIONROMS_CHECKSUM=y
-    CONFIG_PMM=y
-    CONFIG_BOOT=y
-    CONFIG_KEYBOARD=y
-    CONFIG_KBD_CALL_INT15_4F=y
-    CONFIG_MOUSE=y
-    CONFIG_S3_RESUME=y
-    # CONFIG_S3_RESUME_VGA_INIT is not set
-    # CONFIG_DISABLE_A20 is not set
-    #
-    # BIOS Tables
-    #
-    CONFIG_PIRTABLE=y
-    CONFIG_MPTABLE=y
-    CONFIG_SMBIOS=y
-    CONFIG_ACPI=y
-    #
-    # Debugging
-    #
-    CONFIG_DEBUG_LEVEL=3
-    CONFIG_DEBUG_SERIAL=y
-    CONFIG_DEBUG_SERIAL_PORT=0x3f8
-    # CONFIG_SCREEN_AND_DEBUG is not set
+The version of QEMU used in the build system is the last release of QEMU.

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000hf-LH; Tue, 03 Apr 2012 20:22: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 1SFAF9-0000ai-2d
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:19 +0000
Received: from [85.158.143.99:38316] by server-3.bemta-4.messagelabs.com id
	C2/F9-05853-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1333484537!22228412!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4894 invoked from network); 3 Apr 2012 20:22:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-000414-R8
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF6-0003Im-PL
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:16 +0000
Message-Id: <E1SFAF6-0003Im-PL@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Remove qemu-upstream HowTo,
	and link to the wiki page.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1333385107 -3600
# Node ID caae1f9d7cf1f23480ed83fcc988ea0f148b8a67
# Parent  4aa9e1d759e0f1a682a3cb4391c5c4be3bb59c6d
docs: Remove qemu-upstream HowTo, and link to the wiki page.

Instead of having twice the same HowTo in tree and in the wiki, the one in tree
will become a link to the wiki.

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


diff -r 4aa9e1d759e0 -r caae1f9d7cf1 docs/misc/qemu-upstream_howto_use_it.markdown
--- a/docs/misc/qemu-upstream_howto_use_it.markdown	Mon Apr 02 17:43:06 2012 +0100
+++ b/docs/misc/qemu-upstream_howto_use_it.markdown	Mon Apr 02 17:45:07 2012 +0100
@@ -1,130 +1,12 @@
 Using Upstream QEMU with Xen
 ============================
 
-Note
-----
+If you want to build with the QEMU unstable tree, follow the wiki page:
+  [http://wiki.xen.org/wiki/QEMU_Upstream]()
 
-All these steps will become unnecessary after the patches to integrate
-SeaBIOS/QEMU into the Xen build system have been applied.
-
-
-How to build it
----------------
-
-### SeaBIOS
-
-The new device-model needs a different BIOS, SeaBIOS. Clone the repository from:
-
-  - [git://git.qemu.org/seabios.git]()
-  - [http://git.qemu.org/git/seabios.git]()
-
-Put the `.config` file in the appendix at the root of `seabios.git`
-and build SeaBIOS by typing `make`.
-
-In the xen-unstable source tree, add the file `.config` with
-`SEABIOS_DIR = /path/to/seabios.git`.
-To build hvmloader with SeaBIOS, you probably need to `make -C tools/firmware
-clean` first and then `make tools`, to use the new SEABIOS_DIR parameter.
-
-
-### QEMU
-
-Get QEMU upstream source from:
-
-  - [git://xenbits.xensource.com/qemu-upstream-unstable.git]()
-  - [http://xenbits.xensource.com/git-http/qemu-upstream-unstable.git]()
-
-To configure QEMU upstream with support for Xen:
-
-    ./configure --enable-xen --target-list=i386-softmmu --extra-cflags="-I$path_to_xen_source/tools/include -I$path_to_xen_source/tools/libxc -I$path_to_xen_source/tools/xenstore" --extra-ldflags="-L$path_to_xen_source/tools/libxc -L$path_to_xen_source/tools/xenstore"
-
-You can also use other several options such as `--disable-kvm`.
-
-
-How to use QEMU upstream
-------------------------
-
-Only `xl` supports QEMU upstream.
-
-To actually use it, add or change this in your VM configuration file:
+Otherwise, QEMU/SeaBIOS is now integrated into the build system, so you just
+have to specify the device model version in an `xl` config file:
 
     device_model_version = 'qemu-xen'
-    device_model_override = '/path/to/qemu/i386-softmmu/qemu'
 
-NB: In the `qemu-upstream` repository, the default binary name has been
-renamed to `qemu-system-i386`.
-
-
-Appendix
-------
-
-### `.config` file for SeaBIOS
-
-    #
-    # General Features
-    #
-    # CONFIG_COREBOOT is not set
-    CONFIG_XEN=y
-    CONFIG_THREADS=y
-    CONFIG_THREAD_OPTIONROMS=y
-    CONFIG_RELOCATE_INIT=y
-    CONFIG_BOOTMENU=y
-    CONFIG_BOOTMENU_WAIT=1000
-    # CONFIG_BOOTSPLASH is not set
-    CONFIG_BOOTORDER=y
-    #
-    # Hardware support
-    #
-    CONFIG_ATA=y
-    CONFIG_ATA_DMA=y
-    CONFIG_ATA_PIO32=y
-    CONFIG_AHCI=y
-    CONFIG_VIRTIO_BLK=y
-    CONFIG_FLOPPY=y
-    CONFIG_PS2PORT=y
-    CONFIG_USB=y
-    CONFIG_USB_UHCI=y
-    CONFIG_USB_OHCI=y
-    CONFIG_USB_EHCI=y
-    CONFIG_USB_MSC=y
-    CONFIG_USB_HUB=y
-    CONFIG_USB_KEYBOARD=y
-    CONFIG_USB_MOUSE=y
-    CONFIG_SERIAL=y
-    CONFIG_LPT=y
-    # CONFIG_EXTRA_PCI_ROOTS is not set
-    # CONFIG_USE_SMM is not set
-    CONFIG_MTRR_INIT=y
-    #
-    # BIOS interfaces
-    #
-    CONFIG_DRIVES=y
-    # CONFIG_CDROM_BOOT is not set
-    CONFIG_PCIBIOS=y
-    CONFIG_APMBIOS=y
-    CONFIG_PNPBIOS=y
-    CONFIG_OPTIONROMS=y
-    # CONFIG_OPTIONROMS_DEPLOYED is not set
-    CONFIG_OPTIONROMS_CHECKSUM=y
-    CONFIG_PMM=y
-    CONFIG_BOOT=y
-    CONFIG_KEYBOARD=y
-    CONFIG_KBD_CALL_INT15_4F=y
-    CONFIG_MOUSE=y
-    CONFIG_S3_RESUME=y
-    # CONFIG_S3_RESUME_VGA_INIT is not set
-    # CONFIG_DISABLE_A20 is not set
-    #
-    # BIOS Tables
-    #
-    CONFIG_PIRTABLE=y
-    CONFIG_MPTABLE=y
-    CONFIG_SMBIOS=y
-    CONFIG_ACPI=y
-    #
-    # Debugging
-    #
-    CONFIG_DEBUG_LEVEL=3
-    CONFIG_DEBUG_SERIAL=y
-    CONFIG_DEBUG_SERIAL_PORT=0x3f8
-    # CONFIG_SCREEN_AND_DEBUG is not set
+The version of QEMU used in the build system is the last release of QEMU.

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000hV-IE; Tue, 03 Apr 2012 20:22:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF8-0000dJ-OZ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from [85.158.139.83:37619] by server-5.bemta-5.messagelabs.com id
	AB/EF-13566-9FB5B7F4; Tue, 03 Apr 2012 20:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1333484535!18472609!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25299 invoked from network); 3 Apr 2012 20:22:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-00040s-PL
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-0003Ho-O7
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Message-Id: <E1SFAF4-0003Ho-O7@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: support for "rtc_timeoffset"
	and "localtime"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Lin Ming <mlin@ss.pku.edu.cn>
# Date 1333384359 -3600
# Node ID 6f81f4d79fde3fe95a67545267567cd825169ce8
# Parent  86f9fd67152ba4c5bb3870f9b95ae304809eab86
libxl: support for "rtc_timeoffset" and "localtime"

Implement "rtc_timeoffset" and "localtime" options compatible as xm.

rtc_timeoffset is the offset between host time and guest time.
localtime means to specify whether the emulted RTC appears as UTC or is
offset by the host.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 86f9fd67152b -r 6f81f4d79fde docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Apr 02 17:22:31 2012 +0100
+++ b/docs/man/xl.cfg.pod.5	Mon Apr 02 17:32:39 2012 +0100
@@ -558,6 +558,14 @@ frequency changes.
 
 Please see F<docs/misc/tscmode.txt> for more information on this option.
 
+=item B<localtime=BOOLEAN>
+
+Set the real time clock to local time or to UTC. 0 by default, i.e. set to UTC.
+
+=item B<rtc_timeoffset=SECONDS>
+
+Set the real time clock offset in seconds. 0 by default.
+
 =head3 Support for Paravirtualisation of HVM Guests
 
 The following options allow Paravirtualised features (such as devices)
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/libxl_create.c	Mon Apr 02 17:32:39 2012 +0100
@@ -124,6 +124,17 @@ int libxl__domain_build_info_setdefault(
     if (b_info->target_memkb == LIBXL_MEMKB_DEFAULT)
         b_info->target_memkb = b_info->max_memkb;
 
+    libxl_defbool_setdefault(&b_info->localtime, false);
+    if (libxl_defbool_val(b_info->localtime)) {
+        time_t t;
+        struct tm *tm;
+
+        t = time(NULL);
+        tm = localtime(&t);
+
+        b_info->rtc_timeoffset += tm->tm_gmtoff;
+    }
+
     libxl_defbool_setdefault(&b_info->disable_migrate, false);
 
     switch (b_info->type) {
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/libxl_dom.c	Mon Apr 02 17:32:39 2012 +0100
@@ -91,6 +91,9 @@ int libxl__build_pre(libxl__gc *gc, uint
     if (libxl_defbool_val(info->disable_migrate))
         xc_domain_disable_migrate(ctx->xch, domid);
 
+    if (info->rtc_timeoffset)
+        xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset);
+
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         unsigned long shadow;
         shadow = (info->shadow_memkb + 1023) / 1024;
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Mon Apr 02 17:32:39 2012 +0100
@@ -238,6 +238,8 @@ libxl_domain_build_info = Struct("domain
     ("target_memkb",    MemKB),
     ("video_memkb",     MemKB),
     ("shadow_memkb",    MemKB),
+    ("rtc_timeoffset",  uint32),
+    ("localtime",       libxl_defbool),
     ("disable_migrate", libxl_defbool),
     ("cpuid",           libxl_cpuid_policy_list),
     
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Mon Apr 02 17:32:39 2012 +0100
@@ -697,6 +697,11 @@ static void parse_config_data(const char
         }
     }
 
+    if (!xlu_cfg_get_long(config, "rtc_timeoffset", &l, 0))
+        b_info->rtc_timeoffset = l;
+
+    xlu_cfg_get_defbool(config, "localtime", &b_info->localtime, 0);
+
     if (!xlu_cfg_get_long (config, "videoram", &l, 0))
         b_info->video_memkb = l * 1024;
 

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000hV-IE; Tue, 03 Apr 2012 20:22:20 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF8-0000dJ-OZ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from [85.158.139.83:37619] by server-5.bemta-5.messagelabs.com id
	AB/EF-13566-9FB5B7F4; Tue, 03 Apr 2012 20:22:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1333484535!18472609!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25299 invoked from network); 3 Apr 2012 20:22:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-00040s-PL
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF4-0003Ho-O7
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:14 +0000
Message-Id: <E1SFAF4-0003Ho-O7@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: support for "rtc_timeoffset"
	and "localtime"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Lin Ming <mlin@ss.pku.edu.cn>
# Date 1333384359 -3600
# Node ID 6f81f4d79fde3fe95a67545267567cd825169ce8
# Parent  86f9fd67152ba4c5bb3870f9b95ae304809eab86
libxl: support for "rtc_timeoffset" and "localtime"

Implement "rtc_timeoffset" and "localtime" options compatible as xm.

rtc_timeoffset is the offset between host time and guest time.
localtime means to specify whether the emulted RTC appears as UTC or is
offset by the host.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 86f9fd67152b -r 6f81f4d79fde docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Mon Apr 02 17:22:31 2012 +0100
+++ b/docs/man/xl.cfg.pod.5	Mon Apr 02 17:32:39 2012 +0100
@@ -558,6 +558,14 @@ frequency changes.
 
 Please see F<docs/misc/tscmode.txt> for more information on this option.
 
+=item B<localtime=BOOLEAN>
+
+Set the real time clock to local time or to UTC. 0 by default, i.e. set to UTC.
+
+=item B<rtc_timeoffset=SECONDS>
+
+Set the real time clock offset in seconds. 0 by default.
+
 =head3 Support for Paravirtualisation of HVM Guests
 
 The following options allow Paravirtualised features (such as devices)
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/libxl_create.c	Mon Apr 02 17:32:39 2012 +0100
@@ -124,6 +124,17 @@ int libxl__domain_build_info_setdefault(
     if (b_info->target_memkb == LIBXL_MEMKB_DEFAULT)
         b_info->target_memkb = b_info->max_memkb;
 
+    libxl_defbool_setdefault(&b_info->localtime, false);
+    if (libxl_defbool_val(b_info->localtime)) {
+        time_t t;
+        struct tm *tm;
+
+        t = time(NULL);
+        tm = localtime(&t);
+
+        b_info->rtc_timeoffset += tm->tm_gmtoff;
+    }
+
     libxl_defbool_setdefault(&b_info->disable_migrate, false);
 
     switch (b_info->type) {
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/libxl_dom.c	Mon Apr 02 17:32:39 2012 +0100
@@ -91,6 +91,9 @@ int libxl__build_pre(libxl__gc *gc, uint
     if (libxl_defbool_val(info->disable_migrate))
         xc_domain_disable_migrate(ctx->xch, domid);
 
+    if (info->rtc_timeoffset)
+        xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset);
+
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         unsigned long shadow;
         shadow = (info->shadow_memkb + 1023) / 1024;
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Mon Apr 02 17:32:39 2012 +0100
@@ -238,6 +238,8 @@ libxl_domain_build_info = Struct("domain
     ("target_memkb",    MemKB),
     ("video_memkb",     MemKB),
     ("shadow_memkb",    MemKB),
+    ("rtc_timeoffset",  uint32),
+    ("localtime",       libxl_defbool),
     ("disable_migrate", libxl_defbool),
     ("cpuid",           libxl_cpuid_policy_list),
     
diff -r 86f9fd67152b -r 6f81f4d79fde tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Apr 02 17:22:31 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Mon Apr 02 17:32:39 2012 +0100
@@ -697,6 +697,11 @@ static void parse_config_data(const char
         }
     }
 
+    if (!xlu_cfg_get_long(config, "rtc_timeoffset", &l, 0))
+        b_info->rtc_timeoffset = l;
+
+    xlu_cfg_get_defbool(config, "localtime", &b_info->localtime, 0);
+
     if (!xlu_cfg_get_long (config, "videoram", &l, 0))
         b_info->video_memkb = l * 1024;
 

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000ht-Q6; Tue, 03 Apr 2012 20:22: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 1SFAF9-0000eI-8n
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:19 +0000
Received: from [85.158.138.51:17766] by server-11.bemta-3.messagelabs.com id
	92/08-28543-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1333484536!20693159!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30704 invoked from network); 3 Apr 2012 20:22:17 -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;
	3 Apr 2012 20:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-00040y-QD
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-0003II-Oz
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Message-Id: <E1SFAF5-0003II-Oz@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: send page-in requests
	in batches in linux_privcmd_map_foreign_bulk
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1332768138 -7200
# Node ID cafb9a2d51d63e41a1a154d2d0e7c43ec67e4b34
# Parent  95b8f34756fb07db3f549d7d9cfb21c6357010ad
tools/libxc: send page-in requests in batches in linux_privcmd_map_foreign_bulk

One of the bottlenecks with foreign page-in request is the poor retry
handling in linux_privcmd_map_foreign_bulk(). It sends one request per
paged gfn at a time and it waits until the gfn is accessible. This
causes long delays in mmap requests from qemu-dm and xc_save.

Instead of sending one request at a time, walk the entire gfn list and
send batches of mmap requests. They will eventually end up in the pager's
request ring (if it has room again), and will fill up this ring so that
in turn the pager can also process page-in in batches.

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


diff -r 95b8f34756fb -r cafb9a2d51d6 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Mar 26 10:07:40 2012 +0100
+++ b/tools/libxc/xc_linux_osdep.c	Mon Mar 26 15:22:18 2012 +0200
@@ -191,6 +191,59 @@ static void *linux_privcmd_map_foreign_b
     return addr;
 }
 
+/*
+ * Retry mmap of all paged gfns in batches
+ * retuns < 0 on fatal error
+ * returns 0 if all gfns left paging state
+ * returns > 0 if some gfns are still in paging state
+ *
+ * Walk all gfns and try to assemble blocks of gfns in paging state.
+ * This will keep the request ring full and avoids delays.
+ */
+static int retry_paged(int fd, uint32_t dom, void *addr,
+                       const xen_pfn_t *arr, int *err, unsigned int num)
+{
+    privcmd_mmapbatch_v2_t ioctlx;
+    int rc, paged = 0, i = 0;
+    
+    do
+    {
+        /* Skip gfns not in paging state */
+        if ( err[i] != -ENOENT )
+        {
+            i++;
+            continue;
+        }
+
+        paged++;
+
+        /* At least one gfn is still in paging state */
+        ioctlx.num = 1;
+        ioctlx.dom = dom;
+        ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT);
+        ioctlx.arr = arr + i;
+        ioctlx.err = err + i;
+        
+        /* Assemble a batch of requests */
+        while ( ++i < num )
+        {
+            if ( err[i] != -ENOENT )
+                break;
+            ioctlx.num++;
+        }
+        
+        /* Send request and abort on fatal error */
+        rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
+        if ( rc < 0 && errno != ENOENT )
+            goto out;
+
+    } while ( i < num );
+    
+    rc = paged;
+out:
+    return rc;
+}
+
 static void *linux_privcmd_map_foreign_bulk(xc_interface *xch, xc_osdep_handle h,
                                             uint32_t dom, int prot,
                                             const xen_pfn_t *arr, int *err, unsigned int num)
@@ -220,21 +273,10 @@ static void *linux_privcmd_map_foreign_b
     /* Command was recognized, some gfn in arr are in paging state */
     if ( rc < 0 && errno == ENOENT )
     {
-        for ( i = rc = 0; rc == 0 && i < num; i++ )
-        {
-            if ( err[i] != -ENOENT )
-                continue;
-
-            ioctlx.num = 1;
-            ioctlx.dom = dom;
-            ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT);
-            ioctlx.arr = arr + i;
-            ioctlx.err = err + i;
-            do {
-                usleep(100);
-                rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
-            } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
-        }
+        do {
+            usleep(100);
+            rc = retry_paged(fd, dom, addr, arr, err, num);
+        } while ( rc > 0 );
     }
     /* Command was not recognized, use fall back */
     else if ( rc < 0 && errno == EINVAL && (int)num > 0 )

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000ht-Q6; Tue, 03 Apr 2012 20:22: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 1SFAF9-0000eI-8n
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:19 +0000
Received: from [85.158.138.51:17766] by server-11.bemta-3.messagelabs.com id
	92/08-28543-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1333484536!20693159!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30704 invoked from network); 3 Apr 2012 20:22:17 -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;
	3 Apr 2012 20:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-00040y-QD
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-0003II-Oz
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Message-Id: <E1SFAF5-0003II-Oz@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libxc: send page-in requests
	in batches in linux_privcmd_map_foreign_bulk
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1332768138 -7200
# Node ID cafb9a2d51d63e41a1a154d2d0e7c43ec67e4b34
# Parent  95b8f34756fb07db3f549d7d9cfb21c6357010ad
tools/libxc: send page-in requests in batches in linux_privcmd_map_foreign_bulk

One of the bottlenecks with foreign page-in request is the poor retry
handling in linux_privcmd_map_foreign_bulk(). It sends one request per
paged gfn at a time and it waits until the gfn is accessible. This
causes long delays in mmap requests from qemu-dm and xc_save.

Instead of sending one request at a time, walk the entire gfn list and
send batches of mmap requests. They will eventually end up in the pager's
request ring (if it has room again), and will fill up this ring so that
in turn the pager can also process page-in in batches.

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


diff -r 95b8f34756fb -r cafb9a2d51d6 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Mon Mar 26 10:07:40 2012 +0100
+++ b/tools/libxc/xc_linux_osdep.c	Mon Mar 26 15:22:18 2012 +0200
@@ -191,6 +191,59 @@ static void *linux_privcmd_map_foreign_b
     return addr;
 }
 
+/*
+ * Retry mmap of all paged gfns in batches
+ * retuns < 0 on fatal error
+ * returns 0 if all gfns left paging state
+ * returns > 0 if some gfns are still in paging state
+ *
+ * Walk all gfns and try to assemble blocks of gfns in paging state.
+ * This will keep the request ring full and avoids delays.
+ */
+static int retry_paged(int fd, uint32_t dom, void *addr,
+                       const xen_pfn_t *arr, int *err, unsigned int num)
+{
+    privcmd_mmapbatch_v2_t ioctlx;
+    int rc, paged = 0, i = 0;
+    
+    do
+    {
+        /* Skip gfns not in paging state */
+        if ( err[i] != -ENOENT )
+        {
+            i++;
+            continue;
+        }
+
+        paged++;
+
+        /* At least one gfn is still in paging state */
+        ioctlx.num = 1;
+        ioctlx.dom = dom;
+        ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT);
+        ioctlx.arr = arr + i;
+        ioctlx.err = err + i;
+        
+        /* Assemble a batch of requests */
+        while ( ++i < num )
+        {
+            if ( err[i] != -ENOENT )
+                break;
+            ioctlx.num++;
+        }
+        
+        /* Send request and abort on fatal error */
+        rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
+        if ( rc < 0 && errno != ENOENT )
+            goto out;
+
+    } while ( i < num );
+    
+    rc = paged;
+out:
+    return rc;
+}
+
 static void *linux_privcmd_map_foreign_bulk(xc_interface *xch, xc_osdep_handle h,
                                             uint32_t dom, int prot,
                                             const xen_pfn_t *arr, int *err, unsigned int num)
@@ -220,21 +273,10 @@ static void *linux_privcmd_map_foreign_b
     /* Command was recognized, some gfn in arr are in paging state */
     if ( rc < 0 && errno == ENOENT )
     {
-        for ( i = rc = 0; rc == 0 && i < num; i++ )
-        {
-            if ( err[i] != -ENOENT )
-                continue;
-
-            ioctlx.num = 1;
-            ioctlx.dom = dom;
-            ioctlx.addr = (unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT);
-            ioctlx.arr = arr + i;
-            ioctlx.err = err + i;
-            do {
-                usleep(100);
-                rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
-            } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
-        }
+        do {
+            usleep(100);
+            rc = retry_paged(fd, dom, addr, arr, err, num);
+        } while ( rc > 0 );
     }
     /* Command was not recognized, use fall back */
     else if ( rc < 0 && errno == EINVAL && (int)num > 0 )

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFC-0000kg-SU; Tue, 03 Apr 2012 20:22:22 +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 1SFAFA-0000cN-Oj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:20 +0000
Received: from [85.158.143.35:42829] by server-1.bemta-4.messagelabs.com id
	02/17-20925-CFB5B7F4; Tue, 03 Apr 2012 20:22:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1333484538!3997754!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10778 invoked from network); 3 Apr 2012 20:22:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-00041A-VO
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-0003JG-R1
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Message-Id: <E1SFAF7-0003JG-R1@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Use enum values for qemu
	version not raw numbers
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332406949 0
# Node ID d05e264ad2a75b2b7481594bd6e6a0f83bd2d8d1
# Parent  9c79ece1988b51a6a2066b53e8861f15d2df3b55
libxl: Use enum values for qemu version not raw numbers

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


diff -r 9c79ece1988b -r d05e264ad2a7 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Fri Mar 23 09:45:56 2012 -0400
+++ b/tools/libxl/libxl_create.c	Thu Mar 22 09:02:29 2012 +0000
@@ -78,18 +78,20 @@ int libxl__domain_build_info_setdefault(
     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         if (!b_info->u.hvm.bios)
             switch (b_info->device_model_version) {
-            case 1: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
-            case 2: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_SEABIOS; break;
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+                b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+                b_info->u.hvm.bios = LIBXL_BIOS_TYPE_SEABIOS; break;
             default:return ERROR_INVAL;
             }
 
         /* Enforce BIOS<->Device Model version relationship */
         switch (b_info->device_model_version) {
-        case 1:
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
             if (b_info->u.hvm.bios != LIBXL_BIOS_TYPE_ROMBIOS)
                 return ERROR_INVAL;
             break;
-        case 2:
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
             if (b_info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS)
                 return ERROR_INVAL;
             break;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFC-0000kg-SU; Tue, 03 Apr 2012 20:22:22 +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 1SFAFA-0000cN-Oj
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:20 +0000
Received: from [85.158.143.35:42829] by server-1.bemta-4.messagelabs.com id
	02/17-20925-CFB5B7F4; Tue, 03 Apr 2012 20:22:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1333484538!3997754!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10778 invoked from network); 3 Apr 2012 20:22:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-00041A-VO
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-0003JG-R1
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Message-Id: <E1SFAF7-0003JG-R1@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Use enum values for qemu
	version not raw numbers
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332406949 0
# Node ID d05e264ad2a75b2b7481594bd6e6a0f83bd2d8d1
# Parent  9c79ece1988b51a6a2066b53e8861f15d2df3b55
libxl: Use enum values for qemu version not raw numbers

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


diff -r 9c79ece1988b -r d05e264ad2a7 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Fri Mar 23 09:45:56 2012 -0400
+++ b/tools/libxl/libxl_create.c	Thu Mar 22 09:02:29 2012 +0000
@@ -78,18 +78,20 @@ int libxl__domain_build_info_setdefault(
     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         if (!b_info->u.hvm.bios)
             switch (b_info->device_model_version) {
-            case 1: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
-            case 2: b_info->u.hvm.bios = LIBXL_BIOS_TYPE_SEABIOS; break;
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+                b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+                b_info->u.hvm.bios = LIBXL_BIOS_TYPE_SEABIOS; break;
             default:return ERROR_INVAL;
             }
 
         /* Enforce BIOS<->Device Model version relationship */
         switch (b_info->device_model_version) {
-        case 1:
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
             if (b_info->u.hvm.bios != LIBXL_BIOS_TYPE_ROMBIOS)
                 return ERROR_INVAL;
             break;
-        case 2:
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
             if (b_info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS)
                 return ERROR_INVAL;
             break;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000hl-NW; Tue, 03 Apr 2012 20:22: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 1SFAF9-0000ag-EF
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:19 +0000
Received: from [85.158.143.99:38320] by server-2.bemta-4.messagelabs.com id
	33/3A-17550-BFB5B7F4; Tue, 03 Apr 2012 20:22:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1333484537!16967265!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28239 invoked from network); 3 Apr 2012 20:22:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-000417-EM
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-0003J1-A2
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Message-Id: <E1SFAF7-0003J1-A2@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] linux-xencommons: Load
	xen-acpi-processor
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1332510356 14400
# Node ID 9c79ece1988b51a6a2066b53e8861f15d2df3b55
# Parent  caae1f9d7cf1f23480ed83fcc988ea0f148b8a67
linux-xencommons: Load xen-acpi-processor

Upstream the "xen/acpi-processor: C and P-state driver that
uploads said data to hypervisor." takes care of uploading power information
information that normally a cpu frequency scaling driver would using
in the initial domain. We want the hypervisor to take that data and
make good usage of it.

Fortunatly for us we do not have to worry about the native cpu frequency
scaling drivers being loaded first, as the upstream commit:
"xen/cpufreq: Disable the cpu frequency scaling drivers from loading."
takes care of that. Meaning we can load the xen-acpi-processor at any time.

By default that driver is built as a module - and since we are
the only user of it - we should load it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r caae1f9d7cf1 -r 9c79ece1988b tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons	Mon Apr 02 17:45:07 2012 +0100
+++ b/tools/hotplug/Linux/init.d/xencommons	Fri Mar 23 09:45:56 2012 -0400
@@ -58,6 +58,7 @@ do_start () {
 	modprobe xen-gntdev 2>/dev/null
 	modprobe evtchn 2>/dev/null
 	modprobe gntdev 2>/dev/null
+	modprobe xen-acpi-processor 2>/dev/null
 	mkdir -p /var/run/xen
 
 	if ! `xenstore-read -s / >/dev/null 2>&1`

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFA-0000hl-NW; Tue, 03 Apr 2012 20:22: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 1SFAF9-0000ag-EF
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:19 +0000
Received: from [85.158.143.99:38320] by server-2.bemta-4.messagelabs.com id
	33/3A-17550-BFB5B7F4; Tue, 03 Apr 2012 20:22:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1333484537!16967265!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28239 invoked from network); 3 Apr 2012 20:22:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-000417-EM
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF7-0003J1-A2
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:17 +0000
Message-Id: <E1SFAF7-0003J1-A2@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] linux-xencommons: Load
	xen-acpi-processor
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1332510356 14400
# Node ID 9c79ece1988b51a6a2066b53e8861f15d2df3b55
# Parent  caae1f9d7cf1f23480ed83fcc988ea0f148b8a67
linux-xencommons: Load xen-acpi-processor

Upstream the "xen/acpi-processor: C and P-state driver that
uploads said data to hypervisor." takes care of uploading power information
information that normally a cpu frequency scaling driver would using
in the initial domain. We want the hypervisor to take that data and
make good usage of it.

Fortunatly for us we do not have to worry about the native cpu frequency
scaling drivers being loaded first, as the upstream commit:
"xen/cpufreq: Disable the cpu frequency scaling drivers from loading."
takes care of that. Meaning we can load the xen-acpi-processor at any time.

By default that driver is built as a module - and since we are
the only user of it - we should load it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r caae1f9d7cf1 -r 9c79ece1988b tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons	Mon Apr 02 17:45:07 2012 +0100
+++ b/tools/hotplug/Linux/init.d/xencommons	Fri Mar 23 09:45:56 2012 -0400
@@ -58,6 +58,7 @@ do_start () {
 	modprobe xen-gntdev 2>/dev/null
 	modprobe evtchn 2>/dev/null
 	modprobe gntdev 2>/dev/null
+	modprobe xen-acpi-processor 2>/dev/null
 	mkdir -p /var/run/xen
 
 	if ! `xenstore-read -s / >/dev/null 2>&1`

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFC-0000kl-Uu; Tue, 03 Apr 2012 20:22: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 1SFAFA-0000dO-QQ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:21 +0000
Received: from [85.158.139.83:37645] by server-8.bemta-5.messagelabs.com id
	18/99-26964-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1333484535!11086577!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26072 invoked from network); 3 Apr 2012 20:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-00040v-Co
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-0003I3-8a
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Message-Id: <E1SFAF5-0003I3-8a@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: expand docs/INDEX,
	sort html index by title rather than filename
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332752860 -3600
# Node ID 95b8f34756fb07db3f549d7d9cfb21c6357010ad
# Parent  6f81f4d79fde3fe95a67545267567cd825169ce8
docs: expand docs/INDEX, sort html index by title rather than filename

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


diff -r 6f81f4d79fde -r 95b8f34756fb docs/INDEX
--- a/docs/INDEX	Mon Apr 02 17:32:39 2012 +0100
+++ b/docs/INDEX	Mon Mar 26 10:07:40 2012 +0100
@@ -5,3 +5,20 @@ man				Man Pages
 misc				Miscellaneous Documentation
 misc/hvm-emulated-unplug	Xen HVM emulated device unplug protocol
 misc/console			Xen PV Console notes
+misc/xen-command-line		Xen Hypervisor Command Line Options
+misc/crashdb			Xen crash debugger notes
+misc/grant-tables		A Rough Introduction to Using Grant Tables
+misc/kexec_and_kdump		Kexec and Kdump for Xen
+misc/tscmode			TSC Mode HOWTO
+misc/vbd-interface		Xen Guest Disk (VBD) Interface
+misc/xenstore			Xenstore protocol specification
+misc/xl-disk-configuration	XL Disk Configuration
+misc/xl-network-configuration	XL Network Configuration
+misc/distro_mapping		Distro Directory Layouts
+misc/dump-core-format		Xen Core Dump Format
+misc/sedf_scheduler_mini-HOWTO	sEDF Mini HOWTO
+misc/vtd			VT-d HOWTO
+misc/vtpm			Virtual TPM
+misc/xen-error-handling		Xen Error Handling
+misc/xenpaging			Xen Paging
+misc/xsm-flask			XSM/FLASK Configuration
diff -r 6f81f4d79fde -r 95b8f34756fb docs/gen-html-index
--- a/docs/gen-html-index	Mon Apr 02 17:32:39 2012 +0100
+++ b/docs/gen-html-index	Mon Mar 26 10:07:40 2012 +0100
@@ -79,7 +79,7 @@ sub make_link ($$) {
 sub make_links ($$@) {
     my ($dir,$base,@docs) = @_;
     my $idx = '';
-    foreach my $of (sort { $a cmp $b } @docs) {
+    foreach my $of (sort { make_linktext($a) cmp make_linktext($b) } @docs) {
         $idx .= make_link($of,$base);
     }
     return $idx;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22: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 1SFAFC-0000kl-Uu; Tue, 03 Apr 2012 20:22: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 1SFAFA-0000dO-QQ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:21 +0000
Received: from [85.158.139.83:37645] by server-8.bemta-5.messagelabs.com id
	18/99-26964-AFB5B7F4; Tue, 03 Apr 2012 20:22:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1333484535!11086577!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26072 invoked from network); 3 Apr 2012 20:22:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-00040v-Co
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF5-0003I3-8a
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:15 +0000
Message-Id: <E1SFAF5-0003I3-8a@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: expand docs/INDEX,
	sort html index by title rather than filename
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332752860 -3600
# Node ID 95b8f34756fb07db3f549d7d9cfb21c6357010ad
# Parent  6f81f4d79fde3fe95a67545267567cd825169ce8
docs: expand docs/INDEX, sort html index by title rather than filename

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


diff -r 6f81f4d79fde -r 95b8f34756fb docs/INDEX
--- a/docs/INDEX	Mon Apr 02 17:32:39 2012 +0100
+++ b/docs/INDEX	Mon Mar 26 10:07:40 2012 +0100
@@ -5,3 +5,20 @@ man				Man Pages
 misc				Miscellaneous Documentation
 misc/hvm-emulated-unplug	Xen HVM emulated device unplug protocol
 misc/console			Xen PV Console notes
+misc/xen-command-line		Xen Hypervisor Command Line Options
+misc/crashdb			Xen crash debugger notes
+misc/grant-tables		A Rough Introduction to Using Grant Tables
+misc/kexec_and_kdump		Kexec and Kdump for Xen
+misc/tscmode			TSC Mode HOWTO
+misc/vbd-interface		Xen Guest Disk (VBD) Interface
+misc/xenstore			Xenstore protocol specification
+misc/xl-disk-configuration	XL Disk Configuration
+misc/xl-network-configuration	XL Network Configuration
+misc/distro_mapping		Distro Directory Layouts
+misc/dump-core-format		Xen Core Dump Format
+misc/sedf_scheduler_mini-HOWTO	sEDF Mini HOWTO
+misc/vtd			VT-d HOWTO
+misc/vtpm			Virtual TPM
+misc/xen-error-handling		Xen Error Handling
+misc/xenpaging			Xen Paging
+misc/xsm-flask			XSM/FLASK Configuration
diff -r 6f81f4d79fde -r 95b8f34756fb docs/gen-html-index
--- a/docs/gen-html-index	Mon Apr 02 17:32:39 2012 +0100
+++ b/docs/gen-html-index	Mon Mar 26 10:07:40 2012 +0100
@@ -79,7 +79,7 @@ sub make_link ($$) {
 sub make_links ($$@) {
     my ($dir,$base,@docs) = @_;
     my $idx = '';
-    foreach my $of (sort { $a cmp $b } @docs) {
+    foreach my $of (sort { make_linktext($a) cmp make_linktext($b) } @docs) {
         $idx .= make_link($of,$base);
     }
     return $idx;

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFAFD-0000l9-45; Tue, 03 Apr 2012 20:22:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAFB-0000iV-Tt
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:22 +0000
Received: from [85.158.139.83:39774] by server-6.bemta-5.messagelabs.com id
	E3/CB-13222-DFB5B7F4; Tue, 03 Apr 2012 20:22:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1333484538!22265255!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28352 invoked from network); 3 Apr 2012 20:22:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF8-00041D-CZ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF8-0003JV-BN
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Message-Id: <E1SFAF8-0003JV-BN@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1333386871 -3600
# Node ID 2386288b1bf12e550e267c53976dba51eed8e74d
# Parent  d05e264ad2a75b2b7481594bd6e6a0f83bd2d8d1
QEMU_TAG update
---


diff -r d05e264ad2a7 -r 2386288b1bf1 Config.mk
--- a/Config.mk	Thu Mar 22 09:02:29 2012 +0000
+++ b/Config.mk	Mon Apr 02 18:14:31 2012 +0100
@@ -216,9 +216,9 @@ CONFIG_SEABIOS ?= y
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 2503d4d5a29e7af8dffd1e11229e11c1917d2ccf
-# Thu Mar 1 18:58:27 2012 +0000
-# qemu-xen: ignore console disconnect events for console/0
+QEMU_TAG ?= f0fad5549f8103fc0130d3121eb5f7913c5bc2a9
+# Mon Apr 2 17:55:05 2012 +0100
+# qemu-xen-traditional: QDISK fixes
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.

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

From xen-changelog-bounces@lists.xen.org Tue Apr 03 20:22:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Apr 2012 20:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFAFD-0000l9-45; Tue, 03 Apr 2012 20:22:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAFB-0000iV-Tt
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:22 +0000
Received: from [85.158.139.83:39774] by server-6.bemta-5.messagelabs.com id
	E3/CB-13222-DFB5B7F4; Tue, 03 Apr 2012 20:22:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1333484538!22265255!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28352 invoked from network); 3 Apr 2012 20:22:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Apr 2012 20:22:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF8-00041D-CZ
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFAF8-0003JV-BN
	for xen-changelog@lists.xensource.com; Tue, 03 Apr 2012 20:22:18 +0000
Message-Id: <E1SFAF8-0003JV-BN@xenbits.xen.org>
Date: Tue, 03 Apr 2012 20:22:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1333386871 -3600
# Node ID 2386288b1bf12e550e267c53976dba51eed8e74d
# Parent  d05e264ad2a75b2b7481594bd6e6a0f83bd2d8d1
QEMU_TAG update
---


diff -r d05e264ad2a7 -r 2386288b1bf1 Config.mk
--- a/Config.mk	Thu Mar 22 09:02:29 2012 +0000
+++ b/Config.mk	Mon Apr 02 18:14:31 2012 +0100
@@ -216,9 +216,9 @@ CONFIG_SEABIOS ?= y
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 2503d4d5a29e7af8dffd1e11229e11c1917d2ccf
-# Thu Mar 1 18:58:27 2012 +0000
-# qemu-xen: ignore console disconnect events for console/0
+QEMU_TAG ?= f0fad5549f8103fc0130d3121eb5f7913c5bc2a9
+# Mon Apr 2 17:55:05 2012 +0100
+# qemu-xen-traditional: QDISK fixes
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.

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

From xen-changelog-bounces@lists.xen.org Thu Apr 05 20:22:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Apr 2012 20: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 1SFtC9-0004Ki-Sl; Thu, 05 Apr 2012 20:22: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 1SFtC9-0004KL-5a
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:13 +0000
Received: from [193.109.254.147:9658] by server-2.bemta-14.messagelabs.com id
	1E/DB-19409-4FEFD7F4; Thu, 05 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1333657329!3447035!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3975 invoked from network); 5 Apr 2012 20:22:10 -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;
	5 Apr 2012 20: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 1SFtC5-0006qr-40
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFtC4-0007mG-Ao
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:08 +0000
Message-Id: <E1SFtC4-0007mG-Ao@xenbits.xen.org>
Date: Thu, 05 Apr 2012 20: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] libxl: write vifname in xenstore
	if set.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Giam Teck Choon <giamteckchoon@gmail.com>
# Date 1333465427 -3600
# Node ID 98dbb195d270e0f096a9c92aa6b83bba4422073c
# Parent  b574b8b6bb108a7768825471a5f85f40c20b1cec
libxl: write vifname in xenstore if set.

Simple fix to enable user to specify vif names.

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

xen-unstable changeset: 24459:caf9753d4cc1
Backport-requested-by: Roderick Colenbrander <thunderbird2k@gmail.com>
Signed-off-by: Giam Teck Choon <giamteckchoon@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b574b8b6bb10 -r 98dbb195d270 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Mar 30 17:19:18 2012 +0100
+++ b/tools/libxl/libxl.c	Tue Apr 03 16:03:47 2012 +0100
@@ -1229,6 +1229,12 @@ int libxl_device_nic_add(libxl_ctx *ctx,
     flexarray_append(back, libxl__sprintf(&gc, "%d", 1));
     flexarray_append(back, "script");
     flexarray_append(back, nic->script);
+
+    if (nic->ifname) {
+       flexarray_append(back, "vifname");
+       flexarray_append(back, nic->ifname);
+    }
+
     flexarray_append(back, "mac");
     flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
                                                  nic->mac[0], nic->mac[1], nic->mac[2],

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

From xen-changelog-bounces@lists.xen.org Thu Apr 05 20:22:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Apr 2012 20: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 1SFtC9-0004Ki-Sl; Thu, 05 Apr 2012 20:22: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 1SFtC9-0004KL-5a
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:13 +0000
Received: from [193.109.254.147:9658] by server-2.bemta-14.messagelabs.com id
	1E/DB-19409-4FEFD7F4; Thu, 05 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1333657329!3447035!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3975 invoked from network); 5 Apr 2012 20:22:10 -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;
	5 Apr 2012 20: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 1SFtC5-0006qr-40
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFtC4-0007mG-Ao
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:08 +0000
Message-Id: <E1SFtC4-0007mG-Ao@xenbits.xen.org>
Date: Thu, 05 Apr 2012 20: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] libxl: write vifname in xenstore
	if set.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Giam Teck Choon <giamteckchoon@gmail.com>
# Date 1333465427 -3600
# Node ID 98dbb195d270e0f096a9c92aa6b83bba4422073c
# Parent  b574b8b6bb108a7768825471a5f85f40c20b1cec
libxl: write vifname in xenstore if set.

Simple fix to enable user to specify vif names.

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

xen-unstable changeset: 24459:caf9753d4cc1
Backport-requested-by: Roderick Colenbrander <thunderbird2k@gmail.com>
Signed-off-by: Giam Teck Choon <giamteckchoon@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b574b8b6bb10 -r 98dbb195d270 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Mar 30 17:19:18 2012 +0100
+++ b/tools/libxl/libxl.c	Tue Apr 03 16:03:47 2012 +0100
@@ -1229,6 +1229,12 @@ int libxl_device_nic_add(libxl_ctx *ctx,
     flexarray_append(back, libxl__sprintf(&gc, "%d", 1));
     flexarray_append(back, "script");
     flexarray_append(back, nic->script);
+
+    if (nic->ifname) {
+       flexarray_append(back, "vifname");
+       flexarray_append(back, nic->ifname);
+    }
+
     flexarray_append(back, "mac");
     flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x",
                                                  nic->mac[0], nic->mac[1], nic->mac[2],

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

From xen-changelog-bounces@lists.xen.org Thu Apr 05 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Apr 2012 20: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 1SFtCA-0004Kt-Vl; Thu, 05 Apr 2012 20:22: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 1SFtC9-0004KR-Mq
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:13 +0000
Received: from [85.158.138.51:48424] by server-3.bemta-3.messagelabs.com id
	95/38-10665-4FEFD7F4; Thu, 05 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1333657330!21000505!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19376 invoked from network); 5 Apr 2012 20:22:11 -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;
	5 Apr 2012 20: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 1SFtC5-0006qu-7B
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFtC4-0007mV-Sf
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:08 +0000
Message-Id: <E1SFtC4-0007mV-Sf@xenbits.xen.org>
Date: Thu, 05 Apr 2012 20:22:08 +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: tolerate empty
	state/*.xml
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1333465570 -3600
# Node ID 369bf6c946b9b25edb750fc834de8cdd1f346bc9
# Parent  98dbb195d270e0f096a9c92aa6b83bba4422073c
tools: xend: tolerate empty state/*.xml

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

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

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

xen-unstable changeset: 24140:a3a2e300951a
Backport-requested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 98dbb195d270 -r 369bf6c946b9 tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py	Tue Apr 03 16:03:47 2012 +0100
+++ b/tools/python/xen/xend/XendStateStore.py	Tue Apr 03 16:06:10 2012 +0100
@@ -101,6 +101,9 @@ class XendStateStore:
         if not os.path.exists(xml_path):
             return {}
 
+        if not os.path.getsize(xml_path) == 0:
+            return {}
+
         dom = minidom.parse(xml_path)
         root = dom.documentElement
         state = {}

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

From xen-changelog-bounces@lists.xen.org Thu Apr 05 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Apr 2012 20: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 1SFtCA-0004Kt-Vl; Thu, 05 Apr 2012 20:22: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 1SFtC9-0004KR-Mq
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:13 +0000
Received: from [85.158.138.51:48424] by server-3.bemta-3.messagelabs.com id
	95/38-10665-4FEFD7F4; Thu, 05 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1333657330!21000505!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19376 invoked from network); 5 Apr 2012 20:22:11 -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;
	5 Apr 2012 20: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 1SFtC5-0006qu-7B
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFtC4-0007mV-Sf
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:08 +0000
Message-Id: <E1SFtC4-0007mV-Sf@xenbits.xen.org>
Date: Thu, 05 Apr 2012 20:22:08 +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: tolerate empty
	state/*.xml
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1333465570 -3600
# Node ID 369bf6c946b9b25edb750fc834de8cdd1f346bc9
# Parent  98dbb195d270e0f096a9c92aa6b83bba4422073c
tools: xend: tolerate empty state/*.xml

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

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

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

xen-unstable changeset: 24140:a3a2e300951a
Backport-requested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 98dbb195d270 -r 369bf6c946b9 tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py	Tue Apr 03 16:03:47 2012 +0100
+++ b/tools/python/xen/xend/XendStateStore.py	Tue Apr 03 16:06:10 2012 +0100
@@ -101,6 +101,9 @@ class XendStateStore:
         if not os.path.exists(xml_path):
             return {}
 
+        if not os.path.getsize(xml_path) == 0:
+            return {}
+
         dom = minidom.parse(xml_path)
         root = dom.documentElement
         state = {}

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

From xen-changelog-bounces@lists.xen.org Thu Apr 05 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Apr 2012 20: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 1SFtC9-0004KZ-Pz; Thu, 05 Apr 2012 20:22: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 1SFtC8-0004KH-Q0
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:13 +0000
Received: from [193.109.254.147:59795] by server-7.bemta-14.messagelabs.com id
	72/11-01627-4FEFD7F4; Thu, 05 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1333657330!972885!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18964 invoked from network); 5 Apr 2012 20:22: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;
	5 Apr 2012 20: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 1SFtC5-0006qz-Ox
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFtC5-0007mk-ET
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Message-Id: <E1SFtC5-0007mk-ET@xenbits.xen.org>
Date: Thu, 05 Apr 2012 20:22:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] libxl: support for
	"rtc_timeoffset" and "localtime"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Giam Teck Choon <giamteckchoon@gmail.com>
# Date 1333552165 -3600
# Node ID 6f224431eca2ecea490fdcbd401942de5b20c3dd
# Parent  369bf6c946b9b25edb750fc834de8cdd1f346bc9
libxl: support for "rtc_timeoffset" and "localtime"

Implement "rtc_timeoffset" and "localtime" options compatible as xm.

rtc_timeoffset is the offset between host time and guest time.
localtime means to specify whether the emulted RTC appears as UTC or is
offset by the host.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Committed-by: Ian Jackson <ian.jackson.citrix.com>

xen-unstable changeset: 25131:6f81f4d79fde
Backport-requested-by: Giam Teck Choon <giamteckchoon@gmail.com>
Signed-off-by: Giam Teck Choon <giamteckchoon@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl	Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/libxl.idl	Wed Apr 04 16:09:25 2012 +0100
@@ -94,6 +94,8 @@ libxl_domain_build_info = Struct("domain
     ("target_memkb",    uint32),
     ("video_memkb",     uint32),
     ("shadow_memkb",    uint32),
+    ("rtc_timeoffset",  uint32),
+    ("localtime",       bool),
     ("disable_migrate", bool),
     ("kernel",          libxl_file_reference),
     ("cpuid",           libxl_cpuid_policy_list),
diff -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/libxl_dom.c	Wed Apr 04 16:09:25 2012 +0100
@@ -76,6 +76,9 @@ int libxl__build_pre(libxl_ctx *ctx, uin
     if ( info->disable_migrate )
         xc_domain_disable_migrate(ctx->xch, domid);
 
+    if (info->rtc_timeoffset)
+        xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset);
+
     if (info->hvm) {
         unsigned long shadow;
         shadow = (info->shadow_memkb + 1023) / 1024;
diff -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:09:25 2012 +0100
@@ -737,6 +737,20 @@ static void parse_config_data(const char
     if (!xlu_cfg_get_long(config, "tsc_mode", &l))
         b_info->tsc_mode = l;
 
+    b_info->rtc_timeoffset = !xlu_cfg_get_long(config, "rtc_timeoffset", &l)
+        ? l : 0;
+
+    b_info->localtime = !xlu_cfg_get_long(config, "localtime", &l) ? l : 0;
+    if (b_info->localtime) {
+        time_t t;
+        struct tm *tm;
+
+        t = time(NULL);
+        tm = localtime(&t);
+
+        b_info->rtc_timeoffset += tm->tm_gmtoff;
+    }
+
     if (!xlu_cfg_get_long (config, "videoram", &l))
         b_info->video_memkb = l * 1024;
 

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

From xen-changelog-bounces@lists.xen.org Thu Apr 05 20:22:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Apr 2012 20: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 1SFtC9-0004KZ-Pz; Thu, 05 Apr 2012 20:22: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 1SFtC8-0004KH-Q0
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:13 +0000
Received: from [193.109.254.147:59795] by server-7.bemta-14.messagelabs.com id
	72/11-01627-4FEFD7F4; Thu, 05 Apr 2012 20:22:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1333657330!972885!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18964 invoked from network); 5 Apr 2012 20:22: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;
	5 Apr 2012 20: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 1SFtC5-0006qz-Ox
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFtC5-0007mk-ET
	for xen-changelog@lists.xensource.com; Thu, 05 Apr 2012 20:22:09 +0000
Message-Id: <E1SFtC5-0007mk-ET@xenbits.xen.org>
Date: Thu, 05 Apr 2012 20:22:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] libxl: support for
	"rtc_timeoffset" and "localtime"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Giam Teck Choon <giamteckchoon@gmail.com>
# Date 1333552165 -3600
# Node ID 6f224431eca2ecea490fdcbd401942de5b20c3dd
# Parent  369bf6c946b9b25edb750fc834de8cdd1f346bc9
libxl: support for "rtc_timeoffset" and "localtime"

Implement "rtc_timeoffset" and "localtime" options compatible as xm.

rtc_timeoffset is the offset between host time and guest time.
localtime means to specify whether the emulted RTC appears as UTC or is
offset by the host.

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
Committed-by: Ian Jackson <ian.jackson.citrix.com>

xen-unstable changeset: 25131:6f81f4d79fde
Backport-requested-by: Giam Teck Choon <giamteckchoon@gmail.com>
Signed-off-by: Giam Teck Choon <giamteckchoon@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl	Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/libxl.idl	Wed Apr 04 16:09:25 2012 +0100
@@ -94,6 +94,8 @@ libxl_domain_build_info = Struct("domain
     ("target_memkb",    uint32),
     ("video_memkb",     uint32),
     ("shadow_memkb",    uint32),
+    ("rtc_timeoffset",  uint32),
+    ("localtime",       bool),
     ("disable_migrate", bool),
     ("kernel",          libxl_file_reference),
     ("cpuid",           libxl_cpuid_policy_list),
diff -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/libxl_dom.c	Wed Apr 04 16:09:25 2012 +0100
@@ -76,6 +76,9 @@ int libxl__build_pre(libxl_ctx *ctx, uin
     if ( info->disable_migrate )
         xc_domain_disable_migrate(ctx->xch, domid);
 
+    if (info->rtc_timeoffset)
+        xc_domain_set_time_offset(ctx->xch, domid, info->rtc_timeoffset);
+
     if (info->hvm) {
         unsigned long shadow;
         shadow = (info->shadow_memkb + 1023) / 1024;
diff -r 369bf6c946b9 -r 6f224431eca2 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Apr 03 16:06:10 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:09:25 2012 +0100
@@ -737,6 +737,20 @@ static void parse_config_data(const char
     if (!xlu_cfg_get_long(config, "tsc_mode", &l))
         b_info->tsc_mode = l;
 
+    b_info->rtc_timeoffset = !xlu_cfg_get_long(config, "rtc_timeoffset", &l)
+        ? l : 0;
+
+    b_info->localtime = !xlu_cfg_get_long(config, "localtime", &l) ? l : 0;
+    if (b_info->localtime) {
+        time_t t;
+        struct tm *tm;
+
+        t = time(NULL);
+        tm = localtime(&t);
+
+        b_info->rtc_timeoffset += tm->tm_gmtoff;
+    }
+
     if (!xlu_cfg_get_long (config, "videoram", &l))
         b_info->video_memkb = l * 1024;
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzE-0004L5-QU; Fri, 06 Apr 2012 02:33: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 1SFyzD-0004Ki-6V
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Received: from [85.158.143.99:32464] by server-2.bemta-4.messagelabs.com id
	8E/59-17550-AE55E7F4; Fri, 06 Apr 2012 02:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1333679592!16203874!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14166 invoked from network); 6 Apr 2012 02:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02: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 1SFyz9-0003Mc-99
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz8-0008JK-Ut
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Message-Id: <E1SFyz8-0008JK-Ut@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: clarify documentation for the
	the dom0_mem command line option
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333460408 -3600
# Node ID 79117b669f6fb7f22c8f014de0df602cd7c52d7d
# Parent  0879faaf4c09596d06aad313b20e1bc952f4efde
docs: clarify documentation for the the dom0_mem command line option

This addresses Ian C's comments on v1 of a previous patch (which
was applied instead of v2).

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


diff -r 0879faaf4c09 -r 79117b669f6f docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Tue Apr 03 14:28:45 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Tue Apr 03 14:40:08 2012 +0100
@@ -286,19 +286,27 @@ Specify the total size for dom0.
 > `= List of ( min:<size> | max:<size> | <size> )`
 
 Set the amount of memory for the initial domain (dom0). If a size is
-positive, it represents an absolute value.  If a size is negative, the
-size specified is subtracted from the total available memory.
+positive, it represents an absolute value.  If a size is negative, it
+is subtracted from the total available memory.
 
-* `min:<size>` specifies the minimum amount of memory allocated to dom0.
-* `max:<size>` specifies the maximum amount of memory allocated to dom0.
-* `<size>` specified the exact amount of memory allocated to dom0.
+* `<size>` specifies the exact amount of memory.
+* `min:<size>` specifies the minimum amount of memory.
+* `max:<size>` specifies the maximum amount of memory.
+
+If `<size>` is not specified, the default is all the available memory
+minus some reserve.  The reserve is 1/16 of the available memory or
+128 MB (whichever is smaller).
+
+The amount of memory will be at least the minimum but never more than
+the maximum (i.e., `max` overrides the `min` option).  If there isn't
+enough memory then as much as possible is allocated.
 
 `max:<size>` also sets the maximum reservation (the maximum amount of
 memory dom0 can balloon up to).  If this is omitted then the maximum
 reservation is unlimited.
 
-For example, to set dom0's memory to 512 MB but no more than 1 GB use
-`dom0_mem=512M,max:1G`.
+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`
 
 ### dom0\_shadow
 ### dom0\_vcpus\_pin

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzE-0004L5-QU; Fri, 06 Apr 2012 02:33: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 1SFyzD-0004Ki-6V
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Received: from [85.158.143.99:32464] by server-2.bemta-4.messagelabs.com id
	8E/59-17550-AE55E7F4; Fri, 06 Apr 2012 02:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1333679592!16203874!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14166 invoked from network); 6 Apr 2012 02:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02: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 1SFyz9-0003Mc-99
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz8-0008JK-Ut
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Message-Id: <E1SFyz8-0008JK-Ut@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: clarify documentation for the
	the dom0_mem command line option
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1333460408 -3600
# Node ID 79117b669f6fb7f22c8f014de0df602cd7c52d7d
# Parent  0879faaf4c09596d06aad313b20e1bc952f4efde
docs: clarify documentation for the the dom0_mem command line option

This addresses Ian C's comments on v1 of a previous patch (which
was applied instead of v2).

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


diff -r 0879faaf4c09 -r 79117b669f6f docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown	Tue Apr 03 14:28:45 2012 +0100
+++ b/docs/misc/xen-command-line.markdown	Tue Apr 03 14:40:08 2012 +0100
@@ -286,19 +286,27 @@ Specify the total size for dom0.
 > `= List of ( min:<size> | max:<size> | <size> )`
 
 Set the amount of memory for the initial domain (dom0). If a size is
-positive, it represents an absolute value.  If a size is negative, the
-size specified is subtracted from the total available memory.
+positive, it represents an absolute value.  If a size is negative, it
+is subtracted from the total available memory.
 
-* `min:<size>` specifies the minimum amount of memory allocated to dom0.
-* `max:<size>` specifies the maximum amount of memory allocated to dom0.
-* `<size>` specified the exact amount of memory allocated to dom0.
+* `<size>` specifies the exact amount of memory.
+* `min:<size>` specifies the minimum amount of memory.
+* `max:<size>` specifies the maximum amount of memory.
+
+If `<size>` is not specified, the default is all the available memory
+minus some reserve.  The reserve is 1/16 of the available memory or
+128 MB (whichever is smaller).
+
+The amount of memory will be at least the minimum but never more than
+the maximum (i.e., `max` overrides the `min` option).  If there isn't
+enough memory then as much as possible is allocated.
 
 `max:<size>` also sets the maximum reservation (the maximum amount of
 memory dom0 can balloon up to).  If this is omitted then the maximum
 reservation is unlimited.
 
-For example, to set dom0's memory to 512 MB but no more than 1 GB use
-`dom0_mem=512M,max:1G`.
+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`
 
 ### dom0\_shadow
 ### dom0\_vcpus\_pin

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzG-0004La-1h; Fri, 06 Apr 2012 02:33: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 1SFyzE-0004Ky-Vv
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from [193.109.254.147:15464] by server-3.bemta-14.messagelabs.com id
	1B/65-23274-CE55E7F4; Fri, 06 Apr 2012 02:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1333679594!996061!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21522 invoked from network); 6 Apr 2012 02:33:15 -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;
	6 Apr 2012 02:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzC-0003Ml-2g
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0008K6-Ob
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Message-Id: <E1SFyzB-0008K6-Ob@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: log device model arguments to
	aid debugging
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332167041 0
# Node ID af1096d2fe740cdd4d1743a16786f8722d4da35f
# Parent  db3ac329f3e792686868493bbc79eb6d506c4f7b
libxl: log device model arguments to aid debugging

At the moment the only easy way to get at these is to strace xl.

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


diff -r db3ac329f3e7 -r af1096d2fe74 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Apr 03 15:25:01 2012 +0100
+++ b/tools/libxl/libxl_dm.c	Mon Mar 19 14:24:01 2012 +0000
@@ -893,7 +893,7 @@ int libxl__create_device_model(libxl__gc
     char *path, *logfile;
     int logfile_w, null;
     int rc;
-    char **args;
+    char **args, **arg;
     libxl__spawner_starting buf_starting, *p;
     xs_transaction_t t;
     char *vm_path;
@@ -985,6 +985,10 @@ retry_transaction:
         }
     }
 
+    LIBXL__LOG(CTX, XTL_DEBUG, "Spawning device-model %s with arguments:", dm);
+    for (arg = args; *arg; arg++)
+        LIBXL__LOG(CTX, XTL_DEBUG, "  %s", *arg);
+
     rc = libxl__spawn_spawn(gc, p->for_spawn, "device model",
                             libxl_spawner_record_pid, p);
     if (rc < 0)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzG-0004La-1h; Fri, 06 Apr 2012 02:33: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 1SFyzE-0004Ky-Vv
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from [193.109.254.147:15464] by server-3.bemta-14.messagelabs.com id
	1B/65-23274-CE55E7F4; Fri, 06 Apr 2012 02:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1333679594!996061!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21522 invoked from network); 6 Apr 2012 02:33:15 -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;
	6 Apr 2012 02:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzC-0003Ml-2g
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0008K6-Ob
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Message-Id: <E1SFyzB-0008K6-Ob@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: log device model arguments to
	aid debugging
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332167041 0
# Node ID af1096d2fe740cdd4d1743a16786f8722d4da35f
# Parent  db3ac329f3e792686868493bbc79eb6d506c4f7b
libxl: log device model arguments to aid debugging

At the moment the only easy way to get at these is to strace xl.

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


diff -r db3ac329f3e7 -r af1096d2fe74 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Apr 03 15:25:01 2012 +0100
+++ b/tools/libxl/libxl_dm.c	Mon Mar 19 14:24:01 2012 +0000
@@ -893,7 +893,7 @@ int libxl__create_device_model(libxl__gc
     char *path, *logfile;
     int logfile_w, null;
     int rc;
-    char **args;
+    char **args, **arg;
     libxl__spawner_starting buf_starting, *p;
     xs_transaction_t t;
     char *vm_path;
@@ -985,6 +985,10 @@ retry_transaction:
         }
     }
 
+    LIBXL__LOG(CTX, XTL_DEBUG, "Spawning device-model %s with arguments:", dm);
+    for (arg = args; *arg; arg++)
+        LIBXL__LOG(CTX, XTL_DEBUG, "  %s", *arg);
+
     rc = libxl__spawn_spawn(gc, p->for_spawn, "device model",
                             libxl_spawner_record_pid, p);
     if (rc < 0)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzH-0004Ly-5w; Fri, 06 Apr 2012 02:33: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 1SFyzF-0004LL-QK
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from [193.109.254.147:2117] by server-8.bemta-14.messagelabs.com id
	B6/C6-23244-DE55E7F4; Fri, 06 Apr 2012 02:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1333679595!366268!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26553 invoked from network); 6 Apr 2012 02:33:16 -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;
	6 Apr 2012 02:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzD-0003Mr-4r
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzD-0008Ka-2u
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Message-Id: <E1SFyzD-0008Ka-2u@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] config/Tools.mk: remove unused IP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333465013 -3600
# Node ID f454b0305a0ebe84f6cdab6b067040f9614dfd78
# Parent  93d82e1943c3a57ec6ec121017bdb73677891eba
config/Tools.mk: remove unused IP

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


diff -r 93d82e1943c3 -r f454b0305a0e config/Tools.mk.in
--- a/config/Tools.mk.in	Mon Mar 19 15:06:19 2012 +0000
+++ b/config/Tools.mk.in	Tue Apr 03 15:56:53 2012 +0100
@@ -11,7 +11,6 @@ FLEX                := @FLEX@
 PYTHON              := @PYTHON@
 PYTHON_PATH         := @PYTHONPATH@
 PERL                := @PERL@
-IP                  := @IP@
 CURL_CONFIG         := @CURL@
 XML2_CONFIG         := @XML@
 BASH                := @BASH@

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzH-0004Ly-5w; Fri, 06 Apr 2012 02:33: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 1SFyzF-0004LL-QK
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from [193.109.254.147:2117] by server-8.bemta-14.messagelabs.com id
	B6/C6-23244-DE55E7F4; Fri, 06 Apr 2012 02:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1333679595!366268!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26553 invoked from network); 6 Apr 2012 02:33:16 -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;
	6 Apr 2012 02:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzD-0003Mr-4r
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzD-0008Ka-2u
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Message-Id: <E1SFyzD-0008Ka-2u@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] config/Tools.mk: remove unused IP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333465013 -3600
# Node ID f454b0305a0ebe84f6cdab6b067040f9614dfd78
# Parent  93d82e1943c3a57ec6ec121017bdb73677891eba
config/Tools.mk: remove unused IP

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


diff -r 93d82e1943c3 -r f454b0305a0e config/Tools.mk.in
--- a/config/Tools.mk.in	Mon Mar 19 15:06:19 2012 +0000
+++ b/config/Tools.mk.in	Tue Apr 03 15:56:53 2012 +0100
@@ -11,7 +11,6 @@ FLEX                := @FLEX@
 PYTHON              := @PYTHON@
 PYTHON_PATH         := @PYTHONPATH@
 PERL                := @PERL@
-IP                  := @IP@
 CURL_CONFIG         := @CURL@
 XML2_CONFIG         := @XML@
 BASH                := @BASH@

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzE-0004LA-Sq; Fri, 06 Apr 2012 02:33: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 1SFyzE-0004Kn-3R
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Received: from [193.109.254.147:15443] by server-1.bemta-14.messagelabs.com id
	1F/16-29372-BE55E7F4; Fri, 06 Apr 2012 02:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1333679593!3460623!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32761 invoked from network); 6 Apr 2012 02:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0003Mi-CG
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0008Jr-7h
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:13 +0000
Message-Id: <E1SFyzB-0008Jr-7h@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: specify datadir for qemu-xen
	build to fix firmware loading
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333463101 -3600
# Node ID db3ac329f3e792686868493bbc79eb6d506c4f7b
# Parent  c5b7d49ca3ee29b76ebb3e0a99861733d3757f4b
tools: specify datadir for qemu-xen build to fix firmware loading

qemu-xen does currently not find the firmware files, such as
vgabios-cirrus.bin. The reason is that qemu-xen uses the default prefix
/usr/local. Use SHAREDIR/qemu-xen as directory so that it can coexist
with qemu-traditional which is installed in SHAREDIR/xen/qemu.

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


diff -r c5b7d49ca3ee -r db3ac329f3e7 tools/Makefile
--- a/tools/Makefile	Tue Apr 03 15:12:21 2012 +0100
+++ b/tools/Makefile	Tue Apr 03 15:25:01 2012 +0100
@@ -154,6 +154,7 @@ subdir-all-qemu-xen-dir subdir-install-q
 		--extra-ldflags="-L$(XEN_ROOT)/tools/libxc \
 		-L$(XEN_ROOT)/tools/xenstore" \
 		--bindir=$(LIBEXEC) \
+		--datadir=$(SHAREDIR)/qemu-xen \
 		--disable-kvm \
 		--python=$(PYTHON) \
 		$(IOEMU_CONFIGURE_CROSS); \

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzE-0004LA-Sq; Fri, 06 Apr 2012 02:33: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 1SFyzE-0004Kn-3R
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Received: from [193.109.254.147:15443] by server-1.bemta-14.messagelabs.com id
	1F/16-29372-BE55E7F4; Fri, 06 Apr 2012 02:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1333679593!3460623!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32761 invoked from network); 6 Apr 2012 02:33:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0003Mi-CG
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0008Jr-7h
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:13 +0000
Message-Id: <E1SFyzB-0008Jr-7h@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: specify datadir for qemu-xen
	build to fix firmware loading
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333463101 -3600
# Node ID db3ac329f3e792686868493bbc79eb6d506c4f7b
# Parent  c5b7d49ca3ee29b76ebb3e0a99861733d3757f4b
tools: specify datadir for qemu-xen build to fix firmware loading

qemu-xen does currently not find the firmware files, such as
vgabios-cirrus.bin. The reason is that qemu-xen uses the default prefix
/usr/local. Use SHAREDIR/qemu-xen as directory so that it can coexist
with qemu-traditional which is installed in SHAREDIR/xen/qemu.

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


diff -r c5b7d49ca3ee -r db3ac329f3e7 tools/Makefile
--- a/tools/Makefile	Tue Apr 03 15:12:21 2012 +0100
+++ b/tools/Makefile	Tue Apr 03 15:25:01 2012 +0100
@@ -154,6 +154,7 @@ subdir-all-qemu-xen-dir subdir-install-q
 		--extra-ldflags="-L$(XEN_ROOT)/tools/libxc \
 		-L$(XEN_ROOT)/tools/xenstore" \
 		--bindir=$(LIBEXEC) \
+		--datadir=$(SHAREDIR)/qemu-xen \
 		--disable-kvm \
 		--python=$(PYTHON) \
 		$(IOEMU_CONFIGURE_CROSS); \

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzI-0004Mc-CL; Fri, 06 Apr 2012 02:33: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 1SFyzH-0004Kd-6l
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Received: from [85.158.143.99:18377] by server-3.bemta-4.messagelabs.com id
	79/97-05853-EE55E7F4; Fri, 06 Apr 2012 02:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1333679596!22026752!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6111 invoked from network); 6 Apr 2012 02:33:17 -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;
	6 Apr 2012 02:33: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 1SFyzE-0003Mx-BL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzE-0008L5-9e
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Message-Id: <E1SFyzE-0008L5-9e@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Pass actual RAM amount to
	qemu-xen
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1333473311 -3600
# Node ID b0356d31076a45422a121915c69651093f491c78
# Parent  249b2eeeeae5576dd32748ea8ffa13e94d06eb20
libxl: Pass actual RAM amount to qemu-xen

QEMU upstream need to kown the amount of RAM given to a guest. This patch give
the correct value.

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


diff -r 249b2eeeeae5 -r b0356d31076a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Apr 03 18:02:46 2012 +0100
+++ b/tools/libxl/libxl_dm.c	Tue Apr 03 18:15:11 2012 +0100
@@ -323,6 +323,7 @@ static char ** libxl__build_device_model
     const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
     int i;
+    uint64_t ram_size;
 
     dm_args = flexarray_make(16, 1);
     if (!dm_args)
@@ -504,11 +505,9 @@ static char ** libxl__build_device_model
         break;
     }
 
-    /* RAM Size */
+    ram_size = libxl__sizekb_to_mb(b_info->max_memkb - b_info->video_memkb);
     flexarray_append(dm_args, "-m");
-    flexarray_append(dm_args,
-                     libxl__sprintf(gc, "%d",
-                                    libxl__sizekb_to_mb(b_info->target_memkb)));
+    flexarray_append(dm_args, libxl__sprintf(gc, "%"PRId64, ram_size));
 
     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         for (i = 0; i < num_disks; i++) {

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzH-0004M3-8j; Fri, 06 Apr 2012 02:33: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 1SFyzG-0004LP-As
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Received: from [85.158.138.51:50421] by server-6.bemta-3.messagelabs.com id
	16/28-08206-DE55E7F4; Fri, 06 Apr 2012 02:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1333679595!20987872!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9574 invoked from network); 6 Apr 2012 02:33:16 -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;
	6 Apr 2012 02:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzC-0003Mo-NB
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzC-0008KL-Hk
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Message-Id: <E1SFyzC-0008KL-Hk@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Document API and ABI
	compatibility guarantees.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332169579 0
# Node ID 93d82e1943c3a57ec6ec121017bdb73677891eba
# Parent  af1096d2fe740cdd4d1743a16786f8722d4da35f
libxl: Document API and ABI compatibility guarantees.

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


diff -r af1096d2fe74 -r 93d82e1943c3 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Mon Mar 19 14:24:01 2012 +0000
+++ b/tools/libxl/libxl.h	Mon Mar 19 15:06:19 2012 +0000
@@ -14,6 +14,77 @@
  */
 
 /*
+ * libxl API compatibility
+ *
+ * From Xen 4.2 onwards the API of libxl will be maintained in a
+ * stable manner. This means that it should be possible to write an
+ * application against the API provided by libxl in Xen 4.2 and expect
+ * that it will continue to compile against future versions of Xen
+ * without source modification.
+ *
+ * In order to make such compatibility possible it is required that
+ * application which want to be exposed to a particular API #define
+ * LIBXL_API_VERSION before including libxl.h or any other libxl
+ * header. The syntax of the LIBXL_API_VERSION is:
+ *    0xVVSSEE
+ * where ($(XEN_xxx) from xen/Makefile):
+ *   VV is the Xen major release number, $(XEN_VERSION)
+ *   SS is the Xen sub version number, $(XEN_SUBVERSION)
+ *   EE is the Xen extra version digit, first numeric part of
+ *     $(XEN_EXTRAVERSION) not including the leading "."
+ * For example the first stable API version, supported by Xen 4.2.0,
+ * is 0x040200.
+ *
+ * Lack of LIBXL_API_VERSION means "the latest" which will
+ * change. Specifying an unknown LIBXL_API_VERSION will result in a
+ * compile time error.
+ *
+ * Identical versions of the libxl API will represented by the version
+ * containing the earliest instance of that API. e.g. if 4.2.0 and
+ * 4.3.0 contain an identical libxl API then only LIBXL_API_VERSION
+ * 0x040200 will be valid.
+ *
+ * We will try especially hard to avoid changing the API during a
+ * stable series, i.e. it should be unusual for the last byte of
+ * LIBXL_API_VERSION to be non-zero.
+ *
+ * In the event that a change is required which cannot be made
+ * backwards compatible in this manner a #define of the form
+ * LIBXL_HAVE_<interface> will always be added in order to make it
+ * possible to write applciations which build against any version of
+ * libxl. Such changes are expected to be exceptional and used as a
+ * last resort. The barrier for backporting such a change to a stable
+ * branch will be very high.
+ *
+ * These guarantees apply only to stable releases of Xen. When an
+ * incompatible change is made in the unstable tree then
+ * LIBXL_API_VERSION will be bumped to the next expected stable
+ * release number on the first such change only. Applications which
+ * want to support building against Xen unstable are expected to track
+ * API changes in that tree until it is released as a stable release.
+ *
+ * API compatibility will be maintained for all versions of Xen using
+ * the same $(XEN_VERSION) (e.g. throughout a major release).
+ */
+
+/*
+ * libxl ABI compatibility
+ *
+ * The only guarantee which libxl makes regarding ABI compatibility
+ * across releases is that the SONAME will always be bumped whenever
+ * the ABI is changed in an incompatible way.
+ *
+ * This applies within stable branches as well as
+ * development branches. It is possible that a new stable release of
+ * Xen may require a rebuild of applications using the
+ * library. However per the API compatibility gaurantees such a
+ * rebuild should not normally require any source level changes.
+ *
+ * As with the API compatiblity the SONAME will only be bumped for the
+ * first ABI incompatible change in a development branch.
+ */
+
+/*
  * libxl memory management
  *
  * From the point of view of the application (ie, libxl's caller),
@@ -184,6 +255,13 @@
 #include <libxl_uuid.h>
 #include <_libxl_list.h>
 
+/* API compatibility. Only 0x040200 is supported at this time. */
+#ifdef LIBXL_API_VERSION
+#if LIBXL_API_VERSION != 0x040200
+#error Unknown LIBXL_API_VERSION
+#endif
+#endif
+
 typedef uint8_t libxl_mac[6];
 #define LIBXL_MAC_FMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
 #define LIBXL_MAC_FMTLEN ((2*6)+5) /* 6 hex bytes plus 5 colons */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzI-0004Mc-CL; Fri, 06 Apr 2012 02:33: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 1SFyzH-0004Kd-6l
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Received: from [85.158.143.99:18377] by server-3.bemta-4.messagelabs.com id
	79/97-05853-EE55E7F4; Fri, 06 Apr 2012 02:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1333679596!22026752!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6111 invoked from network); 6 Apr 2012 02:33:17 -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;
	6 Apr 2012 02:33: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 1SFyzE-0003Mx-BL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzE-0008L5-9e
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Message-Id: <E1SFyzE-0008L5-9e@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Pass actual RAM amount to
	qemu-xen
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1333473311 -3600
# Node ID b0356d31076a45422a121915c69651093f491c78
# Parent  249b2eeeeae5576dd32748ea8ffa13e94d06eb20
libxl: Pass actual RAM amount to qemu-xen

QEMU upstream need to kown the amount of RAM given to a guest. This patch give
the correct value.

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


diff -r 249b2eeeeae5 -r b0356d31076a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Apr 03 18:02:46 2012 +0100
+++ b/tools/libxl/libxl_dm.c	Tue Apr 03 18:15:11 2012 +0100
@@ -323,6 +323,7 @@ static char ** libxl__build_device_model
     const char *keymap = dm_keymap(guest_config);
     flexarray_t *dm_args;
     int i;
+    uint64_t ram_size;
 
     dm_args = flexarray_make(16, 1);
     if (!dm_args)
@@ -504,11 +505,9 @@ static char ** libxl__build_device_model
         break;
     }
 
-    /* RAM Size */
+    ram_size = libxl__sizekb_to_mb(b_info->max_memkb - b_info->video_memkb);
     flexarray_append(dm_args, "-m");
-    flexarray_append(dm_args,
-                     libxl__sprintf(gc, "%d",
-                                    libxl__sizekb_to_mb(b_info->target_memkb)));
+    flexarray_append(dm_args, libxl__sprintf(gc, "%"PRId64, ram_size));
 
     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
         for (i = 0; i < num_disks; i++) {

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzH-0004M3-8j; Fri, 06 Apr 2012 02:33: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 1SFyzG-0004LP-As
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Received: from [85.158.138.51:50421] by server-6.bemta-3.messagelabs.com id
	16/28-08206-DE55E7F4; Fri, 06 Apr 2012 02:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1333679595!20987872!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9574 invoked from network); 6 Apr 2012 02:33:16 -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;
	6 Apr 2012 02:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzC-0003Mo-NB
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzC-0008KL-Hk
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Message-Id: <E1SFyzC-0008KL-Hk@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Document API and ABI
	compatibility guarantees.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1332169579 0
# Node ID 93d82e1943c3a57ec6ec121017bdb73677891eba
# Parent  af1096d2fe740cdd4d1743a16786f8722d4da35f
libxl: Document API and ABI compatibility guarantees.

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


diff -r af1096d2fe74 -r 93d82e1943c3 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Mon Mar 19 14:24:01 2012 +0000
+++ b/tools/libxl/libxl.h	Mon Mar 19 15:06:19 2012 +0000
@@ -14,6 +14,77 @@
  */
 
 /*
+ * libxl API compatibility
+ *
+ * From Xen 4.2 onwards the API of libxl will be maintained in a
+ * stable manner. This means that it should be possible to write an
+ * application against the API provided by libxl in Xen 4.2 and expect
+ * that it will continue to compile against future versions of Xen
+ * without source modification.
+ *
+ * In order to make such compatibility possible it is required that
+ * application which want to be exposed to a particular API #define
+ * LIBXL_API_VERSION before including libxl.h or any other libxl
+ * header. The syntax of the LIBXL_API_VERSION is:
+ *    0xVVSSEE
+ * where ($(XEN_xxx) from xen/Makefile):
+ *   VV is the Xen major release number, $(XEN_VERSION)
+ *   SS is the Xen sub version number, $(XEN_SUBVERSION)
+ *   EE is the Xen extra version digit, first numeric part of
+ *     $(XEN_EXTRAVERSION) not including the leading "."
+ * For example the first stable API version, supported by Xen 4.2.0,
+ * is 0x040200.
+ *
+ * Lack of LIBXL_API_VERSION means "the latest" which will
+ * change. Specifying an unknown LIBXL_API_VERSION will result in a
+ * compile time error.
+ *
+ * Identical versions of the libxl API will represented by the version
+ * containing the earliest instance of that API. e.g. if 4.2.0 and
+ * 4.3.0 contain an identical libxl API then only LIBXL_API_VERSION
+ * 0x040200 will be valid.
+ *
+ * We will try especially hard to avoid changing the API during a
+ * stable series, i.e. it should be unusual for the last byte of
+ * LIBXL_API_VERSION to be non-zero.
+ *
+ * In the event that a change is required which cannot be made
+ * backwards compatible in this manner a #define of the form
+ * LIBXL_HAVE_<interface> will always be added in order to make it
+ * possible to write applciations which build against any version of
+ * libxl. Such changes are expected to be exceptional and used as a
+ * last resort. The barrier for backporting such a change to a stable
+ * branch will be very high.
+ *
+ * These guarantees apply only to stable releases of Xen. When an
+ * incompatible change is made in the unstable tree then
+ * LIBXL_API_VERSION will be bumped to the next expected stable
+ * release number on the first such change only. Applications which
+ * want to support building against Xen unstable are expected to track
+ * API changes in that tree until it is released as a stable release.
+ *
+ * API compatibility will be maintained for all versions of Xen using
+ * the same $(XEN_VERSION) (e.g. throughout a major release).
+ */
+
+/*
+ * libxl ABI compatibility
+ *
+ * The only guarantee which libxl makes regarding ABI compatibility
+ * across releases is that the SONAME will always be bumped whenever
+ * the ABI is changed in an incompatible way.
+ *
+ * This applies within stable branches as well as
+ * development branches. It is possible that a new stable release of
+ * Xen may require a rebuild of applications using the
+ * library. However per the API compatibility gaurantees such a
+ * rebuild should not normally require any source level changes.
+ *
+ * As with the API compatiblity the SONAME will only be bumped for the
+ * first ABI incompatible change in a development branch.
+ */
+
+/*
  * libxl memory management
  *
  * From the point of view of the application (ie, libxl's caller),
@@ -184,6 +255,13 @@
 #include <libxl_uuid.h>
 #include <_libxl_list.h>
 
+/* API compatibility. Only 0x040200 is supported at this time. */
+#ifdef LIBXL_API_VERSION
+#if LIBXL_API_VERSION != 0x040200
+#error Unknown LIBXL_API_VERSION
+#endif
+#endif
+
 typedef uint8_t libxl_mac[6];
 #define LIBXL_MAC_FMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
 #define LIBXL_MAC_FMTLEN ((2*6)+5) /* 6 hex bytes plus 5 colons */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzD-0004Ko-Ng; Fri, 06 Apr 2012 02:33: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 1SFyzC-0004Kd-Am
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Received: from [85.158.143.35:28574] by server-3.bemta-4.messagelabs.com id
	90/97-05853-9E55E7F4; Fri, 06 Apr 2012 02:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1333679591!13373753!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14142 invoked from network); 6 Apr 2012 02:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz8-0003MZ-Pa
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz8-0008J5-Er
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Message-Id: <E1SFyz8-0008J5-Er@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: fix python-dev detection
	on old python versions
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1333459725 -3600
# Node ID 0879faaf4c09596d06aad313b20e1bc952f4efde
# Parent  8aa1697d57e480e00b5aaef587c940b52055c064
autoconf: fix python-dev detection on old python versions

Replaced the use of python-config (that is only present in Python >= 2.5.x)
with the distutils python module.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
Tested-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8aa1697d57e4 -r 0879faaf4c09 tools/configure
--- a/tools/configure	Tue Apr 03 12:35:35 2012 +0200
+++ b/tools/configure	Tue Apr 03 14:28:45 2012 +0100
@@ -6143,27 +6143,26 @@ else
 $as_echo "yes" >&6; }
 fi
 
+ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("VERSION")'`
 ac_previous_cppflags=$CPPFLAGS
-CPPFLAGS="$CFLAGS `$PYTHON-config --includes`"
+CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
+CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("CFLAGS")'`"
 ac_previous_ldflags=$LDFLAGS
-for flag in `$PYTHON-config --ldflags`
-do
-    case $flag in
-    -L*)
-        LDFLAGS="$LDLFAGS $flag"
-        ;;
-    -lpython*)
-        python_lib=`echo $flag | sed 's/^-l//'`
-        ;;
-    -l*)
-        # Ignore other libraries, we are only interested in testing python-dev
-        ;;
-    *)
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Strange ldflag found in $PYTHON-config output: $flag" >&5
-$as_echo "$as_me: WARNING: Strange ldflag found in $PYTHON-config output: $flag" >&2;}
-        ;;
-    esac
-done
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+    standard_lib=1) + "/config"'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+
 ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" "$ac_includes_default"
 if test "x$ac_cv_header_Python_h" = x""yes; then :
 
@@ -6172,14 +6171,14 @@ else
 fi
 
 
-as_ac_Lib=`$as_echo "ac_cv_lib_$python_lib''_PyArg_ParseTuple" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyArg_ParseTuple in -l$python_lib" >&5
-$as_echo_n "checking for PyArg_ParseTuple in -l$python_lib... " >&6; }
+as_ac_Lib=`$as_echo "ac_cv_lib_python$ac_python_version''_PyArg_ParseTuple" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyArg_ParseTuple in -lpython$ac_python_version" >&5
+$as_echo_n "checking for PyArg_ParseTuple in -lpython$ac_python_version... " >&6; }
 if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$python_lib  $LIBS"
+LIBS="-lpython$ac_python_version  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -6212,10 +6211,10 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_LIB$python_lib" | $as_tr_cpp` 1
-_ACEOF
-
-  LIBS="-l$python_lib $LIBS"
+#define `$as_echo "HAVE_LIBpython$ac_python_version" | $as_tr_cpp` 1
+_ACEOF
+
+  LIBS="-lpython$ac_python_version $LIBS"
 
 else
   as_fn_error $? "Unable to find a suitable python development library" "$LINENO" 5
diff -r 8aa1697d57e4 -r 0879faaf4c09 tools/m4/python_devel.m4
--- a/tools/m4/python_devel.m4	Tue Apr 03 12:35:35 2012 +0200
+++ b/tools/m4/python_devel.m4	Tue Apr 03 14:28:45 2012 +0100
@@ -1,27 +1,27 @@
 AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [
+ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("VERSION")'`
 ac_previous_cppflags=$CPPFLAGS
-CPPFLAGS="$CFLAGS `$PYTHON-config --includes`"
+CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
+CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("CFLAGS")'`"
 ac_previous_ldflags=$LDFLAGS
-for flag in `$PYTHON-config --ldflags`
-do
-    case $flag in
-    -L*)
-        LDFLAGS="$LDLFAGS $flag"
-        ;;
-    -lpython*)
-        python_lib=`echo $flag | sed 's/^-l//'`
-        ;;
-    -l*)
-        # Ignore other libraries, we are only interested in testing python-dev
-        ;;
-    *)
-        AC_MSG_WARN([Strange ldflag found in $PYTHON-config output: $flag])
-        ;;
-    esac
-done
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+    standard_lib=1) + "/config"'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+
 AC_CHECK_HEADER([Python.h], [],
     [AC_MSG_ERROR([Unable to find Python development headers])],)
-AC_CHECK_LIB($python_lib, PyArg_ParseTuple, [],
+AC_CHECK_LIB(python$ac_python_version, PyArg_ParseTuple, [],
     [AC_MSG_ERROR([Unable to find a suitable python development library])])
 CPPFLAGS=$ac_previous_cppflags
 LDLFAGS=$ac_previous_ldflags

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzF-0004LV-VM; Fri, 06 Apr 2012 02:33: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 1SFyzE-0004Kt-Jq
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Received: from [85.158.138.51:10861] by server-4.bemta-3.messagelabs.com id
	C9/BA-16467-BE55E7F4; Fri, 06 Apr 2012 02:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1333679593!21024535!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21904 invoked from network); 6 Apr 2012 02:33:14 -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;
	6 Apr 2012 02:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0003Mf-24
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzA-0008Ja-5y
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:12 +0000
Message-Id: <E1SFyzA-0008Ja-5y@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/vtpm: use LDLIBS to pass -lgmp
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333462341 -3600
# Node ID c5b7d49ca3ee29b76ebb3e0a99861733d3757f4b
# Parent  79117b669f6fb7f22c8f014de0df602cd7c52d7d
tools/vtpm: use LDLIBS to pass -lgmp

Linking tpmd will fail with recent toolchains because -lgmp is passed
via LDFLAGS instead of LDLIBS. With this change -lgpm is placed at the
end of the gcc cmdline and linking tpmd succeeds again.

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


diff -r 79117b669f6f -r c5b7d49ca3ee tools/vtpm/vtpm-0.5.1.patch
--- a/tools/vtpm/vtpm-0.5.1.patch	Tue Apr 03 14:40:08 2012 +0100
+++ b/tools/vtpm/vtpm-0.5.1.patch	Tue Apr 03 15:12:21 2012 +0100
@@ -74,7 +74,7 @@ diff -Naurp tpm_emulator-0.5.1/tpmd/Make
             #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/sbin/
 +BINDIR  := /usr/bin/

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzF-0004LV-VM; Fri, 06 Apr 2012 02:33: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 1SFyzE-0004Kt-Jq
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Received: from [85.158.138.51:10861] by server-4.bemta-3.messagelabs.com id
	C9/BA-16467-BE55E7F4; Fri, 06 Apr 2012 02:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1333679593!21024535!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21904 invoked from network); 6 Apr 2012 02:33:14 -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;
	6 Apr 2012 02:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzB-0003Mf-24
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzA-0008Ja-5y
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:12 +0000
Message-Id: <E1SFyzA-0008Ja-5y@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/vtpm: use LDLIBS to pass -lgmp
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333462341 -3600
# Node ID c5b7d49ca3ee29b76ebb3e0a99861733d3757f4b
# Parent  79117b669f6fb7f22c8f014de0df602cd7c52d7d
tools/vtpm: use LDLIBS to pass -lgmp

Linking tpmd will fail with recent toolchains because -lgmp is passed
via LDFLAGS instead of LDLIBS. With this change -lgpm is placed at the
end of the gcc cmdline and linking tpmd succeeds again.

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


diff -r 79117b669f6f -r c5b7d49ca3ee tools/vtpm/vtpm-0.5.1.patch
--- a/tools/vtpm/vtpm-0.5.1.patch	Tue Apr 03 14:40:08 2012 +0100
+++ b/tools/vtpm/vtpm-0.5.1.patch	Tue Apr 03 15:12:21 2012 +0100
@@ -74,7 +74,7 @@ diff -Naurp tpm_emulator-0.5.1/tpmd/Make
             #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/sbin/
 +BINDIR  := /usr/bin/

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzD-0004Ko-Ng; Fri, 06 Apr 2012 02:33: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 1SFyzC-0004Kd-Am
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:14 +0000
Received: from [85.158.143.35:28574] by server-3.bemta-4.messagelabs.com id
	90/97-05853-9E55E7F4; Fri, 06 Apr 2012 02:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1333679591!13373753!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14142 invoked from network); 6 Apr 2012 02:33:12 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz8-0003MZ-Pa
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz8-0008J5-Er
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Message-Id: <E1SFyz8-0008J5-Er@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: fix python-dev detection
	on old python versions
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1333459725 -3600
# Node ID 0879faaf4c09596d06aad313b20e1bc952f4efde
# Parent  8aa1697d57e480e00b5aaef587c940b52055c064
autoconf: fix python-dev detection on old python versions

Replaced the use of python-config (that is only present in Python >= 2.5.x)
with the distutils python module.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Cc: Zhang, Yang Z <yang.z.zhang@intel.com>
Tested-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8aa1697d57e4 -r 0879faaf4c09 tools/configure
--- a/tools/configure	Tue Apr 03 12:35:35 2012 +0200
+++ b/tools/configure	Tue Apr 03 14:28:45 2012 +0100
@@ -6143,27 +6143,26 @@ else
 $as_echo "yes" >&6; }
 fi
 
+ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("VERSION")'`
 ac_previous_cppflags=$CPPFLAGS
-CPPFLAGS="$CFLAGS `$PYTHON-config --includes`"
+CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
+CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("CFLAGS")'`"
 ac_previous_ldflags=$LDFLAGS
-for flag in `$PYTHON-config --ldflags`
-do
-    case $flag in
-    -L*)
-        LDFLAGS="$LDLFAGS $flag"
-        ;;
-    -lpython*)
-        python_lib=`echo $flag | sed 's/^-l//'`
-        ;;
-    -l*)
-        # Ignore other libraries, we are only interested in testing python-dev
-        ;;
-    *)
-        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Strange ldflag found in $PYTHON-config output: $flag" >&5
-$as_echo "$as_me: WARNING: Strange ldflag found in $PYTHON-config output: $flag" >&2;}
-        ;;
-    esac
-done
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+    standard_lib=1) + "/config"'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+
 ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" "$ac_includes_default"
 if test "x$ac_cv_header_Python_h" = x""yes; then :
 
@@ -6172,14 +6171,14 @@ else
 fi
 
 
-as_ac_Lib=`$as_echo "ac_cv_lib_$python_lib''_PyArg_ParseTuple" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyArg_ParseTuple in -l$python_lib" >&5
-$as_echo_n "checking for PyArg_ParseTuple in -l$python_lib... " >&6; }
+as_ac_Lib=`$as_echo "ac_cv_lib_python$ac_python_version''_PyArg_ParseTuple" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyArg_ParseTuple in -lpython$ac_python_version" >&5
+$as_echo_n "checking for PyArg_ParseTuple in -lpython$ac_python_version... " >&6; }
 if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$python_lib  $LIBS"
+LIBS="-lpython$ac_python_version  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -6212,10 +6211,10 @@ eval ac_res=\$$as_ac_Lib
 $as_echo "$ac_res" >&6; }
 if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_LIB$python_lib" | $as_tr_cpp` 1
-_ACEOF
-
-  LIBS="-l$python_lib $LIBS"
+#define `$as_echo "HAVE_LIBpython$ac_python_version" | $as_tr_cpp` 1
+_ACEOF
+
+  LIBS="-lpython$ac_python_version $LIBS"
 
 else
   as_fn_error $? "Unable to find a suitable python development library" "$LINENO" 5
diff -r 8aa1697d57e4 -r 0879faaf4c09 tools/m4/python_devel.m4
--- a/tools/m4/python_devel.m4	Tue Apr 03 12:35:35 2012 +0200
+++ b/tools/m4/python_devel.m4	Tue Apr 03 14:28:45 2012 +0100
@@ -1,27 +1,27 @@
 AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [
+ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("VERSION")'`
 ac_previous_cppflags=$CPPFLAGS
-CPPFLAGS="$CFLAGS `$PYTHON-config --includes`"
+CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
+CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("CFLAGS")'`"
 ac_previous_ldflags=$LDFLAGS
-for flag in `$PYTHON-config --ldflags`
-do
-    case $flag in
-    -L*)
-        LDFLAGS="$LDLFAGS $flag"
-        ;;
-    -lpython*)
-        python_lib=`echo $flag | sed 's/^-l//'`
-        ;;
-    -l*)
-        # Ignore other libraries, we are only interested in testing python-dev
-        ;;
-    *)
-        AC_MSG_WARN([Strange ldflag found in $PYTHON-config output: $flag])
-        ;;
-    esac
-done
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+    standard_lib=1) + "/config"'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+    print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+
 AC_CHECK_HEADER([Python.h], [],
     [AC_MSG_ERROR([Unable to find Python development headers])],)
-AC_CHECK_LIB($python_lib, PyArg_ParseTuple, [],
+AC_CHECK_LIB(python$ac_python_version, PyArg_ParseTuple, [],
     [AC_MSG_ERROR([Unable to find a suitable python development library])])
 CPPFLAGS=$ac_previous_cppflags
 LDLFAGS=$ac_previous_ldflags

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzJ-0004Ne-H8; Fri, 06 Apr 2012 02:33: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 1SFyzI-0004Ky-88
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from [193.109.254.147:15528] by server-3.bemta-14.messagelabs.com id
	EC/65-23274-FE55E7F4; Fri, 06 Apr 2012 02:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1333679598!3486212!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2786 invoked from network); 6 Apr 2012 02:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzG-0003N6-0d
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0008Lo-VM
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Message-Id: <E1SFyzF-0008Lo-VM@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1333473956 -3600
# Node ID bef883ec33353d53f6b9d7b9c19901ec8da0e8dd
# Parent  b490ef93bad7b932942fb87f2f7bd96442cf3d03
QEMU_TAG update
---


diff -r b490ef93bad7 -r bef883ec3335 Config.mk
--- a/Config.mk	Wed Mar 14 17:53:56 2012 +0100
+++ b/Config.mk	Tue Apr 03 18:25:56 2012 +0100
@@ -216,9 +216,9 @@ CONFIG_SEABIOS ?= y
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= f0fad5549f8103fc0130d3121eb5f7913c5bc2a9
-# Mon Apr 2 17:55:05 2012 +0100
-# qemu-xen-traditional: QDISK fixes
+QEMU_TAG ?= 82db8de16530f016809264d3179823999d702849
+# Tue Apr 3 15:44:48 2012 +0100
+# timers: use INT64_MAX as max expiration
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02: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 1SFyzJ-0004Ne-H8; Fri, 06 Apr 2012 02:33: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 1SFyzI-0004Ky-88
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from [193.109.254.147:15528] by server-3.bemta-14.messagelabs.com id
	EC/65-23274-FE55E7F4; Fri, 06 Apr 2012 02:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1333679598!3486212!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2786 invoked from network); 6 Apr 2012 02:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzG-0003N6-0d
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0008Lo-VM
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Message-Id: <E1SFyzF-0008Lo-VM@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1333473956 -3600
# Node ID bef883ec33353d53f6b9d7b9c19901ec8da0e8dd
# Parent  b490ef93bad7b932942fb87f2f7bd96442cf3d03
QEMU_TAG update
---


diff -r b490ef93bad7 -r bef883ec3335 Config.mk
--- a/Config.mk	Wed Mar 14 17:53:56 2012 +0100
+++ b/Config.mk	Tue Apr 03 18:25:56 2012 +0100
@@ -216,9 +216,9 @@ CONFIG_SEABIOS ?= y
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= f0fad5549f8103fc0130d3121eb5f7913c5bc2a9
-# Mon Apr 2 17:55:05 2012 +0100
-# qemu-xen-traditional: QDISK fixes
+QEMU_TAG ?= 82db8de16530f016809264d3179823999d702849
+# Tue Apr 3 15:44:48 2012 +0100
+# timers: use INT64_MAX as max expiration
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzJ-0004Nl-KN; Fri, 06 Apr 2012 02:33:21 +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 1SFyzI-0004MH-86
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from [85.158.138.51:10979] by server-10.bemta-3.messagelabs.com id
	5E/B1-15637-FE55E7F4; Fri, 06 Apr 2012 02:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1333679596!10022860!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14093 invoked from network); 6 Apr 2012 02:33:17 -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;
	6 Apr 2012 02:33: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 1SFyzD-0003Mu-Q0
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzD-0008Kq-KM
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Message-Id: <E1SFyzD-0008Kq-KM@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: change
	AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1333472566 -3600
# Node ID 249b2eeeeae5576dd32748ea8ffa13e94d06eb20
# Parent  f454b0305a0ebe84f6cdab6b067040f9614dfd78
autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense

Change disable/enable feature macros to have a more significative name
of what they actually do, to avoid confusions.

New macros have the following names:

AX_ARG_DEFAULT_ENABLE: feature is enabled by default, provides the
--disable-{feature} option to disable it.

AX_ARG_DEFAULT_DISABLE: feature is disabled by default, provides the
--enable-{feature] option to enable it.

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


diff -r f454b0305a0e -r 249b2eeeeae5 config/Tools.mk.in
--- a/config/Tools.mk.in	Tue Apr 03 15:56:53 2012 +0100
+++ b/config/Tools.mk.in	Tue Apr 03 18:02:46 2012 +0100
@@ -31,7 +31,7 @@ GIT_HTTP            := @githttp@
 # Optional components
 XENSTAT_XENTOP      := @monitors@
 VTPM_TOOLS          := @vtpm@
-LIBXENAPI_BINDINGS  := @xapi@
+LIBXENAPI_BINDINGS  := @xenapi@
 PYTHON_TOOLS        := @pythontools@
 OCAML_TOOLS         := @ocamltools@
 CONFIG_MINITERM     := @miniterm@
diff -r f454b0305a0e -r 249b2eeeeae5 tools/configure
--- a/tools/configure	Tue Apr 03 15:56:53 2012 +0100
+++ b/tools/configure	Tue Apr 03 18:02:46 2012 +0100
@@ -650,7 +650,7 @@ lomount
 miniterm
 ocamltools
 pythontools
-xapi
+xenapi
 vtpm
 monitors
 githttp
@@ -716,7 +716,7 @@ enable_option_checking
 enable_githttp
 enable_monitors
 enable_vtpm
-enable_xapi
+enable_xenapi
 enable_pythontools
 enable_ocamltools
 enable_miniterm
@@ -1364,15 +1364,18 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-githttp        Download GIT repositories via HTTP
-  --disable-monitors      Disable xenstat and xentop monitoring tools
-  --enable-vtpm           Enable Virtual Trusted Platform Module
-  --enable-xapi           Enable Xen API Bindings
-  --disable-pythontools   Disable Python tools
-  --disable-ocamltools    Disable Ocaml tools
-  --enable-miniterm       Enable miniterm
-  --enable-lomount        Enable lomount
-  --disable-debug         Disable debug build of tools
+  --enable-githttp        Download GIT repositories via HTTP (default is
+                          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-pythontools   Disable Python tools (default is ENABLED)
+  --disable-ocamltools    Disable Ocaml tools (default is ENABLED)
+  --enable-miniterm       Enable miniterm (default is DISABLED)
+  --enable-lomount        Enable lomount (default is DISABLED)
+  --disable-debug         Disable debug build of tools (default is ENABLED)
 
 Some influential environment variables:
   CC          C compiler command
@@ -3844,6 +3847,8 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+
+
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 #
@@ -3909,27 +3914,30 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 # Enable/disable options
+
 # Check whether --enable-githttp was given.
 if test "${enable_githttp+set}" = set; then :
   enableval=$enable_githttp;
 fi
 
 
-if test "x$enable_githttp" = "xyes"; then :
+if test "x$enable_githttp" = "xno"; then :
+
+    ax_cv_githttp="n"
+
+elif test "x$enable_githttp" = "xyes"; then :
 
     ax_cv_githttp="y"
 
-elif test "x$enable_githttp" = "xno"; then :
+elif test -z $ax_cv_githttp; then :
 
     ax_cv_githttp="n"
 
-elif test -z $ax_cv_githttp; then :
-
-    ax_cv_githttp="n"
-
 fi
 githttp=$ax_cv_githttp
 
+
+
 # Check whether --enable-monitors was given.
 if test "${enable_monitors+set}" = set; then :
   enableval=$enable_monitors;
@@ -3951,47 +3959,53 @@ elif test -z $ax_cv_monitors; then :
 fi
 monitors=$ax_cv_monitors
 
+
+
 # Check whether --enable-vtpm was given.
 if test "${enable_vtpm+set}" = set; then :
   enableval=$enable_vtpm;
 fi
 
 
-if test "x$enable_vtpm" = "xyes"; then :
+if test "x$enable_vtpm" = "xno"; then :
+
+    ax_cv_vtpm="n"
+
+elif test "x$enable_vtpm" = "xyes"; then :
 
     ax_cv_vtpm="y"
 
-elif test "x$enable_vtpm" = "xno"; then :
+elif test -z $ax_cv_vtpm; then :
 
     ax_cv_vtpm="n"
 
-elif test -z $ax_cv_vtpm; then :
-
-    ax_cv_vtpm="n"
-
 fi
 vtpm=$ax_cv_vtpm
 
-# Check whether --enable-xapi was given.
-if test "${enable_xapi+set}" = set; then :
-  enableval=$enable_xapi;
-fi
-
-
-if test "x$enable_xapi" = "xyes"; then :
-
-    ax_cv_xapi="y"
-
-elif test "x$enable_xapi" = "xno"; then :
-
-    ax_cv_xapi="n"
-
-elif test -z $ax_cv_xapi; then :
-
-    ax_cv_xapi="n"
-
-fi
-xapi=$ax_cv_xapi
+
+
+# Check whether --enable-xenapi was given.
+if test "${enable_xenapi+set}" = set; then :
+  enableval=$enable_xenapi;
+fi
+
+
+if test "x$enable_xenapi" = "xno"; then :
+
+    ax_cv_xenapi="n"
+
+elif test "x$enable_xenapi" = "xyes"; then :
+
+    ax_cv_xenapi="y"
+
+elif test -z $ax_cv_xenapi; then :
+
+    ax_cv_xenapi="n"
+
+fi
+xenapi=$ax_cv_xenapi
+
+
 
 # Check whether --enable-pythontools was given.
 if test "${enable_pythontools+set}" = set; then :
@@ -4014,6 +4028,8 @@ elif test -z $ax_cv_pythontools; then :
 fi
 pythontools=$ax_cv_pythontools
 
+
+
 # Check whether --enable-ocamltools was given.
 if test "${enable_ocamltools+set}" = set; then :
   enableval=$enable_ocamltools;
@@ -4035,48 +4051,54 @@ elif test -z $ax_cv_ocamltools; then :
 fi
 ocamltools=$ax_cv_ocamltools
 
+
+
 # Check whether --enable-miniterm was given.
 if test "${enable_miniterm+set}" = set; then :
   enableval=$enable_miniterm;
 fi
 
 
-if test "x$enable_miniterm" = "xyes"; then :
+if test "x$enable_miniterm" = "xno"; then :
+
+    ax_cv_miniterm="n"
+
+elif test "x$enable_miniterm" = "xyes"; then :
 
     ax_cv_miniterm="y"
 
-elif test "x$enable_miniterm" = "xno"; then :
+elif test -z $ax_cv_miniterm; then :
 
     ax_cv_miniterm="n"
 
-elif test -z $ax_cv_miniterm; then :
-
-    ax_cv_miniterm="n"
-
 fi
 miniterm=$ax_cv_miniterm
 
+
+
 # Check whether --enable-lomount was given.
 if test "${enable_lomount+set}" = set; then :
   enableval=$enable_lomount;
 fi
 
 
-if test "x$enable_lomount" = "xyes"; then :
+if test "x$enable_lomount" = "xno"; then :
+
+    ax_cv_lomount="n"
+
+elif test "x$enable_lomount" = "xyes"; then :
 
     ax_cv_lomount="y"
 
-elif test "x$enable_lomount" = "xno"; then :
+elif test -z $ax_cv_lomount; then :
 
     ax_cv_lomount="n"
 
-elif test -z $ax_cv_lomount; then :
-
-    ax_cv_lomount="n"
-
 fi
 lomount=$ax_cv_lomount
 
+
+
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug;
@@ -4104,6 +4126,7 @@ debug=$ax_cv_debug
 
 
 
+
 for cflag in $PREPEND_INCLUDES
 do
     PREPEND_CFLAGS+=" -I$cflag"
diff -r f454b0305a0e -r 249b2eeeeae5 tools/configure.ac
--- a/tools/configure.ac	Tue Apr 03 15:56:53 2012 +0100
+++ b/tools/configure.ac	Tue Apr 03 18:02:46 2012 +0100
@@ -23,8 +23,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_CANONICAL_HOST
 
 # M4 Macro includes
-m4_include([m4/enable_feature.m4])
-m4_include([m4/disable_feature.m4])
+m4_include([m4/features.m4])
 m4_include([m4/path_or_fail.m4])
 m4_include([m4/python_version.m4])
 m4_include([m4/python_devel.m4])
@@ -36,16 +35,15 @@ m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
 
 # Enable/disable options
-AX_ARG_ENABLE_AND_EXPORT([githttp], [Download GIT repositories via HTTP])
-AX_ARG_DISABLE_AND_EXPORT([monitors],
-    [Disable xenstat and xentop monitoring tools])
-AX_ARG_ENABLE_AND_EXPORT([vtpm], [Enable Virtual Trusted Platform Module])
-AX_ARG_ENABLE_AND_EXPORT([xapi], [Enable Xen API Bindings])
-AX_ARG_DISABLE_AND_EXPORT([pythontools], [Disable Python tools])
-AX_ARG_DISABLE_AND_EXPORT([ocamltools], [Disable Ocaml tools])
-AX_ARG_ENABLE_AND_EXPORT([miniterm], [Enable miniterm])
-AX_ARG_ENABLE_AND_EXPORT([lomount], [Enable lomount])
-AX_ARG_DISABLE_AND_EXPORT([debug], [Disable debug build of tools])
+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([pythontools], [Disable Python tools])
+AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
+AX_ARG_DEFAULT_DISABLE([miniterm], [Enable miniterm])
+AX_ARG_DEFAULT_DISABLE([lomount], [Enable lomount])
+AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
diff -r f454b0305a0e -r 249b2eeeeae5 tools/m4/disable_feature.m4
--- a/tools/m4/disable_feature.m4	Tue Apr 03 15:56:53 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-AC_DEFUN([AX_ARG_DISABLE_AND_EXPORT],
-[AC_ARG_ENABLE([$1],
-    AS_HELP_STRING([--disable-$1], [$2]))
-
-AS_IF([test "x$enable_$1" = "xno"], [
-    ax_cv_$1="n"
-], [test "x$enable_$1" = "xyes"], [
-    ax_cv_$1="y"
-], [test -z $ax_cv_$1], [
-    ax_cv_$1="y"
-])
-$1=$ax_cv_$1
-AC_SUBST($1)])
diff -r f454b0305a0e -r 249b2eeeeae5 tools/m4/enable_feature.m4
--- a/tools/m4/enable_feature.m4	Tue Apr 03 15:56:53 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-AC_DEFUN([AX_ARG_ENABLE_AND_EXPORT],
-[AC_ARG_ENABLE([$1],
-    AS_HELP_STRING([--enable-$1], [$2]))
-
-AS_IF([test "x$enable_$1" = "xyes"], [
-    ax_cv_$1="y"
-], [test "x$enable_$1" = "xno"], [
-    ax_cv_$1="n"
-], [test -z $ax_cv_$1], [
-    ax_cv_$1="n"
-])
-$1=$ax_cv_$1
-AC_SUBST($1)])
diff -r f454b0305a0e -r 249b2eeeeae5 tools/m4/features.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/features.m4	Tue Apr 03 18:02:46 2012 +0100
@@ -0,0 +1,21 @@
+AC_DEFUN([AX_ARG_DEFAULT_ENABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [$2 (default is ENABLED)]))
+AX_PARSE_VALUE([$1], [y])
+])
+
+AC_DEFUN([AX_ARG_DEFAULT_DISABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1], [$2 (default is DISABLED)]))
+AX_PARSE_VALUE([$1], [n])
+])
+
+dnl This function should not be called outside of this file
+AC_DEFUN([AX_PARSE_VALUE], [
+AS_IF([test "x$enable_$1" = "xno"], [
+    ax_cv_$1="n"
+], [test "x$enable_$1" = "xyes"], [
+    ax_cv_$1="y"
+], [test -z $ax_cv_$1], [
+    ax_cv_$1="$2"
+])
+$1=$ax_cv_$1
+AC_SUBST($1)])

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzJ-0004Nl-KN; Fri, 06 Apr 2012 02:33:21 +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 1SFyzI-0004MH-86
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from [85.158.138.51:10979] by server-10.bemta-3.messagelabs.com id
	5E/B1-15637-FE55E7F4; Fri, 06 Apr 2012 02:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1333679596!10022860!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14093 invoked from network); 6 Apr 2012 02:33:17 -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;
	6 Apr 2012 02:33: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 1SFyzD-0003Mu-Q0
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzD-0008Kq-KM
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:15 +0000
Message-Id: <E1SFyzD-0008Kq-KM@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: change
	AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1333472566 -3600
# Node ID 249b2eeeeae5576dd32748ea8ffa13e94d06eb20
# Parent  f454b0305a0ebe84f6cdab6b067040f9614dfd78
autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense

Change disable/enable feature macros to have a more significative name
of what they actually do, to avoid confusions.

New macros have the following names:

AX_ARG_DEFAULT_ENABLE: feature is enabled by default, provides the
--disable-{feature} option to disable it.

AX_ARG_DEFAULT_DISABLE: feature is disabled by default, provides the
--enable-{feature] option to enable it.

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


diff -r f454b0305a0e -r 249b2eeeeae5 config/Tools.mk.in
--- a/config/Tools.mk.in	Tue Apr 03 15:56:53 2012 +0100
+++ b/config/Tools.mk.in	Tue Apr 03 18:02:46 2012 +0100
@@ -31,7 +31,7 @@ GIT_HTTP            := @githttp@
 # Optional components
 XENSTAT_XENTOP      := @monitors@
 VTPM_TOOLS          := @vtpm@
-LIBXENAPI_BINDINGS  := @xapi@
+LIBXENAPI_BINDINGS  := @xenapi@
 PYTHON_TOOLS        := @pythontools@
 OCAML_TOOLS         := @ocamltools@
 CONFIG_MINITERM     := @miniterm@
diff -r f454b0305a0e -r 249b2eeeeae5 tools/configure
--- a/tools/configure	Tue Apr 03 15:56:53 2012 +0100
+++ b/tools/configure	Tue Apr 03 18:02:46 2012 +0100
@@ -650,7 +650,7 @@ lomount
 miniterm
 ocamltools
 pythontools
-xapi
+xenapi
 vtpm
 monitors
 githttp
@@ -716,7 +716,7 @@ enable_option_checking
 enable_githttp
 enable_monitors
 enable_vtpm
-enable_xapi
+enable_xenapi
 enable_pythontools
 enable_ocamltools
 enable_miniterm
@@ -1364,15 +1364,18 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-githttp        Download GIT repositories via HTTP
-  --disable-monitors      Disable xenstat and xentop monitoring tools
-  --enable-vtpm           Enable Virtual Trusted Platform Module
-  --enable-xapi           Enable Xen API Bindings
-  --disable-pythontools   Disable Python tools
-  --disable-ocamltools    Disable Ocaml tools
-  --enable-miniterm       Enable miniterm
-  --enable-lomount        Enable lomount
-  --disable-debug         Disable debug build of tools
+  --enable-githttp        Download GIT repositories via HTTP (default is
+                          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-pythontools   Disable Python tools (default is ENABLED)
+  --disable-ocamltools    Disable Ocaml tools (default is ENABLED)
+  --enable-miniterm       Enable miniterm (default is DISABLED)
+  --enable-lomount        Enable lomount (default is DISABLED)
+  --disable-debug         Disable debug build of tools (default is ENABLED)
 
 Some influential environment variables:
   CC          C compiler command
@@ -3844,6 +3847,8 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+
+
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 #
@@ -3909,27 +3914,30 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 # Enable/disable options
+
 # Check whether --enable-githttp was given.
 if test "${enable_githttp+set}" = set; then :
   enableval=$enable_githttp;
 fi
 
 
-if test "x$enable_githttp" = "xyes"; then :
+if test "x$enable_githttp" = "xno"; then :
+
+    ax_cv_githttp="n"
+
+elif test "x$enable_githttp" = "xyes"; then :
 
     ax_cv_githttp="y"
 
-elif test "x$enable_githttp" = "xno"; then :
+elif test -z $ax_cv_githttp; then :
 
     ax_cv_githttp="n"
 
-elif test -z $ax_cv_githttp; then :
-
-    ax_cv_githttp="n"
-
 fi
 githttp=$ax_cv_githttp
 
+
+
 # Check whether --enable-monitors was given.
 if test "${enable_monitors+set}" = set; then :
   enableval=$enable_monitors;
@@ -3951,47 +3959,53 @@ elif test -z $ax_cv_monitors; then :
 fi
 monitors=$ax_cv_monitors
 
+
+
 # Check whether --enable-vtpm was given.
 if test "${enable_vtpm+set}" = set; then :
   enableval=$enable_vtpm;
 fi
 
 
-if test "x$enable_vtpm" = "xyes"; then :
+if test "x$enable_vtpm" = "xno"; then :
+
+    ax_cv_vtpm="n"
+
+elif test "x$enable_vtpm" = "xyes"; then :
 
     ax_cv_vtpm="y"
 
-elif test "x$enable_vtpm" = "xno"; then :
+elif test -z $ax_cv_vtpm; then :
 
     ax_cv_vtpm="n"
 
-elif test -z $ax_cv_vtpm; then :
-
-    ax_cv_vtpm="n"
-
 fi
 vtpm=$ax_cv_vtpm
 
-# Check whether --enable-xapi was given.
-if test "${enable_xapi+set}" = set; then :
-  enableval=$enable_xapi;
-fi
-
-
-if test "x$enable_xapi" = "xyes"; then :
-
-    ax_cv_xapi="y"
-
-elif test "x$enable_xapi" = "xno"; then :
-
-    ax_cv_xapi="n"
-
-elif test -z $ax_cv_xapi; then :
-
-    ax_cv_xapi="n"
-
-fi
-xapi=$ax_cv_xapi
+
+
+# Check whether --enable-xenapi was given.
+if test "${enable_xenapi+set}" = set; then :
+  enableval=$enable_xenapi;
+fi
+
+
+if test "x$enable_xenapi" = "xno"; then :
+
+    ax_cv_xenapi="n"
+
+elif test "x$enable_xenapi" = "xyes"; then :
+
+    ax_cv_xenapi="y"
+
+elif test -z $ax_cv_xenapi; then :
+
+    ax_cv_xenapi="n"
+
+fi
+xenapi=$ax_cv_xenapi
+
+
 
 # Check whether --enable-pythontools was given.
 if test "${enable_pythontools+set}" = set; then :
@@ -4014,6 +4028,8 @@ elif test -z $ax_cv_pythontools; then :
 fi
 pythontools=$ax_cv_pythontools
 
+
+
 # Check whether --enable-ocamltools was given.
 if test "${enable_ocamltools+set}" = set; then :
   enableval=$enable_ocamltools;
@@ -4035,48 +4051,54 @@ elif test -z $ax_cv_ocamltools; then :
 fi
 ocamltools=$ax_cv_ocamltools
 
+
+
 # Check whether --enable-miniterm was given.
 if test "${enable_miniterm+set}" = set; then :
   enableval=$enable_miniterm;
 fi
 
 
-if test "x$enable_miniterm" = "xyes"; then :
+if test "x$enable_miniterm" = "xno"; then :
+
+    ax_cv_miniterm="n"
+
+elif test "x$enable_miniterm" = "xyes"; then :
 
     ax_cv_miniterm="y"
 
-elif test "x$enable_miniterm" = "xno"; then :
+elif test -z $ax_cv_miniterm; then :
 
     ax_cv_miniterm="n"
 
-elif test -z $ax_cv_miniterm; then :
-
-    ax_cv_miniterm="n"
-
 fi
 miniterm=$ax_cv_miniterm
 
+
+
 # Check whether --enable-lomount was given.
 if test "${enable_lomount+set}" = set; then :
   enableval=$enable_lomount;
 fi
 
 
-if test "x$enable_lomount" = "xyes"; then :
+if test "x$enable_lomount" = "xno"; then :
+
+    ax_cv_lomount="n"
+
+elif test "x$enable_lomount" = "xyes"; then :
 
     ax_cv_lomount="y"
 
-elif test "x$enable_lomount" = "xno"; then :
+elif test -z $ax_cv_lomount; then :
 
     ax_cv_lomount="n"
 
-elif test -z $ax_cv_lomount; then :
-
-    ax_cv_lomount="n"
-
 fi
 lomount=$ax_cv_lomount
 
+
+
 # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then :
   enableval=$enable_debug;
@@ -4104,6 +4126,7 @@ debug=$ax_cv_debug
 
 
 
+
 for cflag in $PREPEND_INCLUDES
 do
     PREPEND_CFLAGS+=" -I$cflag"
diff -r f454b0305a0e -r 249b2eeeeae5 tools/configure.ac
--- a/tools/configure.ac	Tue Apr 03 15:56:53 2012 +0100
+++ b/tools/configure.ac	Tue Apr 03 18:02:46 2012 +0100
@@ -23,8 +23,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_CANONICAL_HOST
 
 # M4 Macro includes
-m4_include([m4/enable_feature.m4])
-m4_include([m4/disable_feature.m4])
+m4_include([m4/features.m4])
 m4_include([m4/path_or_fail.m4])
 m4_include([m4/python_version.m4])
 m4_include([m4/python_devel.m4])
@@ -36,16 +35,15 @@ m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
 
 # Enable/disable options
-AX_ARG_ENABLE_AND_EXPORT([githttp], [Download GIT repositories via HTTP])
-AX_ARG_DISABLE_AND_EXPORT([monitors],
-    [Disable xenstat and xentop monitoring tools])
-AX_ARG_ENABLE_AND_EXPORT([vtpm], [Enable Virtual Trusted Platform Module])
-AX_ARG_ENABLE_AND_EXPORT([xapi], [Enable Xen API Bindings])
-AX_ARG_DISABLE_AND_EXPORT([pythontools], [Disable Python tools])
-AX_ARG_DISABLE_AND_EXPORT([ocamltools], [Disable Ocaml tools])
-AX_ARG_ENABLE_AND_EXPORT([miniterm], [Enable miniterm])
-AX_ARG_ENABLE_AND_EXPORT([lomount], [Enable lomount])
-AX_ARG_DISABLE_AND_EXPORT([debug], [Disable debug build of tools])
+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([pythontools], [Disable Python tools])
+AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
+AX_ARG_DEFAULT_DISABLE([miniterm], [Enable miniterm])
+AX_ARG_DEFAULT_DISABLE([lomount], [Enable lomount])
+AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
diff -r f454b0305a0e -r 249b2eeeeae5 tools/m4/disable_feature.m4
--- a/tools/m4/disable_feature.m4	Tue Apr 03 15:56:53 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-AC_DEFUN([AX_ARG_DISABLE_AND_EXPORT],
-[AC_ARG_ENABLE([$1],
-    AS_HELP_STRING([--disable-$1], [$2]))
-
-AS_IF([test "x$enable_$1" = "xno"], [
-    ax_cv_$1="n"
-], [test "x$enable_$1" = "xyes"], [
-    ax_cv_$1="y"
-], [test -z $ax_cv_$1], [
-    ax_cv_$1="y"
-])
-$1=$ax_cv_$1
-AC_SUBST($1)])
diff -r f454b0305a0e -r 249b2eeeeae5 tools/m4/enable_feature.m4
--- a/tools/m4/enable_feature.m4	Tue Apr 03 15:56:53 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-AC_DEFUN([AX_ARG_ENABLE_AND_EXPORT],
-[AC_ARG_ENABLE([$1],
-    AS_HELP_STRING([--enable-$1], [$2]))
-
-AS_IF([test "x$enable_$1" = "xyes"], [
-    ax_cv_$1="y"
-], [test "x$enable_$1" = "xno"], [
-    ax_cv_$1="n"
-], [test -z $ax_cv_$1], [
-    ax_cv_$1="n"
-])
-$1=$ax_cv_$1
-AC_SUBST($1)])
diff -r f454b0305a0e -r 249b2eeeeae5 tools/m4/features.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/features.m4	Tue Apr 03 18:02:46 2012 +0100
@@ -0,0 +1,21 @@
+AC_DEFUN([AX_ARG_DEFAULT_ENABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [$2 (default is ENABLED)]))
+AX_PARSE_VALUE([$1], [y])
+])
+
+AC_DEFUN([AX_ARG_DEFAULT_DISABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1], [$2 (default is DISABLED)]))
+AX_PARSE_VALUE([$1], [n])
+])
+
+dnl This function should not be called outside of this file
+AC_DEFUN([AX_PARSE_VALUE], [
+AS_IF([test "x$enable_$1" = "xno"], [
+    ax_cv_$1="n"
+], [test "x$enable_$1" = "xyes"], [
+    ax_cv_$1="y"
+], [test -z $ax_cv_$1], [
+    ax_cv_$1="$2"
+])
+$1=$ax_cv_$1
+AC_SUBST($1)])

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzJ-0004NY-Ei; Fri, 06 Apr 2012 02:33: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 1SFyzI-0004Kd-3o
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from [85.158.143.99:32630] by server-3.bemta-4.messagelabs.com id
	BA/97-05853-FE55E7F4; Fri, 06 Apr 2012 02:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1333679597!22026753!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6124 invoked from network); 6 Apr 2012 02:33: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;
	6 Apr 2012 02:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0003N0-1H
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzE-0008LK-Qo
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Message-Id: <E1SFyzE-0008LK-Qo@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/blktap: reorder MEMSHR_DIR to
	fix CFLAGS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1331740943 -3600
# Node ID 061ef27b6569828c51849b5a63d4f4e311895825
# Parent  b0356d31076a45422a121915c69651093f491c78
tools/blktap: reorder MEMSHR_DIR to fix CFLAGS

In blktap2 MEMSHR_DIR is used before it is set. This removes the
required -D_GNU_SOURCE from CFLAGS, its used as option for -I
Fix this by moving memshr related flags to the place where its actually
used.
The failure is a missing O_DIRECT define.

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


diff -r b0356d31076a -r 061ef27b6569 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile	Tue Apr 03 18:15:11 2012 +0100
+++ b/tools/blktap/drivers/Makefile	Wed Mar 14 17:02:23 2012 +0100
@@ -3,14 +3,12 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 IBIN         = blktapctrl tapdisk
 QCOW_UTIL    = img2qcow qcow2raw qcow-create
-MEMSHR_DIR   = ../../memshr
 
 CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 CFLAGS   += -I../lib
 CFLAGS   += $(CFLAGS_libxenctrl)
 CFLAGS   += $(CFLAGS_libxenstore)
-CFLAGS   += -I $(MEMSHR_DIR)
 CFLAGS   += -D_GNU_SOURCE
 
 ifeq ($CONFIG_GCRYPT,y)
@@ -23,7 +21,9 @@ endif
 
 MEMSHRLIBS :=
 ifeq ($(CONFIG_Linux), y)
+MEMSHR_DIR   = ../../memshr
 CFLAGS += -DMEMSHR
+CFLAGS += -I $(MEMSHR_DIR)
 MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a
 endif
 
diff -r b0356d31076a -r 061ef27b6569 tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile	Tue Apr 03 18:15:11 2012 +0100
+++ b/tools/blktap2/drivers/Makefile	Wed Mar 14 17:02:23 2012 +0100
@@ -14,7 +14,6 @@ CFLAGS    += -Wno-unused
 CFLAGS    += -fno-strict-aliasing
 CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
 CFLAGS    += $(CFLAGS_libxenctrl)
-CFLAGS    += -I $(MEMSHR_DIR)
 CFLAGS    += -D_GNU_SOURCE
 CFLAGS    += -DUSE_NFS_LOCKS
 
@@ -38,11 +37,11 @@ else
 tapdisk2 tapdisk-stream tapdisk-diff $(QCOW_UTIL): AIOLIBS := -laio
 endif
 
-MEMSHR_DIR = $(XEN_ROOT)/tools/memshr
-
 MEMSHRLIBS :=
 ifeq ($(CONFIG_Linux), __fixme__)
+MEMSHR_DIR = $(XEN_ROOT)/tools/memshr
 CFLAGS += -DMEMSHR
+CFLAGS += -I $(MEMSHR_DIR)
 MEMSHRLIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl $(MEMSHR_DIR)/libmemshr.a
 endif
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzJ-0004NY-Ei; Fri, 06 Apr 2012 02:33: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 1SFyzI-0004Kd-3o
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from [85.158.143.99:32630] by server-3.bemta-4.messagelabs.com id
	BA/97-05853-FE55E7F4; Fri, 06 Apr 2012 02:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1333679597!22026753!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6124 invoked from network); 6 Apr 2012 02:33: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;
	6 Apr 2012 02:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0003N0-1H
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzE-0008LK-Qo
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:16 +0000
Message-Id: <E1SFyzE-0008LK-Qo@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/blktap: reorder MEMSHR_DIR to
	fix CFLAGS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1331740943 -3600
# Node ID 061ef27b6569828c51849b5a63d4f4e311895825
# Parent  b0356d31076a45422a121915c69651093f491c78
tools/blktap: reorder MEMSHR_DIR to fix CFLAGS

In blktap2 MEMSHR_DIR is used before it is set. This removes the
required -D_GNU_SOURCE from CFLAGS, its used as option for -I
Fix this by moving memshr related flags to the place where its actually
used.
The failure is a missing O_DIRECT define.

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


diff -r b0356d31076a -r 061ef27b6569 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile	Tue Apr 03 18:15:11 2012 +0100
+++ b/tools/blktap/drivers/Makefile	Wed Mar 14 17:02:23 2012 +0100
@@ -3,14 +3,12 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 IBIN         = blktapctrl tapdisk
 QCOW_UTIL    = img2qcow qcow2raw qcow-create
-MEMSHR_DIR   = ../../memshr
 
 CFLAGS   += -Werror
 CFLAGS   += -Wno-unused
 CFLAGS   += -I../lib
 CFLAGS   += $(CFLAGS_libxenctrl)
 CFLAGS   += $(CFLAGS_libxenstore)
-CFLAGS   += -I $(MEMSHR_DIR)
 CFLAGS   += -D_GNU_SOURCE
 
 ifeq ($CONFIG_GCRYPT,y)
@@ -23,7 +21,9 @@ endif
 
 MEMSHRLIBS :=
 ifeq ($(CONFIG_Linux), y)
+MEMSHR_DIR   = ../../memshr
 CFLAGS += -DMEMSHR
+CFLAGS += -I $(MEMSHR_DIR)
 MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a
 endif
 
diff -r b0356d31076a -r 061ef27b6569 tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile	Tue Apr 03 18:15:11 2012 +0100
+++ b/tools/blktap2/drivers/Makefile	Wed Mar 14 17:02:23 2012 +0100
@@ -14,7 +14,6 @@ CFLAGS    += -Wno-unused
 CFLAGS    += -fno-strict-aliasing
 CFLAGS    += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers
 CFLAGS    += $(CFLAGS_libxenctrl)
-CFLAGS    += -I $(MEMSHR_DIR)
 CFLAGS    += -D_GNU_SOURCE
 CFLAGS    += -DUSE_NFS_LOCKS
 
@@ -38,11 +37,11 @@ else
 tapdisk2 tapdisk-stream tapdisk-diff $(QCOW_UTIL): AIOLIBS := -laio
 endif
 
-MEMSHR_DIR = $(XEN_ROOT)/tools/memshr
-
 MEMSHRLIBS :=
 ifeq ($(CONFIG_Linux), __fixme__)
+MEMSHR_DIR = $(XEN_ROOT)/tools/memshr
 CFLAGS += -DMEMSHR
+CFLAGS += -I $(MEMSHR_DIR)
 MEMSHRLIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl $(MEMSHR_DIR)/libmemshr.a
 endif
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzL-0004Qq-SB; Fri, 06 Apr 2012 02:33: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 1SFyzK-0004O1-D5
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Received: from [85.158.138.51:50549] by server-1.bemta-3.messagelabs.com id
	4B/17-04539-1F55E7F4; Fri, 06 Apr 2012 02:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1333679599!21013295!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6161 invoked from network); 6 Apr 2012 02:33:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzG-0003N9-IH
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzG-0008M3-GZ
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Message-Id: <E1SFyzG-0008M3-GZ@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PV-GRUB: Check for errors when
	applying patches to GRUB
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Matt Wilson <msw@amazon.com>
# Date 1333534154 -3600
# Node ID 1fa1ba79759ac934f03caf974b79fe6d4acca00f
# Parent  bef883ec33353d53f6b9d7b9c19901ec8da0e8dd
PV-GRUB: Check for errors when applying patches to GRUB

We want to ensure that patches apply cleanly without rejects. Bail if
patch returns a non-zero exit code.

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


diff -r bef883ec3335 -r 1fa1ba79759a stubdom/Makefile
--- a/stubdom/Makefile	Tue Apr 03 18:25:56 2012 +0100
+++ b/stubdom/Makefile	Wed Apr 04 11:09:14 2012 +0100
@@ -331,7 +331,7 @@ grub-upstream: grub-$(GRUB_VERSION).tar.
 	tar xzf $<
 	mv grub-$(GRUB_VERSION) $@
 	for i in grub.patches/* ; do \
-		patch -d $@ -p1 < $$i ; \
+		patch -d $@ -p1 < $$i || exit 1; \
 	done
 
 .PHONY: grub

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzL-0004Qk-Ph; Fri, 06 Apr 2012 02:33:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0004NX-W4
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Received: from [85.158.139.83:64106] by server-4.bemta-5.messagelabs.com id
	58/1F-10788-1F55E7F4; Fri, 06 Apr 2012 02:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1333679598!18437171!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11764 invoked from network); 6 Apr 2012 02:33:19 -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;
	6 Apr 2012 02:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0003N3-JL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0008LZ-EC
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Message-Id: <E1SFyzF-0008LZ-EC@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libfsimage: include Rules.mk
	first
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1331744036 -3600
# Node ID b490ef93bad7b932942fb87f2f7bd96442cf3d03
# Parent  061ef27b6569828c51849b5a63d4f4e311895825
tools/libfsimage: include Rules.mk first

Move the inclusion of Rules.mk up so that things like CFLAGS get initialized
properly. Currently only zfs appends CFLAGS. If CFLAGS get reset by Rules.mk
the private settings are lost and compilation of zfs support fails.

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


diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = ext2fs-lib.c
 
@@ -11,5 +12,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/ext2fs/Makefile
--- a/tools/libfsimage/ext2fs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/ext2fs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ext2fs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/fat/Makefile
--- a/tools/libfsimage/fat/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/fat/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_fat.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/iso9660/Makefile
--- a/tools/libfsimage/iso9660/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/iso9660/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_iso9660.c
 
@@ -11,5 +12,3 @@ all: fs-all
 install: fs-install
 
 fsys_iso9660.c: iso9660.h
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/reiserfs/Makefile
--- a/tools/libfsimage/reiserfs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/reiserfs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_reiserfs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/ufs/Makefile
--- a/tools/libfsimage/ufs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/ufs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ufs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/xfs/Makefile
--- a/tools/libfsimage/xfs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/xfs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_xfs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/zfs/Makefile
--- a/tools/libfsimage/zfs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/zfs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -23,6 +23,7 @@
 #
 
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 CFLAGS += -DFSYS_ZFS -DFSIMAGE -I$(XEN_ROOT)/tools/libfsimage/zfs
 LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
@@ -34,5 +35,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzL-0004Qk-Ph; Fri, 06 Apr 2012 02:33:23 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0004NX-W4
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Received: from [85.158.139.83:64106] by server-4.bemta-5.messagelabs.com id
	58/1F-10788-1F55E7F4; Fri, 06 Apr 2012 02:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1333679598!18437171!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11764 invoked from network); 6 Apr 2012 02:33:19 -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;
	6 Apr 2012 02:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0003N3-JL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzF-0008LZ-EC
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:17 +0000
Message-Id: <E1SFyzF-0008LZ-EC@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libfsimage: include Rules.mk
	first
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1331744036 -3600
# Node ID b490ef93bad7b932942fb87f2f7bd96442cf3d03
# Parent  061ef27b6569828c51849b5a63d4f4e311895825
tools/libfsimage: include Rules.mk first

Move the inclusion of Rules.mk up so that things like CFLAGS get initialized
properly. Currently only zfs appends CFLAGS. If CFLAGS get reset by Rules.mk
the private settings are lost and compilation of zfs support fails.

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


diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = ext2fs-lib.c
 
@@ -11,5 +12,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/ext2fs/Makefile
--- a/tools/libfsimage/ext2fs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/ext2fs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ext2fs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/fat/Makefile
--- a/tools/libfsimage/fat/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/fat/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_fat.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/iso9660/Makefile
--- a/tools/libfsimage/iso9660/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/iso9660/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_iso9660.c
 
@@ -11,5 +12,3 @@ all: fs-all
 install: fs-install
 
 fsys_iso9660.c: iso9660.h
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/reiserfs/Makefile
--- a/tools/libfsimage/reiserfs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/reiserfs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_reiserfs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/ufs/Makefile
--- a/tools/libfsimage/ufs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/ufs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ufs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/xfs/Makefile
--- a/tools/libfsimage/xfs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/xfs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -1,4 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_xfs.c
 
@@ -9,5 +10,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r 061ef27b6569 -r b490ef93bad7 tools/libfsimage/zfs/Makefile
--- a/tools/libfsimage/zfs/Makefile	Wed Mar 14 17:02:23 2012 +0100
+++ b/tools/libfsimage/zfs/Makefile	Wed Mar 14 17:53:56 2012 +0100
@@ -23,6 +23,7 @@
 #
 
 XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 CFLAGS += -DFSYS_ZFS -DFSIMAGE -I$(XEN_ROOT)/tools/libfsimage/zfs
 LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
@@ -34,5 +35,3 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
-
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzL-0004Qq-SB; Fri, 06 Apr 2012 02:33: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 1SFyzK-0004O1-D5
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Received: from [85.158.138.51:50549] by server-1.bemta-3.messagelabs.com id
	4B/17-04539-1F55E7F4; Fri, 06 Apr 2012 02:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1333679599!21013295!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6161 invoked from network); 6 Apr 2012 02:33:20 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzG-0003N9-IH
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzG-0008M3-GZ
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:18 +0000
Message-Id: <E1SFyzG-0008M3-GZ@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PV-GRUB: Check for errors when
	applying patches to GRUB
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Matt Wilson <msw@amazon.com>
# Date 1333534154 -3600
# Node ID 1fa1ba79759ac934f03caf974b79fe6d4acca00f
# Parent  bef883ec33353d53f6b9d7b9c19901ec8da0e8dd
PV-GRUB: Check for errors when applying patches to GRUB

We want to ensure that patches apply cleanly without rejects. Bail if
patch returns a non-zero exit code.

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


diff -r bef883ec3335 -r 1fa1ba79759a stubdom/Makefile
--- a/stubdom/Makefile	Tue Apr 03 18:25:56 2012 +0100
+++ b/stubdom/Makefile	Wed Apr 04 11:09:14 2012 +0100
@@ -331,7 +331,7 @@ grub-upstream: grub-$(GRUB_VERSION).tar.
 	tar xzf $<
 	mv grub-$(GRUB_VERSION) $@
 	for i in grub.patches/* ; do \
-		patch -d $@ -p1 < $$i ; \
+		patch -d $@ -p1 < $$i || exit 1; \
 	done
 
 .PHONY: grub

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzM-0004Rz-Ux; Fri, 06 Apr 2012 02:33:24 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0004Q8-L0
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [85.158.143.99:18478] by server-1.bemta-4.messagelabs.com id
	F6/63-20925-2F55E7F4; Fri, 06 Apr 2012 02:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1333679599!22259165!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17071 invoked from network); 6 Apr 2012 02:33:20 -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;
	6 Apr 2012 02:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0003NC-4u
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0008MI-2b
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Message-Id: <E1SFyzH-0008MI-2b@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PV-GRUB: add support for ext4
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Matt Wilson <msw@amazon.com>
# Date 1333534154 -3600
# Node ID d1c985425e7841891ec1e3c0d4dc224be7b8d3cc
# Parent  1fa1ba79759ac934f03caf974b79fe6d4acca00f
PV-GRUB: add support for ext4

This patch adds support for ext4 to the GRUB tree used to build PV-GRUB.
The original patch is taken from the Fedora GRUB package in this commit:
http://pkgs.fedoraproject.org/gitweb/?p=grub.git;a=commitdiff;h=32bf414af04d377055957167aac7dedec691ef57

Signed-off-by: Matt Wilson <msw@amazon.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1fa1ba79759a -r d1c985425e78 stubdom/grub.patches/60ext4.diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/grub.patches/60ext4.diff	Wed Apr 04 11:09:14 2012 +0100
@@ -0,0 +1,474 @@
+Index: grub-0.97/stage2/fsys_ext2fs.c
+===================================================================
+--- grub-0.97.orig/stage2/fsys_ext2fs.c
++++ grub-0.97/stage2/fsys_ext2fs.c
+@@ -41,6 +41,7 @@ typedef __signed__ short __s16;
+ typedef unsigned short __u16;
+ typedef __signed__ int __s32;
+ typedef unsigned int __u32;
++typedef unsigned long long __u64;
+ 
+ /*
+  * Constants relative to the data blocks, from ext2_fs.h
+@@ -51,7 +52,7 @@ typedef unsigned int __u32;
+ #define EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
+ #define EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
+ 
+-/* include/linux/ext2_fs.h */
++/* lib/ext2fs/ext2_fs.h from e2fsprogs */
+ struct ext2_super_block
+   {
+     __u32 s_inodes_count;	/* Inodes count */
+@@ -61,9 +62,9 @@ struct ext2_super_block
+     __u32 s_free_inodes_count;	/* Free inodes count */
+     __u32 s_first_data_block;	/* First Data Block */
+     __u32 s_log_block_size;	/* Block size */
+-    __s32 s_log_frag_size;	/* Fragment size */
++    __s32 s_obso_log_frag_size;	/* Obsoleted Fragment size */
+     __u32 s_blocks_per_group;	/* # Blocks per group */
+-    __u32 s_frags_per_group;	/* # Fragments per group */
++    __u32 s_obso_frags_per_group;	/* Obsoleted Fragments per group */
+     __u32 s_inodes_per_group;	/* # Inodes per group */
+     __u32 s_mtime;		/* Mount time */
+     __u32 s_wtime;		/* Write time */
+@@ -72,7 +73,7 @@ struct ext2_super_block
+     __u16 s_magic;		/* Magic signature */
+     __u16 s_state;		/* File system state */
+     __u16 s_errors;		/* Behaviour when detecting errors */
+-    __u16 s_pad;
++    __u16 s_minor_rev_level;	/* minor revision level */
+     __u32 s_lastcheck;		/* time of last check */
+     __u32 s_checkinterval;	/* max. time between checks */
+     __u32 s_creator_os;		/* OS */
+@@ -119,15 +120,29 @@ struct ext2_super_block
+     __u32 s_hash_seed[4];	/* HTREE hash seed */
+     __u8  s_def_hash_version;	/* Default hash version to use */
+     __u8  s_jnl_backup_type; 	/* Default type of journal backup */
+-    __u16 s_reserved_word_pad;
++    __u16 s_desc_size;		/* size of group descriptor */
+     __u32 s_default_mount_opts;
+     __u32 s_first_meta_bg;	/* First metablock group */
+     __u32 s_mkfs_time;		/* When the filesystem was created */
+     __u32 s_jnl_blocks[17]; 	/* Backup of the journal inode */
+-    __u32 s_reserved[172];	/* Padding to the end of the block */
+-  };
++    /* 64bit desc support valid if EXT4_FEATURE_INCOMPAT_64BIT */
++    __u32 s_blocks_count_hi;	/* Blocks count */
++    __u32 s_r_blocks_count_hi;	/* Reserved blocks count */
++    __u32 s_free_blocks_count_hi; /* Free blocks count */
++    __u16 s_min_extra_isize;	/* All inodes have at least # bytes */
++    __u16 s_max_extra_isize;	/* New inodes should reverve # bytes */
++    __u32 s_flags;		/* Miscellaneous flags */
++    __u16 s_raid_stride;	/* Raid stride */
++    __u16 s_mmp_interval;	/* # seconds to wait MMP checking */
++    __u64 s_mmp_block;		/* Block for multi-mount protection */
++    __u32 s_raid_stripe_width;	/* Blocks on all data disks (N*stride)*/
++    __u8  s_log_groups_per_flex;/* FLEX_BG group size*/
++    __u8  s_reserved_char_pad;
++    __u16 s_reserved_pad;
++    __u32 s_reserved[162];	/* Padding to the end of the block */
++};
+ 
+-struct ext2_group_desc
++struct ext4_group_desc
+   {
+     __u32 bg_block_bitmap;	/* Blocks bitmap block */
+     __u32 bg_inode_bitmap;	/* Inodes bitmap block */
+@@ -135,8 +150,18 @@ struct ext2_group_desc
+     __u16 bg_free_blocks_count;	/* Free blocks count */
+     __u16 bg_free_inodes_count;	/* Free inodes count */
+     __u16 bg_used_dirs_count;	/* Directories count */
+-    __u16 bg_pad;
+-    __u32 bg_reserved[3];
++    __u16 bg_flags;		/* EXT4_BG_flags (INODE_UNINIT, etc) */
++    __u32 bg_reserved[2];		/* Likely block/inode bitmap checksum */
++    __u16 bg_itable_unused;	/* Unused inodes count */
++    __u16 bg_checksum;		/* crc16(sb_uuid+group+desc) */
++    __u32 bg_block_bitmap_hi;	/* Blocks bitmap block MSB */
++    __u32 bg_inode_bitmap_hi;	/* Inodes bitmap block MSB */
++    __u32 bg_inode_table_hi;	/* Inodes table block MSB */
++    __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */
++    __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */
++    __u16 bg_used_dirs_count_hi;	/* Directories count MSB */
++    __u16 bg_itable_unused_hi;	/* Unused inodes count MSB */
++    __u32 bg_reserved2[3];
+   };
+ 
+ struct ext2_inode
+@@ -174,22 +199,22 @@ struct ext2_inode
+     __u32 i_block[EXT2_N_BLOCKS];	/* 40: Pointers to blocks */
+     __u32 i_version;		/* File version (for NFS) */
+     __u32 i_file_acl;		/* File ACL */
+-    __u32 i_dir_acl;		/* Directory ACL */
+-    __u32 i_faddr;		/* Fragment address */
++    __u32 i_size_high;
++    __u32 i_obso_faddr;		/* Obsoleted fragment address */
+     union
+       {
+ 	struct
+ 	  {
+-	    __u8 l_i_frag;	/* Fragment number */
+-	    __u8 l_i_fsize;	/* Fragment size */
+-	    __u16 i_pad1;
+-	    __u32 l_i_reserved2[2];
++		__u16	l_i_blocks_high; /* were l_i_reserved1 */
++		__u16	l_i_file_acl_high;
++		__u16	l_i_uid_high;	/* these 2 fields */
++		__u16	l_i_gid_high;	/* were reserved2[0] */
++		__u32	l_i_reserved2;
+ 	  }
+ 	linux2;
+ 	struct
+ 	  {
+-	    __u8 h_i_frag;	/* Fragment number */
+-	    __u8 h_i_fsize;	/* Fragment size */
++		__u16	h_i_reserved1;	/* Obsoleted fragment number/size which are removed in ext4 */
+ 	    __u16 h_i_mode_high;
+ 	    __u16 h_i_uid_high;
+ 	    __u16 h_i_gid_high;
+@@ -198,16 +223,36 @@ struct ext2_inode
+ 	hurd2;
+ 	struct
+ 	  {
+-	    __u8 m_i_frag;	/* Fragment number */
+-	    __u8 m_i_fsize;	/* Fragment size */
+-	    __u16 m_pad1;
++		__u16	h_i_reserved1;	/* Obsoleted fragment number/size which are removed in ext4 */
++		__u16	m_i_file_acl_high;
+ 	    __u32 m_i_reserved2[2];
+ 	  }
+ 	masix2;
+       }
+     osd2;			/* OS dependent 2 */
++	__u16	i_extra_isize;
++	__u16	i_pad1;
++	__u32  i_ctime_extra;  /* extra Change time      (nsec << 2 | epoch) */
++	__u32  i_mtime_extra;  /* extra Modification time(nsec << 2 | epoch) */
++	__u32  i_atime_extra;  /* extra Access time      (nsec << 2 | epoch) */
++	__u32  i_crtime;       /* File Creation time */
++	__u32  i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
++	__u32  i_version_hi;	/* high 32 bits for 64-bit version */
+   };
+ 
++#define EXT4_FEATURE_INCOMPAT_EXTENTS		0x0040 /* extents support */
++#define EXT4_FEATURE_INCOMPAT_64BIT			0x0080 /* grub not supported*/
++#define EXT4_FEATURE_INCOMPAT_MMP           0x0100
++#define EXT4_FEATURE_INCOMPAT_FLEX_BG		0x0200
++
++#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask)			\
++	( sb->s_feature_incompat & mask )
++
++#define EXT4_EXTENTS_FL		0x00080000 /* Inode uses extents */
++#define EXT4_HUGE_FILE_FL	0x00040000 /* Set to each huge file */
++
++#define EXT4_MIN_DESC_SIZE			32
++
+ /* linux/limits.h */
+ #define NAME_MAX         255	/* # chars in a file name */
+ 
+@@ -225,6 +270,57 @@ struct ext2_dir_entry
+     char name[EXT2_NAME_LEN];	/* File name */
+   };
+ 
++/* linux/ext4_fs_extents.h */
++/* This is the extent on-disk structure.
++ * It's used at the bottom of the tree.
++ */
++struct ext4_extent
++  {
++	__u32  ee_block;   /* first logical block extent covers */
++	__u16  ee_len;     /* number of blocks covered by extent */
++	__u16  ee_start_hi;    /* high 16 bits of physical block */
++	__u32  ee_start_lo;    /* low 32 bits of physical block */
++  };
++
++/*
++ * This is index on-disk structure.
++ * It's used at all the levels except the bottom.
++ */
++struct ext4_extent_idx
++  {
++    __u32  ei_block;   /* index covers logical blocks from 'block' */
++    __u32  ei_leaf_lo; /* pointer to the physical block of the next *
++	                     * level. leaf or next index could be there */
++    __u16  ei_leaf_hi; /* high 16 bits of physical block */
++    __u16  ei_unused;
++  };
++
++/*
++ * Each block (leaves and indexes), even inode-stored has header.
++ */
++struct ext4_extent_header
++  {
++    __u16  eh_magic;   /* probably will support different formats */
++    __u16  eh_entries; /* number of valid entries */
++    __u16  eh_max;     /* capacity of store in entries */
++    __u16  eh_depth;   /* has tree real underlying blocks? */
++    __u32  eh_generation;  /* generation of the tree */
++  };
++
++#define EXT4_EXT_MAGIC      (0xf30a)
++#define EXT_FIRST_EXTENT(__hdr__) \
++    ((struct ext4_extent *) (((char *) (__hdr__)) +     \
++                 sizeof(struct ext4_extent_header)))
++#define EXT_FIRST_INDEX(__hdr__) \
++    ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \
++                 sizeof(struct ext4_extent_header)))
++#define EXT_LAST_EXTENT(__hdr__) \
++    (EXT_FIRST_EXTENT((__hdr__)) + (__u16)((__hdr__)->eh_entries) - 1)
++#define EXT_LAST_INDEX(__hdr__) \
++    (EXT_FIRST_INDEX((__hdr__)) + (__u16)((__hdr__)->eh_entries) - 1)
++
++
++
+ /* linux/ext2fs.h */
+ /*
+  * EXT2_DIR_PAD defines the directory entries boundaries
+@@ -271,8 +367,17 @@ struct ext2_dir_entry
+ /* kind of from ext2/super.c */
+ #define EXT2_BLOCK_SIZE(s)	(1 << EXT2_BLOCK_SIZE_BITS(s))
+ /* linux/ext2fs.h */
++/* sizeof(struct ext2_group_desc) is changed in ext4
++ * in kernel code, ext2/3 uses sizeof(struct ext2_group_desc) to calculate
++ * number of desc per block, while ext4 uses superblock->s_desc_size in stead
++ * superblock->s_desc_size is not available in ext2/3
++ * */
++#define EXT2_DESC_SIZE(s) \
++	(EXT4_HAS_INCOMPAT_FEATURE(s,EXT4_FEATURE_INCOMPAT_64BIT)? \
++	s->s_desc_size : EXT4_MIN_DESC_SIZE)
+ #define EXT2_DESC_PER_BLOCK(s) \
+-     (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
++	(EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
++
+ /* linux/stat.h */
+ #define S_IFMT  00170000
+ #define S_IFLNK  0120000
+@@ -434,6 +539,122 @@ ext2fs_block_map (int logical_block)
+     [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
+ }
+ 
++/* extent binary search index
++ * find closest index in the current level extent tree
++ * kind of from ext4_ext_binsearch_idx in ext4/extents.c
++ */
++static struct ext4_extent_idx*
++ext4_ext_binsearch_idx(struct ext4_extent_header* eh, int logical_block)
++{
++  struct ext4_extent_idx *r, *l, *m;
++  l = EXT_FIRST_INDEX(eh) + 1;
++  r = EXT_LAST_INDEX(eh);
++  while (l <= r)
++    {
++	  m = l + (r - l) / 2;
++	  if (logical_block < m->ei_block)
++		  r = m - 1;
++	  else
++		  l = m + 1;
++	}
++  return (struct ext4_extent_idx*)(l - 1);
++}
++
++/* extent binary search
++ * find closest extent in the leaf level
++ * kind of from ext4_ext_binsearch in ext4/extents.c
++ */
++static struct ext4_extent*
++ext4_ext_binsearch(struct ext4_extent_header* eh, int logical_block)
++{
++  struct ext4_extent *r, *l, *m;
++  l = EXT_FIRST_EXTENT(eh) + 1;
++  r = EXT_LAST_EXTENT(eh);
++  while (l <= r)
++    {
++	  m = l + (r - l) / 2;
++	  if (logical_block < m->ee_block)
++		  r = m - 1;
++	  else
++		  l = m + 1;
++	}
++  return (struct ext4_extent*)(l - 1);
++}
++
++/* Maps extents enabled logical block into physical block via an inode.
++ * EXT4_HUGE_FILE_FL should be checked before calling this.
++ */
++static int
++ext4fs_block_map (int logical_block)
++{
++  struct ext4_extent_header *eh;
++  struct ext4_extent *ex, *extent;
++  struct ext4_extent_idx *ei, *index;
++  int depth;
++  int i;
++
++#ifdef E2DEBUG
++  unsigned char *i;
++  for (i = (unsigned char *) INODE;
++       i < ((unsigned char *) INODE + sizeof (struct ext2_inode));
++       i++)
++    {
++      printf ("%c", "0123456789abcdef"[*i >> 4]);
++      printf ("%c", "0123456789abcdef"[*i % 16]);
++      if (!((i + 1 - (unsigned char *) INODE) % 16))
++	{
++	  printf ("\n");
++	}
++      else
++	{
++	  printf (" ");
++	}
++    }
++  printf ("logical block %d\n", logical_block);
++#endif /* E2DEBUG */
++  eh = (struct ext4_extent_header*)INODE->i_block;
++  if (eh->eh_magic != EXT4_EXT_MAGIC)
++  {
++          errnum = ERR_FSYS_CORRUPT;
++          return -1;
++  }
++  while((depth = eh->eh_depth) != 0)
++  	{ /* extent index */
++	  if (eh->eh_magic != EXT4_EXT_MAGIC)
++	  {
++	          errnum = ERR_FSYS_CORRUPT;
++		  return -1;
++	  }
++	  ei = ext4_ext_binsearch_idx(eh, logical_block);
++	  if (ei->ei_leaf_hi)
++	{/* 64bit physical block number not supported */
++	  errnum = ERR_FILELENGTH;
++	  return -1;
++	}
++	  if (!ext2_rdfsb(ei->ei_leaf_lo, DATABLOCK1))
++	{
++	  errnum = ERR_FSYS_CORRUPT;
++	  return -1;
++	}
++	  eh = (struct ext4_extent_header*)DATABLOCK1;
++  	}
++
++  /* depth==0, we come to the leaf */
++  ex = ext4_ext_binsearch(eh, logical_block);
++  if (ex->ee_start_hi)
++	{/* 64bit physical block number not supported */
++	  errnum = ERR_FILELENGTH;
++	  return -1;
++	}
++  if ((ex->ee_block + ex->ee_len) < logical_block)
++	{
++	  errnum = ERR_FSYS_CORRUPT;
++	  return -1;
++	}
++  return ex->ee_start_lo + logical_block - ex->ee_block;
++
++}
++
+ /* preconditions: all preconds of ext2fs_block_map */
+ int
+ ext2fs_read (char *buf, int len)
+@@ -468,6 +689,11 @@ ext2fs_read (char *buf, int len)
+       /* find the (logical) block component of our location */
+       logical_block = filepos >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK);
+       offset = filepos & (EXT2_BLOCK_SIZE (SUPERBLOCK) - 1);
++      /* map extents enabled logical block number to physical fs on-disk block number */
++      if (EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK,EXT4_FEATURE_INCOMPAT_EXTENTS)
++                    && INODE->i_flags & EXT4_EXTENTS_FL)
++          map = ext4fs_block_map (logical_block);
++      else
+       map = ext2fs_block_map (logical_block);
+ #ifdef E2DEBUG
+       printf ("map=%d\n", map);
+@@ -552,7 +778,7 @@ ext2fs_dir (char *dirname)
+   int desc;			/* index within that group */
+   int ino_blk;			/* fs pointer of the inode's information */
+   int str_chk = 0;		/* used to hold the results of a string compare */
+-  struct ext2_group_desc *gdp;
++  struct ext4_group_desc *ext4_gdp;
+   struct ext2_inode *raw_inode;	/* inode info corresponding to current_ino */
+ 
+   char linkbuf[PATH_MAX];	/* buffer for following symbolic links */
+@@ -598,8 +824,15 @@ ext2fs_dir (char *dirname)
+ 	{
+ 	  return 0;
+ 	}
+-      gdp = GROUP_DESC;
+-      ino_blk = gdp[desc].bg_inode_table +
++	  ext4_gdp = (struct ext4_group_desc *)( (__u8*)GROUP_DESC +
++			  		desc * EXT2_DESC_SIZE(SUPERBLOCK));
++	  if (EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK, EXT4_FEATURE_INCOMPAT_64BIT)
++		&& (! ext4_gdp->bg_inode_table_hi))
++	{/* 64bit itable not supported */
++	  errnum = ERR_FILELENGTH;
++	  return -1;
++	}
++      ino_blk = ext4_gdp->bg_inode_table +
+ 	(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
+ 	 >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
+ #ifdef E2DEBUG
+@@ -676,7 +909,10 @@ ext2fs_dir (char *dirname)
+ 	    }
+ 	  linkbuf[filemax + len] = '\0';
+ 
+-	  /* Read the symlink data. */
++	  /* Read the symlink data.
++	   * Slow symlink is extents enabled
++	   * But since grub_read invokes ext2fs_read, nothing to change here
++	   */
+ 	  if (! ext2_is_fast_symlink ())
+ 	    {
+ 	      /* Read the necessary blocks, and reset the file pointer. */
+@@ -687,7 +923,9 @@ ext2fs_dir (char *dirname)
+ 	    }
+ 	  else
+ 	    {
+-	      /* Copy the data directly from the inode. */
++	      /* Copy the data directly from the inode.
++	       * Fast symlink is not extents enabled
++	       */
+ 	      len = filemax;
+ 	      memmove (linkbuf, (char *) INODE->i_block, len);
+ 	    }
+@@ -721,6 +959,13 @@ ext2fs_dir (char *dirname)
+ 	      errnum = ERR_BAD_FILETYPE;
+ 	      return 0;
+ 	    }
++	  /* if file is too large, just stop and report an error*/
++	  if ( (INODE->i_flags & EXT4_HUGE_FILE_FL) && !(INODE->i_size_high))
++	    {
++		  /* file too large, stop reading */
++		  errnum = ERR_FILELENGTH;
++		  return 0;
++	    }
+ 
+ 	  filemax = (INODE->i_size);
+ 	  return 1;
+@@ -775,17 +1020,28 @@ ext2fs_dir (char *dirname)
+ 	    }
+ 
+ 	  /* else, find the (logical) block component of our location */
++	  /* ext4 logical block number the same as ext2/3 */
+ 	  blk = loc >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK);
+ 
+ 	  /* we know which logical block of the directory entry we are looking
+ 	     for, now we have to translate that to the physical (fs) block on
+ 	     the disk */
++	  /* map extents enabled logical block number to physical fs on-disk block number */
++	  if (EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK,EXT4_FEATURE_INCOMPAT_EXTENTS)
++                        && INODE->i_flags & EXT4_EXTENTS_FL)
++              map = ext4fs_block_map (blk);
++	  else
+ 	  map = ext2fs_block_map (blk);
+ #ifdef E2DEBUG
+ 	  printf ("fs block=%d\n", map);
+ #endif /* E2DEBUG */
+ 	  mapblock2 = -1;
+-	  if ((map < 0) || !ext2_rdfsb (map, DATABLOCK2))
++	  if (map < 0)
++	  {
++	      *rest = ch;
++	      return 0;
++	  }
++          if (!ext2_rdfsb (map, DATABLOCK2))
+ 	    {
+ 	      errnum = ERR_FSYS_CORRUPT;
+ 	      *rest = ch;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzM-0004Rz-Ux; Fri, 06 Apr 2012 02:33:24 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0004Q8-L0
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [85.158.143.99:18478] by server-1.bemta-4.messagelabs.com id
	F6/63-20925-2F55E7F4; Fri, 06 Apr 2012 02:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1333679599!22259165!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17071 invoked from network); 6 Apr 2012 02:33:20 -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;
	6 Apr 2012 02:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0003NC-4u
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0008MI-2b
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Message-Id: <E1SFyzH-0008MI-2b@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PV-GRUB: add support for ext4
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Matt Wilson <msw@amazon.com>
# Date 1333534154 -3600
# Node ID d1c985425e7841891ec1e3c0d4dc224be7b8d3cc
# Parent  1fa1ba79759ac934f03caf974b79fe6d4acca00f
PV-GRUB: add support for ext4

This patch adds support for ext4 to the GRUB tree used to build PV-GRUB.
The original patch is taken from the Fedora GRUB package in this commit:
http://pkgs.fedoraproject.org/gitweb/?p=grub.git;a=commitdiff;h=32bf414af04d377055957167aac7dedec691ef57

Signed-off-by: Matt Wilson <msw@amazon.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1fa1ba79759a -r d1c985425e78 stubdom/grub.patches/60ext4.diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/grub.patches/60ext4.diff	Wed Apr 04 11:09:14 2012 +0100
@@ -0,0 +1,474 @@
+Index: grub-0.97/stage2/fsys_ext2fs.c
+===================================================================
+--- grub-0.97.orig/stage2/fsys_ext2fs.c
++++ grub-0.97/stage2/fsys_ext2fs.c
+@@ -41,6 +41,7 @@ typedef __signed__ short __s16;
+ typedef unsigned short __u16;
+ typedef __signed__ int __s32;
+ typedef unsigned int __u32;
++typedef unsigned long long __u64;
+ 
+ /*
+  * Constants relative to the data blocks, from ext2_fs.h
+@@ -51,7 +52,7 @@ typedef unsigned int __u32;
+ #define EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
+ #define EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
+ 
+-/* include/linux/ext2_fs.h */
++/* lib/ext2fs/ext2_fs.h from e2fsprogs */
+ struct ext2_super_block
+   {
+     __u32 s_inodes_count;	/* Inodes count */
+@@ -61,9 +62,9 @@ struct ext2_super_block
+     __u32 s_free_inodes_count;	/* Free inodes count */
+     __u32 s_first_data_block;	/* First Data Block */
+     __u32 s_log_block_size;	/* Block size */
+-    __s32 s_log_frag_size;	/* Fragment size */
++    __s32 s_obso_log_frag_size;	/* Obsoleted Fragment size */
+     __u32 s_blocks_per_group;	/* # Blocks per group */
+-    __u32 s_frags_per_group;	/* # Fragments per group */
++    __u32 s_obso_frags_per_group;	/* Obsoleted Fragments per group */
+     __u32 s_inodes_per_group;	/* # Inodes per group */
+     __u32 s_mtime;		/* Mount time */
+     __u32 s_wtime;		/* Write time */
+@@ -72,7 +73,7 @@ struct ext2_super_block
+     __u16 s_magic;		/* Magic signature */
+     __u16 s_state;		/* File system state */
+     __u16 s_errors;		/* Behaviour when detecting errors */
+-    __u16 s_pad;
++    __u16 s_minor_rev_level;	/* minor revision level */
+     __u32 s_lastcheck;		/* time of last check */
+     __u32 s_checkinterval;	/* max. time between checks */
+     __u32 s_creator_os;		/* OS */
+@@ -119,15 +120,29 @@ struct ext2_super_block
+     __u32 s_hash_seed[4];	/* HTREE hash seed */
+     __u8  s_def_hash_version;	/* Default hash version to use */
+     __u8  s_jnl_backup_type; 	/* Default type of journal backup */
+-    __u16 s_reserved_word_pad;
++    __u16 s_desc_size;		/* size of group descriptor */
+     __u32 s_default_mount_opts;
+     __u32 s_first_meta_bg;	/* First metablock group */
+     __u32 s_mkfs_time;		/* When the filesystem was created */
+     __u32 s_jnl_blocks[17]; 	/* Backup of the journal inode */
+-    __u32 s_reserved[172];	/* Padding to the end of the block */
+-  };
++    /* 64bit desc support valid if EXT4_FEATURE_INCOMPAT_64BIT */
++    __u32 s_blocks_count_hi;	/* Blocks count */
++    __u32 s_r_blocks_count_hi;	/* Reserved blocks count */
++    __u32 s_free_blocks_count_hi; /* Free blocks count */
++    __u16 s_min_extra_isize;	/* All inodes have at least # bytes */
++    __u16 s_max_extra_isize;	/* New inodes should reverve # bytes */
++    __u32 s_flags;		/* Miscellaneous flags */
++    __u16 s_raid_stride;	/* Raid stride */
++    __u16 s_mmp_interval;	/* # seconds to wait MMP checking */
++    __u64 s_mmp_block;		/* Block for multi-mount protection */
++    __u32 s_raid_stripe_width;	/* Blocks on all data disks (N*stride)*/
++    __u8  s_log_groups_per_flex;/* FLEX_BG group size*/
++    __u8  s_reserved_char_pad;
++    __u16 s_reserved_pad;
++    __u32 s_reserved[162];	/* Padding to the end of the block */
++};
+ 
+-struct ext2_group_desc
++struct ext4_group_desc
+   {
+     __u32 bg_block_bitmap;	/* Blocks bitmap block */
+     __u32 bg_inode_bitmap;	/* Inodes bitmap block */
+@@ -135,8 +150,18 @@ struct ext2_group_desc
+     __u16 bg_free_blocks_count;	/* Free blocks count */
+     __u16 bg_free_inodes_count;	/* Free inodes count */
+     __u16 bg_used_dirs_count;	/* Directories count */
+-    __u16 bg_pad;
+-    __u32 bg_reserved[3];
++    __u16 bg_flags;		/* EXT4_BG_flags (INODE_UNINIT, etc) */
++    __u32 bg_reserved[2];		/* Likely block/inode bitmap checksum */
++    __u16 bg_itable_unused;	/* Unused inodes count */
++    __u16 bg_checksum;		/* crc16(sb_uuid+group+desc) */
++    __u32 bg_block_bitmap_hi;	/* Blocks bitmap block MSB */
++    __u32 bg_inode_bitmap_hi;	/* Inodes bitmap block MSB */
++    __u32 bg_inode_table_hi;	/* Inodes table block MSB */
++    __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */
++    __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */
++    __u16 bg_used_dirs_count_hi;	/* Directories count MSB */
++    __u16 bg_itable_unused_hi;	/* Unused inodes count MSB */
++    __u32 bg_reserved2[3];
+   };
+ 
+ struct ext2_inode
+@@ -174,22 +199,22 @@ struct ext2_inode
+     __u32 i_block[EXT2_N_BLOCKS];	/* 40: Pointers to blocks */
+     __u32 i_version;		/* File version (for NFS) */
+     __u32 i_file_acl;		/* File ACL */
+-    __u32 i_dir_acl;		/* Directory ACL */
+-    __u32 i_faddr;		/* Fragment address */
++    __u32 i_size_high;
++    __u32 i_obso_faddr;		/* Obsoleted fragment address */
+     union
+       {
+ 	struct
+ 	  {
+-	    __u8 l_i_frag;	/* Fragment number */
+-	    __u8 l_i_fsize;	/* Fragment size */
+-	    __u16 i_pad1;
+-	    __u32 l_i_reserved2[2];
++		__u16	l_i_blocks_high; /* were l_i_reserved1 */
++		__u16	l_i_file_acl_high;
++		__u16	l_i_uid_high;	/* these 2 fields */
++		__u16	l_i_gid_high;	/* were reserved2[0] */
++		__u32	l_i_reserved2;
+ 	  }
+ 	linux2;
+ 	struct
+ 	  {
+-	    __u8 h_i_frag;	/* Fragment number */
+-	    __u8 h_i_fsize;	/* Fragment size */
++		__u16	h_i_reserved1;	/* Obsoleted fragment number/size which are removed in ext4 */
+ 	    __u16 h_i_mode_high;
+ 	    __u16 h_i_uid_high;
+ 	    __u16 h_i_gid_high;
+@@ -198,16 +223,36 @@ struct ext2_inode
+ 	hurd2;
+ 	struct
+ 	  {
+-	    __u8 m_i_frag;	/* Fragment number */
+-	    __u8 m_i_fsize;	/* Fragment size */
+-	    __u16 m_pad1;
++		__u16	h_i_reserved1;	/* Obsoleted fragment number/size which are removed in ext4 */
++		__u16	m_i_file_acl_high;
+ 	    __u32 m_i_reserved2[2];
+ 	  }
+ 	masix2;
+       }
+     osd2;			/* OS dependent 2 */
++	__u16	i_extra_isize;
++	__u16	i_pad1;
++	__u32  i_ctime_extra;  /* extra Change time      (nsec << 2 | epoch) */
++	__u32  i_mtime_extra;  /* extra Modification time(nsec << 2 | epoch) */
++	__u32  i_atime_extra;  /* extra Access time      (nsec << 2 | epoch) */
++	__u32  i_crtime;       /* File Creation time */
++	__u32  i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
++	__u32  i_version_hi;	/* high 32 bits for 64-bit version */
+   };
+ 
++#define EXT4_FEATURE_INCOMPAT_EXTENTS		0x0040 /* extents support */
++#define EXT4_FEATURE_INCOMPAT_64BIT			0x0080 /* grub not supported*/
++#define EXT4_FEATURE_INCOMPAT_MMP           0x0100
++#define EXT4_FEATURE_INCOMPAT_FLEX_BG		0x0200
++
++#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask)			\
++	( sb->s_feature_incompat & mask )
++
++#define EXT4_EXTENTS_FL		0x00080000 /* Inode uses extents */
++#define EXT4_HUGE_FILE_FL	0x00040000 /* Set to each huge file */
++
++#define EXT4_MIN_DESC_SIZE			32
++
+ /* linux/limits.h */
+ #define NAME_MAX         255	/* # chars in a file name */
+ 
+@@ -225,6 +270,57 @@ struct ext2_dir_entry
+     char name[EXT2_NAME_LEN];	/* File name */
+   };
+ 
++/* linux/ext4_fs_extents.h */
++/* This is the extent on-disk structure.
++ * It's used at the bottom of the tree.
++ */
++struct ext4_extent
++  {
++	__u32  ee_block;   /* first logical block extent covers */
++	__u16  ee_len;     /* number of blocks covered by extent */
++	__u16  ee_start_hi;    /* high 16 bits of physical block */
++	__u32  ee_start_lo;    /* low 32 bits of physical block */
++  };
++
++/*
++ * This is index on-disk structure.
++ * It's used at all the levels except the bottom.
++ */
++struct ext4_extent_idx
++  {
++    __u32  ei_block;   /* index covers logical blocks from 'block' */
++    __u32  ei_leaf_lo; /* pointer to the physical block of the next *
++	                     * level. leaf or next index could be there */
++    __u16  ei_leaf_hi; /* high 16 bits of physical block */
++    __u16  ei_unused;
++  };
++
++/*
++ * Each block (leaves and indexes), even inode-stored has header.
++ */
++struct ext4_extent_header
++  {
++    __u16  eh_magic;   /* probably will support different formats */
++    __u16  eh_entries; /* number of valid entries */
++    __u16  eh_max;     /* capacity of store in entries */
++    __u16  eh_depth;   /* has tree real underlying blocks? */
++    __u32  eh_generation;  /* generation of the tree */
++  };
++
++#define EXT4_EXT_MAGIC      (0xf30a)
++#define EXT_FIRST_EXTENT(__hdr__) \
++    ((struct ext4_extent *) (((char *) (__hdr__)) +     \
++                 sizeof(struct ext4_extent_header)))
++#define EXT_FIRST_INDEX(__hdr__) \
++    ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \
++                 sizeof(struct ext4_extent_header)))
++#define EXT_LAST_EXTENT(__hdr__) \
++    (EXT_FIRST_EXTENT((__hdr__)) + (__u16)((__hdr__)->eh_entries) - 1)
++#define EXT_LAST_INDEX(__hdr__) \
++    (EXT_FIRST_INDEX((__hdr__)) + (__u16)((__hdr__)->eh_entries) - 1)
++
++
++
+ /* linux/ext2fs.h */
+ /*
+  * EXT2_DIR_PAD defines the directory entries boundaries
+@@ -271,8 +367,17 @@ struct ext2_dir_entry
+ /* kind of from ext2/super.c */
+ #define EXT2_BLOCK_SIZE(s)	(1 << EXT2_BLOCK_SIZE_BITS(s))
+ /* linux/ext2fs.h */
++/* sizeof(struct ext2_group_desc) is changed in ext4
++ * in kernel code, ext2/3 uses sizeof(struct ext2_group_desc) to calculate
++ * number of desc per block, while ext4 uses superblock->s_desc_size in stead
++ * superblock->s_desc_size is not available in ext2/3
++ * */
++#define EXT2_DESC_SIZE(s) \
++	(EXT4_HAS_INCOMPAT_FEATURE(s,EXT4_FEATURE_INCOMPAT_64BIT)? \
++	s->s_desc_size : EXT4_MIN_DESC_SIZE)
+ #define EXT2_DESC_PER_BLOCK(s) \
+-     (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
++	(EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s))
++
+ /* linux/stat.h */
+ #define S_IFMT  00170000
+ #define S_IFLNK  0120000
+@@ -434,6 +539,122 @@ ext2fs_block_map (int logical_block)
+     [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
+ }
+ 
++/* extent binary search index
++ * find closest index in the current level extent tree
++ * kind of from ext4_ext_binsearch_idx in ext4/extents.c
++ */
++static struct ext4_extent_idx*
++ext4_ext_binsearch_idx(struct ext4_extent_header* eh, int logical_block)
++{
++  struct ext4_extent_idx *r, *l, *m;
++  l = EXT_FIRST_INDEX(eh) + 1;
++  r = EXT_LAST_INDEX(eh);
++  while (l <= r)
++    {
++	  m = l + (r - l) / 2;
++	  if (logical_block < m->ei_block)
++		  r = m - 1;
++	  else
++		  l = m + 1;
++	}
++  return (struct ext4_extent_idx*)(l - 1);
++}
++
++/* extent binary search
++ * find closest extent in the leaf level
++ * kind of from ext4_ext_binsearch in ext4/extents.c
++ */
++static struct ext4_extent*
++ext4_ext_binsearch(struct ext4_extent_header* eh, int logical_block)
++{
++  struct ext4_extent *r, *l, *m;
++  l = EXT_FIRST_EXTENT(eh) + 1;
++  r = EXT_LAST_EXTENT(eh);
++  while (l <= r)
++    {
++	  m = l + (r - l) / 2;
++	  if (logical_block < m->ee_block)
++		  r = m - 1;
++	  else
++		  l = m + 1;
++	}
++  return (struct ext4_extent*)(l - 1);
++}
++
++/* Maps extents enabled logical block into physical block via an inode.
++ * EXT4_HUGE_FILE_FL should be checked before calling this.
++ */
++static int
++ext4fs_block_map (int logical_block)
++{
++  struct ext4_extent_header *eh;
++  struct ext4_extent *ex, *extent;
++  struct ext4_extent_idx *ei, *index;
++  int depth;
++  int i;
++
++#ifdef E2DEBUG
++  unsigned char *i;
++  for (i = (unsigned char *) INODE;
++       i < ((unsigned char *) INODE + sizeof (struct ext2_inode));
++       i++)
++    {
++      printf ("%c", "0123456789abcdef"[*i >> 4]);
++      printf ("%c", "0123456789abcdef"[*i % 16]);
++      if (!((i + 1 - (unsigned char *) INODE) % 16))
++	{
++	  printf ("\n");
++	}
++      else
++	{
++	  printf (" ");
++	}
++    }
++  printf ("logical block %d\n", logical_block);
++#endif /* E2DEBUG */
++  eh = (struct ext4_extent_header*)INODE->i_block;
++  if (eh->eh_magic != EXT4_EXT_MAGIC)
++  {
++          errnum = ERR_FSYS_CORRUPT;
++          return -1;
++  }
++  while((depth = eh->eh_depth) != 0)
++  	{ /* extent index */
++	  if (eh->eh_magic != EXT4_EXT_MAGIC)
++	  {
++	          errnum = ERR_FSYS_CORRUPT;
++		  return -1;
++	  }
++	  ei = ext4_ext_binsearch_idx(eh, logical_block);
++	  if (ei->ei_leaf_hi)
++	{/* 64bit physical block number not supported */
++	  errnum = ERR_FILELENGTH;
++	  return -1;
++	}
++	  if (!ext2_rdfsb(ei->ei_leaf_lo, DATABLOCK1))
++	{
++	  errnum = ERR_FSYS_CORRUPT;
++	  return -1;
++	}
++	  eh = (struct ext4_extent_header*)DATABLOCK1;
++  	}
++
++  /* depth==0, we come to the leaf */
++  ex = ext4_ext_binsearch(eh, logical_block);
++  if (ex->ee_start_hi)
++	{/* 64bit physical block number not supported */
++	  errnum = ERR_FILELENGTH;
++	  return -1;
++	}
++  if ((ex->ee_block + ex->ee_len) < logical_block)
++	{
++	  errnum = ERR_FSYS_CORRUPT;
++	  return -1;
++	}
++  return ex->ee_start_lo + logical_block - ex->ee_block;
++
++}
++
+ /* preconditions: all preconds of ext2fs_block_map */
+ int
+ ext2fs_read (char *buf, int len)
+@@ -468,6 +689,11 @@ ext2fs_read (char *buf, int len)
+       /* find the (logical) block component of our location */
+       logical_block = filepos >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK);
+       offset = filepos & (EXT2_BLOCK_SIZE (SUPERBLOCK) - 1);
++      /* map extents enabled logical block number to physical fs on-disk block number */
++      if (EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK,EXT4_FEATURE_INCOMPAT_EXTENTS)
++                    && INODE->i_flags & EXT4_EXTENTS_FL)
++          map = ext4fs_block_map (logical_block);
++      else
+       map = ext2fs_block_map (logical_block);
+ #ifdef E2DEBUG
+       printf ("map=%d\n", map);
+@@ -552,7 +778,7 @@ ext2fs_dir (char *dirname)
+   int desc;			/* index within that group */
+   int ino_blk;			/* fs pointer of the inode's information */
+   int str_chk = 0;		/* used to hold the results of a string compare */
+-  struct ext2_group_desc *gdp;
++  struct ext4_group_desc *ext4_gdp;
+   struct ext2_inode *raw_inode;	/* inode info corresponding to current_ino */
+ 
+   char linkbuf[PATH_MAX];	/* buffer for following symbolic links */
+@@ -598,8 +824,15 @@ ext2fs_dir (char *dirname)
+ 	{
+ 	  return 0;
+ 	}
+-      gdp = GROUP_DESC;
+-      ino_blk = gdp[desc].bg_inode_table +
++	  ext4_gdp = (struct ext4_group_desc *)( (__u8*)GROUP_DESC +
++			  		desc * EXT2_DESC_SIZE(SUPERBLOCK));
++	  if (EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK, EXT4_FEATURE_INCOMPAT_64BIT)
++		&& (! ext4_gdp->bg_inode_table_hi))
++	{/* 64bit itable not supported */
++	  errnum = ERR_FILELENGTH;
++	  return -1;
++	}
++      ino_blk = ext4_gdp->bg_inode_table +
+ 	(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
+ 	 >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
+ #ifdef E2DEBUG
+@@ -676,7 +909,10 @@ ext2fs_dir (char *dirname)
+ 	    }
+ 	  linkbuf[filemax + len] = '\0';
+ 
+-	  /* Read the symlink data. */
++	  /* Read the symlink data.
++	   * Slow symlink is extents enabled
++	   * But since grub_read invokes ext2fs_read, nothing to change here
++	   */
+ 	  if (! ext2_is_fast_symlink ())
+ 	    {
+ 	      /* Read the necessary blocks, and reset the file pointer. */
+@@ -687,7 +923,9 @@ ext2fs_dir (char *dirname)
+ 	    }
+ 	  else
+ 	    {
+-	      /* Copy the data directly from the inode. */
++	      /* Copy the data directly from the inode.
++	       * Fast symlink is not extents enabled
++	       */
+ 	      len = filemax;
+ 	      memmove (linkbuf, (char *) INODE->i_block, len);
+ 	    }
+@@ -721,6 +959,13 @@ ext2fs_dir (char *dirname)
+ 	      errnum = ERR_BAD_FILETYPE;
+ 	      return 0;
+ 	    }
++	  /* if file is too large, just stop and report an error*/
++	  if ( (INODE->i_flags & EXT4_HUGE_FILE_FL) && !(INODE->i_size_high))
++	    {
++		  /* file too large, stop reading */
++		  errnum = ERR_FILELENGTH;
++		  return 0;
++	    }
+ 
+ 	  filemax = (INODE->i_size);
+ 	  return 1;
+@@ -775,17 +1020,28 @@ ext2fs_dir (char *dirname)
+ 	    }
+ 
+ 	  /* else, find the (logical) block component of our location */
++	  /* ext4 logical block number the same as ext2/3 */
+ 	  blk = loc >> EXT2_BLOCK_SIZE_BITS (SUPERBLOCK);
+ 
+ 	  /* we know which logical block of the directory entry we are looking
+ 	     for, now we have to translate that to the physical (fs) block on
+ 	     the disk */
++	  /* map extents enabled logical block number to physical fs on-disk block number */
++	  if (EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK,EXT4_FEATURE_INCOMPAT_EXTENTS)
++                        && INODE->i_flags & EXT4_EXTENTS_FL)
++              map = ext4fs_block_map (blk);
++	  else
+ 	  map = ext2fs_block_map (blk);
+ #ifdef E2DEBUG
+ 	  printf ("fs block=%d\n", map);
+ #endif /* E2DEBUG */
+ 	  mapblock2 = -1;
+-	  if ((map < 0) || !ext2_rdfsb (map, DATABLOCK2))
++	  if (map < 0)
++	  {
++	      *rest = ch;
++	      return 0;
++	  }
++          if (!ext2_rdfsb (map, DATABLOCK2))
+ 	    {
+ 	      errnum = ERR_FSYS_CORRUPT;
+ 	      *rest = ch;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzN-0004SK-2a; Fri, 06 Apr 2012 02:33:25 +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 1SFyzL-0004QM-QL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [193.109.254.147:2277] by server-6.bemta-14.messagelabs.com id
	EA/17-02047-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1333679601!366271!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26589 invoked from network); 6 Apr 2012 02:33:22 -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;
	6 Apr 2012 02:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0003NL-Sv
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0008N2-RK
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Message-Id: <E1SFyzI-0008N2-RK@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl,
	libxl: Add per-device and global permissive config options for pci
	passthrough
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1333552002 -3600
# Node ID 1687cd2e97e37972034f77d9952d10e9b52ac8a4
# Parent  ce20aaa97da645963458911f08e591511e15c55d
xl, libxl: Add per-device and global permissive config options for pci passthrough

By default pciback only allows PV guests to write "known safe" values into
PCI config space.  But many devices require writes to other areas of config
space in order to operate properly.  One way to do that is with the "quirks"
interface, which specifies areas known safe to a particular device; the
other way is to mark a device as "permissive", which tells pciback to allow
all config space writes for that domain and device.

This adds a "permissive" flag to the libxl_pci struct and teaches libxl how
to write the appropriate value into sysfs to enable the permissive feature for
devices being passed through.  It also adds the permissive config options either
on a per-device basis, or as a global option in the xl command-line.

Because of the potential stability and security implications of enabling
permissive, the flag is left off by default.

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


diff -r ce20aaa97da6 -r 1687cd2e97e3 docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Wed Apr 04 16:06:42 2012 +0100
+++ b/docs/man/xl.cfg.pod.5	Wed Apr 04 16:06:42 2012 +0100
@@ -301,10 +301,31 @@ XXX
 
 XXX
 
+=item B<permissive=BOOLEAN>
+
+(PV only) By default pciback only allows PV guests to write "known
+safe" values into PCI config space.  But many devices require writes
+to other areas of config space in order to operate properly.  This
+tells the pciback driver to allow all writes to PCI config space of
+this device by this domain.  This option should be enabled with
+caution: it gives the guest much more control over the device, which
+may have security or stability implications.  It is recommended to
+enable this option only for trusted VMs under administrator control.
+
 =back
 
 =back
 
+=item B<pci_permissive=BOOLEAN>
+
+(PV only) Changes the default value of 'permissive' for all PCI
+devices for this VM.  This can still be overriden on a per-device
+basis. This option should be enabled with caution: it gives the guest
+much more control over the device, which may have security or
+stability implications.  It is recommended to enable this option only
+for trusted VMs under administrator control.  See the "pci=" section
+for more information on the "permissive" flag.
+
 =back
 
 =head2 Paravirtualised (PV) Guest Specific Options
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxl_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -55,7 +55,10 @@ static void libxl_create_pci_backend_dev
     if (pcidev->vdevfn)
         flexarray_append_pair(back, libxl__sprintf(gc, "vdevfn-%d", num), libxl__sprintf(gc, "%x", pcidev->vdevfn));
     flexarray_append(back, libxl__sprintf(gc, "opts-%d", num));
-    flexarray_append(back, libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
+    flexarray_append(back,
+              libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d,permissive=%d",
+                             pcidev->msitranslate, pcidev->power_mgmt,
+                             pcidev->permissive));
     flexarray_append_pair(back, libxl__sprintf(gc, "state-%d", num), libxl__sprintf(gc, "%d", 1));
 }
 
@@ -565,6 +568,31 @@ static int do_pci_add(libxl__gc *gc, uin
             }
         }
         fclose(f);
+
+        /* Don't restrict writes to the PCI config space from this VM */
+        if (pcidev->permissive) {
+            int fd;
+            char *buf;
+            
+            sysfs_path = libxl__sprintf(gc, SYSFS_PCIBACK_DRIVER"/permissive");
+            fd = open(sysfs_path, O_WRONLY);
+            if (fd < 0) {
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s",
+                                 sysfs_path);
+                return ERROR_FAIL;
+            }
+ 
+            buf = libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus,
+                                 pcidev->dev, pcidev->func);
+            rc = write(fd, buf, strlen(buf));
+            /* Annoying to have two if's, but we need the errno */
+            if (rc < 0)
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                                 "write to %s returned %d", sysfs_path, rc);
+            close(fd);
+            if (rc < 0)
+                return ERROR_FAIL;
+        }
         break;
     }
     default:
@@ -958,6 +986,9 @@ static void libxl__device_pci_from_xs_be
             } else if (!strcmp(p, "power_mgmt")) {
                 p = strtok_r(NULL, ",=", &saveptr);
                 pci->power_mgmt = atoi(p);
+            } else if (!strcmp(p, "permissive")) {
+                p = strtok_r(NULL, ",=", &saveptr);
+                pci->permissive = atoi(p);
             }
         } while ((p = strtok_r(NULL, ",=", &saveptr)) != NULL);
     }
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Wed Apr 04 16:06:42 2012 +0100
@@ -354,6 +354,7 @@ libxl_device_pci = Struct("device_pci", 
     ("vfunc_mask", uint32),
     ("msitranslate", bool),
     ("power_mgmt", bool),
+    ("permissive", bool),
     ])
 
 libxl_diskinfo = Struct("diskinfo", [
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/libxlu_pci.c
--- a/tools/libxl/libxlu_pci.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxlu_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -139,6 +139,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, l
                     pcidev->msitranslate = atoi(tok);
                 }else if ( !strcmp(optkey, "power_mgmt") ) {
                     pcidev->power_mgmt = atoi(tok);
+                }else if ( !strcmp(optkey, "permissive") ) {
+                    pcidev->permissive = atoi(tok);
                 }else{
                     XLU__PCI_ERR(cfg, "Unknown PCI BDF option: %s", optkey);
                 }
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:06:42 2012 +0100
@@ -518,6 +518,7 @@ static void parse_config_data(const char
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 1;
+    int pci_permissive = 0;
     int e;
 
     libxl_domain_create_info *c_info = &d_config->c_info;
@@ -991,6 +992,9 @@ skip_vfb:
     if (!xlu_cfg_get_long (config, "pci_power_mgmt", &l, 0))
         pci_power_mgmt = l;
 
+    if (!xlu_cfg_get_long (config, "pci_permissive", &l, 0))
+        pci_permissive = l;
+
     /* To be reworked (automatically enabled) once the auto ballooning
      * after guest starts is done (with PCI devices passed in). */
     if (c_info->type == LIBXL_DOMAIN_TYPE_PV) {
@@ -1010,6 +1014,7 @@ skip_vfb:
 
             pcidev->msitranslate = pci_msitranslate;
             pcidev->power_mgmt = pci_power_mgmt;
+            pcidev->permissive = pci_permissive;
             if (!xlu_pci_parse_bdf(config, pcidev, buf))
                 d_config->num_pcidevs++;
         }

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzN-0004SK-2a; Fri, 06 Apr 2012 02:33:25 +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 1SFyzL-0004QM-QL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [193.109.254.147:2277] by server-6.bemta-14.messagelabs.com id
	EA/17-02047-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1333679601!366271!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26589 invoked from network); 6 Apr 2012 02:33:22 -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;
	6 Apr 2012 02:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0003NL-Sv
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0008N2-RK
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Message-Id: <E1SFyzI-0008N2-RK@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl,
	libxl: Add per-device and global permissive config options for pci
	passthrough
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1333552002 -3600
# Node ID 1687cd2e97e37972034f77d9952d10e9b52ac8a4
# Parent  ce20aaa97da645963458911f08e591511e15c55d
xl, libxl: Add per-device and global permissive config options for pci passthrough

By default pciback only allows PV guests to write "known safe" values into
PCI config space.  But many devices require writes to other areas of config
space in order to operate properly.  One way to do that is with the "quirks"
interface, which specifies areas known safe to a particular device; the
other way is to mark a device as "permissive", which tells pciback to allow
all config space writes for that domain and device.

This adds a "permissive" flag to the libxl_pci struct and teaches libxl how
to write the appropriate value into sysfs to enable the permissive feature for
devices being passed through.  It also adds the permissive config options either
on a per-device basis, or as a global option in the xl command-line.

Because of the potential stability and security implications of enabling
permissive, the flag is left off by default.

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


diff -r ce20aaa97da6 -r 1687cd2e97e3 docs/man/xl.cfg.pod.5
--- a/docs/man/xl.cfg.pod.5	Wed Apr 04 16:06:42 2012 +0100
+++ b/docs/man/xl.cfg.pod.5	Wed Apr 04 16:06:42 2012 +0100
@@ -301,10 +301,31 @@ XXX
 
 XXX
 
+=item B<permissive=BOOLEAN>
+
+(PV only) By default pciback only allows PV guests to write "known
+safe" values into PCI config space.  But many devices require writes
+to other areas of config space in order to operate properly.  This
+tells the pciback driver to allow all writes to PCI config space of
+this device by this domain.  This option should be enabled with
+caution: it gives the guest much more control over the device, which
+may have security or stability implications.  It is recommended to
+enable this option only for trusted VMs under administrator control.
+
 =back
 
 =back
 
+=item B<pci_permissive=BOOLEAN>
+
+(PV only) Changes the default value of 'permissive' for all PCI
+devices for this VM.  This can still be overriden on a per-device
+basis. This option should be enabled with caution: it gives the guest
+much more control over the device, which may have security or
+stability implications.  It is recommended to enable this option only
+for trusted VMs under administrator control.  See the "pci=" section
+for more information on the "permissive" flag.
+
 =back
 
 =head2 Paravirtualised (PV) Guest Specific Options
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxl_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -55,7 +55,10 @@ static void libxl_create_pci_backend_dev
     if (pcidev->vdevfn)
         flexarray_append_pair(back, libxl__sprintf(gc, "vdevfn-%d", num), libxl__sprintf(gc, "%x", pcidev->vdevfn));
     flexarray_append(back, libxl__sprintf(gc, "opts-%d", num));
-    flexarray_append(back, libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d", pcidev->msitranslate, pcidev->power_mgmt));
+    flexarray_append(back,
+              libxl__sprintf(gc, "msitranslate=%d,power_mgmt=%d,permissive=%d",
+                             pcidev->msitranslate, pcidev->power_mgmt,
+                             pcidev->permissive));
     flexarray_append_pair(back, libxl__sprintf(gc, "state-%d", num), libxl__sprintf(gc, "%d", 1));
 }
 
@@ -565,6 +568,31 @@ static int do_pci_add(libxl__gc *gc, uin
             }
         }
         fclose(f);
+
+        /* Don't restrict writes to the PCI config space from this VM */
+        if (pcidev->permissive) {
+            int fd;
+            char *buf;
+            
+            sysfs_path = libxl__sprintf(gc, SYSFS_PCIBACK_DRIVER"/permissive");
+            fd = open(sysfs_path, O_WRONLY);
+            if (fd < 0) {
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s",
+                                 sysfs_path);
+                return ERROR_FAIL;
+            }
+ 
+            buf = libxl__sprintf(gc, PCI_BDF, pcidev->domain, pcidev->bus,
+                                 pcidev->dev, pcidev->func);
+            rc = write(fd, buf, strlen(buf));
+            /* Annoying to have two if's, but we need the errno */
+            if (rc < 0)
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                                 "write to %s returned %d", sysfs_path, rc);
+            close(fd);
+            if (rc < 0)
+                return ERROR_FAIL;
+        }
         break;
     }
     default:
@@ -958,6 +986,9 @@ static void libxl__device_pci_from_xs_be
             } else if (!strcmp(p, "power_mgmt")) {
                 p = strtok_r(NULL, ",=", &saveptr);
                 pci->power_mgmt = atoi(p);
+            } else if (!strcmp(p, "permissive")) {
+                p = strtok_r(NULL, ",=", &saveptr);
+                pci->permissive = atoi(p);
             }
         } while ((p = strtok_r(NULL, ",=", &saveptr)) != NULL);
     }
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxl_types.idl	Wed Apr 04 16:06:42 2012 +0100
@@ -354,6 +354,7 @@ libxl_device_pci = Struct("device_pci", 
     ("vfunc_mask", uint32),
     ("msitranslate", bool),
     ("power_mgmt", bool),
+    ("permissive", bool),
     ])
 
 libxl_diskinfo = Struct("diskinfo", [
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/libxlu_pci.c
--- a/tools/libxl/libxlu_pci.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxlu_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -139,6 +139,8 @@ int xlu_pci_parse_bdf(XLU_Config *cfg, l
                     pcidev->msitranslate = atoi(tok);
                 }else if ( !strcmp(optkey, "power_mgmt") ) {
                     pcidev->power_mgmt = atoi(tok);
+                }else if ( !strcmp(optkey, "permissive") ) {
+                    pcidev->permissive = atoi(tok);
                 }else{
                     XLU__PCI_ERR(cfg, "Unknown PCI BDF option: %s", optkey);
                 }
diff -r ce20aaa97da6 -r 1687cd2e97e3 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:06:42 2012 +0100
@@ -518,6 +518,7 @@ static void parse_config_data(const char
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids;
     int pci_power_mgmt = 0;
     int pci_msitranslate = 1;
+    int pci_permissive = 0;
     int e;
 
     libxl_domain_create_info *c_info = &d_config->c_info;
@@ -991,6 +992,9 @@ skip_vfb:
     if (!xlu_cfg_get_long (config, "pci_power_mgmt", &l, 0))
         pci_power_mgmt = l;
 
+    if (!xlu_cfg_get_long (config, "pci_permissive", &l, 0))
+        pci_permissive = l;
+
     /* To be reworked (automatically enabled) once the auto ballooning
      * after guest starts is done (with PCI devices passed in). */
     if (c_info->type == LIBXL_DOMAIN_TYPE_PV) {
@@ -1010,6 +1014,7 @@ skip_vfb:
 
             pcidev->msitranslate = pci_msitranslate;
             pcidev->power_mgmt = pci_power_mgmt;
+            pcidev->permissive = pci_permissive;
             if (!xlu_pci_parse_bdf(config, pcidev, buf))
                 d_config->num_pcidevs++;
         }

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzN-0004Su-Bv; Fri, 06 Apr 2012 02:33:25 +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 1SFyzM-0004Qe-3T
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [193.109.254.147:15611] by server-8.bemta-14.messagelabs.com id
	7A/C6-23244-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1333679601!3483437!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15146 invoked from network); 6 Apr 2012 02:33:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0003NO-E9
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0008NJ-Cx
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Message-Id: <E1SFyzJ-0008NJ-Cx@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fixup error handling in
	libxl_send_trigger
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1333552218 -3600
# Node ID edbfed5c33897abb9ed29a7cbb03b44526424cad
# Parent  1687cd2e97e37972034f77d9952d10e9b52ac8a4
libxl: fixup error handling in libxl_send_trigger

xc_domain_send_trigger returns -1 and sets errno on failure so use
LIBXL__LOG_ERRNO not LIBXL__LOG_ERRNOVAL(rc).

Change the default case of the switch to set rc=-1,errno=EINVAL too.

Also we weren't actually returning the error code we'd decided on.

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


diff -r 1687cd2e97e3 -r edbfed5c3389 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 04 16:10:18 2012 +0100
@@ -3309,18 +3309,19 @@ int libxl_send_trigger(libxl_ctx *ctx, u
         rc = 0;
         break;
     default:
-        rc = EINVAL;
+        rc = -1;
+        errno = EINVAL;
         break;
     }
 
     if (rc != 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
-                            "Send trigger '%s' failed",
-                            libxl_trigger_to_string(trigger));
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "Send trigger '%s' failed",
+                         libxl_trigger_to_string(trigger));
         rc = ERROR_FAIL;
     }
 
-    return 0;
+    return rc;
 }
 
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzN-0004Su-Bv; Fri, 06 Apr 2012 02:33:25 +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 1SFyzM-0004Qe-3T
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [193.109.254.147:15611] by server-8.bemta-14.messagelabs.com id
	7A/C6-23244-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1333679601!3483437!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15146 invoked from network); 6 Apr 2012 02:33:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0003NO-E9
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0008NJ-Cx
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Message-Id: <E1SFyzJ-0008NJ-Cx@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fixup error handling in
	libxl_send_trigger
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1333552218 -3600
# Node ID edbfed5c33897abb9ed29a7cbb03b44526424cad
# Parent  1687cd2e97e37972034f77d9952d10e9b52ac8a4
libxl: fixup error handling in libxl_send_trigger

xc_domain_send_trigger returns -1 and sets errno on failure so use
LIBXL__LOG_ERRNO not LIBXL__LOG_ERRNOVAL(rc).

Change the default case of the switch to set rc=-1,errno=EINVAL too.

Also we weren't actually returning the error code we'd decided on.

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


diff -r 1687cd2e97e3 -r edbfed5c3389 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 04 16:06:42 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 04 16:10:18 2012 +0100
@@ -3309,18 +3309,19 @@ int libxl_send_trigger(libxl_ctx *ctx, u
         rc = 0;
         break;
     default:
-        rc = EINVAL;
+        rc = -1;
+        errno = EINVAL;
         break;
     }
 
     if (rc != 0) {
-        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
-                            "Send trigger '%s' failed",
-                            libxl_trigger_to_string(trigger));
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "Send trigger '%s' failed",
+                         libxl_trigger_to_string(trigger));
         rc = ERROR_FAIL;
     }
 
-    return 0;
+    return rc;
 }
 
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzO-0004VI-RP; Fri, 06 Apr 2012 02:33:26 +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 1SFyzM-0004RB-Pi
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:25 +0000
Received: from [85.158.138.51:11119] by server-5.bemta-3.messagelabs.com id
	16/DD-24278-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1333679600!20987876!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9786 invoked from network); 6 Apr 2012 02:33:21 -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;
	6 Apr 2012 02:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0003NI-Ay
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0008Mm-8i
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Message-Id: <E1SFyzI-0008Mm-8i@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Move bdf parsing into libxlu
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1333552002 -3600
# Node ID ce20aaa97da645963458911f08e591511e15c55d
# Parent  c2954b4acd69deae140328772028c8ef45818ae4
libxl: Move bdf parsing into libxlu

Config parsing functions do not properly belong in libxl.  Move them into
libxlu so that others can use them or not as they see fit.

No functional changes.  One side-effect was making public a private libxl
utility function which just set the elements of a structure from the  function
arguments passed in.

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


diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 04 16:06:42 2012 +0100
@@ -57,7 +57,7 @@ LIBXL_OBJS += _libxl_types.o libxl_flask
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
 LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
-	libxlu_disk_l.o libxlu_disk.o
+	libxlu_disk_l.o libxlu_disk.o libxlu_pci.o
 $(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 
 CLIENTS = xl testidl
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 04 16:06:42 2012 +0100
@@ -653,13 +653,6 @@ int libxl_device_pci_destroy(libxl_ctx *
 libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, uint32_t domid, int *num);
 
 /*
- * Parse a PCI BDF into a PCI device structure.
- */
-int libxl_device_pci_parse_bdf(libxl_ctx *ctx,
-                               libxl_device_pci *pcidev,
-                               const char *str);
-
-/*
  * Similar to libxl_device_pci_list but returns all devices which
  * could be assigned to a domain (i.e. are bound to the backend
  * driver) but are not currently.
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/libxl_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -34,9 +34,9 @@ static unsigned int pcidev_encode_bdf(li
     return value;
 }
 
-static int pcidev_init(libxl_device_pci *pcidev, unsigned int domain,
-                          unsigned int bus, unsigned int dev,
-                          unsigned int func, unsigned int vdevfn)
+static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
+                               unsigned int bus, unsigned int dev,
+                               unsigned int func, unsigned int vdevfn)
 {
     pcidev->domain = domain;
     pcidev->bus = bus;
@@ -46,149 +46,6 @@ static int pcidev_init(libxl_device_pci 
     return 0;
 }
 
-static int hex_convert(const char *str, unsigned int *val, unsigned int mask)
-{
-    unsigned long ret;
-    char *end;
-
-    ret = strtoul(str, &end, 16);
-    if ( end == str || *end != '\0' )
-        return -1;
-    if ( ret & ~mask )
-        return -1;
-    *val = (unsigned int)ret & mask;
-    return 0;
-}
-
-#define STATE_DOMAIN    0
-#define STATE_BUS       1
-#define STATE_DEV       2
-#define STATE_FUNC      3
-#define STATE_VSLOT     4
-#define STATE_OPTIONS_K 6
-#define STATE_OPTIONS_V 7
-#define STATE_TERMINAL  8
-int libxl_device_pci_parse_bdf(libxl_ctx *ctx, libxl_device_pci *pcidev, const char *str)
-{
-    unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
-    char *buf2, *tok, *ptr, *end, *optkey = NULL;
-
-    if ( NULL == (buf2 = ptr = strdup(str)) )
-        return ERROR_NOMEM;
-
-    for(tok = ptr, end = ptr + strlen(ptr) + 1; ptr < end; ptr++) {
-        switch(state) {
-        case STATE_DOMAIN:
-            if ( *ptr == ':' ) {
-                state = STATE_BUS;
-                *ptr = '\0';
-                if ( hex_convert(tok, &dom, 0xffff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_BUS:
-            if ( *ptr == ':' ) {
-                state = STATE_DEV;
-                *ptr = '\0';
-                if ( hex_convert(tok, &bus, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }else if ( *ptr == '.' ) {
-                state = STATE_FUNC;
-                *ptr = '\0';
-                if ( dom & ~0xff )
-                    goto parse_error;
-                bus = dom;
-                dom = 0;
-                if ( hex_convert(tok, &dev, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_DEV:
-            if ( *ptr == '.' ) {
-                state = STATE_FUNC;
-                *ptr = '\0';
-                if ( hex_convert(tok, &dev, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_FUNC:
-            if ( *ptr == '\0' || *ptr == '@' || *ptr == ',' ) {
-                switch( *ptr ) {
-                case '\0':
-                    state = STATE_TERMINAL;
-                    break;
-                case '@':
-                    state = STATE_VSLOT;
-                    break;
-                case ',':
-                    state = STATE_OPTIONS_K;
-                    break;
-                }
-                *ptr = '\0';
-                if ( !strcmp(tok, "*") ) {
-                    pcidev->vfunc_mask = LIBXL_PCI_FUNC_ALL;
-                }else{
-                    if ( hex_convert(tok, &func, 0x7) )
-                        goto parse_error;
-                    pcidev->vfunc_mask = (1 << 0);
-                }
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_VSLOT:
-            if ( *ptr == '\0' || *ptr == ',' ) {
-                state = ( *ptr == ',' ) ? STATE_OPTIONS_K : STATE_TERMINAL;
-                *ptr = '\0';
-                if ( hex_convert(tok, &vslot, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_OPTIONS_K:
-            if ( *ptr == '=' ) {
-                state = STATE_OPTIONS_V;
-                *ptr = '\0';
-                optkey = tok;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_OPTIONS_V:
-            if ( *ptr == ',' || *ptr == '\0' ) {
-                state = (*ptr == ',') ? STATE_OPTIONS_K : STATE_TERMINAL;
-                *ptr = '\0';
-                if ( !strcmp(optkey, "msitranslate") ) {
-                    pcidev->msitranslate = atoi(tok);
-                }else if ( !strcmp(optkey, "power_mgmt") ) {
-                    pcidev->power_mgmt = atoi(tok);
-                }else{
-                    LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
-                           "Unknown PCI BDF option: %s", optkey);
-                }
-                tok = ptr + 1;
-            }
-        default:
-            break;
-        }
-    }
-
-    free(buf2);
-
-    if ( tok != ptr || state != STATE_TERMINAL )
-        goto parse_error;
-
-    pcidev_init(pcidev, dom, bus, dev, func, vslot << 3);
-
-    return 0;
-
-parse_error:
-    return ERROR_INVAL;
-}
-
 static void libxl_create_pci_backend_device(libxl__gc *gc, flexarray_t *back, int num, libxl_device_pci *pcidev)
 {
     flexarray_append(back, libxl__sprintf(gc, "key-%d", num));
@@ -436,7 +293,7 @@ static int get_all_assigned_devices(libx
                     *list = realloc(*list, sizeof(libxl_device_pci) * ((*num) + 1));
                     if (*list == NULL)
                         return ERROR_NOMEM;
-                    pcidev_init(*list + *num, dom, bus, dev, func, 0);
+                    pcidev_struct_fill(*list + *num, dom, bus, dev, func, 0);
                     (*num)++;
                 }
             }
@@ -507,7 +364,7 @@ libxl_device_pci *libxl_device_pci_list_
         new = pcidevs + *num;
 
         memset(new, 0, sizeof(*new));
-        pcidev_init(new, dom, bus, dev, func, 0);
+        pcidev_struct_fill(new, dom, bus, dev, func, 0);
         (*num)++;
     }
 
@@ -1086,7 +943,7 @@ static void libxl__device_pci_from_xs_be
     if (s)
         vdevfn = strtol(s, (char **) NULL, 16);
 
-    pcidev_init(pci, domain, bus, dev, func, vdevfn);
+    pcidev_struct_fill(pci, domain, bus, dev, func, vdevfn);
 
     s = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/opts-%d", be_path, nr));
     if (s) {
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxlu_pci.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxlu_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -0,0 +1,172 @@
+#include "libxl_osdeps.h" /* must come before any other headers */
+#include "libxlu_internal.h"
+#include "libxlu_disk_l.h"
+#include "libxlu_disk_i.h"
+#include "libxlu_cfg_i.h"
+
+
+#define XLU__PCI_ERR(_c, _x, _a...) \
+    if((_c) && (_c)->report) fprintf((_c)->report, _x, ##_a)
+
+static int hex_convert(const char *str, unsigned int *val, unsigned int mask)
+{
+    unsigned long ret;
+    char *end;
+
+    ret = strtoul(str, &end, 16);
+    if ( end == str || *end != '\0' )
+        return -1;
+    if ( ret & ~mask )
+        return -1;
+    *val = (unsigned int)ret & mask;
+    return 0;
+}
+
+static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
+                               unsigned int bus, unsigned int dev,
+                               unsigned int func, unsigned int vdevfn)
+{
+    pcidev->domain = domain;
+    pcidev->bus = bus;
+    pcidev->dev = dev;
+    pcidev->func = func;
+    pcidev->vdevfn = vdevfn;
+    return 0;
+}
+
+#define STATE_DOMAIN    0
+#define STATE_BUS       1
+#define STATE_DEV       2
+#define STATE_FUNC      3
+#define STATE_VSLOT     4
+#define STATE_OPTIONS_K 6
+#define STATE_OPTIONS_V 7
+#define STATE_TERMINAL  8
+int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
+{
+    unsigned state = STATE_DOMAIN;
+    unsigned dom, bus, dev, func, vslot = 0;
+    char *buf2, *tok, *ptr, *end, *optkey = NULL;
+
+    if ( NULL == (buf2 = ptr = strdup(str)) )
+        return ERROR_NOMEM;
+
+    for(tok = ptr, end = ptr + strlen(ptr) + 1; ptr < end; ptr++) {
+        switch(state) {
+        case STATE_DOMAIN:
+            if ( *ptr == ':' ) {
+                state = STATE_BUS;
+                *ptr = '\0';
+                if ( hex_convert(tok, &dom, 0xffff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_BUS:
+            if ( *ptr == ':' ) {
+                state = STATE_DEV;
+                *ptr = '\0';
+                if ( hex_convert(tok, &bus, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }else if ( *ptr == '.' ) {
+                state = STATE_FUNC;
+                *ptr = '\0';
+                if ( dom & ~0xff )
+                    goto parse_error;
+                bus = dom;
+                dom = 0;
+                if ( hex_convert(tok, &dev, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_DEV:
+            if ( *ptr == '.' ) {
+                state = STATE_FUNC;
+                *ptr = '\0';
+                if ( hex_convert(tok, &dev, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_FUNC:
+            if ( *ptr == '\0' || *ptr == '@' || *ptr == ',' ) {
+                switch( *ptr ) {
+                case '\0':
+                    state = STATE_TERMINAL;
+                    break;
+                case '@':
+                    state = STATE_VSLOT;
+                    break;
+                case ',':
+                    state = STATE_OPTIONS_K;
+                    break;
+                }
+                *ptr = '\0';
+                if ( !strcmp(tok, "*") ) {
+                    pcidev->vfunc_mask = LIBXL_PCI_FUNC_ALL;
+                }else{
+                    if ( hex_convert(tok, &func, 0x7) )
+                        goto parse_error;
+                    pcidev->vfunc_mask = (1 << 0);
+                }
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_VSLOT:
+            if ( *ptr == '\0' || *ptr == ',' ) {
+                state = ( *ptr == ',' ) ? STATE_OPTIONS_K : STATE_TERMINAL;
+                *ptr = '\0';
+                if ( hex_convert(tok, &vslot, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_OPTIONS_K:
+            if ( *ptr == '=' ) {
+                state = STATE_OPTIONS_V;
+                *ptr = '\0';
+                optkey = tok;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_OPTIONS_V:
+            if ( *ptr == ',' || *ptr == '\0' ) {
+                state = (*ptr == ',') ? STATE_OPTIONS_K : STATE_TERMINAL;
+                *ptr = '\0';
+                if ( !strcmp(optkey, "msitranslate") ) {
+                    pcidev->msitranslate = atoi(tok);
+                }else if ( !strcmp(optkey, "power_mgmt") ) {
+                    pcidev->power_mgmt = atoi(tok);
+                }else{
+                    XLU__PCI_ERR(cfg, "Unknown PCI BDF option: %s", optkey);
+                }
+                tok = ptr + 1;
+            }
+        default:
+            break;
+        }
+    }
+
+    free(buf2);
+
+    if ( tok != ptr || state != STATE_TERMINAL )
+        goto parse_error;
+
+    /* Just a pretty way to fill in the values */
+    pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
+
+    return 0;
+
+parse_error:
+    return ERROR_INVAL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxlutil.h
--- a/tools/libxl/libxlutil.h	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/libxlutil.h	Wed Apr 04 16:06:42 2012 +0100
@@ -88,6 +88,11 @@ int xlu_disk_parse(XLU_Config *cfg, int 
    * resulting disk struct is used with libxl.
    */
 
+/*
+ * PCI specification parsing
+ */
+int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str);
+
 
 #endif /* LIBXLUTIL_H */
 
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:06:42 2012 +0100
@@ -1010,7 +1010,7 @@ skip_vfb:
 
             pcidev->msitranslate = pci_msitranslate;
             pcidev->power_mgmt = pci_power_mgmt;
-            if (!libxl_device_pci_parse_bdf(ctx, pcidev, buf))
+            if (!xlu_pci_parse_bdf(config, pcidev, buf))
                 d_config->num_pcidevs++;
         }
         if (d_config->num_pcidevs && c_info->type == LIBXL_DOMAIN_TYPE_PV)
@@ -2253,11 +2253,16 @@ int main_pcilist(int argc, char **argv)
 static void pcidetach(const char *dom, const char *bdf, int force)
 {
     libxl_device_pci pcidev;
+    XLU_Config *config;
 
     find_domain(dom);
 
     memset(&pcidev, 0x00, sizeof(pcidev));
-    if (libxl_device_pci_parse_bdf(ctx, &pcidev, bdf)) {
+    
+    config = xlu_cfg_init(stderr, "command line");
+    if (!config) { perror("xlu_cfg_inig"); exit(-1); }
+
+    if (xlu_pci_parse_bdf(config, &pcidev, bdf)) {
         fprintf(stderr, "pci-detach: malformed BDF specification \"%s\"\n", bdf);
         exit(2);
     }
@@ -2293,11 +2298,16 @@ int main_pcidetach(int argc, char **argv
 static void pciattach(const char *dom, const char *bdf, const char *vs)
 {
     libxl_device_pci pcidev;
+    XLU_Config *config;
 
     find_domain(dom);
 
     memset(&pcidev, 0x00, sizeof(pcidev));
-    if (libxl_device_pci_parse_bdf(ctx, &pcidev, bdf)) {
+
+    config = xlu_cfg_init(stderr, "command line");
+    if (!config) { perror("xlu_cfg_inig"); exit(-1); }
+
+    if (xlu_pci_parse_bdf(config, &pcidev, bdf)) {
         fprintf(stderr, "pci-attach: malformed BDF specification \"%s\"\n", bdf);
         exit(2);
     }
diff -r c2954b4acd69 -r ce20aaa97da6 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c	Wed Apr 04 16:06:42 2012 +0100
@@ -40,6 +40,7 @@
 
 #include <libxl.h>
 #include <libxl_utils.h>
+#include <libxlutil.h>
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
@@ -556,7 +557,7 @@ static PyObject *pyxl_pci_parse(XlObject
         return NULL;
     }
 
-    if ( libxl_device_pci_parse_bdf(self->ctx, &pci->obj, str) ) {
+    if ( xlu_pci_parse_bdf(NULL, &pci->obj, str) ) {
         PyErr_SetString(xl_error_obj, "cannot parse pci device spec (BDF)");
         Py_DECREF(pci);
         return NULL;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzO-0004VI-RP; Fri, 06 Apr 2012 02:33:26 +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 1SFyzM-0004RB-Pi
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:25 +0000
Received: from [85.158.138.51:11119] by server-5.bemta-3.messagelabs.com id
	16/DD-24278-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1333679600!20987876!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9786 invoked from network); 6 Apr 2012 02:33:21 -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;
	6 Apr 2012 02:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0003NI-Ay
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzI-0008Mm-8i
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:20 +0000
Message-Id: <E1SFyzI-0008Mm-8i@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Move bdf parsing into libxlu
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1333552002 -3600
# Node ID ce20aaa97da645963458911f08e591511e15c55d
# Parent  c2954b4acd69deae140328772028c8ef45818ae4
libxl: Move bdf parsing into libxlu

Config parsing functions do not properly belong in libxl.  Move them into
libxlu so that others can use them or not as they see fit.

No functional changes.  One side-effect was making public a private libxl
utility function which just set the elements of a structure from the  function
arguments passed in.

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


diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 04 16:06:42 2012 +0100
@@ -57,7 +57,7 @@ LIBXL_OBJS += _libxl_types.o libxl_flask
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
 LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
-	libxlu_disk_l.o libxlu_disk.o
+	libxlu_disk_l.o libxlu_disk.o libxlu_pci.o
 $(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 
 CLIENTS = xl testidl
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 04 16:06:42 2012 +0100
@@ -653,13 +653,6 @@ int libxl_device_pci_destroy(libxl_ctx *
 libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, uint32_t domid, int *num);
 
 /*
- * Parse a PCI BDF into a PCI device structure.
- */
-int libxl_device_pci_parse_bdf(libxl_ctx *ctx,
-                               libxl_device_pci *pcidev,
-                               const char *str);
-
-/*
  * Similar to libxl_device_pci_list but returns all devices which
  * could be assigned to a domain (i.e. are bound to the backend
  * driver) but are not currently.
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/libxl_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -34,9 +34,9 @@ static unsigned int pcidev_encode_bdf(li
     return value;
 }
 
-static int pcidev_init(libxl_device_pci *pcidev, unsigned int domain,
-                          unsigned int bus, unsigned int dev,
-                          unsigned int func, unsigned int vdevfn)
+static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
+                               unsigned int bus, unsigned int dev,
+                               unsigned int func, unsigned int vdevfn)
 {
     pcidev->domain = domain;
     pcidev->bus = bus;
@@ -46,149 +46,6 @@ static int pcidev_init(libxl_device_pci 
     return 0;
 }
 
-static int hex_convert(const char *str, unsigned int *val, unsigned int mask)
-{
-    unsigned long ret;
-    char *end;
-
-    ret = strtoul(str, &end, 16);
-    if ( end == str || *end != '\0' )
-        return -1;
-    if ( ret & ~mask )
-        return -1;
-    *val = (unsigned int)ret & mask;
-    return 0;
-}
-
-#define STATE_DOMAIN    0
-#define STATE_BUS       1
-#define STATE_DEV       2
-#define STATE_FUNC      3
-#define STATE_VSLOT     4
-#define STATE_OPTIONS_K 6
-#define STATE_OPTIONS_V 7
-#define STATE_TERMINAL  8
-int libxl_device_pci_parse_bdf(libxl_ctx *ctx, libxl_device_pci *pcidev, const char *str)
-{
-    unsigned state = STATE_DOMAIN;
-    unsigned dom, bus, dev, func, vslot = 0;
-    char *buf2, *tok, *ptr, *end, *optkey = NULL;
-
-    if ( NULL == (buf2 = ptr = strdup(str)) )
-        return ERROR_NOMEM;
-
-    for(tok = ptr, end = ptr + strlen(ptr) + 1; ptr < end; ptr++) {
-        switch(state) {
-        case STATE_DOMAIN:
-            if ( *ptr == ':' ) {
-                state = STATE_BUS;
-                *ptr = '\0';
-                if ( hex_convert(tok, &dom, 0xffff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_BUS:
-            if ( *ptr == ':' ) {
-                state = STATE_DEV;
-                *ptr = '\0';
-                if ( hex_convert(tok, &bus, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }else if ( *ptr == '.' ) {
-                state = STATE_FUNC;
-                *ptr = '\0';
-                if ( dom & ~0xff )
-                    goto parse_error;
-                bus = dom;
-                dom = 0;
-                if ( hex_convert(tok, &dev, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_DEV:
-            if ( *ptr == '.' ) {
-                state = STATE_FUNC;
-                *ptr = '\0';
-                if ( hex_convert(tok, &dev, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_FUNC:
-            if ( *ptr == '\0' || *ptr == '@' || *ptr == ',' ) {
-                switch( *ptr ) {
-                case '\0':
-                    state = STATE_TERMINAL;
-                    break;
-                case '@':
-                    state = STATE_VSLOT;
-                    break;
-                case ',':
-                    state = STATE_OPTIONS_K;
-                    break;
-                }
-                *ptr = '\0';
-                if ( !strcmp(tok, "*") ) {
-                    pcidev->vfunc_mask = LIBXL_PCI_FUNC_ALL;
-                }else{
-                    if ( hex_convert(tok, &func, 0x7) )
-                        goto parse_error;
-                    pcidev->vfunc_mask = (1 << 0);
-                }
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_VSLOT:
-            if ( *ptr == '\0' || *ptr == ',' ) {
-                state = ( *ptr == ',' ) ? STATE_OPTIONS_K : STATE_TERMINAL;
-                *ptr = '\0';
-                if ( hex_convert(tok, &vslot, 0xff) )
-                    goto parse_error;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_OPTIONS_K:
-            if ( *ptr == '=' ) {
-                state = STATE_OPTIONS_V;
-                *ptr = '\0';
-                optkey = tok;
-                tok = ptr + 1;
-            }
-            break;
-        case STATE_OPTIONS_V:
-            if ( *ptr == ',' || *ptr == '\0' ) {
-                state = (*ptr == ',') ? STATE_OPTIONS_K : STATE_TERMINAL;
-                *ptr = '\0';
-                if ( !strcmp(optkey, "msitranslate") ) {
-                    pcidev->msitranslate = atoi(tok);
-                }else if ( !strcmp(optkey, "power_mgmt") ) {
-                    pcidev->power_mgmt = atoi(tok);
-                }else{
-                    LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
-                           "Unknown PCI BDF option: %s", optkey);
-                }
-                tok = ptr + 1;
-            }
-        default:
-            break;
-        }
-    }
-
-    free(buf2);
-
-    if ( tok != ptr || state != STATE_TERMINAL )
-        goto parse_error;
-
-    pcidev_init(pcidev, dom, bus, dev, func, vslot << 3);
-
-    return 0;
-
-parse_error:
-    return ERROR_INVAL;
-}
-
 static void libxl_create_pci_backend_device(libxl__gc *gc, flexarray_t *back, int num, libxl_device_pci *pcidev)
 {
     flexarray_append(back, libxl__sprintf(gc, "key-%d", num));
@@ -436,7 +293,7 @@ static int get_all_assigned_devices(libx
                     *list = realloc(*list, sizeof(libxl_device_pci) * ((*num) + 1));
                     if (*list == NULL)
                         return ERROR_NOMEM;
-                    pcidev_init(*list + *num, dom, bus, dev, func, 0);
+                    pcidev_struct_fill(*list + *num, dom, bus, dev, func, 0);
                     (*num)++;
                 }
             }
@@ -507,7 +364,7 @@ libxl_device_pci *libxl_device_pci_list_
         new = pcidevs + *num;
 
         memset(new, 0, sizeof(*new));
-        pcidev_init(new, dom, bus, dev, func, 0);
+        pcidev_struct_fill(new, dom, bus, dev, func, 0);
         (*num)++;
     }
 
@@ -1086,7 +943,7 @@ static void libxl__device_pci_from_xs_be
     if (s)
         vdevfn = strtol(s, (char **) NULL, 16);
 
-    pcidev_init(pci, domain, bus, dev, func, vdevfn);
+    pcidev_struct_fill(pci, domain, bus, dev, func, vdevfn);
 
     s = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/opts-%d", be_path, nr));
     if (s) {
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxlu_pci.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxlu_pci.c	Wed Apr 04 16:06:42 2012 +0100
@@ -0,0 +1,172 @@
+#include "libxl_osdeps.h" /* must come before any other headers */
+#include "libxlu_internal.h"
+#include "libxlu_disk_l.h"
+#include "libxlu_disk_i.h"
+#include "libxlu_cfg_i.h"
+
+
+#define XLU__PCI_ERR(_c, _x, _a...) \
+    if((_c) && (_c)->report) fprintf((_c)->report, _x, ##_a)
+
+static int hex_convert(const char *str, unsigned int *val, unsigned int mask)
+{
+    unsigned long ret;
+    char *end;
+
+    ret = strtoul(str, &end, 16);
+    if ( end == str || *end != '\0' )
+        return -1;
+    if ( ret & ~mask )
+        return -1;
+    *val = (unsigned int)ret & mask;
+    return 0;
+}
+
+static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
+                               unsigned int bus, unsigned int dev,
+                               unsigned int func, unsigned int vdevfn)
+{
+    pcidev->domain = domain;
+    pcidev->bus = bus;
+    pcidev->dev = dev;
+    pcidev->func = func;
+    pcidev->vdevfn = vdevfn;
+    return 0;
+}
+
+#define STATE_DOMAIN    0
+#define STATE_BUS       1
+#define STATE_DEV       2
+#define STATE_FUNC      3
+#define STATE_VSLOT     4
+#define STATE_OPTIONS_K 6
+#define STATE_OPTIONS_V 7
+#define STATE_TERMINAL  8
+int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str)
+{
+    unsigned state = STATE_DOMAIN;
+    unsigned dom, bus, dev, func, vslot = 0;
+    char *buf2, *tok, *ptr, *end, *optkey = NULL;
+
+    if ( NULL == (buf2 = ptr = strdup(str)) )
+        return ERROR_NOMEM;
+
+    for(tok = ptr, end = ptr + strlen(ptr) + 1; ptr < end; ptr++) {
+        switch(state) {
+        case STATE_DOMAIN:
+            if ( *ptr == ':' ) {
+                state = STATE_BUS;
+                *ptr = '\0';
+                if ( hex_convert(tok, &dom, 0xffff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_BUS:
+            if ( *ptr == ':' ) {
+                state = STATE_DEV;
+                *ptr = '\0';
+                if ( hex_convert(tok, &bus, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }else if ( *ptr == '.' ) {
+                state = STATE_FUNC;
+                *ptr = '\0';
+                if ( dom & ~0xff )
+                    goto parse_error;
+                bus = dom;
+                dom = 0;
+                if ( hex_convert(tok, &dev, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_DEV:
+            if ( *ptr == '.' ) {
+                state = STATE_FUNC;
+                *ptr = '\0';
+                if ( hex_convert(tok, &dev, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_FUNC:
+            if ( *ptr == '\0' || *ptr == '@' || *ptr == ',' ) {
+                switch( *ptr ) {
+                case '\0':
+                    state = STATE_TERMINAL;
+                    break;
+                case '@':
+                    state = STATE_VSLOT;
+                    break;
+                case ',':
+                    state = STATE_OPTIONS_K;
+                    break;
+                }
+                *ptr = '\0';
+                if ( !strcmp(tok, "*") ) {
+                    pcidev->vfunc_mask = LIBXL_PCI_FUNC_ALL;
+                }else{
+                    if ( hex_convert(tok, &func, 0x7) )
+                        goto parse_error;
+                    pcidev->vfunc_mask = (1 << 0);
+                }
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_VSLOT:
+            if ( *ptr == '\0' || *ptr == ',' ) {
+                state = ( *ptr == ',' ) ? STATE_OPTIONS_K : STATE_TERMINAL;
+                *ptr = '\0';
+                if ( hex_convert(tok, &vslot, 0xff) )
+                    goto parse_error;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_OPTIONS_K:
+            if ( *ptr == '=' ) {
+                state = STATE_OPTIONS_V;
+                *ptr = '\0';
+                optkey = tok;
+                tok = ptr + 1;
+            }
+            break;
+        case STATE_OPTIONS_V:
+            if ( *ptr == ',' || *ptr == '\0' ) {
+                state = (*ptr == ',') ? STATE_OPTIONS_K : STATE_TERMINAL;
+                *ptr = '\0';
+                if ( !strcmp(optkey, "msitranslate") ) {
+                    pcidev->msitranslate = atoi(tok);
+                }else if ( !strcmp(optkey, "power_mgmt") ) {
+                    pcidev->power_mgmt = atoi(tok);
+                }else{
+                    XLU__PCI_ERR(cfg, "Unknown PCI BDF option: %s", optkey);
+                }
+                tok = ptr + 1;
+            }
+        default:
+            break;
+        }
+    }
+
+    free(buf2);
+
+    if ( tok != ptr || state != STATE_TERMINAL )
+        goto parse_error;
+
+    /* Just a pretty way to fill in the values */
+    pcidev_struct_fill(pcidev, dom, bus, dev, func, vslot << 3);
+
+    return 0;
+
+parse_error:
+    return ERROR_INVAL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/libxlutil.h
--- a/tools/libxl/libxlutil.h	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/libxlutil.h	Wed Apr 04 16:06:42 2012 +0100
@@ -88,6 +88,11 @@ int xlu_disk_parse(XLU_Config *cfg, int 
    * resulting disk struct is used with libxl.
    */
 
+/*
+ * PCI specification parsing
+ */
+int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str);
+
 
 #endif /* LIBXLUTIL_H */
 
diff -r c2954b4acd69 -r ce20aaa97da6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 04 16:06:42 2012 +0100
@@ -1010,7 +1010,7 @@ skip_vfb:
 
             pcidev->msitranslate = pci_msitranslate;
             pcidev->power_mgmt = pci_power_mgmt;
-            if (!libxl_device_pci_parse_bdf(ctx, pcidev, buf))
+            if (!xlu_pci_parse_bdf(config, pcidev, buf))
                 d_config->num_pcidevs++;
         }
         if (d_config->num_pcidevs && c_info->type == LIBXL_DOMAIN_TYPE_PV)
@@ -2253,11 +2253,16 @@ int main_pcilist(int argc, char **argv)
 static void pcidetach(const char *dom, const char *bdf, int force)
 {
     libxl_device_pci pcidev;
+    XLU_Config *config;
 
     find_domain(dom);
 
     memset(&pcidev, 0x00, sizeof(pcidev));
-    if (libxl_device_pci_parse_bdf(ctx, &pcidev, bdf)) {
+    
+    config = xlu_cfg_init(stderr, "command line");
+    if (!config) { perror("xlu_cfg_inig"); exit(-1); }
+
+    if (xlu_pci_parse_bdf(config, &pcidev, bdf)) {
         fprintf(stderr, "pci-detach: malformed BDF specification \"%s\"\n", bdf);
         exit(2);
     }
@@ -2293,11 +2298,16 @@ int main_pcidetach(int argc, char **argv
 static void pciattach(const char *dom, const char *bdf, const char *vs)
 {
     libxl_device_pci pcidev;
+    XLU_Config *config;
 
     find_domain(dom);
 
     memset(&pcidev, 0x00, sizeof(pcidev));
-    if (libxl_device_pci_parse_bdf(ctx, &pcidev, bdf)) {
+
+    config = xlu_cfg_init(stderr, "command line");
+    if (!config) { perror("xlu_cfg_inig"); exit(-1); }
+
+    if (xlu_pci_parse_bdf(config, &pcidev, bdf)) {
         fprintf(stderr, "pci-attach: malformed BDF specification \"%s\"\n", bdf);
         exit(2);
     }
diff -r c2954b4acd69 -r ce20aaa97da6 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Wed Apr 04 11:09:15 2012 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c	Wed Apr 04 16:06:42 2012 +0100
@@ -40,6 +40,7 @@
 
 #include <libxl.h>
 #include <libxl_utils.h>
+#include <libxlutil.h>
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
@@ -556,7 +557,7 @@ static PyObject *pyxl_pci_parse(XlObject
         return NULL;
     }
 
-    if ( libxl_device_pci_parse_bdf(self->ctx, &pci->obj, str) ) {
+    if ( xlu_pci_parse_bdf(NULL, &pci->obj, str) ) {
         PyErr_SetString(xl_error_obj, "cannot parse pci device spec (BDF)");
         Py_DECREF(pci);
         return NULL;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzO-0004V9-Ot; Fri, 06 Apr 2012 02:33:26 +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 1SFyzM-0004QM-Sl
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:25 +0000
Received: from [193.109.254.147:15647] by server-6.bemta-14.messagelabs.com id
	EB/17-02047-4F55E7F4; Fri, 06 Apr 2012 02:33:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1333679602!3486214!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2993 invoked from network); 6 Apr 2012 02:33:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0003NR-VX
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0008NY-Tq
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Message-Id: <E1SFyzJ-0008NY-Tq@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: check for as86, ld86,
	bcc and iasl
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329928670 -3600
# Node ID 83d3b4e2eb16c7b718f970ffacf62bf8755c6623
# Parent  edbfed5c33897abb9ed29a7cbb03b44526424cad
autoconf: check for as86, ld86, bcc and iasl

Check for this tools, and set the proper paths on config/Tool.mk.

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


diff -r edbfed5c3389 -r 83d3b4e2eb16 config/Tools.mk.in
--- a/config/Tools.mk.in	Wed Apr 04 16:10:18 2012 +0100
+++ b/config/Tools.mk.in	Wed Feb 22 17:37:50 2012 +0100
@@ -15,6 +15,10 @@ CURL_CONFIG         := @CURL@
 XML2_CONFIG         := @XML@
 BASH                := @BASH@
 XGETTTEXT           := @XGETTEXT@
+AS86                := @AS86@
+LD86                := @LD86@
+BCC                 := @BCC@
+IASL                := @IASL@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
diff -r edbfed5c3389 -r 83d3b4e2eb16 tools/configure
--- a/tools/configure	Wed Apr 04 16:10:18 2012 +0100
+++ b/tools/configure	Wed Feb 22 17:37:50 2012 +0100
@@ -633,6 +633,10 @@ INSTALL_PROGRAM
 SET_MAKE
 LN_S
 SED
+IASL
+BCC
+LD86
+AS86
 XGETTEXT
 BASH
 XML
@@ -744,6 +748,10 @@ CURL
 XML
 BASH
 XGETTEXT
+AS86
+LD86
+BCC
+IASL
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
@@ -1400,6 +1408,10 @@ Some influential environment variables:
   XML         Path to xml2-config tool
   BASH        Path to bash shell
   XGETTEXT    Path to xgetttext tool
+  AS86        Path to as86 tool
+  LD86        Path to ld86 tool
+  BCC         Path to bcc tool
+  IASL        Path to iasl tool
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
               directories to add to pkg-config's search path
@@ -4155,6 +4167,10 @@ LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPE
 
 
 
+
+
+
+
 # Checks for programs.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
@@ -6293,6 +6309,186 @@ if test x"${XGETTEXT}" == x"no"
 then
     as_fn_error $? "Unable to find xgettext, please install xgettext" "$LINENO" 5
 fi
+# Extract the first word of "as86", so it can be a program name with args.
+set dummy as86; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_AS86+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $AS86 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AS86="$AS86" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_AS86="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_AS86" && ac_cv_path_AS86="no"
+  ;;
+esac
+fi
+AS86=$ac_cv_path_AS86
+if test -n "$AS86"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS86" >&5
+$as_echo "$AS86" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${AS86}" == x"no"
+then
+    as_fn_error $? "Unable to find as86, please install as86" "$LINENO" 5
+fi
+# Extract the first word of "ld86", so it can be a program name with args.
+set dummy ld86; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_LD86+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LD86 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LD86="$LD86" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_LD86="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_LD86" && ac_cv_path_LD86="no"
+  ;;
+esac
+fi
+LD86=$ac_cv_path_LD86
+if test -n "$LD86"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD86" >&5
+$as_echo "$LD86" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${LD86}" == x"no"
+then
+    as_fn_error $? "Unable to find ld86, please install ld86" "$LINENO" 5
+fi
+# Extract the first word of "bcc", so it can be a program name with args.
+set dummy bcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_BCC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BCC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BCC="$BCC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BCC="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BCC" && ac_cv_path_BCC="no"
+  ;;
+esac
+fi
+BCC=$ac_cv_path_BCC
+if test -n "$BCC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BCC" >&5
+$as_echo "$BCC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BCC}" == x"no"
+then
+    as_fn_error $? "Unable to find bcc, please install bcc" "$LINENO" 5
+fi
+# Extract the first word of "iasl", so it can be a program name with args.
+set dummy iasl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_IASL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $IASL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_IASL="$IASL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_IASL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_IASL" && ac_cv_path_IASL="no"
+  ;;
+esac
+fi
+IASL=$ac_cv_path_IASL
+if test -n "$IASL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IASL" >&5
+$as_echo "$IASL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${IASL}" == x"no"
+then
+    as_fn_error $? "Unable to find iasl, please install iasl" "$LINENO" 5
+fi
 
 ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
 if test "x$ac_cv_header_uuid_uuid_h" = x""yes; then :
diff -r edbfed5c3389 -r 83d3b4e2eb16 tools/configure.ac
--- a/tools/configure.ac	Wed Apr 04 16:10:18 2012 +0100
+++ b/tools/configure.ac	Wed Feb 22 17:37:50 2012 +0100
@@ -64,6 +64,10 @@ AC_ARG_VAR([CURL], [Path to curl-config 
 AC_ARG_VAR([XML], [Path to xml2-config tool])
 AC_ARG_VAR([BASH], [Path to bash shell])
 AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool])
+AC_ARG_VAR([AS86], [Path to as86 tool])
+AC_ARG_VAR([LD86], [Path to ld86 tool])
+AC_ARG_VAR([BCC], [Path to bcc tool])
+AC_ARG_VAR([IASL], [Path to iasl tool])
 
 # Checks for programs.
 AC_PROG_SED
@@ -96,6 +100,10 @@ AS_IF([test "x$pythontools" = "xy"], [
     AX_CHECK_PYTHON_DEVEL()
 ])
 AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
+AX_PATH_PROG_OR_FAIL([AS86], [as86])
+AX_PATH_PROG_OR_FAIL([LD86], [ld86])
+AX_PATH_PROG_OR_FAIL([BCC], [bcc])
+AX_PATH_PROG_OR_FAIL([IASL], [iasl])
 AX_CHECK_UUID
 AX_CHECK_CURSES
 PKG_CHECK_MODULES(glib, glib-2.0)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzO-0004V9-Ot; Fri, 06 Apr 2012 02:33:26 +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 1SFyzM-0004QM-Sl
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:25 +0000
Received: from [193.109.254.147:15647] by server-6.bemta-14.messagelabs.com id
	EB/17-02047-4F55E7F4; Fri, 06 Apr 2012 02:33:24 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1333679602!3486214!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2993 invoked from network); 6 Apr 2012 02:33:23 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0003NR-VX
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzJ-0008NY-Tq
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:21 +0000
Message-Id: <E1SFyzJ-0008NY-Tq@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] autoconf: check for as86, ld86,
	bcc and iasl
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1329928670 -3600
# Node ID 83d3b4e2eb16c7b718f970ffacf62bf8755c6623
# Parent  edbfed5c33897abb9ed29a7cbb03b44526424cad
autoconf: check for as86, ld86, bcc and iasl

Check for this tools, and set the proper paths on config/Tool.mk.

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


diff -r edbfed5c3389 -r 83d3b4e2eb16 config/Tools.mk.in
--- a/config/Tools.mk.in	Wed Apr 04 16:10:18 2012 +0100
+++ b/config/Tools.mk.in	Wed Feb 22 17:37:50 2012 +0100
@@ -15,6 +15,10 @@ CURL_CONFIG         := @CURL@
 XML2_CONFIG         := @XML@
 BASH                := @BASH@
 XGETTTEXT           := @XGETTEXT@
+AS86                := @AS86@
+LD86                := @LD86@
+BCC                 := @BCC@
+IASL                := @IASL@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
diff -r edbfed5c3389 -r 83d3b4e2eb16 tools/configure
--- a/tools/configure	Wed Apr 04 16:10:18 2012 +0100
+++ b/tools/configure	Wed Feb 22 17:37:50 2012 +0100
@@ -633,6 +633,10 @@ INSTALL_PROGRAM
 SET_MAKE
 LN_S
 SED
+IASL
+BCC
+LD86
+AS86
 XGETTEXT
 BASH
 XML
@@ -744,6 +748,10 @@ CURL
 XML
 BASH
 XGETTEXT
+AS86
+LD86
+BCC
+IASL
 PKG_CONFIG
 PKG_CONFIG_PATH
 PKG_CONFIG_LIBDIR
@@ -1400,6 +1408,10 @@ Some influential environment variables:
   XML         Path to xml2-config tool
   BASH        Path to bash shell
   XGETTEXT    Path to xgetttext tool
+  AS86        Path to as86 tool
+  LD86        Path to ld86 tool
+  BCC         Path to bcc tool
+  IASL        Path to iasl tool
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
               directories to add to pkg-config's search path
@@ -4155,6 +4167,10 @@ LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPE
 
 
 
+
+
+
+
 # Checks for programs.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
@@ -6293,6 +6309,186 @@ if test x"${XGETTEXT}" == x"no"
 then
     as_fn_error $? "Unable to find xgettext, please install xgettext" "$LINENO" 5
 fi
+# Extract the first word of "as86", so it can be a program name with args.
+set dummy as86; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_AS86+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $AS86 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AS86="$AS86" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_AS86="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_AS86" && ac_cv_path_AS86="no"
+  ;;
+esac
+fi
+AS86=$ac_cv_path_AS86
+if test -n "$AS86"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS86" >&5
+$as_echo "$AS86" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${AS86}" == x"no"
+then
+    as_fn_error $? "Unable to find as86, please install as86" "$LINENO" 5
+fi
+# Extract the first word of "ld86", so it can be a program name with args.
+set dummy ld86; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_LD86+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $LD86 in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LD86="$LD86" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_LD86="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_LD86" && ac_cv_path_LD86="no"
+  ;;
+esac
+fi
+LD86=$ac_cv_path_LD86
+if test -n "$LD86"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD86" >&5
+$as_echo "$LD86" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${LD86}" == x"no"
+then
+    as_fn_error $? "Unable to find ld86, please install ld86" "$LINENO" 5
+fi
+# Extract the first word of "bcc", so it can be a program name with args.
+set dummy bcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_BCC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BCC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BCC="$BCC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_BCC="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BCC" && ac_cv_path_BCC="no"
+  ;;
+esac
+fi
+BCC=$ac_cv_path_BCC
+if test -n "$BCC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BCC" >&5
+$as_echo "$BCC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BCC}" == x"no"
+then
+    as_fn_error $? "Unable to find bcc, please install bcc" "$LINENO" 5
+fi
+# Extract the first word of "iasl", so it can be a program name with args.
+set dummy iasl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_IASL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $IASL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_IASL="$IASL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_IASL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_IASL" && ac_cv_path_IASL="no"
+  ;;
+esac
+fi
+IASL=$ac_cv_path_IASL
+if test -n "$IASL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IASL" >&5
+$as_echo "$IASL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${IASL}" == x"no"
+then
+    as_fn_error $? "Unable to find iasl, please install iasl" "$LINENO" 5
+fi
 
 ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
 if test "x$ac_cv_header_uuid_uuid_h" = x""yes; then :
diff -r edbfed5c3389 -r 83d3b4e2eb16 tools/configure.ac
--- a/tools/configure.ac	Wed Apr 04 16:10:18 2012 +0100
+++ b/tools/configure.ac	Wed Feb 22 17:37:50 2012 +0100
@@ -64,6 +64,10 @@ AC_ARG_VAR([CURL], [Path to curl-config 
 AC_ARG_VAR([XML], [Path to xml2-config tool])
 AC_ARG_VAR([BASH], [Path to bash shell])
 AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool])
+AC_ARG_VAR([AS86], [Path to as86 tool])
+AC_ARG_VAR([LD86], [Path to ld86 tool])
+AC_ARG_VAR([BCC], [Path to bcc tool])
+AC_ARG_VAR([IASL], [Path to iasl tool])
 
 # Checks for programs.
 AC_PROG_SED
@@ -96,6 +100,10 @@ AS_IF([test "x$pythontools" = "xy"], [
     AX_CHECK_PYTHON_DEVEL()
 ])
 AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
+AX_PATH_PROG_OR_FAIL([AS86], [as86])
+AX_PATH_PROG_OR_FAIL([LD86], [ld86])
+AX_PATH_PROG_OR_FAIL([BCC], [bcc])
+AX_PATH_PROG_OR_FAIL([IASL], [iasl])
 AX_CHECK_UUID
 AX_CHECK_CURSES
 PKG_CHECK_MODULES(glib, glib-2.0)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzO-0004Ul-JT; Fri, 06 Apr 2012 02:33:26 +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 1SFyzL-0004Qa-TE
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [193.109.254.147:2285] by server-4.bemta-14.messagelabs.com id
	D6/D8-11570-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1333679590!3483425!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.0 required=7.0 tests=BODY_DONG,BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14994 invoked from network); 6 Apr 2012 02:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02: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 1SFyz8-0003MW-3U
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz7-0008Iq-PJ
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:09 +0000
Message-Id: <E1SFyz7-0008Iq-PJ@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] remove ia64
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1333449335 -7200
# Node ID 8aa1697d57e480e00b5aaef587c940b52055c064
# Parent  2386288b1bf12e550e267c53976dba51eed8e74d
remove ia64

It retains IA64-specific bits in code imported from elsewhere (e.g.
ACPI, EFI) as well as in the public headers.

It also doesn't touch the tools, mini-os, and unmodified_drivers
sub-trees.

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


diff -r 2386288b1bf1 -r 8aa1697d57e4 MAINTAINERS
--- a/MAINTAINERS	Mon Apr 02 18:14:31 2012 +0100
+++ b/MAINTAINERS	Tue Apr 03 12:35:35 2012 +0200
@@ -138,14 +138,6 @@ M:	Tim Deegan <tim@xen.org>
 S:	Supported
 F:	tools/debugger/kdd/
 
-IA64 ARCHITECTURE
-M:	KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
-S:	Supported
-L:	xen-ia64-devel@lists.xensource.com
-F:	xen/arch/ia64/*
-F:	xen/include/asm-ia64/*
-F:	tools/libxc/ia64/*
-
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 M:	Joseph Cihula <joseph.cihula@intel.com>
 M:	Gang Wei <gang.wei@intel.com>
diff -r 2386288b1bf1 -r 8aa1697d57e4 config/ia64.mk
--- a/config/ia64.mk	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-CONFIG_IA64 := y
-CONFIG_IA64_$(XEN_OS) := y
-
-CONFIG_IOEMU := y
-CONFIG_XCUTILS := y
-CONFIG_XENCOMM := y
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/Makefile
--- a/xen/arch/ia64/Makefile	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-subdir-y += xen
-subdir-y += vmx
-subdir-y += linux
-subdir-y += linux-xen
-
-ALL_OBJS := linux-xen/head.o $(ALL_OBJS)
-
-$(TARGET)-syms: $(ALL_OBJS) xen.lds.s
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o
-	$(LD) $(LDFLAGS) -T xen.lds.s -N -Map $(@D)/.$(@F).0.map $(ALL_OBJS) \
-		$(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 
-	$(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S 
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o 
-	$(LD) $(LDFLAGS) -T xen.lds.s -N -Map $(@D)/.$(@F).1.map $(ALL_OBJS) \
-		$(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 
-	$(NM) -n $(@D)/.$(@F).1 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1.S 
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o 
-	$(LD) $(LDFLAGS) -T xen.lds.s -N -Map $@.map $(ALL_OBJS) \
-		$(@D)/.$(@F).1.o -o $@
-	rm -f $(@D)/.$(@F).[0-9]* 
-
-$(TARGET): $(TARGET)-syms
-	$(NM) -n $< | grep -v ' [aUw] ' > $(@D)/System.map 
-	$(OBJCOPY) -R .note -R .comment -S $< $@
-
-# Headers do not depend on auto-generated header, but object files do.
-$(ALL_OBJS): $(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h
-
-asm-offsets.s: asm-offsets.c \
-    $(BASEDIR)/include/asm-ia64/.offsets.h.stamp 
-	$(CC) $(CFLAGS) -DGENERATE_ASM_OFFSETS -DIA64_TASK_SIZE=0 -S -o $@ $<
-
-asm-xsi-offsets.s: asm-xsi-offsets.c
-	$(CC) $(CFLAGS) -S -o $@ $<
-
-$(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h: asm-xsi-offsets.s
-	@(set -e; \
-	  echo "/*"; \
-	  echo " * DO NOT MODIFY."; \
-	  echo " *"; \
-	  echo " * This file was auto-generated from $<"; \
-	  echo " *"; \
-	  echo " */"; \
-	  echo ""; \
-	  echo "#ifndef __ASM_XSI_OFFSETS_H__"; \
-	  echo "#define __ASM_XSI_OFFSETS_H__"; \
-	  echo ""; \
-	  sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
-	  echo ""; \
-	  echo "#endif") <$< >$@
-
-$(BASEDIR)/include/asm-ia64/.offsets.h.stamp:
-# Need such symbol link to make linux headers available
-	[ -e $(BASEDIR)/include/linux ] \
-	 || ln -sf $(BASEDIR)/include/xen $(BASEDIR)/include/linux
-	[ -e $(BASEDIR)/include/asm-ia64/xen ] \
-	 || ln -sf $(BASEDIR)/include/asm-ia64/linux $(BASEDIR)/include/asm-ia64/xen
-	touch $@
-
-# I'm sure a Makefile wizard would know a better way to do this
-xen.lds.s: xen/xen.lds.S
-	$(CC) -E $(CPPFLAGS) -P -DXEN $(AFLAGS) \
-		-o xen.lds.s xen/xen.lds.S
-
-.PHONY: clean
-clean::
-	rm -f *.o *~ core  xen.lds.s $(BASEDIR)/include/asm-ia64/.offsets.h.stamp asm-offsets.s map.out
-	rm -f asm-xsi-offsets.s $(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h
-	rm -f $(BASEDIR)/System.map
-	rm -f $(BASEDIR)/include/linux
-	rm -f $(BASEDIR)/include/asm-ia64/xen
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-########################################
-# ia64-specific definitions
-
-ia64 := y
-HAS_ACPI := y
-HAS_VGA  := y
-HAS_CPUFREQ := y
-HAS_PCI := y
-HAS_PASSTHROUGH := y
-HAS_NS16550 := y
-HAS_KEXEC := y
-xenoprof := y
-no_warns ?= n
-vti_debug ?= n
-vmx_panic ?= n
-vhpt_disable ?= n
-xen_ia64_expose_p2m	?= y
-xen_ia64_pervcpu_vhpt	?= y
-xen_ia64_tlb_track	?= y
-xen_ia64_tlb_track_cnt	?= n
-xen_ia64_tlbflush_clock	?= y
-xen_ia64_disable_optvfault ?= n
-
-# If they are enabled,
-# shrink struct page_info assuming all mfn can be addressed by 32 bits.
-# However, with 50bit ia64 architected physical address and 16KB page size,
-# mfn isn't always assessed by 32bit. So they are disabled by default.
-xen_ia64_shrink_page_list ?= n
-xen_ia64_pickle_domain ?= n
-
-# Used only by linux/Makefile.
-AFLAGS_KERNEL  += -mconstant-gp -nostdinc $(CPPFLAGS)
-
-CFLAGS	+= -nostdinc -fno-builtin -fno-common
-CFLAGS	+= -mconstant-gp
-#CFLAGS  += -O3		# -O3 over-inlines making debugging tough!
-CFLAGS	+= -O2		# but no optimization causes compile errors!
-CFLAGS	+= -fomit-frame-pointer -D__KERNEL__
-CFLAGS	+= -iwithprefix include
-CPPFLAGS+= -I$(BASEDIR)/include						\
-	   -I$(BASEDIR)/include/asm-ia64				\
-	   -I$(BASEDIR)/include/asm-ia64/linux 				\
-	   -I$(BASEDIR)/include/asm-ia64/linux-xen 			\
-	   -I$(BASEDIR)/include/asm-ia64/linux-null 			\
-	   -I$(BASEDIR)/arch/ia64/linux -I$(BASEDIR)/arch/ia64/linux-xen
-CFLAGS	+= $(CPPFLAGS)
-#CFLAGS  += -Wno-pointer-arith -Wredundant-decls
-CFLAGS	+= -DIA64 -DXEN -DLINUX_2_6
-CFLAGS	+= -ffixed-r13 -mfixed-range=f2-f5,f12-f127,b2-b5
-CFLAGS	+= -g
-ifeq ($(vti_debug),y)
-CFLAGS  += -DVTI_DEBUG
-endif
-ifeq ($(vmx_panic),y)
-CFLAGS  += -DCONFIG_VMX_PANIC
-endif
-ifeq ($(xen_ia64_expose_p2m),y)
-CFLAGS	+= -DCONFIG_XEN_IA64_EXPOSE_P2M
-endif
-ifeq ($(xen_ia64_pervcpu_vhpt),y)
-CFLAGS	+= -DCONFIG_XEN_IA64_PERVCPU_VHPT
-ifeq ($(vhpt_disable),y)
-$(error "both xen_ia64_pervcpu_vhpt=y and vhpt_disable=y are enabled. they can't be enabled simultaneously. disable one of them.")
-endif
-endif
-ifeq ($(xen_ia64_tlb_track),y)
-CFLAGS	+= -DCONFIG_XEN_IA64_TLB_TRACK
-endif
-ifeq ($(xen_ia64_tlb_track_cnt),y)
-CFLAGS	+= -DCONFIG_TLB_TRACK_CNT
-endif
-ifeq ($(xen_ia64_tlbflush_clock),y)
-CFLAGS += -DCONFIG_XEN_IA64_TLBFLUSH_CLOCK
-endif
-ifeq ($(no_warns),y)
-CFLAGS	+= -Wa,--fatal-warnings -Werror -Wno-uninitialized
-endif
-ifneq ($(vhpt_disable),y)
-CFLAGS += -DVHPT_ENABLED=1
-else
-CFLAGS += -DVHPT_ENABLED=0
-endif
-ifeq ($(xen_ia64_disable_optvfault),y)
-CFLAGS += -DCONFIG_XEN_IA64_DISABLE_OPTVFAULT
-endif
-ifeq ($(xen_ia64_shrink_page_list),y)
-CFLAGS += -DCONFIG_IA64_SHRINK_PAGE_LIST
-endif
-ifeq ($(xen_ia64_pickle_domain),y)
-CFLAGS += -DCONFIG_IA64_PICKLE_DOMAIN
-endif
-
-LDFLAGS = -g
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/asm-offsets.c
--- a/xen/arch/ia64/asm-offsets.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,273 +0,0 @@
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed
- * to extract and format the required data.
- */
-
-#include <xen/config.h>
-#include <xen/sched.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <asm/mca.h>
-#include <public/xen.h>
-#include <asm/tlb.h>
-#include <asm/regs.h>
-#include <asm/xenmca.h>
-
-#define task_struct vcpu
-
-#define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " (%0) " #val : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-#define OFFSET(_sym, _str, _mem) \
-    DEFINE(_sym, offsetof(_str, _mem));
-
-void foo(void)
-{
-	DEFINE(IA64_TASK_SIZE, sizeof (struct task_struct));
-	DEFINE(IA64_THREAD_INFO_SIZE, sizeof (struct thread_info));
-	DEFINE(IA64_PT_REGS_SIZE, sizeof (struct pt_regs));
-	DEFINE(IA64_SWITCH_STACK_SIZE, sizeof (struct switch_stack));
-	DEFINE(IA64_CPU_SIZE, sizeof (struct cpuinfo_ia64));
-	DEFINE(UNW_FRAME_INFO_SIZE, sizeof (struct unw_frame_info));
-	DEFINE(MAPPED_REGS_T_SIZE, sizeof (mapped_regs_t));
-
-	BLANK();
-	DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET, offsetof (struct ia64_mca_cpu, init_stack));
-
-	BLANK();
-	DEFINE(VCPU_VTM_OFFSET_OFS, offsetof(struct vcpu, arch.arch_vmx.vtm.vtm_offset));
-	DEFINE(VCPU_VTM_LAST_ITC_OFS, offsetof(struct vcpu, arch.arch_vmx.vtm.last_itc));
-	DEFINE(VCPU_VRR0_OFS, offsetof(struct vcpu, arch.arch_vmx.vrr[0]));
-	DEFINE(VCPU_ITR0_OFS, offsetof(struct vcpu, arch.itrs[0]));
-	DEFINE(VCPU_CALLBACK_OFS, offsetof(struct vcpu, arch.event_callback_ip));
-#ifdef   VTI_DEBUG
-	DEFINE(IVT_CUR_OFS, offsetof(struct vcpu, arch.arch_vmx.ivt_current));
-	DEFINE(IVT_DBG_OFS, offsetof(struct vcpu, arch.arch_vmx.ivt_debug));
-	DEFINE(IVT_DEBUG_SIZE, sizeof(struct ivt_debug));
-#endif
-	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
-	DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
-
-	BLANK();
-
-	DEFINE(IA64_TASK_THREAD_KSP_OFFSET, offsetof (struct vcpu, arch._thread.ksp));
-	DEFINE(IA64_TASK_THREAD_ON_USTACK_OFFSET, offsetof (struct vcpu, arch._thread.on_ustack));
-
-	DEFINE(IA64_VCPU_HYPERCALL_CONTINUATION_OFS, offsetof (struct vcpu, arch.hypercall_continuation));
-	DEFINE(IA64_VCPU_FP_PSR_OFFSET, offsetof (struct vcpu, arch.fp_psr));
-	DEFINE(IA64_VCPU_META_RID_DT_OFFSET, offsetof (struct vcpu, arch.metaphysical_rid_dt));
-	DEFINE(IA64_VCPU_META_RID_D_OFFSET, offsetof (struct vcpu, arch.metaphysical_rid_d));
-	DEFINE(IA64_VCPU_META_SAVED_RR0_OFFSET, offsetof (struct vcpu, arch.metaphysical_saved_rr0));
-	DEFINE(IA64_VCPU_BREAKIMM_OFFSET, offsetof (struct vcpu, arch.breakimm));
-	DEFINE(IA64_VCPU_IVA_OFFSET, offsetof (struct vcpu, arch.iva));
-	DEFINE(IA64_VCPU_EVENT_CALLBACK_IP_OFFSET, offsetof (struct vcpu, arch.event_callback_ip));
-	DEFINE(IA64_VCPU_IRR0_OFFSET, offsetof (struct vcpu, arch.irr[0]));
-	DEFINE(IA64_VCPU_IRR3_OFFSET, offsetof (struct vcpu, arch.irr[3]));
-	DEFINE(IA64_VCPU_INSVC3_OFFSET, offsetof (struct vcpu, arch.insvc[3]));
-	DEFINE(IA64_VCPU_STARTING_RID_OFFSET, offsetof (struct vcpu, arch.starting_rid));
-	DEFINE(IA64_VCPU_ENDING_RID_OFFSET, offsetof (struct vcpu, arch.ending_rid));
-	DEFINE(IA64_VCPU_RID_BITS_OFFSET, offsetof (struct vcpu, arch.rid_bits));
-	DEFINE(IA64_VCPU_DOMAIN_ITM_OFFSET, offsetof (struct vcpu, arch.domain_itm));
-	DEFINE(IA64_VCPU_DOMAIN_ITM_LAST_OFFSET, offsetof (struct vcpu, arch.domain_itm_last));
-	DEFINE(IA64_VCPU_ITLB_OFFSET, offsetof (struct vcpu, arch.itlb));
-	DEFINE(IA64_VCPU_DTLB_OFFSET, offsetof (struct vcpu, arch.dtlb));
-	DEFINE(IA64_VCPU_VHPT_PG_SHIFT_OFFSET, offsetof (struct vcpu, arch.vhpt_pg_shift));
-
-	BLANK();
-
-	DEFINE(IA64_VCPU_SHADOW_BITMAP_OFFSET, offsetof (struct vcpu, arch.shadow_bitmap));
-
-	BLANK();
-
-	DEFINE(IA64_CPUINFO_ITM_NEXT_OFFSET, offsetof (struct cpuinfo_ia64, itm_next));
-	DEFINE(IA64_CPUINFO_KSOFTIRQD_OFFSET, offsetof (struct cpuinfo_ia64, ksoftirqd));
-
-
-	BLANK();
-
-	DEFINE(IA64_PT_REGS_B6_OFFSET, offsetof (struct pt_regs, b6));
-	DEFINE(IA64_PT_REGS_B7_OFFSET, offsetof (struct pt_regs, b7));
-	DEFINE(IA64_PT_REGS_AR_CSD_OFFSET, offsetof (struct pt_regs, ar_csd));
-	DEFINE(IA64_PT_REGS_AR_SSD_OFFSET, offsetof (struct pt_regs, ar_ssd));
-	DEFINE(IA64_PT_REGS_R8_OFFSET, offsetof (struct pt_regs, r8));
-	DEFINE(IA64_PT_REGS_R9_OFFSET, offsetof (struct pt_regs, r9));
-	DEFINE(IA64_PT_REGS_R10_OFFSET, offsetof (struct pt_regs, r10));
-	DEFINE(IA64_PT_REGS_R11_OFFSET, offsetof (struct pt_regs, r11));
-	DEFINE(IA64_PT_REGS_CR_IPSR_OFFSET, offsetof (struct pt_regs, cr_ipsr));
-	DEFINE(IA64_PT_REGS_CR_IIP_OFFSET, offsetof (struct pt_regs, cr_iip));
-	DEFINE(IA64_PT_REGS_CR_IFS_OFFSET, offsetof (struct pt_regs, cr_ifs));
-	DEFINE(IA64_PT_REGS_AR_UNAT_OFFSET, offsetof (struct pt_regs, ar_unat));
-	DEFINE(IA64_PT_REGS_AR_PFS_OFFSET, offsetof (struct pt_regs, ar_pfs));
-	DEFINE(IA64_PT_REGS_AR_RSC_OFFSET, offsetof (struct pt_regs, ar_rsc));
-	DEFINE(IA64_PT_REGS_AR_RNAT_OFFSET, offsetof (struct pt_regs, ar_rnat));
-
-	DEFINE(IA64_PT_REGS_AR_BSPSTORE_OFFSET, offsetof (struct pt_regs, ar_bspstore));
-	DEFINE(IA64_PT_REGS_PR_OFFSET, offsetof (struct pt_regs, pr));
-	DEFINE(IA64_PT_REGS_B0_OFFSET, offsetof (struct pt_regs, b0));
-	DEFINE(IA64_PT_REGS_LOADRS_OFFSET, offsetof (struct pt_regs, loadrs));
-	DEFINE(IA64_PT_REGS_R1_OFFSET, offsetof (struct pt_regs, r1));
-	DEFINE(IA64_PT_REGS_R12_OFFSET, offsetof (struct pt_regs, r12));
-	DEFINE(IA64_PT_REGS_R13_OFFSET, offsetof (struct pt_regs, r13));
-	DEFINE(IA64_PT_REGS_AR_FPSR_OFFSET, offsetof (struct pt_regs, ar_fpsr));
-	DEFINE(IA64_PT_REGS_R15_OFFSET, offsetof (struct pt_regs, r15));
-	DEFINE(IA64_PT_REGS_R14_OFFSET, offsetof (struct pt_regs, r14));
-	DEFINE(IA64_PT_REGS_R2_OFFSET, offsetof (struct pt_regs, r2));
-	DEFINE(IA64_PT_REGS_R3_OFFSET, offsetof (struct pt_regs, r3));
-	DEFINE(IA64_PT_REGS_R16_OFFSET, offsetof (struct pt_regs, r16));
-	DEFINE(IA64_PT_REGS_R17_OFFSET, offsetof (struct pt_regs, r17));
-	DEFINE(IA64_PT_REGS_R18_OFFSET, offsetof (struct pt_regs, r18));
-	DEFINE(IA64_PT_REGS_R19_OFFSET, offsetof (struct pt_regs, r19));
-	DEFINE(IA64_PT_REGS_R20_OFFSET, offsetof (struct pt_regs, r20));
-	DEFINE(IA64_PT_REGS_R21_OFFSET, offsetof (struct pt_regs, r21));
-	DEFINE(IA64_PT_REGS_R22_OFFSET, offsetof (struct pt_regs, r22));
-	DEFINE(IA64_PT_REGS_R23_OFFSET, offsetof (struct pt_regs, r23));
-	DEFINE(IA64_PT_REGS_R24_OFFSET, offsetof (struct pt_regs, r24));
-	DEFINE(IA64_PT_REGS_R25_OFFSET, offsetof (struct pt_regs, r25));
-	DEFINE(IA64_PT_REGS_R26_OFFSET, offsetof (struct pt_regs, r26));
-	DEFINE(IA64_PT_REGS_R27_OFFSET, offsetof (struct pt_regs, r27));
-	DEFINE(IA64_PT_REGS_R28_OFFSET, offsetof (struct pt_regs, r28));
-	DEFINE(IA64_PT_REGS_R29_OFFSET, offsetof (struct pt_regs, r29));
-	DEFINE(IA64_PT_REGS_R30_OFFSET, offsetof (struct pt_regs, r30));
-	DEFINE(IA64_PT_REGS_R31_OFFSET, offsetof (struct pt_regs, r31));
-	DEFINE(IA64_PT_REGS_AR_CCV_OFFSET, offsetof (struct pt_regs, ar_ccv));
-	DEFINE(IA64_PT_REGS_F6_OFFSET, offsetof (struct pt_regs, f6));
-	DEFINE(IA64_PT_REGS_F7_OFFSET, offsetof (struct pt_regs, f7));
-	DEFINE(IA64_PT_REGS_F8_OFFSET, offsetof (struct pt_regs, f8));
-	DEFINE(IA64_PT_REGS_F9_OFFSET, offsetof (struct pt_regs, f9));
-	DEFINE(IA64_PT_REGS_F10_OFFSET, offsetof (struct pt_regs, f10));
-	DEFINE(IA64_PT_REGS_F11_OFFSET, offsetof (struct pt_regs, f11));
-	DEFINE(IA64_PT_REGS_R4_OFFSET, offsetof (struct pt_regs, r4));
-	DEFINE(IA64_PT_REGS_R5_OFFSET, offsetof (struct pt_regs, r5));
-	DEFINE(IA64_PT_REGS_R6_OFFSET, offsetof (struct pt_regs, r6));
-	DEFINE(IA64_PT_REGS_R7_OFFSET, offsetof (struct pt_regs, r7));
-	DEFINE(IA64_PT_REGS_EML_UNAT_OFFSET, offsetof (struct pt_regs, eml_unat));
-	DEFINE(IA64_VCPU_IIPA_OFFSET, offsetof (struct vcpu, arch.arch_vmx.cr_iipa));
-	DEFINE(IA64_VCPU_ISR_OFFSET, offsetof (struct vcpu, arch.arch_vmx.cr_isr));
-	DEFINE(IA64_VCPU_CAUSE_OFFSET, offsetof (struct vcpu, arch.arch_vmx.cause));
-	DEFINE(IA64_VCPU_OPCODE_OFFSET, offsetof (struct vcpu, arch.arch_vmx.opcode));
-	DEFINE(SWITCH_MPTA_OFFSET,offsetof(struct vcpu ,arch.arch_vmx.mpta));
-	DEFINE(IA64_PT_REGS_R16_SLOT, (((offsetof(struct pt_regs, r16)-sizeof(struct pt_regs))>>3)&0x3f));
-	DEFINE(IA64_PT_REGS_R2_SLOT, (((offsetof(struct pt_regs, r16)-sizeof(struct pt_regs))>>3)&0x3f));
-	DEFINE(IA64_PT_REGS_R8_SLOT, (((offsetof(struct pt_regs, r16)-sizeof(struct pt_regs))>>3)&0x3f));
-	DEFINE(IA64_VCPU_FLAGS_OFFSET,offsetof(struct vcpu ,arch.arch_vmx.flags));
-	DEFINE(IA64_VCPU_MMU_MODE_OFFSET,offsetof(struct vcpu, arch.arch_vmx.mmu_mode));
-
-	BLANK();
-
-	DEFINE(IA64_SWITCH_STACK_CALLER_UNAT_OFFSET, offsetof (struct switch_stack, caller_unat));
-	DEFINE(IA64_SWITCH_STACK_AR_FPSR_OFFSET, offsetof (struct switch_stack, ar_fpsr));
-	DEFINE(IA64_SWITCH_STACK_F2_OFFSET, offsetof (struct switch_stack, f2));
-	DEFINE(IA64_SWITCH_STACK_F3_OFFSET, offsetof (struct switch_stack, f3));
-	DEFINE(IA64_SWITCH_STACK_F4_OFFSET, offsetof (struct switch_stack, f4));
-	DEFINE(IA64_SWITCH_STACK_F5_OFFSET, offsetof (struct switch_stack, f5));
-	DEFINE(IA64_SWITCH_STACK_F12_OFFSET, offsetof (struct switch_stack, f12));
-	DEFINE(IA64_SWITCH_STACK_F13_OFFSET, offsetof (struct switch_stack, f13));
-	DEFINE(IA64_SWITCH_STACK_F14_OFFSET, offsetof (struct switch_stack, f14));
-	DEFINE(IA64_SWITCH_STACK_F15_OFFSET, offsetof (struct switch_stack, f15));
-	DEFINE(IA64_SWITCH_STACK_F16_OFFSET, offsetof (struct switch_stack, f16));
-	DEFINE(IA64_SWITCH_STACK_F17_OFFSET, offsetof (struct switch_stack, f17));
-	DEFINE(IA64_SWITCH_STACK_F18_OFFSET, offsetof (struct switch_stack, f18));
-	DEFINE(IA64_SWITCH_STACK_F19_OFFSET, offsetof (struct switch_stack, f19));
-	DEFINE(IA64_SWITCH_STACK_F20_OFFSET, offsetof (struct switch_stack, f20));
-	DEFINE(IA64_SWITCH_STACK_F21_OFFSET, offsetof (struct switch_stack, f21));
-	DEFINE(IA64_SWITCH_STACK_F22_OFFSET, offsetof (struct switch_stack, f22));
-	DEFINE(IA64_SWITCH_STACK_F23_OFFSET, offsetof (struct switch_stack, f23));
-	DEFINE(IA64_SWITCH_STACK_F24_OFFSET, offsetof (struct switch_stack, f24));
-	DEFINE(IA64_SWITCH_STACK_F25_OFFSET, offsetof (struct switch_stack, f25));
-	DEFINE(IA64_SWITCH_STACK_F26_OFFSET, offsetof (struct switch_stack, f26));
-	DEFINE(IA64_SWITCH_STACK_F27_OFFSET, offsetof (struct switch_stack, f27));
-	DEFINE(IA64_SWITCH_STACK_F28_OFFSET, offsetof (struct switch_stack, f28));
-	DEFINE(IA64_SWITCH_STACK_F29_OFFSET, offsetof (struct switch_stack, f29));
-	DEFINE(IA64_SWITCH_STACK_F30_OFFSET, offsetof (struct switch_stack, f30));
-	DEFINE(IA64_SWITCH_STACK_F31_OFFSET, offsetof (struct switch_stack, f31));
-	DEFINE(IA64_SWITCH_STACK_R4_OFFSET, offsetof (struct switch_stack, r4));
-	DEFINE(IA64_SWITCH_STACK_R5_OFFSET, offsetof (struct switch_stack, r5));
-	DEFINE(IA64_SWITCH_STACK_R6_OFFSET, offsetof (struct switch_stack, r6));
-	DEFINE(IA64_SWITCH_STACK_R7_OFFSET, offsetof (struct switch_stack, r7));
-	DEFINE(IA64_SWITCH_STACK_B0_OFFSET, offsetof (struct switch_stack, b0));
-	DEFINE(IA64_SWITCH_STACK_B1_OFFSET, offsetof (struct switch_stack, b1));
-	DEFINE(IA64_SWITCH_STACK_B2_OFFSET, offsetof (struct switch_stack, b2));
-	DEFINE(IA64_SWITCH_STACK_B3_OFFSET, offsetof (struct switch_stack, b3));
-	DEFINE(IA64_SWITCH_STACK_B4_OFFSET, offsetof (struct switch_stack, b4));
-	DEFINE(IA64_SWITCH_STACK_B5_OFFSET, offsetof (struct switch_stack, b5));
-	DEFINE(IA64_SWITCH_STACK_AR_PFS_OFFSET, offsetof (struct switch_stack, ar_pfs));
-	DEFINE(IA64_SWITCH_STACK_AR_LC_OFFSET, offsetof (struct switch_stack, ar_lc));
-	DEFINE(IA64_SWITCH_STACK_AR_UNAT_OFFSET, offsetof (struct switch_stack, ar_unat));
-	DEFINE(IA64_SWITCH_STACK_AR_RNAT_OFFSET, offsetof (struct switch_stack, ar_rnat));
-	DEFINE(IA64_SWITCH_STACK_AR_BSPSTORE_OFFSET, offsetof (struct switch_stack, ar_bspstore));
-	DEFINE(IA64_SWITCH_STACK_PR_OFFSET, offsetof (struct switch_stack, pr));
-
-	BLANK();
-
-	DEFINE(IA64_VPD_BASE_OFFSET, offsetof (struct vcpu, arch.privregs));
-	DEFINE(IA64_VPD_VIFS_OFFSET, offsetof (mapped_regs_t, ifs));
-	DEFINE(IA64_VPD_VHPI_OFFSET, offsetof (mapped_regs_t, vhpi));
-	DEFINE(IA64_VPD_VB1REG_OFFSET, offsetof (mapped_regs_t, bank1_regs[0]));
-	DEFINE(IA64_VPD_VB0REG_OFFSET, offsetof (mapped_regs_t, bank0_regs[0]));
-	DEFINE(IA64_VPD_VB1NAT_OFFSET, offsetof (mapped_regs_t, vnat));
-	DEFINE(IA64_VPD_VB0NAT_OFFSET, offsetof (mapped_regs_t, vbnat));
- 	DEFINE(IA64_VLSAPIC_INSVC_BASE_OFFSET, offsetof (struct vcpu, arch.insvc[0]));
-	DEFINE(IA64_VPD_VPTA_OFFSET, offsetof (struct mapped_regs, pta));
-	DEFINE(XXX_THASH_SIZE, sizeof (thash_data_t));
-
-	BLANK();
-	DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET, offsetof (struct cpuinfo_ia64, nsec_per_cyc));
-	DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET, offsetof (struct cpuinfo_ia64, ptce_base));
-	DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET, offsetof (struct cpuinfo_ia64, ptce_count));
-	DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET, offsetof (struct timespec, tv_nsec));
-
-
-	DEFINE(CLONE_IDLETASK_BIT, 12);
-	DEFINE(CLONE_SETTLS_BIT, 19);
-	DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET, offsetof (struct cpuinfo_ia64, nsec_per_cyc));
-
-	BLANK();
-	DEFINE(IA64_KR_CURRENT_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT]));
-	DEFINE(IA64_KR_PT_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_PT_BASE]));
-	DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
-	DEFINE(IA64_KR_PERCPU_DATA_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_PER_CPU_DATA]));
-	DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
-	DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT_STACK]));
-
-#ifdef PERF_COUNTERS
-	BLANK();
-	DEFINE(IA64_PERFC_recover_to_page_fault, PERFC_recover_to_page_fault);
-	DEFINE(IA64_PERFC_recover_to_break_fault, PERFC_recover_to_break_fault);
-	DEFINE(IA64_PERFC_fast_vhpt_translate, PERFC_fast_vhpt_translate);
-	DEFINE(IA64_PERFC_fast_hyperprivop, PERFC_fast_hyperprivop);
-	DEFINE(IA64_PERFC_fast_reflect, PERFC_fast_reflect);
-#endif
-
-	BLANK();
-	DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET,
-	       offsetof(struct cpuinfo_ia64, ptce_base));
-	DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET,
-	       offsetof(struct cpuinfo_ia64, ptce_count));
-	DEFINE(IA64_CPUINFO_PTCE_STRIDE_OFFSET,
-	       offsetof(struct cpuinfo_ia64, ptce_stride));
-
-	BLANK();
-	DEFINE(IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET,
-	       offsetof(struct ia64_mca_cpu, proc_state_dump));
-	DEFINE(IA64_MCA_CPU_STACK_OFFSET,
-	       offsetof(struct ia64_mca_cpu, stack));
-	DEFINE(IA64_MCA_CPU_STACKFRAME_OFFSET,
-	       offsetof(struct ia64_mca_cpu, stackframe));
-	DEFINE(IA64_MCA_CPU_RBSTORE_OFFSET,
-	       offsetof(struct ia64_mca_cpu, rbstore));
-
-#if VHPT_ENABLED
-	DEFINE(IA64_VCPU_VHPT_PAGE_OFFSET,
-	       offsetof(struct vcpu, arch.vhpt_page));
-	DEFINE(IA64_VCPU_VHPT_MADDR_OFFSET,
-	       offsetof(struct vcpu, arch.vhpt_maddr));
-#endif
-
-	BLANK();
-	DEFINE(IA64_MCA_TLB_INFO_SIZE, sizeof(struct ia64_mca_tlb_info));
-	DEFINE(IA64_MCA_PERCPU_OFFSET,
-	       offsetof(struct ia64_mca_tlb_info, percpu_paddr));
-}
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/asm-xsi-offsets.c
--- a/xen/arch/ia64/asm-xsi-offsets.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
-/*
- * asm-xsi-offsets.c_
- * Copyright (c) 2005, Intel Corporation.
- *      Kun Tian (Kevin Tian) <kevin.tian@intel.com>
- *      Eddie Dong  <eddie.dong@intel.com>
- *      Fred Yang <fred.yang@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- */
-
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed
- * to extract and format the required data.
- */
-
-#include <xen/config.h>
-#include <xen/sched.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <public/xen.h>
-#include <asm/tlb.h>
-#include <asm/regs.h>
-
-#define task_struct vcpu
-
-#define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " (%0) " #val : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-#define DEFINE_MAPPED_REG_OFS(sym, field) \
-	DEFINE(sym, (XMAPPEDREGS_OFS + offsetof(mapped_regs_t, field)))
-
-void foo(void)
-{
-	DEFINE_MAPPED_REG_OFS(XSI_PSR_I_ADDR_OFS, interrupt_mask_addr);
-	DEFINE_MAPPED_REG_OFS(XSI_IPSR_OFS, ipsr);
-	DEFINE_MAPPED_REG_OFS(XSI_IIP_OFS, iip);
-	DEFINE_MAPPED_REG_OFS(XSI_IFS_OFS, ifs);
-	DEFINE_MAPPED_REG_OFS(XSI_PRECOVER_IFS_OFS, precover_ifs);
-	DEFINE_MAPPED_REG_OFS(XSI_ISR_OFS, isr);
-	DEFINE_MAPPED_REG_OFS(XSI_IFA_OFS, ifa);
-	DEFINE_MAPPED_REG_OFS(XSI_IIPA_OFS, iipa);
-	DEFINE_MAPPED_REG_OFS(XSI_IIM_OFS, iim);
-	DEFINE_MAPPED_REG_OFS(XSI_TPR_OFS, tpr);
-	DEFINE_MAPPED_REG_OFS(XSI_IHA_OFS, iha);
-	DEFINE_MAPPED_REG_OFS(XSI_ITIR_OFS, itir);
-	DEFINE_MAPPED_REG_OFS(XSI_ITV_OFS, itv);
-	DEFINE_MAPPED_REG_OFS(XSI_PTA_OFS, pta);
-	DEFINE_MAPPED_REG_OFS(XSI_VPSR_DFH_OFS, vpsr_dfh);
-	DEFINE_MAPPED_REG_OFS(XSI_HPSR_DFH_OFS, hpsr_dfh);
-	DEFINE_MAPPED_REG_OFS(XSI_PSR_IC_OFS, interrupt_collection_enabled);
-	DEFINE_MAPPED_REG_OFS(XSI_VPSR_PP_OFS, vpsr_pp);
-	DEFINE_MAPPED_REG_OFS(XSI_METAPHYS_OFS, metaphysical_mode);
-	DEFINE_MAPPED_REG_OFS(XSI_BANKNUM_OFS, banknum);
-	DEFINE_MAPPED_REG_OFS(XSI_BANK0_R16_OFS, bank0_regs[0]);
-	DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]);
-	DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat);
-	DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat);
-	DEFINE_MAPPED_REG_OFS(XSI_RR0_OFS, rrs[0]);
-	DEFINE_MAPPED_REG_OFS(XSI_KR0_OFS, krs[0]);
-}
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/Makefile
--- a/xen/arch/ia64/linux-xen/Makefile	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-subdir-y += sn
-
-obj-y += cmdline.o
-obj-y += efi.o
-obj-y += entry.o
-obj-y += irq_ia64.o
-obj-y += mca.o
-obj-y += mca_asm.o
-obj-y += mm_contig.o
-obj-y += process-linux-xen.o
-obj-y += sal.o
-obj-y += setup.o
-obj-y += smpboot.o
-obj-y += smp.o
-obj-y += time.o
-obj-y += tlb.o
-obj-y += unaligned.o
-obj-y += unwind.o
-obj-y += iosapic.o
-obj-y += numa.o
-obj-y += perfmon.o
-obj-y += perfmon_default_smpl.o
-obj-y += acpi.o
-obj-y += acpi_numa.o
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/README.origin
--- a/xen/arch/ia64/linux-xen/README.origin	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-# Source files in this directory are near-identical copies of linux-2.6.13
-# files:
-
-# NOTE: ALL changes to these files should be clearly marked
-# (e.g. with #ifdef XEN or XEN in a comment) so that they can be
-# easily updated to future versions of the corresponding Linux files.
-
-cmdline.c		-> linux/lib/cmdline.c
-entry.h			-> linux/arch/ia64/kernel/entry.h
-entry.S			-> linux/arch/ia64/kernel/entry.S
-head.S			-> linux/arch/ia64/kernel/head.S
-hpsim_ssc.h		-> linux/arch/ia64/hp/sim/hpsim_ssc.h
-irq_ia64.c		-> linux/arch/ia64/kernel/irq_ia64.c
-mca.c			-> linux/arch/ia64/kernel/mca.c
-mca_asm.S		-> linux/arch/ia64/kernel/mca_asm.S
-minstate.h		-> linux/arch/ia64/kernel/minstate.h
-mm_contig.c		-> linux/arch/ia64/mm/contig.c
-numa.c			-> linux/arch/ia64/kernel/numa.c
-process-linux-xen.c	-> linux/arch/ia64/kernel/process.c
-sal.c			-> linux/arch/ia64/kernel/sal.c
-setup.c			-> linux/arch/ia64/kernel/setup.c
-smp.c			-> linux/arch/ia64/kernel/smp.c
-smpboot.c		-> linux/arch/ia64/kernel/smpboot.c
-time.c			-> linux/arch/ia64/kernel/time.c
-tlb.c			-> linux/arch/ia64/mm/tlb.c
-unaligned.c		-> linux/arch/ia64/kernel/unaligned.c
-unwind.c		-> linux/arch/ia64/kernel/unwind.c
-unwind_decoder.c	-> linux/arch/ia64/kernel/unwind_decoder.c
-unwind_i.h		-> linux/arch/ia64/kernel/unwind_i.h
-
-# The files below are from Linux-2.6.16
-iosapic.c		-> linux/arch/ia64/kernel/iosapic.c
-
-# The files below are from Linux-2.6.16.33
-perfmon.c		-> linux/arch/kernel/perfmon.c
-perfmon_default_smpl.c	-> linux/arch/kernel/perfmon_default_smpl.c
-perfmon_generic.h	-> linux/arch/kernel/perfmon_generic.h
-perfmon_itanium.h	-> linux/arch/kernel/perfmon_itanium.h
-perfmon_mckinley.h	-> linux/arch/kernel/perfmon_mckinley.h
-perfmon_montecito.h	-> linux/arch/kernel/perfmon_montecito.h
-
-# The files below are from Linux-2.6.21
-efi.c			-> linux/arch/ia64/kernel/efi.c
-
-# The files below are from Linux-2.6.26-rc5
-acpi.c			-> linux/arch/ia64/kernel/acpi.c
-acpi_numa.c		-> linux/drivers/acpi/numa.c
\ No newline at end of file
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/acpi.c
--- a/xen/arch/ia64/linux-xen/acpi.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1098 +0,0 @@
-/*
- *  acpi.c - Architecture-Specific Low-Level ACPI Support
- *
- *  Copyright (C) 1999 VA Linux Systems
- *  Copyright (C) 1999,2000 Walt Drummond <drummond@valinux.com>
- *  Copyright (C) 2000, 2002-2003 Hewlett-Packard Co.
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *  Copyright (C) 2000 Intel Corp.
- *  Copyright (C) 2000,2001 J.I. Lee <jung-ik.lee@intel.com>
- *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
- *  Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com>
- *  Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
- *  Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
- *  Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/smp.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/irq.h>
-#include <linux/acpi.h>
-#include <linux/efi.h>
-#include <linux/mmzone.h>
-#include <linux/nodemask.h>
-#include <asm/io.h>
-#include <asm/iosapic.h>
-#include <asm/machvec.h>
-#include <asm/page.h>
-#include <asm/system.h>
-#include <asm/numa.h>
-#include <asm/sal.h>
-#include <asm/cyclone.h>
-#include <asm/xen/hypervisor.h>
-#ifdef XEN
-#include <asm/hw_irq.h>
-#include <asm/numa.h>
-extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES];
-#endif
-
-
-#define BAD_MADT_ENTRY(entry, end) (                                        \
-		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
-		((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
-
-#define PREFIX			"ACPI: "
-
-void (*pm_idle) (void) __read_mostly;
-EXPORT_SYMBOL(pm_idle);
-void (*pm_power_off) (void) __read_mostly;
-EXPORT_SYMBOL(pm_power_off);
-
-unsigned int acpi_cpei_override;
-unsigned int acpi_cpei_phys_cpuid;
-
-unsigned long acpi_wakeup_address = 0;
-
-#ifdef CONFIG_IA64_GENERIC
-static unsigned long __init acpi_find_rsdp(void)
-{
-	unsigned long rsdp_phys = 0;
-
-	if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
-		rsdp_phys = efi.acpi20;
-	else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
-		printk(KERN_WARNING PREFIX
-		       "v1.0/r0.71 tables no longer supported\n");
-	return rsdp_phys;
-}
-#endif
-
-const char __init *
-acpi_get_sysname(void)
-{
-#ifdef CONFIG_IA64_GENERIC
-	unsigned long rsdp_phys;
-	struct acpi_table_rsdp *rsdp;
-	struct acpi_table_xsdt *xsdt;
-	struct acpi_table_header *hdr;
-
-	rsdp_phys = acpi_find_rsdp();
-	if (!rsdp_phys) {
-		printk(KERN_ERR
-		       "ACPI 2.0 RSDP not found, default to \"dig\"\n");
-		return "dig";
-	}
-
-	rsdp = (struct acpi_table_rsdp *)__va(rsdp_phys);
-	if (strncmp(rsdp->signature, ACPI_SIG_RSDP, sizeof(ACPI_SIG_RSDP) - 1)) {
-		printk(KERN_ERR
-		       "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
-		return "dig";
-	}
-
-	xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_physical_address);
-	hdr = &xsdt->header;
-	if (strncmp(hdr->signature, ACPI_SIG_XSDT, sizeof(ACPI_SIG_XSDT) - 1)) {
-		printk(KERN_ERR
-		       "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
-		return "dig";
-	}
-
-	if (!strcmp(hdr->oem_id, "HP")) {
-		return "hpzx1";
-	} else if (!strcmp(hdr->oem_id, "SGI")) {
-		if (!strcmp(hdr->oem_table_id + 4, "UV"))
-			return "uv";
-		else
-			return "sn2";
-#ifndef XEN
-	} else if (is_running_on_xen() && !strcmp(hdr->oem_id, "XEN")) {
-		return "xen";
-#endif
-	}
-
-	return "dig";
-#else
-# if defined (CONFIG_IA64_HP_SIM)
-	return "hpsim";
-# elif defined (CONFIG_IA64_HP_ZX1)
-	return "hpzx1";
-# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB)
-	return "hpzx1_swiotlb";
-# elif defined (CONFIG_IA64_SGI_SN2)
-	return "sn2";
-# elif defined (CONFIG_IA64_SGI_UV)
-	return "uv";
-# elif defined (CONFIG_IA64_DIG)
-	return "dig";
-# elif defined (CONFIG_IA64_XEN)
-	return "xen";
-# else
-#	error Unknown platform.  Fix acpi.c.
-# endif
-#endif
-}
-
-#ifdef CONFIG_ACPI
-
-#define ACPI_MAX_PLATFORM_INTERRUPTS	256
-
-/* Array to record platform interrupt vectors for generic interrupt routing. */
-int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
-	[0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
-};
-
-/*
- * Interrupt routing API for device drivers.  Provides interrupt vector for
- * a generic platform event.  Currently only CPEI is implemented.
- */
-int acpi_request_vector(u32 int_type)
-{
-	int vector = -1;
-
-	if (int_type < ACPI_MAX_PLATFORM_INTERRUPTS) {
-		/* corrected platform error interrupt */
-		vector = platform_intr_list[int_type];
-	} else
-		printk(KERN_ERR
-		       "acpi_request_vector(): invalid interrupt type\n");
-	return vector;
-}
-
-char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
-{
-	return __va(phys_addr);
-}
-
-/* --------------------------------------------------------------------------
-                            Boot-time Table Parsing
-   -------------------------------------------------------------------------- */
-
-static int total_cpus __initdata;
-static int available_cpus __initdata;
-struct acpi_table_madt *acpi_madt __initdata;
-static u8 has_8259;
-
-static int __init
-acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
-			  const unsigned long end)
-{
-	struct acpi_madt_local_apic_override *lapic;
-
-	lapic = (struct acpi_madt_local_apic_override *)header;
-
-	if (BAD_MADT_ENTRY(lapic, end))
-		return -EINVAL;
-
-	if (lapic->address) {
-		iounmap(ipi_base_addr);
-		ipi_base_addr = ioremap(lapic->address, 0);
-	}
-	return 0;
-}
-
-#ifdef XEN
-
-#define MAX_LOCAL_SAPIC 255
-static u16 ia64_acpiid_to_sapicid[ MAX_LOCAL_SAPIC ] =
-		{[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
-
-/* acpi id to cpu id */
-int get_cpu_id(u32 acpi_id)
-{
-	int i;
-	u16 apic_id;
-
-	if ( acpi_id >= MAX_LOCAL_SAPIC )
-		return -EINVAL;
-
-	apic_id = ia64_acpiid_to_sapicid[acpi_id];
-	if ( apic_id == 0xffff )
-		return -EINVAL;
-
-	for ( i = 0; i < NR_CPUS; i++ )
-	{
-		if ( apic_id == ia64_cpu_to_sapicid[i] )
-			return i;
-	}
-
-	return -1;
-}
-
-int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *pdc, u32 mask)
-{
-	pdc[2] |= ACPI_PDC_EST_CAPABILITY_SMP & mask;
-	return 0;
-}
-
-#endif
-
-static int __init
-acpi_parse_lsapic(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_local_sapic *lsapic;
-
-	lsapic = (struct acpi_madt_local_sapic *)header;
-
-	/*Skip BAD_MADT_ENTRY check, as lsapic size could vary */
-
-	if (lsapic->lapic_flags & ACPI_MADT_ENABLED) {
-#ifdef CONFIG_SMP
-		smp_boot_data.cpu_phys_id[available_cpus] =
-		    (lsapic->id << 8) | lsapic->eid;
-#endif
-#ifdef XEN
-        ia64_acpiid_to_sapicid[lsapic->processor_id] =
-            (lsapic->id << 8) | lsapic->eid;
-#endif
-		++available_cpus;
-	}
-
-	total_cpus++;
-	return 0;
-}
-
-static int __init
-acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_local_apic_nmi *lacpi_nmi;
-
-	lacpi_nmi = (struct acpi_madt_local_apic_nmi *)header;
-
-	if (BAD_MADT_ENTRY(lacpi_nmi, end))
-		return -EINVAL;
-
-	/* TBD: Support lapic_nmi entries */
-	return 0;
-}
-
-static int __init
-acpi_parse_iosapic(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_io_sapic *iosapic;
-
-	iosapic = (struct acpi_madt_io_sapic *)header;
-
-	if (BAD_MADT_ENTRY(iosapic, end))
-		return -EINVAL;
-
-#ifndef XEN
-	return iosapic_init(iosapic->address, iosapic->global_irq_base);
-#else
-	return iosapic_init(iosapic->address, iosapic->global_irq_base,
-			    iosapic->id);
-#endif
-}
-
-static unsigned int __initdata acpi_madt_rev;
-
-static int __init
-acpi_parse_plat_int_src(struct acpi_subtable_header * header,
-			const unsigned long end)
-{
-	struct acpi_madt_interrupt_source *plintsrc;
-	int vector;
-
-	plintsrc = (struct acpi_madt_interrupt_source *)header;
-
-	if (BAD_MADT_ENTRY(plintsrc, end))
-		return -EINVAL;
-
-	/*
-	 * Get vector assignment for this interrupt, set attributes,
-	 * and program the IOSAPIC routing table.
-	 */
-	vector = iosapic_register_platform_intr(plintsrc->type,
-						plintsrc->global_irq,
-						plintsrc->io_sapic_vector,
-						plintsrc->eid,
-						plintsrc->id,
-						((plintsrc->inti_flags & ACPI_MADT_POLARITY_MASK) ==
-						 ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
-						IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-						((plintsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
-						 ACPI_MADT_TRIGGER_EDGE) ?
-						IOSAPIC_EDGE : IOSAPIC_LEVEL);
-
-	platform_intr_list[plintsrc->type] = vector;
-	if (acpi_madt_rev > 1) {
-		acpi_cpei_override = plintsrc->flags & ACPI_MADT_CPEI_OVERRIDE;
-	}
-
-	/*
-	 * Save the physical id, so we can check when its being removed
-	 */
-	acpi_cpei_phys_cpuid = ((plintsrc->id << 8) | (plintsrc->eid)) & 0xffff;
-
-	return 0;
-}
-
-#ifdef CONFIG_HOTPLUG_CPU
-
-#ifdef XEN
-unsigned int force_cpei_retarget = 0;
-#endif
-
-unsigned int can_cpei_retarget(void)
-{
-	extern int cpe_vector;
-	extern unsigned int force_cpei_retarget;
-
-	/*
-	 * Only if CPEI is supported and the override flag
-	 * is present, otherwise return that its re-targettable
-	 * if we are in polling mode.
-	 */
-	if (cpe_vector > 0) {
-		if (acpi_cpei_override || force_cpei_retarget)
-			return 1;
-		else
-			return 0;
-	}
-	return 1;
-}
-
-unsigned int is_cpu_cpei_target(unsigned int cpu)
-{
-	unsigned int logical_id;
-
-	logical_id = cpu_logical_id(acpi_cpei_phys_cpuid);
-
-	if (logical_id == cpu)
-		return 1;
-	else
-		return 0;
-}
-
-void set_cpei_target_cpu(unsigned int cpu)
-{
-	acpi_cpei_phys_cpuid = cpu_physical_id(cpu);
-}
-#endif
-
-unsigned int get_cpei_target_cpu(void)
-{
-	return acpi_cpei_phys_cpuid;
-}
-
-static int __init
-acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
-		       const unsigned long end)
-{
-	struct acpi_madt_interrupt_override *p;
-
-	p = (struct acpi_madt_interrupt_override *)header;
-
-	if (BAD_MADT_ENTRY(p, end))
-		return -EINVAL;
-
-	iosapic_override_isa_irq(p->source_irq, p->global_irq,
-				 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) ==
-				  ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
-				 IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-				 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
-				 ACPI_MADT_TRIGGER_EDGE) ?
-				 IOSAPIC_EDGE : IOSAPIC_LEVEL);
-	return 0;
-}
-
-static int __init
-acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_nmi_source *nmi_src;
-
-	nmi_src = (struct acpi_madt_nmi_source *)header;
-
-	if (BAD_MADT_ENTRY(nmi_src, end))
-		return -EINVAL;
-
-	/* TBD: Support nimsrc entries */
-	return 0;
-}
-
-static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
-{
-	if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
-
-		/*
-		 * Unfortunately ITC_DRIFT is not yet part of the
-		 * official SAL spec, so the ITC_DRIFT bit is not
-		 * set by the BIOS on this hardware.
-		 */
-		sal_platform_features |= IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT;
-
-#ifndef XEN
-		cyclone_setup();
-#endif
-	}
-}
-
-static int __init acpi_parse_madt(struct acpi_table_header *table)
-{
-	if (!table)
-		return -EINVAL;
-
-	acpi_madt = (struct acpi_table_madt *)table;
-
-	acpi_madt_rev = acpi_madt->header.revision;
-
-	/* remember the value for reference after free_initmem() */
-#ifdef CONFIG_ITANIUM
-	has_8259 = 1;		/* Firmware on old Itanium systems is broken */
-#else
-	has_8259 = acpi_madt->flags & ACPI_MADT_PCAT_COMPAT;
-#endif
-	iosapic_system_init(has_8259);
-
-	/* Get base address of IPI Message Block */
-
-	if (acpi_madt->address)
-		ipi_base_addr = ioremap(acpi_madt->address, 0);
-
-	printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
-
-	acpi_madt_oem_check(acpi_madt->header.oem_id,
-			    acpi_madt->header.oem_table_id);
-
-	return 0;
-}
-
-#ifdef CONFIG_ACPI_NUMA
-
-#undef SLIT_DEBUG
-
-#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
-
-static int __initdata srat_num_cpus;	/* number of cpus */
-static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
-#define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))
-#define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))
-static struct acpi_table_slit __initdata *slit_table;
-cpumask_t early_cpu_possible_map = CPU_MASK_NONE;
-
-static int __init
-get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
-{
-	int pxm;
-
-	pxm = pa->proximity_domain_lo;
-	if (srat_rev >= 2) {
-		pxm += pa->proximity_domain_hi[0] << 8;
-		pxm += pa->proximity_domain_hi[1] << 16;
-		pxm += pa->proximity_domain_hi[2] << 24;
-	} else if (ia64_platform_is("sn2"))
-		pxm += pa->proximity_domain_hi[0] << 8;
-	return pxm;
-}
-
-static int __init
-get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
-{
-	int pxm;
-
-	pxm = ma->proximity_domain;
-	if (!ia64_platform_is("sn2") && srat_rev < 2)
-		pxm &= 0xff;
-
-	return pxm;
-}
-
-/*
- * ACPI 2.0 SLIT (System Locality Information Table)
- * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
- */
-void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
-{
-	u32 len;
-
-	len = sizeof(struct acpi_table_header) + 8
-	    + slit->locality_count * slit->locality_count;
-	if (slit->header.length != len) {
-		printk(KERN_ERR
-		       "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
-		       len, slit->header.length);
-		memset(numa_slit, 10, sizeof(numa_slit));
-		return;
-	}
-	slit_table = slit;
-}
-
-void __init
-acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
-{
-	int pxm;
-
-	if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))
-		return;
-
-	pxm = get_processor_proximity_domain(pa);
-
-	/* record this node in proximity bitmap */
-	pxm_bit_set(pxm);
-
-	node_cpuid[srat_num_cpus].phys_id =
-	    (pa->apic_id << 8) | (pa->local_sapic_eid);
-	/* nid should be overridden as logical node id later */
-	node_cpuid[srat_num_cpus].nid = pxm;
-	cpumask_set_cpu(srat_num_cpus, &early_cpu_possible_map);
-	srat_num_cpus++;
-}
-
-void __init
-acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
-{
-	unsigned long paddr, size;
-	int pxm;
-	struct node_memblk_s *p, *q, *pend;
-
-	pxm = get_memory_proximity_domain(ma);
-
-	/* fill node memory chunk structure */
-	paddr = ma->base_address;
-	size = ma->length;
-
-	/* Ignore disabled entries */
-	if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
-		return;
-
-	/* record this node in proximity bitmap */
-	pxm_bit_set(pxm);
-
-	/* Insertion sort based on base address */
-	pend = &node_memblk[num_node_memblks];
-	for (p = &node_memblk[0]; p < pend; p++) {
-		if (paddr < p->start_paddr)
-			break;
-	}
-	if (p < pend) {
-		for (q = pend - 1; q >= p; q--)
-			*(q + 1) = *q;
-	}
-	p->start_paddr = paddr;
-	p->size = size;
-	p->nid = pxm;
-	num_node_memblks++;
-}
-
-void __init acpi_numa_arch_fixup(void)
-{
-	int i, j, node_from, node_to;
-
-	/* If there's no SRAT, fix the phys_id and mark node 0 online */
-	if (srat_num_cpus == 0) {
-		node_set_online(0);
-		node_cpuid[0].phys_id = hard_smp_processor_id();
-		return;
-	}
-
-	/*
-	 * MCD - This can probably be dropped now.  No need for pxm ID to node ID
-	 * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
-	 */
-	nodes_clear(node_online_map);
-	for (i = 0; i < MAX_PXM_DOMAINS; i++) {
-		if (pxm_bit_test(i)) {
-			int nid = acpi_map_pxm_to_node(i);
-			node_set_online(nid);
-		}
-	}
-
-	/* set logical node id in memory chunk structure */
-	for (i = 0; i < num_node_memblks; i++)
-		node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
-
-	/* assign memory bank numbers for each chunk on each node */
-	for_each_online_node(i) {
-		int bank;
-
-		bank = 0;
-		for (j = 0; j < num_node_memblks; j++)
-			if (node_memblk[j].nid == i)
-				node_memblk[j].bank = bank++;
-	}
-
-	/* set logical node id in cpu structure */
-	for_each_possible_early_cpu(i)
-		node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
-
-	printk(KERN_INFO "Number of logical nodes in system = %d\n",
-	       num_online_nodes());
-	printk(KERN_INFO "Number of memory chunks in system = %d\n",
-	       num_node_memblks);
-
-	if (!slit_table)
-		return;
-	memset(numa_slit, -1, sizeof(numa_slit));
-	for (i = 0; i < slit_table->locality_count; i++) {
-		if (!pxm_bit_test(i))
-			continue;
-		node_from = pxm_to_node(i);
-		for (j = 0; j < slit_table->locality_count; j++) {
-			if (!pxm_bit_test(j))
-				continue;
-			node_to = pxm_to_node(j);
-			node_distance(node_from, node_to) =
-			    slit_table->entry[i * slit_table->locality_count + j];
-		}
-	}
-
-#ifdef SLIT_DEBUG
-	printk("ACPI 2.0 SLIT locality table:\n");
-	for_each_online_node(i) {
-		for_each_online_node(j)
-		    printk("%03d ", node_distance(i, j));
-		printk("\n");
-	}
-#endif
-}
-#endif				/* CONFIG_ACPI_NUMA */
-
-#ifndef XEN
-/*
- * success: return IRQ number (>=0)
- * failure: return < 0
- */
-int acpi_register_gsi(u32 gsi, int triggering, int polarity)
-{
-	if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
-		return gsi;
-
-	if (has_8259 && gsi < 16)
-		return isa_irq_to_vector(gsi);
-
-	return iosapic_register_intr(gsi,
-				     (polarity ==
-				      ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
-				     IOSAPIC_POL_LOW,
-				     (triggering ==
-				      ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
-				     IOSAPIC_LEVEL);
-}
-
-void acpi_unregister_gsi(u32 gsi)
-{
-	if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
-		return;
-
-	if (has_8259 && gsi < 16)
-		return;
-
-	iosapic_unregister_intr(gsi);
-}
-#endif
-
-static int __init acpi_parse_fadt(struct acpi_table_header *table)
-{
-	struct acpi_table_header *fadt_header;
-	struct acpi_table_fadt *fadt;
-
-	if (!table)
-		return -EINVAL;
-
-	fadt_header = (struct acpi_table_header *)table;
-	if (fadt_header->revision != 3)
-		return -ENODEV;	/* Only deal with ACPI 2.0 FADT */
-
-	fadt = (struct acpi_table_fadt *)fadt_header;
-
-#ifndef XEN
-	acpi_register_gsi(fadt->sci_interrupt, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
-#endif
-	return 0;
-}
-
-int __init acpi_boot_init(void)
-{
-
-	/*
-	 * MADT
-	 * ----
-	 * Parse the Multiple APIC Description Table (MADT), if exists.
-	 * Note that this table provides platform SMP configuration
-	 * information -- the successor to MPS tables.
-	 */
-
-	if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
-		printk(KERN_ERR PREFIX "Can't find MADT\n");
-		goto skip_madt;
-	}
-
-	/* Local APIC */
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, acpi_parse_lapic_addr_ovr, 0) < 0)
-		printk(KERN_ERR PREFIX
-		       "Error parsing LAPIC address override entry\n");
-
-	if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, acpi_parse_lsapic, NR_CPUS)
-	    < 1)
-		printk(KERN_ERR PREFIX
-		       "Error parsing MADT - no LAPIC entries\n");
-
-	if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0)
-	    < 0)
-		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
-
-	/* I/O APIC */
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_IO_SAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) {
-		if (!ia64_platform_is("sn2"))
-			printk(KERN_ERR PREFIX
-			       "Error parsing MADT - no IOSAPIC entries\n");
-	}
-
-	/* System-Level Interrupt Routing */
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_INTERRUPT_SOURCE, acpi_parse_plat_int_src,
-	     ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
-		printk(KERN_ERR PREFIX
-		       "Error parsing platform interrupt source entry\n");
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr, 0) < 0)
-		printk(KERN_ERR PREFIX
-		       "Error parsing interrupt source overrides entry\n");
-
-	if (acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src, 0) < 0)
-		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
-      skip_madt:
-
-	/*
-	 * FADT says whether a legacy keyboard controller is present.
-	 * The FADT also contains an SCI_INT line, by which the system
-	 * gets interrupts such as power and sleep buttons.  If it's not
-	 * on a Legacy interrupt, it needs to be setup.
-	 */
-	if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt))
-		printk(KERN_ERR PREFIX "Can't find FADT\n");
-
-#ifdef XEN
-	acpi_dmar_init();
-#endif
-
-#ifdef CONFIG_SMP
-	if (available_cpus == 0) {
-		printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
-		printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
-		smp_boot_data.cpu_phys_id[available_cpus] =
-		    hard_smp_processor_id();
-		available_cpus = 1;	/* We've got at least one of these, no? */
-	}
-	smp_boot_data.cpu_count = available_cpus;
-
-	smp_build_cpu_map();
-# ifdef CONFIG_ACPI_NUMA
-	if (srat_num_cpus == 0) {
-		int cpu, i = 1;
-		for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
-			if (smp_boot_data.cpu_phys_id[cpu] !=
-			    hard_smp_processor_id())
-				node_cpuid[i++].phys_id =
-				    smp_boot_data.cpu_phys_id[cpu];
-	}
-# endif
-#endif
-#ifdef CONFIG_ACPI_NUMA
-	build_cpu_to_node_map();
-#endif
-	/* Make boot-up look pretty */
-	printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
-	       total_cpus);
-	return 0;
-}
-
-int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
-{
-	int tmp;
-
-	if (has_8259 && gsi < 16)
-		*irq = isa_irq_to_vector(gsi);
-	else {
-		tmp = gsi_to_irq(gsi);
-		if (tmp == -1)
-			return -1;
-		*irq = tmp;
-	}
-	return 0;
-}
-
-/*
- *  ACPI based hotplug CPU support
- */
-#ifdef CONFIG_ACPI_HOTPLUG_CPU
-static
-int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
-{
-#ifdef CONFIG_ACPI_NUMA
-	int pxm_id;
-	int nid;
-
-	pxm_id = acpi_get_pxm(handle);
-	/*
-	 * We don't have cpu-only-node hotadd. But if the system equips
-	 * SRAT table, pxm is already found and node is ready.
-  	 * So, just pxm_to_nid(pxm) is OK.
-	 * This code here is for the system which doesn't have full SRAT
-  	 * table for possible cpus.
-	 */
-	nid = acpi_map_pxm_to_node(pxm_id);
-	node_cpuid[cpu].phys_id = physid;
-	node_cpuid[cpu].nid = nid;
-#endif
-	return (0);
-}
-
-int additional_cpus __initdata = -1;
-
-static __init int setup_additional_cpus(char *s)
-{
-	if (s)
-		additional_cpus = simple_strtol(s, NULL, 0);
-
-	return 0;
-}
-
-early_param("additional_cpus", setup_additional_cpus);
-
-/*
- * cpu_possible_map should be static, it cannot change as CPUs
- * are onlined, or offlined. The reason is per-cpu data-structures
- * are allocated by some modules at init time, and dont expect to
- * do this dynamically on cpu arrival/departure.
- * cpu_present_map on the other hand can change dynamically.
- * In case when cpu_hotplug is not compiled, then we resort to current
- * behaviour, which is cpu_possible == cpu_present.
- * - Ashok Raj
- *
- * Three ways to find out the number of additional hotplug CPUs:
- * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
- * - The user can overwrite it with additional_cpus=NUM
- * - Otherwise don't reserve additional CPUs.
- */
-__init void prefill_possible_map(void)
-{
-	int i;
-	int possible, disabled_cpus;
-
-	disabled_cpus = total_cpus - available_cpus;
-
- 	if (additional_cpus == -1) {
- 		if (disabled_cpus > 0)
-			additional_cpus = disabled_cpus;
- 		else
-			additional_cpus = 0;
- 	}
-
-	possible = available_cpus + additional_cpus;
-
-	if (possible > NR_CPUS)
-		possible = NR_CPUS;
-
-	printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
-		possible, max((possible - available_cpus), 0));
-
-	for (i = 0; i < possible; i++)
-		cpumask_set_cpu(i, &cpu_possible_map);
-}
-
-#ifndef XEN
-int acpi_map_lsapic(acpi_handle handle, int *pcpu)
-{
-	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-	union acpi_object *obj;
-	struct acpi_madt_local_sapic *lsapic;
-	cpumask_t tmp_map;
-	long physid;
-	int cpu;
-
-	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
-		return -EINVAL;
-
-	if (!buffer.length || !buffer.pointer)
-		return -EINVAL;
-
-	obj = buffer.pointer;
-	if (obj->type != ACPI_TYPE_BUFFER)
-	{
-		kfree(buffer.pointer);
-		return -EINVAL;
-	}
-
-	lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer;
-
-	if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
-	    (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))) {
-		kfree(buffer.pointer);
-		return -EINVAL;
-	}
-
-	physid = ((lsapic->id << 8) | (lsapic->eid));
-
-	kfree(buffer.pointer);
-	buffer.length = ACPI_ALLOCATE_BUFFER;
-	buffer.pointer = NULL;
-
-	cpumask_complement(&tmp_map, &cpu_present_map);
-	cpu = cpumask_first(&tmp_map);
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
-
-	acpi_map_cpu2node(handle, cpu, physid);
-
-	cpumask_set_cpu(cpu, &cpu_present_map);
-	ia64_cpu_to_sapicid[cpu] = physid;
-
-	*pcpu = cpu;
-	return (0);
-}
-
-EXPORT_SYMBOL(acpi_map_lsapic);
-
-int acpi_unmap_lsapic(int cpu)
-{
-	ia64_cpu_to_sapicid[cpu] = -1;
-	cpumask_clear_cpu(cpu, &cpu_present_map);
-
-#ifdef CONFIG_ACPI_NUMA
-	/* NUMA specific cleanup's */
-#endif
-
-	return (0);
-}
-
-EXPORT_SYMBOL(acpi_unmap_lsapic);
-#endif /* XEN */
-#endif				/* CONFIG_ACPI_HOTPLUG_CPU */
-
-#ifndef XEN
-#ifdef CONFIG_ACPI_NUMA
-static acpi_status __devinit
-acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
-{
-	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-	union acpi_object *obj;
-	struct acpi_madt_io_sapic *iosapic;
-	unsigned int gsi_base;
-	int pxm, node;
-
-	/* Only care about objects w/ a method that returns the MADT */
-	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
-		return AE_OK;
-
-	if (!buffer.length || !buffer.pointer)
-		return AE_OK;
-
-	obj = buffer.pointer;
-	if (obj->type != ACPI_TYPE_BUFFER ||
-	    obj->buffer.length < sizeof(*iosapic)) {
-		kfree(buffer.pointer);
-		return AE_OK;
-	}
-
-	iosapic = (struct acpi_madt_io_sapic *)obj->buffer.pointer;
-
-	if (iosapic->header.type != ACPI_MADT_TYPE_IO_SAPIC) {
-		kfree(buffer.pointer);
-		return AE_OK;
-	}
-
-	gsi_base = iosapic->global_irq_base;
-
-	kfree(buffer.pointer);
-
-	/*
-	 * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell
-	 * us which node to associate this with.
-	 */
-	pxm = acpi_get_pxm(handle);
-	if (pxm < 0)
-		return AE_OK;
-
-	node = pxm_to_node(pxm);
-
-	if (node >= MAX_NUMNODES || !node_online(node) ||
-	    cpus_empty(node_to_cpumask(node)))
-		return AE_OK;
-
-	/* We know a gsi to node mapping! */
-	map_iosapic_to_node(gsi_base, node);
-	return AE_OK;
-}
-
-static int __init
-acpi_map_iosapics (void)
-{
-	acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL);
-	return 0;
-}
-
-fs_initcall(acpi_map_iosapics);
-#endif				/* CONFIG_ACPI_NUMA */
-
-int __ref acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
-{
-	int err;
-
-	if ((err = iosapic_init(phys_addr, gsi_base)))
-		return err;
-
-#ifdef CONFIG_ACPI_NUMA
-	acpi_map_iosapic(handle, 0, NULL, NULL);
-#endif				/* CONFIG_ACPI_NUMA */
-
-	return 0;
-}
-
-EXPORT_SYMBOL(acpi_register_ioapic);
-
-int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
-{
-	return iosapic_remove(gsi_base);
-}
-
-EXPORT_SYMBOL(acpi_unregister_ioapic);
-#endif /* XEN */
-
-/*
- * acpi_save_state_mem() - save kernel state
- *
- * TBD when when IA64 starts to support suspend...
- */
-int acpi_save_state_mem(void) { return 0; } 
-
-/*
- * acpi_restore_state()
- */
-void acpi_restore_state_mem(void) {}
-
-/*
- * do_suspend_lowlevel()
- */
-void do_suspend_lowlevel(void) {}
-
-#endif				/* CONFIG_ACPI */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/acpi_numa.c
--- a/xen/arch/ia64/linux-xen/acpi_numa.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +0,0 @@
-/*
- *  acpi_numa.c - ACPI NUMA support
- *
- *  Copyright (C) 2002 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/acpi.h>
-#include <acpi/acmacros.h>
-
-#ifndef XEN
-#define ACPI_NUMA	0x80000000
-#define _COMPONENT	ACPI_NUMA
-ACPI_MODULE_NAME("numa");
-#else
-#define NID_INVAL	-1
-#define PXM_INVAL	-1
-#endif
-
-#ifndef XEN
-static nodemask_t nodes_found_map = NODE_MASK_NONE;
-#else
-/* the above causes error: initializer element is not constant
- * anyway NODE_MASK_NONE is 0 filled array.
- */
-static nodemask_t nodes_found_map;
-#endif
-
-/* maps to convert between proximity domain and logical node ID */
-static int pxm_to_node_map[MAX_PXM_DOMAINS]
-				= { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL };
-static int node_to_pxm_map[MAX_NUMNODES]
-				= { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
-
-int pxm_to_node(int pxm)
-{
-	if (pxm < 0)
-		return NID_INVAL;
-	return pxm_to_node_map[pxm];
-}
-
-int node_to_pxm(int node)
-{
-	if (node < 0)
-		return PXM_INVAL;
-	return node_to_pxm_map[node];
-}
-
-void __acpi_map_pxm_to_node(int pxm, int node)
-{
-	pxm_to_node_map[pxm] = node;
-	node_to_pxm_map[node] = pxm;
-}
-
-int acpi_map_pxm_to_node(int pxm)
-{
-	int node = pxm_to_node_map[pxm];
-
-	if (node < 0){
-		if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
-			return NID_INVAL;
-		node = first_unset_node(nodes_found_map);
-		__acpi_map_pxm_to_node(pxm, node);
-		node_set(node, nodes_found_map);
-	}
-
-	return node;
-}
-
-#ifndef XEN
-#if 0
-void __cpuinit acpi_unmap_pxm_to_node(int node)
-{
-	int pxm = node_to_pxm_map[node];
-	pxm_to_node_map[pxm] = NID_INVAL;
-	node_to_pxm_map[node] = PXM_INVAL;
-	node_clear(node, nodes_found_map);
-}
-#endif  /*  0  */
-
-static void __init
-acpi_table_print_srat_entry(struct acpi_subtable_header *header)
-{
-
-	ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
-
-	if (!header)
-		return;
-
-	switch (header->type) {
-
-	case ACPI_SRAT_TYPE_CPU_AFFINITY:
-#ifdef ACPI_DEBUG_OUTPUT
-		{
-			struct acpi_srat_cpu_affinity *p =
-			    (struct acpi_srat_cpu_affinity *)header;
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-					  "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
-					  p->apic_id, p->local_sapic_eid,
-					  p->proximity_domain_lo,
-					  (p->flags & ACPI_SRAT_CPU_ENABLED)?
-					  "enabled" : "disabled"));
-		}
-#endif				/* ACPI_DEBUG_OUTPUT */
-		break;
-
-	case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
-#ifdef ACPI_DEBUG_OUTPUT
-		{
-			struct acpi_srat_mem_affinity *p =
-			    (struct acpi_srat_mem_affinity *)header;
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-					  "SRAT Memory (0x%lx length 0x%lx type 0x%x) in proximity domain %d %s%s\n",
-					  (unsigned long)p->base_address,
-					  (unsigned long)p->length,
-					  p->memory_type, p->proximity_domain,
-					  (p->flags & ACPI_SRAT_MEM_ENABLED)?
-					  "enabled" : "disabled",
-					  (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)?
-					  " hot-pluggable" : ""));
-		}
-#endif				/* ACPI_DEBUG_OUTPUT */
-		break;
-
-	default:
-		printk(KERN_WARNING PREFIX
-		       "Found unsupported SRAT entry (type = 0x%x)\n",
-		       header->type);
-		break;
-	}
-}
-
-static int __init acpi_parse_slit(struct acpi_table_header *table)
-{
-	struct acpi_table_slit *slit;
-	u32 localities;
-
-	if (!table)
-		return -EINVAL;
-
-	slit = (struct acpi_table_slit *)table;
-
-	/* downcast just for %llu vs %lu for i386/ia64  */
-	localities = (u32) slit->locality_count;
-
-	acpi_numa_slit_init(slit);
-
-	return 0;
-}
-
-static int __init
-acpi_parse_processor_affinity(struct acpi_subtable_header * header,
-			      const unsigned long end)
-{
-	struct acpi_srat_cpu_affinity *processor_affinity;
-
-	processor_affinity = (struct acpi_srat_cpu_affinity *)header;
-	if (!processor_affinity)
-		return -EINVAL;
-
-	acpi_table_print_srat_entry(header);
-
-	/* let architecture-dependent part to do it */
-	acpi_numa_processor_affinity_init(processor_affinity);
-
-	return 0;
-}
-
-static int __init
-acpi_parse_memory_affinity(struct acpi_subtable_header * header,
-			   const unsigned long end)
-{
-	struct acpi_srat_mem_affinity *memory_affinity;
-
-	memory_affinity = (struct acpi_srat_mem_affinity *)header;
-	if (!memory_affinity)
-		return -EINVAL;
-
-	acpi_table_print_srat_entry(header);
-
-	/* let architecture-dependent part to do it */
-	acpi_numa_memory_affinity_init(memory_affinity);
-
-	return 0;
-}
-
-static int __init acpi_parse_srat(struct acpi_table_header *table)
-{
-	struct acpi_table_srat *srat;
-
-	if (!table)
-		return -EINVAL;
-
-	srat = (struct acpi_table_srat *)table;
-
-	return 0;
-}
-
-static int __init
-acpi_table_parse_srat(enum acpi_srat_type id,
-		      acpi_table_entry_handler handler, unsigned int max_entries)
-{
-	return acpi_table_parse_entries(ACPI_SIG_SRAT,
-					    sizeof(struct acpi_table_srat), id,
-					    handler, max_entries);
-}
-
-int __init acpi_numa_init(void)
-{
-	/* SRAT: Static Resource Affinity Table */
-	if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
-		acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
-				      acpi_parse_processor_affinity, NR_CPUS);
-		acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
-				      acpi_parse_memory_affinity,
-				      NR_NODE_MEMBLKS);
-	}
-
-	/* SLIT: System Locality Information Table */
-	acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit);
-
-	acpi_numa_arch_fixup();
-	return 0;
-}
-
-int acpi_get_pxm(acpi_handle h)
-{
-	unsigned long pxm;
-	acpi_status status;
-	acpi_handle handle;
-	acpi_handle phandle = h;
-
-	do {
-		handle = phandle;
-		status = acpi_evaluate_integer(handle, "_PXM", NULL, &pxm);
-		if (ACPI_SUCCESS(status))
-			return pxm;
-		status = acpi_get_parent(handle, &phandle);
-	} while (ACPI_SUCCESS(status));
-	return -1;
-}
-
-int acpi_get_node(acpi_handle *handle)
-{
-	int pxm, node = -1;
-
-	pxm = acpi_get_pxm(handle);
-	if (pxm >= 0)
-		node = acpi_map_pxm_to_node(pxm);
-
-	return node;
-}
-EXPORT_SYMBOL(acpi_get_node);
-#endif /* XEN */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/cmdline.c
--- a/xen/arch/ia64/linux-xen/cmdline.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * linux/lib/cmdline.c
- * Helper functions generally used for parsing kernel command line
- * and module options.
- *
- * Code and copyrights come from init/main.c and arch/i386/kernel/setup.c.
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2.  See the file COPYING for more details.
- *
- * GNU Indent formatting options for this file: -kr -i8 -npsl -pcs
- *
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#ifdef XEN
-#include <xen/lib.h>
-#endif
-
-
-/**
- *	get_option - Parse integer from an option string
- *	@str: option string
- *	@pint: (output) integer value parsed from @str
- *
- *	Read an int from an option string; if available accept a subsequent
- *	comma as well.
- *
- *	Return values:
- *	0 : no int in string
- *	1 : int found, no subsequent comma
- *	2 : int found including a subsequent comma
- */
-
-int get_option (char **str, int *pint)
-{
-	char *cur = *str;
-
-	if (!cur || !(*cur))
-		return 0;
-#ifndef XEN
-	*pint = simple_strtol (cur, str, 0);
-#else
-	*pint = simple_strtol (cur, (const char**)str, 0);
-#endif
-	if (cur == *str)
-		return 0;
-	if (**str == ',') {
-		(*str)++;
-		return 2;
-	}
-
-	return 1;
-}
-
-/**
- *	get_options - Parse a string into a list of integers
- *	@str: String to be parsed
- *	@nints: size of integer array
- *	@ints: integer array
- *
- *	This function parses a string containing a comma-separated
- *	list of integers.  The parse halts when the array is
- *	full, or when no more numbers can be retrieved from the
- *	string.
- *
- *	Return value is the character in the string which caused
- *	the parse to end (typically a null terminator, if @str is
- *	completely parseable).
- */
- 
-char *get_options(const char *str, int nints, int *ints)
-{
-	int res, i = 1;
-
-	while (i < nints) {
-		res = get_option ((char **)&str, ints + i);
-		if (res == 0)
-			break;
-		i++;
-		if (res == 1)
-			break;
-	}
-	ints[0] = i - 1;
-	return (char *)str;
-}
-
-/**
- *	memparse - parse a string with mem suffixes into a number
- *	@ptr: Where parse begins
- *	@retptr: (output) Pointer to next char after parse completes
- *
- *	Parses a string into a number.  The number stored at @ptr is
- *	potentially suffixed with %K (for kilobytes, or 1024 bytes),
- *	%M (for megabytes, or 1048576 bytes), or %G (for gigabytes, or
- *	1073741824).  If the number is suffixed with K, M, or G, then
- *	the return value is the number multiplied by one kilobyte, one
- *	megabyte, or one gigabyte, respectively.
- */
-
-unsigned long long memparse (char *ptr, char **retptr)
-{
-#ifndef XEN
-	unsigned long long ret = simple_strtoull (ptr, retptr, 0);
-#else
-	unsigned long long ret = simple_strtoull (ptr, (const char**)retptr, 0);
-#endif
-
-	switch (**retptr) {
-	case 'G':
-	case 'g':
-		ret <<= 10;
-	case 'M':
-	case 'm':
-		ret <<= 10;
-	case 'K':
-	case 'k':
-		ret <<= 10;
-		(*retptr)++;
-	default:
-		break;
-	}
-	return ret;
-}
-
-
-EXPORT_SYMBOL(memparse);
-EXPORT_SYMBOL(get_option);
-EXPORT_SYMBOL(get_options);
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/efi.c
--- a/xen/arch/ia64/linux-xen/efi.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1334 +0,0 @@
-/*
- * Extensible Firmware Interface
- *
- * Based on Extensible Firmware Interface Specification version 0.9 April 30, 1999
- *
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- * Copyright (C) 1999-2003 Hewlett-Packard Co.
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *	Stephane Eranian <eranian@hpl.hp.com>
- * (c) Copyright 2006 Hewlett-Packard Development Company, L.P.
- *	Bjorn Helgaas <bjorn.helgaas@hp.com>
- *
- * All EFI Runtime Services are not implemented yet as EFI only
- * supports physical mode addressing on SoftSDV. This is to be fixed
- * in a future version.  --drummond 1999-07-20
- *
- * Implemented EFI runtime services and virtual mode calls.  --davidm
- *
- * Goutham Rao: <goutham.rao@intel.com>
- *	Skip non-WB memory and ignore empty memory ranges.
- */
-#include <linux/module.h>
-#include <linux/bootmem.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/time.h>
-#include <linux/efi.h>
-#include <linux/kexec.h>
-
-#include <asm/io.h>
-#include <asm/kregs.h>
-#include <asm/meminit.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/mca.h>
-
-#define EFI_DEBUG	0
-
-extern efi_status_t efi_call_phys (void *, ...);
-#ifdef XEN
-/* this should be defined in linux/kernel.h */
-extern unsigned long long memparse (char *ptr, char **retptr);
-/* this should be defined in linux/efi.h */
-//#define EFI_INVALID_TABLE_ADDR          (void *)(~0UL)
-#endif
-
-struct efi efi;
-EXPORT_SYMBOL(efi);
-static efi_runtime_services_t *runtime;
-#if defined(XEN) && !defined(CONFIG_VIRTUAL_FRAME_TABLE)
-// this is a temporary hack to avoid CONFIG_VIRTUAL_MEM_MAP
-static unsigned long mem_limit = ~0UL, max_addr = 0x100000000UL, min_addr = 0UL;
-#else
-static unsigned long mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;
-#endif
-
-#define efi_call_virt(f, args...)	(*(f))(args)
-
-#define STUB_GET_TIME(prefix, adjust_arg)							  \
-static efi_status_t										  \
-prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc)						  \
-{												  \
-	struct ia64_fpreg fr[6];								  \
-	efi_time_cap_t *atc = NULL;								  \
-	efi_status_t ret;									  \
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												  \
-	if (tc)											  \
-		atc = adjust_arg(tc);								  \
-	ia64_save_scratch_fpregs(fr);								  \
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), adjust_arg(tm), atc); \
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								  \
-	return ret;										  \
-}
-
-#define STUB_SET_TIME(prefix, adjust_arg)							\
-static efi_status_t										\
-prefix##_set_time (efi_time_t *tm)								\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_set_time_t *) __va(runtime->set_time), adjust_arg(tm));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_GET_WAKEUP_TIME(prefix, adjust_arg)						\
-static efi_status_t										\
-prefix##_get_wakeup_time (efi_bool_t *enabled, efi_bool_t *pending, efi_time_t *tm)		\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_wakeup_time_t *) __va(runtime->get_wakeup_time),	\
-				adjust_arg(enabled), adjust_arg(pending), adjust_arg(tm));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_SET_WAKEUP_TIME(prefix, adjust_arg)						\
-static efi_status_t										\
-prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm)					\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_time_t *atm = NULL;									\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	if (tm)											\
-		atm = adjust_arg(tm);								\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_set_wakeup_time_t *) __va(runtime->set_wakeup_time),	\
-				enabled, atm);							\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_GET_VARIABLE(prefix, adjust_arg)						\
-static efi_status_t									\
-prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr,		\
-		       unsigned long *data_size, void *data)				\
-{											\
-	struct ia64_fpreg fr[6];							\
-	u32 *aattr = NULL;									\
-	efi_status_t ret;								\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-											\
-	if (attr)									\
-		aattr = adjust_arg(attr);						\
-	ia64_save_scratch_fpregs(fr);							\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_variable_t *) __va(runtime->get_variable),	\
-				adjust_arg(name), adjust_arg(vendor), aattr,		\
-				adjust_arg(data_size), adjust_arg(data));		\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);							\
-	return ret;									\
-}
-
-#define STUB_GET_NEXT_VARIABLE(prefix, adjust_arg)						\
-static efi_status_t										\
-prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, efi_guid_t *vendor)	\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_next_variable_t *) __va(runtime->get_next_variable),	\
-				adjust_arg(name_size), adjust_arg(name), adjust_arg(vendor));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_SET_VARIABLE(prefix, adjust_arg)						\
-static efi_status_t									\
-prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, unsigned long attr,	\
-		       unsigned long data_size, void *data)				\
-{											\
-	struct ia64_fpreg fr[6];							\
-	efi_status_t ret;								\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-											\
-	ia64_save_scratch_fpregs(fr);							\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_set_variable_t *) __va(runtime->set_variable),	\
-				adjust_arg(name), adjust_arg(vendor), attr, data_size,	\
-				adjust_arg(data));					\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);							\
-	return ret;									\
-}
-
-#define STUB_GET_NEXT_HIGH_MONO_COUNT(prefix, adjust_arg)					\
-static efi_status_t										\
-prefix##_get_next_high_mono_count (u32 *count)							\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_next_high_mono_count_t *)				\
-				__va(runtime->get_next_high_mono_count), adjust_arg(count));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_RESET_SYSTEM(prefix, adjust_arg)					\
-static void									\
-prefix##_reset_system (int reset_type, efi_status_t status,			\
-		       unsigned long data_size, efi_char16_t *data)		\
-{										\
-	struct ia64_fpreg fr[6];						\
-	efi_char16_t *adata = NULL;						\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-										\
-	if (data)								\
-		adata = adjust_arg(data);					\
-										\
-	ia64_save_scratch_fpregs(fr);						\
-	XEN_EFI_RR_ENTER(rr6, rr7);						\
-	efi_call_##prefix((efi_reset_system_t *) __va(runtime->reset_system),	\
-			  reset_type, status, data_size, adata);		\
-	/* should not return, but just in case... */				\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);						\
-}
-
-#define phys_ptr(arg)	((__typeof__(arg)) ia64_tpa(arg))
-
-STUB_GET_TIME(phys, phys_ptr)
-STUB_SET_TIME(phys, phys_ptr)
-STUB_GET_WAKEUP_TIME(phys, phys_ptr)
-STUB_SET_WAKEUP_TIME(phys, phys_ptr)
-STUB_GET_VARIABLE(phys, phys_ptr)
-STUB_GET_NEXT_VARIABLE(phys, phys_ptr)
-STUB_SET_VARIABLE(phys, phys_ptr)
-STUB_GET_NEXT_HIGH_MONO_COUNT(phys, phys_ptr)
-STUB_RESET_SYSTEM(phys, phys_ptr)
-
-#define id(arg)	arg
-
-STUB_GET_TIME(virt, id)
-STUB_SET_TIME(virt, id)
-STUB_GET_WAKEUP_TIME(virt, id)
-STUB_SET_WAKEUP_TIME(virt, id)
-STUB_GET_VARIABLE(virt, id)
-STUB_GET_NEXT_VARIABLE(virt, id)
-STUB_SET_VARIABLE(virt, id)
-STUB_GET_NEXT_HIGH_MONO_COUNT(virt, id)
-STUB_RESET_SYSTEM(virt, id)
-
-#ifndef XEN
-void
-efi_gettimeofday (struct timespec *ts)
-{
-	efi_time_t tm;
-
-	memset(ts, 0, sizeof(ts));
-	if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS)
-		return;
-
-	ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
-	ts->tv_nsec = tm.nanosecond;
-}
-#endif
-
-static int
-is_memory_available (efi_memory_desc_t *md)
-{
-	if (!(md->attribute & EFI_MEMORY_WB))
-		return 0;
-
-	switch (md->type) {
-	      case EFI_LOADER_CODE:
-	      case EFI_LOADER_DATA:
-	      case EFI_BOOT_SERVICES_CODE:
-	      case EFI_BOOT_SERVICES_DATA:
-	      case EFI_CONVENTIONAL_MEMORY:
-		return 1;
-	}
-	return 0;
-}
-
-typedef struct kern_memdesc {
-	u64 attribute;
-	u64 start;
-	u64 num_pages;
-} kern_memdesc_t;
-
-static kern_memdesc_t *kern_memmap;
-
-#define efi_md_size(md)	(md->num_pages << EFI_PAGE_SHIFT)
-
-static inline u64
-kmd_end(kern_memdesc_t *kmd)
-{
-	return (kmd->start + (kmd->num_pages << EFI_PAGE_SHIFT));
-}
-
-static inline u64
-efi_md_end(efi_memory_desc_t *md)
-{
-	return (md->phys_addr + efi_md_size(md));
-}
-
-static inline int
-efi_wb(efi_memory_desc_t *md)
-{
-	return (md->attribute & EFI_MEMORY_WB);
-}
-
-static inline int
-efi_uc(efi_memory_desc_t *md)
-{
-	return (md->attribute & EFI_MEMORY_UC);
-}
-
-static void
-walk (efi_freemem_callback_t callback, void *arg, u64 attr)
-{
-	kern_memdesc_t *k;
-	u64 start, end, voff;
-
-	voff = (attr == EFI_MEMORY_WB) ? PAGE_OFFSET : __IA64_UNCACHED_OFFSET;
-	for (k = kern_memmap; k->start != ~0UL; k++) {
-		if (k->attribute != attr)
-			continue;
-		start = PAGE_ALIGN(k->start);
-		end = (k->start + (k->num_pages << EFI_PAGE_SHIFT)) & PAGE_MASK;
-		if (start < end)
-			if ((*callback)(start + voff, end + voff, arg) < 0)
-				return;
-	}
-}
-
-/*
- * Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that
- * has memory that is available for OS use.
- */
-void
-efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
-{
-	walk(callback, arg, EFI_MEMORY_WB);
-}
-
-/*
- * Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that
- * has memory that is available for uncached allocator.
- */
-void
-efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg)
-{
-	walk(callback, arg, EFI_MEMORY_UC);
-}
-
-/*
- * Look for the PAL_CODE region reported by EFI and maps it using an
- * ITR to enable safe PAL calls in virtual mode.  See IA-64 Processor
- * Abstraction Layer chapter 11 in ADAG
- */
-
-#ifdef XEN
-static void *
-__efi_get_pal_addr (void)
-#else
-void *
-efi_get_pal_addr (void)
-#endif
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-	int pal_code_count = 0;
-	u64 vaddr, mask;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-		if (md->type != EFI_PAL_CODE)
-			continue;
-
-		if (++pal_code_count > 1) {
-			printk(KERN_ERR "Too many EFI Pal Code memory ranges, dropped @ %lx\n",
-			       md->phys_addr);
-			continue;
-		}
-		/*
-		 * The only ITLB entry in region 7 that is used is the one installed by
-		 * __start().  That entry covers a 64MB range.
-		 */
-		mask  = ~((1 << KERNEL_TR_PAGE_SHIFT) - 1);
-		vaddr = PAGE_OFFSET + md->phys_addr;
-
-		/*
-		 * We must check that the PAL mapping won't overlap with the kernel
-		 * mapping.
-		 *
-		 * PAL code is guaranteed to be aligned on a power of 2 between 4k and
-		 * 256KB and that only one ITR is needed to map it. This implies that the
-		 * PAL code is always aligned on its size, i.e., the closest matching page
-		 * size supported by the TLB. Therefore PAL code is guaranteed never to
-		 * cross a 64MB unless it is bigger than 64MB (very unlikely!).  So for
-		 * now the following test is enough to determine whether or not we need a
-		 * dedicated ITR for the PAL code.
-		 */
-		if ((vaddr & mask) == (KERNEL_START & mask)) {
-			printk(KERN_INFO "%s: no need to install ITR for PAL code\n",
-			       __FUNCTION__);
-			continue;
-		}
-
-		if (md->num_pages << EFI_PAGE_SHIFT > IA64_GRANULE_SIZE)
-			panic("Woah!  PAL code size bigger than a granule!");
-
-#if EFI_DEBUG
-		mask  = ~((1 << IA64_GRANULE_SHIFT) - 1);
-
-		printk(KERN_INFO "CPU %d: mapping PAL code [0x%lx-0x%lx) into [0x%lx-0x%lx)\n",
-			smp_processor_id(), md->phys_addr,
-			md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
-			vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE);
-#endif
-		return __va_efi(md->phys_addr);
-	}
-	printk(KERN_WARNING "%s: no PAL-code memory-descriptor found\n",
-	       __FUNCTION__);
-	return NULL;
-}
-
-#ifdef XEN
-static void *pal_vaddr = 0;
-
-void *
-efi_get_pal_addr(void)
-{
-	if (!pal_vaddr)
-		pal_vaddr = __efi_get_pal_addr();
-	return pal_vaddr;
-}
-#endif
-
-#ifdef XEN
-static void
-__efi_unmap_pal_code (void *pal_vaddr)
-{
-	ia64_ptr(0x1, GRANULEROUNDDOWN((unsigned long)pal_vaddr),
-		 IA64_GRANULE_SHIFT);
-}
-
-void
-efi_unmap_pal_code (void)
-{
-	void *pal_vaddr = efi_get_pal_addr ();
-	u64 psr;
-
-	if (!pal_vaddr)
-		return;
-
-	/*
-	 * Cannot write to CRx with PSR.ic=1
-	 */
-	psr = ia64_clear_ic();
-	__efi_unmap_pal_code(pal_vaddr);
-	ia64_set_psr(psr);		/* restore psr */
-	ia64_srlz_i();
-}
-#endif
-
-void
-efi_map_pal_code (void)
-{
-	void *pal_vaddr = efi_get_pal_addr ();
-	u64 psr;
-
-	if (!pal_vaddr)
-		return;
-
-	/*
-	 * Cannot write to CRx with PSR.ic=1
-	 */
-	psr = ia64_clear_ic();
-#ifdef XEN
-	/* pal_vaddr must be unpinned before pinning
-	 * This is needed in the case of a nested EFI, PAL or SAL call */
-	__efi_unmap_pal_code(pal_vaddr);
-#endif
-	ia64_itr(0x1, IA64_TR_PALCODE, GRANULEROUNDDOWN((unsigned long) pal_vaddr),
-		 pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)),
-		 IA64_GRANULE_SHIFT);
-	ia64_set_psr(psr);		/* restore psr */
-	ia64_srlz_i();
-}
-
-void __init
-efi_init (void)
-{
-	void *efi_map_start, *efi_map_end;
-	efi_config_table_t *config_tables;
-	efi_char16_t *c16;
-	u64 efi_desc_size;
-	char *cp, vendor[100] = "unknown";
-	int i;
-
-	/* it's too early to be able to use the standard kernel command line support... */
-#ifdef XEN
-	extern char saved_command_line[];
-	for (cp = saved_command_line; *cp; ) {
-#else
-	for (cp = boot_command_line; *cp; ) {
-#endif
-		if (memcmp(cp, "mem=", 4) == 0) {
-			mem_limit = memparse(cp + 4, &cp);
-		} else if (memcmp(cp, "max_addr=", 9) == 0) {
-			max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
-		} else if (memcmp(cp, "min_addr=", 9) == 0) {
-			min_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
-		} else {
-			while (*cp != ' ' && *cp)
-				++cp;
-			while (*cp == ' ')
-				++cp;
-		}
-	}
-	if (min_addr != 0UL)
-		printk(KERN_INFO "Ignoring memory below %luMB\n", min_addr >> 20);
-	if (max_addr != ~0UL)
-		printk(KERN_INFO "Ignoring memory above %luMB\n", max_addr >> 20);
-
-	efi.systab = __va(ia64_boot_param->efi_systab);
-
-	/*
-	 * Verify the EFI Table
-	 */
-	if (efi.systab == NULL)
-		panic("Woah! Can't find EFI system table.\n");
-	if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
-		panic("Woah! EFI system table signature incorrect\n");
-	if ((efi.systab->hdr.revision >> 16) == 0)
-		printk(KERN_WARNING "Warning: EFI system table version "
-		       "%d.%02d, expected 1.00 or greater\n",
-		       efi.systab->hdr.revision >> 16,
-		       efi.systab->hdr.revision & 0xffff);
-
-	config_tables = __va(efi.systab->tables);
-
-	/* Show what we know for posterity */
-	c16 = __va(efi.systab->fw_vendor);
-	if (c16) {
-		for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i)
-			vendor[i] = *c16++;
-		vendor[i] = '\0';
-	}
-
-	printk(KERN_INFO "EFI v%u.%.02u by %s:",
-	       efi.systab->hdr.revision >> 16, efi.systab->hdr.revision & 0xffff, vendor);
-
-	efi.mps        = EFI_INVALID_TABLE_ADDR;
-	efi.acpi       = EFI_INVALID_TABLE_ADDR;
-	efi.acpi20     = EFI_INVALID_TABLE_ADDR;
-	efi.smbios     = EFI_INVALID_TABLE_ADDR;
-	efi.sal_systab = EFI_INVALID_TABLE_ADDR;
-	efi.boot_info  = EFI_INVALID_TABLE_ADDR;
-	efi.hcdp       = EFI_INVALID_TABLE_ADDR;
-	efi.uga        = EFI_INVALID_TABLE_ADDR;
-
-	for (i = 0; i < (int) efi.systab->nr_tables; i++) {
-		if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) {
-			efi.mps = config_tables[i].table;
-			printk(" MPS=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) {
-			efi.acpi20 = config_tables[i].table;
-			printk(" ACPI 2.0=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) {
-			efi.acpi = config_tables[i].table;
-			printk(" ACPI=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) {
-			efi.smbios = config_tables[i].table;
-			printk(" SMBIOS=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID) == 0) {
-			efi.sal_systab = config_tables[i].table;
-			printk(" SALsystab=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) {
-			efi.hcdp = config_tables[i].table;
-			printk(" HCDP=0x%lx", config_tables[i].table);
-		}
-	}
-	printk("\n");
-
-	runtime = __va(efi.systab->runtime);
-	efi.get_time = phys_get_time;
-	efi.set_time = phys_set_time;
-	efi.get_wakeup_time = phys_get_wakeup_time;
-	efi.set_wakeup_time = phys_set_wakeup_time;
-	efi.get_variable = phys_get_variable;
-	efi.get_next_variable = phys_get_next_variable;
-	efi.set_variable = phys_set_variable;
-	efi.get_next_high_mono_count = phys_get_next_high_mono_count;
-	efi.reset_system = phys_reset_system;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-#if EFI_DEBUG
-	/* print EFI memory map: */
-	{
-		efi_memory_desc_t *md;
-		void *p;
-
-		for (i = 0, p = efi_map_start; p < efi_map_end; ++i, p += efi_desc_size) {
-			md = p;
-			printk("mem%02u: type=%u, attr=0x%lx, range=[0x%016lx-0x%016lx) (%luMB)\n",
-			       i, md->type, md->attribute, md->phys_addr,
-			       md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
-			       md->num_pages >> (20 - EFI_PAGE_SHIFT));
-		}
-	}
-#endif
-
-#ifndef XEN
-	efi_map_pal_code();
-#endif
-	efi_enter_virtual_mode();
-}
-
-void
-efi_enter_virtual_mode (void)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	efi_status_t status;
-	u64 efi_desc_size;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-#ifdef XEN
-		if (md->attribute & EFI_MEMORY_RUNTIME) {
-			if (md->attribute & EFI_MEMORY_WB)
-				md->virt_addr = __IA64_EFI_CACHED_OFFSET|
-						md->phys_addr;
-			else if (md->attribute & (EFI_MEMORY_UC|EFI_MEMORY_WC|
-						  EFI_MEMORY_WT))
-				md->virt_addr = __IA64_EFI_UNCACHED_OFFSET|
-						md->phys_addr;
-		}
-#else
-		if (md->attribute & EFI_MEMORY_RUNTIME) {
-			/*
-			 * Some descriptors have multiple bits set, so the order of
-			 * the tests is relevant.
-			 */
-			if (md->attribute & EFI_MEMORY_WB) {
-				md->virt_addr = (u64) __va(md->phys_addr);
-			} else if (md->attribute & EFI_MEMORY_UC) {
-				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
-			} else if (md->attribute & EFI_MEMORY_WC) {
-#if 0
-				md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P
-									   | _PAGE_D
-									   | _PAGE_MA_WC
-									   | _PAGE_PL_0
-									   | _PAGE_AR_RW));
-#else
-				printk(KERN_INFO "EFI_MEMORY_WC mapping\n");
-				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
-#endif
-			} else if (md->attribute & EFI_MEMORY_WT) {
-#if 0
-				md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P
-									   | _PAGE_D | _PAGE_MA_WT
-									   | _PAGE_PL_0
-									   | _PAGE_AR_RW));
-#else
-				printk(KERN_INFO "EFI_MEMORY_WT mapping\n");
-				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
-#endif
-			}
-		}
-#endif
-	}
-
-	status = efi_call_phys(__va(runtime->set_virtual_address_map),
-			       ia64_boot_param->efi_memmap_size,
-			       efi_desc_size, ia64_boot_param->efi_memdesc_version,
-			       ia64_boot_param->efi_memmap);
-	if (status != EFI_SUCCESS) {
-		printk(KERN_WARNING "warning: unable to switch EFI into virtual mode "
-		       "(status=%lu)\n", status);
-		return;
-	}
-
-	/*
-	 * Now that EFI is in virtual mode, we call the EFI functions more efficiently:
-	 */
-	efi.get_time = virt_get_time;
-	efi.set_time = virt_set_time;
-	efi.get_wakeup_time = virt_get_wakeup_time;
-	efi.set_wakeup_time = virt_set_wakeup_time;
-	efi.get_variable = virt_get_variable;
-	efi.get_next_variable = virt_get_next_variable;
-	efi.set_variable = virt_set_variable;
-	efi.get_next_high_mono_count = virt_get_next_high_mono_count;
-	efi.reset_system = virt_reset_system;
-}
-
-/*
- * Walk the EFI memory map looking for the I/O port range.  There can only be one entry of
- * this type, other I/O port ranges should be described via ACPI.
- */
-u64
-efi_get_iobase (void)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-		if (md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) {
-			if (md->attribute & EFI_MEMORY_UC)
-				return md->phys_addr;
-		}
-	}
-	return 0;
-}
-
-static struct kern_memdesc *
-kern_memory_descriptor (unsigned long phys_addr)
-{
-	struct kern_memdesc *md;
-
-	for (md = kern_memmap; md->start != ~0UL; md++) {
-		if (phys_addr - md->start < (md->num_pages << EFI_PAGE_SHIFT))
-			 return md;
-	}
-	return NULL;
-}
-
-static efi_memory_desc_t *
-efi_memory_descriptor (unsigned long phys_addr)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-
-		if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT))
-			 return md;
-	}
-	return NULL;
-}
-
-u32
-efi_mem_type (unsigned long phys_addr)
-{
-	efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
-
-	if (md)
-		return md->type;
-	return 0;
-}
-
-u64
-efi_mem_attributes (unsigned long phys_addr)
-{
-	efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
-
-	if (md)
-		return md->attribute;
-	return 0;
-}
-EXPORT_SYMBOL(efi_mem_attributes);
-
-u64
-efi_mem_attribute (unsigned long phys_addr, unsigned long size)
-{
-	unsigned long end = phys_addr + size;
-	efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
-	u64 attr;
-
-	if (!md)
-		return 0;
-
-	/*
-	 * EFI_MEMORY_RUNTIME is not a memory attribute; it just tells
-	 * the kernel that firmware needs this region mapped.
-	 */
-	attr = md->attribute & ~EFI_MEMORY_RUNTIME;
-	do {
-		unsigned long md_end = efi_md_end(md);
-
-		if (end <= md_end)
-			return attr;
-
-		md = efi_memory_descriptor(md_end);
-		if (!md || (md->attribute & ~EFI_MEMORY_RUNTIME) != attr)
-			return 0;
-	} while (md);
-	return 0;
-}
-
-u64
-kern_mem_attribute (unsigned long phys_addr, unsigned long size)
-{
-	unsigned long end = phys_addr + size;
-	struct kern_memdesc *md;
-	u64 attr;
-
-	/*
-	 * This is a hack for ioremap calls before we set up kern_memmap.
-	 * Maybe we should do efi_memmap_init() earlier instead.
-	 */
-	if (!kern_memmap) {
-		attr = efi_mem_attribute(phys_addr, size);
-		if (attr & EFI_MEMORY_WB)
-			return EFI_MEMORY_WB;
-		return 0;
-	}
-
-	md = kern_memory_descriptor(phys_addr);
-	if (!md)
-		return 0;
-
-	attr = md->attribute;
-	do {
-		unsigned long md_end = kmd_end(md);
-
-		if (end <= md_end)
-			return attr;
-
-		md = kern_memory_descriptor(md_end);
-		if (!md || md->attribute != attr)
-			return 0;
-	} while (md);
-	return 0;
-}
-EXPORT_SYMBOL(kern_mem_attribute);
-
-#ifndef XEN
-int
-valid_phys_addr_range (unsigned long phys_addr, unsigned long size)
-{
-	u64 attr;
-
-	/*
-	 * /dev/mem reads and writes use copy_to_user(), which implicitly
-	 * uses a granule-sized kernel identity mapping.  It's really
-	 * only safe to do this for regions in kern_memmap.  For more
-	 * details, see Documentation/ia64/aliasing.txt.
-	 */
-	attr = kern_mem_attribute(phys_addr, size);
-	if (attr & EFI_MEMORY_WB || attr & EFI_MEMORY_UC)
-		return 1;
-	return 0;
-}
-
-int
-valid_mmap_phys_addr_range (unsigned long pfn, unsigned long size)
-{
-	/*
-	 * MMIO regions are often missing from the EFI memory map.
-	 * We must allow mmap of them for programs like X, so we
-	 * currently can't do any useful validation.
-	 */
-	return 1;
-}
-
-pgprot_t
-phys_mem_access_prot(struct file *file, unsigned long pfn, unsigned long size,
-		     pgprot_t vma_prot)
-{
-	unsigned long phys_addr = pfn << PAGE_SHIFT;
-	u64 attr;
-
-	/*
-	 * For /dev/mem mmap, we use user mappings, but if the region is
-	 * in kern_memmap (and hence may be covered by a kernel mapping),
-	 * we must use the same attribute as the kernel mapping.
-	 */
-	attr = kern_mem_attribute(phys_addr, size);
-	if (attr & EFI_MEMORY_WB)
-		return pgprot_cacheable(vma_prot);
-	else if (attr & EFI_MEMORY_UC)
-		return pgprot_noncached(vma_prot);
-
-	/*
-	 * Some chipsets don't support UC access to memory.  If
-	 * WB is supported, we prefer that.
-	 */
-	if (efi_mem_attribute(phys_addr, size) & EFI_MEMORY_WB)
-		return pgprot_cacheable(vma_prot);
-
-	return pgprot_noncached(vma_prot);
-}
-#endif
-
-int __init
-efi_uart_console_only(void)
-{
-	efi_status_t status;
-	char *s, name[] = "ConOut";
-	efi_guid_t guid = EFI_GLOBAL_VARIABLE_GUID;
-	efi_char16_t *utf16, name_utf16[32];
-	unsigned char data[1024];
-	unsigned long size = sizeof(data);
-	struct efi_generic_dev_path *hdr, *end_addr;
-	int uart = 0;
-
-	/* Convert to UTF-16 */
-	utf16 = name_utf16;
-	s = name;
-	while (*s)
-		*utf16++ = *s++ & 0x7f;
-	*utf16 = 0;
-
-	status = efi.get_variable(name_utf16, &guid, NULL, &size, data);
-	if (status != EFI_SUCCESS) {
-		printk(KERN_ERR "No EFI %s variable?\n", name);
-		return 0;
-	}
-
-	hdr = (struct efi_generic_dev_path *) data;
-	end_addr = (struct efi_generic_dev_path *) ((u8 *) data + size);
-	while (hdr < end_addr) {
-		if (hdr->type == EFI_DEV_MSG &&
-		    hdr->sub_type == EFI_DEV_MSG_UART)
-			uart = 1;
-		else if (hdr->type == EFI_DEV_END_PATH ||
-			  hdr->type == EFI_DEV_END_PATH2) {
-			if (!uart)
-				return 0;
-			if (hdr->sub_type == EFI_DEV_END_ENTIRE)
-				return 1;
-			uart = 0;
-		}
-		hdr = (struct efi_generic_dev_path *) ((u8 *) hdr + hdr->length);
-	}
-	printk(KERN_ERR "Malformed %s value\n", name);
-	return 0;
-}
-
-/*
- * Look for the first granule aligned memory descriptor memory
- * that is big enough to hold EFI memory map. Make sure this
- * descriptor is atleast granule sized so it does not get trimmed
- */
-struct kern_memdesc *
-find_memmap_space (void)
-{
-	u64	contig_low=0, contig_high=0;
-	u64	as = 0, ae;
-	void *efi_map_start, *efi_map_end, *p, *q;
-	efi_memory_desc_t *md, *pmd = NULL, *check_md;
-	u64	space_needed, efi_desc_size;
-	unsigned long total_mem = 0;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	/*
-	 * Worst case: we need 3 kernel descriptors for each efi descriptor
-	 * (if every entry has a WB part in the middle, and UC head and tail),
-	 * plus one for the end marker.
-	 */
-	space_needed = sizeof(kern_memdesc_t) *
-		(3 * (ia64_boot_param->efi_memmap_size/efi_desc_size) + 1);
-
-	for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
-		md = p;
-		if (!efi_wb(md)) {
-			continue;
-		}
-		if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) {
-			contig_low = GRANULEROUNDUP(md->phys_addr);
-			contig_high = efi_md_end(md);
-			for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) {
-				check_md = q;
-				if (!efi_wb(check_md))
-					break;
-				if (contig_high != check_md->phys_addr)
-					break;
-				contig_high = efi_md_end(check_md);
-			}
-			contig_high = GRANULEROUNDDOWN(contig_high);
-		}
-		if (!is_memory_available(md) || md->type == EFI_LOADER_DATA)
-			continue;
-
-		/* Round ends inward to granule boundaries */
-		as = max(contig_low, md->phys_addr);
-		ae = min(contig_high, efi_md_end(md));
-
-		/* keep within max_addr= and min_addr= command line arg */
-		as = max(as, min_addr);
-		ae = min(ae, max_addr);
-		if (ae <= as)
-			continue;
-
-		/* avoid going over mem= command line arg */
-		if (total_mem + (ae - as) > mem_limit)
-			ae -= total_mem + (ae - as) - mem_limit;
-
-		if (ae <= as)
-			continue;
-
-		if (ae - as > space_needed)
-			break;
-	}
-	if (p >= efi_map_end)
-		panic("Can't allocate space for kernel memory descriptors");
-
-	return __va(as);
-}
-
-/*
- * Walk the EFI memory map and gather all memory available for kernel
- * to use.  We can allocate partial granules only if the unavailable
- * parts exist, and are WB.
- */
-void
-efi_memmap_init(unsigned long *s, unsigned long *e)
-{
-	struct kern_memdesc *k, *prev = NULL;
-	u64	contig_low=0, contig_high=0;
-	u64	as, ae, lim;
-	void *efi_map_start, *efi_map_end, *p, *q;
-	efi_memory_desc_t *md, *pmd = NULL, *check_md;
-	u64	efi_desc_size;
-	unsigned long total_mem = 0;
-
-	k = kern_memmap = find_memmap_space();
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
-		md = p;
-		if (!efi_wb(md)) {
-			if (efi_uc(md) && (md->type == EFI_CONVENTIONAL_MEMORY ||
-				    	   md->type == EFI_BOOT_SERVICES_DATA)) {
-				k->attribute = EFI_MEMORY_UC;
-				k->start = md->phys_addr;
-				k->num_pages = md->num_pages;
-				k++;
-			}
-			continue;
-		}
-#ifdef XEN
-		/* this works around a problem in the ski bootloader */
-		if (running_on_sim && md->type != EFI_CONVENTIONAL_MEMORY)
-			continue;
-#endif
-		if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) {
-			contig_low = GRANULEROUNDUP(md->phys_addr);
-			contig_high = efi_md_end(md);
-			for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) {
-				check_md = q;
-				if (!efi_wb(check_md))
-					break;
-				if (contig_high != check_md->phys_addr)
-					break;
-				contig_high = efi_md_end(check_md);
-			}
-			contig_high = GRANULEROUNDDOWN(contig_high);
-		}
-		if (!is_memory_available(md))
-			continue;
-
-#ifdef CONFIG_CRASH_DUMP
-		/* saved_max_pfn should ignore max_addr= command line arg */
-		if (saved_max_pfn < (efi_md_end(md) >> PAGE_SHIFT))
-			saved_max_pfn = (efi_md_end(md) >> PAGE_SHIFT);
-#endif
-		/*
-		 * Round ends inward to granule boundaries
-		 * Give trimmings to uncached allocator
-		 */
-		if (md->phys_addr < contig_low) {
-			lim = min(efi_md_end(md), contig_low);
-			if (efi_uc(md)) {
-				if (k > kern_memmap && (k-1)->attribute == EFI_MEMORY_UC &&
-				    kmd_end(k-1) == md->phys_addr) {
-					(k-1)->num_pages += (lim - md->phys_addr) >> EFI_PAGE_SHIFT;
-				} else {
-					k->attribute = EFI_MEMORY_UC;
-					k->start = md->phys_addr;
-					k->num_pages = (lim - md->phys_addr) >> EFI_PAGE_SHIFT;
-					k++;
-				}
-			}
-			as = contig_low;
-		} else
-			as = md->phys_addr;
-
-		if (efi_md_end(md) > contig_high) {
-			lim = max(md->phys_addr, contig_high);
-			if (efi_uc(md)) {
-				if (lim == md->phys_addr && k > kern_memmap &&
-				    (k-1)->attribute == EFI_MEMORY_UC &&
-				    kmd_end(k-1) == md->phys_addr) {
-					(k-1)->num_pages += md->num_pages;
-				} else {
-					k->attribute = EFI_MEMORY_UC;
-					k->start = lim;
-					k->num_pages = (efi_md_end(md) - lim) >> EFI_PAGE_SHIFT;
-					k++;
-				}
-			}
-			ae = contig_high;
-		} else
-			ae = efi_md_end(md);
-
-		/* keep within max_addr= and min_addr= command line arg */
-		as = max(as, min_addr);
-		ae = min(ae, max_addr);
-		if (ae <= as)
-			continue;
-
-		/* avoid going over mem= command line arg */
-		if (total_mem + (ae - as) > mem_limit)
-			ae -= total_mem + (ae - as) - mem_limit;
-
-		if (ae <= as)
-			continue;
-		if (prev && kmd_end(prev) == md->phys_addr) {
-			prev->num_pages += (ae - as) >> EFI_PAGE_SHIFT;
-			total_mem += ae - as;
-			continue;
-		}
-		k->attribute = EFI_MEMORY_WB;
-		k->start = as;
-		k->num_pages = (ae - as) >> EFI_PAGE_SHIFT;
-		total_mem += ae - as;
-		prev = k++;
-	}
-	k->start = ~0L; /* end-marker */
-
-	/* reserve the memory we are using for kern_memmap */
-	*s = (u64)kern_memmap;
-	*e = (u64)++k;
-}
-
-#ifndef XEN
-void
-efi_initialize_iomem_resources(struct resource *code_resource,
-			       struct resource *data_resource)
-{
-	struct resource *res;
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-	char *name;
-	unsigned long flags;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	res = NULL;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-
-		if (md->num_pages == 0) /* should not happen */
-			continue;
-
-		flags = IORESOURCE_MEM;
-		switch (md->type) {
-
-			case EFI_MEMORY_MAPPED_IO:
-			case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
-				continue;
-
-			case EFI_LOADER_CODE:
-			case EFI_LOADER_DATA:
-			case EFI_BOOT_SERVICES_DATA:
-			case EFI_BOOT_SERVICES_CODE:
-			case EFI_CONVENTIONAL_MEMORY:
-				if (md->attribute & EFI_MEMORY_WP) {
-					name = "System ROM";
-					flags |= IORESOURCE_READONLY;
-				} else {
-					name = "System RAM";
-				}
-				break;
-
-			case EFI_ACPI_MEMORY_NVS:
-				name = "ACPI Non-volatile Storage";
-				flags |= IORESOURCE_BUSY;
-				break;
-
-			case EFI_UNUSABLE_MEMORY:
-				name = "reserved";
-				flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED;
-				break;
-
-			case EFI_RESERVED_TYPE:
-			case EFI_RUNTIME_SERVICES_CODE:
-			case EFI_RUNTIME_SERVICES_DATA:
-			case EFI_ACPI_RECLAIM_MEMORY:
-			default:
-				name = "reserved";
-				flags |= IORESOURCE_BUSY;
-				break;
-		}
-
-		if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
-			printk(KERN_ERR "failed to alocate resource for iomem\n");
-			return;
-		}
-
-		res->name = name;
-		res->start = md->phys_addr;
-		res->end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1;
-		res->flags = flags;
-
-		if (insert_resource(&iomem_resource, res) < 0)
-			kfree(res);
-		else {
-			/*
-			 * We don't know which region contains
-			 * kernel data so we try it repeatedly and
-			 * let the resource manager test it.
-			 */
-			insert_resource(res, code_resource);
-			insert_resource(res, data_resource);
-#ifdef CONFIG_KEXEC
-                        insert_resource(res, &efi_memmap_res);
-                        insert_resource(res, &boot_param_res);
-			if (crashk_res.end > crashk_res.start)
-				insert_resource(res, &crashk_res);
-#endif
-		}
-	}
-}
-#endif /* XEN */
-
-#if defined(CONFIG_KEXEC) || defined(XEN)
-/* find a block of memory aligned to 64M exclude reserved regions
-   rsvd_regions are sorted
- */
-unsigned long __init
-kdump_find_rsvd_region (unsigned long size,
-		struct rsvd_region *r, int n)
-{
-  int i;
-  u64 start, end;
-  u64 alignment = 1UL << _PAGE_SIZE_64M;
-  void *efi_map_start, *efi_map_end, *p;
-  efi_memory_desc_t *md;
-  u64 efi_desc_size;
-
-  efi_map_start = __va(ia64_boot_param->efi_memmap);
-  efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-  efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-  for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-	  md = p;
-	  if (!efi_wb(md))
-		  continue;
-	  start = ALIGN(md->phys_addr, alignment);
-	  end = efi_md_end(md);
-	  for (i = 0; i < n; i++) {
-		if (__pa(r[i].start) >= start && __pa(r[i].end) < end) {
-			if (__pa(r[i].start) > start + size)
-				return start;
-			start = ALIGN(__pa(r[i].end), alignment);
-			if (i < n-1 && __pa(r[i+1].start) < start + size)
-				continue;
-			else
-				break;
-		}
-	  }
-	  if (end > start + size)
-		return start;
-  }
-
-  printk(KERN_WARNING "Cannot reserve 0x%lx byte of memory for crashdump\n",
-	size);
-  return ~0UL;
-}
-#endif
-
-#ifndef XEN
-#ifdef CONFIG_PROC_VMCORE
-/* locate the size find a the descriptor at a certain address */
-unsigned long
-vmcore_find_descriptor_size (unsigned long address)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-	unsigned long ret = 0;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-		if (efi_wb(md) && md->type == EFI_LOADER_DATA
-		    && md->phys_addr == address) {
-			ret = efi_md_size(md);
-			break;
-		}
-	}
-
-	if (ret == 0)
-		printk(KERN_WARNING "Cannot locate EFI vmcore descriptor\n");
-
-	return ret;
-}
-#endif
-#endif /* XEN */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/entry.S
--- a/xen/arch/ia64/linux-xen/entry.S	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1851 +0,0 @@
-/*
- * ia64/kernel/entry.S
- *
- * Kernel entry points.
- *
- * Copyright (C) 1998-2003, 2005 Hewlett-Packard Co
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999, 2002-2003
- *	Asit Mallick <Asit.K.Mallick@intel.com>
- * 	Don Dugger <Don.Dugger@intel.com>
- *	Suresh Siddha <suresh.b.siddha@intel.com>
- *	Fenghua Yu <fenghua.yu@intel.com>
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- */
-/*
- * ia64_switch_to now places correct virtual mapping in in TR2 for
- * kernel stack. This allows us to handle interrupts without changing
- * to physical mode.
- *
- * Jonathan Nicklin	<nicklin@missioncriticallinux.com>
- * Patrick O'Rourke	<orourke@missioncriticallinux.com>
- * 11/07/2000
- */
-/*
- * Global (preserved) predicate usage on syscall entry/exit path:
- *
- *	pKStk:		See entry.h.
- *	pUStk:		See entry.h.
- *	pSys:		See entry.h.
- *	pNonSys:	!pSys
- */
-
-#include <linux/config.h>
-
-#include <asm/asmmacro.h>
-#include <asm/cache.h>
-#ifdef XEN
-#include <xen/errno.h>
-#else
-#include <asm/errno.h>
-#endif
-#include <asm/kregs.h>
-#include <asm/offsets.h>
-#include <asm/pgtable.h>
-#include <asm/percpu.h>
-#include <asm/processor.h>
-#include <asm/thread_info.h>
-#include <asm/unistd.h>
-
-#include "minstate.h"
-
-#ifndef XEN
-	/*
-	 * execve() is special because in case of success, we need to
-	 * setup a null register window frame.
-	 */
-ENTRY(ia64_execve)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,4,0
-	mov loc0=rp
-	.body
-	mov out0=in0			// filename
-	;;				// stop bit between alloc and call
-	mov out1=in1			// argv
-	mov out2=in2			// envp
-	add out3=16,sp			// regs
-	br.call.sptk.many rp=sys_execve
-.ret0:
-#ifdef CONFIG_IA32_SUPPORT
-	/*
-	 * Check if we're returning to ia32 mode. If so, we need to restore ia32 registers
-	 * from pt_regs.
-	 */
-	adds r16=PT(CR_IPSR)+16,sp
-	;;
-	ld8 r16=[r16]
-#endif
-	cmp4.ge p6,p7=r8,r0
-	mov ar.pfs=loc1			// restore ar.pfs
-	sxt4 r8=r8			// return 64-bit result
-	;;
-	stf.spill [sp]=f0
-(p6)	cmp.ne pKStk,pUStk=r0,r0	// a successful execve() lands us in user-mode...
-	mov rp=loc0
-(p6)	mov ar.pfs=r0			// clear ar.pfs on success
-(p7)	br.ret.sptk.many rp
-
-	/*
-	 * In theory, we'd have to zap this state only to prevent leaking of
-	 * security sensitive state (e.g., if current->mm->dumpable is zero).  However,
-	 * this executes in less than 20 cycles even on Itanium, so it's not worth
-	 * optimizing for...).
-	 */
-	mov ar.unat=0; 		mov ar.lc=0
-	mov r4=0;		mov f2=f0;		mov b1=r0
-	mov r5=0;		mov f3=f0;		mov b2=r0
-	mov r6=0;		mov f4=f0;		mov b3=r0
-	mov r7=0;		mov f5=f0;		mov b4=r0
-	ldf.fill f12=[sp];	mov f13=f0;		mov b5=r0
-	ldf.fill f14=[sp];	ldf.fill f15=[sp];	mov f16=f0
-	ldf.fill f17=[sp];	ldf.fill f18=[sp];	mov f19=f0
-	ldf.fill f20=[sp];	ldf.fill f21=[sp];	mov f22=f0
-	ldf.fill f23=[sp];	ldf.fill f24=[sp];	mov f25=f0
-	ldf.fill f26=[sp];	ldf.fill f27=[sp];	mov f28=f0
-	ldf.fill f29=[sp];	ldf.fill f30=[sp];	mov f31=f0
-#ifdef CONFIG_IA32_SUPPORT
-	tbit.nz p6,p0=r16, IA64_PSR_IS_BIT
-	movl loc0=ia64_ret_from_ia32_execve
-	;;
-(p6)	mov rp=loc0
-#endif
-	br.ret.sptk.many rp
-END(ia64_execve)
-
-/*
- * sys_clone2(u64 flags, u64 ustack_base, u64 ustack_size, u64 parent_tidptr, u64 child_tidptr,
- *	      u64 tls)
- */
-GLOBAL_ENTRY(sys_clone2)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc r16=ar.pfs,8,2,6,0
-	DO_SAVE_SWITCH_STACK
-	adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
-	mov loc0=rp
-	mov loc1=r16				// save ar.pfs across do_fork
-	.body
-	mov out1=in1
-	mov out3=in2
-	tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
-	mov out4=in3	// parent_tidptr: valid only w/CLONE_PARENT_SETTID
-	;;
-(p6)	st8 [r2]=in5				// store TLS in r16 for copy_thread()
-	mov out5=in4	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
-	adds out2=IA64_SWITCH_STACK_SIZE+16,sp	// out2 = &regs
-	mov out0=in0				// out0 = clone_flags
-	br.call.sptk.many rp=do_fork
-.ret1:	.restore sp
-	adds sp=IA64_SWITCH_STACK_SIZE,sp	// pop the switch stack
-	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(sys_clone2)
-
-/*
- * sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls)
- *	Deprecated.  Use sys_clone2() instead.
- */
-GLOBAL_ENTRY(sys_clone)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc r16=ar.pfs,8,2,6,0
-	DO_SAVE_SWITCH_STACK
-	adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
-	mov loc0=rp
-	mov loc1=r16				// save ar.pfs across do_fork
-	.body
-	mov out1=in1
-	mov out3=16				// stacksize (compensates for 16-byte scratch area)
-	tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
-	mov out4=in2	// parent_tidptr: valid only w/CLONE_PARENT_SETTID
-	;;
-(p6)	st8 [r2]=in4				// store TLS in r13 (tp)
-	mov out5=in3	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
-	adds out2=IA64_SWITCH_STACK_SIZE+16,sp	// out2 = &regs
-	mov out0=in0				// out0 = clone_flags
-	br.call.sptk.many rp=do_fork
-.ret2:	.restore sp
-	adds sp=IA64_SWITCH_STACK_SIZE,sp	// pop the switch stack
-	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(sys_clone)
-#endif
-
-/*
- * prev_task <- ia64_switch_to(struct task_struct *next)
- *	With Ingo's new scheduler, interrupts are disabled when this routine gets
- *	called.  The code starting at .map relies on this.  The rest of the code
- *	doesn't care about the interrupt masking status.
- */
-GLOBAL_ENTRY(ia64_switch_to)
-	.prologue
-	alloc r16=ar.pfs,1,0,0,0
-	DO_SAVE_SWITCH_STACK
-	.body
-
-	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
-#ifdef XEN
-	movl r24=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_STACK_OFFSET;;
-	ld8 r27=[r24]
-	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
-	dep r20=0,in0,60,4		// physical address of "next"
-#else
-	movl r25=init_task
-	mov r27=IA64_KR(CURRENT_STACK)
-	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
-	dep r20=0,in0,61,3		// physical address of "next"
-#endif
-	;;
-	st8 [r22]=sp			// save kernel stack pointer of old task
-	shr.u r26=r20,IA64_GRANULE_SHIFT
-#ifdef XEN
-	;;
-	/*
-	 * If we've already mapped this task's page, we can skip doing it again.
-	 */
-	cmp.eq p7,p6=r26,r27
-(p6)	br.cond.dpnt .map
-#else	
-	cmp.eq p7,p6=r25,in0
-	;;
-	/*
-	 * If we've already mapped this task's page, we can skip doing it again.
-	 */
-(p6)	cmp.eq p7,p6=r26,r27
-(p6)	br.cond.dpnt .map
-#endif	
-	;;
-.done:
-(p6)	ssm psr.ic			// if we had to map, reenable the psr.ic bit FIRST!!!
-	;;
-(p6)	srlz.d
-	ld8 sp=[r21]			// load kernel stack pointer of new task
-#ifdef XEN
-	add r25=IA64_KR_CURRENT_OFFSET-IA64_KR_CURRENT_STACK_OFFSET,r24
-	;;
-	st8 [r25]=in0			// update "current" application register
-	;;
-	bsw.0
-	;;
-	mov r8=r13			// return pointer to previously running task
-	mov r13=in0			// set "current" pointer
-	mov r21=in0
-	;;
-	bsw.1
-	;;
-#else
-	mov IA64_KR(CURRENT)=in0	// update "current" application register
-	mov r8=r13          // return pointer to previously running task
-	mov r13=in0         // set "current" pointer
-#endif
-	DO_LOAD_SWITCH_STACK
-
-#ifdef CONFIG_SMP
-	sync.i				// ensure "fc"s done by this CPU are visible on other CPUs
-#endif
-	br.ret.sptk.many rp		// boogie on out in new context
-
-.map:
-	rsm psr.ic			// interrupts (psr.i) are already disabled here
-	movl r25=PAGE_KERNEL
-#ifdef XEN	
-	movl r27=IA64_GRANULE_SHIFT << 2
-#endif
-	;;
-	srlz.d
-	or r23=r25,r20			// construct PA | page properties
-#ifdef XEN
-	ptr.d in0,r27			// to purge dtr[IA64_TR_VHPT] and dtr[IA64_TR_VPD]
-#else
-	movl r27=IA64_GRANULE_SHIFT << 2	
-#endif
-	;;
-	mov cr.itir=r27
-	mov cr.ifa=in0			// VA of next task...
-#ifdef XEN
-	srlz.d
-#endif
-	;;
-	mov r25=IA64_TR_CURRENT_STACK
-#ifdef XEN
-	st8 [r24]=r26			// remember last page we mapped...
-#else
-	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
-#endif
-	;;
-	itr.d dtr[r25]=r23		// wire in new mapping...
-	br.cond.sptk .done
-END(ia64_switch_to)
-
-/*
- * Note that interrupts are enabled during save_switch_stack and load_switch_stack.  This
- * means that we may get an interrupt with "sp" pointing to the new kernel stack while
- * ar.bspstore is still pointing to the old kernel backing store area.  Since ar.rsc,
- * ar.rnat, ar.bsp, and ar.bspstore are all preserved by interrupts, this is not a
- * problem.  Also, we don't need to specify unwind information for preserved registers
- * that are not modified in save_switch_stack as the right unwind information is already
- * specified at the call-site of save_switch_stack.
- */
-
-/*
- * save_switch_stack:
- *	- r16 holds ar.pfs
- *	- b7 holds address to return to
- *	- rp (b0) holds return address to save
- */
-GLOBAL_ENTRY(save_switch_stack)
-	.prologue
-	.altrp b7
-	flushrs			// flush dirty regs to backing store (must be first in insn group)
-	.save @priunat,r17
-	mov r17=ar.unat		// preserve caller's
-	.body
-#ifdef CONFIG_ITANIUM
-	adds r2=16+128,sp
-	adds r3=16+64,sp
-	adds r14=SW(R4)+16,sp
-	;;
-	st8.spill [r14]=r4,16		// spill r4
-	lfetch.fault.excl.nt1 [r3],128
-	;;
-	lfetch.fault.excl.nt1 [r2],128
-	lfetch.fault.excl.nt1 [r3],128
-	;;
-	lfetch.fault.excl [r2]
-	lfetch.fault.excl [r3]
-	adds r15=SW(R5)+16,sp
-#else
-	add r2=16+3*128,sp
-	add r3=16,sp
-	add r14=SW(R4)+16,sp
-	;;
-	st8.spill [r14]=r4,SW(R6)-SW(R4)	// spill r4 and prefetch offset 0x1c0
-	lfetch.fault.excl.nt1 [r3],128	//		prefetch offset 0x010
-	;;
-	lfetch.fault.excl.nt1 [r3],128	//		prefetch offset 0x090
-	lfetch.fault.excl.nt1 [r2],128	//		prefetch offset 0x190
-	;;
-	lfetch.fault.excl.nt1 [r3]	//		prefetch offset 0x110
-	lfetch.fault.excl.nt1 [r2]	//		prefetch offset 0x210
-	adds r15=SW(R5)+16,sp
-#endif
-	;;
-	st8.spill [r15]=r5,SW(R7)-SW(R5)	// spill r5
-	mov.m ar.rsc=0			// put RSE in mode: enforced lazy, little endian, pl 0
-	add r2=SW(F2)+16,sp		// r2 = &sw->f2
-	;;
-	st8.spill [r14]=r6,SW(B0)-SW(R6)	// spill r6
-	mov.m r18=ar.fpsr		// preserve fpsr
-	add r3=SW(F3)+16,sp		// r3 = &sw->f3
-	;;
-	stf.spill [r2]=f2,32
-	mov.m r19=ar.rnat
-	mov r21=b0
-
-	stf.spill [r3]=f3,32
-	st8.spill [r15]=r7,SW(B2)-SW(R7)	// spill r7
-	mov r22=b1
-	;;
-	// since we're done with the spills, read and save ar.unat:
-	mov.m r29=ar.unat
-	mov.m r20=ar.bspstore
-	mov r23=b2
-	stf.spill [r2]=f4,32
-	stf.spill [r3]=f5,32
-	mov r24=b3
-	;;
-	st8 [r14]=r21,SW(B1)-SW(B0)		// save b0
-	st8 [r15]=r23,SW(B3)-SW(B2)		// save b2
-	mov r25=b4
-	mov r26=b5
-	;;
-	st8 [r14]=r22,SW(B4)-SW(B1)		// save b1
-	st8 [r15]=r24,SW(AR_PFS)-SW(B3)		// save b3
-	mov r21=ar.lc		// I-unit
-	stf.spill [r2]=f12,32
-	stf.spill [r3]=f13,32
-	;;
-	st8 [r14]=r25,SW(B5)-SW(B4)		// save b4
-	st8 [r15]=r16,SW(AR_LC)-SW(AR_PFS)	// save ar.pfs
-	stf.spill [r2]=f14,32
-	stf.spill [r3]=f15,32
-	;;
-	st8 [r14]=r26				// save b5
-	st8 [r15]=r21				// save ar.lc
-	stf.spill [r2]=f16,32
-	stf.spill [r3]=f17,32
-	;;
-	stf.spill [r2]=f18,32
-	stf.spill [r3]=f19,32
-	;;
-	stf.spill [r2]=f20,32
-	stf.spill [r3]=f21,32
-	;;
-	stf.spill [r2]=f22,32
-	stf.spill [r3]=f23,32
-	;;
-	stf.spill [r2]=f24,32
-	stf.spill [r3]=f25,32
-	;;
-	stf.spill [r2]=f26,32
-	stf.spill [r3]=f27,32
-	;;
-	stf.spill [r2]=f28,32
-	stf.spill [r3]=f29,32
-	;;
-	stf.spill [r2]=f30,SW(AR_UNAT)-SW(F30)
-	stf.spill [r3]=f31,SW(PR)-SW(F31)
-	add r14=SW(CALLER_UNAT)+16,sp
-	;;
-	st8 [r2]=r29,SW(AR_RNAT)-SW(AR_UNAT)	// save ar.unat
-	st8 [r14]=r17,SW(AR_FPSR)-SW(CALLER_UNAT) // save caller_unat
-	mov r21=pr
-	;;
-	st8 [r2]=r19,SW(AR_BSPSTORE)-SW(AR_RNAT) // save ar.rnat
-	st8 [r3]=r21				// save predicate registers
-	;;
-	st8 [r2]=r20				// save ar.bspstore
-	st8 [r14]=r18				// save fpsr
-	mov ar.rsc=3		// put RSE back into eager mode, pl 0
-	br.cond.sptk.many b7
-END(save_switch_stack)
-
-/*
- * load_switch_stack:
- *	- "invala" MUST be done at call site (normally in DO_LOAD_SWITCH_STACK)
- *	- b7 holds address to return to
- *	- must not touch r8-r11
- */
-#ifdef XEN
-GLOBAL_ENTRY(load_switch_stack)
-#else
-ENTRY(load_switch_stack)
-#endif
-	.prologue
-	.altrp b7
-
-	.body
-	lfetch.fault.nt1 [sp]
-	adds r2=SW(AR_BSPSTORE)+16,sp
-	adds r3=SW(AR_UNAT)+16,sp
-	mov ar.rsc=0						// put RSE into enforced lazy mode
-	adds r14=SW(CALLER_UNAT)+16,sp
-	adds r15=SW(AR_FPSR)+16,sp
-	;;
-	ld8 r27=[r2],(SW(B0)-SW(AR_BSPSTORE))	// bspstore
-	ld8 r29=[r3],(SW(B1)-SW(AR_UNAT))	// unat
-	;;
-	ld8 r21=[r2],16		// restore b0
-	ld8 r22=[r3],16		// restore b1
-	;;
-	ld8 r23=[r2],16		// restore b2
-	ld8 r24=[r3],16		// restore b3
-	;;
-	ld8 r25=[r2],16		// restore b4
-	ld8 r26=[r3],16		// restore b5
-	;;
-	ld8 r16=[r2],(SW(PR)-SW(AR_PFS))	// ar.pfs
-	ld8 r17=[r3],(SW(AR_RNAT)-SW(AR_LC))	// ar.lc
-	;;
-	ld8 r28=[r2]		// restore pr
-	ld8 r30=[r3]		// restore rnat
-	;;
-	ld8 r18=[r14],16	// restore caller's unat
-	ld8 r19=[r15],24	// restore fpsr
-	;;
-	ldf.fill f2=[r14],32
-	ldf.fill f3=[r15],32
-	;;
-	ldf.fill f4=[r14],32
-	ldf.fill f5=[r15],32
-	;;
-	ldf.fill f12=[r14],32
-	ldf.fill f13=[r15],32
-	;;
-	ldf.fill f14=[r14],32
-	ldf.fill f15=[r15],32
-	;;
-	ldf.fill f16=[r14],32
-	ldf.fill f17=[r15],32
-	;;
-	ldf.fill f18=[r14],32
-	ldf.fill f19=[r15],32
-	mov b0=r21
-	;;
-	ldf.fill f20=[r14],32
-	ldf.fill f21=[r15],32
-	mov b1=r22
-	;;
-	ldf.fill f22=[r14],32
-	ldf.fill f23=[r15],32
-	mov b2=r23
-	;;
-	mov ar.bspstore=r27
-	mov ar.unat=r29		// establish unat holding the NaT bits for r4-r7
-	mov b3=r24
-	;;
-	ldf.fill f24=[r14],32
-	ldf.fill f25=[r15],32
-	mov b4=r25
-	;;
-	ldf.fill f26=[r14],32
-	ldf.fill f27=[r15],32
-	mov b5=r26
-	;;
-	ldf.fill f28=[r14],32
-	ldf.fill f29=[r15],32
-	mov ar.pfs=r16
-	;;
-	ldf.fill f30=[r14],32
-	ldf.fill f31=[r15],24
-	mov ar.lc=r17
-	;;
-	ld8.fill r4=[r14],16
-	ld8.fill r5=[r15],16
-	mov pr=r28,-1
-	;;
-	ld8.fill r6=[r14],16
-	ld8.fill r7=[r15],16
-
-	mov ar.unat=r18				// restore caller's unat
-	mov ar.rnat=r30				// must restore after bspstore but before rsc!
-	mov ar.fpsr=r19				// restore fpsr
-	mov ar.rsc=3				// put RSE back into eager mode, pl 0
-	br.cond.sptk.many b7
-END(load_switch_stack)
-
-#ifndef XEN
-GLOBAL_ENTRY(execve)
-	mov r15=__NR_execve			// put syscall number in place
-	break __BREAK_SYSCALL
-	br.ret.sptk.many rp
-END(execve)
-
-GLOBAL_ENTRY(clone)
-	mov r15=__NR_clone			// put syscall number in place
-	break __BREAK_SYSCALL
-	br.ret.sptk.many rp
-END(clone)
-
-	/*
-	 * Invoke a system call, but do some tracing before and after the call.
-	 * We MUST preserve the current register frame throughout this routine
-	 * because some system calls (such as ia64_execve) directly
-	 * manipulate ar.pfs.
-	 */
-GLOBAL_ENTRY(ia64_trace_syscall)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * We need to preserve the scratch registers f6-f11 in case the system
-	 * call is sigreturn.
-	 */
-	adds r16=PT(F6)+16,sp
-	adds r17=PT(F7)+16,sp
-	;;
- 	stf.spill [r16]=f6,32
- 	stf.spill [r17]=f7,32
-	;;
- 	stf.spill [r16]=f8,32
- 	stf.spill [r17]=f9,32
-	;;
- 	stf.spill [r16]=f10
- 	stf.spill [r17]=f11
-	br.call.sptk.many rp=syscall_trace_enter // give parent a chance to catch syscall args
-	adds r16=PT(F6)+16,sp
-	adds r17=PT(F7)+16,sp
-	;;
-	ldf.fill f6=[r16],32
-	ldf.fill f7=[r17],32
-	;;
-	ldf.fill f8=[r16],32
-	ldf.fill f9=[r17],32
-	;;
-	ldf.fill f10=[r16]
-	ldf.fill f11=[r17]
-	// the syscall number may have changed, so re-load it and re-calculate the
-	// syscall entry-point:
-	adds r15=PT(R15)+16,sp			// r15 = &pt_regs.r15 (syscall #)
-	;;
-	ld8 r15=[r15]
-	mov r3=NR_syscalls - 1
-	;;
-	adds r15=-1024,r15
-	movl r16=sys_call_table
-	;;
-	shladd r20=r15,3,r16			// r20 = sys_call_table + 8*(syscall-1024)
-	cmp.leu p6,p7=r15,r3
-	;;
-(p6)	ld8 r20=[r20]				// load address of syscall entry point
-(p7)	movl r20=sys_ni_syscall
-	;;
-	mov b6=r20
-	br.call.sptk.many rp=b6			// do the syscall
-.strace_check_retval:
-	cmp.lt p6,p0=r8,r0			// syscall failed?
-	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
-	adds r3=PT(R10)+16,sp			// r3 = &pt_regs.r10
-	mov r10=0
-(p6)	br.cond.sptk strace_error		// syscall failed ->
-	;;					// avoid RAW on r10
-.strace_save_retval:
-.mem.offset 0,0; st8.spill [r2]=r8		// store return value in slot for r8
-.mem.offset 8,0; st8.spill [r3]=r10		// clear error indication in slot for r10
-	br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
-.ret3:	br.cond.sptk .work_pending_syscall_end
-
-strace_error:
-	ld8 r3=[r2]				// load pt_regs.r8
-	sub r9=0,r8				// negate return value to get errno value
-	;;
-	cmp.ne p6,p0=r3,r0			// is pt_regs.r8!=0?
-	adds r3=16,r2				// r3=&pt_regs.r10
-	;;
-(p6)	mov r10=-1
-(p6)	mov r8=r9
-	br.cond.sptk .strace_save_retval
-END(ia64_trace_syscall)
-
-	/*
-	 * When traced and returning from sigreturn, we invoke syscall_trace but then
-	 * go straight to ia64_leave_kernel rather than ia64_leave_syscall.
-	 */
-GLOBAL_ENTRY(ia64_strace_leave_kernel)
-	PT_REGS_UNWIND_INFO(0)
-{	/*
-	 * Some versions of gas generate bad unwind info if the first instruction of a
-	 * procedure doesn't go into the first slot of a bundle.  This is a workaround.
-	 */
-	nop.m 0
-	nop.i 0
-	br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
-}
-.ret4:	br.cond.sptk ia64_leave_kernel
-END(ia64_strace_leave_kernel)
-#endif
-
-GLOBAL_ENTRY(ia64_ret_from_clone)
-	PT_REGS_UNWIND_INFO(0)
-{	/*
-	 * Some versions of gas generate bad unwind info if the first instruction of a
-	 * procedure doesn't go into the first slot of a bundle.  This is a workaround.
-	 */
-	nop.m 0
-	nop.i 0
-	/*
-	 * We need to call schedule_tail() to complete the scheduling process.
-	 * Called by ia64_switch_to() after do_fork()->copy_thread().  r8 contains the
-	 * address of the previously executing task.
-	 */
-	br.call.sptk.many rp=ia64_invoke_schedule_tail
-}
-#ifdef XEN
-	// new domains are cloned but not exec'ed so switch to user mode here
-	cmp.ne pKStk,pUStk=r0,r0
-	adds r16 = IA64_VCPU_FLAGS_OFFSET, r13
-	;;
-	ld8 r16 = [r16]				// arch.arch_vmx.flags
-	;;
-	cmp.eq p6,p0 = r16, r0
-(p6)	br.cond.spnt ia64_leave_kernel		// !VMX_DOMAIN
-	;;
-	adds r16 = PT(CR_IFS)+16, r12
-	;;
-	ld8 r16 = [r16]
-	cmp.eq pNonSys,pSys=r0,r0		// pSys=0,pNonSys=1
-	;;
-	cmp.eq p6,p7 = 0x6, r16
-(p7)	br.cond.sptk ia64_leave_hypervisor	// VMX_DOMAIN
-	;;
-	/*
-	 * cr.ifs.v==0 && cr.ifm(ar.pfm)==6 means that HYPERVISOR_suspend
-	 * has been called. (i.e. HVM with PV driver is restored here)
-	 * We need to allocate a dummy RSE stack frame to resume.
-	 */
-	alloc r32=ar.pfs, 0, 0, 6, 0
-	cmp.eq pSys,pNonSys=r0,r0		// pSys=1,pNonSys=0
-	;;
-	bsw.0
-	;;
-	mov r21=r13				// set current
-	;;
-	bsw.1
-	;;
-	mov r8=r0
-	br.cond.sptk.many ia64_leave_hypercall
-#else
-.ret8:
-	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
-	;;
-	ld4 r2=[r2]
-	;;
-	mov r8=0
-	and r2=_TIF_SYSCALL_TRACEAUDIT,r2
-	;;
-	cmp.ne p6,p0=r2,r0
-(p6)	br.cond.spnt .strace_check_retval
-#endif
-	;;					// added stop bits to prevent r8 dependency
-END(ia64_ret_from_clone)
-	// fall through
-GLOBAL_ENTRY(ia64_ret_from_syscall)
-	PT_REGS_UNWIND_INFO(0)
-	cmp.ge p6,p7=r8,r0			// syscall executed successfully?
-	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
-	mov r10=r0				// clear error indication in r10
-#ifndef XEN    
-(p7)	br.cond.spnt handle_syscall_error	// handle potential syscall failure
-#endif
-END(ia64_ret_from_syscall)
-	// fall through
-/*
- * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
- *	need to switch to bank 0 and doesn't restore the scratch registers.
- *	To avoid leaking kernel bits, the scratch registers are set to
- *	the following known-to-be-safe values:
- *
- *		  r1: restored (global pointer)
- *		  r2: cleared
- *		  r3: 1 (when returning to user-level)
- *	      r8-r11: restored (syscall return value(s))
- *		 r12: restored (user-level stack pointer)
- *		 r13: restored (user-level thread pointer)
- *		 r14: set to __kernel_syscall_via_epc
- *		 r15: restored (syscall #)
- *	     r16-r17: cleared
- *		 r18: user-level b6
- *		 r19: cleared
- *		 r20: user-level ar.fpsr
- *		 r21: user-level b0
- *		 r22: cleared
- *		 r23: user-level ar.bspstore
- *		 r24: user-level ar.rnat
- *		 r25: user-level ar.unat
- *		 r26: user-level ar.pfs
- *		 r27: user-level ar.rsc
- *		 r28: user-level ip
- *		 r29: user-level psr
- *		 r30: user-level cfm
- *		 r31: user-level pr
- *	      f6-f11: cleared
- *		  pr: restored (user-level pr)
- *		  b0: restored (user-level rp)
- *	          b6: restored
- *		  b7: set to __kernel_syscall_via_epc
- *	     ar.unat: restored (user-level ar.unat)
- *	      ar.pfs: restored (user-level ar.pfs)
- *	      ar.rsc: restored (user-level ar.rsc)
- *	     ar.rnat: restored (user-level ar.rnat)
- *	 ar.bspstore: restored (user-level ar.bspstore)
- *	     ar.fpsr: restored (user-level ar.fpsr)
- *	      ar.ccv: cleared
- *	      ar.csd: cleared
- *	      ar.ssd: cleared
- */
-ENTRY(ia64_leave_syscall)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
-	 * user- or fsys-mode, hence we disable interrupts early on.
-	 *
-	 * p6 controls whether current_thread_info()->flags needs to be check for
-	 * extra work.  We always check for extra work when returning to user-level.
-	 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
-	 * is 0.  After extra work processing has been completed, execution
-	 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
-	 * needs to be redone.
-	 */
-#ifdef CONFIG_PREEMPT
-	rsm psr.i				// disable interrupts
-	cmp.eq pLvSys,p0=r0,r0			// pLvSys=1: leave from syscall
-(pKStk) adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
-	;;
-	.pred.rel.mutex pUStk,pKStk
-(pKStk) ld4 r21=[r20]			// r21 <- preempt_count
-(pUStk)	mov r21=0			// r21 <- 0
-	;;
-	cmp.eq p6,p0=r21,r0		// p6 <- pUStk || (preempt_count == 0)
-#else /* !CONFIG_PREEMPT */
-(pUStk)	rsm psr.i
-	cmp.eq pLvSys,p0=r0,r0		// pLvSys=1: leave from syscall
-(pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
-#endif
-.work_processed_syscall:
-	adds r2=PT(LOADRS)+16,r12
-	adds r3=PT(AR_BSPSTORE)+16,r12
-#ifdef XEN
-	;;
-#else
-	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
-	;;
-(p6)	ld4 r31=[r18]				// load current_thread_info()->flags
-#endif
-	ld8 r19=[r2],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
-	nop.i 0
-	;;
-#ifndef XEN    
-	mov r16=ar.bsp				// M2  get existing backing store pointer
-#endif    
-	ld8 r18=[r2],PT(R9)-PT(B6)		// load b6
-#ifndef XEN
-(p6)	and r15=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
-#endif
-	;;
-	ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE)	// load ar.bspstore (may be garbage)
-#ifndef XEN
-(p6)	cmp4.ne.unc p6,p0=r15, r0		// any special work pending?
-(p6)	br.cond.spnt .work_pending_syscall
-#endif
-	;;
-	// start restoring the state saved on the kernel stack (struct pt_regs):
-	ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
-	ld8 r11=[r3],PT(CR_IIP)-PT(R11)
-(pNonSys) break 0		//      bug check: we shouldn't be here if pNonSys is TRUE!
-	;;
-	invala			// M0|1 invalidate ALAT
-	rsm psr.i | psr.ic	// M2   turn off interrupts and interruption collection
-#ifndef XEN
-	cmp.eq p9,p0=r0,r0	// A    set p9 to indicate that we should restore cr.ifs
-#endif
-
-	ld8 r29=[r2],16		// M0|1 load cr.ipsr
-	ld8 r28=[r3],16		// M0|1 load cr.iip
-	mov r22=r0		// A    clear r22
-	;;
-	ld8 r30=[r2],16		// M0|1 load cr.ifs
-	ld8 r25=[r3],16		// M0|1 load ar.unat
-(pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13
-	;;
-	ld8 r26=[r2],PT(B0)-PT(AR_PFS)	// M0|1 load ar.pfs
-(pKStk)	mov r22=psr			// M2   read PSR now that interrupts are disabled
-	nop 0
-	;;
-	ld8 r21=[r2],PT(AR_RNAT)-PT(B0) // M0|1 load b0
-	ld8 r27=[r3],PT(PR)-PT(AR_RSC)	// M0|1 load ar.rsc
-	mov f6=f0			// F    clear f6
-	;;
-	ld8 r24=[r2],PT(AR_FPSR)-PT(AR_RNAT)	// M0|1 load ar.rnat (may be garbage)
-	ld8 r31=[r3],PT(R1)-PT(PR)		// M0|1 load predicates
-	mov f7=f0				// F    clear f7
-	;;
-	ld8 r20=[r2],PT(R12)-PT(AR_FPSR)	// M0|1 load ar.fpsr
-	ld8.fill r1=[r3],16			// M0|1 load r1
-(pUStk) mov r17=1				// A
-	;;
-(pUStk) st1 [r14]=r17				// M2|3
-	ld8.fill r13=[r3],16			// M0|1
-	mov f8=f0				// F    clear f8
-	;;
-	ld8.fill r12=[r2]			// M0|1 restore r12 (sp)
-#ifdef XEN    
-	ld8.fill r2=[r3]			// M0|1
-#else    
-	ld8.fill r15=[r3]			// M0|1 restore r15
-#endif    
-	mov b6=r18				// I0   restore b6
-
-#ifdef XEN
-	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)    // A
-#else
-	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0 // A
-#endif
-	mov f9=f0					// F    clear f9
-(pKStk) br.cond.dpnt.many skip_rbs_switch		// B
-
-	srlz.d				// M0   ensure interruption collection is off (for cover)
-	shr.u r18=r19,16		// I0|1 get byte size of existing "dirty" partition
-#ifndef XEN    
-	cover				// B    add current frame into dirty partition & set cr.ifs
-#endif    
-	;;
-(pUStk) ld4 r17=[r17]			// M0|1 r17 = cpu_data->phys_stacked_size_p8
-	mov r19=ar.bsp			// M2   get new backing store pointer
-	mov f10=f0			// F    clear f10
-
-	nop.m 0
-#ifdef XEN
-	mov r14=r0
-#else
-	movl r14=__kernel_syscall_via_epc // X
-#endif
-	;;
-	mov.m ar.csd=r0			// M2   clear ar.csd
-	mov.m ar.ccv=r0			// M2   clear ar.ccv
-	mov b7=r14			// I0   clear b7 (hint with __kernel_syscall_via_epc)
-
-	mov.m ar.ssd=r0			// M2   clear ar.ssd
-	mov f11=f0			// F    clear f11
-	br.cond.sptk.many rbs_switch	// B
-END(ia64_leave_syscall)
-
-#ifdef CONFIG_IA32_SUPPORT
-GLOBAL_ENTRY(ia64_ret_from_ia32_execve)
-	PT_REGS_UNWIND_INFO(0)
-	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
-	adds r3=PT(R10)+16,sp			// r3 = &pt_regs.r10
-	;;
-	.mem.offset 0,0
-	st8.spill [r2]=r8	// store return value in slot for r8 and set unat bit
-	.mem.offset 8,0
-	st8.spill [r3]=r0	// clear error indication in slot for r10 and set unat bit
-END(ia64_ret_from_ia32_execve)
-	// fall through
-#endif /* CONFIG_IA32_SUPPORT */
-GLOBAL_ENTRY(ia64_leave_kernel)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
-	 * user- or fsys-mode, hence we disable interrupts early on.
-	 *
-	 * p6 controls whether current_thread_info()->flags needs to be check for
-	 * extra work.  We always check for extra work when returning to user-level.
-	 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
-	 * is 0.  After extra work processing has been completed, execution
-	 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
-	 * needs to be redone.
-	 */
-#ifdef CONFIG_PREEMPT
-	rsm psr.i				// disable interrupts
-	cmp.eq p0,pLvSys=r0,r0			// pLvSys=0: leave from kernel
-(pKStk)	adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
-	;;
-	.pred.rel.mutex pUStk,pKStk
-(pKStk)	ld4 r21=[r20]			// r21 <- preempt_count
-(pUStk)	mov r21=0			// r21 <- 0
-	;;
-	cmp.eq p6,p0=r21,r0		// p6 <- pUStk || (preempt_count == 0)
-#else
-(pUStk)	rsm psr.i
-	cmp.eq p0,pLvSys=r0,r0		// pLvSys=0: leave from kernel
-(pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
-#endif
-.work_processed_kernel:
-#ifdef XEN
-	;;
-(pUStk)	ssm psr.i
-(pUStk)	br.call.sptk.many b0=do_softirq
-(pUStk)	rsm psr.i
-	;;
-(pUStk)	br.call.sptk.many b0=reflect_event
-	;;
-	adds r7 = PT(EML_UNAT)+16,r12
-	;;
-	ld8 r7 = [r7]
-	;;
-	mov ar.unat=r7  /* load eml_unat  */
-	mov r31=r0
-
-#else
-	adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
-	;;
-(p6)	ld4 r31=[r17]				// load current_thread_info()->flags
-#endif
-	adds r21=PT(PR)+16,r12
-	;;
-
-	lfetch [r21],PT(CR_IPSR)-PT(PR)
-	adds r2=PT(B6)+16,r12
-	adds r3=PT(R16)+16,r12
-	;;
-	lfetch [r21]
-	ld8 r28=[r2],8		// load b6
-	adds r29=PT(R24)+16,r12
-
-#ifdef XEN
-	ld8.fill r16=[r3]
-	adds r3=PT(AR_CSD)-PT(R16),r3
-#else
-	ld8.fill r16=[r3],PT(AR_CSD)-PT(R16)
-#endif
-	adds r30=PT(AR_CCV)+16,r12
-(p6)	and r19=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
-	;;
-	ld8.fill r24=[r29]
-	ld8 r15=[r30]		// load ar.ccv
-(p6)	cmp4.ne.unc p6,p0=r19, r0		// any special work pending?
-	;;
-	ld8 r29=[r2],16		// load b7
-	ld8 r30=[r3],16		// load ar.csd
-#ifndef XEN
-(p6)	br.cond.spnt .work_pending
-#endif
-	;;
-	ld8 r31=[r2],16		// load ar.ssd
-	ld8.fill r8=[r3],16
-	;;
-	ld8.fill r9=[r2],16
-	ld8.fill r10=[r3],PT(R17)-PT(R10)
-	;;
-	ld8.fill r11=[r2],PT(R18)-PT(R11)
-	ld8.fill r17=[r3],16
-	;;
-	ld8.fill r18=[r2],16
-	ld8.fill r19=[r3],16
-	;;
-	ld8.fill r20=[r2],16
-	ld8.fill r21=[r3],16
-	mov ar.csd=r30
-	mov ar.ssd=r31
-	;;
-	rsm psr.i | psr.ic	// initiate turning off of interrupt and interruption collection
-	invala			// invalidate ALAT
-	;;
-	ld8.fill r22=[r2],24
-	ld8.fill r23=[r3],24
-	mov b6=r28
-	;;
-	ld8.fill r25=[r2],16
-	ld8.fill r26=[r3],16
-	mov b7=r29
-	;;
-	ld8.fill r27=[r2],16
-	ld8.fill r28=[r3],16
-	;;
-	ld8.fill r29=[r2],16
-	ld8.fill r30=[r3],24
-	;;
-	ld8.fill r31=[r2],PT(F9)-PT(R31)
-	adds r3=PT(F10)-PT(F6),r3
-	;;
-	ldf.fill f9=[r2],PT(F6)-PT(F9)
-	ldf.fill f10=[r3],PT(F8)-PT(F10)
-	;;
-	ldf.fill f6=[r2],PT(F7)-PT(F6)
-	;;
-	ldf.fill f7=[r2],PT(F11)-PT(F7)
-#ifdef XEN
-	ldf.fill f8=[r3],PT(R5)-PT(F8)
-	;;
-	ldf.fill f11=[r2],PT(R4)-PT(F11)
-	mov ar.ccv=r15
-	;;
-	ld8.fill r4=[r2],16
-	ld8.fill r5=[r3],16
-	;;
-	ld8.fill r6=[r2]
-	ld8.fill r7=[r3]
-	;;
-	srlz.d	// ensure that inter. collection is off (VHPT is don't care, since text is pinned)
-    ;;
-	bsw.0			// switch back to bank 0 (no stop bit required beforehand...)
-	;;
-#else
-	ldf.fill f8=[r3],32
-	;;
-	srlz.d	// ensure that inter. collection is off (VHPT is don't care, since text is pinned)
-	mov ar.ccv=r15
-	;;
-	ldf.fill f11=[r2]
-	bsw.0			// switch back to bank 0 (no stop bit required beforehand...)
-	;;
-#endif
-#ifdef XEN
-(pUStk) movl r18=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
-(pUStk) ld8 r18=[r18]
-#else
-(pUStk)	mov r18=IA64_KR(CURRENT)// M2 (12 cycle read latency)
-#endif
-	adds r16=PT(CR_IPSR)+16,r12
-	adds r17=PT(CR_IIP)+16,r12
-
-(pKStk)	mov r22=psr		// M2 read PSR now that interrupts are disabled
-	nop.i 0
-	nop.i 0
-	;;
-	ld8 r29=[r16],16	// load cr.ipsr
-	ld8 r28=[r17],16	// load cr.iip
-	;;
-	ld8 r30=[r16],16	// load cr.ifs
-	ld8 r25=[r17],16	// load ar.unat
-	;;
-	ld8 r26=[r16],16	// load ar.pfs
-	ld8 r27=[r17],16	// load ar.rsc
-#ifndef XEN	
-	cmp.eq p9,p0=r0,r0	// set p9 to indicate that we should restore cr.ifs
-#endif
-	;;
-	ld8 r24=[r16],16	// load ar.rnat (may be garbage)
-	ld8 r23=[r17],16	// load ar.bspstore (may be garbage)
-	;;
-	ld8 r31=[r16],16	// load predicates
-	ld8 r21=[r17],16	// load b0
-	;;
-	ld8 r19=[r16],16	// load ar.rsc value for "loadrs"
-	ld8.fill r1=[r17],16	// load r1
-	;;
-	ld8.fill r12=[r16],16
-	ld8.fill r13=[r17],16
-(pUStk)	adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18
-	;;
-	ld8 r20=[r16],16	// ar.fpsr
-	ld8.fill r15=[r17],16
-	;;
-	ld8.fill r14=[r16],16
-	ld8.fill r2=[r17]
-(pUStk)	mov r17=1
-	;;
-	ld8.fill r3=[r16]
-(pUStk)	st1 [r18]=r17		// restore current->thread.on_ustack
-	shr.u r18=r19,16	// get byte size of existing "dirty" partition
-	;;
-	mov r16=ar.bsp		// get existing backing store pointer
-#ifdef XEN
-	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)
-#else
-	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
-#endif
-	;;
-	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
-(pKStk)	br.cond.dpnt skip_rbs_switch
-
-	/*
-	 * Restore user backing store.
-	 *
-	 * NOTE: alloc, loadrs, and cover can't be predicated.
-	 */
-(pNonSys) br.cond.dpnt dont_preserve_current_frame
-	cover				// add current frame into dirty partition and set cr.ifs
-	;;
-	mov r19=ar.bsp			// get new backing store pointer
-rbs_switch:
-	sub r16=r16,r18			// krbs = old bsp - size of dirty partition
-#ifndef XEN
-	cmp.ne p9,p0=r0,r0		// clear p9 to skip restore of cr.ifs
-#endif
-	;;
-	sub r19=r19,r16			// calculate total byte size of dirty partition
-	add r18=64,r18			// don't force in0-in7 into memory...
-	;;
-	shl r19=r19,16			// shift size of dirty partition into loadrs position
-	;;
-dont_preserve_current_frame:
-	/*
-	 * To prevent leaking bits between the kernel and user-space,
-	 * we must clear the stacked registers in the "invalid" partition here.
-	 * Not pretty, but at least it's fast (3.34 registers/cycle on Itanium,
-	 * 5 registers/cycle on McKinley).
-	 */
-#	define pRecurse	p6
-#	define pReturn	p7
-#ifdef CONFIG_ITANIUM
-#	define Nregs	10
-#else
-#	define Nregs	14
-#endif
-	alloc loc0=ar.pfs,2,Nregs-2,2,0
-	shr.u loc1=r18,9		// RNaTslots <= floor(dirtySize / (64*8))
-	sub r17=r17,r18			// r17 = (physStackedSize + 8) - dirtySize
-	;;
-	mov ar.rsc=r19			// load ar.rsc to be used for "loadrs"
-	shladd in0=loc1,3,r17
-	mov in1=0
-	;;
-	TEXT_ALIGN(32)
-rse_clear_invalid:
-#ifdef CONFIG_ITANIUM
-	// cycle 0
- { .mii
-	alloc loc0=ar.pfs,2,Nregs-2,2,0
-	cmp.lt pRecurse,p0=Nregs*8,in0	// if more than Nregs regs left to clear, (re)curse
-	add out0=-Nregs*8,in0
-}{ .mfb
-	add out1=1,in1			// increment recursion count
-	nop.f 0
-	nop.b 0				// can't do br.call here because of alloc (WAW on CFM)
-	;;
-}{ .mfi	// cycle 1
-	mov loc1=0
-	nop.f 0
-	mov loc2=0
-}{ .mib
-	mov loc3=0
-	mov loc4=0
-(pRecurse) br.call.sptk.many b0=rse_clear_invalid
-
-}{ .mfi	// cycle 2
-	mov loc5=0
-	nop.f 0
-	cmp.ne pReturn,p0=r0,in1	// if recursion count != 0, we need to do a br.ret
-}{ .mib
-	mov loc6=0
-	mov loc7=0
-(pReturn) br.ret.sptk.many b0
-}
-#else /* !CONFIG_ITANIUM */
-	alloc loc0=ar.pfs,2,Nregs-2,2,0
-	cmp.lt pRecurse,p0=Nregs*8,in0	// if more than Nregs regs left to clear, (re)curse
-	add out0=-Nregs*8,in0
-	add out1=1,in1			// increment recursion count
-	mov loc1=0
-	mov loc2=0
-	;;
-	mov loc3=0
-	mov loc4=0
-	mov loc5=0
-	mov loc6=0
-	mov loc7=0
-(pRecurse) br.call.dptk.few b0=rse_clear_invalid
-	;;
-	mov loc8=0
-	mov loc9=0
-	cmp.ne pReturn,p0=r0,in1	// if recursion count != 0, we need to do a br.ret
-	mov loc10=0
-	mov loc11=0
-(pReturn) br.ret.dptk.many b0
-#endif /* !CONFIG_ITANIUM */
-#	undef pRecurse
-#	undef pReturn
-	;;
-	alloc r17=ar.pfs,0,0,0,0	// drop current register frame
-	;;
-	loadrs
-	;;
-skip_rbs_switch:
-	mov ar.unat=r25		// M2
-(pKStk)	extr.u r22=r22,21,1	// I0 extract current value of psr.pp from r22
-(pLvSys)mov r19=r0		// A  clear r19 for leave_syscall, no-op otherwise
-	;;
-(pUStk)	mov ar.bspstore=r23	// M2
-(pKStk)	dep r29=r22,r29,21,1	// I0 update ipsr.pp with psr.pp
-(pLvSys)mov r16=r0		// A  clear r16 for leave_syscall, no-op otherwise
-	;;
-	mov cr.ipsr=r29		// M2
-	mov ar.pfs=r26		// I0
-(pLvSys)mov r17=r0		// A  clear r17 for leave_syscall, no-op otherwise
-#ifdef XEN
-	mov cr.ifs=r30		// M2
-#else    
-(p9)	mov cr.ifs=r30		// M2
-#endif
-	mov b0=r21		// I0
-(pLvSys)mov r18=r0		// A  clear r18 for leave_syscall, no-op otherwise
-
-	mov ar.fpsr=r20		// M2
-	mov cr.iip=r28		// M2
-	nop 0
-	;;
-(pUStk)	mov ar.rnat=r24		// M2 must happen with RSE in lazy mode
-	nop 0
-#ifdef XEN    
-(pLvSys)mov r15=r0
-#else
-(pLvSys)mov r2=r0
-#endif
-
-	mov ar.rsc=r27		// M2
-	mov pr=r31,-1		// I0
-	rfi			// B
-
-#ifndef XEN
-	/*
-	 * On entry:
-	 *	r20 = &current->thread_info->pre_count (if CONFIG_PREEMPT)
-	 *	r31 = current->thread_info->flags
-	 * On exit:
-	 *	p6 = TRUE if work-pending-check needs to be redone
-	 */
-.work_pending_syscall:
-	add r2=-8,r2
-	add r3=-8,r3
-	;;
-	st8 [r2]=r8
-	st8 [r3]=r10
-.work_pending:
-	tbit.nz p6,p0=r31,TIF_SIGDELAYED		// signal delayed from  MCA/INIT/NMI/PMI context?
-(p6)	br.cond.sptk.few .sigdelayed
-	;;
-	tbit.z p6,p0=r31,TIF_NEED_RESCHED		// current_thread_info()->need_resched==0?
-(p6)	br.cond.sptk.few .notify
-#ifdef CONFIG_PREEMPT
-(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1
-	;;
-(pKStk) st4 [r20]=r21
-	ssm psr.i		// enable interrupts
-#endif
-	br.call.spnt.many rp=schedule
-.ret9:	cmp.eq p6,p0=r0,r0				// p6 <- 1
-	rsm psr.i		// disable interrupts
-	;;
-#ifdef CONFIG_PREEMPT
-(pKStk)	adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
-	;;
-(pKStk)	st4 [r20]=r0		// preempt_count() <- 0
-#endif
-(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
-	br.cond.sptk.many .work_processed_kernel	// re-check
-
-.notify:
-(pUStk)	br.call.spnt.many rp=notify_resume_user
-.ret10:	cmp.ne p6,p0=r0,r0				// p6 <- 0
-(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
-	br.cond.sptk.many .work_processed_kernel	// don't re-check
-
-// There is a delayed signal that was detected in MCA/INIT/NMI/PMI context where
-// it could not be delivered.  Deliver it now.  The signal might be for us and
-// may set TIF_SIGPENDING, so redrive ia64_leave_* after processing the delayed
-// signal.
-
-.sigdelayed:
-	br.call.sptk.many rp=do_sigdelayed
-	cmp.eq p6,p0=r0,r0				// p6 <- 1, always re-check
-(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
-	br.cond.sptk.many .work_processed_kernel	// re-check
-
-.work_pending_syscall_end:
-	adds r2=PT(R8)+16,r12
-	adds r3=PT(R10)+16,r12
-	;;
-	ld8 r8=[r2]
-	ld8 r10=[r3]
-	br.cond.sptk.many .work_processed_syscall	// re-check
-#endif
-
-END(ia64_leave_kernel)
-
-ENTRY(handle_syscall_error)
-	/*
-	 * Some system calls (e.g., ptrace, mmap) can return arbitrary values which could
-	 * lead us to mistake a negative return value as a failed syscall.  Those syscall
-	 * must deposit a non-zero value in pt_regs.r8 to indicate an error.  If
-	 * pt_regs.r8 is zero, we assume that the call completed successfully.
-	 */
-	PT_REGS_UNWIND_INFO(0)
-	ld8 r3=[r2]		// load pt_regs.r8
-	;;
-	cmp.eq p6,p7=r3,r0	// is pt_regs.r8==0?
-	;;
-(p7)	mov r10=-1
-(p7)	sub r8=0,r8		// negate return value to get errno
-	br.cond.sptk ia64_leave_syscall
-END(handle_syscall_error)
-
-	/*
-	 * Invoke schedule_tail(task) while preserving in0-in7, which may be needed
-	 * in case a system call gets restarted.
-	 */
-GLOBAL_ENTRY(ia64_invoke_schedule_tail)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,1,0
-	mov loc0=rp
-	mov out0=r8				// Address of previous task
-	;;
-	br.call.sptk.many rp=schedule_tail
-.ret11:	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(ia64_invoke_schedule_tail)
-
-#ifndef XEN
-	/*
-	 * Setup stack and call do_notify_resume_user().  Note that pSys and pNonSys need to
-	 * be set up by the caller.  We declare 8 input registers so the system call
-	 * args get preserved, in case we need to restart a system call.
-	 */
-ENTRY(notify_resume_user)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
-	mov r9=ar.unat
-	mov loc0=rp				// save return address
-	mov out0=0				// there is no "oldset"
-	adds out1=8,sp				// out1=&sigscratch->ar_pfs
-(pSys)	mov out2=1				// out2==1 => we're in a syscall
-	;;
-(pNonSys) mov out2=0				// out2==0 => not a syscall
-	.fframe 16
-	.spillsp ar.unat, 16
-	st8 [sp]=r9,-16				// allocate space for ar.unat and save it
-	st8 [out1]=loc1,-8			// save ar.pfs, out1=&sigscratch
-	.body
-	br.call.sptk.many rp=do_notify_resume_user
-.ret15:	.restore sp
-	adds sp=16,sp				// pop scratch stack space
-	;;
-	ld8 r9=[sp]				// load new unat from sigscratch->scratch_unat
-	mov rp=loc0
-	;;
-	mov ar.unat=r9
-	mov ar.pfs=loc1
-	br.ret.sptk.many rp
-END(notify_resume_user)
-
-GLOBAL_ENTRY(sys_rt_sigsuspend)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
-	mov r9=ar.unat
-	mov loc0=rp				// save return address
-	mov out0=in0				// mask
-	mov out1=in1				// sigsetsize
-	adds out2=8,sp				// out2=&sigscratch->ar_pfs
-	;;
-	.fframe 16
-	.spillsp ar.unat, 16
-	st8 [sp]=r9,-16				// allocate space for ar.unat and save it
-	st8 [out2]=loc1,-8			// save ar.pfs, out2=&sigscratch
-	.body
-	br.call.sptk.many rp=ia64_rt_sigsuspend
-.ret17:	.restore sp
-	adds sp=16,sp				// pop scratch stack space
-	;;
-	ld8 r9=[sp]				// load new unat from sw->caller_unat
-	mov rp=loc0
-	;;
-	mov ar.unat=r9
-	mov ar.pfs=loc1
-	br.ret.sptk.many rp
-END(sys_rt_sigsuspend)
-
-ENTRY(sys_rt_sigreturn)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	alloc r2=ar.pfs,8,0,1,0
-	.prologue
-	PT_REGS_SAVES(16)
-	adds sp=-16,sp
-	.body
-	cmp.eq pNonSys,pSys=r0,r0		// sigreturn isn't a normal syscall...
-	;;
-	/*
-	 * leave_kernel() restores f6-f11 from pt_regs, but since the streamlined
-	 * syscall-entry path does not save them we save them here instead.  Note: we
-	 * don't need to save any other registers that are not saved by the stream-lined
-	 * syscall path, because restore_sigcontext() restores them.
-	 */
-	adds r16=PT(F6)+32,sp
-	adds r17=PT(F7)+32,sp
-	;;
- 	stf.spill [r16]=f6,32
- 	stf.spill [r17]=f7,32
-	;;
- 	stf.spill [r16]=f8,32
- 	stf.spill [r17]=f9,32
-	;;
- 	stf.spill [r16]=f10
- 	stf.spill [r17]=f11
-	adds out0=16,sp				// out0 = &sigscratch
-	br.call.sptk.many rp=ia64_rt_sigreturn
-.ret19:	.restore sp,0
-	adds sp=16,sp
-	;;
-	ld8 r9=[sp]				// load new ar.unat
-	mov.sptk b7=r8,ia64_leave_kernel
-	;;
-	mov ar.unat=r9
-	br.many b7
-END(sys_rt_sigreturn)
-#endif
-
-GLOBAL_ENTRY(ia64_prepare_handle_unaligned)
-	.prologue
-	/*
-	 * r16 = fake ar.pfs, we simply need to make sure privilege is still 0
-	 */
-	mov r16=r0
-	DO_SAVE_SWITCH_STACK
-	br.call.sptk.many rp=ia64_handle_unaligned	// stack frame setup in ivt
-.ret21:	.body
-	DO_LOAD_SWITCH_STACK
-	br.cond.sptk.many rp				// goes to ia64_leave_kernel
-END(ia64_prepare_handle_unaligned)
-
-	//
-	// unw_init_running(void (*callback)(info, arg), void *arg)
-	//
-#	define EXTRA_FRAME_SIZE	((UNW_FRAME_INFO_SIZE+15)&~15)
-
-GLOBAL_ENTRY(unw_init_running)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-	alloc loc1=ar.pfs,2,3,3,0
-	;;
-	ld8 loc2=[in0],8
-	mov loc0=rp
-	mov r16=loc1
-	DO_SAVE_SWITCH_STACK
-	.body
-
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-	.fframe IA64_SWITCH_STACK_SIZE+EXTRA_FRAME_SIZE
-	SWITCH_STACK_SAVES(EXTRA_FRAME_SIZE)
-	adds sp=-EXTRA_FRAME_SIZE,sp
-	.body
-	;;
-	adds out0=16,sp				// &info
-	mov out1=r13				// current
-	adds out2=16+EXTRA_FRAME_SIZE,sp	// &switch_stack
-	br.call.sptk.many rp=unw_init_frame_info
-1:	adds out0=16,sp				// &info
-	mov b6=loc2
-	mov loc2=gp				// save gp across indirect function call
-	;;
-	ld8 gp=[in0]
-	mov out1=in1				// arg
-	br.call.sptk.many rp=b6			// invoke the callback function
-1:	mov gp=loc2				// restore gp
-
-	// For now, we don't allow changing registers from within
-	// unw_init_running; if we ever want to allow that, we'd
-	// have to do a load_switch_stack here:
-	.restore sp
-	adds sp=IA64_SWITCH_STACK_SIZE+EXTRA_FRAME_SIZE,sp
-
-	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(unw_init_running)
-
-#ifdef XEN
-GLOBAL_ENTRY(ia64_do_multicall_call)
-	movl r2=ia64_hypercall_table;;
-	shladd r2=r38,3,r2;;
-	ld8 r2=[r2];;
-	mov b6=r2
-	br.sptk.many b6;;
-END(ia64_do_multicall_call)
-
-    
-	.rodata
-	.align 8
-	.globl ia64_hypercall_table
-ia64_hypercall_table:
-	data8 do_ni_hypercall		/* do_set_trap_table *//*  0 */
-	data8 do_ni_hypercall		/* do_mmu_update */
-	data8 do_ni_hypercall		/* do_set_gdt */
-	data8 do_ni_hypercall		/* do_stack_switch */
-	data8 do_ni_hypercall		/* do_set_callbacks */
-	data8 do_ni_hypercall		/* do_fpu_taskswitch *//*  5 */
-	data8 do_sched_op_compat
-	data8 do_platform_op
-	data8 do_ni_hypercall		/* do_set_debugreg */
-	data8 do_ni_hypercall		/* do_get_debugreg */
-	data8 do_ni_hypercall		/* do_update_descriptor * 10 */
-	data8 do_ni_hypercall		/* do_ni_hypercall */
-	data8 do_memory_op
-	data8 do_multicall
-	data8 do_ni_hypercall		/* do_update_va_mapping */
-	data8 do_ni_hypercall		/* do_set_timer_op */  /* 15 */
-	data8 do_ni_hypercall
-	data8 do_xen_version
-	data8 do_console_io
-	data8 do_ni_hypercall
-	data8 do_grant_table_op				       /* 20 */
-	data8 do_ni_hypercall		/* do_vm_assist */
-	data8 do_ni_hypercall		/* do_update_va_mapping_othe */
-	data8 do_ni_hypercall		/* (x86 only) */
-	data8 do_vcpu_op		/* do_vcpu_op */
-	data8 do_ni_hypercall		/* (x86_64 only) */    /* 25 */
-	data8 do_ni_hypercall		/* do_mmuext_op */
-	data8 do_ni_hypercall		/* do_acm_op */
-	data8 do_ni_hypercall		/* do_nmi_op */
-	data8 do_sched_op
-	data8 do_callback_op		/*  */                 /* 30 */
-	data8 do_xenoprof_op		/*  */
-	data8 do_event_channel_op
-	data8 do_physdev_op
-	data8 do_hvm_op			/*  */
-	data8 do_sysctl			/*  */                  /* 35 */
-	data8 do_domctl			/*  */
-	data8 do_kexec_op		/*  */
-	data8 do_tmem_op		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */                 /* 40 */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */                 /* 45 */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_dom0vp_op              /* dom0vp_op */
-	data8 do_pirq_guest_eoi		/* arch_1 */
-	data8 do_ia64_debug_op		/* arch_2 */           /* 50 */
-	data8 do_ni_hypercall		/* arch_3 */
-	data8 do_ni_hypercall		/* arch_4 */
-	data8 do_ni_hypercall		/* arch_5 */
-	data8 do_ni_hypercall		/* arch_6 */
-	data8 do_ni_hypercall		/* arch_7 */           /* 55 */
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall                                  /* 60 */
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-
-	// guard against failures to increase NR_hypercalls
-	.org ia64_hypercall_table + 8*NR_hypercalls
-
-#else
-	.rodata
-	.align 8
-	.globl sys_call_table
-sys_call_table:
-	data8 sys_ni_syscall		//  This must be sys_ni_syscall!  See ivt.S.
-	data8 sys_exit				// 1025
-	data8 sys_read
-	data8 sys_write
-	data8 sys_open
-	data8 sys_close
-	data8 sys_creat				// 1030
-	data8 sys_link
-	data8 sys_unlink
-	data8 ia64_execve
-	data8 sys_chdir
-	data8 sys_fchdir			// 1035
-	data8 sys_utimes
-	data8 sys_mknod
-	data8 sys_chmod
-	data8 sys_chown
-	data8 sys_lseek				// 1040
-	data8 sys_getpid
-	data8 sys_getppid
-	data8 sys_mount
-	data8 sys_umount
-	data8 sys_setuid			// 1045
-	data8 sys_getuid
-	data8 sys_geteuid
-	data8 sys_ptrace
-	data8 sys_access
-	data8 sys_sync				// 1050
-	data8 sys_fsync
-	data8 sys_fdatasync
-	data8 sys_kill
-	data8 sys_rename
-	data8 sys_mkdir				// 1055
-	data8 sys_rmdir
-	data8 sys_dup
-	data8 sys_pipe
-	data8 sys_times
-	data8 ia64_brk				// 1060
-	data8 sys_setgid
-	data8 sys_getgid
-	data8 sys_getegid
-	data8 sys_acct
-	data8 sys_ioctl				// 1065
-	data8 sys_fcntl
-	data8 sys_umask
-	data8 sys_chroot
-	data8 sys_ustat
-	data8 sys_dup2				// 1070
-	data8 sys_setreuid
-	data8 sys_setregid
-	data8 sys_getresuid
-	data8 sys_setresuid
-	data8 sys_getresgid			// 1075
-	data8 sys_setresgid
-	data8 sys_getgroups
-	data8 sys_setgroups
-	data8 sys_getpgid
-	data8 sys_setpgid			// 1080
-	data8 sys_setsid
-	data8 sys_getsid
-	data8 sys_sethostname
-	data8 sys_setrlimit
-	data8 sys_getrlimit			// 1085
-	data8 sys_getrusage
-	data8 sys_gettimeofday
-	data8 sys_settimeofday
-	data8 sys_select
-	data8 sys_poll				// 1090
-	data8 sys_symlink
-	data8 sys_readlink
-	data8 sys_uselib
-	data8 sys_swapon
-	data8 sys_swapoff			// 1095
-	data8 sys_reboot
-	data8 sys_truncate
-	data8 sys_ftruncate
-	data8 sys_fchmod
-	data8 sys_fchown			// 1100
-	data8 ia64_getpriority
-	data8 sys_setpriority
-	data8 sys_statfs
-	data8 sys_fstatfs
-	data8 sys_gettid			// 1105
-	data8 sys_semget
-	data8 sys_semop
-	data8 sys_semctl
-	data8 sys_msgget
-	data8 sys_msgsnd			// 1110
-	data8 sys_msgrcv
-	data8 sys_msgctl
-	data8 sys_shmget
-	data8 sys_shmat
-	data8 sys_shmdt				// 1115
-	data8 sys_shmctl
-	data8 sys_syslog
-	data8 sys_setitimer
-	data8 sys_getitimer
-	data8 sys_ni_syscall			// 1120		/* was: ia64_oldstat */
-	data8 sys_ni_syscall					/* was: ia64_oldlstat */
-	data8 sys_ni_syscall					/* was: ia64_oldfstat */
-	data8 sys_vhangup
-	data8 sys_lchown
-	data8 sys_remap_file_pages		// 1125
-	data8 sys_wait4
-	data8 sys_sysinfo
-	data8 sys_clone
-	data8 sys_setdomainname
-	data8 sys_newuname			// 1130
-	data8 sys_adjtimex
-	data8 sys_ni_syscall					/* was: ia64_create_module */
-	data8 sys_init_module
-	data8 sys_delete_module
-	data8 sys_ni_syscall			// 1135		/* was: sys_get_kernel_syms */
-	data8 sys_ni_syscall					/* was: sys_query_module */
-	data8 sys_quotactl
-	data8 sys_bdflush
-	data8 sys_sysfs
-	data8 sys_personality			// 1140
-	data8 sys_ni_syscall		// sys_afs_syscall
-	data8 sys_setfsuid
-	data8 sys_setfsgid
-	data8 sys_getdents
-	data8 sys_flock				// 1145
-	data8 sys_readv
-	data8 sys_writev
-	data8 sys_pread64
-	data8 sys_pwrite64
-	data8 sys_sysctl			// 1150
-	data8 sys_mmap
-	data8 sys_munmap
-	data8 sys_mlock
-	data8 sys_mlockall
-	data8 sys_mprotect			// 1155
-	data8 ia64_mremap
-	data8 sys_msync
-	data8 sys_munlock
-	data8 sys_munlockall
-	data8 sys_sched_getparam		// 1160
-	data8 sys_sched_setparam
-	data8 sys_sched_getscheduler
-	data8 sys_sched_setscheduler
-	data8 sys_sched_yield
-	data8 sys_sched_get_priority_max	// 1165
-	data8 sys_sched_get_priority_min
-	data8 sys_sched_rr_get_interval
-	data8 sys_nanosleep
-	data8 sys_nfsservctl
-	data8 sys_prctl				// 1170
-	data8 sys_getpagesize
-	data8 sys_mmap2
-	data8 sys_pciconfig_read
-	data8 sys_pciconfig_write
-	data8 sys_perfmonctl			// 1175
-	data8 sys_sigaltstack
-	data8 sys_rt_sigaction
-	data8 sys_rt_sigpending
-	data8 sys_rt_sigprocmask
-	data8 sys_rt_sigqueueinfo		// 1180
-	data8 sys_rt_sigreturn
-	data8 sys_rt_sigsuspend
-	data8 sys_rt_sigtimedwait
-	data8 sys_getcwd
-	data8 sys_capget			// 1185
-	data8 sys_capset
-	data8 sys_sendfile64
-	data8 sys_ni_syscall		// sys_getpmsg (STREAMS)
-	data8 sys_ni_syscall		// sys_putpmsg (STREAMS)
-	data8 sys_socket			// 1190
-	data8 sys_bind
-	data8 sys_connect
-	data8 sys_listen
-	data8 sys_accept
-	data8 sys_getsockname			// 1195
-	data8 sys_getpeername
-	data8 sys_socketpair
-	data8 sys_send
-	data8 sys_sendto
-	data8 sys_recv				// 1200
-	data8 sys_recvfrom
-	data8 sys_shutdown
-	data8 sys_setsockopt
-	data8 sys_getsockopt
-	data8 sys_sendmsg			// 1205
-	data8 sys_recvmsg
-	data8 sys_pivot_root
-	data8 sys_mincore
-	data8 sys_madvise
-	data8 sys_newstat			// 1210
-	data8 sys_newlstat
-	data8 sys_newfstat
-	data8 sys_clone2
-	data8 sys_getdents64
-	data8 sys_getunwind			// 1215
-	data8 sys_readahead
-	data8 sys_setxattr
-	data8 sys_lsetxattr
-	data8 sys_fsetxattr
-	data8 sys_getxattr			// 1220
-	data8 sys_lgetxattr
-	data8 sys_fgetxattr
-	data8 sys_listxattr
-	data8 sys_llistxattr
-	data8 sys_flistxattr			// 1225
-	data8 sys_removexattr
-	data8 sys_lremovexattr
-	data8 sys_fremovexattr
-	data8 sys_tkill
-	data8 sys_futex				// 1230
-	data8 sys_sched_setaffinity
-	data8 sys_sched_getaffinity
-	data8 sys_set_tid_address
-	data8 sys_fadvise64_64
-	data8 sys_tgkill 			// 1235
-	data8 sys_exit_group
-	data8 sys_lookup_dcookie
-	data8 sys_io_setup
-	data8 sys_io_destroy
-	data8 sys_io_getevents			// 1240
-	data8 sys_io_submit
-	data8 sys_io_cancel
-	data8 sys_epoll_create
-	data8 sys_epoll_ctl
-	data8 sys_epoll_wait			// 1245
-	data8 sys_restart_syscall
-	data8 sys_semtimedop
-	data8 sys_timer_create
-	data8 sys_timer_settime
-	data8 sys_timer_gettime			// 1250
-	data8 sys_timer_getoverrun
-	data8 sys_timer_delete
-	data8 sys_clock_settime
-	data8 sys_clock_gettime
-	data8 sys_clock_getres			// 1255
-	data8 sys_clock_nanosleep
-	data8 sys_fstatfs64
-	data8 sys_statfs64
-	data8 sys_mbind
-	data8 sys_get_mempolicy			// 1260
-	data8 sys_set_mempolicy
-	data8 sys_mq_open
-	data8 sys_mq_unlink
-	data8 sys_mq_timedsend
-	data8 sys_mq_timedreceive		// 1265
-	data8 sys_mq_notify
-	data8 sys_mq_getsetattr
-	data8 sys_ni_syscall			// reserved for kexec_load
-	data8 sys_ni_syscall			// reserved for vserver
-	data8 sys_waitid			// 1270
-	data8 sys_add_key
-	data8 sys_request_key
-	data8 sys_keyctl
-	data8 sys_ioprio_set
-	data8 sys_ioprio_get			// 1275
-	data8 sys_ni_syscall
-	data8 sys_inotify_init
-	data8 sys_inotify_add_watch
-	data8 sys_inotify_rm_watch
-
-	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
-#endif
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/entry.h
--- a/xen/arch/ia64/linux-xen/entry.h	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-#include <linux/config.h>
-
-/*
- * Preserved registers that are shared between code in ivt.S and
- * entry.S.  Be careful not to step on these!
- */
-#define PRED_LEAVE_SYSCALL	1 /* TRUE iff leave from syscall */
-#define PRED_KERNEL_STACK	2 /* returning to kernel-stacks? */
-#define PRED_USER_STACK		3 /* returning to user-stacks? */
-#define PRED_SYSCALL		4 /* inside a system call? */
-#define PRED_NON_SYSCALL	5 /* complement of PRED_SYSCALL */
-
-#ifdef __ASSEMBLY__
-# define PASTE2(x,y)	x##y
-# define PASTE(x,y)	PASTE2(x,y)
-
-# define pLvSys		PASTE(p,PRED_LEAVE_SYSCALL)
-# define pKStk		PASTE(p,PRED_KERNEL_STACK)
-# define pUStk		PASTE(p,PRED_USER_STACK)
-# define pSys		PASTE(p,PRED_SYSCALL)
-# define pNonSys	PASTE(p,PRED_NON_SYSCALL)
-#endif
-
-#define PT(f)		(IA64_PT_REGS_##f##_OFFSET)
-#define SW(f)		(IA64_SWITCH_STACK_##f##_OFFSET)
-#ifdef  XEN
-#define VPD(f)      (VPD_##f##_START_OFFSET)
-#endif
-
-#define PT_REGS_SAVES(off)			\
-	.unwabi 3, 'i';				\
-	.fframe IA64_PT_REGS_SIZE+16+(off);	\
-	.spillsp rp, PT(CR_IIP)+16+(off);	\
-	.spillsp ar.pfs, PT(CR_IFS)+16+(off);	\
-	.spillsp ar.unat, PT(AR_UNAT)+16+(off);	\
-	.spillsp ar.fpsr, PT(AR_FPSR)+16+(off);	\
-	.spillsp pr, PT(PR)+16+(off);
-
-#define PT_REGS_UNWIND_INFO(off)		\
-	.prologue;				\
-	PT_REGS_SAVES(off);			\
-	.body
-
-#define SWITCH_STACK_SAVES(off)							\
-	.savesp ar.unat,SW(CALLER_UNAT)+16+(off);				\
-	.savesp ar.fpsr,SW(AR_FPSR)+16+(off);					\
-	.spillsp f2,SW(F2)+16+(off); .spillsp f3,SW(F3)+16+(off);		\
-	.spillsp f4,SW(F4)+16+(off); .spillsp f5,SW(F5)+16+(off);		\
-	.spillsp f16,SW(F16)+16+(off); .spillsp f17,SW(F17)+16+(off);		\
-	.spillsp f18,SW(F18)+16+(off); .spillsp f19,SW(F19)+16+(off);		\
-	.spillsp f20,SW(F20)+16+(off); .spillsp f21,SW(F21)+16+(off);		\
-	.spillsp f22,SW(F22)+16+(off); .spillsp f23,SW(F23)+16+(off);		\
-	.spillsp f24,SW(F24)+16+(off); .spillsp f25,SW(F25)+16+(off);		\
-	.spillsp f26,SW(F26)+16+(off); .spillsp f27,SW(F27)+16+(off);		\
-	.spillsp f28,SW(F28)+16+(off); .spillsp f29,SW(F29)+16+(off);		\
-	.spillsp f30,SW(F30)+16+(off); .spillsp f31,SW(F31)+16+(off);		\
-	.spillsp r4,SW(R4)+16+(off); .spillsp r5,SW(R5)+16+(off);		\
-	.spillsp r6,SW(R6)+16+(off); .spillsp r7,SW(R7)+16+(off);		\
-	.spillsp b0,SW(B0)+16+(off); .spillsp b1,SW(B1)+16+(off);		\
-	.spillsp b2,SW(B2)+16+(off); .spillsp b3,SW(B3)+16+(off);		\
-	.spillsp b4,SW(B4)+16+(off); .spillsp b5,SW(B5)+16+(off);		\
-	.spillsp ar.pfs,SW(AR_PFS)+16+(off); .spillsp ar.lc,SW(AR_LC)+16+(off);	\
-	.spillsp @priunat,SW(AR_UNAT)+16+(off);					\
-	.spillsp ar.rnat,SW(AR_RNAT)+16+(off);					\
-	.spillsp ar.bspstore,SW(AR_BSPSTORE)+16+(off);				\
-	.spillsp pr,SW(PR)+16+(off)
-
-#define DO_SAVE_SWITCH_STACK			\
-	movl r28=1f;				\
-	;;					\
-	.fframe IA64_SWITCH_STACK_SIZE;		\
-	adds sp=-IA64_SWITCH_STACK_SIZE,sp;	\
-	mov.ret.sptk b7=r28,1f;			\
-	SWITCH_STACK_SAVES(0);			\
-	br.cond.sptk.many save_switch_stack;	\
-1:
-
-#define DO_LOAD_SWITCH_STACK			\
-	movl r28=1f;				\
-	;;					\
-	invala;					\
-	mov.ret.sptk b7=r28,1f;			\
-	br.cond.sptk.many load_switch_stack;	\
-1:	.restore sp;				\
-	adds sp=IA64_SWITCH_STACK_SIZE,sp
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/head.S
--- a/xen/arch/ia64/linux-xen/head.S	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1298 +0,0 @@
-/*
- * Here is where the ball gets rolling as far as the kernel is concerned.
- * When control is transferred to _start, the bootload has already
- * loaded us to the correct address.  All that's left to do here is
- * to set up the kernel's global pointer and jump to the kernel
- * entry point.
- *
- * Copyright (C) 1998-2001, 2003, 2005 Hewlett-Packard Co
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *	Stephane Eranian <eranian@hpl.hp.com>
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- * Copyright (C) 1999 Intel Corp.
- * Copyright (C) 1999 Asit Mallick <Asit.K.Mallick@intel.com>
- * Copyright (C) 1999 Don Dugger <Don.Dugger@intel.com>
- * Copyright (C) 2002 Fenghua Yu <fenghua.yu@intel.com>
- *   -Optimize __ia64_save_fpu() and __ia64_load_fpu() for Itanium 2.
- * Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com>
- *   Support for CPU Hotplug
- */
-
-#include <linux/config.h>
-
-#include <asm/asmmacro.h>
-#include <asm/fpu.h>
-#include <asm/kregs.h>
-#include <asm/mmu_context.h>
-#include <asm/offsets.h>
-#include <asm/pal.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <asm/system.h>
-#include <asm/mca_asm.h>
-
-#ifdef CONFIG_HOTPLUG_CPU
-#define SAL_PSR_BITS_TO_SET				\
-	(IA64_PSR_AC | IA64_PSR_BN | IA64_PSR_MFH | IA64_PSR_MFL)
-
-#define SAVE_FROM_REG(src, ptr, dest)	\
-	mov dest=src;;						\
-	st8 [ptr]=dest,0x08
-
-#define RESTORE_REG(reg, ptr, _tmp)		\
-	ld8 _tmp=[ptr],0x08;;				\
-	mov reg=_tmp
-
-#define SAVE_BREAK_REGS(ptr, _idx, _breg, _dest)\
-	mov ar.lc=IA64_NUM_DBG_REGS-1;; 			\
-	mov _idx=0;; 								\
-1: 												\
-	SAVE_FROM_REG(_breg[_idx], ptr, _dest);;	\
-	add _idx=1,_idx;;							\
-	br.cloop.sptk.many 1b
-
-#define RESTORE_BREAK_REGS(ptr, _idx, _breg, _tmp, _lbl)\
-	mov ar.lc=IA64_NUM_DBG_REGS-1;;			\
-	mov _idx=0;;							\
-_lbl:  RESTORE_REG(_breg[_idx], ptr, _tmp);;	\
-	add _idx=1, _idx;;						\
-	br.cloop.sptk.many _lbl
-
-#define SAVE_ONE_RR(num, _reg, _tmp) \
-	movl _tmp=(num<<61);;	\
-	mov _reg=rr[_tmp]
-
-#define SAVE_REGION_REGS(_tmp, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7) \
-	SAVE_ONE_RR(0,_r0, _tmp);; \
-	SAVE_ONE_RR(1,_r1, _tmp);; \
-	SAVE_ONE_RR(2,_r2, _tmp);; \
-	SAVE_ONE_RR(3,_r3, _tmp);; \
-	SAVE_ONE_RR(4,_r4, _tmp);; \
-	SAVE_ONE_RR(5,_r5, _tmp);; \
-	SAVE_ONE_RR(6,_r6, _tmp);; \
-	SAVE_ONE_RR(7,_r7, _tmp);;
-
-#define STORE_REGION_REGS(ptr, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7) \
-	st8 [ptr]=_r0, 8;; \
-	st8 [ptr]=_r1, 8;; \
-	st8 [ptr]=_r2, 8;; \
-	st8 [ptr]=_r3, 8;; \
-	st8 [ptr]=_r4, 8;; \
-	st8 [ptr]=_r5, 8;; \
-	st8 [ptr]=_r6, 8;; \
-	st8 [ptr]=_r7, 8;;
-
-#define RESTORE_REGION_REGS(ptr, _idx1, _idx2, _tmp) \
-	mov		ar.lc=0x08-1;;						\
-	movl	_idx1=0x00;;						\
-RestRR:											\
-	dep.z	_idx2=_idx1,61,3;;					\
-	ld8		_tmp=[ptr],8;;						\
-	mov		rr[_idx2]=_tmp;;					\
-	srlz.d;;									\
-	add		_idx1=1,_idx1;;						\
-	br.cloop.sptk.few	RestRR
-
-#define SET_AREA_FOR_BOOTING_CPU(reg1, reg2) \
-	movl reg1=sal_state_for_booting_cpu;;	\
-	ld8 reg2=[reg1];;
-
-/*
- * Adjust region registers saved before starting to save
- * break regs and rest of the states that need to be preserved.
- */
-#define SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(_reg1,_reg2,_pred)  \
-	SAVE_FROM_REG(b0,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b1,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b2,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b3,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b4,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b5,_reg1,_reg2);;						\
-	st8 [_reg1]=r1,0x08;;								\
-	st8 [_reg1]=r12,0x08;;								\
-	st8 [_reg1]=r13,0x08;;								\
-	SAVE_FROM_REG(ar.fpsr,_reg1,_reg2);;				\
-	SAVE_FROM_REG(ar.pfs,_reg1,_reg2);;					\
-	SAVE_FROM_REG(ar.rnat,_reg1,_reg2);;				\
-	SAVE_FROM_REG(ar.unat,_reg1,_reg2);;				\
-	SAVE_FROM_REG(ar.bspstore,_reg1,_reg2);;			\
-	SAVE_FROM_REG(cr.dcr,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.iva,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.pta,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.itv,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.pmv,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.cmcv,_reg1,_reg2);;				\
-	SAVE_FROM_REG(cr.lrr0,_reg1,_reg2);;				\
-	SAVE_FROM_REG(cr.lrr1,_reg1,_reg2);;				\
-	st8 [_reg1]=r4,0x08;;								\
-	st8 [_reg1]=r5,0x08;;								\
-	st8 [_reg1]=r6,0x08;;								\
-	st8 [_reg1]=r7,0x08;;								\
-	st8 [_reg1]=_pred,0x08;;							\
-	SAVE_FROM_REG(ar.lc, _reg1, _reg2);;				\
-	stf.spill.nta [_reg1]=f2,16;;						\
-	stf.spill.nta [_reg1]=f3,16;;						\
-	stf.spill.nta [_reg1]=f4,16;;						\
-	stf.spill.nta [_reg1]=f5,16;;						\
-	stf.spill.nta [_reg1]=f16,16;;						\
-	stf.spill.nta [_reg1]=f17,16;;						\
-	stf.spill.nta [_reg1]=f18,16;;						\
-	stf.spill.nta [_reg1]=f19,16;;						\
-	stf.spill.nta [_reg1]=f20,16;;						\
-	stf.spill.nta [_reg1]=f21,16;;						\
-	stf.spill.nta [_reg1]=f22,16;;						\
-	stf.spill.nta [_reg1]=f23,16;;						\
-	stf.spill.nta [_reg1]=f24,16;;						\
-	stf.spill.nta [_reg1]=f25,16;;						\
-	stf.spill.nta [_reg1]=f26,16;;						\
-	stf.spill.nta [_reg1]=f27,16;;						\
-	stf.spill.nta [_reg1]=f28,16;;						\
-	stf.spill.nta [_reg1]=f29,16;;						\
-	stf.spill.nta [_reg1]=f30,16;;						\
-	stf.spill.nta [_reg1]=f31,16;;
-
-#else
-#define SET_AREA_FOR_BOOTING_CPU(a1, a2)
-#define SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(a1,a2, a3)
-#define SAVE_REGION_REGS(_tmp, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7)
-#define STORE_REGION_REGS(ptr, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7)
-#endif
-
-#ifdef XEN
-#define SET_ONE_RR(num, pgsize, _tmp1, _tmp2, vhpt) \
-	movl _tmp1=(num << 61);;	\
-	movl _tmp2=((ia64_rid(IA64_REGION_ID_KERNEL, (num<<61)) << 8) | (pgsize << 2) | vhpt);; \
-	mov rr[_tmp1]=_tmp2
-#else
-#define SET_ONE_RR(num, pgsize, _tmp1, _tmp2, vhpt) \
-	movl _tmp1=(num << 61);;	\
-	mov _tmp2=((ia64_rid(IA64_REGION_ID_KERNEL, (num<<61)) << 8) | (pgsize << 2) | vhpt);; \
-	mov rr[_tmp1]=_tmp2
-#endif
-
-	.section __special_page_section,"ax"
-
-	.global empty_zero_page
-empty_zero_page:
-	.skip PAGE_SIZE
-
-#ifndef XEN
-	.global swapper_pg_dir
-swapper_pg_dir:
-	.skip PAGE_SIZE
-#endif
-
-#if defined(XEN) && defined(CONFIG_VIRTUAL_FRAME_TABLE)
-	.global frametable_pg_dir
-frametable_pg_dir:
-	.skip PAGE_SIZE
-#endif
-
-	.rodata
-halt_msg:
-	stringz "Halting kernel\n"
-
-	.text
-
-	.global start_ap
-
-	/*
-	 * Start the kernel.  When the bootloader passes control to _start(), r28
-	 * points to the address of the boot parameter area.  Execution reaches
-	 * here in physical mode.
-	 */
-GLOBAL_ENTRY(_start)
-start_ap:
-	.prologue
-	.save rp, r0		// terminate unwind chain with a NULL rp
-	.body
-
-	rsm psr.i | psr.ic
-	;;
-	srlz.i
-	;;
-	/*
-	 * Save the region registers, predicate before they get clobbered
-	 */
-	SAVE_REGION_REGS(r2, r8,r9,r10,r11,r12,r13,r14,r15);
-	mov r25=pr;;
-
-	/*
-	 * Initialize kernel region registers:
-	 *	rr[0]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[1]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[2]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[3]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[4]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[5]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[6]: VHPT disabled, page size = IA64_GRANULE_SHIFT
-	 *	rr[7]: VHPT disabled, page size = IA64_GRANULE_SHIFT
-	 * We initialize all of them to prevent inadvertently assuming
-	 * something about the state of address translation early in boot.
-	 */
-	SET_ONE_RR(0, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(1, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(2, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(3, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(4, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(5, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(6, IA64_GRANULE_SHIFT, r2, r16, 0);;
-	SET_ONE_RR(7, IA64_GRANULE_SHIFT, r2, r16, 0);;
-	/*
-	 * Now pin mappings into the TLB for kernel text and data
-	 */
-	mov r18=KERNEL_TR_PAGE_SHIFT<<2
-	movl r17=KERNEL_START
-	;;
-	mov cr.itir=r18
-	mov cr.ifa=r17
-	mov r16=IA64_TR_KERNEL
-	mov r3=ip
-	movl r18=PAGE_KERNEL
-	;;
-	dep r2=0,r3,0,KERNEL_TR_PAGE_SHIFT
-	;;
-	or r18=r2,r18
-	;;
-	srlz.i
-	;;
-	itr.i itr[r16]=r18
-	;;
-	itr.d dtr[r16]=r18
-	;;
-	srlz.i
-
-	/*
-	 * Switch into virtual mode:
-	 */
-#ifdef XEN
-		movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \
-		  |IA64_PSR_DI|IA64_PSR_AC)
-#else
-	movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \
-		  |IA64_PSR_DI)
-#endif
-	;;
-	mov cr.ipsr=r16
-	movl r17=1f
-	;;
-	mov cr.iip=r17
-	mov cr.ifs=r0
-	;;
-	rfi
-	;;
-1:	// now we are in virtual mode
-
-	SET_AREA_FOR_BOOTING_CPU(r2, r16);
-
-	STORE_REGION_REGS(r16, r8,r9,r10,r11,r12,r13,r14,r15);
-	SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(r16,r17,r25)
-	;;
-
-	// set IVT entry point---can't access I/O ports without it
-	movl r3=ia64_ivt
-	;;
-	mov cr.iva=r3
-	movl r2=FPSR_DEFAULT
-	;;
-	srlz.i
-	movl gp=__gp
-	;;
-	mov ar.fpsr=r2
-	;;
-
-#define isAP	p2	// are we an Application Processor?
-#define isBP	p3	// are we the Bootstrap Processor?
-
-#ifdef XEN
-# define init_task	init_task_mem
-#endif
-
-#ifdef CONFIG_SMP
-	/*
-	 * Find the init_task for the currently booting CPU.  At poweron, and in
-	 * UP mode, task_for_booting_cpu is NULL.
-	 */
-	movl r3=task_for_booting_cpu
- 	;;
-	ld8 r3=[r3]
-	movl r2=init_task
-	;;
-	cmp.eq isBP,isAP=r3,r0
-	;;
-(isAP)	mov r2=r3
-#else
-	movl r2=init_task
-	cmp.eq isBP,isAP=r0,r0
-#endif
-	;;
-	tpa r3=r2		// r3 == phys addr of task struct
-	mov r16=-1
-#ifndef XEN
-(isBP)	br.cond.dpnt .load_current // BP stack is on region 5 --- no need to map it
-#endif
-
-	// load mapping for stack (virtaddr in r2, physaddr in r3)
-	rsm psr.ic
-	movl r17=PAGE_KERNEL
-	;;
-	srlz.d
-	dep r18=0,r3,0,12
-	;;
-	or r18=r17,r18
-#ifdef XEN
-	dep r2=-1,r3,60,4       // IMVA of task 
-#else
-	dep r2=-1,r3,61,3	// IMVA of task
-#endif
-	;;
-	mov r17=rr[r2]
-	shr.u r16=r3,IA64_GRANULE_SHIFT
-	;;
-	dep r17=0,r17,8,24
-	;;
-	mov cr.itir=r17
-	mov cr.ifa=r2
-
-	mov r19=IA64_TR_CURRENT_STACK
-	;;
-	itr.d dtr[r19]=r18
-	;;
-	ssm psr.ic
-	srlz.d
-  	;;
-	
-.load_current:
-	// load the "current" pointer (r13) and ar.k6 with the current task
-	mov IA64_KR(CURRENT)=r2		// virtual address
-	mov IA64_KR(CURRENT_STACK)=r16
-	mov r13=r2
-	/*
-	 * Reserve space at the top of the stack for "struct pt_regs".  Kernel
-	 * threads don't store interesting values in that structure, but the space
-	 * still needs to be there because time-critical stuff such as the context
-	 * switching can be implemented more efficiently (for example, __switch_to()
-	 * always sets the psr.dfh bit of the task it is switching to).
-	 */
-
-	addl r12=IA64_STK_OFFSET-IA64_PT_REGS_SIZE-16,r2
-	addl r2=IA64_RBS_OFFSET,r2	// initialize the RSE
-	mov ar.rsc=0		// place RSE in enforced lazy mode
-	;;
-	loadrs			// clear the dirty partition
-#ifdef XEN
-(isAP)	br.few 2f
-	movl r19=__phys_per_cpu_start
-	mov r18=PERCPU_PAGE_SIZE
-#ifndef CONFIG_SMP
-	add r19=r19,r18
-	;;
-#else
-	movl r20=__cpu0_per_cpu
-	;;
-	shr.u r18=r18,3
-1:
-	ld8 r21=[r19],8 ;;
-	st8[r20]=r21,8
-	adds r18=-1,r18
-	;;
-	cmp4.lt p7,p6=0,r18
-(p7)	br.cond.dptk.few 1b
-	;;
-#endif
-	movl r18=__per_cpu_offset
-	movl r19=__cpu0_per_cpu
-	movl r20=__per_cpu_start
-	;;
-	sub r20=r19,r20
-	;;
-	st8 [r18]=r20
-2:
-#endif
-	;;
-	mov ar.bspstore=r2	// establish the new RSE stack
-	;;
-	mov ar.rsc=0x3		// place RSE in eager mode
-
-#ifdef XEN
-(isBP)	dep r28=-1,r28,60,4	// make address virtual
-#else
-(isBP)	dep r28=-1,r28,61,3	// make address virtual
-#endif
-(isBP)	movl r2=ia64_boot_param
-	;;
-(isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
-
-#ifdef CONFIG_SMP
-(isAP)	br.call.sptk.many rp=start_secondary
-.ret0:
-(isAP)	br.cond.sptk self
-#endif
-
-	// This is executed by the bootstrap processor (bsp) only:
-
-#ifdef CONFIG_IA64_FW_EMU
-	// initialize PAL & SAL emulator:
-	br.call.sptk.many rp=sys_fw_init
-.ret1:
-#endif
-	br.call.sptk.many rp=start_kernel
-.ret2:	addl r3=@ltoff(halt_msg),gp
-	;;
-	alloc r2=ar.pfs,8,0,2,0
-	;;
-	ld8 out0=[r3]
-	br.call.sptk.many b0=console_print
-
-self:	hint @pause
-#ifdef XEN
-	;;
-	br.sptk.many self		// endless loop
-	;;
-#else
-	br.sptk.many self		// endless loop
-#endif
-END(_start)
-
-GLOBAL_ENTRY(ia64_save_debug_regs)
-	alloc r16=ar.pfs,1,0,0,0
-	mov r20=ar.lc			// preserve ar.lc
-	mov ar.lc=IA64_NUM_DBG_REGS-1
-	mov r18=0
-	add r19=IA64_NUM_DBG_REGS*8,in0
-	;;
-1:	mov r16=dbr[r18]
-#ifdef CONFIG_ITANIUM
-	;;
-	srlz.d
-#endif
-	mov r17=ibr[r18]
-	add r18=1,r18
-	;;
-	st8.nta [in0]=r16,8
-	st8.nta [r19]=r17,8
-	br.cloop.sptk.many 1b
-	;;
-	mov ar.lc=r20			// restore ar.lc
-	br.ret.sptk.many rp
-END(ia64_save_debug_regs)
-
-GLOBAL_ENTRY(ia64_load_debug_regs)
-	alloc r16=ar.pfs,1,0,0,0
-	lfetch.nta [in0]
-	mov r20=ar.lc			// preserve ar.lc
-	add r19=IA64_NUM_DBG_REGS*8,in0
-	mov ar.lc=IA64_NUM_DBG_REGS-1
-	mov r18=-1
-	;;
-1:	ld8.nta r16=[in0],8
-	ld8.nta r17=[r19],8
-	add r18=1,r18
-	;;
-	mov dbr[r18]=r16
-#ifdef CONFIG_ITANIUM
-	;;
-	srlz.d				// Errata 132 (NoFix status)
-#endif
-	mov ibr[r18]=r17
-	br.cloop.sptk.many 1b
-	;;
-	mov ar.lc=r20			// restore ar.lc
-	br.ret.sptk.many rp
-END(ia64_load_debug_regs)
-
-GLOBAL_ENTRY(__ia64_save_fpu)
-	alloc r2=ar.pfs,1,4,0,0
-	adds loc0=96*16-16,in0
-	adds loc1=96*16-16-128,in0
-	;;
-	stf.spill.nta [loc0]=f127,-256
-	stf.spill.nta [loc1]=f119,-256
-	;;
-	stf.spill.nta [loc0]=f111,-256
-	stf.spill.nta [loc1]=f103,-256
-	;;
-	stf.spill.nta [loc0]=f95,-256
-	stf.spill.nta [loc1]=f87,-256
-	;;
-	stf.spill.nta [loc0]=f79,-256
-	stf.spill.nta [loc1]=f71,-256
-	;;
-	stf.spill.nta [loc0]=f63,-256
-	stf.spill.nta [loc1]=f55,-256
-	adds loc2=96*16-32,in0
-	;;
-	stf.spill.nta [loc0]=f47,-256
-	stf.spill.nta [loc1]=f39,-256
-	adds loc3=96*16-32-128,in0
-	;;
-	stf.spill.nta [loc2]=f126,-256
-	stf.spill.nta [loc3]=f118,-256
-	;;
-	stf.spill.nta [loc2]=f110,-256
-	stf.spill.nta [loc3]=f102,-256
-	;;
-	stf.spill.nta [loc2]=f94,-256
-	stf.spill.nta [loc3]=f86,-256
-	;;
-	stf.spill.nta [loc2]=f78,-256
-	stf.spill.nta [loc3]=f70,-256
-	;;
-	stf.spill.nta [loc2]=f62,-256
-	stf.spill.nta [loc3]=f54,-256
-	adds loc0=96*16-48,in0
-	;;
-	stf.spill.nta [loc2]=f46,-256
-	stf.spill.nta [loc3]=f38,-256
-	adds loc1=96*16-48-128,in0
-	;;
-	stf.spill.nta [loc0]=f125,-256
-	stf.spill.nta [loc1]=f117,-256
-	;;
-	stf.spill.nta [loc0]=f109,-256
-	stf.spill.nta [loc1]=f101,-256
-	;;
-	stf.spill.nta [loc0]=f93,-256
-	stf.spill.nta [loc1]=f85,-256
-	;;
-	stf.spill.nta [loc0]=f77,-256
-	stf.spill.nta [loc1]=f69,-256
-	;;
-	stf.spill.nta [loc0]=f61,-256
-	stf.spill.nta [loc1]=f53,-256
-	adds loc2=96*16-64,in0
-	;;
-	stf.spill.nta [loc0]=f45,-256
-	stf.spill.nta [loc1]=f37,-256
-	adds loc3=96*16-64-128,in0
-	;;
-	stf.spill.nta [loc2]=f124,-256
-	stf.spill.nta [loc3]=f116,-256
-	;;
-	stf.spill.nta [loc2]=f108,-256
-	stf.spill.nta [loc3]=f100,-256
-	;;
-	stf.spill.nta [loc2]=f92,-256
-	stf.spill.nta [loc3]=f84,-256
-	;;
-	stf.spill.nta [loc2]=f76,-256
-	stf.spill.nta [loc3]=f68,-256
-	;;
-	stf.spill.nta [loc2]=f60,-256
-	stf.spill.nta [loc3]=f52,-256
-	adds loc0=96*16-80,in0
-	;;
-	stf.spill.nta [loc2]=f44,-256
-	stf.spill.nta [loc3]=f36,-256
-	adds loc1=96*16-80-128,in0
-	;;
-	stf.spill.nta [loc0]=f123,-256
-	stf.spill.nta [loc1]=f115,-256
-	;;
-	stf.spill.nta [loc0]=f107,-256
-	stf.spill.nta [loc1]=f99,-256
-	;;
-	stf.spill.nta [loc0]=f91,-256
-	stf.spill.nta [loc1]=f83,-256
-	;;
-	stf.spill.nta [loc0]=f75,-256
-	stf.spill.nta [loc1]=f67,-256
-	;;
-	stf.spill.nta [loc0]=f59,-256
-	stf.spill.nta [loc1]=f51,-256
-	adds loc2=96*16-96,in0
-	;;
-	stf.spill.nta [loc0]=f43,-256
-	stf.spill.nta [loc1]=f35,-256
-	adds loc3=96*16-96-128,in0
-	;;
-	stf.spill.nta [loc2]=f122,-256
-	stf.spill.nta [loc3]=f114,-256
-	;;
-	stf.spill.nta [loc2]=f106,-256
-	stf.spill.nta [loc3]=f98,-256
-	;;
-	stf.spill.nta [loc2]=f90,-256
-	stf.spill.nta [loc3]=f82,-256
-	;;
-	stf.spill.nta [loc2]=f74,-256
-	stf.spill.nta [loc3]=f66,-256
-	;;
-	stf.spill.nta [loc2]=f58,-256
-	stf.spill.nta [loc3]=f50,-256
-	adds loc0=96*16-112,in0
-	;;
-	stf.spill.nta [loc2]=f42,-256
-	stf.spill.nta [loc3]=f34,-256
-	adds loc1=96*16-112-128,in0
-	;;
-	stf.spill.nta [loc0]=f121,-256
-	stf.spill.nta [loc1]=f113,-256
-	;;
-	stf.spill.nta [loc0]=f105,-256
-	stf.spill.nta [loc1]=f97,-256
-	;;
-	stf.spill.nta [loc0]=f89,-256
-	stf.spill.nta [loc1]=f81,-256
-	;;
-	stf.spill.nta [loc0]=f73,-256
-	stf.spill.nta [loc1]=f65,-256
-	;;
-	stf.spill.nta [loc0]=f57,-256
-	stf.spill.nta [loc1]=f49,-256
-	adds loc2=96*16-128,in0
-	;;
-	stf.spill.nta [loc0]=f41,-256
-	stf.spill.nta [loc1]=f33,-256
-	adds loc3=96*16-128-128,in0
-	;;
-	stf.spill.nta [loc2]=f120,-256
-	stf.spill.nta [loc3]=f112,-256
-	;;
-	stf.spill.nta [loc2]=f104,-256
-	stf.spill.nta [loc3]=f96,-256
-	;;
-	stf.spill.nta [loc2]=f88,-256
-	stf.spill.nta [loc3]=f80,-256
-	;;
-	stf.spill.nta [loc2]=f72,-256
-	stf.spill.nta [loc3]=f64,-256
-	;;
-	stf.spill.nta [loc2]=f56,-256
-	stf.spill.nta [loc3]=f48,-256
-	;;
-	stf.spill.nta [loc2]=f40
-	stf.spill.nta [loc3]=f32
-	br.ret.sptk.many rp
-END(__ia64_save_fpu)
-
-GLOBAL_ENTRY(__ia64_load_fpu)
-	alloc r2=ar.pfs,1,2,0,0
-	adds r3=128,in0
-	adds r14=256,in0
-	adds r15=384,in0
-	mov loc0=512
-	mov loc1=-1024+16
-	;;
-	ldf.fill.nta f32=[in0],loc0
-	ldf.fill.nta f40=[ r3],loc0
-	ldf.fill.nta f48=[r14],loc0
-	ldf.fill.nta f56=[r15],loc0
-	;;
-	ldf.fill.nta f64=[in0],loc0
-	ldf.fill.nta f72=[ r3],loc0
-	ldf.fill.nta f80=[r14],loc0
-	ldf.fill.nta f88=[r15],loc0
-	;;
-	ldf.fill.nta f96=[in0],loc1
-	ldf.fill.nta f104=[ r3],loc1
-	ldf.fill.nta f112=[r14],loc1
-	ldf.fill.nta f120=[r15],loc1
-	;;
-	ldf.fill.nta f33=[in0],loc0
-	ldf.fill.nta f41=[ r3],loc0
-	ldf.fill.nta f49=[r14],loc0
-	ldf.fill.nta f57=[r15],loc0
-	;;
-	ldf.fill.nta f65=[in0],loc0
-	ldf.fill.nta f73=[ r3],loc0
-	ldf.fill.nta f81=[r14],loc0
-	ldf.fill.nta f89=[r15],loc0
-	;;
-	ldf.fill.nta f97=[in0],loc1
-	ldf.fill.nta f105=[ r3],loc1
-	ldf.fill.nta f113=[r14],loc1
-	ldf.fill.nta f121=[r15],loc1
-	;;
-	ldf.fill.nta f34=[in0],loc0
-	ldf.fill.nta f42=[ r3],loc0
-	ldf.fill.nta f50=[r14],loc0
-	ldf.fill.nta f58=[r15],loc0
-	;;
-	ldf.fill.nta f66=[in0],loc0
-	ldf.fill.nta f74=[ r3],loc0
-	ldf.fill.nta f82=[r14],loc0
-	ldf.fill.nta f90=[r15],loc0
-	;;
-	ldf.fill.nta f98=[in0],loc1
-	ldf.fill.nta f106=[ r3],loc1
-	ldf.fill.nta f114=[r14],loc1
-	ldf.fill.nta f122=[r15],loc1
-	;;
-	ldf.fill.nta f35=[in0],loc0
-	ldf.fill.nta f43=[ r3],loc0
-	ldf.fill.nta f51=[r14],loc0
-	ldf.fill.nta f59=[r15],loc0
-	;;
-	ldf.fill.nta f67=[in0],loc0
-	ldf.fill.nta f75=[ r3],loc0
-	ldf.fill.nta f83=[r14],loc0
-	ldf.fill.nta f91=[r15],loc0
-	;;
-	ldf.fill.nta f99=[in0],loc1
-	ldf.fill.nta f107=[ r3],loc1
-	ldf.fill.nta f115=[r14],loc1
-	ldf.fill.nta f123=[r15],loc1
-	;;
-	ldf.fill.nta f36=[in0],loc0
-	ldf.fill.nta f44=[ r3],loc0
-	ldf.fill.nta f52=[r14],loc0
-	ldf.fill.nta f60=[r15],loc0
-	;;
-	ldf.fill.nta f68=[in0],loc0
-	ldf.fill.nta f76=[ r3],loc0
-	ldf.fill.nta f84=[r14],loc0
-	ldf.fill.nta f92=[r15],loc0
-	;;
-	ldf.fill.nta f100=[in0],loc1
-	ldf.fill.nta f108=[ r3],loc1
-	ldf.fill.nta f116=[r14],loc1
-	ldf.fill.nta f124=[r15],loc1
-	;;
-	ldf.fill.nta f37=[in0],loc0
-	ldf.fill.nta f45=[ r3],loc0
-	ldf.fill.nta f53=[r14],loc0
-	ldf.fill.nta f61=[r15],loc0
-	;;
-	ldf.fill.nta f69=[in0],loc0
-	ldf.fill.nta f77=[ r3],loc0
-	ldf.fill.nta f85=[r14],loc0
-	ldf.fill.nta f93=[r15],loc0
-	;;
-	ldf.fill.nta f101=[in0],loc1
-	ldf.fill.nta f109=[ r3],loc1
-	ldf.fill.nta f117=[r14],loc1
-	ldf.fill.nta f125=[r15],loc1
-	;;
-	ldf.fill.nta f38 =[in0],loc0
-	ldf.fill.nta f46 =[ r3],loc0
-	ldf.fill.nta f54 =[r14],loc0
-	ldf.fill.nta f62 =[r15],loc0
-	;;
-	ldf.fill.nta f70 =[in0],loc0
-	ldf.fill.nta f78 =[ r3],loc0
-	ldf.fill.nta f86 =[r14],loc0
-	ldf.fill.nta f94 =[r15],loc0
-	;;
-	ldf.fill.nta f102=[in0],loc1
-	ldf.fill.nta f110=[ r3],loc1
-	ldf.fill.nta f118=[r14],loc1
-	ldf.fill.nta f126=[r15],loc1
-	;;
-	ldf.fill.nta f39 =[in0],loc0
-	ldf.fill.nta f47 =[ r3],loc0
-	ldf.fill.nta f55 =[r14],loc0
-	ldf.fill.nta f63 =[r15],loc0
-	;;
-	ldf.fill.nta f71 =[in0],loc0
-	ldf.fill.nta f79 =[ r3],loc0
-	ldf.fill.nta f87 =[r14],loc0
-	ldf.fill.nta f95 =[r15],loc0
-	;;
-	ldf.fill.nta f103=[in0]
-	ldf.fill.nta f111=[ r3]
-	ldf.fill.nta f119=[r14]
-	ldf.fill.nta f127=[r15]
-	br.ret.sptk.many rp
-END(__ia64_load_fpu)
-
-GLOBAL_ENTRY(__ia64_init_fpu)
-	stf.spill [sp]=f0		// M3
-	mov	 f32=f0			// F
-	nop.b	 0
-
-	ldfps	 f33,f34=[sp]		// M0
-	ldfps	 f35,f36=[sp]		// M1
-	mov      f37=f0			// F
-	;;
-
-	setf.s	 f38=r0			// M2
-	setf.s	 f39=r0			// M3
-	mov      f40=f0			// F
-
-	ldfps	 f41,f42=[sp]		// M0
-	ldfps	 f43,f44=[sp]		// M1
-	mov      f45=f0			// F
-
-	setf.s	 f46=r0			// M2
-	setf.s	 f47=r0			// M3
-	mov      f48=f0			// F
-
-	ldfps	 f49,f50=[sp]		// M0
-	ldfps	 f51,f52=[sp]		// M1
-	mov      f53=f0			// F
-
-	setf.s	 f54=r0			// M2
-	setf.s	 f55=r0			// M3
-	mov      f56=f0			// F
-
-	ldfps	 f57,f58=[sp]		// M0
-	ldfps	 f59,f60=[sp]		// M1
-	mov      f61=f0			// F
-
-	setf.s	 f62=r0			// M2
-	setf.s	 f63=r0			// M3
-	mov      f64=f0			// F
-
-	ldfps	 f65,f66=[sp]		// M0
-	ldfps	 f67,f68=[sp]		// M1
-	mov      f69=f0			// F
-
-	setf.s	 f70=r0			// M2
-	setf.s	 f71=r0			// M3
-	mov      f72=f0			// F
-
-	ldfps	 f73,f74=[sp]		// M0
-	ldfps	 f75,f76=[sp]		// M1
-	mov      f77=f0			// F
-
-	setf.s	 f78=r0			// M2
-	setf.s	 f79=r0			// M3
-	mov      f80=f0			// F
-
-	ldfps	 f81,f82=[sp]		// M0
-	ldfps	 f83,f84=[sp]		// M1
-	mov      f85=f0			// F
-
-	setf.s	 f86=r0			// M2
-	setf.s	 f87=r0			// M3
-	mov      f88=f0			// F
-
-	/*
-	 * When the instructions are cached, it would be faster to initialize
-	 * the remaining registers with simply mov instructions (F-unit).
-	 * This gets the time down to ~29 cycles.  However, this would use up
-	 * 33 bundles, whereas continuing with the above pattern yields
-	 * 10 bundles and ~30 cycles.
-	 */
-
-	ldfps	 f89,f90=[sp]		// M0
-	ldfps	 f91,f92=[sp]		// M1
-	mov      f93=f0			// F
-
-	setf.s	 f94=r0			// M2
-	setf.s	 f95=r0			// M3
-	mov      f96=f0			// F
-
-	ldfps	 f97,f98=[sp]		// M0
-	ldfps	 f99,f100=[sp]		// M1
-	mov      f101=f0		// F
-
-	setf.s	 f102=r0		// M2
-	setf.s	 f103=r0		// M3
-	mov      f104=f0		// F
-
-	ldfps	 f105,f106=[sp]		// M0
-	ldfps	 f107,f108=[sp]		// M1
-	mov      f109=f0		// F
-
-	setf.s	 f110=r0		// M2
-	setf.s	 f111=r0		// M3
-	mov      f112=f0		// F
-
-	ldfps	 f113,f114=[sp]		// M0
-	ldfps	 f115,f116=[sp]		// M1
-	mov      f117=f0		// F
-
-	setf.s	 f118=r0		// M2
-	setf.s	 f119=r0		// M3
-	mov      f120=f0		// F
-
-	ldfps	 f121,f122=[sp]		// M0
-	ldfps	 f123,f124=[sp]		// M1
-	mov      f125=f0		// F
-
-	setf.s	 f126=r0		// M2
-	setf.s	 f127=r0		// M3
-	br.ret.sptk.many rp		// F
-END(__ia64_init_fpu)
-
-/*
- * Switch execution mode from virtual to physical
- *
- * Inputs:
- *	r16 = new psr to establish
- * Output:
- *	r19 = old virtual address of ar.bsp
- *	r20 = old virtual address of sp
- *
- * Note: RSE must already be in enforced lazy mode
- */
-GLOBAL_ENTRY(ia64_switch_mode_phys)
- {
-	alloc r2=ar.pfs,0,0,0,0
-	rsm psr.i | psr.ic		// disable interrupts and interrupt collection
-	mov r15=ip
- }
-	;;
- {
-	flushrs				// must be first insn in group
-	srlz.i
- }
-	;;
-	mov cr.ipsr=r16			// set new PSR
-	add r3=1f-ia64_switch_mode_phys,r15
-
-	mov r19=ar.bsp
-	mov r20=sp
-	mov r14=rp			// get return address into a general register
-	;;
-
-	// going to physical mode, use tpa to translate virt->phys
-	tpa r17=r19
-	tpa r3=r3
-	tpa sp=sp
-	tpa r14=r14
-	;;
-
-	mov r18=ar.rnat			// save ar.rnat
-	mov ar.bspstore=r17		// this steps on ar.rnat
-	mov cr.iip=r3
-	mov cr.ifs=r0
-	;;
-	mov ar.rnat=r18			// restore ar.rnat
-	rfi				// must be last insn in group
-	;;
-1:	mov rp=r14
-	br.ret.sptk.many rp
-END(ia64_switch_mode_phys)
-
-/*
- * Switch execution mode from physical to virtual
- *
- * Inputs:
- *	r16 = new psr to establish
- *	r19 = new bspstore to establish
- *	r20 = new sp to establish
- *
- * Note: RSE must already be in enforced lazy mode
- */
-GLOBAL_ENTRY(ia64_switch_mode_virt)
- {
-	alloc r2=ar.pfs,0,0,0,0
-	rsm psr.i | psr.ic		// disable interrupts and interrupt collection
-	mov r15=ip
- }
-	;;
- {
-	flushrs				// must be first insn in group
-	srlz.i
- }
-	;;
-	mov cr.ipsr=r16			// set new PSR
-	add r3=1f-ia64_switch_mode_virt,r15
-
-	mov r14=rp			// get return address into a general register
-	;;
-
-	// going to virtual
-	//   - for code addresses, set upper bits of addr to KERNEL_START
-	//   - for stack addresses, copy from input argument
-	movl r18=KERNEL_START
-	dep r3=0,r3,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
-	dep r14=0,r14,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
-	mov sp=r20
-	;;
-	or r3=r3,r18
-	or r14=r14,r18
-	;;
-
-	mov r18=ar.rnat			// save ar.rnat
-	mov ar.bspstore=r19		// this steps on ar.rnat
-	mov cr.iip=r3
-	mov cr.ifs=r0
-	;;
-	mov ar.rnat=r18			// restore ar.rnat
-	rfi				// must be last insn in group
-	;;
-1:	mov rp=r14
-	br.ret.sptk.many rp
-END(ia64_switch_mode_virt)
-
-GLOBAL_ENTRY(ia64_delay_loop)
-	.prologue
-{	nop 0			// work around GAS unwind info generation bug...
-	.save ar.lc,r2
-	mov r2=ar.lc
-	.body
-	;;
-	mov ar.lc=r32
-}
-	;;
-	// force loop to be 32-byte aligned (GAS bug means we cannot use .align
-	// inside function body without corrupting unwind info).
-{	nop 0 }
-1:	br.cloop.sptk.few 1b
-	;;
-	mov ar.lc=r2
-	br.ret.sptk.many rp
-END(ia64_delay_loop)
-
-#ifndef XEN
-/*
- * Return a CPU-local timestamp in nano-seconds.  This timestamp is
- * NOT synchronized across CPUs its return value must never be
- * compared against the values returned on another CPU.  The usage in
- * kernel/sched.c ensures that.
- *
- * The return-value of sched_clock() is NOT supposed to wrap-around.
- * If it did, it would cause some scheduling hiccups (at the worst).
- * Fortunately, with a 64-bit cycle-counter ticking at 100GHz, even
- * that would happen only once every 5+ years.
- *
- * The code below basically calculates:
- *
- *   (ia64_get_itc() * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT
- *
- * except that the multiplication and the shift are done with 128-bit
- * intermediate precision so that we can produce a full 64-bit result.
- */
-GLOBAL_ENTRY(sched_clock)
-#ifdef XEN
-	movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
-#else
-	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
-#endif
-	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
-	;;
-	ldf8 f8=[r8]
-	;;
-	setf.sig f9=r9		// certain to stall, so issue it _after_ ldf8...
-	;;
-	xmpy.lu f10=f9,f8	// calculate low 64 bits of 128-bit product	(4 cyc)
-	xmpy.hu f11=f9,f8	// calculate high 64 bits of 128-bit product
-	;;
-	getf.sig r8=f10		//						(5 cyc)
-	getf.sig r9=f11
-	;;
-	shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
-	br.ret.sptk.many rp
-END(sched_clock)
-
-GLOBAL_ENTRY(start_kernel_thread)
-	.prologue
-	.save rp, r0				// this is the end of the call-chain
-	.body
-	alloc r2 = ar.pfs, 0, 0, 2, 0
-	mov out0 = r9
-	mov out1 = r11;;
-	br.call.sptk.many rp = kernel_thread_helper;;
-	mov out0 = r8
-	br.call.sptk.many rp = sys_exit;;
-1:	br.sptk.few 1b				// not reached
-END(start_kernel_thread)
-#endif /* XEN */
-
-#ifdef CONFIG_IA64_BRL_EMU
-
-/*
- *  Assembly routines used by brl_emu.c to set preserved register state.
- */
-
-#define SET_REG(reg)				\
- GLOBAL_ENTRY(ia64_set_##reg);			\
-	alloc r16=ar.pfs,1,0,0,0;		\
-	mov reg=r32;				\
-	;;					\
-	br.ret.sptk.many rp;			\
- END(ia64_set_##reg)
-
-SET_REG(b1);
-SET_REG(b2);
-SET_REG(b3);
-SET_REG(b4);
-SET_REG(b5);
-
-#endif /* CONFIG_IA64_BRL_EMU */
-
-#ifdef CONFIG_SMP
-	/*
-	 * This routine handles spinlock contention.  It uses a non-standard calling
-	 * convention to avoid converting leaf routines into interior routines.  Because
-	 * of this special convention, there are several restrictions:
-	 *
-	 * - do not use gp relative variables, this code is called from the kernel
-	 *   and from modules, r1 is undefined.
-	 * - do not use stacked registers, the caller owns them.
-	 * - do not use the scratch stack space, the caller owns it.
-	 * - do not use any registers other than the ones listed below
-	 *
-	 * Inputs:
-	 *   ar.pfs - saved CFM of caller
-	 *   ar.ccv - 0 (and available for use)
-	 *   r27    - flags from spin_lock_irqsave or 0.  Must be preserved.
-	 *   r28    - available for use.
-	 *   r29    - available for use.
-	 *   r30    - available for use.
-	 *   r31    - address of lock, available for use.
-	 *   b6     - return address
-	 *   p14    - available for use.
-	 *   p15    - used to track flag status.
-	 *
-	 * If you patch this code to use more registers, do not forget to update
-	 * the clobber lists for spin_lock() in include/asm-ia64/spinlock.h.
-	 */
-
-#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
-
-GLOBAL_ENTRY(ia64_spinlock_contention_pre3_4)
-	.prologue
-	.save ar.pfs, r0	// this code effectively has a zero frame size
-	.save rp, r28
-	.body
-	nop 0
-	tbit.nz p15,p0=r27,IA64_PSR_I_BIT
-	.restore sp		// pop existing prologue after next insn
-	mov b6 = r28
-	.prologue
-	.save ar.pfs, r0
-	.altrp b6
-	.body
-	;;
-(p15)	ssm psr.i		// reenable interrupts if they were on
-				// DavidM says that srlz.d is slow and is not required in this case
-.wait:
-	// exponential backoff, kdb, lockmeter etc. go in here
-	hint @pause
-	ld4 r30=[r31]		// don't use ld4.bias; if it's contended, we won't write the word
-	nop 0
-	;;
-	cmp4.ne p14,p0=r30,r0
-(p14)	br.cond.sptk.few .wait
-(p15)	rsm psr.i		// disable interrupts if we reenabled them
-	br.cond.sptk.few b6	// lock is now free, try to acquire
-	.global ia64_spinlock_contention_pre3_4_end	// for kernprof
-ia64_spinlock_contention_pre3_4_end:
-END(ia64_spinlock_contention_pre3_4)
-
-#else
-
-GLOBAL_ENTRY(ia64_spinlock_contention)
-	.prologue
-	.altrp b6
-	.body
-	tbit.nz p15,p0=r27,IA64_PSR_I_BIT
-	;;
-.wait:
-(p15)	ssm psr.i		// reenable interrupts if they were on
-				// DavidM says that srlz.d is slow and is not required in this case
-.wait2:
-	// exponential backoff, kdb, lockmeter etc. go in here
-	hint @pause
-	ld4 r30=[r31]		// don't use ld4.bias; if it's contended, we won't write the word
-	;;
-	cmp4.ne p14,p0=r30,r0
-	mov r30 = 1
-(p14)	br.cond.sptk.few .wait2
-(p15)	rsm psr.i		// disable interrupts if we reenabled them
-	;;
-	cmpxchg4.acq r30=[r31], r30, ar.ccv
-	;;
-	cmp4.ne p14,p0=r0,r30
-(p14)	br.cond.sptk.few .wait
-
-	br.ret.sptk.many b6	// lock is now taken
-END(ia64_spinlock_contention)
-
-#endif
-
-#ifdef CONFIG_HOTPLUG_CPU
-GLOBAL_ENTRY(ia64_jump_to_sal)
-	alloc r16=ar.pfs,1,0,0,0;;
-	rsm psr.i  | psr.ic
-{
-	flushrs
-	srlz.i
-}
-	tpa r25=in0
-	movl r18=tlb_purge_done;;
-	DATA_VA_TO_PA(r18);;
-	mov b1=r18 	// Return location
-	movl r18=ia64_do_tlb_purge;;
-	DATA_VA_TO_PA(r18);;
-	mov b2=r18 	// doing tlb_flush work
-	mov ar.rsc=0  // Put RSE  in enforced lazy, LE mode
-	movl r17=1f;;
-	DATA_VA_TO_PA(r17);;
-	mov cr.iip=r17
-	movl r16=SAL_PSR_BITS_TO_SET;;
-	mov cr.ipsr=r16
-	mov cr.ifs=r0;;
-	rfi;;
-1:
-	/*
-	 * Invalidate all TLB data/inst
-	 */
-	br.sptk.many b2;; // jump to tlb purge code
-
-tlb_purge_done:
-	RESTORE_REGION_REGS(r25, r17,r18,r19);;
-	RESTORE_REG(b0, r25, r17);;
-	RESTORE_REG(b1, r25, r17);;
-	RESTORE_REG(b2, r25, r17);;
-	RESTORE_REG(b3, r25, r17);;
-	RESTORE_REG(b4, r25, r17);;
-	RESTORE_REG(b5, r25, r17);;
-	ld8 r1=[r25],0x08;;
-	ld8 r12=[r25],0x08;;
-	ld8 r13=[r25],0x08;;
-	RESTORE_REG(ar.fpsr, r25, r17);;
-	RESTORE_REG(ar.pfs, r25, r17);;
-	RESTORE_REG(ar.rnat, r25, r17);;
-	RESTORE_REG(ar.unat, r25, r17);;
-	RESTORE_REG(ar.bspstore, r25, r17);;
-	RESTORE_REG(cr.dcr, r25, r17);;
-	RESTORE_REG(cr.iva, r25, r17);;
-	RESTORE_REG(cr.pta, r25, r17);;
-#ifdef XEN
-	dv_serialize_instruction
-#endif
-	RESTORE_REG(cr.itv, r25, r17);;
-	RESTORE_REG(cr.pmv, r25, r17);;
-	RESTORE_REG(cr.cmcv, r25, r17);;
-	RESTORE_REG(cr.lrr0, r25, r17);;
-	RESTORE_REG(cr.lrr1, r25, r17);;
-	ld8 r4=[r25],0x08;;
-	ld8 r5=[r25],0x08;;
-	ld8 r6=[r25],0x08;;
-	ld8 r7=[r25],0x08;;
-	ld8 r17=[r25],0x08;;
-	mov pr=r17,-1;;
-	RESTORE_REG(ar.lc, r25, r17);;
-	/*
-	 * Now Restore floating point regs
-	 */
-	ldf.fill.nta f2=[r25],16;;
-	ldf.fill.nta f3=[r25],16;;
-	ldf.fill.nta f4=[r25],16;;
-	ldf.fill.nta f5=[r25],16;;
-	ldf.fill.nta f16=[r25],16;;
-	ldf.fill.nta f17=[r25],16;;
-	ldf.fill.nta f18=[r25],16;;
-	ldf.fill.nta f19=[r25],16;;
-	ldf.fill.nta f20=[r25],16;;
-	ldf.fill.nta f21=[r25],16;;
-	ldf.fill.nta f22=[r25],16;;
-	ldf.fill.nta f23=[r25],16;;
-	ldf.fill.nta f24=[r25],16;;
-	ldf.fill.nta f25=[r25],16;;
-	ldf.fill.nta f26=[r25],16;;
-	ldf.fill.nta f27=[r25],16;;
-	ldf.fill.nta f28=[r25],16;;
-	ldf.fill.nta f29=[r25],16;;
-	ldf.fill.nta f30=[r25],16;;
-	ldf.fill.nta f31=[r25],16;;
-
-	/*
-	 * Now that we have done all the register restores
-	 * we are now ready for the big DIVE to SAL Land
-	 */
-	ssm psr.ic;;
-	srlz.d;;
-	br.ret.sptk.many b0;;
-END(ia64_jump_to_sal)
-#endif /* CONFIG_HOTPLUG_CPU */
-
-#endif /* CONFIG_SMP */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/hpsim_ssc.h
--- a/xen/arch/ia64/linux-xen/hpsim_ssc.h	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Platform dependent support for HP simulator.
- *
- * Copyright (C) 1998, 1999 Hewlett-Packard Co
- * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999 Vijay Chander <vijay@engr.sgi.com>
- */
-#ifndef _IA64_PLATFORM_HPSIM_SSC_H
-#define _IA64_PLATFORM_HPSIM_SSC_H
-
-/* Simulator system calls: */
-
-#define SSC_CONSOLE_INIT		20
-#define SSC_GETCHAR			21
-#define SSC_PUTCHAR			31
-#define SSC_CONNECT_INTERRUPT		58
-#define SSC_GENERATE_INTERRUPT		59
-#define SSC_SET_PERIODIC_INTERRUPT	60
-#define SSC_GET_RTC			65
-#define SSC_EXIT			66
-#define SSC_LOAD_SYMBOLS		69
-#define SSC_GET_TOD			74
-#define SSC_CTL_TRACE			76
-
-#define SSC_NETDEV_PROBE		100
-#define SSC_NETDEV_SEND			101
-#define SSC_NETDEV_RECV			102
-#define SSC_NETDEV_ATTACH		103
-#define SSC_NETDEV_DETACH		104
-
-/*
- * Simulator system call.
- */
-extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr);
-
-#ifdef XEN
-/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong
- * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */
-#define SSC_OPEN			50
-#define SSC_CLOSE			51
-#define SSC_READ			52
-#define SSC_WRITE			53
-#define SSC_GET_COMPLETION		54
-#define SSC_WAIT_COMPLETION		55
-
-#define SSC_WRITE_ACCESS		2
-#define SSC_READ_ACCESS			1
-
-struct ssc_disk_req {
-	unsigned long addr;
-	unsigned long len;
-};
-#endif
-
-#endif /* _IA64_PLATFORM_HPSIM_SSC_H */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1288 +0,0 @@
-/*
- * I/O SAPIC support.
- *
- * Copyright (C) 1999 Intel Corp.
- * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
- * Copyright (C) 2000-2002 J.I. Lee <jung-ik.lee@intel.com>
- * Copyright (C) 1999-2000, 2002-2003 Hewlett-Packard Co.
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999,2000 Walt Drummond <drummond@valinux.com>
- *
- * 00/04/19	D. Mosberger	Rewritten to mirror more closely the x86 I/O APIC code.
- *				In particular, we now have separate handlers for edge
- *				and level triggered interrupts.
- * 00/10/27	Asit Mallick, Goutham Rao <goutham.rao@intel.com> IRQ vector allocation
- *				PCI to vector mapping, shared PCI interrupts.
- * 00/10/27	D. Mosberger	Document things a bit more to make them more understandable.
- *				Clean up much of the old IOSAPIC cruft.
- * 01/07/27	J.I. Lee	PCI irq routing, Platform/Legacy interrupts and fixes for
- *				ACPI S5(SoftOff) support.
- * 02/01/23	J.I. Lee	iosapic pgm fixes for PCI irq routing from _PRT
- * 02/01/07     E. Focht        <efocht@ess.nec.de> Redirectable interrupt vectors in
- *                              iosapic_set_affinity(), initializations for
- *                              /proc/irq/#/smp_affinity
- * 02/04/02	P. Diefenbaugh	Cleaned up ACPI PCI IRQ routing.
- * 02/04/18	J.I. Lee	bug fix in iosapic_init_pci_irq
- * 02/04/30	J.I. Lee	bug fix in find_iosapic to fix ACPI PCI IRQ to IOSAPIC mapping
- *				error
- * 02/07/29	T. Kochi	Allocate interrupt vectors dynamically
- * 02/08/04	T. Kochi	Cleaned up terminology (irq, global system interrupt, vector, etc.)
- * 02/09/20	D. Mosberger	Simplified by taking advantage of ACPI's pci_irq code.
- * 03/02/19	B. Helgaas	Make pcat_compat system-wide, not per-IOSAPIC.
- *				Remove iosapic_address & gsi_base from external interfaces.
- *				Rationalize __init/__devinit attributes.
- * 04/12/04 Ashok Raj	<ashok.raj@intel.com> Intel Corporation 2004
- *				Updated to work with irq migration necessary for CPU Hotplug
- */
-/*
- * Here is what the interrupt logic between a PCI device and the kernel looks like:
- *
- * (1) A PCI device raises one of the four interrupt pins (INTA, INTB, INTC, INTD).  The
- *     device is uniquely identified by its bus--, and slot-number (the function
- *     number does not matter here because all functions share the same interrupt
- *     lines).
- *
- * (2) The motherboard routes the interrupt line to a pin on a IOSAPIC controller.
- *     Multiple interrupt lines may have to share the same IOSAPIC pin (if they're level
- *     triggered and use the same polarity).  Each interrupt line has a unique Global
- *     System Interrupt (GSI) number which can be calculated as the sum of the controller's
- *     base GSI number and the IOSAPIC pin number to which the line connects.
- *
- * (3) The IOSAPIC uses an internal routing table entries (RTEs) to map the IOSAPIC pin
- *     into the IA-64 interrupt vector.  This interrupt vector is then sent to the CPU.
- *
- * (4) The kernel recognizes an interrupt as an IRQ.  The IRQ interface is used as
- *     architecture-independent interrupt handling mechanism in Linux.  As an
- *     IRQ is a number, we have to have IA-64 interrupt vector number <-> IRQ number
- *     mapping.  On smaller systems, we use one-to-one mapping between IA-64 vector and
- *     IRQ.  A platform can implement platform_irq_to_vector(irq) and
- *     platform_local_vector_to_irq(vector) APIs to differentiate the mapping.
- *     Please see also include/asm-ia64/hw_irq.h for those APIs.
- *
- * To sum up, there are three levels of mappings involved:
- *
- *	PCI pin -> global system interrupt (GSI) -> IA-64 vector <-> IRQ
- *
- * Note: The term "IRQ" is loosely used everywhere in Linux kernel to describe interrupts.
- * Now we use "IRQ" only for Linux IRQ's.  ISA IRQ (isa_irq) is the only exception in this
- * source code.
- */
-#include <linux/config.h>
-
-#include <linux/acpi.h>
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/pci.h>
-#ifdef XEN
-#include <xen/errno.h>
-#endif
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/string.h>
-#include <linux/bootmem.h>
-
-#include <asm/delay.h>
-#include <asm/hw_irq.h>
-#include <asm/io.h>
-#include <asm/iosapic.h>
-#include <asm/machvec.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <asm/system.h>
-
-#ifdef XEN
-static inline int iosapic_irq_to_vector (int irq)
-{
-	return irq;
-}
-
-#undef irq_to_vector
-#define irq_to_vector(irq)      iosapic_irq_to_vector(irq)
-#define AUTO_ASSIGN	AUTO_ASSIGN_IRQ
-#endif
-
-#undef DEBUG_INTERRUPT_ROUTING
-
-#ifdef DEBUG_INTERRUPT_ROUTING
-#define DBG(fmt...)	printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-#define NR_PREALLOCATE_RTE_ENTRIES	(PAGE_SIZE / sizeof(struct iosapic_rte_info))
-#define RTE_PREALLOCATED	(1)
-
-static DEFINE_SPINLOCK(iosapic_lock);
-
-/* These tables map IA-64 vectors to the IOSAPIC pin that generates this vector. */
-
-struct iosapic_rte_info {
-	struct list_head rte_list;	/* node in list of RTEs sharing the same vector */
-	char __iomem	*addr;		/* base address of IOSAPIC */
-	unsigned int	gsi_base;	/* first GSI assigned to this IOSAPIC */
-	char		rte_index;	/* IOSAPIC RTE index */
-	int		refcnt;		/* reference counter */
-	unsigned int	flags;		/* flags */
-} ____cacheline_aligned;
-
-static struct iosapic_intr_info {
-	struct list_head rtes;		/* RTEs using this vector (empty => not an IOSAPIC interrupt) */
-	int		count;		/* # of RTEs that shares this vector */
-	u32		low32;		/* current value of low word of Redirection table entry */
-	unsigned int	dest;		/* destination CPU physical ID */
-	unsigned char	dmode	: 3;	/* delivery mode (see iosapic.h) */
-	unsigned char 	polarity: 1;	/* interrupt polarity (see iosapic.h) */
-	unsigned char	trigger	: 1;	/* trigger mode (see iosapic.h) */
-} iosapic_intr_info[IA64_NUM_VECTORS];
-
-#ifndef XEN
-static struct iosapic {
-	char __iomem	*addr;		/* base address of IOSAPIC */
-	unsigned int 	gsi_base;	/* first GSI assigned to this IOSAPIC */
-	unsigned short 	num_rte;	/* number of RTE in this IOSAPIC */
-	int		rtes_inuse;	/* # of RTEs in use on this IOSAPIC */
-#ifdef CONFIG_NUMA
-	unsigned short	node;		/* numa node association via pxm */
-#endif
-} iosapic_lists[NR_IOSAPICS];
-#else
-struct iosapic iosapic_lists[NR_IOSAPICS];
-#endif
-
-static unsigned char pcat_compat __devinitdata;	/* 8259 compatibility flag */
-
-static int iosapic_kmalloc_ok;
-static LIST_HEAD(free_rte_list);
-
-/*
- * Find an IOSAPIC associated with a GSI
- */
-static inline int
-find_iosapic (unsigned int gsi)
-{
-	int i;
-
-	for (i = 0; i < NR_IOSAPICS; i++) {
-		if ((unsigned) (gsi - iosapic_lists[i].gsi_base) < iosapic_lists[i].num_rte)
-			return i;
-	}
-
-	return -1;
-}
-
-static inline int
-_gsi_to_vector (unsigned int gsi)
-{
-	struct iosapic_intr_info *info;
-	struct iosapic_rte_info *rte;
-
-	for (info = iosapic_intr_info; info < iosapic_intr_info + IA64_NUM_VECTORS; ++info)
-		list_for_each_entry(rte, &info->rtes, rte_list)
-			if (rte->gsi_base + rte->rte_index == gsi)
-				return info - iosapic_intr_info;
-	return -1;
-}
-
-/*
- * Translate GSI number to the corresponding IA-64 interrupt vector.  If no
- * entry exists, return -1.
- */
-inline int
-gsi_to_vector (unsigned int gsi)
-{
-	return _gsi_to_vector(gsi);
-}
-
-int
-gsi_to_irq (unsigned int gsi)
-{
-	unsigned long flags;
-	int irq;
-	/*
-	 * XXX fix me: this assumes an identity mapping vetween IA-64 vector and Linux irq
-	 * numbers...
-	 */
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		irq = _gsi_to_vector(gsi);
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	return irq;
-}
-
-static struct iosapic_rte_info *gsi_vector_to_rte(unsigned int gsi, unsigned int vec)
-{
-	struct iosapic_rte_info *rte;
-
-	list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list)
-		if (rte->gsi_base + rte->rte_index == gsi)
-			return rte;
-	return NULL;
-}
-
-static void
-set_rte (unsigned int gsi, unsigned int vector, unsigned int dest, int mask)
-{
-	unsigned long pol, trigger, dmode;
-	u32 low32, high32;
-	char __iomem *addr;
-	int rte_index;
-	char redir;
-	struct iosapic_rte_info *rte;
-
-	DBG(KERN_DEBUG"IOSAPIC: routing vector %d to 0x%x\n", vector, dest);
-
-	rte = gsi_vector_to_rte(gsi, vector);
-	if (!rte)
-		return;		/* not an IOSAPIC interrupt */
-
-	rte_index = rte->rte_index;
-	addr	= rte->addr;
-	pol     = iosapic_intr_info[vector].polarity;
-	trigger = iosapic_intr_info[vector].trigger;
-	dmode   = iosapic_intr_info[vector].dmode;
-
-	redir = (dmode == IOSAPIC_LOWEST_PRIORITY) ? 1 : 0;
-
-#ifdef CONFIG_SMP
-	{
-		unsigned int irq;
-
-		for (irq = 0; irq < NR_IRQS; ++irq)
-			if (irq_to_vector(irq) == vector) {
-				set_irq_affinity_info(irq, (int)(dest & 0xffff), redir);
-				break;
-			}
-	}
-#endif
-
-	low32 = ((pol << IOSAPIC_POLARITY_SHIFT) |
-		 (trigger << IOSAPIC_TRIGGER_SHIFT) |
-		 (dmode << IOSAPIC_DELIVERY_SHIFT) |
-		 ((mask ? 1 : 0) << IOSAPIC_MASK_SHIFT) |
-		 vector);
-
-	/* dest contains both id and eid */
-	high32 = (dest << IOSAPIC_DEST_SHIFT);
-
-	iosapic_write(addr, IOSAPIC_RTE_HIGH(rte_index), high32);
-	iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-	iosapic_intr_info[vector].low32 = low32;
-	iosapic_intr_info[vector].dest = dest;
-}
-
-void
-kexec_disable_iosapic(void)
-{
-        struct iosapic_intr_info *info;
-        struct iosapic_rte_info *rte;
-        u8 vec = 0;
-        for (info = iosapic_intr_info; info <
-                        iosapic_intr_info + IA64_NUM_VECTORS; ++info, ++vec) {
-                list_for_each_entry(rte, &info->rtes,
-                                rte_list) {
-                        iosapic_write(rte->addr,
-                                        IOSAPIC_RTE_LOW(rte->rte_index),
-                                        IOSAPIC_MASK|vec);
-                        iosapic_eoi(rte->addr, vec);
-                }
-        }
-}
-
-static void
-mask_irq (struct irq_desc *desc)
-{
-	unsigned long flags;
-	char __iomem *addr;
-	u32 low32;
-	int rte_index;
-	ia64_vector vec = irq_to_vector(desc->irq);
-	struct iosapic_rte_info *rte;
-
-	if (list_empty(&iosapic_intr_info[vec].rtes))
-		return;			/* not an IOSAPIC interrupt! */
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		/* set only the mask bit */
-		low32 = iosapic_intr_info[vec].low32 |= IOSAPIC_MASK;
-		list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) {
-			addr = rte->addr;
-			rte_index = rte->rte_index;
-			iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-}
-
-static void
-unmask_irq (struct irq_desc *desc)
-{
-	unsigned long flags;
-	char __iomem *addr;
-	u32 low32;
-	int rte_index;
-	ia64_vector vec = irq_to_vector(desc->irq);
-	struct iosapic_rte_info *rte;
-
-	if (list_empty(&iosapic_intr_info[vec].rtes))
-		return;			/* not an IOSAPIC interrupt! */
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		low32 = iosapic_intr_info[vec].low32 &= ~IOSAPIC_MASK;
-		list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) {
-			addr = rte->addr;
-			rte_index = rte->rte_index;
-			iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-}
-
-
-static void
-iosapic_set_affinity (struct irq_desc *desc, const cpumask_t *mask)
-{
-#ifdef CONFIG_SMP
-	unsigned long flags;
-	u32 high32, low32;
-	int dest, rte_index;
-	char __iomem *addr;
-	int redir = (desc->irq & IA64_IRQ_REDIRECTED) ? 1 : 0;
-	unsigned int irq = desc->irq & ~IA64_IRQ_REDIRECTED;
-	ia64_vector vec;
-	struct iosapic_rte_info *rte;
-
-	vec = irq_to_vector(irq);
-
-	if (cpumask_empty(mask))
-		return;
-
-	dest = cpu_physical_id(cpumask_first(mask));
-
-	if (list_empty(&iosapic_intr_info[vec].rtes))
-		return;			/* not an IOSAPIC interrupt */
-
-	set_irq_affinity_info(irq, dest, redir);
-
-	/* dest contains both id and eid */
-	high32 = dest << IOSAPIC_DEST_SHIFT;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		low32 = iosapic_intr_info[vec].low32 & ~(7 << IOSAPIC_DELIVERY_SHIFT);
-
-		if (redir)
-		        /* change delivery mode to lowest priority */
-			low32 |= (IOSAPIC_LOWEST_PRIORITY << IOSAPIC_DELIVERY_SHIFT);
-		else
-		        /* change delivery mode to fixed */
-			low32 |= (IOSAPIC_FIXED << IOSAPIC_DELIVERY_SHIFT);
-
-		iosapic_intr_info[vec].low32 = low32;
-		iosapic_intr_info[vec].dest = dest;
-		list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) {
-			addr = rte->addr;
-			rte_index = rte->rte_index;
-			iosapic_write(addr, IOSAPIC_RTE_HIGH(rte_index), high32);
-			iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-#endif
-}
-
-/*
- * Handlers for level-triggered interrupts.
- */
-
-static unsigned int
-iosapic_startup_level_irq (struct irq_desc *desc)
-{
-	unmask_irq(desc);
-	return 0;
-}
-
-static void
-iosapic_end_level_irq (struct irq_desc *desc)
-{
-	ia64_vector vec = irq_to_vector(desc->irq);
-	struct iosapic_rte_info *rte;
-
-	move_irq(desc->irq);
-	list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list)
-		iosapic_eoi(rte->addr, vec);
-}
-
-#define iosapic_shutdown_level_irq	mask_irq
-#define iosapic_enable_level_irq	unmask_irq
-#define iosapic_disable_level_irq	mask_irq
-#define iosapic_ack_level_irq		irq_actor_none
-
-static hw_irq_controller irq_type_iosapic_level = {
-	.typename =	"IO-SAPIC-level",
-	.startup =	iosapic_startup_level_irq,
-	.shutdown =	iosapic_shutdown_level_irq,
-	.enable =	iosapic_enable_level_irq,
-	.disable =	iosapic_disable_level_irq,
-	.ack =		iosapic_ack_level_irq,
-	.end =		iosapic_end_level_irq,
-	.set_affinity =	iosapic_set_affinity
-};
-
-/*
- * Handlers for edge-triggered interrupts.
- */
-
-static unsigned int
-iosapic_startup_edge_irq (struct irq_desc *desc)
-{
-	unmask_irq(desc);
-	/*
-	 * IOSAPIC simply drops interrupts pended while the
-	 * corresponding pin was masked, so we can't know if an
-	 * interrupt is pending already.  Let's hope not...
-	 */
-	return 0;
-}
-
-static void
-iosapic_ack_edge_irq (struct irq_desc *desc)
-{
-	move_irq(idesc->irq);
-	/*
-	 * Once we have recorded IRQ_PENDING already, we can mask the
-	 * interrupt for real. This prevents IRQ storms from unhandled
-	 * devices.
-	 */
-	if ((desc->status & (IRQ_PENDING|IRQ_DISABLED)) == (IRQ_PENDING|IRQ_DISABLED))
-		mask_irq(desc);
-}
-
-#define iosapic_enable_edge_irq		unmask_irq
-#define iosapic_disable_edge_irq	irq_disable_none
-#define iosapic_end_edge_irq		irq_actor_none
-
-static hw_irq_controller irq_type_iosapic_edge = {
-	.typename =	"IO-SAPIC-edge",
-	.startup =	iosapic_startup_edge_irq,
-	.shutdown =	iosapic_disable_edge_irq,
-	.enable =	iosapic_enable_edge_irq,
-	.disable =	iosapic_disable_edge_irq,
-	.ack =		iosapic_ack_edge_irq,
-	.end =		iosapic_end_edge_irq,
-	.set_affinity =	iosapic_set_affinity
-};
-
-unsigned int
-iosapic_version (char __iomem *addr)
-{
-	/*
-	 * IOSAPIC Version Register return 32 bit structure like:
-	 * {
-	 *	unsigned int version   : 8;
-	 *	unsigned int reserved1 : 8;
-	 *	unsigned int max_redir : 8;
-	 *	unsigned int reserved2 : 8;
-	 * }
-	 */
-	return iosapic_read(addr, IOSAPIC_VERSION);
-}
-
-static int iosapic_find_sharable_vector (unsigned long trigger, unsigned long pol)
-{
-	int i, vector = -1, min_count = -1;
-	struct iosapic_intr_info *info;
-
-	/*
-	 * shared vectors for edge-triggered interrupts are not
-	 * supported yet
-	 */
-	if (trigger == IOSAPIC_EDGE)
-		return -1;
-
-	for (i = IA64_FIRST_DEVICE_VECTOR; i <= IA64_LAST_DEVICE_VECTOR; i++) {
-		info = &iosapic_intr_info[i];
-		if (info->trigger == trigger && info->polarity == pol &&
-		    (info->dmode == IOSAPIC_FIXED || info->dmode == IOSAPIC_LOWEST_PRIORITY)) {
-			if (min_count == -1 || info->count < min_count) {
-				vector = i;
-				min_count = info->count;
-			}
-		}
-	}
-
-	return vector;
-}
-
-/*
- * if the given vector is already owned by other,
- *  assign a new vector for the other and make the vector available
- */
-static void __init
-iosapic_reassign_vector (int vector)
-{
-	int new_vector;
-
-	if (!list_empty(&iosapic_intr_info[vector].rtes)) {
-		new_vector = assign_irq_vector(AUTO_ASSIGN);
-		if (new_vector < 0)
-			panic("%s: out of interrupt vectors!\n", __FUNCTION__);
-		printk(KERN_INFO "Reassigning vector %d to %d\n", vector, new_vector);
-		memcpy(&iosapic_intr_info[new_vector], &iosapic_intr_info[vector],
-		       sizeof(struct iosapic_intr_info));
-		INIT_LIST_HEAD(&iosapic_intr_info[new_vector].rtes);
-		list_move(iosapic_intr_info[vector].rtes.next, &iosapic_intr_info[new_vector].rtes);
-		memset(&iosapic_intr_info[vector], 0, sizeof(struct iosapic_intr_info));
-		iosapic_intr_info[vector].low32 = IOSAPIC_MASK;
-		INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes);
-	}
-}
-
-static struct iosapic_rte_info *iosapic_alloc_rte (void)
-{
-	int i;
-	struct iosapic_rte_info *rte;
-	int preallocated = 0;
-
-	if (!iosapic_kmalloc_ok && list_empty(&free_rte_list)) {
-#ifdef XEN
-		rte = xmalloc_bytes(sizeof(struct iosapic_rte_info) * NR_PREALLOCATE_RTE_ENTRIES);
-#else
-		rte = alloc_bootmem(sizeof(struct iosapic_rte_info) * NR_PREALLOCATE_RTE_ENTRIES);
-#endif
-		if (!rte)
-			return NULL;
-		for (i = 0; i < NR_PREALLOCATE_RTE_ENTRIES; i++, rte++)
-			list_add(&rte->rte_list, &free_rte_list);
-	}
-
-	if (!list_empty(&free_rte_list)) {
-		rte = list_entry(free_rte_list.next, struct iosapic_rte_info, rte_list);
-		list_del(&rte->rte_list);
-		preallocated++;
-	} else {
-		rte = kmalloc(sizeof(struct iosapic_rte_info), GFP_ATOMIC);
-		if (!rte)
-			return NULL;
-	}
-
-	memset(rte, 0, sizeof(struct iosapic_rte_info));
-	if (preallocated)
-		rte->flags |= RTE_PREALLOCATED;
-
-	return rte;
-}
-
-static void iosapic_free_rte (struct iosapic_rte_info *rte)
-{
-	if (rte->flags & RTE_PREALLOCATED)
-		list_add_tail(&rte->rte_list, &free_rte_list);
-	else
-		kfree(rte);
-}
-
-static inline int vector_is_shared (int vector)
-{
-	return (iosapic_intr_info[vector].count > 1);
-}
-
-static int
-register_intr (unsigned int gsi, int vector, unsigned char delivery,
-	       unsigned long polarity, unsigned long trigger)
-{
-	irq_desc_t *idesc;
-	hw_irq_controller *irq_type;
-	int rte_index;
-	int index;
-	unsigned long gsi_base;
-	void __iomem *iosapic_address;
-	struct iosapic_rte_info *rte;
-
-	index = find_iosapic(gsi);
-	if (index < 0) {
-		printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi);
-		return -ENODEV;
-	}
-
-	iosapic_address = iosapic_lists[index].addr;
-	gsi_base = iosapic_lists[index].gsi_base;
-
-	rte = gsi_vector_to_rte(gsi, vector);
-	if (!rte) {
-		rte = iosapic_alloc_rte();
-		if (!rte) {
-			printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__);
-			return -ENOMEM;
-		}
-
-		rte_index = gsi - gsi_base;
-		rte->rte_index	= rte_index;
-		rte->addr	= iosapic_address;
-		rte->gsi_base	= gsi_base;
-		rte->refcnt++;
-		list_add_tail(&rte->rte_list, &iosapic_intr_info[vector].rtes);
-		iosapic_intr_info[vector].count++;
-		iosapic_lists[index].rtes_inuse++;
-	}
-	else if (vector_is_shared(vector)) {
-		struct iosapic_intr_info *info = &iosapic_intr_info[vector];
-		if (info->trigger != trigger || info->polarity != polarity) {
-			printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__);
-			return -EINVAL;
-		}
-	}
-
-	iosapic_intr_info[vector].polarity = polarity;
-	iosapic_intr_info[vector].dmode    = delivery;
-	iosapic_intr_info[vector].trigger  = trigger;
-
-	if (trigger == IOSAPIC_EDGE)
-		irq_type = &irq_type_iosapic_edge;
-	else
-		irq_type = &irq_type_iosapic_level;
-
-	idesc = irq_descp(vector);
-	if (idesc->handler != irq_type) {
-		if (idesc->handler != &no_irq_type)
-			printk(KERN_WARNING "%s: changing vector %d from %s to %s\n",
-			       __FUNCTION__, vector, idesc->handler->typename, irq_type->typename);
-		idesc->handler = irq_type;
-	}
-	return 0;
-}
-
-static unsigned int
-get_target_cpu (unsigned int gsi, int vector)
-{
-#ifdef CONFIG_SMP
-	static int cpu = -1;
-
-	/*
-	 * In case of vector shared by multiple RTEs, all RTEs that
-	 * share the vector need to use the same destination CPU.
-	 */
-	if (!list_empty(&iosapic_intr_info[vector].rtes))
-		return iosapic_intr_info[vector].dest;
-
-	/*
-	 * If the platform supports redirection via XTP, let it
-	 * distribute interrupts.
-	 */
-	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
-		return cpu_physical_id(smp_processor_id());
-
-	/*
-	 * Some interrupts (ACPI SCI, for instance) are registered
-	 * before the BSP is marked as online.
-	 */
-	if (!cpu_online(smp_processor_id()))
-		return cpu_physical_id(smp_processor_id());
-
-#ifdef CONFIG_NUMA
-	{
-		int num_cpus, cpu_index, iosapic_index, numa_cpu, i = 0;
-		cpumask_t cpu_mask;
-
-		iosapic_index = find_iosapic(gsi);
-		if (iosapic_index < 0 ||
-		    iosapic_lists[iosapic_index].node == MAX_NUMNODES)
-			goto skip_numa_setup;
-
-		cpu_mask = node_to_cpumask(iosapic_lists[iosapic_index].node);
-
-		for_each_cpu(numa_cpu, &cpu_mask) {
-			if (!cpu_online(numa_cpu))
-				cpumask_clear_cpu(numa_cpu, &cpu_mask);
-		}
-
-		num_cpus = cpumask_weight(&cpu_mask);
-
-		if (!num_cpus)
-			goto skip_numa_setup;
-
-		/* Use vector assigment to distribute across cpus in node */
-		cpu_index = vector % num_cpus;
-
-		for (numa_cpu = cpumask_first(&cpu_mask) ; i < cpu_index ; i++)
-			numa_cpu = cpumask_next(numa_cpu, &cpu_mask);
-
-		if (numa_cpu != NR_CPUS)
-			return cpu_physical_id(numa_cpu);
-	}
-skip_numa_setup:
-#endif
-	/*
-	 * Otherwise, round-robin interrupt vectors across all the
-	 * processors.  (It'd be nice if we could be smarter in the
-	 * case of NUMA.)
-	 */
-	do {
-		if (++cpu >= NR_CPUS)
-			cpu = 0;
-	} while (!cpu_online(cpu));
-
-	return cpu_physical_id(cpu);
-#else
-	return cpu_physical_id(smp_processor_id());
-#endif
-}
-
-/*
- * ACPI can describe IOSAPIC interrupts via static tables and namespace
- * methods.  This provides an interface to register those interrupts and
- * program the IOSAPIC RTE.
- */
-int
-iosapic_register_intr (unsigned int gsi,
-		       unsigned long polarity, unsigned long trigger)
-{
-	int vector, mask = 1, err;
-	unsigned int dest;
-	unsigned long flags;
-	struct iosapic_rte_info *rte;
-	u32 low32;
-again:
-	/*
-	 * If this GSI has already been registered (i.e., it's a
-	 * shared interrupt, or we lost a race to register it),
-	 * don't touch the RTE.
-	 */
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		vector = gsi_to_vector(gsi);
-		if (vector > 0) {
-			rte = gsi_vector_to_rte(gsi, vector);
-			rte->refcnt++;
-			spin_unlock_irqrestore(&iosapic_lock, flags);
-			return vector;
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	/* If vector is running out, we try to find a sharable vector */
-	vector = assign_irq_vector(AUTO_ASSIGN);
-	if (vector < 0) {
-		vector = iosapic_find_sharable_vector(trigger, polarity);
-  		if (vector < 0)
-			return -ENOSPC;
-	}
-
-	spin_lock_irqsave(&irq_descp(vector)->lock, flags);
-	spin_lock(&iosapic_lock);
-	{
-		if (gsi_to_vector(gsi) > 0) {
-			if (list_empty(&iosapic_intr_info[vector].rtes))
-				free_irq_vector(vector);
-			spin_unlock(&iosapic_lock);
-			spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
-			goto again;
-		}
-
-		dest = get_target_cpu(gsi, vector);
-		err = register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
-			      polarity, trigger);
-		if (err < 0) {
-			spin_unlock(&iosapic_lock);
-			spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
-			return err;
-		}
-
-		/*
-		 * If the vector is shared and already unmasked for
-		 * other interrupt sources, don't mask it.
-		 */
-		low32 = iosapic_intr_info[vector].low32;
-		if (vector_is_shared(vector) && !(low32 & IOSAPIC_MASK))
-			mask = 0;
-		set_rte(gsi, vector, dest, mask);
-	}
-	spin_unlock(&iosapic_lock);
-	spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
-
-	printk(KERN_INFO "GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d\n",
-	       gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"),
-	       (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
-	       cpu_logical_id(dest), dest, vector);
-
-	return vector;
-}
-
-void
-iosapic_unregister_intr (unsigned int gsi)
-{
-	unsigned long flags;
-	int irq, vector, index;
-	irq_desc_t *idesc;
-	u32 low32;
-	unsigned long trigger, polarity;
-	unsigned int dest;
-	struct iosapic_rte_info *rte;
-
-	/*
-	 * If the irq associated with the gsi is not found,
-	 * iosapic_unregister_intr() is unbalanced. We need to check
-	 * this again after getting locks.
-	 */
-	irq = gsi_to_irq(gsi);
-	if (irq < 0) {
-		printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n", gsi);
-		WARN_ON(1);
-		return;
-	}
-	vector = irq_to_vector(irq);
-
-	idesc = irq_descp(irq);
-	spin_lock_irqsave(&idesc->lock, flags);
-	spin_lock(&iosapic_lock);
-	{
-		if ((rte = gsi_vector_to_rte(gsi, vector)) == NULL) {
-			printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n", gsi);
-			WARN_ON(1);
-			goto out;
-		}
-
-		if (--rte->refcnt > 0)
-			goto out;
-
-		/* Mask the interrupt */
-		low32 = iosapic_intr_info[vector].low32 | IOSAPIC_MASK;
-		iosapic_write(rte->addr, IOSAPIC_RTE_LOW(rte->rte_index), low32);
-
-		/* Remove the rte entry from the list */
-		list_del(&rte->rte_list);
-		iosapic_intr_info[vector].count--;
-		iosapic_free_rte(rte);
-		index = find_iosapic(gsi);
-		iosapic_lists[index].rtes_inuse--;
-		WARN_ON(iosapic_lists[index].rtes_inuse < 0);
-
-		trigger	 = iosapic_intr_info[vector].trigger;
-		polarity = iosapic_intr_info[vector].polarity;
-		dest     = iosapic_intr_info[vector].dest;
-		printk(KERN_INFO "GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d unregistered\n",
-		       gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"),
-		       (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
-		       cpu_logical_id(dest), dest, vector);
-
-		if (list_empty(&iosapic_intr_info[vector].rtes)) {
-			/* Sanity check */
-			BUG_ON(iosapic_intr_info[vector].count);
-
-			/* Clear the interrupt controller descriptor */
-			idesc->handler = &no_irq_type;
-
-			/* Clear the interrupt information */
-			memset(&iosapic_intr_info[vector], 0, sizeof(struct iosapic_intr_info));
-			iosapic_intr_info[vector].low32 |= IOSAPIC_MASK;
-			INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes);
-
-			if (idesc->action) {
-				printk(KERN_ERR "interrupt handlers still exist on IRQ %u\n", irq);
-				WARN_ON(1);
-			}
-
-			/* Free the interrupt vector */
-			free_irq_vector(vector);
-		}
-	}
- out:
-	spin_unlock(&iosapic_lock);
-	spin_unlock_irqrestore(&idesc->lock, flags);
-}
-
-/*
- * ACPI calls this when it finds an entry for a platform interrupt.
- * Note that the irq_base and IOSAPIC address must be set in iosapic_init().
- */
-int __init
-iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
-				int iosapic_vector, u16 eid, u16 id,
-				unsigned long polarity, unsigned long trigger)
-{
-	static const char * const name[] = {"unknown", "PMI", "INIT", "CPEI"};
-	unsigned char delivery;
-	int vector, mask = 0;
-	unsigned int dest = ((id << 8) | eid) & 0xffff;
-
-	switch (int_type) {
-	      case ACPI_INTERRUPT_PMI:
-		vector = iosapic_vector;
-		/*
-		 * since PMI vector is alloc'd by FW(ACPI) not by kernel,
-		 * we need to make sure the vector is available
-		 */
-		iosapic_reassign_vector(vector);
-		delivery = IOSAPIC_PMI;
-		break;
-	      case ACPI_INTERRUPT_INIT:
-		vector = assign_irq_vector(AUTO_ASSIGN);
-		if (vector < 0)
-			panic("%s: out of interrupt vectors!\n", __FUNCTION__);
-		delivery = IOSAPIC_INIT;
-		break;
-	      case ACPI_INTERRUPT_CPEI:
-		vector = IA64_CPE_VECTOR;
-		delivery = IOSAPIC_LOWEST_PRIORITY;
-		mask = 1;
-		break;
-	      default:
-		printk(KERN_ERR "iosapic_register_platform_irq(): invalid int type 0x%x\n", int_type);
-		return -1;
-	}
-
-	register_intr(gsi, vector, delivery, polarity, trigger);
-
-	printk(KERN_INFO "PLATFORM int %s (0x%x): GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d\n",
-	       int_type < ARRAY_SIZE(name) ? name[int_type] : "unknown",
-	       int_type, gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"),
-	       (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
-	       cpu_logical_id(dest), dest, vector);
-
-	set_rte(gsi, vector, dest, mask);
-	return vector;
-}
-
-
-/*
- * ACPI calls this when it finds an entry for a legacy ISA IRQ override.
- * Note that the gsi_base and IOSAPIC address must be set in iosapic_init().
- */
-void __init
-iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
-			  unsigned long polarity,
-			  unsigned long trigger)
-{
-	int vector;
-	unsigned int dest = cpu_physical_id(smp_processor_id());
-
-	vector = isa_irq_to_vector(isa_irq);
-
-	register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, polarity, trigger);
-
-	DBG("ISA: IRQ %u -> GSI %u (%s,%s) -> CPU %d (0x%04x) vector %d\n",
-	    isa_irq, gsi, trigger == IOSAPIC_EDGE ? "edge" : "level",
-	    polarity == IOSAPIC_POL_HIGH ? "high" : "low",
-	    cpu_logical_id(dest), dest, vector);
-
-	set_rte(gsi, vector, dest, 1);
-}
-
-void __init
-iosapic_system_init (int system_pcat_compat)
-{
-	int vector;
-
-	for (vector = 0; vector < IA64_NUM_VECTORS; ++vector) {
-		iosapic_intr_info[vector].low32 = IOSAPIC_MASK;
-		INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes);	/* mark as unused */
-	}
-
-	pcat_compat = system_pcat_compat;
-	if (pcat_compat) {
-		/*
-		 * Disable the compatibility mode interrupts (8259 style), needs IN/OUT support
-		 * enabled.
-		 */
-		printk(KERN_INFO "%s: Disabling PC-AT compatible 8259 interrupts\n", __FUNCTION__);
-		outb(0xff, 0xA1);
-		outb(0xff, 0x21);
-	}
-}
-
-static inline int
-iosapic_alloc (void)
-{
-	int index;
-
-	for (index = 0; index < NR_IOSAPICS; index++)
-		if (!iosapic_lists[index].addr)
-			return index;
-
-	printk(KERN_WARNING "%s: failed to allocate iosapic\n", __FUNCTION__);
-	return -1;
-}
-
-static inline void
-iosapic_free (int index)
-{
-	memset(&iosapic_lists[index], 0, sizeof(iosapic_lists[0]));
-}
-
-static inline int
-iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver)
-{
-	int index;
-	unsigned int gsi_end, base, end;
-
-	/* check gsi range */
-	gsi_end = gsi_base + ((ver >> 16) & 0xff);
-	for (index = 0; index < NR_IOSAPICS; index++) {
-		if (!iosapic_lists[index].addr)
-			continue;
-
-		base = iosapic_lists[index].gsi_base;
-		end  = base + iosapic_lists[index].num_rte - 1;
-
-		if (gsi_base < base && gsi_end < base)
-			continue;/* OK */
-
-		if (gsi_base > end && gsi_end > end)
-			continue; /* OK */
-
-		return -EBUSY;
-	}
-	return 0;
-}
-
-int __devinit
-#ifndef XEN
-iosapic_init (unsigned long phys_addr, unsigned int gsi_base)
-#else	
-iosapic_init (unsigned long phys_addr, unsigned int gsi_base, unsigned int id)
-#endif
-{
-	int num_rte, err, index;
-	unsigned int isa_irq, ver;
-	char __iomem *addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		addr = ioremap(phys_addr, 0);
-		ver = iosapic_version(addr);
-
-		if ((err = iosapic_check_gsi_range(gsi_base, ver))) {
-			iounmap(addr);
-			spin_unlock_irqrestore(&iosapic_lock, flags);
-			return err;
-		}
-
-		/*
-		 * The MAX_REDIR register holds the highest input pin
-		 * number (starting from 0).
-		 * We add 1 so that we can use it for number of pins (= RTEs)
-		 */
-		num_rte = ((ver >> 16) & 0xff) + 1;
-
-		index = iosapic_alloc();
-		iosapic_lists[index].addr = addr;
-		iosapic_lists[index].gsi_base = gsi_base;
-		iosapic_lists[index].num_rte = num_rte;
-#ifdef XEN
-		iosapic_lists[index].id = id;
-#endif
-#ifdef CONFIG_NUMA
-		iosapic_lists[index].node = MAX_NUMNODES;
-#endif
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	if ((gsi_base == 0) && pcat_compat) {
-		/*
-		 * Map the legacy ISA devices into the IOSAPIC data.  Some of these may
-		 * get reprogrammed later on with data from the ACPI Interrupt Source
-		 * Override table.
-		 */
-		for (isa_irq = 0; isa_irq < 16; ++isa_irq)
-			iosapic_override_isa_irq(isa_irq, isa_irq, IOSAPIC_POL_HIGH, IOSAPIC_EDGE);
-	}
-	return 0;
-}
-
-#ifdef CONFIG_HOTPLUG
-int
-iosapic_remove (unsigned int gsi_base)
-{
-	int index, err = 0;
-	unsigned long flags;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		index = find_iosapic(gsi_base);
-		if (index < 0) {
-			printk(KERN_WARNING "%s: No IOSAPIC for GSI base %u\n",
-			       __FUNCTION__, gsi_base);
-			goto out;
-		}
-
-		if (iosapic_lists[index].rtes_inuse) {
-			err = -EBUSY;
-			printk(KERN_WARNING "%s: IOSAPIC for GSI base %u is busy\n",
-			       __FUNCTION__, gsi_base);
-			goto out;
-		}
-
-		iounmap(iosapic_lists[index].addr);
-		iosapic_free(index);
-	}
- out:
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-	return err;
-}
-#endif /* CONFIG_HOTPLUG */
-
-#ifdef CONFIG_NUMA
-void __devinit
-map_iosapic_to_node(unsigned int gsi_base, int node)
-{
-	int index;
-
-	index = find_iosapic(gsi_base);
-	if (index < 0) {
-		printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n",
-		       __FUNCTION__, gsi_base);
-		return;
-	}
-	iosapic_lists[index].node = node;
-	return;
-}
-#endif
-
-#ifndef XEN
-static int __init iosapic_enable_kmalloc (void)
-{
-	iosapic_kmalloc_ok = 1;
-	return 0;
-}
-core_initcall (iosapic_enable_kmalloc);
-#endif
-
-#ifdef XEN
-/* nop for now */
-void set_irq_affinity_info(unsigned int irq, int hwid, int redir) {}
-
-static int iosapic_physbase_to_id(unsigned long physbase)
-{
-	int i;
-	unsigned long addr = physbase | __IA64_UNCACHED_OFFSET;
-
-	for (i = 0; i < NR_IOSAPICS; i++) {
-	    if ((unsigned long)(iosapic_lists[i].addr) == addr)
-		return i;
-	}
-
-	return -1;
-}
-
-int iosapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval)
-{
-	int id;
-	unsigned long flags;
-
-	if ((id = (iosapic_physbase_to_id(physbase))) < 0)
-	    return id;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	*pval = iosapic_read(iosapic_lists[id].addr, reg);
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	return 0;
-}
-
-int iosapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
-{
-	unsigned int id, gsi, vec, xen_vec, dest, high32;
-	char rte_index;
-	struct iosapic *ios;
-	struct iosapic_intr_info *info;
-	struct rte_entry rte;
-	unsigned long flags;
-
-	if ((id = (iosapic_physbase_to_id(physbase))) < 0)
-	    return -EINVAL;
-	ios = &iosapic_lists[id];
-
-	/* Only handle first half of RTE update */
-	if ((reg < 0x10) || (reg & 1))
-	    return 0;
-
-	rte.val = val;
-	rte_index = IOSAPIC_RTEINDEX(reg);
-	vec = rte.lo.vector;
-#if 0
-	/* Take PMI/NMI/INIT/EXTINT handled by xen */ 
-	if (rte.delivery_mode > IOSAPIC_LOWEST_PRIORITY) {
-	    printk("Attempt to write IOSAPIC dest mode owned by xen!\n");
-	    printk("IOSAPIC/PIN = (%d/%d), lo = 0x%x\n",
-		id, rte_index, val);
-	    return -EINVAL;
-	}
-#endif
-
-	/* Sanity check. Vector should be allocated before this update */
-	if ((rte_index > ios->num_rte) ||
-	    ((vec > IA64_FIRST_DEVICE_VECTOR) &&
-	     (vec < IA64_LAST_DEVICE_VECTOR) &&
-	     (!test_bit(vec - IA64_FIRST_DEVICE_VECTOR, ia64_vector_mask))))
-	    return -EINVAL;
-
-	gsi = ios->gsi_base + rte_index;
-	xen_vec = gsi_to_vector(gsi);
-	if (xen_vec >= 0 && test_bit(xen_vec, ia64_xen_vector)) {
-		printk("WARN: GSI %d in use by Xen.\n", gsi);
-		return -EINVAL;
-	}
-	info = &iosapic_intr_info[vec];
-	spin_lock_irqsave(&irq_descp(vec)->lock, flags);
-	spin_lock(&iosapic_lock);
-	if (!gsi_vector_to_rte(gsi, vec)) {
-	    register_intr(gsi, vec, IOSAPIC_LOWEST_PRIORITY,
-		rte.lo.polarity, rte.lo.trigger);
-	} else if (vector_is_shared(vec)) {
-	    if ((info->trigger != rte.lo.trigger) ||
-		(info->polarity != rte.lo.polarity)) {
-		printk("WARN: can't override shared interrupt vec\n");
-	        printk("IOSAPIC/PIN = (%d/%d), ori = 0x%x, new = 0x%x\n",
-			id, rte_index, info->low32, rte.val);
-		spin_unlock(&iosapic_lock);
-		spin_unlock_irqrestore(&irq_descp(vec)->lock, flags);
-		return -EINVAL;
-	    }
-
-	    /* If the vector is shared and already unmasked for other
-	     * interrupt sources, don't mask it.
-	     *
-	     * Same check may also apply to single gsi pin, which may
-	     * be shared by devices belonging to different domain. But
-	     * let's see how to act later on demand.
-	     */
-	    if (!(info->low32 & IOSAPIC_MASK))
-		rte.lo.mask = 0;
-	}
-
-	/* time to update physical RTE */
-	dest = cpu_physical_id(smp_processor_id());
-	high32 = (dest << IOSAPIC_DEST_SHIFT);
-	iosapic_write(iosapic_lists[id].addr, reg + 1, high32);
-	iosapic_write(iosapic_lists[id].addr, reg, rte.val);
-	info->low32 = rte.val;
-	info->dest = dest;
-	spin_unlock(&iosapic_lock);
-	spin_unlock_irqrestore(&irq_descp(vec)->lock, flags);
-	return 0;
-}
-
-/* for vtd interrupt remapping. xen/drivers/vtd/intremap.c */
-int iosapic_get_nr_iosapics(void)
-{
-	int index;
-
-	for (index = NR_IOSAPICS - 1; index >= 0; index--) {
-		if (iosapic_lists[index].addr)
-			break;
-	}
-
-	return index + 1;
-}
-
-int iosapic_get_nr_pins(int index)
-{
-	return iosapic_lists[index].num_rte;
-}
-#endif /* XEN */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/irq_ia64.c
--- a/xen/arch/ia64/linux-xen/irq_ia64.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,350 +0,0 @@
-/*
- * linux/arch/ia64/kernel/irq.c
- *
- * Copyright (C) 1998-2001 Hewlett-Packard Co
- *	Stephane Eranian <eranian@hpl.hp.com>
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *
- *  6/10/99: Updated to bring in sync with x86 version to facilitate
- *	     support for SMP and different interrupt controllers.
- *
- * 09/15/00 Goutham Rao <goutham.rao@intel.com> Implemented pci_irq_to_vector
- *                      PCI to vector allocation routine.
- * 04/14/2004 Ashok Raj <ashok.raj@intel.com>
- *						Added CPU Hotplug handling for IPF.
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-
-#include <linux/jiffies.h>
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/kernel_stat.h>
-#include <linux/slab.h>
-#include <linux/ptrace.h>
-#include <linux/random.h>	/* for rand_initialize_irq() */
-#include <linux/signal.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/threads.h>
-#include <linux/bitops.h>
-
-#include <asm/delay.h>
-#include <asm/intrinsics.h>
-#include <asm/io.h>
-#include <asm/hw_irq.h>
-#include <asm/machvec.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-
-#ifdef XEN
-#include <xen/perfc.h>
-#endif
-
-#ifdef CONFIG_PERFMON
-# include <asm/perfmon.h>
-#endif
-
-#define IRQ_DEBUG	0
-
-/* default base addr of IPI table */
-void __iomem *ipi_base_addr = ((void __iomem *)
-			       (__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR));
-
-/*
- * Legacy IRQ to IA-64 vector translation table.
- */
-__u8 isa_irq_to_vector_map[16] = {
-	/* 8259 IRQ translation, first 16 entries */
-	0x2f, 0x20, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29,
-	0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21
-};
-EXPORT_SYMBOL(isa_irq_to_vector_map);
-
-#ifdef XEN
-unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)];
-#else
-static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)];
-#endif
-
-int
-assign_irq_vector (int irq)
-{
-	int pos, vector;
- again:
-	pos = find_first_zero_bit(ia64_vector_mask, IA64_NUM_DEVICE_VECTORS);
-	vector = IA64_FIRST_DEVICE_VECTOR + pos;
-	if (vector > IA64_LAST_DEVICE_VECTOR)
-		return -ENOSPC;
-	if (test_and_set_bit(pos, ia64_vector_mask))
-		goto again;
-	return vector;
-}
-
-void
-free_irq_vector (int vector)
-{
-	int pos;
-
-	if (vector < IA64_FIRST_DEVICE_VECTOR || vector > IA64_LAST_DEVICE_VECTOR)
-		return;
-
-	pos = vector - IA64_FIRST_DEVICE_VECTOR;
-	if (!test_and_clear_bit(pos, ia64_vector_mask))
-		printk(KERN_WARNING "%s: double free!\n", __FUNCTION__);
-}
-
-#ifdef CONFIG_SMP
-#	define IS_RESCHEDULE(vec)	(vec == IA64_IPI_RESCHEDULE)
-#else
-#	define IS_RESCHEDULE(vec)	(0)
-#endif
-/*
- * That's where the IVT branches when we get an external
- * interrupt. This branches to the correct hardware IRQ handler via
- * function ptr.
- */
-void
-ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
-{
-	unsigned long saved_tpr;
-
-#ifdef XEN
-	perfc_incr(irqs);
-#endif
-#if IRQ_DEBUG
-#ifdef XEN
-	xen_debug_irq(vector, regs);
-#endif
-	{
-		unsigned long bsp, sp;
-
-		/*
-		 * Note: if the interrupt happened while executing in
-		 * the context switch routine (ia64_switch_to), we may
-		 * get a spurious stack overflow here.  This is
-		 * because the register and the memory stack are not
-		 * switched atomically.
-		 */
-		bsp = ia64_getreg(_IA64_REG_AR_BSP);
-		sp = ia64_getreg(_IA64_REG_SP);
-
-		if ((sp - bsp) < 1024) {
-			static unsigned char count;
-			static long last_time;
-
-			if (jiffies - last_time > 5*HZ)
-				count = 0;
-			if (++count < 5) {
-				last_time = jiffies;
-				printk("ia64_handle_irq: DANGER: less than "
-				       "1KB of free stack space!!\n"
-				       "(bsp=0x%lx, sp=%lx)\n", bsp, sp);
-			}
-		}
-	}
-#endif /* IRQ_DEBUG */
-
-	/*
-	 * Always set TPR to limit maximum interrupt nesting depth to
-	 * 16 (without this, it would be ~240, which could easily lead
-	 * to kernel stack overflows).
-	 */
-	irq_enter();
-	saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
-	ia64_srlz_d();
-	while (vector != IA64_SPURIOUS_INT_VECTOR) {
-		if (!IS_RESCHEDULE(vector)) {
-			ia64_setreg(_IA64_REG_CR_TPR, vector);
-			ia64_srlz_d();
-
-			__do_IRQ(local_vector_to_irq(vector), regs);
-
-			/*
-			 * Disable interrupts and send EOI:
-			 */
-			local_irq_disable();
-			ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
-		}
-		ia64_eoi();
-		vector = ia64_get_ivr();
-	}
-	/*
-	 * This must be done *after* the ia64_eoi().  For example, the keyboard softirq
-	 * handler needs to be able to wait for further keyboard interrupts, which can't
-	 * come through until ia64_eoi() has been done.
-	 */
-	irq_exit();
-}
-
-#ifndef XEN
-#ifdef CONFIG_HOTPLUG_CPU
-/*
- * This function emulates a interrupt processing when a cpu is about to be
- * brought down.
- */
-void ia64_process_pending_intr(void)
-{
-	ia64_vector vector;
-	unsigned long saved_tpr;
-	extern unsigned int vectors_in_migration[NR_IRQS];
-
-	vector = ia64_get_ivr();
-
-	 irq_enter();
-	 saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
-	 ia64_srlz_d();
-
-	 /*
-	  * Perform normal interrupt style processing
-	  */
-	while (vector != IA64_SPURIOUS_INT_VECTOR) {
-		if (!IS_RESCHEDULE(vector)) {
-			ia64_setreg(_IA64_REG_CR_TPR, vector);
-			ia64_srlz_d();
-
-			/*
-			 * Now try calling normal ia64_handle_irq as it would have got called
-			 * from a real intr handler. Try passing null for pt_regs, hopefully
-			 * it will work. I hope it works!.
-			 * Probably could shared code.
-			 */
-			vectors_in_migration[local_vector_to_irq(vector)]=0;
-			__do_IRQ(local_vector_to_irq(vector), NULL);
-
-			/*
-			 * Disable interrupts and send EOI
-			 */
-			local_irq_disable();
-			ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
-		}
-		ia64_eoi();
-		vector = ia64_get_ivr();
-	}
-	irq_exit();
-}
-#endif
-#endif
-
-
-#ifdef CONFIG_SMP
-extern irqreturn_t handle_IPI (int irq, void *dev_id, struct pt_regs *regs);
-
-static struct irqaction __read_mostly ipi_irqaction = {
-	.handler =	handle_IPI,
-#ifndef XEN
-	.flags =	SA_INTERRUPT,
-#endif
-	.name =		"IPI"
-};
-#endif
-
-static hw_irq_controller irq_type_ia64_lsapic = {
-	.typename =	"LSAPIC",
-	.startup =	irq_startup_none,
-	.shutdown =	irq_shutdown_none,
-	.enable =	irq_enable_none,
-	.disable =	irq_disable_none,
-	.ack =		irq_actor_none,
-	.end =		irq_actor_none
-};
-
-void
-register_percpu_irq (ia64_vector vec, struct irqaction *action)
-{
-	irq_desc_t *desc;
-#ifndef XEN
-	unsigned int irq;
-
-	for (irq = 0; irq < NR_IRQS; ++irq)
-		if (irq_to_vector(irq) == vec) {
-			desc = irq_descp(irq);
-			desc->status |= IRQ_PER_CPU;
-			desc->handler = &irq_type_ia64_lsapic;
-			if (action)
-				setup_irq(irq, action);
-		}
-#else
-	desc = irq_descp(vec);
-	desc->status |= IRQ_PER_CPU;
-	desc->handler = &irq_type_ia64_lsapic;
-	if (action)
-		setup_vector(vec, action);
-#endif
-}
-
-#ifdef XEN
-int __init request_irq_vector(unsigned int vector,
-		void (*handler)(int, void *, struct cpu_user_regs *),
-		unsigned long irqflags, const char * devname, void *dev_id)
-{
-	struct irqaction * action;
-	int retval;
-
-	/*
-	 * Sanity-check: shared interrupts must pass in a real dev-ID,
-	 * otherwise we'll have trouble later trying to figure out
-	 * which interrupt is which (messes up the interrupt freeing logic etc).
-	 *                          */
-	if (vector >= NR_VECTORS)
-		return -EINVAL;
-	if (!handler)
-		return -EINVAL;
-
-	action = xmalloc(struct irqaction);
-	if (!action)
-		return -ENOMEM;
-
-	action->handler = handler;
-	action->name = devname;
-	action->dev_id = dev_id;
-
-	retval = setup_vector(vector, action);
-	if (retval)
-		xfree(action);
-
-	return retval;
-}
-#endif
-
-void __init
-init_IRQ (void)
-{
-#ifdef XEN
-	BUG_ON(init_irq_data());
-#endif
-	register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
-#ifdef CONFIG_SMP
-	register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
-#endif
-#ifdef CONFIG_PERFMON
-	pfm_init_percpu();
-#endif
-	platform_irq_init();
-}
-
-void
-ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect)
-{
-	void __iomem *ipi_addr;
-	unsigned long ipi_data;
-	unsigned long phys_cpu_id;
-
-#ifdef CONFIG_SMP
-	phys_cpu_id = cpu_physical_id(cpu);
-#else
-	phys_cpu_id = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff;
-#endif
-
-	/*
-	 * cpu number is in 8bit ID and 8bit EID
-	 */
-
-	ipi_data = (delivery_mode << 8) | (vector & 0xff);
-	ipi_addr = ipi_base_addr + ((phys_cpu_id << 4) | ((redirect & 1) << 3));
-
-	writeq(ipi_data, ipi_addr);
-}
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/mca.c
--- a/xen/arch/ia64/linux-xen/mca.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1963 +0,0 @@
-/*
- * File:	mca.c
- * Purpose:	Generic MCA handling layer
- *
- * Updated for latest kernel
- * Copyright (C) 2003 Hewlett-Packard Co
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *
- * Copyright (C) 2002 Dell Inc.
- * Copyright (C) Matt Domsch (Matt_Domsch@dell.com)
- *
- * Copyright (C) 2002 Intel
- * Copyright (C) Jenna Hall (jenna.s.hall@intel.com)
- *
- * Copyright (C) 2001 Intel
- * Copyright (C) Fred Lewis (frederick.v.lewis@intel.com)
- *
- * Copyright (C) 2000 Intel
- * Copyright (C) Chuck Fleckenstein (cfleck@co.intel.com)
- *
- * Copyright (C) 1999, 2004 Silicon Graphics, Inc.
- * Copyright (C) Vijay Chander(vijay@engr.sgi.com)
- *
- * 03/04/15 D. Mosberger Added INIT backtrace support.
- * 02/03/25 M. Domsch	GUID cleanups
- *
- * 02/01/04 J. Hall	Aligned MCA stack to 16 bytes, added platform vs. CPU
- *			error flag, set SAL default return values, changed
- *			error record structure to linked list, added init call
- *			to sal_get_state_info_size().
- *
- * 01/01/03 F. Lewis    Added setup of CMCI and CPEI IRQs, logging of corrected
- *                      platform errors, completed code for logging of
- *                      corrected & uncorrected machine check errors, and
- *                      updated for conformance with Nov. 2000 revision of the
- *                      SAL 3.0 spec.
- * 00/03/29 C. Fleckenstein  Fixed PAL/SAL update issues, began MCA bug fixes, logging issues,
- *                           added min save state dump, added INIT handler.
- *
- * 2003-12-08 Keith Owens <kaos@sgi.com>
- *            smp_call_function() must not be called from interrupt context (can
- *            deadlock on tasklist_lock).  Use keventd to call smp_call_function().
- *
- * 2004-02-01 Keith Owens <kaos@sgi.com>
- *            Avoid deadlock when using printk() for MCA and INIT records.
- *            Delete all record printing code, moved to salinfo_decode in user space.
- *            Mark variables and functions static where possible.
- *            Delete dead variables and functions.
- *            Reorder to remove the need for forward declarations and to consolidate
- *            related code.
- */
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/kallsyms.h>
-#include <linux/smp_lock.h>
-#include <linux/bootmem.h>
-#include <linux/acpi.h>
-#include <linux/timer.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/smp.h>
-#include <linux/workqueue.h>
-
-#include <asm/delay.h>
-#include <asm/machvec.h>
-#include <asm/meminit.h>
-#include <asm/page.h>
-#include <asm/ptrace.h>
-#include <asm/system.h>
-#include <asm/sal.h>
-#include <asm/mca.h>
-
-#include <asm/irq.h>
-#include <asm/hw_irq.h>
-
-#ifdef XEN
-#include <xen/symbols.h>
-#include <xen/mm.h>
-#include <xen/console.h>
-#include <xen/event.h>
-#include <xen/softirq.h>
-#include <asm/xenmca.h>
-#include <linux/shutdown.h>
-#endif
-
-#if defined(IA64_MCA_DEBUG_INFO)
-# define IA64_MCA_DEBUG(fmt...)	printk(fmt)
-#else
-# define IA64_MCA_DEBUG(fmt...)
-#endif
-
-/* Used by mca_asm.S */
-#ifndef XEN
-ia64_mca_sal_to_os_state_t	ia64_sal_to_os_handoff_state;
-#else
-ia64_mca_sal_to_os_state_t	ia64_sal_to_os_handoff_state[NR_CPUS];
-DEFINE_PER_CPU(u64, ia64_sal_to_os_handoff_state_addr); 
-#endif
-ia64_mca_os_to_sal_state_t	ia64_os_to_sal_handoff_state;
-u64				ia64_mca_serialize;
-DEFINE_PER_CPU(u64, ia64_mca_data); /* == __per_cpu_mca[smp_processor_id()] */
-DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */
-DEFINE_PER_CPU(u64, ia64_mca_pal_pte);	    /* PTE to map PAL code */
-DEFINE_PER_CPU(u64, ia64_mca_pal_base);    /* vaddr PAL code granule */
-
-unsigned long __per_cpu_mca[NR_CPUS];
-
-/* In mca_asm.S */
-extern void			ia64_monarch_init_handler (void);
-extern void			ia64_slave_init_handler (void);
-
-static ia64_mc_info_t		ia64_mc_info;
-
-#ifdef XEN
-#define jiffies			NOW()
-#undef HZ
-#define HZ			1000000000UL
-#endif
-
-#define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */
-#define MIN_CPE_POLL_INTERVAL (2*60*HZ)  /* 2 minutes */
-#define CMC_POLL_INTERVAL     (1*60*HZ)  /* 1 minute */
-#define CPE_HISTORY_LENGTH    5
-#define CMC_HISTORY_LENGTH    5
-
-#ifndef XEN 
-static struct timer_list cpe_poll_timer;
-static struct timer_list cmc_poll_timer;
-#else
-#define mod_timer(timer, expires)	set_timer(timer, expires)
-static struct timer cpe_poll_timer;
-static struct timer cmc_poll_timer;
-#endif
-/*
- * This variable tells whether we are currently in polling mode.
- * Start with this in the wrong state so we won't play w/ timers
- * before the system is ready.
- */
-static int cmc_polling_enabled = 1;
-
-/*
- * Clearing this variable prevents CPE polling from getting activated
- * in mca_late_init.  Use it if your system doesn't provide a CPEI,
- * but encounters problems retrieving CPE logs.  This should only be
- * necessary for debugging.
- */
-static int cpe_poll_enabled = 1;
-
-extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe);
-
-static int mca_init;
-
-/*
- * IA64_MCA log support
- */
-#define IA64_MAX_LOGS		2	/* Double-buffering for nested MCAs */
-#define IA64_MAX_LOG_TYPES      4   /* MCA, INIT, CMC, CPE */
-
-typedef struct ia64_state_log_s
-{
-	spinlock_t	isl_lock;
-	int		isl_index;
-	unsigned long	isl_count;
-	ia64_err_rec_t  *isl_log[IA64_MAX_LOGS]; /* need space to store header + error log */
-} ia64_state_log_t;
-
-static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES];
-
-#ifndef XEN
-#define IA64_LOG_ALLOCATE(it, size) \
-	{ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \
-		(ia64_err_rec_t *)alloc_bootmem(size); \
-	ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \
-		(ia64_err_rec_t *)alloc_bootmem(size);}
-#else
-#define IA64_LOG_ALLOCATE(it, size) \
-	do { \
-		unsigned int pageorder; \
-		struct page_info *page;	\
-		pageorder = get_order_from_bytes(size); \
-		page = alloc_domheap_pages(NULL, pageorder, 0); \
-		ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \
-			page? (ia64_err_rec_t *)page_to_virt(page): NULL;  \
-		page = alloc_domheap_pages(NULL, pageorder, 0); \
-		ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \
-			page? (ia64_err_rec_t *)page_to_virt(page): NULL; \
-	} while(0)
-#endif
-
-#define IA64_LOG_LOCK_INIT(it) spin_lock_init(&ia64_state_log[it].isl_lock)
-#define IA64_LOG_LOCK(it)      spin_lock_irqsave(&ia64_state_log[it].isl_lock, s)
-#define IA64_LOG_UNLOCK(it)    spin_unlock_irqrestore(&ia64_state_log[it].isl_lock,s)
-#define IA64_LOG_NEXT_INDEX(it)    ia64_state_log[it].isl_index
-#define IA64_LOG_CURR_INDEX(it)    1 - ia64_state_log[it].isl_index
-#define IA64_LOG_INDEX_INC(it) \
-    {ia64_state_log[it].isl_index = 1 - ia64_state_log[it].isl_index; \
-    ia64_state_log[it].isl_count++;}
-#define IA64_LOG_INDEX_DEC(it) \
-    ia64_state_log[it].isl_index = 1 - ia64_state_log[it].isl_index
-#define IA64_LOG_NEXT_BUFFER(it)   (void *)((ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)]))
-#define IA64_LOG_CURR_BUFFER(it)   (void *)((ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)]))
-#define IA64_LOG_COUNT(it)         ia64_state_log[it].isl_count
-
-#ifdef XEN
-sal_queue_entry_t sal_entry[NR_CPUS][IA64_MAX_LOG_TYPES];
-struct list_head *sal_queue, sal_log_queues[IA64_MAX_LOG_TYPES];
-sal_log_record_header_t *sal_record;
-DEFINE_SPINLOCK(sal_queue_lock);
-#endif
-
-/*
- * ia64_log_init
- *	Reset the OS ia64 log buffer
- * Inputs   :   info_type   (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE})
- * Outputs	:	None
- */
-static void
-ia64_log_init(int sal_info_type)
-{
-	u64	max_size = 0;
-
-	IA64_LOG_NEXT_INDEX(sal_info_type) = 0;
-	IA64_LOG_LOCK_INIT(sal_info_type);
-
-	// SAL will tell us the maximum size of any error record of this type
-	max_size = ia64_sal_get_state_info_size(sal_info_type);
-	if (!max_size)
-		/* alloc_bootmem() doesn't like zero-sized allocations! */
-		return;
-
-	// set up OS data structures to hold error info
-	IA64_LOG_ALLOCATE(sal_info_type, max_size);
-	memset(IA64_LOG_CURR_BUFFER(sal_info_type), 0, max_size);
-	memset(IA64_LOG_NEXT_BUFFER(sal_info_type), 0, max_size);
-
-#ifdef XEN
-	if (sal_record == NULL) {
-		unsigned int pageorder;
-		struct page_info *page;
-		pageorder  = get_order_from_bytes(max_size);
-		page = alloc_domheap_pages(NULL, pageorder, 0);
-		BUG_ON(page == NULL);
-		sal_record = (sal_log_record_header_t *)page_to_virt(page);
-		BUG_ON(sal_record == NULL);
-	}
-#endif
-}
-
-#ifndef XEN
-/*
- * ia64_log_get
- *
- *	Get the current MCA log from SAL and copy it into the OS log buffer.
- *
- *  Inputs  :   info_type   (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE})
- *              irq_safe    whether you can use printk at this point
- *  Outputs :   size        (total record length)
- *              *buffer     (ptr to error record)
- *
- */
-static u64
-ia64_log_get(int sal_info_type, u8 **buffer, int irq_safe)
-{
-	sal_log_record_header_t     *log_buffer;
-	u64                         total_len = 0;
-	int                         s;
-
-	IA64_LOG_LOCK(sal_info_type);
-
-	/* Get the process state information */
-	log_buffer = IA64_LOG_NEXT_BUFFER(sal_info_type);
-
-	total_len = ia64_sal_get_state_info(sal_info_type, (u64 *)log_buffer);
-
-	if (total_len) {
-		IA64_LOG_INDEX_INC(sal_info_type);
-		IA64_LOG_UNLOCK(sal_info_type);
-		if (irq_safe) {
-			IA64_MCA_DEBUG("%s: SAL error record type %d retrieved. "
-				       "Record length = %ld\n", __FUNCTION__, sal_info_type, total_len);
-		}
-		*buffer = (u8 *) log_buffer;
-		return total_len;
-	} else {
-		IA64_LOG_UNLOCK(sal_info_type);
-		return 0;
-	}
-}
-
-/*
- *  ia64_mca_log_sal_error_record
- *
- *  This function retrieves a specified error record type from SAL
- *  and wakes up any processes waiting for error records.
- *
- *  Inputs  :   sal_info_type   (Type of error record MCA/CMC/CPE/INIT)
- */
-static void
-ia64_mca_log_sal_error_record(int sal_info_type)
-{
-	u8 *buffer;
-	sal_log_record_header_t *rh;
-	u64 size;
-	int irq_safe = sal_info_type != SAL_INFO_TYPE_MCA && sal_info_type != SAL_INFO_TYPE_INIT;
-#ifdef IA64_MCA_DEBUG_INFO
-	static const char * const rec_name[] = { "MCA", "INIT", "CMC", "CPE" };
-#endif
-
-	size = ia64_log_get(sal_info_type, &buffer, irq_safe);
-	if (!size)
-		return;
-
-	salinfo_log_wakeup(sal_info_type, buffer, size, irq_safe);
-
-	if (irq_safe)
-		IA64_MCA_DEBUG("CPU %d: SAL log contains %s error record\n",
-			smp_processor_id(),
-			sal_info_type < ARRAY_SIZE(rec_name) ? rec_name[sal_info_type] : "UNKNOWN");
-
-	/* Clear logs from corrected errors in case there's no user-level logger */
-	rh = (sal_log_record_header_t *)buffer;
-	if (rh->severity == sal_log_severity_corrected)
-		ia64_sal_clear_state_info(sal_info_type);
-}
-#else /* !XEN */
-/*
- * ia64_log_queue
- *
- *	Get the current MCA log from SAL and copy it into the OS log buffer.
- *
- *  Inputs  :   info_type   (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE})
- *  Outputs :   size        (total record length)
- *              *buffer     (ptr to error record)
- *
- */
-static u64
-ia64_log_queue(int sal_info_type, int virq)
-{
-	sal_log_record_header_t     *log_buffer;
-	u64                         total_len = 0;
-	int                         s;
-	sal_queue_entry_t	    *e;
-	unsigned long		    flags;
-
-	IA64_LOG_LOCK(sal_info_type);
-
-	/* Get the process state information */
-	log_buffer = IA64_LOG_NEXT_BUFFER(sal_info_type);
-
-	total_len = ia64_sal_get_state_info(sal_info_type, (u64 *)log_buffer);
-
-	if (total_len) {
-		int queue_type;
-		int cpuid = smp_processor_id();
-
-		spin_lock_irqsave(&sal_queue_lock, flags);
-
-		if (sal_info_type == SAL_INFO_TYPE_MCA && virq == VIRQ_MCA_CMC)
-			queue_type = SAL_INFO_TYPE_CMC;
-		else
-			queue_type = sal_info_type;
-
-		/* Skip if sal_entry is already listed in sal_queue */
-		list_for_each_entry(e, &sal_queue[queue_type], list) {
-			if (e == &sal_entry[cpuid][queue_type])
-				goto found;
-		}
-		e = &sal_entry[cpuid][queue_type];
-		memset(e, 0, sizeof(sal_queue_entry_t));
-		e->cpuid = cpuid;
-		e->sal_info_type = sal_info_type;
-		e->vector = IA64_CMC_VECTOR;
-		e->virq = virq;
-		e->length = total_len;
-
-		list_add_tail(&e->list, &sal_queue[queue_type]);
-
-	found:
-		spin_unlock_irqrestore(&sal_queue_lock, flags);
-
-		IA64_LOG_INDEX_INC(sal_info_type);
-		IA64_LOG_UNLOCK(sal_info_type);
-		if (sal_info_type != SAL_INFO_TYPE_MCA &&
-		    sal_info_type != SAL_INFO_TYPE_INIT) {
-			IA64_MCA_DEBUG("%s: SAL error record type %d retrieved. "
-				       "Record length = %ld\n", __FUNCTION__,
-			               sal_info_type, total_len);
-		}
-		return total_len;
-	} else {
-		IA64_LOG_UNLOCK(sal_info_type);
-		return 0;
-	}
-}
-#endif /* !XEN */
-
-/*
- * platform dependent error handling
- */
-#ifndef PLATFORM_MCA_HANDLERS
-
-#ifdef CONFIG_ACPI
-
-#ifdef XEN
-/**
- *	Copy from linux/kernel/irq/manage.c
- *
- *	disable_irq_nosync - disable an irq without waiting
- *	@irq: Interrupt to disable
- *
- *	Disable the selected interrupt line.  Disables and Enables are
- *	nested.
- *	Unlike disable_irq(), this function does not ensure existing
- *	instances of the IRQ handler have completed before returning.
- *
- *	This function may be called from IRQ context.
- */
-void disable_irq_nosync(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	if (irq >= NR_IRQS)
-		return;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	if (!desc->arch.depth++) {
-		desc->status |= IRQ_DISABLED;
-		desc->handler->disable(desc);
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/**
- *	Copy from linux/kernel/irq/manage.c
- *
- *	enable_irq - enable handling of an irq
- *	@irq: Interrupt to enable
- *
- *	Undoes the effect of one call to disable_irq().  If this
- *	matches the last disable, processing of interrupts on this
- *	IRQ line is re-enabled.
- *
- *	This function may be called from IRQ context.
- */
-void enable_irq(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	if (irq >= NR_IRQS)
-		return;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	switch (desc->arch.depth) {
-	case 0:
-		WARN_ON(1);
-		break;
-	case 1: {
-		unsigned int status = desc->status & ~IRQ_DISABLED;
-
-		desc->status = status;
-		if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
-			desc->status = status | IRQ_REPLAY;
-			hw_resend_irq(desc->handler,irq);
-		}
-		desc->handler->enable(desc);
-		/* fall-through */
-	}
-	default:
-		desc->arch.depth--;
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-#endif	/* XEN */
-
-int cpe_vector = -1;
-
-static irqreturn_t
-ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)
-{
-	static unsigned long	cpe_history[CPE_HISTORY_LENGTH];
-	static int		index;
-	static DEFINE_SPINLOCK(cpe_history_lock);
-
-	IA64_MCA_DEBUG("%s: received interrupt vector = %#x on CPU %d\n",
-		       __FUNCTION__, cpe_irq, smp_processor_id());
-
-	/* SAL spec states this should run w/ interrupts enabled */
-	local_irq_enable();
-
-#ifndef XEN
-	/* Get the CPE error record and log it */
-	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CPE);
-#else
-	ia64_log_queue(SAL_INFO_TYPE_CPE, VIRQ_MCA_CPE);
-	/* CPE error does not inform to dom0 but the following codes are 
-	   reserved for future implementation */
-/* 	send_guest_vcpu_virq(dom0->vcpu[0], VIRQ_MCA_CPE); */
-#endif
-
-	spin_lock(&cpe_history_lock);
-	if (!cpe_poll_enabled && cpe_vector >= 0) {
-
-		int i, count = 1; /* we know 1 happened now */
-		unsigned long now = jiffies;
-
-		for (i = 0; i < CPE_HISTORY_LENGTH; i++) {
-			if (now - cpe_history[i] <= HZ)
-				count++;
-		}
-
-		IA64_MCA_DEBUG(KERN_INFO "CPE threshold %d/%d\n", count, CPE_HISTORY_LENGTH);
-		if (count >= CPE_HISTORY_LENGTH) {
-
-			cpe_poll_enabled = 1;
-			spin_unlock(&cpe_history_lock);
-			disable_irq_nosync(local_vector_to_irq(IA64_CPE_VECTOR));
-
-			/*
-			 * Corrected errors will still be corrected, but
-			 * make sure there's a log somewhere that indicates
-			 * something is generating more than we can handle.
-			 */
-			printk(KERN_WARNING "WARNING: Switching to polling CPE handler; error records may be lost\n");
-
-			mod_timer(&cpe_poll_timer, jiffies + MIN_CPE_POLL_INTERVAL);
-
-			/* lock already released, get out now */
-			return IRQ_HANDLED;
-		} else {
-			cpe_history[index++] = now;
-			if (index == CPE_HISTORY_LENGTH)
-				index = 0;
-		}
-	}
-	spin_unlock(&cpe_history_lock);
-	return IRQ_HANDLED;
-}
-
-#endif /* CONFIG_ACPI */
-
-static void
-show_min_state (pal_min_state_area_t *minstate)
-{
-	u64 iip = minstate->pmsa_iip + ((struct ia64_psr *)(&minstate->pmsa_ipsr))->ri;
-	u64 xip = minstate->pmsa_xip + ((struct ia64_psr *)(&minstate->pmsa_xpsr))->ri;
-
-	printk("NaT bits\t%016lx\n", minstate->pmsa_nat_bits);
-	printk("pr\t\t%016lx\n", minstate->pmsa_pr);
-	printk("b0\t\t%016lx ", minstate->pmsa_br0); print_symbol("%s\n", minstate->pmsa_br0);
-	printk("ar.rsc\t\t%016lx\n", minstate->pmsa_rsc);
-	printk("cr.iip\t\t%016lx ", iip); print_symbol("%s\n", iip);
-	printk("cr.ipsr\t\t%016lx\n", minstate->pmsa_ipsr);
-	printk("cr.ifs\t\t%016lx\n", minstate->pmsa_ifs);
-	printk("xip\t\t%016lx ", xip); print_symbol("%s\n", xip);
-	printk("xpsr\t\t%016lx\n", minstate->pmsa_xpsr);
-	printk("xfs\t\t%016lx\n", minstate->pmsa_xfs);
-	printk("b1\t\t%016lx ", minstate->pmsa_br1);
-	print_symbol("%s\n", minstate->pmsa_br1);
-
-	printk("\nstatic registers r0-r15:\n");
-	printk(" r0- 3 %016lx %016lx %016lx %016lx\n",
-	       0UL, minstate->pmsa_gr[0], minstate->pmsa_gr[1], minstate->pmsa_gr[2]);
-	printk(" r4- 7 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_gr[3], minstate->pmsa_gr[4],
-	       minstate->pmsa_gr[5], minstate->pmsa_gr[6]);
-	printk(" r8-11 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_gr[7], minstate->pmsa_gr[8],
-	       minstate->pmsa_gr[9], minstate->pmsa_gr[10]);
-	printk("r12-15 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_gr[11], minstate->pmsa_gr[12],
-	       minstate->pmsa_gr[13], minstate->pmsa_gr[14]);
-
-	printk("\nbank 0:\n");
-	printk("r16-19 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[0], minstate->pmsa_bank0_gr[1],
-	       minstate->pmsa_bank0_gr[2], minstate->pmsa_bank0_gr[3]);
-	printk("r20-23 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[4], minstate->pmsa_bank0_gr[5],
-	       minstate->pmsa_bank0_gr[6], minstate->pmsa_bank0_gr[7]);
-	printk("r24-27 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[8], minstate->pmsa_bank0_gr[9],
-	       minstate->pmsa_bank0_gr[10], minstate->pmsa_bank0_gr[11]);
-	printk("r28-31 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[12], minstate->pmsa_bank0_gr[13],
-	       minstate->pmsa_bank0_gr[14], minstate->pmsa_bank0_gr[15]);
-
-	printk("\nbank 1:\n");
-	printk("r16-19 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[0], minstate->pmsa_bank1_gr[1],
-	       minstate->pmsa_bank1_gr[2], minstate->pmsa_bank1_gr[3]);
-	printk("r20-23 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[4], minstate->pmsa_bank1_gr[5],
-	       minstate->pmsa_bank1_gr[6], minstate->pmsa_bank1_gr[7]);
-	printk("r24-27 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[8], minstate->pmsa_bank1_gr[9],
-	       minstate->pmsa_bank1_gr[10], minstate->pmsa_bank1_gr[11]);
-	printk("r28-31 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[12], minstate->pmsa_bank1_gr[13],
-	       minstate->pmsa_bank1_gr[14], minstate->pmsa_bank1_gr[15]);
-}
-
-static void
-fetch_min_state (pal_min_state_area_t *ms, struct pt_regs *pt, struct switch_stack *sw)
-{
-	u64 *dst_banked, *src_banked, bit, shift, nat_bits;
-	int i;
-
-	/*
-	 * First, update the pt-regs and switch-stack structures with the contents stored
-	 * in the min-state area:
-	 */
-	if (((struct ia64_psr *) &ms->pmsa_ipsr)->ic == 0) {
-		pt->cr_ipsr = ms->pmsa_xpsr;
-		pt->cr_iip = ms->pmsa_xip;
-		pt->cr_ifs = ms->pmsa_xfs;
-	} else {
-		pt->cr_ipsr = ms->pmsa_ipsr;
-		pt->cr_iip = ms->pmsa_iip;
-		pt->cr_ifs = ms->pmsa_ifs;
-	}
-	pt->ar_rsc = ms->pmsa_rsc;
-	pt->pr = ms->pmsa_pr;
-	pt->r1 = ms->pmsa_gr[0];
-	pt->r2 = ms->pmsa_gr[1];
-	pt->r3 = ms->pmsa_gr[2];
-	sw->r4 = ms->pmsa_gr[3];
-	sw->r5 = ms->pmsa_gr[4];
-	sw->r6 = ms->pmsa_gr[5];
-	sw->r7 = ms->pmsa_gr[6];
-	pt->r8 = ms->pmsa_gr[7];
-	pt->r9 = ms->pmsa_gr[8];
-	pt->r10 = ms->pmsa_gr[9];
-	pt->r11 = ms->pmsa_gr[10];
-	pt->r12 = ms->pmsa_gr[11];
-	pt->r13 = ms->pmsa_gr[12];
-	pt->r14 = ms->pmsa_gr[13];
-	pt->r15 = ms->pmsa_gr[14];
-	dst_banked = &pt->r16;		/* r16-r31 are contiguous in struct pt_regs */
-	src_banked = ms->pmsa_bank1_gr;
-	for (i = 0; i < 16; ++i)
-		dst_banked[i] = src_banked[i];
-	pt->b0 = ms->pmsa_br0;
-	sw->b1 = ms->pmsa_br1;
-
-	/* construct the NaT bits for the pt-regs structure: */
-#	define PUT_NAT_BIT(dst, addr)					\
-	do {								\
-		bit = nat_bits & 1; nat_bits >>= 1;			\
-		shift = ((unsigned long) addr >> 3) & 0x3f;		\
-		dst = ((dst) & ~(1UL << shift)) | (bit << shift);	\
-	} while (0)
-
-	/* Rotate the saved NaT bits such that bit 0 corresponds to pmsa_gr[0]: */
-	shift = ((unsigned long) &ms->pmsa_gr[0] >> 3) & 0x3f;
-	nat_bits = (ms->pmsa_nat_bits >> shift) | (ms->pmsa_nat_bits << (64 - shift));
-
-	PUT_NAT_BIT(sw->caller_unat, &pt->r1);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r2);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r3);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r4);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r5);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r6);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r7);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r8);	PUT_NAT_BIT(sw->caller_unat, &pt->r9);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r10);	PUT_NAT_BIT(sw->caller_unat, &pt->r11);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r12);	PUT_NAT_BIT(sw->caller_unat, &pt->r13);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r14);	PUT_NAT_BIT(sw->caller_unat, &pt->r15);
-	nat_bits >>= 16;	/* skip over bank0 NaT bits */
-	PUT_NAT_BIT(sw->caller_unat, &pt->r16);	PUT_NAT_BIT(sw->caller_unat, &pt->r17);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r18);	PUT_NAT_BIT(sw->caller_unat, &pt->r19);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r20);	PUT_NAT_BIT(sw->caller_unat, &pt->r21);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r22);	PUT_NAT_BIT(sw->caller_unat, &pt->r23);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r24);	PUT_NAT_BIT(sw->caller_unat, &pt->r25);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r26);	PUT_NAT_BIT(sw->caller_unat, &pt->r27);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r28);	PUT_NAT_BIT(sw->caller_unat, &pt->r29);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r30);	PUT_NAT_BIT(sw->caller_unat, &pt->r31);
-}
-
-#ifdef XEN
-static spinlock_t init_dump_lock = SPIN_LOCK_UNLOCKED;
-static spinlock_t show_stack_lock = SPIN_LOCK_UNLOCKED;
-static atomic_t num_stopped_cpus = ATOMIC_INIT(0);
-extern void show_stack (struct task_struct *, unsigned long *);
-
-#define CPU_FLUSH_RETRY_MAX 5
-static void
-init_cache_flush (void)
-{
-	unsigned long flags;
-	int i;
-	s64 rval = 0;
-	u64 vector, progress = 0;
-
-	for (i = 0; i < CPU_FLUSH_RETRY_MAX; i++) {
-		local_irq_save(flags);
-		rval = ia64_pal_cache_flush(PAL_CACHE_TYPE_INSTRUCTION_DATA,
-		                            0, &progress, &vector);
-		local_irq_restore(flags);
-		if (rval == 0){
-			printk("\nPAL cache flush success\n");
-			return;
-		}
-	}
-	printk("\nPAL cache flush failed. status=%ld\n",rval);
-}
-
-static void inline
-save_ksp (struct unw_frame_info *info)
-{
-	current->arch._thread.ksp = (__u64)(info->sw) - 16;
-	wmb();
-	init_cache_flush();
-}	
-
-static void
-freeze_cpu_osinit (struct unw_frame_info *info, void *arg)
-{
-	save_ksp(info);
-	atomic_inc(&num_stopped_cpus);
-	printk("%s: CPU%d init handler done\n",
-	       __FUNCTION__, smp_processor_id());
-	for (;;)
-		local_irq_disable();
-}
-
-/* FIXME */
-static void
-try_crashdump(struct unw_frame_info *info, void *arg)
-{ 
-	save_ksp(info);
-	printk("\nINIT dump complete.  Please reboot now.\n");
-	for (;;)
-		local_irq_disable();
-}
-#endif /* XEN */
-
-static void
-init_handler_platform (pal_min_state_area_t *ms,
-		       struct pt_regs *pt, struct switch_stack *sw)
-{
-	struct unw_frame_info info;
-
-	/* if a kernel debugger is available call it here else just dump the registers */
-
-	/*
-	 * Wait for a bit.  On some machines (e.g., HP's zx2000 and zx6000, INIT can be
-	 * generated via the BMC's command-line interface, but since the console is on the
-	 * same serial line, the user will need some time to switch out of the BMC before
-	 * the dump begins.
-	 */
-	printk("Delaying for 5 seconds...\n");
-	udelay(5*1000000);
-#ifdef XEN
-	fetch_min_state(ms, pt, sw);
-	spin_lock(&show_stack_lock);
-#endif
-	show_min_state(ms);
-
-#ifdef XEN
-	printk("Backtrace of current vcpu (vcpu_id %d of domid %d)\n",
-	       current->vcpu_id, current->domain->domain_id);
-#else
-	printk("Backtrace of current task (pid %d, %s)\n", current->pid, current->comm);
-	fetch_min_state(ms, pt, sw);
-#endif
-	unw_init_from_interruption(&info, current, pt, sw);
-	ia64_do_show_stack(&info, NULL);
-#ifdef XEN
-	spin_unlock(&show_stack_lock);
-
-	if (spin_trylock(&init_dump_lock)) {
-		struct domain *d;
-		struct vcpu *v;
-#ifdef CONFIG_SMP
-		int other_cpus = num_online_cpus() - 1;
-		int wait = 1000 * other_cpus;
-
-		while ((atomic_read(&num_stopped_cpus) != other_cpus) && wait--)
-			udelay(1000);
-		if (other_cpus && wait < 0)
-			printk("timeout %d\n", atomic_read(&num_stopped_cpus));
-#endif
-		if (opt_noreboot) {
-			/* this route is for dump routine */
-			unw_init_running(try_crashdump, pt);
-		} else {
-			rcu_read_lock(&domlist_read_lock);
-			for_each_domain(d) {
-				for_each_vcpu(d, v) {
-					printk("Backtrace of current vcpu "
-					       "(vcpu_id %d of domid %d)\n",
-					       v->vcpu_id, d->domain_id);
-					show_stack(v, NULL);
-				}
-			}
-			rcu_read_unlock(&domlist_read_lock);
-		}
-	}
-	unw_init_running(freeze_cpu_osinit, NULL);
-#else /* XEN */
-#ifdef CONFIG_SMP
-	/* read_trylock() would be handy... */
-	if (!tasklist_lock.write_lock)
-		read_lock(&tasklist_lock);
-#endif
-	{
-		struct task_struct *g, *t;
-		do_each_thread (g, t) {
-			if (t == current)
-				continue;
-
-			printk("\nBacktrace of pid %d (%s)\n", t->pid, t->comm);
-			show_stack(t, NULL);
-		} while_each_thread (g, t);
-	}
-#ifdef CONFIG_SMP
-	if (!tasklist_lock.write_lock)
-		read_unlock(&tasklist_lock);
-#endif
-
-	printk("\nINIT dump complete.  Please reboot now.\n");
-#endif /* XEN */
-	while (1);			/* hang city if no debugger */
-}
-
-#ifdef CONFIG_ACPI
-/*
- * ia64_mca_register_cpev
- *
- *  Register the corrected platform error vector with SAL.
- *
- *  Inputs
- *      cpev        Corrected Platform Error Vector number
- *
- *  Outputs
- *      None
- */
-static void
-ia64_mca_register_cpev (int cpev)
-{
-	/* Register the CPE interrupt vector with SAL */
-	struct ia64_sal_retval isrv;
-
-	isrv = ia64_sal_mc_set_params(SAL_MC_PARAM_CPE_INT, SAL_MC_PARAM_MECHANISM_INT, cpev, 0, 0);
-	if (isrv.status) {
-		printk(KERN_ERR "Failed to register Corrected Platform "
-		       "Error interrupt vector with SAL (status %ld)\n", isrv.status);
-		return;
-	}
-
-	IA64_MCA_DEBUG("%s: corrected platform error "
-		       "vector %#x registered\n", __FUNCTION__, cpev);
-}
-#endif /* CONFIG_ACPI */
-
-#endif /* PLATFORM_MCA_HANDLERS */
-
-/*
- * ia64_mca_cmc_vector_setup
- *
- *  Setup the corrected machine check vector register in the processor.
- *  (The interrupt is masked on boot. ia64_mca_late_init unmask this.)
- *  This function is invoked on a per-processor basis.
- *
- * Inputs
- *      None
- *
- * Outputs
- *	None
- */
-void
-ia64_mca_cmc_vector_setup (void)
-{
-	cmcv_reg_t	cmcv;
-
-	cmcv.cmcv_regval	= 0;
-	cmcv.cmcv_mask		= 1;        /* Mask/disable interrupt at first */
-	cmcv.cmcv_vector	= IA64_CMC_VECTOR;
-	ia64_setreg(_IA64_REG_CR_CMCV, cmcv.cmcv_regval);
-
-	IA64_MCA_DEBUG("%s: CPU %d corrected "
-		       "machine check vector %#x registered.\n",
-		       __FUNCTION__, smp_processor_id(), IA64_CMC_VECTOR);
-
-	IA64_MCA_DEBUG("%s: CPU %d CMCV = %#016lx\n",
-		       __FUNCTION__, smp_processor_id(), ia64_getreg(_IA64_REG_CR_CMCV));
-}
-
-/*
- * ia64_mca_cmc_vector_disable
- *
- *  Mask the corrected machine check vector register in the processor.
- *  This function is invoked on a per-processor basis.
- *
- * Inputs
- *      dummy(unused)
- *
- * Outputs
- *	None
- */
-static void
-ia64_mca_cmc_vector_disable (void *dummy)
-{
-	cmcv_reg_t	cmcv;
-
-	cmcv.cmcv_regval = ia64_getreg(_IA64_REG_CR_CMCV);
-
-	cmcv.cmcv_mask = 1; /* Mask/disable interrupt */
-	ia64_setreg(_IA64_REG_CR_CMCV, cmcv.cmcv_regval);
-
-	IA64_MCA_DEBUG("%s: CPU %d corrected "
-		       "machine check vector %#x disabled.\n",
-		       __FUNCTION__, smp_processor_id(), cmcv.cmcv_vector);
-}
-
-/*
- * ia64_mca_cmc_vector_enable
- *
- *  Unmask the corrected machine check vector register in the processor.
- *  This function is invoked on a per-processor basis.
- *
- * Inputs
- *      dummy(unused)
- *
- * Outputs
- *	None
- */
-static void
-ia64_mca_cmc_vector_enable (void *dummy)
-{
-	cmcv_reg_t	cmcv;
-
-	cmcv.cmcv_regval = ia64_getreg(_IA64_REG_CR_CMCV);
-
-	cmcv.cmcv_mask = 0; /* Unmask/enable interrupt */
-	ia64_setreg(_IA64_REG_CR_CMCV, cmcv.cmcv_regval);
-
-	IA64_MCA_DEBUG("%s: CPU %d corrected "
-		       "machine check vector %#x enabled.\n",
-		       __FUNCTION__, smp_processor_id(), cmcv.cmcv_vector);
-}
-
-#ifndef XEN
-/*
- * ia64_mca_cmc_vector_disable_keventd
- *
- * Called via keventd (smp_call_function() is not safe in interrupt context) to
- * disable the cmc interrupt vector.
- */
-static void
-ia64_mca_cmc_vector_disable_keventd(void *unused)
-{
-	on_each_cpu(ia64_mca_cmc_vector_disable, NULL, 0);
-}
-
-/*
- * ia64_mca_cmc_vector_enable_keventd
- *
- * Called via keventd (smp_call_function() is not safe in interrupt context) to
- * enable the cmc interrupt vector.
- */
-static void
-ia64_mca_cmc_vector_enable_keventd(void *unused)
-{
-	on_each_cpu(ia64_mca_cmc_vector_enable, NULL, 0);
-}
-#endif /* !XEN	*/
-
-/*
- * ia64_mca_wakeup_ipi_wait
- *
- *	Wait for the inter-cpu interrupt to be sent by the
- *	monarch processor once it is done with handling the
- *	MCA.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-static void
-ia64_mca_wakeup_ipi_wait(void)
-{
-	int	irr_num = (IA64_MCA_WAKEUP_VECTOR >> 6);
-	int	irr_bit = (IA64_MCA_WAKEUP_VECTOR & 0x3f);
-	u64	irr = 0;
-
-	do {
-		switch(irr_num) {
-		      case 0:
-			irr = ia64_getreg(_IA64_REG_CR_IRR0);
-			break;
-		      case 1:
-			irr = ia64_getreg(_IA64_REG_CR_IRR1);
-			break;
-		      case 2:
-			irr = ia64_getreg(_IA64_REG_CR_IRR2);
-			break;
-		      case 3:
-			irr = ia64_getreg(_IA64_REG_CR_IRR3);
-			break;
-		}
-		cpu_relax();
-	} while (!(irr & (1UL << irr_bit))) ;
-}
-
-/*
- * ia64_mca_wakeup
- *
- *	Send an inter-cpu interrupt to wake-up a particular cpu
- *	and mark that cpu to be out of rendez.
- *
- *  Inputs  :   cpuid
- *  Outputs :   None
- */
-static void
-ia64_mca_wakeup(int cpu)
-{
-	platform_send_ipi(cpu, IA64_MCA_WAKEUP_VECTOR, IA64_IPI_DM_INT, 0);
-	ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
-
-}
-
-/*
- * ia64_mca_wakeup_all
- *
- *	Wakeup all the cpus which have rendez'ed previously.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-static void
-ia64_mca_wakeup_all(void)
-{
-	int cpu;
-
-	/* Clear the Rendez checkin flag for all cpus */
-	for(cpu = 0; cpu < NR_CPUS; cpu++) {
-		if (!cpu_online(cpu))
-			continue;
-		if (ia64_mc_info.imi_rendez_checkin[cpu] == IA64_MCA_RENDEZ_CHECKIN_DONE)
-			ia64_mca_wakeup(cpu);
-	}
-
-}
-
-/*
- * ia64_mca_rendez_interrupt_handler
- *
- *	This is handler used to put slave processors into spinloop
- *	while the monarch processor does the mca handling and later
- *	wake each slave up once the monarch is done.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-static irqreturn_t
-ia64_mca_rendez_int_handler(int rendez_irq, void *arg, struct pt_regs *ptregs)
-{
-	unsigned long flags;
-	int cpu = smp_processor_id();
-
-	/* Mask all interrupts */
-	local_irq_save(flags);
-
-	ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_DONE;
-	/* Register with the SAL monarch that the slave has
-	 * reached SAL
-	 */
-	ia64_sal_mc_rendez();
-
-	/* Wait for the wakeup IPI from the monarch
-	 * This waiting is done by polling on the wakeup-interrupt
-	 * vector bit in the processor's IRRs
-	 */
-	ia64_mca_wakeup_ipi_wait();
-
-	/* Enable all interrupts */
-	local_irq_restore(flags);
-	return IRQ_HANDLED;
-}
-
-/*
- * ia64_mca_wakeup_int_handler
- *
- *	The interrupt handler for processing the inter-cpu interrupt to the
- *	slave cpu which was spinning in the rendez loop.
- *	Since this spinning is done by turning off the interrupts and
- *	polling on the wakeup-interrupt bit in the IRR, there is
- *	nothing useful to be done in the handler.
- *
- *  Inputs  :   wakeup_irq  (Wakeup-interrupt bit)
- *	arg		(Interrupt handler specific argument)
- *	ptregs		(Exception frame at the time of the interrupt)
- *  Outputs :   None
- *
- */
-static irqreturn_t
-ia64_mca_wakeup_int_handler(int wakeup_irq, void *arg, struct pt_regs *ptregs)
-{
-	return IRQ_HANDLED;
-}
-
-/*
- * ia64_return_to_sal_check
- *
- *	This is function called before going back from the OS_MCA handler
- *	to the OS_MCA dispatch code which finally takes the control back
- *	to the SAL.
- *	The main purpose of this routine is to setup the OS_MCA to SAL
- *	return state which can be used by the OS_MCA dispatch code
- *	just before going back to SAL.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-
-static void
-ia64_return_to_sal_check(int recover)
-{
-#ifdef XEN
-	int cpu = smp_processor_id();
-#endif
-
-	/* Copy over some relevant stuff from the sal_to_os_mca_handoff
-	 * so that it can be used at the time of os_mca_to_sal_handoff
-	 */
-#ifdef XEN
-	ia64_os_to_sal_handoff_state.imots_sal_gp =
-		ia64_sal_to_os_handoff_state[cpu].imsto_sal_gp;
-
-	ia64_os_to_sal_handoff_state.imots_sal_check_ra =
-		ia64_sal_to_os_handoff_state[cpu].imsto_sal_check_ra;
-#else
-	ia64_os_to_sal_handoff_state.imots_sal_gp =
-		ia64_sal_to_os_handoff_state.imsto_sal_gp;
-
-	ia64_os_to_sal_handoff_state.imots_sal_check_ra =
-		ia64_sal_to_os_handoff_state.imsto_sal_check_ra;
-#endif
-
-	if (recover)
-		ia64_os_to_sal_handoff_state.imots_os_status = IA64_MCA_CORRECTED;
-	else
-		ia64_os_to_sal_handoff_state.imots_os_status = IA64_MCA_COLD_BOOT;
-
-	/* Default = tell SAL to return to same context */
-	ia64_os_to_sal_handoff_state.imots_context = IA64_MCA_SAME_CONTEXT;
-
-#ifdef XEN
-	ia64_os_to_sal_handoff_state.imots_new_min_state =
-		(u64 *)ia64_sal_to_os_handoff_state[cpu].pal_min_state;
-#else
-	ia64_os_to_sal_handoff_state.imots_new_min_state =
-		(u64 *)ia64_sal_to_os_handoff_state.pal_min_state;
-#endif
-
-}
-
-/* Function pointer for extra MCA recovery */
-int (*ia64_mca_ucmc_extension)
-	(void*,ia64_mca_sal_to_os_state_t*,ia64_mca_os_to_sal_state_t*)
-	= NULL;
-
-int
-ia64_reg_MCA_extension(void *fn)
-{
-	if (ia64_mca_ucmc_extension)
-		return 1;
-
-	ia64_mca_ucmc_extension = fn;
-	return 0;
-}
-
-void
-ia64_unreg_MCA_extension(void)
-{
-	if (ia64_mca_ucmc_extension)
-		ia64_mca_ucmc_extension = NULL;
-}
-
-EXPORT_SYMBOL(ia64_reg_MCA_extension);
-EXPORT_SYMBOL(ia64_unreg_MCA_extension);
-
-/*
- * ia64_mca_ucmc_handler
- *
- *	This is uncorrectable machine check handler called from OS_MCA
- *	dispatch code which is in turn called from SAL_CHECK().
- *	This is the place where the core of OS MCA handling is done.
- *	Right now the logs are extracted and displayed in a well-defined
- *	format. This handler code is supposed to be run only on the
- *	monarch processor. Once the monarch is done with MCA handling
- *	further MCA logging is enabled by clearing logs.
- *	Monarch also has the duty of sending wakeup-IPIs to pull the
- *	slave processors out of rendezvous spinloop.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-void
-ia64_mca_ucmc_handler(void)
-{
-#ifdef XEN
-	int cpu = smp_processor_id();
-	pal_processor_state_info_t *psp = (pal_processor_state_info_t *)
-		&ia64_sal_to_os_handoff_state[cpu].proc_state_param;
-#else
-	pal_processor_state_info_t *psp = (pal_processor_state_info_t *)
-		&ia64_sal_to_os_handoff_state.proc_state_param;
-#endif
-	int recover; 
-
-#ifndef XEN
-	/* Get the MCA error record and log it */
-	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA);
-#else
-	ia64_log_queue(SAL_INFO_TYPE_MCA, VIRQ_MCA_CMC);
-	send_guest_vcpu_virq(dom0->vcpu[0], VIRQ_MCA_CMC);
-#endif
-
-	/* TLB error is only exist in this SAL error record */
-	recover = (psp->tc && !(psp->cc || psp->bc || psp->rc || psp->uc))
-	/* other error recovery */
-#ifndef XEN
-	   || (ia64_mca_ucmc_extension 
-		&& ia64_mca_ucmc_extension(
-			IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA),
-			&ia64_sal_to_os_handoff_state,
-			&ia64_os_to_sal_handoff_state)); 
-#else
-	;
-#endif
-
-#ifndef XEN
-	if (recover) {
-		sal_log_record_header_t *rh = IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA);
-		rh->severity = sal_log_severity_corrected;
-		ia64_sal_clear_state_info(SAL_INFO_TYPE_MCA);
-	}
-#endif
-	/*
-	 *  Wakeup all the processors which are spinning in the rendezvous
-	 *  loop.
-	 */
-	ia64_mca_wakeup_all();
-
-	/* Return to SAL */
-	ia64_return_to_sal_check(recover);
-}
-
-#ifndef XEN
-static DECLARE_WORK(cmc_disable_work, ia64_mca_cmc_vector_disable_keventd, NULL);
-static DECLARE_WORK(cmc_enable_work, ia64_mca_cmc_vector_enable_keventd, NULL);
-#endif
-
-/*
- * ia64_mca_cmc_int_handler
- *
- *  This is corrected machine check interrupt handler.
- *	Right now the logs are extracted and displayed in a well-defined
- *	format.
- *
- * Inputs
- *      interrupt number
- *      client data arg ptr
- *      saved registers ptr
- *
- * Outputs
- *	None
- */
-static irqreturn_t
-ia64_mca_cmc_int_handler(int cmc_irq, void *arg, struct pt_regs *ptregs)
-{
-	static unsigned long	cmc_history[CMC_HISTORY_LENGTH];
-	static int		index;
-	static DEFINE_SPINLOCK(cmc_history_lock);
-
-	IA64_MCA_DEBUG("%s: received interrupt vector = %#x on CPU %d\n",
-		       __FUNCTION__, cmc_irq, smp_processor_id());
-
-	/* SAL spec states this should run w/ interrupts enabled */
-	local_irq_enable();
-
-#ifndef XEN	
-	/* Get the CMC error record and log it */
-	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC);
-#else
-	ia64_log_queue(SAL_INFO_TYPE_CMC, VIRQ_MCA_CMC);
-	send_guest_vcpu_virq(dom0->vcpu[0], VIRQ_MCA_CMC);
-#endif
-
-	spin_lock(&cmc_history_lock);
-	if (!cmc_polling_enabled) {
-		int i, count = 1; /* we know 1 happened now */
-		unsigned long now = jiffies;
-
-		for (i = 0; i < CMC_HISTORY_LENGTH; i++) {
-			if (now - cmc_history[i] <= HZ)
-				count++;
-		}
-
-		IA64_MCA_DEBUG(KERN_INFO "CMC threshold %d/%d\n", count, CMC_HISTORY_LENGTH);
-		if (count >= CMC_HISTORY_LENGTH) {
-
-			cmc_polling_enabled = 1;
-			spin_unlock(&cmc_history_lock);
-#ifndef XEN	/* XXX FIXME */
-			schedule_work(&cmc_disable_work);
-#else
-			cpumask_raise_softirq(&cpu_online_map,
-			                      CMC_DISABLE_SOFTIRQ);
-#endif
-
-			/*
-			 * Corrected errors will still be corrected, but
-			 * make sure there's a log somewhere that indicates
-			 * something is generating more than we can handle.
-			 */
-			printk(KERN_WARNING "WARNING: Switching to polling CMC handler; error records may be lost\n");
-
-			mod_timer(&cmc_poll_timer, jiffies + CMC_POLL_INTERVAL);
-
-			/* lock already released, get out now */
-			return IRQ_HANDLED;
-		} else {
-			cmc_history[index++] = now;
-			if (index == CMC_HISTORY_LENGTH)
-				index = 0;
-		}
-	}
-	spin_unlock(&cmc_history_lock);
-	return IRQ_HANDLED;
-}
-
-/*
- *  ia64_mca_cmc_int_caller
- *
- * 	Triggered by sw interrupt from CMC polling routine.  Calls
- * 	real interrupt handler and either triggers a sw interrupt
- * 	on the next cpu or does cleanup at the end.
- *
- * Inputs
- *	interrupt number
- *	client data arg ptr
- *	saved registers ptr
- * Outputs
- * 	handled
- */
-static irqreturn_t
-ia64_mca_cmc_int_caller(int cmc_irq, void *arg, struct pt_regs *ptregs)
-{
-	static int start_count = -1;
-	unsigned int cpuid;
-
-	cpuid = smp_processor_id();
-
-	/* If first cpu, update count */
-	if (start_count == -1)
-		start_count = IA64_LOG_COUNT(SAL_INFO_TYPE_CMC);
-
-#ifndef XEN
-	ia64_mca_cmc_int_handler(cmc_irq, arg, ptregs);
-#else
-	IA64_MCA_DEBUG("%s: received polling vector = %#x on CPU %d\n",
-	               __FUNCTION__, cmc_irq, smp_processor_id());
-	ia64_log_queue(SAL_INFO_TYPE_CMC, VIRQ_MCA_CMC);
-#endif
-
-	for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
-
-	if (cpuid < NR_CPUS) {
-		platform_send_ipi(cpuid, IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
-	} else {
-		/* If no log record, switch out of polling mode */
-		if (start_count == IA64_LOG_COUNT(SAL_INFO_TYPE_CMC)) {
-
-			printk(KERN_WARNING "Returning to interrupt driven CMC handler\n");
-#ifndef XEN	/* XXX FIXME */
-			schedule_work(&cmc_enable_work);
-#else
-			cpumask_raise_softirq(&cpu_online_map,
-			                      CMC_ENABLE_SOFTIRQ);
-#endif
-			cmc_polling_enabled = 0;
-
-		} else {
-
-			mod_timer(&cmc_poll_timer, jiffies + CMC_POLL_INTERVAL);
-		}
-
-		start_count = -1;
-	}
-	return IRQ_HANDLED;
-}
-
-/*
- *  ia64_mca_cmc_poll
- *
- *	Poll for Corrected Machine Checks (CMCs)
- *
- * Inputs   :   dummy(unused)
- * Outputs  :   None
- *
- */
-static void
-#ifndef XEN
-ia64_mca_cmc_poll (unsigned long dummy)
-#else
-ia64_mca_cmc_poll (void *dummy)
-#endif
-{
-	/* Trigger a CMC interrupt cascade  */
-	platform_send_ipi(cpumask_first(&cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
-}
-
-/*
- *  ia64_mca_cpe_int_caller
- *
- * 	Triggered by sw interrupt from CPE polling routine.  Calls
- * 	real interrupt handler and either triggers a sw interrupt
- * 	on the next cpu or does cleanup at the end.
- *
- * Inputs
- *	interrupt number
- *	client data arg ptr
- *	saved registers ptr
- * Outputs
- * 	handled
- */
-#ifdef CONFIG_ACPI
-
-static irqreturn_t
-ia64_mca_cpe_int_caller(int cpe_irq, void *arg, struct pt_regs *ptregs)
-{
-	static int start_count = -1;
-#ifdef XEN
-	static unsigned long poll_time = MIN_CPE_POLL_INTERVAL;
-#else
-	static int poll_time = MIN_CPE_POLL_INTERVAL;
-#endif
-	unsigned int cpuid;
-
-	cpuid = smp_processor_id();
-
-	/* If first cpu, update count */
-	if (start_count == -1)
-		start_count = IA64_LOG_COUNT(SAL_INFO_TYPE_CPE);
-
-#ifndef XEN
-	ia64_mca_cpe_int_handler(cpe_irq, arg, ptregs);
-#else
-	IA64_MCA_DEBUG("%s: received polling vector = %#x on CPU %d\n",
-	               __FUNCTION__, cpe_irq, smp_processor_id());
-	ia64_log_queue(SAL_INFO_TYPE_CPE, VIRQ_MCA_CPE);
-#endif
-
-	for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
-
-	if (cpuid < NR_CPUS) {
-		platform_send_ipi(cpuid, IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
-	} else {
-		/*
-		 * If a log was recorded, increase our polling frequency,
-		 * otherwise, backoff or return to interrupt mode.
-		 */
-		if (start_count != IA64_LOG_COUNT(SAL_INFO_TYPE_CPE)) {
-			poll_time = max(MIN_CPE_POLL_INTERVAL, poll_time / 2);
-		} else if (cpe_vector < 0) {
-			poll_time = min(MAX_CPE_POLL_INTERVAL, poll_time * 2);
-		} else {
-			poll_time = MIN_CPE_POLL_INTERVAL;
-
-			printk(KERN_WARNING "Returning to interrupt driven CPE handler\n");
-			enable_irq(local_vector_to_irq(IA64_CPE_VECTOR));
-			cpe_poll_enabled = 0;
-		}
-
-		if (cpe_poll_enabled)
-			mod_timer(&cpe_poll_timer, jiffies + poll_time);
-		start_count = -1;
-	}
-	return IRQ_HANDLED;
-}
-
-/*
- *  ia64_mca_cpe_poll
- *
- *	Poll for Corrected Platform Errors (CPEs), trigger interrupt
- *	on first cpu, from there it will trickle through all the cpus.
- *
- * Inputs   :   dummy(unused)
- * Outputs  :   None
- *
- */
-static void
-#ifndef XEN
-ia64_mca_cpe_poll (unsigned long dummy)
-#else
-ia64_mca_cpe_poll (void *dummy)
-#endif
-{
-	/* Trigger a CPE interrupt cascade  */
-	platform_send_ipi(cpumask_first(&cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
-}
-
-#endif /* CONFIG_ACPI */
-
-/*
- * C portion of the OS INIT handler
- *
- * Called from ia64_monarch_init_handler
- *
- * Inputs: pointer to pt_regs where processor info was saved.
- *
- * Returns:
- *   0 if SAL must warm boot the System
- *   1 if SAL must return to interrupted context using PAL_MC_RESUME
- *
- */
-void
-ia64_init_handler (struct pt_regs *pt, struct switch_stack *sw)
-{
-	pal_min_state_area_t *ms;
-

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzO-0004Ul-JT; Fri, 06 Apr 2012 02:33:26 +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 1SFyzL-0004Qa-TE
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:24 +0000
Received: from [193.109.254.147:2285] by server-4.bemta-14.messagelabs.com id
	D6/D8-11570-3F55E7F4; Fri, 06 Apr 2012 02:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1333679590!3483425!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.0 required=7.0 tests=BODY_DONG,BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14994 invoked from network); 6 Apr 2012 02:33:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Apr 2012 02: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 1SFyz8-0003MW-3U
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyz7-0008Iq-PJ
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:09 +0000
Message-Id: <E1SFyz7-0008Iq-PJ@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] remove ia64
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1333449335 -7200
# Node ID 8aa1697d57e480e00b5aaef587c940b52055c064
# Parent  2386288b1bf12e550e267c53976dba51eed8e74d
remove ia64

It retains IA64-specific bits in code imported from elsewhere (e.g.
ACPI, EFI) as well as in the public headers.

It also doesn't touch the tools, mini-os, and unmodified_drivers
sub-trees.

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


diff -r 2386288b1bf1 -r 8aa1697d57e4 MAINTAINERS
--- a/MAINTAINERS	Mon Apr 02 18:14:31 2012 +0100
+++ b/MAINTAINERS	Tue Apr 03 12:35:35 2012 +0200
@@ -138,14 +138,6 @@ M:	Tim Deegan <tim@xen.org>
 S:	Supported
 F:	tools/debugger/kdd/
 
-IA64 ARCHITECTURE
-M:	KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
-S:	Supported
-L:	xen-ia64-devel@lists.xensource.com
-F:	xen/arch/ia64/*
-F:	xen/include/asm-ia64/*
-F:	tools/libxc/ia64/*
-
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 M:	Joseph Cihula <joseph.cihula@intel.com>
 M:	Gang Wei <gang.wei@intel.com>
diff -r 2386288b1bf1 -r 8aa1697d57e4 config/ia64.mk
--- a/config/ia64.mk	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-CONFIG_IA64 := y
-CONFIG_IA64_$(XEN_OS) := y
-
-CONFIG_IOEMU := y
-CONFIG_XCUTILS := y
-CONFIG_XENCOMM := y
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/Makefile
--- a/xen/arch/ia64/Makefile	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-subdir-y += xen
-subdir-y += vmx
-subdir-y += linux
-subdir-y += linux-xen
-
-ALL_OBJS := linux-xen/head.o $(ALL_OBJS)
-
-$(TARGET)-syms: $(ALL_OBJS) xen.lds.s
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o
-	$(LD) $(LDFLAGS) -T xen.lds.s -N -Map $(@D)/.$(@F).0.map $(ALL_OBJS) \
-		$(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0 
-	$(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S 
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o 
-	$(LD) $(LDFLAGS) -T xen.lds.s -N -Map $(@D)/.$(@F).1.map $(ALL_OBJS) \
-		$(@D)/.$(@F).0.o -o $(@D)/.$(@F).1 
-	$(NM) -n $(@D)/.$(@F).1 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1.S 
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o 
-	$(LD) $(LDFLAGS) -T xen.lds.s -N -Map $@.map $(ALL_OBJS) \
-		$(@D)/.$(@F).1.o -o $@
-	rm -f $(@D)/.$(@F).[0-9]* 
-
-$(TARGET): $(TARGET)-syms
-	$(NM) -n $< | grep -v ' [aUw] ' > $(@D)/System.map 
-	$(OBJCOPY) -R .note -R .comment -S $< $@
-
-# Headers do not depend on auto-generated header, but object files do.
-$(ALL_OBJS): $(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h
-
-asm-offsets.s: asm-offsets.c \
-    $(BASEDIR)/include/asm-ia64/.offsets.h.stamp 
-	$(CC) $(CFLAGS) -DGENERATE_ASM_OFFSETS -DIA64_TASK_SIZE=0 -S -o $@ $<
-
-asm-xsi-offsets.s: asm-xsi-offsets.c
-	$(CC) $(CFLAGS) -S -o $@ $<
-
-$(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h: asm-xsi-offsets.s
-	@(set -e; \
-	  echo "/*"; \
-	  echo " * DO NOT MODIFY."; \
-	  echo " *"; \
-	  echo " * This file was auto-generated from $<"; \
-	  echo " *"; \
-	  echo " */"; \
-	  echo ""; \
-	  echo "#ifndef __ASM_XSI_OFFSETS_H__"; \
-	  echo "#define __ASM_XSI_OFFSETS_H__"; \
-	  echo ""; \
-	  sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
-	  echo ""; \
-	  echo "#endif") <$< >$@
-
-$(BASEDIR)/include/asm-ia64/.offsets.h.stamp:
-# Need such symbol link to make linux headers available
-	[ -e $(BASEDIR)/include/linux ] \
-	 || ln -sf $(BASEDIR)/include/xen $(BASEDIR)/include/linux
-	[ -e $(BASEDIR)/include/asm-ia64/xen ] \
-	 || ln -sf $(BASEDIR)/include/asm-ia64/linux $(BASEDIR)/include/asm-ia64/xen
-	touch $@
-
-# I'm sure a Makefile wizard would know a better way to do this
-xen.lds.s: xen/xen.lds.S
-	$(CC) -E $(CPPFLAGS) -P -DXEN $(AFLAGS) \
-		-o xen.lds.s xen/xen.lds.S
-
-.PHONY: clean
-clean::
-	rm -f *.o *~ core  xen.lds.s $(BASEDIR)/include/asm-ia64/.offsets.h.stamp asm-offsets.s map.out
-	rm -f asm-xsi-offsets.s $(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h
-	rm -f $(BASEDIR)/System.map
-	rm -f $(BASEDIR)/include/linux
-	rm -f $(BASEDIR)/include/asm-ia64/xen
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/Rules.mk
--- a/xen/arch/ia64/Rules.mk	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-########################################
-# ia64-specific definitions
-
-ia64 := y
-HAS_ACPI := y
-HAS_VGA  := y
-HAS_CPUFREQ := y
-HAS_PCI := y
-HAS_PASSTHROUGH := y
-HAS_NS16550 := y
-HAS_KEXEC := y
-xenoprof := y
-no_warns ?= n
-vti_debug ?= n
-vmx_panic ?= n
-vhpt_disable ?= n
-xen_ia64_expose_p2m	?= y
-xen_ia64_pervcpu_vhpt	?= y
-xen_ia64_tlb_track	?= y
-xen_ia64_tlb_track_cnt	?= n
-xen_ia64_tlbflush_clock	?= y
-xen_ia64_disable_optvfault ?= n
-
-# If they are enabled,
-# shrink struct page_info assuming all mfn can be addressed by 32 bits.
-# However, with 50bit ia64 architected physical address and 16KB page size,
-# mfn isn't always assessed by 32bit. So they are disabled by default.
-xen_ia64_shrink_page_list ?= n
-xen_ia64_pickle_domain ?= n
-
-# Used only by linux/Makefile.
-AFLAGS_KERNEL  += -mconstant-gp -nostdinc $(CPPFLAGS)
-
-CFLAGS	+= -nostdinc -fno-builtin -fno-common
-CFLAGS	+= -mconstant-gp
-#CFLAGS  += -O3		# -O3 over-inlines making debugging tough!
-CFLAGS	+= -O2		# but no optimization causes compile errors!
-CFLAGS	+= -fomit-frame-pointer -D__KERNEL__
-CFLAGS	+= -iwithprefix include
-CPPFLAGS+= -I$(BASEDIR)/include						\
-	   -I$(BASEDIR)/include/asm-ia64				\
-	   -I$(BASEDIR)/include/asm-ia64/linux 				\
-	   -I$(BASEDIR)/include/asm-ia64/linux-xen 			\
-	   -I$(BASEDIR)/include/asm-ia64/linux-null 			\
-	   -I$(BASEDIR)/arch/ia64/linux -I$(BASEDIR)/arch/ia64/linux-xen
-CFLAGS	+= $(CPPFLAGS)
-#CFLAGS  += -Wno-pointer-arith -Wredundant-decls
-CFLAGS	+= -DIA64 -DXEN -DLINUX_2_6
-CFLAGS	+= -ffixed-r13 -mfixed-range=f2-f5,f12-f127,b2-b5
-CFLAGS	+= -g
-ifeq ($(vti_debug),y)
-CFLAGS  += -DVTI_DEBUG
-endif
-ifeq ($(vmx_panic),y)
-CFLAGS  += -DCONFIG_VMX_PANIC
-endif
-ifeq ($(xen_ia64_expose_p2m),y)
-CFLAGS	+= -DCONFIG_XEN_IA64_EXPOSE_P2M
-endif
-ifeq ($(xen_ia64_pervcpu_vhpt),y)
-CFLAGS	+= -DCONFIG_XEN_IA64_PERVCPU_VHPT
-ifeq ($(vhpt_disable),y)
-$(error "both xen_ia64_pervcpu_vhpt=y and vhpt_disable=y are enabled. they can't be enabled simultaneously. disable one of them.")
-endif
-endif
-ifeq ($(xen_ia64_tlb_track),y)
-CFLAGS	+= -DCONFIG_XEN_IA64_TLB_TRACK
-endif
-ifeq ($(xen_ia64_tlb_track_cnt),y)
-CFLAGS	+= -DCONFIG_TLB_TRACK_CNT
-endif
-ifeq ($(xen_ia64_tlbflush_clock),y)
-CFLAGS += -DCONFIG_XEN_IA64_TLBFLUSH_CLOCK
-endif
-ifeq ($(no_warns),y)
-CFLAGS	+= -Wa,--fatal-warnings -Werror -Wno-uninitialized
-endif
-ifneq ($(vhpt_disable),y)
-CFLAGS += -DVHPT_ENABLED=1
-else
-CFLAGS += -DVHPT_ENABLED=0
-endif
-ifeq ($(xen_ia64_disable_optvfault),y)
-CFLAGS += -DCONFIG_XEN_IA64_DISABLE_OPTVFAULT
-endif
-ifeq ($(xen_ia64_shrink_page_list),y)
-CFLAGS += -DCONFIG_IA64_SHRINK_PAGE_LIST
-endif
-ifeq ($(xen_ia64_pickle_domain),y)
-CFLAGS += -DCONFIG_IA64_PICKLE_DOMAIN
-endif
-
-LDFLAGS = -g
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/asm-offsets.c
--- a/xen/arch/ia64/asm-offsets.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,273 +0,0 @@
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed
- * to extract and format the required data.
- */
-
-#include <xen/config.h>
-#include <xen/sched.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <asm/mca.h>
-#include <public/xen.h>
-#include <asm/tlb.h>
-#include <asm/regs.h>
-#include <asm/xenmca.h>
-
-#define task_struct vcpu
-
-#define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " (%0) " #val : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-#define OFFSET(_sym, _str, _mem) \
-    DEFINE(_sym, offsetof(_str, _mem));
-
-void foo(void)
-{
-	DEFINE(IA64_TASK_SIZE, sizeof (struct task_struct));
-	DEFINE(IA64_THREAD_INFO_SIZE, sizeof (struct thread_info));
-	DEFINE(IA64_PT_REGS_SIZE, sizeof (struct pt_regs));
-	DEFINE(IA64_SWITCH_STACK_SIZE, sizeof (struct switch_stack));
-	DEFINE(IA64_CPU_SIZE, sizeof (struct cpuinfo_ia64));
-	DEFINE(UNW_FRAME_INFO_SIZE, sizeof (struct unw_frame_info));
-	DEFINE(MAPPED_REGS_T_SIZE, sizeof (mapped_regs_t));
-
-	BLANK();
-	DEFINE(IA64_MCA_CPU_INIT_STACK_OFFSET, offsetof (struct ia64_mca_cpu, init_stack));
-
-	BLANK();
-	DEFINE(VCPU_VTM_OFFSET_OFS, offsetof(struct vcpu, arch.arch_vmx.vtm.vtm_offset));
-	DEFINE(VCPU_VTM_LAST_ITC_OFS, offsetof(struct vcpu, arch.arch_vmx.vtm.last_itc));
-	DEFINE(VCPU_VRR0_OFS, offsetof(struct vcpu, arch.arch_vmx.vrr[0]));
-	DEFINE(VCPU_ITR0_OFS, offsetof(struct vcpu, arch.itrs[0]));
-	DEFINE(VCPU_CALLBACK_OFS, offsetof(struct vcpu, arch.event_callback_ip));
-#ifdef   VTI_DEBUG
-	DEFINE(IVT_CUR_OFS, offsetof(struct vcpu, arch.arch_vmx.ivt_current));
-	DEFINE(IVT_DBG_OFS, offsetof(struct vcpu, arch.arch_vmx.ivt_debug));
-	DEFINE(IVT_DEBUG_SIZE, sizeof(struct ivt_debug));
-#endif
-	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
-	DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
-
-	BLANK();
-
-	DEFINE(IA64_TASK_THREAD_KSP_OFFSET, offsetof (struct vcpu, arch._thread.ksp));
-	DEFINE(IA64_TASK_THREAD_ON_USTACK_OFFSET, offsetof (struct vcpu, arch._thread.on_ustack));
-
-	DEFINE(IA64_VCPU_HYPERCALL_CONTINUATION_OFS, offsetof (struct vcpu, arch.hypercall_continuation));
-	DEFINE(IA64_VCPU_FP_PSR_OFFSET, offsetof (struct vcpu, arch.fp_psr));
-	DEFINE(IA64_VCPU_META_RID_DT_OFFSET, offsetof (struct vcpu, arch.metaphysical_rid_dt));
-	DEFINE(IA64_VCPU_META_RID_D_OFFSET, offsetof (struct vcpu, arch.metaphysical_rid_d));
-	DEFINE(IA64_VCPU_META_SAVED_RR0_OFFSET, offsetof (struct vcpu, arch.metaphysical_saved_rr0));
-	DEFINE(IA64_VCPU_BREAKIMM_OFFSET, offsetof (struct vcpu, arch.breakimm));
-	DEFINE(IA64_VCPU_IVA_OFFSET, offsetof (struct vcpu, arch.iva));
-	DEFINE(IA64_VCPU_EVENT_CALLBACK_IP_OFFSET, offsetof (struct vcpu, arch.event_callback_ip));
-	DEFINE(IA64_VCPU_IRR0_OFFSET, offsetof (struct vcpu, arch.irr[0]));
-	DEFINE(IA64_VCPU_IRR3_OFFSET, offsetof (struct vcpu, arch.irr[3]));
-	DEFINE(IA64_VCPU_INSVC3_OFFSET, offsetof (struct vcpu, arch.insvc[3]));
-	DEFINE(IA64_VCPU_STARTING_RID_OFFSET, offsetof (struct vcpu, arch.starting_rid));
-	DEFINE(IA64_VCPU_ENDING_RID_OFFSET, offsetof (struct vcpu, arch.ending_rid));
-	DEFINE(IA64_VCPU_RID_BITS_OFFSET, offsetof (struct vcpu, arch.rid_bits));
-	DEFINE(IA64_VCPU_DOMAIN_ITM_OFFSET, offsetof (struct vcpu, arch.domain_itm));
-	DEFINE(IA64_VCPU_DOMAIN_ITM_LAST_OFFSET, offsetof (struct vcpu, arch.domain_itm_last));
-	DEFINE(IA64_VCPU_ITLB_OFFSET, offsetof (struct vcpu, arch.itlb));
-	DEFINE(IA64_VCPU_DTLB_OFFSET, offsetof (struct vcpu, arch.dtlb));
-	DEFINE(IA64_VCPU_VHPT_PG_SHIFT_OFFSET, offsetof (struct vcpu, arch.vhpt_pg_shift));
-
-	BLANK();
-
-	DEFINE(IA64_VCPU_SHADOW_BITMAP_OFFSET, offsetof (struct vcpu, arch.shadow_bitmap));
-
-	BLANK();
-
-	DEFINE(IA64_CPUINFO_ITM_NEXT_OFFSET, offsetof (struct cpuinfo_ia64, itm_next));
-	DEFINE(IA64_CPUINFO_KSOFTIRQD_OFFSET, offsetof (struct cpuinfo_ia64, ksoftirqd));
-
-
-	BLANK();
-
-	DEFINE(IA64_PT_REGS_B6_OFFSET, offsetof (struct pt_regs, b6));
-	DEFINE(IA64_PT_REGS_B7_OFFSET, offsetof (struct pt_regs, b7));
-	DEFINE(IA64_PT_REGS_AR_CSD_OFFSET, offsetof (struct pt_regs, ar_csd));
-	DEFINE(IA64_PT_REGS_AR_SSD_OFFSET, offsetof (struct pt_regs, ar_ssd));
-	DEFINE(IA64_PT_REGS_R8_OFFSET, offsetof (struct pt_regs, r8));
-	DEFINE(IA64_PT_REGS_R9_OFFSET, offsetof (struct pt_regs, r9));
-	DEFINE(IA64_PT_REGS_R10_OFFSET, offsetof (struct pt_regs, r10));
-	DEFINE(IA64_PT_REGS_R11_OFFSET, offsetof (struct pt_regs, r11));
-	DEFINE(IA64_PT_REGS_CR_IPSR_OFFSET, offsetof (struct pt_regs, cr_ipsr));
-	DEFINE(IA64_PT_REGS_CR_IIP_OFFSET, offsetof (struct pt_regs, cr_iip));
-	DEFINE(IA64_PT_REGS_CR_IFS_OFFSET, offsetof (struct pt_regs, cr_ifs));
-	DEFINE(IA64_PT_REGS_AR_UNAT_OFFSET, offsetof (struct pt_regs, ar_unat));
-	DEFINE(IA64_PT_REGS_AR_PFS_OFFSET, offsetof (struct pt_regs, ar_pfs));
-	DEFINE(IA64_PT_REGS_AR_RSC_OFFSET, offsetof (struct pt_regs, ar_rsc));
-	DEFINE(IA64_PT_REGS_AR_RNAT_OFFSET, offsetof (struct pt_regs, ar_rnat));
-
-	DEFINE(IA64_PT_REGS_AR_BSPSTORE_OFFSET, offsetof (struct pt_regs, ar_bspstore));
-	DEFINE(IA64_PT_REGS_PR_OFFSET, offsetof (struct pt_regs, pr));
-	DEFINE(IA64_PT_REGS_B0_OFFSET, offsetof (struct pt_regs, b0));
-	DEFINE(IA64_PT_REGS_LOADRS_OFFSET, offsetof (struct pt_regs, loadrs));
-	DEFINE(IA64_PT_REGS_R1_OFFSET, offsetof (struct pt_regs, r1));
-	DEFINE(IA64_PT_REGS_R12_OFFSET, offsetof (struct pt_regs, r12));
-	DEFINE(IA64_PT_REGS_R13_OFFSET, offsetof (struct pt_regs, r13));
-	DEFINE(IA64_PT_REGS_AR_FPSR_OFFSET, offsetof (struct pt_regs, ar_fpsr));
-	DEFINE(IA64_PT_REGS_R15_OFFSET, offsetof (struct pt_regs, r15));
-	DEFINE(IA64_PT_REGS_R14_OFFSET, offsetof (struct pt_regs, r14));
-	DEFINE(IA64_PT_REGS_R2_OFFSET, offsetof (struct pt_regs, r2));
-	DEFINE(IA64_PT_REGS_R3_OFFSET, offsetof (struct pt_regs, r3));
-	DEFINE(IA64_PT_REGS_R16_OFFSET, offsetof (struct pt_regs, r16));
-	DEFINE(IA64_PT_REGS_R17_OFFSET, offsetof (struct pt_regs, r17));
-	DEFINE(IA64_PT_REGS_R18_OFFSET, offsetof (struct pt_regs, r18));
-	DEFINE(IA64_PT_REGS_R19_OFFSET, offsetof (struct pt_regs, r19));
-	DEFINE(IA64_PT_REGS_R20_OFFSET, offsetof (struct pt_regs, r20));
-	DEFINE(IA64_PT_REGS_R21_OFFSET, offsetof (struct pt_regs, r21));
-	DEFINE(IA64_PT_REGS_R22_OFFSET, offsetof (struct pt_regs, r22));
-	DEFINE(IA64_PT_REGS_R23_OFFSET, offsetof (struct pt_regs, r23));
-	DEFINE(IA64_PT_REGS_R24_OFFSET, offsetof (struct pt_regs, r24));
-	DEFINE(IA64_PT_REGS_R25_OFFSET, offsetof (struct pt_regs, r25));
-	DEFINE(IA64_PT_REGS_R26_OFFSET, offsetof (struct pt_regs, r26));
-	DEFINE(IA64_PT_REGS_R27_OFFSET, offsetof (struct pt_regs, r27));
-	DEFINE(IA64_PT_REGS_R28_OFFSET, offsetof (struct pt_regs, r28));
-	DEFINE(IA64_PT_REGS_R29_OFFSET, offsetof (struct pt_regs, r29));
-	DEFINE(IA64_PT_REGS_R30_OFFSET, offsetof (struct pt_regs, r30));
-	DEFINE(IA64_PT_REGS_R31_OFFSET, offsetof (struct pt_regs, r31));
-	DEFINE(IA64_PT_REGS_AR_CCV_OFFSET, offsetof (struct pt_regs, ar_ccv));
-	DEFINE(IA64_PT_REGS_F6_OFFSET, offsetof (struct pt_regs, f6));
-	DEFINE(IA64_PT_REGS_F7_OFFSET, offsetof (struct pt_regs, f7));
-	DEFINE(IA64_PT_REGS_F8_OFFSET, offsetof (struct pt_regs, f8));
-	DEFINE(IA64_PT_REGS_F9_OFFSET, offsetof (struct pt_regs, f9));
-	DEFINE(IA64_PT_REGS_F10_OFFSET, offsetof (struct pt_regs, f10));
-	DEFINE(IA64_PT_REGS_F11_OFFSET, offsetof (struct pt_regs, f11));
-	DEFINE(IA64_PT_REGS_R4_OFFSET, offsetof (struct pt_regs, r4));
-	DEFINE(IA64_PT_REGS_R5_OFFSET, offsetof (struct pt_regs, r5));
-	DEFINE(IA64_PT_REGS_R6_OFFSET, offsetof (struct pt_regs, r6));
-	DEFINE(IA64_PT_REGS_R7_OFFSET, offsetof (struct pt_regs, r7));
-	DEFINE(IA64_PT_REGS_EML_UNAT_OFFSET, offsetof (struct pt_regs, eml_unat));
-	DEFINE(IA64_VCPU_IIPA_OFFSET, offsetof (struct vcpu, arch.arch_vmx.cr_iipa));
-	DEFINE(IA64_VCPU_ISR_OFFSET, offsetof (struct vcpu, arch.arch_vmx.cr_isr));
-	DEFINE(IA64_VCPU_CAUSE_OFFSET, offsetof (struct vcpu, arch.arch_vmx.cause));
-	DEFINE(IA64_VCPU_OPCODE_OFFSET, offsetof (struct vcpu, arch.arch_vmx.opcode));
-	DEFINE(SWITCH_MPTA_OFFSET,offsetof(struct vcpu ,arch.arch_vmx.mpta));
-	DEFINE(IA64_PT_REGS_R16_SLOT, (((offsetof(struct pt_regs, r16)-sizeof(struct pt_regs))>>3)&0x3f));
-	DEFINE(IA64_PT_REGS_R2_SLOT, (((offsetof(struct pt_regs, r16)-sizeof(struct pt_regs))>>3)&0x3f));
-	DEFINE(IA64_PT_REGS_R8_SLOT, (((offsetof(struct pt_regs, r16)-sizeof(struct pt_regs))>>3)&0x3f));
-	DEFINE(IA64_VCPU_FLAGS_OFFSET,offsetof(struct vcpu ,arch.arch_vmx.flags));
-	DEFINE(IA64_VCPU_MMU_MODE_OFFSET,offsetof(struct vcpu, arch.arch_vmx.mmu_mode));
-
-	BLANK();
-
-	DEFINE(IA64_SWITCH_STACK_CALLER_UNAT_OFFSET, offsetof (struct switch_stack, caller_unat));
-	DEFINE(IA64_SWITCH_STACK_AR_FPSR_OFFSET, offsetof (struct switch_stack, ar_fpsr));
-	DEFINE(IA64_SWITCH_STACK_F2_OFFSET, offsetof (struct switch_stack, f2));
-	DEFINE(IA64_SWITCH_STACK_F3_OFFSET, offsetof (struct switch_stack, f3));
-	DEFINE(IA64_SWITCH_STACK_F4_OFFSET, offsetof (struct switch_stack, f4));
-	DEFINE(IA64_SWITCH_STACK_F5_OFFSET, offsetof (struct switch_stack, f5));
-	DEFINE(IA64_SWITCH_STACK_F12_OFFSET, offsetof (struct switch_stack, f12));
-	DEFINE(IA64_SWITCH_STACK_F13_OFFSET, offsetof (struct switch_stack, f13));
-	DEFINE(IA64_SWITCH_STACK_F14_OFFSET, offsetof (struct switch_stack, f14));
-	DEFINE(IA64_SWITCH_STACK_F15_OFFSET, offsetof (struct switch_stack, f15));
-	DEFINE(IA64_SWITCH_STACK_F16_OFFSET, offsetof (struct switch_stack, f16));
-	DEFINE(IA64_SWITCH_STACK_F17_OFFSET, offsetof (struct switch_stack, f17));
-	DEFINE(IA64_SWITCH_STACK_F18_OFFSET, offsetof (struct switch_stack, f18));
-	DEFINE(IA64_SWITCH_STACK_F19_OFFSET, offsetof (struct switch_stack, f19));
-	DEFINE(IA64_SWITCH_STACK_F20_OFFSET, offsetof (struct switch_stack, f20));
-	DEFINE(IA64_SWITCH_STACK_F21_OFFSET, offsetof (struct switch_stack, f21));
-	DEFINE(IA64_SWITCH_STACK_F22_OFFSET, offsetof (struct switch_stack, f22));
-	DEFINE(IA64_SWITCH_STACK_F23_OFFSET, offsetof (struct switch_stack, f23));
-	DEFINE(IA64_SWITCH_STACK_F24_OFFSET, offsetof (struct switch_stack, f24));
-	DEFINE(IA64_SWITCH_STACK_F25_OFFSET, offsetof (struct switch_stack, f25));
-	DEFINE(IA64_SWITCH_STACK_F26_OFFSET, offsetof (struct switch_stack, f26));
-	DEFINE(IA64_SWITCH_STACK_F27_OFFSET, offsetof (struct switch_stack, f27));
-	DEFINE(IA64_SWITCH_STACK_F28_OFFSET, offsetof (struct switch_stack, f28));
-	DEFINE(IA64_SWITCH_STACK_F29_OFFSET, offsetof (struct switch_stack, f29));
-	DEFINE(IA64_SWITCH_STACK_F30_OFFSET, offsetof (struct switch_stack, f30));
-	DEFINE(IA64_SWITCH_STACK_F31_OFFSET, offsetof (struct switch_stack, f31));
-	DEFINE(IA64_SWITCH_STACK_R4_OFFSET, offsetof (struct switch_stack, r4));
-	DEFINE(IA64_SWITCH_STACK_R5_OFFSET, offsetof (struct switch_stack, r5));
-	DEFINE(IA64_SWITCH_STACK_R6_OFFSET, offsetof (struct switch_stack, r6));
-	DEFINE(IA64_SWITCH_STACK_R7_OFFSET, offsetof (struct switch_stack, r7));
-	DEFINE(IA64_SWITCH_STACK_B0_OFFSET, offsetof (struct switch_stack, b0));
-	DEFINE(IA64_SWITCH_STACK_B1_OFFSET, offsetof (struct switch_stack, b1));
-	DEFINE(IA64_SWITCH_STACK_B2_OFFSET, offsetof (struct switch_stack, b2));
-	DEFINE(IA64_SWITCH_STACK_B3_OFFSET, offsetof (struct switch_stack, b3));
-	DEFINE(IA64_SWITCH_STACK_B4_OFFSET, offsetof (struct switch_stack, b4));
-	DEFINE(IA64_SWITCH_STACK_B5_OFFSET, offsetof (struct switch_stack, b5));
-	DEFINE(IA64_SWITCH_STACK_AR_PFS_OFFSET, offsetof (struct switch_stack, ar_pfs));
-	DEFINE(IA64_SWITCH_STACK_AR_LC_OFFSET, offsetof (struct switch_stack, ar_lc));
-	DEFINE(IA64_SWITCH_STACK_AR_UNAT_OFFSET, offsetof (struct switch_stack, ar_unat));
-	DEFINE(IA64_SWITCH_STACK_AR_RNAT_OFFSET, offsetof (struct switch_stack, ar_rnat));
-	DEFINE(IA64_SWITCH_STACK_AR_BSPSTORE_OFFSET, offsetof (struct switch_stack, ar_bspstore));
-	DEFINE(IA64_SWITCH_STACK_PR_OFFSET, offsetof (struct switch_stack, pr));
-
-	BLANK();
-
-	DEFINE(IA64_VPD_BASE_OFFSET, offsetof (struct vcpu, arch.privregs));
-	DEFINE(IA64_VPD_VIFS_OFFSET, offsetof (mapped_regs_t, ifs));
-	DEFINE(IA64_VPD_VHPI_OFFSET, offsetof (mapped_regs_t, vhpi));
-	DEFINE(IA64_VPD_VB1REG_OFFSET, offsetof (mapped_regs_t, bank1_regs[0]));
-	DEFINE(IA64_VPD_VB0REG_OFFSET, offsetof (mapped_regs_t, bank0_regs[0]));
-	DEFINE(IA64_VPD_VB1NAT_OFFSET, offsetof (mapped_regs_t, vnat));
-	DEFINE(IA64_VPD_VB0NAT_OFFSET, offsetof (mapped_regs_t, vbnat));
- 	DEFINE(IA64_VLSAPIC_INSVC_BASE_OFFSET, offsetof (struct vcpu, arch.insvc[0]));
-	DEFINE(IA64_VPD_VPTA_OFFSET, offsetof (struct mapped_regs, pta));
-	DEFINE(XXX_THASH_SIZE, sizeof (thash_data_t));
-
-	BLANK();
-	DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET, offsetof (struct cpuinfo_ia64, nsec_per_cyc));
-	DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET, offsetof (struct cpuinfo_ia64, ptce_base));
-	DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET, offsetof (struct cpuinfo_ia64, ptce_count));
-	DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET, offsetof (struct timespec, tv_nsec));
-
-
-	DEFINE(CLONE_IDLETASK_BIT, 12);
-	DEFINE(CLONE_SETTLS_BIT, 19);
-	DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET, offsetof (struct cpuinfo_ia64, nsec_per_cyc));
-
-	BLANK();
-	DEFINE(IA64_KR_CURRENT_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT]));
-	DEFINE(IA64_KR_PT_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_PT_BASE]));
-	DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
-	DEFINE(IA64_KR_PERCPU_DATA_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_PER_CPU_DATA]));
-	DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
-	DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT_STACK]));
-
-#ifdef PERF_COUNTERS
-	BLANK();
-	DEFINE(IA64_PERFC_recover_to_page_fault, PERFC_recover_to_page_fault);
-	DEFINE(IA64_PERFC_recover_to_break_fault, PERFC_recover_to_break_fault);
-	DEFINE(IA64_PERFC_fast_vhpt_translate, PERFC_fast_vhpt_translate);
-	DEFINE(IA64_PERFC_fast_hyperprivop, PERFC_fast_hyperprivop);
-	DEFINE(IA64_PERFC_fast_reflect, PERFC_fast_reflect);
-#endif
-
-	BLANK();
-	DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET,
-	       offsetof(struct cpuinfo_ia64, ptce_base));
-	DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET,
-	       offsetof(struct cpuinfo_ia64, ptce_count));
-	DEFINE(IA64_CPUINFO_PTCE_STRIDE_OFFSET,
-	       offsetof(struct cpuinfo_ia64, ptce_stride));
-
-	BLANK();
-	DEFINE(IA64_MCA_CPU_PROC_STATE_DUMP_OFFSET,
-	       offsetof(struct ia64_mca_cpu, proc_state_dump));
-	DEFINE(IA64_MCA_CPU_STACK_OFFSET,
-	       offsetof(struct ia64_mca_cpu, stack));
-	DEFINE(IA64_MCA_CPU_STACKFRAME_OFFSET,
-	       offsetof(struct ia64_mca_cpu, stackframe));
-	DEFINE(IA64_MCA_CPU_RBSTORE_OFFSET,
-	       offsetof(struct ia64_mca_cpu, rbstore));
-
-#if VHPT_ENABLED
-	DEFINE(IA64_VCPU_VHPT_PAGE_OFFSET,
-	       offsetof(struct vcpu, arch.vhpt_page));
-	DEFINE(IA64_VCPU_VHPT_MADDR_OFFSET,
-	       offsetof(struct vcpu, arch.vhpt_maddr));
-#endif
-
-	BLANK();
-	DEFINE(IA64_MCA_TLB_INFO_SIZE, sizeof(struct ia64_mca_tlb_info));
-	DEFINE(IA64_MCA_PERCPU_OFFSET,
-	       offsetof(struct ia64_mca_tlb_info, percpu_paddr));
-}
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/asm-xsi-offsets.c
--- a/xen/arch/ia64/asm-xsi-offsets.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/* -*-  Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
-/*
- * asm-xsi-offsets.c_
- * Copyright (c) 2005, Intel Corporation.
- *      Kun Tian (Kevin Tian) <kevin.tian@intel.com>
- *      Eddie Dong  <eddie.dong@intel.com>
- *      Fred Yang <fred.yang@intel.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- */
-
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed
- * to extract and format the required data.
- */
-
-#include <xen/config.h>
-#include <xen/sched.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <public/xen.h>
-#include <asm/tlb.h>
-#include <asm/regs.h>
-
-#define task_struct vcpu
-
-#define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " (%0) " #val : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-#define DEFINE_MAPPED_REG_OFS(sym, field) \
-	DEFINE(sym, (XMAPPEDREGS_OFS + offsetof(mapped_regs_t, field)))
-
-void foo(void)
-{
-	DEFINE_MAPPED_REG_OFS(XSI_PSR_I_ADDR_OFS, interrupt_mask_addr);
-	DEFINE_MAPPED_REG_OFS(XSI_IPSR_OFS, ipsr);
-	DEFINE_MAPPED_REG_OFS(XSI_IIP_OFS, iip);
-	DEFINE_MAPPED_REG_OFS(XSI_IFS_OFS, ifs);
-	DEFINE_MAPPED_REG_OFS(XSI_PRECOVER_IFS_OFS, precover_ifs);
-	DEFINE_MAPPED_REG_OFS(XSI_ISR_OFS, isr);
-	DEFINE_MAPPED_REG_OFS(XSI_IFA_OFS, ifa);
-	DEFINE_MAPPED_REG_OFS(XSI_IIPA_OFS, iipa);
-	DEFINE_MAPPED_REG_OFS(XSI_IIM_OFS, iim);
-	DEFINE_MAPPED_REG_OFS(XSI_TPR_OFS, tpr);
-	DEFINE_MAPPED_REG_OFS(XSI_IHA_OFS, iha);
-	DEFINE_MAPPED_REG_OFS(XSI_ITIR_OFS, itir);
-	DEFINE_MAPPED_REG_OFS(XSI_ITV_OFS, itv);
-	DEFINE_MAPPED_REG_OFS(XSI_PTA_OFS, pta);
-	DEFINE_MAPPED_REG_OFS(XSI_VPSR_DFH_OFS, vpsr_dfh);
-	DEFINE_MAPPED_REG_OFS(XSI_HPSR_DFH_OFS, hpsr_dfh);
-	DEFINE_MAPPED_REG_OFS(XSI_PSR_IC_OFS, interrupt_collection_enabled);
-	DEFINE_MAPPED_REG_OFS(XSI_VPSR_PP_OFS, vpsr_pp);
-	DEFINE_MAPPED_REG_OFS(XSI_METAPHYS_OFS, metaphysical_mode);
-	DEFINE_MAPPED_REG_OFS(XSI_BANKNUM_OFS, banknum);
-	DEFINE_MAPPED_REG_OFS(XSI_BANK0_R16_OFS, bank0_regs[0]);
-	DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]);
-	DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat);
-	DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat);
-	DEFINE_MAPPED_REG_OFS(XSI_RR0_OFS, rrs[0]);
-	DEFINE_MAPPED_REG_OFS(XSI_KR0_OFS, krs[0]);
-}
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/Makefile
--- a/xen/arch/ia64/linux-xen/Makefile	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-subdir-y += sn
-
-obj-y += cmdline.o
-obj-y += efi.o
-obj-y += entry.o
-obj-y += irq_ia64.o
-obj-y += mca.o
-obj-y += mca_asm.o
-obj-y += mm_contig.o
-obj-y += process-linux-xen.o
-obj-y += sal.o
-obj-y += setup.o
-obj-y += smpboot.o
-obj-y += smp.o
-obj-y += time.o
-obj-y += tlb.o
-obj-y += unaligned.o
-obj-y += unwind.o
-obj-y += iosapic.o
-obj-y += numa.o
-obj-y += perfmon.o
-obj-y += perfmon_default_smpl.o
-obj-y += acpi.o
-obj-y += acpi_numa.o
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/README.origin
--- a/xen/arch/ia64/linux-xen/README.origin	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-# Source files in this directory are near-identical copies of linux-2.6.13
-# files:
-
-# NOTE: ALL changes to these files should be clearly marked
-# (e.g. with #ifdef XEN or XEN in a comment) so that they can be
-# easily updated to future versions of the corresponding Linux files.
-
-cmdline.c		-> linux/lib/cmdline.c
-entry.h			-> linux/arch/ia64/kernel/entry.h
-entry.S			-> linux/arch/ia64/kernel/entry.S
-head.S			-> linux/arch/ia64/kernel/head.S
-hpsim_ssc.h		-> linux/arch/ia64/hp/sim/hpsim_ssc.h
-irq_ia64.c		-> linux/arch/ia64/kernel/irq_ia64.c
-mca.c			-> linux/arch/ia64/kernel/mca.c
-mca_asm.S		-> linux/arch/ia64/kernel/mca_asm.S
-minstate.h		-> linux/arch/ia64/kernel/minstate.h
-mm_contig.c		-> linux/arch/ia64/mm/contig.c
-numa.c			-> linux/arch/ia64/kernel/numa.c
-process-linux-xen.c	-> linux/arch/ia64/kernel/process.c
-sal.c			-> linux/arch/ia64/kernel/sal.c
-setup.c			-> linux/arch/ia64/kernel/setup.c
-smp.c			-> linux/arch/ia64/kernel/smp.c
-smpboot.c		-> linux/arch/ia64/kernel/smpboot.c
-time.c			-> linux/arch/ia64/kernel/time.c
-tlb.c			-> linux/arch/ia64/mm/tlb.c
-unaligned.c		-> linux/arch/ia64/kernel/unaligned.c
-unwind.c		-> linux/arch/ia64/kernel/unwind.c
-unwind_decoder.c	-> linux/arch/ia64/kernel/unwind_decoder.c
-unwind_i.h		-> linux/arch/ia64/kernel/unwind_i.h
-
-# The files below are from Linux-2.6.16
-iosapic.c		-> linux/arch/ia64/kernel/iosapic.c
-
-# The files below are from Linux-2.6.16.33
-perfmon.c		-> linux/arch/kernel/perfmon.c
-perfmon_default_smpl.c	-> linux/arch/kernel/perfmon_default_smpl.c
-perfmon_generic.h	-> linux/arch/kernel/perfmon_generic.h
-perfmon_itanium.h	-> linux/arch/kernel/perfmon_itanium.h
-perfmon_mckinley.h	-> linux/arch/kernel/perfmon_mckinley.h
-perfmon_montecito.h	-> linux/arch/kernel/perfmon_montecito.h
-
-# The files below are from Linux-2.6.21
-efi.c			-> linux/arch/ia64/kernel/efi.c
-
-# The files below are from Linux-2.6.26-rc5
-acpi.c			-> linux/arch/ia64/kernel/acpi.c
-acpi_numa.c		-> linux/drivers/acpi/numa.c
\ No newline at end of file
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/acpi.c
--- a/xen/arch/ia64/linux-xen/acpi.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1098 +0,0 @@
-/*
- *  acpi.c - Architecture-Specific Low-Level ACPI Support
- *
- *  Copyright (C) 1999 VA Linux Systems
- *  Copyright (C) 1999,2000 Walt Drummond <drummond@valinux.com>
- *  Copyright (C) 2000, 2002-2003 Hewlett-Packard Co.
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *  Copyright (C) 2000 Intel Corp.
- *  Copyright (C) 2000,2001 J.I. Lee <jung-ik.lee@intel.com>
- *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
- *  Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com>
- *  Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
- *  Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
- *  Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/smp.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/irq.h>
-#include <linux/acpi.h>
-#include <linux/efi.h>
-#include <linux/mmzone.h>
-#include <linux/nodemask.h>
-#include <asm/io.h>
-#include <asm/iosapic.h>
-#include <asm/machvec.h>
-#include <asm/page.h>
-#include <asm/system.h>
-#include <asm/numa.h>
-#include <asm/sal.h>
-#include <asm/cyclone.h>
-#include <asm/xen/hypervisor.h>
-#ifdef XEN
-#include <asm/hw_irq.h>
-#include <asm/numa.h>
-extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES];
-#endif
-
-
-#define BAD_MADT_ENTRY(entry, end) (                                        \
-		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
-		((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
-
-#define PREFIX			"ACPI: "
-
-void (*pm_idle) (void) __read_mostly;
-EXPORT_SYMBOL(pm_idle);
-void (*pm_power_off) (void) __read_mostly;
-EXPORT_SYMBOL(pm_power_off);
-
-unsigned int acpi_cpei_override;
-unsigned int acpi_cpei_phys_cpuid;
-
-unsigned long acpi_wakeup_address = 0;
-
-#ifdef CONFIG_IA64_GENERIC
-static unsigned long __init acpi_find_rsdp(void)
-{
-	unsigned long rsdp_phys = 0;
-
-	if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
-		rsdp_phys = efi.acpi20;
-	else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
-		printk(KERN_WARNING PREFIX
-		       "v1.0/r0.71 tables no longer supported\n");
-	return rsdp_phys;
-}
-#endif
-
-const char __init *
-acpi_get_sysname(void)
-{
-#ifdef CONFIG_IA64_GENERIC
-	unsigned long rsdp_phys;
-	struct acpi_table_rsdp *rsdp;
-	struct acpi_table_xsdt *xsdt;
-	struct acpi_table_header *hdr;
-
-	rsdp_phys = acpi_find_rsdp();
-	if (!rsdp_phys) {
-		printk(KERN_ERR
-		       "ACPI 2.0 RSDP not found, default to \"dig\"\n");
-		return "dig";
-	}
-
-	rsdp = (struct acpi_table_rsdp *)__va(rsdp_phys);
-	if (strncmp(rsdp->signature, ACPI_SIG_RSDP, sizeof(ACPI_SIG_RSDP) - 1)) {
-		printk(KERN_ERR
-		       "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
-		return "dig";
-	}
-
-	xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_physical_address);
-	hdr = &xsdt->header;
-	if (strncmp(hdr->signature, ACPI_SIG_XSDT, sizeof(ACPI_SIG_XSDT) - 1)) {
-		printk(KERN_ERR
-		       "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
-		return "dig";
-	}
-
-	if (!strcmp(hdr->oem_id, "HP")) {
-		return "hpzx1";
-	} else if (!strcmp(hdr->oem_id, "SGI")) {
-		if (!strcmp(hdr->oem_table_id + 4, "UV"))
-			return "uv";
-		else
-			return "sn2";
-#ifndef XEN
-	} else if (is_running_on_xen() && !strcmp(hdr->oem_id, "XEN")) {
-		return "xen";
-#endif
-	}
-
-	return "dig";
-#else
-# if defined (CONFIG_IA64_HP_SIM)
-	return "hpsim";
-# elif defined (CONFIG_IA64_HP_ZX1)
-	return "hpzx1";
-# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB)
-	return "hpzx1_swiotlb";
-# elif defined (CONFIG_IA64_SGI_SN2)
-	return "sn2";
-# elif defined (CONFIG_IA64_SGI_UV)
-	return "uv";
-# elif defined (CONFIG_IA64_DIG)
-	return "dig";
-# elif defined (CONFIG_IA64_XEN)
-	return "xen";
-# else
-#	error Unknown platform.  Fix acpi.c.
-# endif
-#endif
-}
-
-#ifdef CONFIG_ACPI
-
-#define ACPI_MAX_PLATFORM_INTERRUPTS	256
-
-/* Array to record platform interrupt vectors for generic interrupt routing. */
-int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
-	[0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
-};
-
-/*
- * Interrupt routing API for device drivers.  Provides interrupt vector for
- * a generic platform event.  Currently only CPEI is implemented.
- */
-int acpi_request_vector(u32 int_type)
-{
-	int vector = -1;
-
-	if (int_type < ACPI_MAX_PLATFORM_INTERRUPTS) {
-		/* corrected platform error interrupt */
-		vector = platform_intr_list[int_type];
-	} else
-		printk(KERN_ERR
-		       "acpi_request_vector(): invalid interrupt type\n");
-	return vector;
-}
-
-char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size)
-{
-	return __va(phys_addr);
-}
-
-/* --------------------------------------------------------------------------
-                            Boot-time Table Parsing
-   -------------------------------------------------------------------------- */
-
-static int total_cpus __initdata;
-static int available_cpus __initdata;
-struct acpi_table_madt *acpi_madt __initdata;
-static u8 has_8259;
-
-static int __init
-acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
-			  const unsigned long end)
-{
-	struct acpi_madt_local_apic_override *lapic;
-
-	lapic = (struct acpi_madt_local_apic_override *)header;
-
-	if (BAD_MADT_ENTRY(lapic, end))
-		return -EINVAL;
-
-	if (lapic->address) {
-		iounmap(ipi_base_addr);
-		ipi_base_addr = ioremap(lapic->address, 0);
-	}
-	return 0;
-}
-
-#ifdef XEN
-
-#define MAX_LOCAL_SAPIC 255
-static u16 ia64_acpiid_to_sapicid[ MAX_LOCAL_SAPIC ] =
-		{[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
-
-/* acpi id to cpu id */
-int get_cpu_id(u32 acpi_id)
-{
-	int i;
-	u16 apic_id;
-
-	if ( acpi_id >= MAX_LOCAL_SAPIC )
-		return -EINVAL;
-
-	apic_id = ia64_acpiid_to_sapicid[acpi_id];
-	if ( apic_id == 0xffff )
-		return -EINVAL;
-
-	for ( i = 0; i < NR_CPUS; i++ )
-	{
-		if ( apic_id == ia64_cpu_to_sapicid[i] )
-			return i;
-	}
-
-	return -1;
-}
-
-int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *pdc, u32 mask)
-{
-	pdc[2] |= ACPI_PDC_EST_CAPABILITY_SMP & mask;
-	return 0;
-}
-
-#endif
-
-static int __init
-acpi_parse_lsapic(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_local_sapic *lsapic;
-
-	lsapic = (struct acpi_madt_local_sapic *)header;
-
-	/*Skip BAD_MADT_ENTRY check, as lsapic size could vary */
-
-	if (lsapic->lapic_flags & ACPI_MADT_ENABLED) {
-#ifdef CONFIG_SMP
-		smp_boot_data.cpu_phys_id[available_cpus] =
-		    (lsapic->id << 8) | lsapic->eid;
-#endif
-#ifdef XEN
-        ia64_acpiid_to_sapicid[lsapic->processor_id] =
-            (lsapic->id << 8) | lsapic->eid;
-#endif
-		++available_cpus;
-	}
-
-	total_cpus++;
-	return 0;
-}
-
-static int __init
-acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_local_apic_nmi *lacpi_nmi;
-
-	lacpi_nmi = (struct acpi_madt_local_apic_nmi *)header;
-
-	if (BAD_MADT_ENTRY(lacpi_nmi, end))
-		return -EINVAL;
-
-	/* TBD: Support lapic_nmi entries */
-	return 0;
-}
-
-static int __init
-acpi_parse_iosapic(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_io_sapic *iosapic;
-
-	iosapic = (struct acpi_madt_io_sapic *)header;
-
-	if (BAD_MADT_ENTRY(iosapic, end))
-		return -EINVAL;
-
-#ifndef XEN
-	return iosapic_init(iosapic->address, iosapic->global_irq_base);
-#else
-	return iosapic_init(iosapic->address, iosapic->global_irq_base,
-			    iosapic->id);
-#endif
-}
-
-static unsigned int __initdata acpi_madt_rev;
-
-static int __init
-acpi_parse_plat_int_src(struct acpi_subtable_header * header,
-			const unsigned long end)
-{
-	struct acpi_madt_interrupt_source *plintsrc;
-	int vector;
-
-	plintsrc = (struct acpi_madt_interrupt_source *)header;
-
-	if (BAD_MADT_ENTRY(plintsrc, end))
-		return -EINVAL;
-
-	/*
-	 * Get vector assignment for this interrupt, set attributes,
-	 * and program the IOSAPIC routing table.
-	 */
-	vector = iosapic_register_platform_intr(plintsrc->type,
-						plintsrc->global_irq,
-						plintsrc->io_sapic_vector,
-						plintsrc->eid,
-						plintsrc->id,
-						((plintsrc->inti_flags & ACPI_MADT_POLARITY_MASK) ==
-						 ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
-						IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-						((plintsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
-						 ACPI_MADT_TRIGGER_EDGE) ?
-						IOSAPIC_EDGE : IOSAPIC_LEVEL);
-
-	platform_intr_list[plintsrc->type] = vector;
-	if (acpi_madt_rev > 1) {
-		acpi_cpei_override = plintsrc->flags & ACPI_MADT_CPEI_OVERRIDE;
-	}
-
-	/*
-	 * Save the physical id, so we can check when its being removed
-	 */
-	acpi_cpei_phys_cpuid = ((plintsrc->id << 8) | (plintsrc->eid)) & 0xffff;
-
-	return 0;
-}
-
-#ifdef CONFIG_HOTPLUG_CPU
-
-#ifdef XEN
-unsigned int force_cpei_retarget = 0;
-#endif
-
-unsigned int can_cpei_retarget(void)
-{
-	extern int cpe_vector;
-	extern unsigned int force_cpei_retarget;
-
-	/*
-	 * Only if CPEI is supported and the override flag
-	 * is present, otherwise return that its re-targettable
-	 * if we are in polling mode.
-	 */
-	if (cpe_vector > 0) {
-		if (acpi_cpei_override || force_cpei_retarget)
-			return 1;
-		else
-			return 0;
-	}
-	return 1;
-}
-
-unsigned int is_cpu_cpei_target(unsigned int cpu)
-{
-	unsigned int logical_id;
-
-	logical_id = cpu_logical_id(acpi_cpei_phys_cpuid);
-
-	if (logical_id == cpu)
-		return 1;
-	else
-		return 0;
-}
-
-void set_cpei_target_cpu(unsigned int cpu)
-{
-	acpi_cpei_phys_cpuid = cpu_physical_id(cpu);
-}
-#endif
-
-unsigned int get_cpei_target_cpu(void)
-{
-	return acpi_cpei_phys_cpuid;
-}
-
-static int __init
-acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
-		       const unsigned long end)
-{
-	struct acpi_madt_interrupt_override *p;
-
-	p = (struct acpi_madt_interrupt_override *)header;
-
-	if (BAD_MADT_ENTRY(p, end))
-		return -EINVAL;
-
-	iosapic_override_isa_irq(p->source_irq, p->global_irq,
-				 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) ==
-				  ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
-				 IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-				 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
-				 ACPI_MADT_TRIGGER_EDGE) ?
-				 IOSAPIC_EDGE : IOSAPIC_LEVEL);
-	return 0;
-}
-
-static int __init
-acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
-{
-	struct acpi_madt_nmi_source *nmi_src;
-
-	nmi_src = (struct acpi_madt_nmi_source *)header;
-
-	if (BAD_MADT_ENTRY(nmi_src, end))
-		return -EINVAL;
-
-	/* TBD: Support nimsrc entries */
-	return 0;
-}
-
-static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
-{
-	if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
-
-		/*
-		 * Unfortunately ITC_DRIFT is not yet part of the
-		 * official SAL spec, so the ITC_DRIFT bit is not
-		 * set by the BIOS on this hardware.
-		 */
-		sal_platform_features |= IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT;
-
-#ifndef XEN
-		cyclone_setup();
-#endif
-	}
-}
-
-static int __init acpi_parse_madt(struct acpi_table_header *table)
-{
-	if (!table)
-		return -EINVAL;
-
-	acpi_madt = (struct acpi_table_madt *)table;
-
-	acpi_madt_rev = acpi_madt->header.revision;
-
-	/* remember the value for reference after free_initmem() */
-#ifdef CONFIG_ITANIUM
-	has_8259 = 1;		/* Firmware on old Itanium systems is broken */
-#else
-	has_8259 = acpi_madt->flags & ACPI_MADT_PCAT_COMPAT;
-#endif
-	iosapic_system_init(has_8259);
-
-	/* Get base address of IPI Message Block */
-
-	if (acpi_madt->address)
-		ipi_base_addr = ioremap(acpi_madt->address, 0);
-
-	printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
-
-	acpi_madt_oem_check(acpi_madt->header.oem_id,
-			    acpi_madt->header.oem_table_id);
-
-	return 0;
-}
-
-#ifdef CONFIG_ACPI_NUMA
-
-#undef SLIT_DEBUG
-
-#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
-
-static int __initdata srat_num_cpus;	/* number of cpus */
-static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
-#define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))
-#define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))
-static struct acpi_table_slit __initdata *slit_table;
-cpumask_t early_cpu_possible_map = CPU_MASK_NONE;
-
-static int __init
-get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
-{
-	int pxm;
-
-	pxm = pa->proximity_domain_lo;
-	if (srat_rev >= 2) {
-		pxm += pa->proximity_domain_hi[0] << 8;
-		pxm += pa->proximity_domain_hi[1] << 16;
-		pxm += pa->proximity_domain_hi[2] << 24;
-	} else if (ia64_platform_is("sn2"))
-		pxm += pa->proximity_domain_hi[0] << 8;
-	return pxm;
-}
-
-static int __init
-get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
-{
-	int pxm;
-
-	pxm = ma->proximity_domain;
-	if (!ia64_platform_is("sn2") && srat_rev < 2)
-		pxm &= 0xff;
-
-	return pxm;
-}
-
-/*
- * ACPI 2.0 SLIT (System Locality Information Table)
- * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
- */
-void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
-{
-	u32 len;
-
-	len = sizeof(struct acpi_table_header) + 8
-	    + slit->locality_count * slit->locality_count;
-	if (slit->header.length != len) {
-		printk(KERN_ERR
-		       "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
-		       len, slit->header.length);
-		memset(numa_slit, 10, sizeof(numa_slit));
-		return;
-	}
-	slit_table = slit;
-}
-
-void __init
-acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
-{
-	int pxm;
-
-	if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))
-		return;
-
-	pxm = get_processor_proximity_domain(pa);
-
-	/* record this node in proximity bitmap */
-	pxm_bit_set(pxm);
-
-	node_cpuid[srat_num_cpus].phys_id =
-	    (pa->apic_id << 8) | (pa->local_sapic_eid);
-	/* nid should be overridden as logical node id later */
-	node_cpuid[srat_num_cpus].nid = pxm;
-	cpumask_set_cpu(srat_num_cpus, &early_cpu_possible_map);
-	srat_num_cpus++;
-}
-
-void __init
-acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
-{
-	unsigned long paddr, size;
-	int pxm;
-	struct node_memblk_s *p, *q, *pend;
-
-	pxm = get_memory_proximity_domain(ma);
-
-	/* fill node memory chunk structure */
-	paddr = ma->base_address;
-	size = ma->length;
-
-	/* Ignore disabled entries */
-	if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
-		return;
-
-	/* record this node in proximity bitmap */
-	pxm_bit_set(pxm);
-
-	/* Insertion sort based on base address */
-	pend = &node_memblk[num_node_memblks];
-	for (p = &node_memblk[0]; p < pend; p++) {
-		if (paddr < p->start_paddr)
-			break;
-	}
-	if (p < pend) {
-		for (q = pend - 1; q >= p; q--)
-			*(q + 1) = *q;
-	}
-	p->start_paddr = paddr;
-	p->size = size;
-	p->nid = pxm;
-	num_node_memblks++;
-}
-
-void __init acpi_numa_arch_fixup(void)
-{
-	int i, j, node_from, node_to;
-
-	/* If there's no SRAT, fix the phys_id and mark node 0 online */
-	if (srat_num_cpus == 0) {
-		node_set_online(0);
-		node_cpuid[0].phys_id = hard_smp_processor_id();
-		return;
-	}
-
-	/*
-	 * MCD - This can probably be dropped now.  No need for pxm ID to node ID
-	 * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
-	 */
-	nodes_clear(node_online_map);
-	for (i = 0; i < MAX_PXM_DOMAINS; i++) {
-		if (pxm_bit_test(i)) {
-			int nid = acpi_map_pxm_to_node(i);
-			node_set_online(nid);
-		}
-	}
-
-	/* set logical node id in memory chunk structure */
-	for (i = 0; i < num_node_memblks; i++)
-		node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
-
-	/* assign memory bank numbers for each chunk on each node */
-	for_each_online_node(i) {
-		int bank;
-
-		bank = 0;
-		for (j = 0; j < num_node_memblks; j++)
-			if (node_memblk[j].nid == i)
-				node_memblk[j].bank = bank++;
-	}
-
-	/* set logical node id in cpu structure */
-	for_each_possible_early_cpu(i)
-		node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
-
-	printk(KERN_INFO "Number of logical nodes in system = %d\n",
-	       num_online_nodes());
-	printk(KERN_INFO "Number of memory chunks in system = %d\n",
-	       num_node_memblks);
-
-	if (!slit_table)
-		return;
-	memset(numa_slit, -1, sizeof(numa_slit));
-	for (i = 0; i < slit_table->locality_count; i++) {
-		if (!pxm_bit_test(i))
-			continue;
-		node_from = pxm_to_node(i);
-		for (j = 0; j < slit_table->locality_count; j++) {
-			if (!pxm_bit_test(j))
-				continue;
-			node_to = pxm_to_node(j);
-			node_distance(node_from, node_to) =
-			    slit_table->entry[i * slit_table->locality_count + j];
-		}
-	}
-
-#ifdef SLIT_DEBUG
-	printk("ACPI 2.0 SLIT locality table:\n");
-	for_each_online_node(i) {
-		for_each_online_node(j)
-		    printk("%03d ", node_distance(i, j));
-		printk("\n");
-	}
-#endif
-}
-#endif				/* CONFIG_ACPI_NUMA */
-
-#ifndef XEN
-/*
- * success: return IRQ number (>=0)
- * failure: return < 0
- */
-int acpi_register_gsi(u32 gsi, int triggering, int polarity)
-{
-	if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
-		return gsi;
-
-	if (has_8259 && gsi < 16)
-		return isa_irq_to_vector(gsi);
-
-	return iosapic_register_intr(gsi,
-				     (polarity ==
-				      ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
-				     IOSAPIC_POL_LOW,
-				     (triggering ==
-				      ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
-				     IOSAPIC_LEVEL);
-}
-
-void acpi_unregister_gsi(u32 gsi)
-{
-	if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
-		return;
-
-	if (has_8259 && gsi < 16)
-		return;
-
-	iosapic_unregister_intr(gsi);
-}
-#endif
-
-static int __init acpi_parse_fadt(struct acpi_table_header *table)
-{
-	struct acpi_table_header *fadt_header;
-	struct acpi_table_fadt *fadt;
-
-	if (!table)
-		return -EINVAL;
-
-	fadt_header = (struct acpi_table_header *)table;
-	if (fadt_header->revision != 3)
-		return -ENODEV;	/* Only deal with ACPI 2.0 FADT */
-
-	fadt = (struct acpi_table_fadt *)fadt_header;
-
-#ifndef XEN
-	acpi_register_gsi(fadt->sci_interrupt, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
-#endif
-	return 0;
-}
-
-int __init acpi_boot_init(void)
-{
-
-	/*
-	 * MADT
-	 * ----
-	 * Parse the Multiple APIC Description Table (MADT), if exists.
-	 * Note that this table provides platform SMP configuration
-	 * information -- the successor to MPS tables.
-	 */
-
-	if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
-		printk(KERN_ERR PREFIX "Can't find MADT\n");
-		goto skip_madt;
-	}
-
-	/* Local APIC */
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, acpi_parse_lapic_addr_ovr, 0) < 0)
-		printk(KERN_ERR PREFIX
-		       "Error parsing LAPIC address override entry\n");
-
-	if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, acpi_parse_lsapic, NR_CPUS)
-	    < 1)
-		printk(KERN_ERR PREFIX
-		       "Error parsing MADT - no LAPIC entries\n");
-
-	if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0)
-	    < 0)
-		printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
-
-	/* I/O APIC */
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_IO_SAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) {
-		if (!ia64_platform_is("sn2"))
-			printk(KERN_ERR PREFIX
-			       "Error parsing MADT - no IOSAPIC entries\n");
-	}
-
-	/* System-Level Interrupt Routing */
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_INTERRUPT_SOURCE, acpi_parse_plat_int_src,
-	     ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
-		printk(KERN_ERR PREFIX
-		       "Error parsing platform interrupt source entry\n");
-
-	if (acpi_table_parse_madt
-	    (ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr, 0) < 0)
-		printk(KERN_ERR PREFIX
-		       "Error parsing interrupt source overrides entry\n");
-
-	if (acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src, 0) < 0)
-		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
-      skip_madt:
-
-	/*
-	 * FADT says whether a legacy keyboard controller is present.
-	 * The FADT also contains an SCI_INT line, by which the system
-	 * gets interrupts such as power and sleep buttons.  If it's not
-	 * on a Legacy interrupt, it needs to be setup.
-	 */
-	if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt))
-		printk(KERN_ERR PREFIX "Can't find FADT\n");
-
-#ifdef XEN
-	acpi_dmar_init();
-#endif
-
-#ifdef CONFIG_SMP
-	if (available_cpus == 0) {
-		printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
-		printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
-		smp_boot_data.cpu_phys_id[available_cpus] =
-		    hard_smp_processor_id();
-		available_cpus = 1;	/* We've got at least one of these, no? */
-	}
-	smp_boot_data.cpu_count = available_cpus;
-
-	smp_build_cpu_map();
-# ifdef CONFIG_ACPI_NUMA
-	if (srat_num_cpus == 0) {
-		int cpu, i = 1;
-		for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
-			if (smp_boot_data.cpu_phys_id[cpu] !=
-			    hard_smp_processor_id())
-				node_cpuid[i++].phys_id =
-				    smp_boot_data.cpu_phys_id[cpu];
-	}
-# endif
-#endif
-#ifdef CONFIG_ACPI_NUMA
-	build_cpu_to_node_map();
-#endif
-	/* Make boot-up look pretty */
-	printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
-	       total_cpus);
-	return 0;
-}
-
-int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
-{
-	int tmp;
-
-	if (has_8259 && gsi < 16)
-		*irq = isa_irq_to_vector(gsi);
-	else {
-		tmp = gsi_to_irq(gsi);
-		if (tmp == -1)
-			return -1;
-		*irq = tmp;
-	}
-	return 0;
-}
-
-/*
- *  ACPI based hotplug CPU support
- */
-#ifdef CONFIG_ACPI_HOTPLUG_CPU
-static
-int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
-{
-#ifdef CONFIG_ACPI_NUMA
-	int pxm_id;
-	int nid;
-
-	pxm_id = acpi_get_pxm(handle);
-	/*
-	 * We don't have cpu-only-node hotadd. But if the system equips
-	 * SRAT table, pxm is already found and node is ready.
-  	 * So, just pxm_to_nid(pxm) is OK.
-	 * This code here is for the system which doesn't have full SRAT
-  	 * table for possible cpus.
-	 */
-	nid = acpi_map_pxm_to_node(pxm_id);
-	node_cpuid[cpu].phys_id = physid;
-	node_cpuid[cpu].nid = nid;
-#endif
-	return (0);
-}
-
-int additional_cpus __initdata = -1;
-
-static __init int setup_additional_cpus(char *s)
-{
-	if (s)
-		additional_cpus = simple_strtol(s, NULL, 0);
-
-	return 0;
-}
-
-early_param("additional_cpus", setup_additional_cpus);
-
-/*
- * cpu_possible_map should be static, it cannot change as CPUs
- * are onlined, or offlined. The reason is per-cpu data-structures
- * are allocated by some modules at init time, and dont expect to
- * do this dynamically on cpu arrival/departure.
- * cpu_present_map on the other hand can change dynamically.
- * In case when cpu_hotplug is not compiled, then we resort to current
- * behaviour, which is cpu_possible == cpu_present.
- * - Ashok Raj
- *
- * Three ways to find out the number of additional hotplug CPUs:
- * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
- * - The user can overwrite it with additional_cpus=NUM
- * - Otherwise don't reserve additional CPUs.
- */
-__init void prefill_possible_map(void)
-{
-	int i;
-	int possible, disabled_cpus;
-
-	disabled_cpus = total_cpus - available_cpus;
-
- 	if (additional_cpus == -1) {
- 		if (disabled_cpus > 0)
-			additional_cpus = disabled_cpus;
- 		else
-			additional_cpus = 0;
- 	}
-
-	possible = available_cpus + additional_cpus;
-
-	if (possible > NR_CPUS)
-		possible = NR_CPUS;
-
-	printk(KERN_INFO "SMP: Allowing %d CPUs, %d hotplug CPUs\n",
-		possible, max((possible - available_cpus), 0));
-
-	for (i = 0; i < possible; i++)
-		cpumask_set_cpu(i, &cpu_possible_map);
-}
-
-#ifndef XEN
-int acpi_map_lsapic(acpi_handle handle, int *pcpu)
-{
-	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-	union acpi_object *obj;
-	struct acpi_madt_local_sapic *lsapic;
-	cpumask_t tmp_map;
-	long physid;
-	int cpu;
-
-	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
-		return -EINVAL;
-
-	if (!buffer.length || !buffer.pointer)
-		return -EINVAL;
-
-	obj = buffer.pointer;
-	if (obj->type != ACPI_TYPE_BUFFER)
-	{
-		kfree(buffer.pointer);
-		return -EINVAL;
-	}
-
-	lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer;
-
-	if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
-	    (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))) {
-		kfree(buffer.pointer);
-		return -EINVAL;
-	}
-
-	physid = ((lsapic->id << 8) | (lsapic->eid));
-
-	kfree(buffer.pointer);
-	buffer.length = ACPI_ALLOCATE_BUFFER;
-	buffer.pointer = NULL;
-
-	cpumask_complement(&tmp_map, &cpu_present_map);
-	cpu = cpumask_first(&tmp_map);
-	if (cpu >= nr_cpu_ids)
-		return -EINVAL;
-
-	acpi_map_cpu2node(handle, cpu, physid);
-
-	cpumask_set_cpu(cpu, &cpu_present_map);
-	ia64_cpu_to_sapicid[cpu] = physid;
-
-	*pcpu = cpu;
-	return (0);
-}
-
-EXPORT_SYMBOL(acpi_map_lsapic);
-
-int acpi_unmap_lsapic(int cpu)
-{
-	ia64_cpu_to_sapicid[cpu] = -1;
-	cpumask_clear_cpu(cpu, &cpu_present_map);
-
-#ifdef CONFIG_ACPI_NUMA
-	/* NUMA specific cleanup's */
-#endif
-
-	return (0);
-}
-
-EXPORT_SYMBOL(acpi_unmap_lsapic);
-#endif /* XEN */
-#endif				/* CONFIG_ACPI_HOTPLUG_CPU */
-
-#ifndef XEN
-#ifdef CONFIG_ACPI_NUMA
-static acpi_status __devinit
-acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
-{
-	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-	union acpi_object *obj;
-	struct acpi_madt_io_sapic *iosapic;
-	unsigned int gsi_base;
-	int pxm, node;
-
-	/* Only care about objects w/ a method that returns the MADT */
-	if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
-		return AE_OK;
-
-	if (!buffer.length || !buffer.pointer)
-		return AE_OK;
-
-	obj = buffer.pointer;
-	if (obj->type != ACPI_TYPE_BUFFER ||
-	    obj->buffer.length < sizeof(*iosapic)) {
-		kfree(buffer.pointer);
-		return AE_OK;
-	}
-
-	iosapic = (struct acpi_madt_io_sapic *)obj->buffer.pointer;
-
-	if (iosapic->header.type != ACPI_MADT_TYPE_IO_SAPIC) {
-		kfree(buffer.pointer);
-		return AE_OK;
-	}
-
-	gsi_base = iosapic->global_irq_base;
-
-	kfree(buffer.pointer);
-
-	/*
-	 * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell
-	 * us which node to associate this with.
-	 */
-	pxm = acpi_get_pxm(handle);
-	if (pxm < 0)
-		return AE_OK;
-
-	node = pxm_to_node(pxm);
-
-	if (node >= MAX_NUMNODES || !node_online(node) ||
-	    cpus_empty(node_to_cpumask(node)))
-		return AE_OK;
-
-	/* We know a gsi to node mapping! */
-	map_iosapic_to_node(gsi_base, node);
-	return AE_OK;
-}
-
-static int __init
-acpi_map_iosapics (void)
-{
-	acpi_get_devices(NULL, acpi_map_iosapic, NULL, NULL);
-	return 0;
-}
-
-fs_initcall(acpi_map_iosapics);
-#endif				/* CONFIG_ACPI_NUMA */
-
-int __ref acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
-{
-	int err;
-
-	if ((err = iosapic_init(phys_addr, gsi_base)))
-		return err;
-
-#ifdef CONFIG_ACPI_NUMA
-	acpi_map_iosapic(handle, 0, NULL, NULL);
-#endif				/* CONFIG_ACPI_NUMA */
-
-	return 0;
-}
-
-EXPORT_SYMBOL(acpi_register_ioapic);
-
-int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
-{
-	return iosapic_remove(gsi_base);
-}
-
-EXPORT_SYMBOL(acpi_unregister_ioapic);
-#endif /* XEN */
-
-/*
- * acpi_save_state_mem() - save kernel state
- *
- * TBD when when IA64 starts to support suspend...
- */
-int acpi_save_state_mem(void) { return 0; } 
-
-/*
- * acpi_restore_state()
- */
-void acpi_restore_state_mem(void) {}
-
-/*
- * do_suspend_lowlevel()
- */
-void do_suspend_lowlevel(void) {}
-
-#endif				/* CONFIG_ACPI */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/acpi_numa.c
--- a/xen/arch/ia64/linux-xen/acpi_numa.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +0,0 @@
-/*
- *  acpi_numa.c - ACPI NUMA support
- *
- *  Copyright (C) 2002 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/acpi.h>
-#include <acpi/acmacros.h>
-
-#ifndef XEN
-#define ACPI_NUMA	0x80000000
-#define _COMPONENT	ACPI_NUMA
-ACPI_MODULE_NAME("numa");
-#else
-#define NID_INVAL	-1
-#define PXM_INVAL	-1
-#endif
-
-#ifndef XEN
-static nodemask_t nodes_found_map = NODE_MASK_NONE;
-#else
-/* the above causes error: initializer element is not constant
- * anyway NODE_MASK_NONE is 0 filled array.
- */
-static nodemask_t nodes_found_map;
-#endif
-
-/* maps to convert between proximity domain and logical node ID */
-static int pxm_to_node_map[MAX_PXM_DOMAINS]
-				= { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL };
-static int node_to_pxm_map[MAX_NUMNODES]
-				= { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
-
-int pxm_to_node(int pxm)
-{
-	if (pxm < 0)
-		return NID_INVAL;
-	return pxm_to_node_map[pxm];
-}
-
-int node_to_pxm(int node)
-{
-	if (node < 0)
-		return PXM_INVAL;
-	return node_to_pxm_map[node];
-}
-
-void __acpi_map_pxm_to_node(int pxm, int node)
-{
-	pxm_to_node_map[pxm] = node;
-	node_to_pxm_map[node] = pxm;
-}
-
-int acpi_map_pxm_to_node(int pxm)
-{
-	int node = pxm_to_node_map[pxm];
-
-	if (node < 0){
-		if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
-			return NID_INVAL;
-		node = first_unset_node(nodes_found_map);
-		__acpi_map_pxm_to_node(pxm, node);
-		node_set(node, nodes_found_map);
-	}
-
-	return node;
-}
-
-#ifndef XEN
-#if 0
-void __cpuinit acpi_unmap_pxm_to_node(int node)
-{
-	int pxm = node_to_pxm_map[node];
-	pxm_to_node_map[pxm] = NID_INVAL;
-	node_to_pxm_map[node] = PXM_INVAL;
-	node_clear(node, nodes_found_map);
-}
-#endif  /*  0  */
-
-static void __init
-acpi_table_print_srat_entry(struct acpi_subtable_header *header)
-{
-
-	ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
-
-	if (!header)
-		return;
-
-	switch (header->type) {
-
-	case ACPI_SRAT_TYPE_CPU_AFFINITY:
-#ifdef ACPI_DEBUG_OUTPUT
-		{
-			struct acpi_srat_cpu_affinity *p =
-			    (struct acpi_srat_cpu_affinity *)header;
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-					  "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
-					  p->apic_id, p->local_sapic_eid,
-					  p->proximity_domain_lo,
-					  (p->flags & ACPI_SRAT_CPU_ENABLED)?
-					  "enabled" : "disabled"));
-		}
-#endif				/* ACPI_DEBUG_OUTPUT */
-		break;
-
-	case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
-#ifdef ACPI_DEBUG_OUTPUT
-		{
-			struct acpi_srat_mem_affinity *p =
-			    (struct acpi_srat_mem_affinity *)header;
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-					  "SRAT Memory (0x%lx length 0x%lx type 0x%x) in proximity domain %d %s%s\n",
-					  (unsigned long)p->base_address,
-					  (unsigned long)p->length,
-					  p->memory_type, p->proximity_domain,
-					  (p->flags & ACPI_SRAT_MEM_ENABLED)?
-					  "enabled" : "disabled",
-					  (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)?
-					  " hot-pluggable" : ""));
-		}
-#endif				/* ACPI_DEBUG_OUTPUT */
-		break;
-
-	default:
-		printk(KERN_WARNING PREFIX
-		       "Found unsupported SRAT entry (type = 0x%x)\n",
-		       header->type);
-		break;
-	}
-}
-
-static int __init acpi_parse_slit(struct acpi_table_header *table)
-{
-	struct acpi_table_slit *slit;
-	u32 localities;
-
-	if (!table)
-		return -EINVAL;
-
-	slit = (struct acpi_table_slit *)table;
-
-	/* downcast just for %llu vs %lu for i386/ia64  */
-	localities = (u32) slit->locality_count;
-
-	acpi_numa_slit_init(slit);
-
-	return 0;
-}
-
-static int __init
-acpi_parse_processor_affinity(struct acpi_subtable_header * header,
-			      const unsigned long end)
-{
-	struct acpi_srat_cpu_affinity *processor_affinity;
-
-	processor_affinity = (struct acpi_srat_cpu_affinity *)header;
-	if (!processor_affinity)
-		return -EINVAL;
-
-	acpi_table_print_srat_entry(header);
-
-	/* let architecture-dependent part to do it */
-	acpi_numa_processor_affinity_init(processor_affinity);
-
-	return 0;
-}
-
-static int __init
-acpi_parse_memory_affinity(struct acpi_subtable_header * header,
-			   const unsigned long end)
-{
-	struct acpi_srat_mem_affinity *memory_affinity;
-
-	memory_affinity = (struct acpi_srat_mem_affinity *)header;
-	if (!memory_affinity)
-		return -EINVAL;
-
-	acpi_table_print_srat_entry(header);
-
-	/* let architecture-dependent part to do it */
-	acpi_numa_memory_affinity_init(memory_affinity);
-
-	return 0;
-}
-
-static int __init acpi_parse_srat(struct acpi_table_header *table)
-{
-	struct acpi_table_srat *srat;
-
-	if (!table)
-		return -EINVAL;
-
-	srat = (struct acpi_table_srat *)table;
-
-	return 0;
-}
-
-static int __init
-acpi_table_parse_srat(enum acpi_srat_type id,
-		      acpi_table_entry_handler handler, unsigned int max_entries)
-{
-	return acpi_table_parse_entries(ACPI_SIG_SRAT,
-					    sizeof(struct acpi_table_srat), id,
-					    handler, max_entries);
-}
-
-int __init acpi_numa_init(void)
-{
-	/* SRAT: Static Resource Affinity Table */
-	if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
-		acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
-				      acpi_parse_processor_affinity, NR_CPUS);
-		acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
-				      acpi_parse_memory_affinity,
-				      NR_NODE_MEMBLKS);
-	}
-
-	/* SLIT: System Locality Information Table */
-	acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit);
-
-	acpi_numa_arch_fixup();
-	return 0;
-}
-
-int acpi_get_pxm(acpi_handle h)
-{
-	unsigned long pxm;
-	acpi_status status;
-	acpi_handle handle;
-	acpi_handle phandle = h;
-
-	do {
-		handle = phandle;
-		status = acpi_evaluate_integer(handle, "_PXM", NULL, &pxm);
-		if (ACPI_SUCCESS(status))
-			return pxm;
-		status = acpi_get_parent(handle, &phandle);
-	} while (ACPI_SUCCESS(status));
-	return -1;
-}
-
-int acpi_get_node(acpi_handle *handle)
-{
-	int pxm, node = -1;
-
-	pxm = acpi_get_pxm(handle);
-	if (pxm >= 0)
-		node = acpi_map_pxm_to_node(pxm);
-
-	return node;
-}
-EXPORT_SYMBOL(acpi_get_node);
-#endif /* XEN */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/cmdline.c
--- a/xen/arch/ia64/linux-xen/cmdline.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * linux/lib/cmdline.c
- * Helper functions generally used for parsing kernel command line
- * and module options.
- *
- * Code and copyrights come from init/main.c and arch/i386/kernel/setup.c.
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2.  See the file COPYING for more details.
- *
- * GNU Indent formatting options for this file: -kr -i8 -npsl -pcs
- *
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#ifdef XEN
-#include <xen/lib.h>
-#endif
-
-
-/**
- *	get_option - Parse integer from an option string
- *	@str: option string
- *	@pint: (output) integer value parsed from @str
- *
- *	Read an int from an option string; if available accept a subsequent
- *	comma as well.
- *
- *	Return values:
- *	0 : no int in string
- *	1 : int found, no subsequent comma
- *	2 : int found including a subsequent comma
- */
-
-int get_option (char **str, int *pint)
-{
-	char *cur = *str;
-
-	if (!cur || !(*cur))
-		return 0;
-#ifndef XEN
-	*pint = simple_strtol (cur, str, 0);
-#else
-	*pint = simple_strtol (cur, (const char**)str, 0);
-#endif
-	if (cur == *str)
-		return 0;
-	if (**str == ',') {
-		(*str)++;
-		return 2;
-	}
-
-	return 1;
-}
-
-/**
- *	get_options - Parse a string into a list of integers
- *	@str: String to be parsed
- *	@nints: size of integer array
- *	@ints: integer array
- *
- *	This function parses a string containing a comma-separated
- *	list of integers.  The parse halts when the array is
- *	full, or when no more numbers can be retrieved from the
- *	string.
- *
- *	Return value is the character in the string which caused
- *	the parse to end (typically a null terminator, if @str is
- *	completely parseable).
- */
- 
-char *get_options(const char *str, int nints, int *ints)
-{
-	int res, i = 1;
-
-	while (i < nints) {
-		res = get_option ((char **)&str, ints + i);
-		if (res == 0)
-			break;
-		i++;
-		if (res == 1)
-			break;
-	}
-	ints[0] = i - 1;
-	return (char *)str;
-}
-
-/**
- *	memparse - parse a string with mem suffixes into a number
- *	@ptr: Where parse begins
- *	@retptr: (output) Pointer to next char after parse completes
- *
- *	Parses a string into a number.  The number stored at @ptr is
- *	potentially suffixed with %K (for kilobytes, or 1024 bytes),
- *	%M (for megabytes, or 1048576 bytes), or %G (for gigabytes, or
- *	1073741824).  If the number is suffixed with K, M, or G, then
- *	the return value is the number multiplied by one kilobyte, one
- *	megabyte, or one gigabyte, respectively.
- */
-
-unsigned long long memparse (char *ptr, char **retptr)
-{
-#ifndef XEN
-	unsigned long long ret = simple_strtoull (ptr, retptr, 0);
-#else
-	unsigned long long ret = simple_strtoull (ptr, (const char**)retptr, 0);
-#endif
-
-	switch (**retptr) {
-	case 'G':
-	case 'g':
-		ret <<= 10;
-	case 'M':
-	case 'm':
-		ret <<= 10;
-	case 'K':
-	case 'k':
-		ret <<= 10;
-		(*retptr)++;
-	default:
-		break;
-	}
-	return ret;
-}
-
-
-EXPORT_SYMBOL(memparse);
-EXPORT_SYMBOL(get_option);
-EXPORT_SYMBOL(get_options);
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/efi.c
--- a/xen/arch/ia64/linux-xen/efi.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1334 +0,0 @@
-/*
- * Extensible Firmware Interface
- *
- * Based on Extensible Firmware Interface Specification version 0.9 April 30, 1999
- *
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- * Copyright (C) 1999-2003 Hewlett-Packard Co.
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *	Stephane Eranian <eranian@hpl.hp.com>
- * (c) Copyright 2006 Hewlett-Packard Development Company, L.P.
- *	Bjorn Helgaas <bjorn.helgaas@hp.com>
- *
- * All EFI Runtime Services are not implemented yet as EFI only
- * supports physical mode addressing on SoftSDV. This is to be fixed
- * in a future version.  --drummond 1999-07-20
- *
- * Implemented EFI runtime services and virtual mode calls.  --davidm
- *
- * Goutham Rao: <goutham.rao@intel.com>
- *	Skip non-WB memory and ignore empty memory ranges.
- */
-#include <linux/module.h>
-#include <linux/bootmem.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/time.h>
-#include <linux/efi.h>
-#include <linux/kexec.h>
-
-#include <asm/io.h>
-#include <asm/kregs.h>
-#include <asm/meminit.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/mca.h>
-
-#define EFI_DEBUG	0
-
-extern efi_status_t efi_call_phys (void *, ...);
-#ifdef XEN
-/* this should be defined in linux/kernel.h */
-extern unsigned long long memparse (char *ptr, char **retptr);
-/* this should be defined in linux/efi.h */
-//#define EFI_INVALID_TABLE_ADDR          (void *)(~0UL)
-#endif
-
-struct efi efi;
-EXPORT_SYMBOL(efi);
-static efi_runtime_services_t *runtime;
-#if defined(XEN) && !defined(CONFIG_VIRTUAL_FRAME_TABLE)
-// this is a temporary hack to avoid CONFIG_VIRTUAL_MEM_MAP
-static unsigned long mem_limit = ~0UL, max_addr = 0x100000000UL, min_addr = 0UL;
-#else
-static unsigned long mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;
-#endif
-
-#define efi_call_virt(f, args...)	(*(f))(args)
-
-#define STUB_GET_TIME(prefix, adjust_arg)							  \
-static efi_status_t										  \
-prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc)						  \
-{												  \
-	struct ia64_fpreg fr[6];								  \
-	efi_time_cap_t *atc = NULL;								  \
-	efi_status_t ret;									  \
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												  \
-	if (tc)											  \
-		atc = adjust_arg(tc);								  \
-	ia64_save_scratch_fpregs(fr);								  \
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), adjust_arg(tm), atc); \
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								  \
-	return ret;										  \
-}
-
-#define STUB_SET_TIME(prefix, adjust_arg)							\
-static efi_status_t										\
-prefix##_set_time (efi_time_t *tm)								\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_set_time_t *) __va(runtime->set_time), adjust_arg(tm));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_GET_WAKEUP_TIME(prefix, adjust_arg)						\
-static efi_status_t										\
-prefix##_get_wakeup_time (efi_bool_t *enabled, efi_bool_t *pending, efi_time_t *tm)		\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_wakeup_time_t *) __va(runtime->get_wakeup_time),	\
-				adjust_arg(enabled), adjust_arg(pending), adjust_arg(tm));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_SET_WAKEUP_TIME(prefix, adjust_arg)						\
-static efi_status_t										\
-prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm)					\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_time_t *atm = NULL;									\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	if (tm)											\
-		atm = adjust_arg(tm);								\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_set_wakeup_time_t *) __va(runtime->set_wakeup_time),	\
-				enabled, atm);							\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_GET_VARIABLE(prefix, adjust_arg)						\
-static efi_status_t									\
-prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr,		\
-		       unsigned long *data_size, void *data)				\
-{											\
-	struct ia64_fpreg fr[6];							\
-	u32 *aattr = NULL;									\
-	efi_status_t ret;								\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-											\
-	if (attr)									\
-		aattr = adjust_arg(attr);						\
-	ia64_save_scratch_fpregs(fr);							\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_variable_t *) __va(runtime->get_variable),	\
-				adjust_arg(name), adjust_arg(vendor), aattr,		\
-				adjust_arg(data_size), adjust_arg(data));		\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);							\
-	return ret;									\
-}
-
-#define STUB_GET_NEXT_VARIABLE(prefix, adjust_arg)						\
-static efi_status_t										\
-prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, efi_guid_t *vendor)	\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_next_variable_t *) __va(runtime->get_next_variable),	\
-				adjust_arg(name_size), adjust_arg(name), adjust_arg(vendor));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_SET_VARIABLE(prefix, adjust_arg)						\
-static efi_status_t									\
-prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, unsigned long attr,	\
-		       unsigned long data_size, void *data)				\
-{											\
-	struct ia64_fpreg fr[6];							\
-	efi_status_t ret;								\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-											\
-	ia64_save_scratch_fpregs(fr);							\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_set_variable_t *) __va(runtime->set_variable),	\
-				adjust_arg(name), adjust_arg(vendor), attr, data_size,	\
-				adjust_arg(data));					\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);							\
-	return ret;									\
-}
-
-#define STUB_GET_NEXT_HIGH_MONO_COUNT(prefix, adjust_arg)					\
-static efi_status_t										\
-prefix##_get_next_high_mono_count (u32 *count)							\
-{												\
-	struct ia64_fpreg fr[6];								\
-	efi_status_t ret;									\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-												\
-	ia64_save_scratch_fpregs(fr);								\
-	XEN_EFI_RR_ENTER(rr6, rr7);								  \
-	ret = efi_call_##prefix((efi_get_next_high_mono_count_t *)				\
-				__va(runtime->get_next_high_mono_count), adjust_arg(count));	\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);								\
-	return ret;										\
-}
-
-#define STUB_RESET_SYSTEM(prefix, adjust_arg)					\
-static void									\
-prefix##_reset_system (int reset_type, efi_status_t status,			\
-		       unsigned long data_size, efi_char16_t *data)		\
-{										\
-	struct ia64_fpreg fr[6];						\
-	efi_char16_t *adata = NULL;						\
-	XEN_EFI_RR_DECLARE(rr6, rr7);								  \
-										\
-	if (data)								\
-		adata = adjust_arg(data);					\
-										\
-	ia64_save_scratch_fpregs(fr);						\
-	XEN_EFI_RR_ENTER(rr6, rr7);						\
-	efi_call_##prefix((efi_reset_system_t *) __va(runtime->reset_system),	\
-			  reset_type, status, data_size, adata);		\
-	/* should not return, but just in case... */				\
-	XEN_EFI_RR_LEAVE(rr6, rr7);								  \
-	ia64_load_scratch_fpregs(fr);						\
-}
-
-#define phys_ptr(arg)	((__typeof__(arg)) ia64_tpa(arg))
-
-STUB_GET_TIME(phys, phys_ptr)
-STUB_SET_TIME(phys, phys_ptr)
-STUB_GET_WAKEUP_TIME(phys, phys_ptr)
-STUB_SET_WAKEUP_TIME(phys, phys_ptr)
-STUB_GET_VARIABLE(phys, phys_ptr)
-STUB_GET_NEXT_VARIABLE(phys, phys_ptr)
-STUB_SET_VARIABLE(phys, phys_ptr)
-STUB_GET_NEXT_HIGH_MONO_COUNT(phys, phys_ptr)
-STUB_RESET_SYSTEM(phys, phys_ptr)
-
-#define id(arg)	arg
-
-STUB_GET_TIME(virt, id)
-STUB_SET_TIME(virt, id)
-STUB_GET_WAKEUP_TIME(virt, id)
-STUB_SET_WAKEUP_TIME(virt, id)
-STUB_GET_VARIABLE(virt, id)
-STUB_GET_NEXT_VARIABLE(virt, id)
-STUB_SET_VARIABLE(virt, id)
-STUB_GET_NEXT_HIGH_MONO_COUNT(virt, id)
-STUB_RESET_SYSTEM(virt, id)
-
-#ifndef XEN
-void
-efi_gettimeofday (struct timespec *ts)
-{
-	efi_time_t tm;
-
-	memset(ts, 0, sizeof(ts));
-	if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS)
-		return;
-
-	ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
-	ts->tv_nsec = tm.nanosecond;
-}
-#endif
-
-static int
-is_memory_available (efi_memory_desc_t *md)
-{
-	if (!(md->attribute & EFI_MEMORY_WB))
-		return 0;
-
-	switch (md->type) {
-	      case EFI_LOADER_CODE:
-	      case EFI_LOADER_DATA:
-	      case EFI_BOOT_SERVICES_CODE:
-	      case EFI_BOOT_SERVICES_DATA:
-	      case EFI_CONVENTIONAL_MEMORY:
-		return 1;
-	}
-	return 0;
-}
-
-typedef struct kern_memdesc {
-	u64 attribute;
-	u64 start;
-	u64 num_pages;
-} kern_memdesc_t;
-
-static kern_memdesc_t *kern_memmap;
-
-#define efi_md_size(md)	(md->num_pages << EFI_PAGE_SHIFT)
-
-static inline u64
-kmd_end(kern_memdesc_t *kmd)
-{
-	return (kmd->start + (kmd->num_pages << EFI_PAGE_SHIFT));
-}
-
-static inline u64
-efi_md_end(efi_memory_desc_t *md)
-{
-	return (md->phys_addr + efi_md_size(md));
-}
-
-static inline int
-efi_wb(efi_memory_desc_t *md)
-{
-	return (md->attribute & EFI_MEMORY_WB);
-}
-
-static inline int
-efi_uc(efi_memory_desc_t *md)
-{
-	return (md->attribute & EFI_MEMORY_UC);
-}
-
-static void
-walk (efi_freemem_callback_t callback, void *arg, u64 attr)
-{
-	kern_memdesc_t *k;
-	u64 start, end, voff;
-
-	voff = (attr == EFI_MEMORY_WB) ? PAGE_OFFSET : __IA64_UNCACHED_OFFSET;
-	for (k = kern_memmap; k->start != ~0UL; k++) {
-		if (k->attribute != attr)
-			continue;
-		start = PAGE_ALIGN(k->start);
-		end = (k->start + (k->num_pages << EFI_PAGE_SHIFT)) & PAGE_MASK;
-		if (start < end)
-			if ((*callback)(start + voff, end + voff, arg) < 0)
-				return;
-	}
-}
-
-/*
- * Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that
- * has memory that is available for OS use.
- */
-void
-efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
-{
-	walk(callback, arg, EFI_MEMORY_WB);
-}
-
-/*
- * Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that
- * has memory that is available for uncached allocator.
- */
-void
-efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg)
-{
-	walk(callback, arg, EFI_MEMORY_UC);
-}
-
-/*
- * Look for the PAL_CODE region reported by EFI and maps it using an
- * ITR to enable safe PAL calls in virtual mode.  See IA-64 Processor
- * Abstraction Layer chapter 11 in ADAG
- */
-
-#ifdef XEN
-static void *
-__efi_get_pal_addr (void)
-#else
-void *
-efi_get_pal_addr (void)
-#endif
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-	int pal_code_count = 0;
-	u64 vaddr, mask;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-		if (md->type != EFI_PAL_CODE)
-			continue;
-
-		if (++pal_code_count > 1) {
-			printk(KERN_ERR "Too many EFI Pal Code memory ranges, dropped @ %lx\n",
-			       md->phys_addr);
-			continue;
-		}
-		/*
-		 * The only ITLB entry in region 7 that is used is the one installed by
-		 * __start().  That entry covers a 64MB range.
-		 */
-		mask  = ~((1 << KERNEL_TR_PAGE_SHIFT) - 1);
-		vaddr = PAGE_OFFSET + md->phys_addr;
-
-		/*
-		 * We must check that the PAL mapping won't overlap with the kernel
-		 * mapping.
-		 *
-		 * PAL code is guaranteed to be aligned on a power of 2 between 4k and
-		 * 256KB and that only one ITR is needed to map it. This implies that the
-		 * PAL code is always aligned on its size, i.e., the closest matching page
-		 * size supported by the TLB. Therefore PAL code is guaranteed never to
-		 * cross a 64MB unless it is bigger than 64MB (very unlikely!).  So for
-		 * now the following test is enough to determine whether or not we need a
-		 * dedicated ITR for the PAL code.
-		 */
-		if ((vaddr & mask) == (KERNEL_START & mask)) {
-			printk(KERN_INFO "%s: no need to install ITR for PAL code\n",
-			       __FUNCTION__);
-			continue;
-		}
-
-		if (md->num_pages << EFI_PAGE_SHIFT > IA64_GRANULE_SIZE)
-			panic("Woah!  PAL code size bigger than a granule!");
-
-#if EFI_DEBUG
-		mask  = ~((1 << IA64_GRANULE_SHIFT) - 1);
-
-		printk(KERN_INFO "CPU %d: mapping PAL code [0x%lx-0x%lx) into [0x%lx-0x%lx)\n",
-			smp_processor_id(), md->phys_addr,
-			md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
-			vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE);
-#endif
-		return __va_efi(md->phys_addr);
-	}
-	printk(KERN_WARNING "%s: no PAL-code memory-descriptor found\n",
-	       __FUNCTION__);
-	return NULL;
-}
-
-#ifdef XEN
-static void *pal_vaddr = 0;
-
-void *
-efi_get_pal_addr(void)
-{
-	if (!pal_vaddr)
-		pal_vaddr = __efi_get_pal_addr();
-	return pal_vaddr;
-}
-#endif
-
-#ifdef XEN
-static void
-__efi_unmap_pal_code (void *pal_vaddr)
-{
-	ia64_ptr(0x1, GRANULEROUNDDOWN((unsigned long)pal_vaddr),
-		 IA64_GRANULE_SHIFT);
-}
-
-void
-efi_unmap_pal_code (void)
-{
-	void *pal_vaddr = efi_get_pal_addr ();
-	u64 psr;
-
-	if (!pal_vaddr)
-		return;
-
-	/*
-	 * Cannot write to CRx with PSR.ic=1
-	 */
-	psr = ia64_clear_ic();
-	__efi_unmap_pal_code(pal_vaddr);
-	ia64_set_psr(psr);		/* restore psr */
-	ia64_srlz_i();
-}
-#endif
-
-void
-efi_map_pal_code (void)
-{
-	void *pal_vaddr = efi_get_pal_addr ();
-	u64 psr;
-
-	if (!pal_vaddr)
-		return;
-
-	/*
-	 * Cannot write to CRx with PSR.ic=1
-	 */
-	psr = ia64_clear_ic();
-#ifdef XEN
-	/* pal_vaddr must be unpinned before pinning
-	 * This is needed in the case of a nested EFI, PAL or SAL call */
-	__efi_unmap_pal_code(pal_vaddr);
-#endif
-	ia64_itr(0x1, IA64_TR_PALCODE, GRANULEROUNDDOWN((unsigned long) pal_vaddr),
-		 pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)),
-		 IA64_GRANULE_SHIFT);
-	ia64_set_psr(psr);		/* restore psr */
-	ia64_srlz_i();
-}
-
-void __init
-efi_init (void)
-{
-	void *efi_map_start, *efi_map_end;
-	efi_config_table_t *config_tables;
-	efi_char16_t *c16;
-	u64 efi_desc_size;
-	char *cp, vendor[100] = "unknown";
-	int i;
-
-	/* it's too early to be able to use the standard kernel command line support... */
-#ifdef XEN
-	extern char saved_command_line[];
-	for (cp = saved_command_line; *cp; ) {
-#else
-	for (cp = boot_command_line; *cp; ) {
-#endif
-		if (memcmp(cp, "mem=", 4) == 0) {
-			mem_limit = memparse(cp + 4, &cp);
-		} else if (memcmp(cp, "max_addr=", 9) == 0) {
-			max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
-		} else if (memcmp(cp, "min_addr=", 9) == 0) {
-			min_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
-		} else {
-			while (*cp != ' ' && *cp)
-				++cp;
-			while (*cp == ' ')
-				++cp;
-		}
-	}
-	if (min_addr != 0UL)
-		printk(KERN_INFO "Ignoring memory below %luMB\n", min_addr >> 20);
-	if (max_addr != ~0UL)
-		printk(KERN_INFO "Ignoring memory above %luMB\n", max_addr >> 20);
-
-	efi.systab = __va(ia64_boot_param->efi_systab);
-
-	/*
-	 * Verify the EFI Table
-	 */
-	if (efi.systab == NULL)
-		panic("Woah! Can't find EFI system table.\n");
-	if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
-		panic("Woah! EFI system table signature incorrect\n");
-	if ((efi.systab->hdr.revision >> 16) == 0)
-		printk(KERN_WARNING "Warning: EFI system table version "
-		       "%d.%02d, expected 1.00 or greater\n",
-		       efi.systab->hdr.revision >> 16,
-		       efi.systab->hdr.revision & 0xffff);
-
-	config_tables = __va(efi.systab->tables);
-
-	/* Show what we know for posterity */
-	c16 = __va(efi.systab->fw_vendor);
-	if (c16) {
-		for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i)
-			vendor[i] = *c16++;
-		vendor[i] = '\0';
-	}
-
-	printk(KERN_INFO "EFI v%u.%.02u by %s:",
-	       efi.systab->hdr.revision >> 16, efi.systab->hdr.revision & 0xffff, vendor);
-
-	efi.mps        = EFI_INVALID_TABLE_ADDR;
-	efi.acpi       = EFI_INVALID_TABLE_ADDR;
-	efi.acpi20     = EFI_INVALID_TABLE_ADDR;
-	efi.smbios     = EFI_INVALID_TABLE_ADDR;
-	efi.sal_systab = EFI_INVALID_TABLE_ADDR;
-	efi.boot_info  = EFI_INVALID_TABLE_ADDR;
-	efi.hcdp       = EFI_INVALID_TABLE_ADDR;
-	efi.uga        = EFI_INVALID_TABLE_ADDR;
-
-	for (i = 0; i < (int) efi.systab->nr_tables; i++) {
-		if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) {
-			efi.mps = config_tables[i].table;
-			printk(" MPS=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) {
-			efi.acpi20 = config_tables[i].table;
-			printk(" ACPI 2.0=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) {
-			efi.acpi = config_tables[i].table;
-			printk(" ACPI=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) {
-			efi.smbios = config_tables[i].table;
-			printk(" SMBIOS=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID) == 0) {
-			efi.sal_systab = config_tables[i].table;
-			printk(" SALsystab=0x%lx", config_tables[i].table);
-		} else if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) {
-			efi.hcdp = config_tables[i].table;
-			printk(" HCDP=0x%lx", config_tables[i].table);
-		}
-	}
-	printk("\n");
-
-	runtime = __va(efi.systab->runtime);
-	efi.get_time = phys_get_time;
-	efi.set_time = phys_set_time;
-	efi.get_wakeup_time = phys_get_wakeup_time;
-	efi.set_wakeup_time = phys_set_wakeup_time;
-	efi.get_variable = phys_get_variable;
-	efi.get_next_variable = phys_get_next_variable;
-	efi.set_variable = phys_set_variable;
-	efi.get_next_high_mono_count = phys_get_next_high_mono_count;
-	efi.reset_system = phys_reset_system;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-#if EFI_DEBUG
-	/* print EFI memory map: */
-	{
-		efi_memory_desc_t *md;
-		void *p;
-
-		for (i = 0, p = efi_map_start; p < efi_map_end; ++i, p += efi_desc_size) {
-			md = p;
-			printk("mem%02u: type=%u, attr=0x%lx, range=[0x%016lx-0x%016lx) (%luMB)\n",
-			       i, md->type, md->attribute, md->phys_addr,
-			       md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
-			       md->num_pages >> (20 - EFI_PAGE_SHIFT));
-		}
-	}
-#endif
-
-#ifndef XEN
-	efi_map_pal_code();
-#endif
-	efi_enter_virtual_mode();
-}
-
-void
-efi_enter_virtual_mode (void)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	efi_status_t status;
-	u64 efi_desc_size;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-#ifdef XEN
-		if (md->attribute & EFI_MEMORY_RUNTIME) {
-			if (md->attribute & EFI_MEMORY_WB)
-				md->virt_addr = __IA64_EFI_CACHED_OFFSET|
-						md->phys_addr;
-			else if (md->attribute & (EFI_MEMORY_UC|EFI_MEMORY_WC|
-						  EFI_MEMORY_WT))
-				md->virt_addr = __IA64_EFI_UNCACHED_OFFSET|
-						md->phys_addr;
-		}
-#else
-		if (md->attribute & EFI_MEMORY_RUNTIME) {
-			/*
-			 * Some descriptors have multiple bits set, so the order of
-			 * the tests is relevant.
-			 */
-			if (md->attribute & EFI_MEMORY_WB) {
-				md->virt_addr = (u64) __va(md->phys_addr);
-			} else if (md->attribute & EFI_MEMORY_UC) {
-				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
-			} else if (md->attribute & EFI_MEMORY_WC) {
-#if 0
-				md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P
-									   | _PAGE_D
-									   | _PAGE_MA_WC
-									   | _PAGE_PL_0
-									   | _PAGE_AR_RW));
-#else
-				printk(KERN_INFO "EFI_MEMORY_WC mapping\n");
-				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
-#endif
-			} else if (md->attribute & EFI_MEMORY_WT) {
-#if 0
-				md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P
-									   | _PAGE_D | _PAGE_MA_WT
-									   | _PAGE_PL_0
-									   | _PAGE_AR_RW));
-#else
-				printk(KERN_INFO "EFI_MEMORY_WT mapping\n");
-				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
-#endif
-			}
-		}
-#endif
-	}
-
-	status = efi_call_phys(__va(runtime->set_virtual_address_map),
-			       ia64_boot_param->efi_memmap_size,
-			       efi_desc_size, ia64_boot_param->efi_memdesc_version,
-			       ia64_boot_param->efi_memmap);
-	if (status != EFI_SUCCESS) {
-		printk(KERN_WARNING "warning: unable to switch EFI into virtual mode "
-		       "(status=%lu)\n", status);
-		return;
-	}
-
-	/*
-	 * Now that EFI is in virtual mode, we call the EFI functions more efficiently:
-	 */
-	efi.get_time = virt_get_time;
-	efi.set_time = virt_set_time;
-	efi.get_wakeup_time = virt_get_wakeup_time;
-	efi.set_wakeup_time = virt_set_wakeup_time;
-	efi.get_variable = virt_get_variable;
-	efi.get_next_variable = virt_get_next_variable;
-	efi.set_variable = virt_set_variable;
-	efi.get_next_high_mono_count = virt_get_next_high_mono_count;
-	efi.reset_system = virt_reset_system;
-}
-
-/*
- * Walk the EFI memory map looking for the I/O port range.  There can only be one entry of
- * this type, other I/O port ranges should be described via ACPI.
- */
-u64
-efi_get_iobase (void)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-		if (md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) {
-			if (md->attribute & EFI_MEMORY_UC)
-				return md->phys_addr;
-		}
-	}
-	return 0;
-}
-
-static struct kern_memdesc *
-kern_memory_descriptor (unsigned long phys_addr)
-{
-	struct kern_memdesc *md;
-
-	for (md = kern_memmap; md->start != ~0UL; md++) {
-		if (phys_addr - md->start < (md->num_pages << EFI_PAGE_SHIFT))
-			 return md;
-	}
-	return NULL;
-}
-
-static efi_memory_desc_t *
-efi_memory_descriptor (unsigned long phys_addr)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-
-		if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT))
-			 return md;
-	}
-	return NULL;
-}
-
-u32
-efi_mem_type (unsigned long phys_addr)
-{
-	efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
-
-	if (md)
-		return md->type;
-	return 0;
-}
-
-u64
-efi_mem_attributes (unsigned long phys_addr)
-{
-	efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
-
-	if (md)
-		return md->attribute;
-	return 0;
-}
-EXPORT_SYMBOL(efi_mem_attributes);
-
-u64
-efi_mem_attribute (unsigned long phys_addr, unsigned long size)
-{
-	unsigned long end = phys_addr + size;
-	efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
-	u64 attr;
-
-	if (!md)
-		return 0;
-
-	/*
-	 * EFI_MEMORY_RUNTIME is not a memory attribute; it just tells
-	 * the kernel that firmware needs this region mapped.
-	 */
-	attr = md->attribute & ~EFI_MEMORY_RUNTIME;
-	do {
-		unsigned long md_end = efi_md_end(md);
-
-		if (end <= md_end)
-			return attr;
-
-		md = efi_memory_descriptor(md_end);
-		if (!md || (md->attribute & ~EFI_MEMORY_RUNTIME) != attr)
-			return 0;
-	} while (md);
-	return 0;
-}
-
-u64
-kern_mem_attribute (unsigned long phys_addr, unsigned long size)
-{
-	unsigned long end = phys_addr + size;
-	struct kern_memdesc *md;
-	u64 attr;
-
-	/*
-	 * This is a hack for ioremap calls before we set up kern_memmap.
-	 * Maybe we should do efi_memmap_init() earlier instead.
-	 */
-	if (!kern_memmap) {
-		attr = efi_mem_attribute(phys_addr, size);
-		if (attr & EFI_MEMORY_WB)
-			return EFI_MEMORY_WB;
-		return 0;
-	}
-
-	md = kern_memory_descriptor(phys_addr);
-	if (!md)
-		return 0;
-
-	attr = md->attribute;
-	do {
-		unsigned long md_end = kmd_end(md);
-
-		if (end <= md_end)
-			return attr;
-
-		md = kern_memory_descriptor(md_end);
-		if (!md || md->attribute != attr)
-			return 0;
-	} while (md);
-	return 0;
-}
-EXPORT_SYMBOL(kern_mem_attribute);
-
-#ifndef XEN
-int
-valid_phys_addr_range (unsigned long phys_addr, unsigned long size)
-{
-	u64 attr;
-
-	/*
-	 * /dev/mem reads and writes use copy_to_user(), which implicitly
-	 * uses a granule-sized kernel identity mapping.  It's really
-	 * only safe to do this for regions in kern_memmap.  For more
-	 * details, see Documentation/ia64/aliasing.txt.
-	 */
-	attr = kern_mem_attribute(phys_addr, size);
-	if (attr & EFI_MEMORY_WB || attr & EFI_MEMORY_UC)
-		return 1;
-	return 0;
-}
-
-int
-valid_mmap_phys_addr_range (unsigned long pfn, unsigned long size)
-{
-	/*
-	 * MMIO regions are often missing from the EFI memory map.
-	 * We must allow mmap of them for programs like X, so we
-	 * currently can't do any useful validation.
-	 */
-	return 1;
-}
-
-pgprot_t
-phys_mem_access_prot(struct file *file, unsigned long pfn, unsigned long size,
-		     pgprot_t vma_prot)
-{
-	unsigned long phys_addr = pfn << PAGE_SHIFT;
-	u64 attr;
-
-	/*
-	 * For /dev/mem mmap, we use user mappings, but if the region is
-	 * in kern_memmap (and hence may be covered by a kernel mapping),
-	 * we must use the same attribute as the kernel mapping.
-	 */
-	attr = kern_mem_attribute(phys_addr, size);
-	if (attr & EFI_MEMORY_WB)
-		return pgprot_cacheable(vma_prot);
-	else if (attr & EFI_MEMORY_UC)
-		return pgprot_noncached(vma_prot);
-
-	/*
-	 * Some chipsets don't support UC access to memory.  If
-	 * WB is supported, we prefer that.
-	 */
-	if (efi_mem_attribute(phys_addr, size) & EFI_MEMORY_WB)
-		return pgprot_cacheable(vma_prot);
-
-	return pgprot_noncached(vma_prot);
-}
-#endif
-
-int __init
-efi_uart_console_only(void)
-{
-	efi_status_t status;
-	char *s, name[] = "ConOut";
-	efi_guid_t guid = EFI_GLOBAL_VARIABLE_GUID;
-	efi_char16_t *utf16, name_utf16[32];
-	unsigned char data[1024];
-	unsigned long size = sizeof(data);
-	struct efi_generic_dev_path *hdr, *end_addr;
-	int uart = 0;
-
-	/* Convert to UTF-16 */
-	utf16 = name_utf16;
-	s = name;
-	while (*s)
-		*utf16++ = *s++ & 0x7f;
-	*utf16 = 0;
-
-	status = efi.get_variable(name_utf16, &guid, NULL, &size, data);
-	if (status != EFI_SUCCESS) {
-		printk(KERN_ERR "No EFI %s variable?\n", name);
-		return 0;
-	}
-
-	hdr = (struct efi_generic_dev_path *) data;
-	end_addr = (struct efi_generic_dev_path *) ((u8 *) data + size);
-	while (hdr < end_addr) {
-		if (hdr->type == EFI_DEV_MSG &&
-		    hdr->sub_type == EFI_DEV_MSG_UART)
-			uart = 1;
-		else if (hdr->type == EFI_DEV_END_PATH ||
-			  hdr->type == EFI_DEV_END_PATH2) {
-			if (!uart)
-				return 0;
-			if (hdr->sub_type == EFI_DEV_END_ENTIRE)
-				return 1;
-			uart = 0;
-		}
-		hdr = (struct efi_generic_dev_path *) ((u8 *) hdr + hdr->length);
-	}
-	printk(KERN_ERR "Malformed %s value\n", name);
-	return 0;
-}
-
-/*
- * Look for the first granule aligned memory descriptor memory
- * that is big enough to hold EFI memory map. Make sure this
- * descriptor is atleast granule sized so it does not get trimmed
- */
-struct kern_memdesc *
-find_memmap_space (void)
-{
-	u64	contig_low=0, contig_high=0;
-	u64	as = 0, ae;
-	void *efi_map_start, *efi_map_end, *p, *q;
-	efi_memory_desc_t *md, *pmd = NULL, *check_md;
-	u64	space_needed, efi_desc_size;
-	unsigned long total_mem = 0;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	/*
-	 * Worst case: we need 3 kernel descriptors for each efi descriptor
-	 * (if every entry has a WB part in the middle, and UC head and tail),
-	 * plus one for the end marker.
-	 */
-	space_needed = sizeof(kern_memdesc_t) *
-		(3 * (ia64_boot_param->efi_memmap_size/efi_desc_size) + 1);
-
-	for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
-		md = p;
-		if (!efi_wb(md)) {
-			continue;
-		}
-		if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) {
-			contig_low = GRANULEROUNDUP(md->phys_addr);
-			contig_high = efi_md_end(md);
-			for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) {
-				check_md = q;
-				if (!efi_wb(check_md))
-					break;
-				if (contig_high != check_md->phys_addr)
-					break;
-				contig_high = efi_md_end(check_md);
-			}
-			contig_high = GRANULEROUNDDOWN(contig_high);
-		}
-		if (!is_memory_available(md) || md->type == EFI_LOADER_DATA)
-			continue;
-
-		/* Round ends inward to granule boundaries */
-		as = max(contig_low, md->phys_addr);
-		ae = min(contig_high, efi_md_end(md));
-
-		/* keep within max_addr= and min_addr= command line arg */
-		as = max(as, min_addr);
-		ae = min(ae, max_addr);
-		if (ae <= as)
-			continue;
-
-		/* avoid going over mem= command line arg */
-		if (total_mem + (ae - as) > mem_limit)
-			ae -= total_mem + (ae - as) - mem_limit;
-
-		if (ae <= as)
-			continue;
-
-		if (ae - as > space_needed)
-			break;
-	}
-	if (p >= efi_map_end)
-		panic("Can't allocate space for kernel memory descriptors");
-
-	return __va(as);
-}
-
-/*
- * Walk the EFI memory map and gather all memory available for kernel
- * to use.  We can allocate partial granules only if the unavailable
- * parts exist, and are WB.
- */
-void
-efi_memmap_init(unsigned long *s, unsigned long *e)
-{
-	struct kern_memdesc *k, *prev = NULL;
-	u64	contig_low=0, contig_high=0;
-	u64	as, ae, lim;
-	void *efi_map_start, *efi_map_end, *p, *q;
-	efi_memory_desc_t *md, *pmd = NULL, *check_md;
-	u64	efi_desc_size;
-	unsigned long total_mem = 0;
-
-	k = kern_memmap = find_memmap_space();
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
-		md = p;
-		if (!efi_wb(md)) {
-			if (efi_uc(md) && (md->type == EFI_CONVENTIONAL_MEMORY ||
-				    	   md->type == EFI_BOOT_SERVICES_DATA)) {
-				k->attribute = EFI_MEMORY_UC;
-				k->start = md->phys_addr;
-				k->num_pages = md->num_pages;
-				k++;
-			}
-			continue;
-		}
-#ifdef XEN
-		/* this works around a problem in the ski bootloader */
-		if (running_on_sim && md->type != EFI_CONVENTIONAL_MEMORY)
-			continue;
-#endif
-		if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) {
-			contig_low = GRANULEROUNDUP(md->phys_addr);
-			contig_high = efi_md_end(md);
-			for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) {
-				check_md = q;
-				if (!efi_wb(check_md))
-					break;
-				if (contig_high != check_md->phys_addr)
-					break;
-				contig_high = efi_md_end(check_md);
-			}
-			contig_high = GRANULEROUNDDOWN(contig_high);
-		}
-		if (!is_memory_available(md))
-			continue;
-
-#ifdef CONFIG_CRASH_DUMP
-		/* saved_max_pfn should ignore max_addr= command line arg */
-		if (saved_max_pfn < (efi_md_end(md) >> PAGE_SHIFT))
-			saved_max_pfn = (efi_md_end(md) >> PAGE_SHIFT);
-#endif
-		/*
-		 * Round ends inward to granule boundaries
-		 * Give trimmings to uncached allocator
-		 */
-		if (md->phys_addr < contig_low) {
-			lim = min(efi_md_end(md), contig_low);
-			if (efi_uc(md)) {
-				if (k > kern_memmap && (k-1)->attribute == EFI_MEMORY_UC &&
-				    kmd_end(k-1) == md->phys_addr) {
-					(k-1)->num_pages += (lim - md->phys_addr) >> EFI_PAGE_SHIFT;
-				} else {
-					k->attribute = EFI_MEMORY_UC;
-					k->start = md->phys_addr;
-					k->num_pages = (lim - md->phys_addr) >> EFI_PAGE_SHIFT;
-					k++;
-				}
-			}
-			as = contig_low;
-		} else
-			as = md->phys_addr;
-
-		if (efi_md_end(md) > contig_high) {
-			lim = max(md->phys_addr, contig_high);
-			if (efi_uc(md)) {
-				if (lim == md->phys_addr && k > kern_memmap &&
-				    (k-1)->attribute == EFI_MEMORY_UC &&
-				    kmd_end(k-1) == md->phys_addr) {
-					(k-1)->num_pages += md->num_pages;
-				} else {
-					k->attribute = EFI_MEMORY_UC;
-					k->start = lim;
-					k->num_pages = (efi_md_end(md) - lim) >> EFI_PAGE_SHIFT;
-					k++;
-				}
-			}
-			ae = contig_high;
-		} else
-			ae = efi_md_end(md);
-
-		/* keep within max_addr= and min_addr= command line arg */
-		as = max(as, min_addr);
-		ae = min(ae, max_addr);
-		if (ae <= as)
-			continue;
-
-		/* avoid going over mem= command line arg */
-		if (total_mem + (ae - as) > mem_limit)
-			ae -= total_mem + (ae - as) - mem_limit;
-
-		if (ae <= as)
-			continue;
-		if (prev && kmd_end(prev) == md->phys_addr) {
-			prev->num_pages += (ae - as) >> EFI_PAGE_SHIFT;
-			total_mem += ae - as;
-			continue;
-		}
-		k->attribute = EFI_MEMORY_WB;
-		k->start = as;
-		k->num_pages = (ae - as) >> EFI_PAGE_SHIFT;
-		total_mem += ae - as;
-		prev = k++;
-	}
-	k->start = ~0L; /* end-marker */
-
-	/* reserve the memory we are using for kern_memmap */
-	*s = (u64)kern_memmap;
-	*e = (u64)++k;
-}
-
-#ifndef XEN
-void
-efi_initialize_iomem_resources(struct resource *code_resource,
-			       struct resource *data_resource)
-{
-	struct resource *res;
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-	char *name;
-	unsigned long flags;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	res = NULL;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-
-		if (md->num_pages == 0) /* should not happen */
-			continue;
-
-		flags = IORESOURCE_MEM;
-		switch (md->type) {
-
-			case EFI_MEMORY_MAPPED_IO:
-			case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
-				continue;
-
-			case EFI_LOADER_CODE:
-			case EFI_LOADER_DATA:
-			case EFI_BOOT_SERVICES_DATA:
-			case EFI_BOOT_SERVICES_CODE:
-			case EFI_CONVENTIONAL_MEMORY:
-				if (md->attribute & EFI_MEMORY_WP) {
-					name = "System ROM";
-					flags |= IORESOURCE_READONLY;
-				} else {
-					name = "System RAM";
-				}
-				break;
-
-			case EFI_ACPI_MEMORY_NVS:
-				name = "ACPI Non-volatile Storage";
-				flags |= IORESOURCE_BUSY;
-				break;
-
-			case EFI_UNUSABLE_MEMORY:
-				name = "reserved";
-				flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED;
-				break;
-
-			case EFI_RESERVED_TYPE:
-			case EFI_RUNTIME_SERVICES_CODE:
-			case EFI_RUNTIME_SERVICES_DATA:
-			case EFI_ACPI_RECLAIM_MEMORY:
-			default:
-				name = "reserved";
-				flags |= IORESOURCE_BUSY;
-				break;
-		}
-
-		if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
-			printk(KERN_ERR "failed to alocate resource for iomem\n");
-			return;
-		}
-
-		res->name = name;
-		res->start = md->phys_addr;
-		res->end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - 1;
-		res->flags = flags;
-
-		if (insert_resource(&iomem_resource, res) < 0)
-			kfree(res);
-		else {
-			/*
-			 * We don't know which region contains
-			 * kernel data so we try it repeatedly and
-			 * let the resource manager test it.
-			 */
-			insert_resource(res, code_resource);
-			insert_resource(res, data_resource);
-#ifdef CONFIG_KEXEC
-                        insert_resource(res, &efi_memmap_res);
-                        insert_resource(res, &boot_param_res);
-			if (crashk_res.end > crashk_res.start)
-				insert_resource(res, &crashk_res);
-#endif
-		}
-	}
-}
-#endif /* XEN */
-
-#if defined(CONFIG_KEXEC) || defined(XEN)
-/* find a block of memory aligned to 64M exclude reserved regions
-   rsvd_regions are sorted
- */
-unsigned long __init
-kdump_find_rsvd_region (unsigned long size,
-		struct rsvd_region *r, int n)
-{
-  int i;
-  u64 start, end;
-  u64 alignment = 1UL << _PAGE_SIZE_64M;
-  void *efi_map_start, *efi_map_end, *p;
-  efi_memory_desc_t *md;
-  u64 efi_desc_size;
-
-  efi_map_start = __va(ia64_boot_param->efi_memmap);
-  efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-  efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-  for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-	  md = p;
-	  if (!efi_wb(md))
-		  continue;
-	  start = ALIGN(md->phys_addr, alignment);
-	  end = efi_md_end(md);
-	  for (i = 0; i < n; i++) {
-		if (__pa(r[i].start) >= start && __pa(r[i].end) < end) {
-			if (__pa(r[i].start) > start + size)
-				return start;
-			start = ALIGN(__pa(r[i].end), alignment);
-			if (i < n-1 && __pa(r[i+1].start) < start + size)
-				continue;
-			else
-				break;
-		}
-	  }
-	  if (end > start + size)
-		return start;
-  }
-
-  printk(KERN_WARNING "Cannot reserve 0x%lx byte of memory for crashdump\n",
-	size);
-  return ~0UL;
-}
-#endif
-
-#ifndef XEN
-#ifdef CONFIG_PROC_VMCORE
-/* locate the size find a the descriptor at a certain address */
-unsigned long
-vmcore_find_descriptor_size (unsigned long address)
-{
-	void *efi_map_start, *efi_map_end, *p;
-	efi_memory_desc_t *md;
-	u64 efi_desc_size;
-	unsigned long ret = 0;
-
-	efi_map_start = __va(ia64_boot_param->efi_memmap);
-	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
-	efi_desc_size = ia64_boot_param->efi_memdesc_size;
-
-	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
-		md = p;
-		if (efi_wb(md) && md->type == EFI_LOADER_DATA
-		    && md->phys_addr == address) {
-			ret = efi_md_size(md);
-			break;
-		}
-	}
-
-	if (ret == 0)
-		printk(KERN_WARNING "Cannot locate EFI vmcore descriptor\n");
-
-	return ret;
-}
-#endif
-#endif /* XEN */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/entry.S
--- a/xen/arch/ia64/linux-xen/entry.S	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1851 +0,0 @@
-/*
- * ia64/kernel/entry.S
- *
- * Kernel entry points.
- *
- * Copyright (C) 1998-2003, 2005 Hewlett-Packard Co
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999, 2002-2003
- *	Asit Mallick <Asit.K.Mallick@intel.com>
- * 	Don Dugger <Don.Dugger@intel.com>
- *	Suresh Siddha <suresh.b.siddha@intel.com>
- *	Fenghua Yu <fenghua.yu@intel.com>
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- */
-/*
- * ia64_switch_to now places correct virtual mapping in in TR2 for
- * kernel stack. This allows us to handle interrupts without changing
- * to physical mode.
- *
- * Jonathan Nicklin	<nicklin@missioncriticallinux.com>
- * Patrick O'Rourke	<orourke@missioncriticallinux.com>
- * 11/07/2000
- */
-/*
- * Global (preserved) predicate usage on syscall entry/exit path:
- *
- *	pKStk:		See entry.h.
- *	pUStk:		See entry.h.
- *	pSys:		See entry.h.
- *	pNonSys:	!pSys
- */
-
-#include <linux/config.h>
-
-#include <asm/asmmacro.h>
-#include <asm/cache.h>
-#ifdef XEN
-#include <xen/errno.h>
-#else
-#include <asm/errno.h>
-#endif
-#include <asm/kregs.h>
-#include <asm/offsets.h>
-#include <asm/pgtable.h>
-#include <asm/percpu.h>
-#include <asm/processor.h>
-#include <asm/thread_info.h>
-#include <asm/unistd.h>
-
-#include "minstate.h"
-
-#ifndef XEN
-	/*
-	 * execve() is special because in case of success, we need to
-	 * setup a null register window frame.
-	 */
-ENTRY(ia64_execve)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,4,0
-	mov loc0=rp
-	.body
-	mov out0=in0			// filename
-	;;				// stop bit between alloc and call
-	mov out1=in1			// argv
-	mov out2=in2			// envp
-	add out3=16,sp			// regs
-	br.call.sptk.many rp=sys_execve
-.ret0:
-#ifdef CONFIG_IA32_SUPPORT
-	/*
-	 * Check if we're returning to ia32 mode. If so, we need to restore ia32 registers
-	 * from pt_regs.
-	 */
-	adds r16=PT(CR_IPSR)+16,sp
-	;;
-	ld8 r16=[r16]
-#endif
-	cmp4.ge p6,p7=r8,r0
-	mov ar.pfs=loc1			// restore ar.pfs
-	sxt4 r8=r8			// return 64-bit result
-	;;
-	stf.spill [sp]=f0
-(p6)	cmp.ne pKStk,pUStk=r0,r0	// a successful execve() lands us in user-mode...
-	mov rp=loc0
-(p6)	mov ar.pfs=r0			// clear ar.pfs on success
-(p7)	br.ret.sptk.many rp
-
-	/*
-	 * In theory, we'd have to zap this state only to prevent leaking of
-	 * security sensitive state (e.g., if current->mm->dumpable is zero).  However,
-	 * this executes in less than 20 cycles even on Itanium, so it's not worth
-	 * optimizing for...).
-	 */
-	mov ar.unat=0; 		mov ar.lc=0
-	mov r4=0;		mov f2=f0;		mov b1=r0
-	mov r5=0;		mov f3=f0;		mov b2=r0
-	mov r6=0;		mov f4=f0;		mov b3=r0
-	mov r7=0;		mov f5=f0;		mov b4=r0
-	ldf.fill f12=[sp];	mov f13=f0;		mov b5=r0
-	ldf.fill f14=[sp];	ldf.fill f15=[sp];	mov f16=f0
-	ldf.fill f17=[sp];	ldf.fill f18=[sp];	mov f19=f0
-	ldf.fill f20=[sp];	ldf.fill f21=[sp];	mov f22=f0
-	ldf.fill f23=[sp];	ldf.fill f24=[sp];	mov f25=f0
-	ldf.fill f26=[sp];	ldf.fill f27=[sp];	mov f28=f0
-	ldf.fill f29=[sp];	ldf.fill f30=[sp];	mov f31=f0
-#ifdef CONFIG_IA32_SUPPORT
-	tbit.nz p6,p0=r16, IA64_PSR_IS_BIT
-	movl loc0=ia64_ret_from_ia32_execve
-	;;
-(p6)	mov rp=loc0
-#endif
-	br.ret.sptk.many rp
-END(ia64_execve)
-
-/*
- * sys_clone2(u64 flags, u64 ustack_base, u64 ustack_size, u64 parent_tidptr, u64 child_tidptr,
- *	      u64 tls)
- */
-GLOBAL_ENTRY(sys_clone2)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc r16=ar.pfs,8,2,6,0
-	DO_SAVE_SWITCH_STACK
-	adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
-	mov loc0=rp
-	mov loc1=r16				// save ar.pfs across do_fork
-	.body
-	mov out1=in1
-	mov out3=in2
-	tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
-	mov out4=in3	// parent_tidptr: valid only w/CLONE_PARENT_SETTID
-	;;
-(p6)	st8 [r2]=in5				// store TLS in r16 for copy_thread()
-	mov out5=in4	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
-	adds out2=IA64_SWITCH_STACK_SIZE+16,sp	// out2 = &regs
-	mov out0=in0				// out0 = clone_flags
-	br.call.sptk.many rp=do_fork
-.ret1:	.restore sp
-	adds sp=IA64_SWITCH_STACK_SIZE,sp	// pop the switch stack
-	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(sys_clone2)
-
-/*
- * sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls)
- *	Deprecated.  Use sys_clone2() instead.
- */
-GLOBAL_ENTRY(sys_clone)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc r16=ar.pfs,8,2,6,0
-	DO_SAVE_SWITCH_STACK
-	adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
-	mov loc0=rp
-	mov loc1=r16				// save ar.pfs across do_fork
-	.body
-	mov out1=in1
-	mov out3=16				// stacksize (compensates for 16-byte scratch area)
-	tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
-	mov out4=in2	// parent_tidptr: valid only w/CLONE_PARENT_SETTID
-	;;
-(p6)	st8 [r2]=in4				// store TLS in r13 (tp)
-	mov out5=in3	// child_tidptr:  valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
-	adds out2=IA64_SWITCH_STACK_SIZE+16,sp	// out2 = &regs
-	mov out0=in0				// out0 = clone_flags
-	br.call.sptk.many rp=do_fork
-.ret2:	.restore sp
-	adds sp=IA64_SWITCH_STACK_SIZE,sp	// pop the switch stack
-	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(sys_clone)
-#endif
-
-/*
- * prev_task <- ia64_switch_to(struct task_struct *next)
- *	With Ingo's new scheduler, interrupts are disabled when this routine gets
- *	called.  The code starting at .map relies on this.  The rest of the code
- *	doesn't care about the interrupt masking status.
- */
-GLOBAL_ENTRY(ia64_switch_to)
-	.prologue
-	alloc r16=ar.pfs,1,0,0,0
-	DO_SAVE_SWITCH_STACK
-	.body
-
-	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
-#ifdef XEN
-	movl r24=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_STACK_OFFSET;;
-	ld8 r27=[r24]
-	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
-	dep r20=0,in0,60,4		// physical address of "next"
-#else
-	movl r25=init_task
-	mov r27=IA64_KR(CURRENT_STACK)
-	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
-	dep r20=0,in0,61,3		// physical address of "next"
-#endif
-	;;
-	st8 [r22]=sp			// save kernel stack pointer of old task
-	shr.u r26=r20,IA64_GRANULE_SHIFT
-#ifdef XEN
-	;;
-	/*
-	 * If we've already mapped this task's page, we can skip doing it again.
-	 */
-	cmp.eq p7,p6=r26,r27
-(p6)	br.cond.dpnt .map
-#else	
-	cmp.eq p7,p6=r25,in0
-	;;
-	/*
-	 * If we've already mapped this task's page, we can skip doing it again.
-	 */
-(p6)	cmp.eq p7,p6=r26,r27
-(p6)	br.cond.dpnt .map
-#endif	
-	;;
-.done:
-(p6)	ssm psr.ic			// if we had to map, reenable the psr.ic bit FIRST!!!
-	;;
-(p6)	srlz.d
-	ld8 sp=[r21]			// load kernel stack pointer of new task
-#ifdef XEN
-	add r25=IA64_KR_CURRENT_OFFSET-IA64_KR_CURRENT_STACK_OFFSET,r24
-	;;
-	st8 [r25]=in0			// update "current" application register
-	;;
-	bsw.0
-	;;
-	mov r8=r13			// return pointer to previously running task
-	mov r13=in0			// set "current" pointer
-	mov r21=in0
-	;;
-	bsw.1
-	;;
-#else
-	mov IA64_KR(CURRENT)=in0	// update "current" application register
-	mov r8=r13          // return pointer to previously running task
-	mov r13=in0         // set "current" pointer
-#endif
-	DO_LOAD_SWITCH_STACK
-
-#ifdef CONFIG_SMP
-	sync.i				// ensure "fc"s done by this CPU are visible on other CPUs
-#endif
-	br.ret.sptk.many rp		// boogie on out in new context
-
-.map:
-	rsm psr.ic			// interrupts (psr.i) are already disabled here
-	movl r25=PAGE_KERNEL
-#ifdef XEN	
-	movl r27=IA64_GRANULE_SHIFT << 2
-#endif
-	;;
-	srlz.d
-	or r23=r25,r20			// construct PA | page properties
-#ifdef XEN
-	ptr.d in0,r27			// to purge dtr[IA64_TR_VHPT] and dtr[IA64_TR_VPD]
-#else
-	movl r27=IA64_GRANULE_SHIFT << 2	
-#endif
-	;;
-	mov cr.itir=r27
-	mov cr.ifa=in0			// VA of next task...
-#ifdef XEN
-	srlz.d
-#endif
-	;;
-	mov r25=IA64_TR_CURRENT_STACK
-#ifdef XEN
-	st8 [r24]=r26			// remember last page we mapped...
-#else
-	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
-#endif
-	;;
-	itr.d dtr[r25]=r23		// wire in new mapping...
-	br.cond.sptk .done
-END(ia64_switch_to)
-
-/*
- * Note that interrupts are enabled during save_switch_stack and load_switch_stack.  This
- * means that we may get an interrupt with "sp" pointing to the new kernel stack while
- * ar.bspstore is still pointing to the old kernel backing store area.  Since ar.rsc,
- * ar.rnat, ar.bsp, and ar.bspstore are all preserved by interrupts, this is not a
- * problem.  Also, we don't need to specify unwind information for preserved registers
- * that are not modified in save_switch_stack as the right unwind information is already
- * specified at the call-site of save_switch_stack.
- */
-
-/*
- * save_switch_stack:
- *	- r16 holds ar.pfs
- *	- b7 holds address to return to
- *	- rp (b0) holds return address to save
- */
-GLOBAL_ENTRY(save_switch_stack)
-	.prologue
-	.altrp b7
-	flushrs			// flush dirty regs to backing store (must be first in insn group)
-	.save @priunat,r17
-	mov r17=ar.unat		// preserve caller's
-	.body
-#ifdef CONFIG_ITANIUM
-	adds r2=16+128,sp
-	adds r3=16+64,sp
-	adds r14=SW(R4)+16,sp
-	;;
-	st8.spill [r14]=r4,16		// spill r4
-	lfetch.fault.excl.nt1 [r3],128
-	;;
-	lfetch.fault.excl.nt1 [r2],128
-	lfetch.fault.excl.nt1 [r3],128
-	;;
-	lfetch.fault.excl [r2]
-	lfetch.fault.excl [r3]
-	adds r15=SW(R5)+16,sp
-#else
-	add r2=16+3*128,sp
-	add r3=16,sp
-	add r14=SW(R4)+16,sp
-	;;
-	st8.spill [r14]=r4,SW(R6)-SW(R4)	// spill r4 and prefetch offset 0x1c0
-	lfetch.fault.excl.nt1 [r3],128	//		prefetch offset 0x010
-	;;
-	lfetch.fault.excl.nt1 [r3],128	//		prefetch offset 0x090
-	lfetch.fault.excl.nt1 [r2],128	//		prefetch offset 0x190
-	;;
-	lfetch.fault.excl.nt1 [r3]	//		prefetch offset 0x110
-	lfetch.fault.excl.nt1 [r2]	//		prefetch offset 0x210
-	adds r15=SW(R5)+16,sp
-#endif
-	;;
-	st8.spill [r15]=r5,SW(R7)-SW(R5)	// spill r5
-	mov.m ar.rsc=0			// put RSE in mode: enforced lazy, little endian, pl 0
-	add r2=SW(F2)+16,sp		// r2 = &sw->f2
-	;;
-	st8.spill [r14]=r6,SW(B0)-SW(R6)	// spill r6
-	mov.m r18=ar.fpsr		// preserve fpsr
-	add r3=SW(F3)+16,sp		// r3 = &sw->f3
-	;;
-	stf.spill [r2]=f2,32
-	mov.m r19=ar.rnat
-	mov r21=b0
-
-	stf.spill [r3]=f3,32
-	st8.spill [r15]=r7,SW(B2)-SW(R7)	// spill r7
-	mov r22=b1
-	;;
-	// since we're done with the spills, read and save ar.unat:
-	mov.m r29=ar.unat
-	mov.m r20=ar.bspstore
-	mov r23=b2
-	stf.spill [r2]=f4,32
-	stf.spill [r3]=f5,32
-	mov r24=b3
-	;;
-	st8 [r14]=r21,SW(B1)-SW(B0)		// save b0
-	st8 [r15]=r23,SW(B3)-SW(B2)		// save b2
-	mov r25=b4
-	mov r26=b5
-	;;
-	st8 [r14]=r22,SW(B4)-SW(B1)		// save b1
-	st8 [r15]=r24,SW(AR_PFS)-SW(B3)		// save b3
-	mov r21=ar.lc		// I-unit
-	stf.spill [r2]=f12,32
-	stf.spill [r3]=f13,32
-	;;
-	st8 [r14]=r25,SW(B5)-SW(B4)		// save b4
-	st8 [r15]=r16,SW(AR_LC)-SW(AR_PFS)	// save ar.pfs
-	stf.spill [r2]=f14,32
-	stf.spill [r3]=f15,32
-	;;
-	st8 [r14]=r26				// save b5
-	st8 [r15]=r21				// save ar.lc
-	stf.spill [r2]=f16,32
-	stf.spill [r3]=f17,32
-	;;
-	stf.spill [r2]=f18,32
-	stf.spill [r3]=f19,32
-	;;
-	stf.spill [r2]=f20,32
-	stf.spill [r3]=f21,32
-	;;
-	stf.spill [r2]=f22,32
-	stf.spill [r3]=f23,32
-	;;
-	stf.spill [r2]=f24,32
-	stf.spill [r3]=f25,32
-	;;
-	stf.spill [r2]=f26,32
-	stf.spill [r3]=f27,32
-	;;
-	stf.spill [r2]=f28,32
-	stf.spill [r3]=f29,32
-	;;
-	stf.spill [r2]=f30,SW(AR_UNAT)-SW(F30)
-	stf.spill [r3]=f31,SW(PR)-SW(F31)
-	add r14=SW(CALLER_UNAT)+16,sp
-	;;
-	st8 [r2]=r29,SW(AR_RNAT)-SW(AR_UNAT)	// save ar.unat
-	st8 [r14]=r17,SW(AR_FPSR)-SW(CALLER_UNAT) // save caller_unat
-	mov r21=pr
-	;;
-	st8 [r2]=r19,SW(AR_BSPSTORE)-SW(AR_RNAT) // save ar.rnat
-	st8 [r3]=r21				// save predicate registers
-	;;
-	st8 [r2]=r20				// save ar.bspstore
-	st8 [r14]=r18				// save fpsr
-	mov ar.rsc=3		// put RSE back into eager mode, pl 0
-	br.cond.sptk.many b7
-END(save_switch_stack)
-
-/*
- * load_switch_stack:
- *	- "invala" MUST be done at call site (normally in DO_LOAD_SWITCH_STACK)
- *	- b7 holds address to return to
- *	- must not touch r8-r11
- */
-#ifdef XEN
-GLOBAL_ENTRY(load_switch_stack)
-#else
-ENTRY(load_switch_stack)
-#endif
-	.prologue
-	.altrp b7
-
-	.body
-	lfetch.fault.nt1 [sp]
-	adds r2=SW(AR_BSPSTORE)+16,sp
-	adds r3=SW(AR_UNAT)+16,sp
-	mov ar.rsc=0						// put RSE into enforced lazy mode
-	adds r14=SW(CALLER_UNAT)+16,sp
-	adds r15=SW(AR_FPSR)+16,sp
-	;;
-	ld8 r27=[r2],(SW(B0)-SW(AR_BSPSTORE))	// bspstore
-	ld8 r29=[r3],(SW(B1)-SW(AR_UNAT))	// unat
-	;;
-	ld8 r21=[r2],16		// restore b0
-	ld8 r22=[r3],16		// restore b1
-	;;
-	ld8 r23=[r2],16		// restore b2
-	ld8 r24=[r3],16		// restore b3
-	;;
-	ld8 r25=[r2],16		// restore b4
-	ld8 r26=[r3],16		// restore b5
-	;;
-	ld8 r16=[r2],(SW(PR)-SW(AR_PFS))	// ar.pfs
-	ld8 r17=[r3],(SW(AR_RNAT)-SW(AR_LC))	// ar.lc
-	;;
-	ld8 r28=[r2]		// restore pr
-	ld8 r30=[r3]		// restore rnat
-	;;
-	ld8 r18=[r14],16	// restore caller's unat
-	ld8 r19=[r15],24	// restore fpsr
-	;;
-	ldf.fill f2=[r14],32
-	ldf.fill f3=[r15],32
-	;;
-	ldf.fill f4=[r14],32
-	ldf.fill f5=[r15],32
-	;;
-	ldf.fill f12=[r14],32
-	ldf.fill f13=[r15],32
-	;;
-	ldf.fill f14=[r14],32
-	ldf.fill f15=[r15],32
-	;;
-	ldf.fill f16=[r14],32
-	ldf.fill f17=[r15],32
-	;;
-	ldf.fill f18=[r14],32
-	ldf.fill f19=[r15],32
-	mov b0=r21
-	;;
-	ldf.fill f20=[r14],32
-	ldf.fill f21=[r15],32
-	mov b1=r22
-	;;
-	ldf.fill f22=[r14],32
-	ldf.fill f23=[r15],32
-	mov b2=r23
-	;;
-	mov ar.bspstore=r27
-	mov ar.unat=r29		// establish unat holding the NaT bits for r4-r7
-	mov b3=r24
-	;;
-	ldf.fill f24=[r14],32
-	ldf.fill f25=[r15],32
-	mov b4=r25
-	;;
-	ldf.fill f26=[r14],32
-	ldf.fill f27=[r15],32
-	mov b5=r26
-	;;
-	ldf.fill f28=[r14],32
-	ldf.fill f29=[r15],32
-	mov ar.pfs=r16
-	;;
-	ldf.fill f30=[r14],32
-	ldf.fill f31=[r15],24
-	mov ar.lc=r17
-	;;
-	ld8.fill r4=[r14],16
-	ld8.fill r5=[r15],16
-	mov pr=r28,-1
-	;;
-	ld8.fill r6=[r14],16
-	ld8.fill r7=[r15],16
-
-	mov ar.unat=r18				// restore caller's unat
-	mov ar.rnat=r30				// must restore after bspstore but before rsc!
-	mov ar.fpsr=r19				// restore fpsr
-	mov ar.rsc=3				// put RSE back into eager mode, pl 0
-	br.cond.sptk.many b7
-END(load_switch_stack)
-
-#ifndef XEN
-GLOBAL_ENTRY(execve)
-	mov r15=__NR_execve			// put syscall number in place
-	break __BREAK_SYSCALL
-	br.ret.sptk.many rp
-END(execve)
-
-GLOBAL_ENTRY(clone)
-	mov r15=__NR_clone			// put syscall number in place
-	break __BREAK_SYSCALL
-	br.ret.sptk.many rp
-END(clone)
-
-	/*
-	 * Invoke a system call, but do some tracing before and after the call.
-	 * We MUST preserve the current register frame throughout this routine
-	 * because some system calls (such as ia64_execve) directly
-	 * manipulate ar.pfs.
-	 */
-GLOBAL_ENTRY(ia64_trace_syscall)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * We need to preserve the scratch registers f6-f11 in case the system
-	 * call is sigreturn.
-	 */
-	adds r16=PT(F6)+16,sp
-	adds r17=PT(F7)+16,sp
-	;;
- 	stf.spill [r16]=f6,32
- 	stf.spill [r17]=f7,32
-	;;
- 	stf.spill [r16]=f8,32
- 	stf.spill [r17]=f9,32
-	;;
- 	stf.spill [r16]=f10
- 	stf.spill [r17]=f11
-	br.call.sptk.many rp=syscall_trace_enter // give parent a chance to catch syscall args
-	adds r16=PT(F6)+16,sp
-	adds r17=PT(F7)+16,sp
-	;;
-	ldf.fill f6=[r16],32
-	ldf.fill f7=[r17],32
-	;;
-	ldf.fill f8=[r16],32
-	ldf.fill f9=[r17],32
-	;;
-	ldf.fill f10=[r16]
-	ldf.fill f11=[r17]
-	// the syscall number may have changed, so re-load it and re-calculate the
-	// syscall entry-point:
-	adds r15=PT(R15)+16,sp			// r15 = &pt_regs.r15 (syscall #)
-	;;
-	ld8 r15=[r15]
-	mov r3=NR_syscalls - 1
-	;;
-	adds r15=-1024,r15
-	movl r16=sys_call_table
-	;;
-	shladd r20=r15,3,r16			// r20 = sys_call_table + 8*(syscall-1024)
-	cmp.leu p6,p7=r15,r3
-	;;
-(p6)	ld8 r20=[r20]				// load address of syscall entry point
-(p7)	movl r20=sys_ni_syscall
-	;;
-	mov b6=r20
-	br.call.sptk.many rp=b6			// do the syscall
-.strace_check_retval:
-	cmp.lt p6,p0=r8,r0			// syscall failed?
-	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
-	adds r3=PT(R10)+16,sp			// r3 = &pt_regs.r10
-	mov r10=0
-(p6)	br.cond.sptk strace_error		// syscall failed ->
-	;;					// avoid RAW on r10
-.strace_save_retval:
-.mem.offset 0,0; st8.spill [r2]=r8		// store return value in slot for r8
-.mem.offset 8,0; st8.spill [r3]=r10		// clear error indication in slot for r10
-	br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
-.ret3:	br.cond.sptk .work_pending_syscall_end
-
-strace_error:
-	ld8 r3=[r2]				// load pt_regs.r8
-	sub r9=0,r8				// negate return value to get errno value
-	;;
-	cmp.ne p6,p0=r3,r0			// is pt_regs.r8!=0?
-	adds r3=16,r2				// r3=&pt_regs.r10
-	;;
-(p6)	mov r10=-1
-(p6)	mov r8=r9
-	br.cond.sptk .strace_save_retval
-END(ia64_trace_syscall)
-
-	/*
-	 * When traced and returning from sigreturn, we invoke syscall_trace but then
-	 * go straight to ia64_leave_kernel rather than ia64_leave_syscall.
-	 */
-GLOBAL_ENTRY(ia64_strace_leave_kernel)
-	PT_REGS_UNWIND_INFO(0)
-{	/*
-	 * Some versions of gas generate bad unwind info if the first instruction of a
-	 * procedure doesn't go into the first slot of a bundle.  This is a workaround.
-	 */
-	nop.m 0
-	nop.i 0
-	br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
-}
-.ret4:	br.cond.sptk ia64_leave_kernel
-END(ia64_strace_leave_kernel)
-#endif
-
-GLOBAL_ENTRY(ia64_ret_from_clone)
-	PT_REGS_UNWIND_INFO(0)
-{	/*
-	 * Some versions of gas generate bad unwind info if the first instruction of a
-	 * procedure doesn't go into the first slot of a bundle.  This is a workaround.
-	 */
-	nop.m 0
-	nop.i 0
-	/*
-	 * We need to call schedule_tail() to complete the scheduling process.
-	 * Called by ia64_switch_to() after do_fork()->copy_thread().  r8 contains the
-	 * address of the previously executing task.
-	 */
-	br.call.sptk.many rp=ia64_invoke_schedule_tail
-}
-#ifdef XEN
-	// new domains are cloned but not exec'ed so switch to user mode here
-	cmp.ne pKStk,pUStk=r0,r0
-	adds r16 = IA64_VCPU_FLAGS_OFFSET, r13
-	;;
-	ld8 r16 = [r16]				// arch.arch_vmx.flags
-	;;
-	cmp.eq p6,p0 = r16, r0
-(p6)	br.cond.spnt ia64_leave_kernel		// !VMX_DOMAIN
-	;;
-	adds r16 = PT(CR_IFS)+16, r12
-	;;
-	ld8 r16 = [r16]
-	cmp.eq pNonSys,pSys=r0,r0		// pSys=0,pNonSys=1
-	;;
-	cmp.eq p6,p7 = 0x6, r16
-(p7)	br.cond.sptk ia64_leave_hypervisor	// VMX_DOMAIN
-	;;
-	/*
-	 * cr.ifs.v==0 && cr.ifm(ar.pfm)==6 means that HYPERVISOR_suspend
-	 * has been called. (i.e. HVM with PV driver is restored here)
-	 * We need to allocate a dummy RSE stack frame to resume.
-	 */
-	alloc r32=ar.pfs, 0, 0, 6, 0
-	cmp.eq pSys,pNonSys=r0,r0		// pSys=1,pNonSys=0
-	;;
-	bsw.0
-	;;
-	mov r21=r13				// set current
-	;;
-	bsw.1
-	;;
-	mov r8=r0
-	br.cond.sptk.many ia64_leave_hypercall
-#else
-.ret8:
-	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
-	;;
-	ld4 r2=[r2]
-	;;
-	mov r8=0
-	and r2=_TIF_SYSCALL_TRACEAUDIT,r2
-	;;
-	cmp.ne p6,p0=r2,r0
-(p6)	br.cond.spnt .strace_check_retval
-#endif
-	;;					// added stop bits to prevent r8 dependency
-END(ia64_ret_from_clone)
-	// fall through
-GLOBAL_ENTRY(ia64_ret_from_syscall)
-	PT_REGS_UNWIND_INFO(0)
-	cmp.ge p6,p7=r8,r0			// syscall executed successfully?
-	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
-	mov r10=r0				// clear error indication in r10
-#ifndef XEN    
-(p7)	br.cond.spnt handle_syscall_error	// handle potential syscall failure
-#endif
-END(ia64_ret_from_syscall)
-	// fall through
-/*
- * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
- *	need to switch to bank 0 and doesn't restore the scratch registers.
- *	To avoid leaking kernel bits, the scratch registers are set to
- *	the following known-to-be-safe values:
- *
- *		  r1: restored (global pointer)
- *		  r2: cleared
- *		  r3: 1 (when returning to user-level)
- *	      r8-r11: restored (syscall return value(s))
- *		 r12: restored (user-level stack pointer)
- *		 r13: restored (user-level thread pointer)
- *		 r14: set to __kernel_syscall_via_epc
- *		 r15: restored (syscall #)
- *	     r16-r17: cleared
- *		 r18: user-level b6
- *		 r19: cleared
- *		 r20: user-level ar.fpsr
- *		 r21: user-level b0
- *		 r22: cleared
- *		 r23: user-level ar.bspstore
- *		 r24: user-level ar.rnat
- *		 r25: user-level ar.unat
- *		 r26: user-level ar.pfs
- *		 r27: user-level ar.rsc
- *		 r28: user-level ip
- *		 r29: user-level psr
- *		 r30: user-level cfm
- *		 r31: user-level pr
- *	      f6-f11: cleared
- *		  pr: restored (user-level pr)
- *		  b0: restored (user-level rp)
- *	          b6: restored
- *		  b7: set to __kernel_syscall_via_epc
- *	     ar.unat: restored (user-level ar.unat)
- *	      ar.pfs: restored (user-level ar.pfs)
- *	      ar.rsc: restored (user-level ar.rsc)
- *	     ar.rnat: restored (user-level ar.rnat)
- *	 ar.bspstore: restored (user-level ar.bspstore)
- *	     ar.fpsr: restored (user-level ar.fpsr)
- *	      ar.ccv: cleared
- *	      ar.csd: cleared
- *	      ar.ssd: cleared
- */
-ENTRY(ia64_leave_syscall)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
-	 * user- or fsys-mode, hence we disable interrupts early on.
-	 *
-	 * p6 controls whether current_thread_info()->flags needs to be check for
-	 * extra work.  We always check for extra work when returning to user-level.
-	 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
-	 * is 0.  After extra work processing has been completed, execution
-	 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
-	 * needs to be redone.
-	 */
-#ifdef CONFIG_PREEMPT
-	rsm psr.i				// disable interrupts
-	cmp.eq pLvSys,p0=r0,r0			// pLvSys=1: leave from syscall
-(pKStk) adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
-	;;
-	.pred.rel.mutex pUStk,pKStk
-(pKStk) ld4 r21=[r20]			// r21 <- preempt_count
-(pUStk)	mov r21=0			// r21 <- 0
-	;;
-	cmp.eq p6,p0=r21,r0		// p6 <- pUStk || (preempt_count == 0)
-#else /* !CONFIG_PREEMPT */
-(pUStk)	rsm psr.i
-	cmp.eq pLvSys,p0=r0,r0		// pLvSys=1: leave from syscall
-(pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
-#endif
-.work_processed_syscall:
-	adds r2=PT(LOADRS)+16,r12
-	adds r3=PT(AR_BSPSTORE)+16,r12
-#ifdef XEN
-	;;
-#else
-	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
-	;;
-(p6)	ld4 r31=[r18]				// load current_thread_info()->flags
-#endif
-	ld8 r19=[r2],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
-	nop.i 0
-	;;
-#ifndef XEN    
-	mov r16=ar.bsp				// M2  get existing backing store pointer
-#endif    
-	ld8 r18=[r2],PT(R9)-PT(B6)		// load b6
-#ifndef XEN
-(p6)	and r15=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
-#endif
-	;;
-	ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE)	// load ar.bspstore (may be garbage)
-#ifndef XEN
-(p6)	cmp4.ne.unc p6,p0=r15, r0		// any special work pending?
-(p6)	br.cond.spnt .work_pending_syscall
-#endif
-	;;
-	// start restoring the state saved on the kernel stack (struct pt_regs):
-	ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
-	ld8 r11=[r3],PT(CR_IIP)-PT(R11)
-(pNonSys) break 0		//      bug check: we shouldn't be here if pNonSys is TRUE!
-	;;
-	invala			// M0|1 invalidate ALAT
-	rsm psr.i | psr.ic	// M2   turn off interrupts and interruption collection
-#ifndef XEN
-	cmp.eq p9,p0=r0,r0	// A    set p9 to indicate that we should restore cr.ifs
-#endif
-
-	ld8 r29=[r2],16		// M0|1 load cr.ipsr
-	ld8 r28=[r3],16		// M0|1 load cr.iip
-	mov r22=r0		// A    clear r22
-	;;
-	ld8 r30=[r2],16		// M0|1 load cr.ifs
-	ld8 r25=[r3],16		// M0|1 load ar.unat
-(pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13
-	;;
-	ld8 r26=[r2],PT(B0)-PT(AR_PFS)	// M0|1 load ar.pfs
-(pKStk)	mov r22=psr			// M2   read PSR now that interrupts are disabled
-	nop 0
-	;;
-	ld8 r21=[r2],PT(AR_RNAT)-PT(B0) // M0|1 load b0
-	ld8 r27=[r3],PT(PR)-PT(AR_RSC)	// M0|1 load ar.rsc
-	mov f6=f0			// F    clear f6
-	;;
-	ld8 r24=[r2],PT(AR_FPSR)-PT(AR_RNAT)	// M0|1 load ar.rnat (may be garbage)
-	ld8 r31=[r3],PT(R1)-PT(PR)		// M0|1 load predicates
-	mov f7=f0				// F    clear f7
-	;;
-	ld8 r20=[r2],PT(R12)-PT(AR_FPSR)	// M0|1 load ar.fpsr
-	ld8.fill r1=[r3],16			// M0|1 load r1
-(pUStk) mov r17=1				// A
-	;;
-(pUStk) st1 [r14]=r17				// M2|3
-	ld8.fill r13=[r3],16			// M0|1
-	mov f8=f0				// F    clear f8
-	;;
-	ld8.fill r12=[r2]			// M0|1 restore r12 (sp)
-#ifdef XEN    
-	ld8.fill r2=[r3]			// M0|1
-#else    
-	ld8.fill r15=[r3]			// M0|1 restore r15
-#endif    
-	mov b6=r18				// I0   restore b6
-
-#ifdef XEN
-	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)    // A
-#else
-	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0 // A
-#endif
-	mov f9=f0					// F    clear f9
-(pKStk) br.cond.dpnt.many skip_rbs_switch		// B
-
-	srlz.d				// M0   ensure interruption collection is off (for cover)
-	shr.u r18=r19,16		// I0|1 get byte size of existing "dirty" partition
-#ifndef XEN    
-	cover				// B    add current frame into dirty partition & set cr.ifs
-#endif    
-	;;
-(pUStk) ld4 r17=[r17]			// M0|1 r17 = cpu_data->phys_stacked_size_p8
-	mov r19=ar.bsp			// M2   get new backing store pointer
-	mov f10=f0			// F    clear f10
-
-	nop.m 0
-#ifdef XEN
-	mov r14=r0
-#else
-	movl r14=__kernel_syscall_via_epc // X
-#endif
-	;;
-	mov.m ar.csd=r0			// M2   clear ar.csd
-	mov.m ar.ccv=r0			// M2   clear ar.ccv
-	mov b7=r14			// I0   clear b7 (hint with __kernel_syscall_via_epc)
-
-	mov.m ar.ssd=r0			// M2   clear ar.ssd
-	mov f11=f0			// F    clear f11
-	br.cond.sptk.many rbs_switch	// B
-END(ia64_leave_syscall)
-
-#ifdef CONFIG_IA32_SUPPORT
-GLOBAL_ENTRY(ia64_ret_from_ia32_execve)
-	PT_REGS_UNWIND_INFO(0)
-	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
-	adds r3=PT(R10)+16,sp			// r3 = &pt_regs.r10
-	;;
-	.mem.offset 0,0
-	st8.spill [r2]=r8	// store return value in slot for r8 and set unat bit
-	.mem.offset 8,0
-	st8.spill [r3]=r0	// clear error indication in slot for r10 and set unat bit
-END(ia64_ret_from_ia32_execve)
-	// fall through
-#endif /* CONFIG_IA32_SUPPORT */
-GLOBAL_ENTRY(ia64_leave_kernel)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
-	 * user- or fsys-mode, hence we disable interrupts early on.
-	 *
-	 * p6 controls whether current_thread_info()->flags needs to be check for
-	 * extra work.  We always check for extra work when returning to user-level.
-	 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
-	 * is 0.  After extra work processing has been completed, execution
-	 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
-	 * needs to be redone.
-	 */
-#ifdef CONFIG_PREEMPT
-	rsm psr.i				// disable interrupts
-	cmp.eq p0,pLvSys=r0,r0			// pLvSys=0: leave from kernel
-(pKStk)	adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
-	;;
-	.pred.rel.mutex pUStk,pKStk
-(pKStk)	ld4 r21=[r20]			// r21 <- preempt_count
-(pUStk)	mov r21=0			// r21 <- 0
-	;;
-	cmp.eq p6,p0=r21,r0		// p6 <- pUStk || (preempt_count == 0)
-#else
-(pUStk)	rsm psr.i
-	cmp.eq p0,pLvSys=r0,r0		// pLvSys=0: leave from kernel
-(pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
-#endif
-.work_processed_kernel:
-#ifdef XEN
-	;;
-(pUStk)	ssm psr.i
-(pUStk)	br.call.sptk.many b0=do_softirq
-(pUStk)	rsm psr.i
-	;;
-(pUStk)	br.call.sptk.many b0=reflect_event
-	;;
-	adds r7 = PT(EML_UNAT)+16,r12
-	;;
-	ld8 r7 = [r7]
-	;;
-	mov ar.unat=r7  /* load eml_unat  */
-	mov r31=r0
-
-#else
-	adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
-	;;
-(p6)	ld4 r31=[r17]				// load current_thread_info()->flags
-#endif
-	adds r21=PT(PR)+16,r12
-	;;
-
-	lfetch [r21],PT(CR_IPSR)-PT(PR)
-	adds r2=PT(B6)+16,r12
-	adds r3=PT(R16)+16,r12
-	;;
-	lfetch [r21]
-	ld8 r28=[r2],8		// load b6
-	adds r29=PT(R24)+16,r12
-
-#ifdef XEN
-	ld8.fill r16=[r3]
-	adds r3=PT(AR_CSD)-PT(R16),r3
-#else
-	ld8.fill r16=[r3],PT(AR_CSD)-PT(R16)
-#endif
-	adds r30=PT(AR_CCV)+16,r12
-(p6)	and r19=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
-	;;
-	ld8.fill r24=[r29]
-	ld8 r15=[r30]		// load ar.ccv
-(p6)	cmp4.ne.unc p6,p0=r19, r0		// any special work pending?
-	;;
-	ld8 r29=[r2],16		// load b7
-	ld8 r30=[r3],16		// load ar.csd
-#ifndef XEN
-(p6)	br.cond.spnt .work_pending
-#endif
-	;;
-	ld8 r31=[r2],16		// load ar.ssd
-	ld8.fill r8=[r3],16
-	;;
-	ld8.fill r9=[r2],16
-	ld8.fill r10=[r3],PT(R17)-PT(R10)
-	;;
-	ld8.fill r11=[r2],PT(R18)-PT(R11)
-	ld8.fill r17=[r3],16
-	;;
-	ld8.fill r18=[r2],16
-	ld8.fill r19=[r3],16
-	;;
-	ld8.fill r20=[r2],16
-	ld8.fill r21=[r3],16
-	mov ar.csd=r30
-	mov ar.ssd=r31
-	;;
-	rsm psr.i | psr.ic	// initiate turning off of interrupt and interruption collection
-	invala			// invalidate ALAT
-	;;
-	ld8.fill r22=[r2],24
-	ld8.fill r23=[r3],24
-	mov b6=r28
-	;;
-	ld8.fill r25=[r2],16
-	ld8.fill r26=[r3],16
-	mov b7=r29
-	;;
-	ld8.fill r27=[r2],16
-	ld8.fill r28=[r3],16
-	;;
-	ld8.fill r29=[r2],16
-	ld8.fill r30=[r3],24
-	;;
-	ld8.fill r31=[r2],PT(F9)-PT(R31)
-	adds r3=PT(F10)-PT(F6),r3
-	;;
-	ldf.fill f9=[r2],PT(F6)-PT(F9)
-	ldf.fill f10=[r3],PT(F8)-PT(F10)
-	;;
-	ldf.fill f6=[r2],PT(F7)-PT(F6)
-	;;
-	ldf.fill f7=[r2],PT(F11)-PT(F7)
-#ifdef XEN
-	ldf.fill f8=[r3],PT(R5)-PT(F8)
-	;;
-	ldf.fill f11=[r2],PT(R4)-PT(F11)
-	mov ar.ccv=r15
-	;;
-	ld8.fill r4=[r2],16
-	ld8.fill r5=[r3],16
-	;;
-	ld8.fill r6=[r2]
-	ld8.fill r7=[r3]
-	;;
-	srlz.d	// ensure that inter. collection is off (VHPT is don't care, since text is pinned)
-    ;;
-	bsw.0			// switch back to bank 0 (no stop bit required beforehand...)
-	;;
-#else
-	ldf.fill f8=[r3],32
-	;;
-	srlz.d	// ensure that inter. collection is off (VHPT is don't care, since text is pinned)
-	mov ar.ccv=r15
-	;;
-	ldf.fill f11=[r2]
-	bsw.0			// switch back to bank 0 (no stop bit required beforehand...)
-	;;
-#endif
-#ifdef XEN
-(pUStk) movl r18=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
-(pUStk) ld8 r18=[r18]
-#else
-(pUStk)	mov r18=IA64_KR(CURRENT)// M2 (12 cycle read latency)
-#endif
-	adds r16=PT(CR_IPSR)+16,r12
-	adds r17=PT(CR_IIP)+16,r12
-
-(pKStk)	mov r22=psr		// M2 read PSR now that interrupts are disabled
-	nop.i 0
-	nop.i 0
-	;;
-	ld8 r29=[r16],16	// load cr.ipsr
-	ld8 r28=[r17],16	// load cr.iip
-	;;
-	ld8 r30=[r16],16	// load cr.ifs
-	ld8 r25=[r17],16	// load ar.unat
-	;;
-	ld8 r26=[r16],16	// load ar.pfs
-	ld8 r27=[r17],16	// load ar.rsc
-#ifndef XEN	
-	cmp.eq p9,p0=r0,r0	// set p9 to indicate that we should restore cr.ifs
-#endif
-	;;
-	ld8 r24=[r16],16	// load ar.rnat (may be garbage)
-	ld8 r23=[r17],16	// load ar.bspstore (may be garbage)
-	;;
-	ld8 r31=[r16],16	// load predicates
-	ld8 r21=[r17],16	// load b0
-	;;
-	ld8 r19=[r16],16	// load ar.rsc value for "loadrs"
-	ld8.fill r1=[r17],16	// load r1
-	;;
-	ld8.fill r12=[r16],16
-	ld8.fill r13=[r17],16
-(pUStk)	adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18
-	;;
-	ld8 r20=[r16],16	// ar.fpsr
-	ld8.fill r15=[r17],16
-	;;
-	ld8.fill r14=[r16],16
-	ld8.fill r2=[r17]
-(pUStk)	mov r17=1
-	;;
-	ld8.fill r3=[r16]
-(pUStk)	st1 [r18]=r17		// restore current->thread.on_ustack
-	shr.u r18=r19,16	// get byte size of existing "dirty" partition
-	;;
-	mov r16=ar.bsp		// get existing backing store pointer
-#ifdef XEN
-	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)
-#else
-	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
-#endif
-	;;
-	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
-(pKStk)	br.cond.dpnt skip_rbs_switch
-
-	/*
-	 * Restore user backing store.
-	 *
-	 * NOTE: alloc, loadrs, and cover can't be predicated.
-	 */
-(pNonSys) br.cond.dpnt dont_preserve_current_frame
-	cover				// add current frame into dirty partition and set cr.ifs
-	;;
-	mov r19=ar.bsp			// get new backing store pointer
-rbs_switch:
-	sub r16=r16,r18			// krbs = old bsp - size of dirty partition
-#ifndef XEN
-	cmp.ne p9,p0=r0,r0		// clear p9 to skip restore of cr.ifs
-#endif
-	;;
-	sub r19=r19,r16			// calculate total byte size of dirty partition
-	add r18=64,r18			// don't force in0-in7 into memory...
-	;;
-	shl r19=r19,16			// shift size of dirty partition into loadrs position
-	;;
-dont_preserve_current_frame:
-	/*
-	 * To prevent leaking bits between the kernel and user-space,
-	 * we must clear the stacked registers in the "invalid" partition here.
-	 * Not pretty, but at least it's fast (3.34 registers/cycle on Itanium,
-	 * 5 registers/cycle on McKinley).
-	 */
-#	define pRecurse	p6
-#	define pReturn	p7
-#ifdef CONFIG_ITANIUM
-#	define Nregs	10
-#else
-#	define Nregs	14
-#endif
-	alloc loc0=ar.pfs,2,Nregs-2,2,0
-	shr.u loc1=r18,9		// RNaTslots <= floor(dirtySize / (64*8))
-	sub r17=r17,r18			// r17 = (physStackedSize + 8) - dirtySize
-	;;
-	mov ar.rsc=r19			// load ar.rsc to be used for "loadrs"
-	shladd in0=loc1,3,r17
-	mov in1=0
-	;;
-	TEXT_ALIGN(32)
-rse_clear_invalid:
-#ifdef CONFIG_ITANIUM
-	// cycle 0
- { .mii
-	alloc loc0=ar.pfs,2,Nregs-2,2,0
-	cmp.lt pRecurse,p0=Nregs*8,in0	// if more than Nregs regs left to clear, (re)curse
-	add out0=-Nregs*8,in0
-}{ .mfb
-	add out1=1,in1			// increment recursion count
-	nop.f 0
-	nop.b 0				// can't do br.call here because of alloc (WAW on CFM)
-	;;
-}{ .mfi	// cycle 1
-	mov loc1=0
-	nop.f 0
-	mov loc2=0
-}{ .mib
-	mov loc3=0
-	mov loc4=0
-(pRecurse) br.call.sptk.many b0=rse_clear_invalid
-
-}{ .mfi	// cycle 2
-	mov loc5=0
-	nop.f 0
-	cmp.ne pReturn,p0=r0,in1	// if recursion count != 0, we need to do a br.ret
-}{ .mib
-	mov loc6=0
-	mov loc7=0
-(pReturn) br.ret.sptk.many b0
-}
-#else /* !CONFIG_ITANIUM */
-	alloc loc0=ar.pfs,2,Nregs-2,2,0
-	cmp.lt pRecurse,p0=Nregs*8,in0	// if more than Nregs regs left to clear, (re)curse
-	add out0=-Nregs*8,in0
-	add out1=1,in1			// increment recursion count
-	mov loc1=0
-	mov loc2=0
-	;;
-	mov loc3=0
-	mov loc4=0
-	mov loc5=0
-	mov loc6=0
-	mov loc7=0
-(pRecurse) br.call.dptk.few b0=rse_clear_invalid
-	;;
-	mov loc8=0
-	mov loc9=0
-	cmp.ne pReturn,p0=r0,in1	// if recursion count != 0, we need to do a br.ret
-	mov loc10=0
-	mov loc11=0
-(pReturn) br.ret.dptk.many b0
-#endif /* !CONFIG_ITANIUM */
-#	undef pRecurse
-#	undef pReturn
-	;;
-	alloc r17=ar.pfs,0,0,0,0	// drop current register frame
-	;;
-	loadrs
-	;;
-skip_rbs_switch:
-	mov ar.unat=r25		// M2
-(pKStk)	extr.u r22=r22,21,1	// I0 extract current value of psr.pp from r22
-(pLvSys)mov r19=r0		// A  clear r19 for leave_syscall, no-op otherwise
-	;;
-(pUStk)	mov ar.bspstore=r23	// M2
-(pKStk)	dep r29=r22,r29,21,1	// I0 update ipsr.pp with psr.pp
-(pLvSys)mov r16=r0		// A  clear r16 for leave_syscall, no-op otherwise
-	;;
-	mov cr.ipsr=r29		// M2
-	mov ar.pfs=r26		// I0
-(pLvSys)mov r17=r0		// A  clear r17 for leave_syscall, no-op otherwise
-#ifdef XEN
-	mov cr.ifs=r30		// M2
-#else    
-(p9)	mov cr.ifs=r30		// M2
-#endif
-	mov b0=r21		// I0
-(pLvSys)mov r18=r0		// A  clear r18 for leave_syscall, no-op otherwise
-
-	mov ar.fpsr=r20		// M2
-	mov cr.iip=r28		// M2
-	nop 0
-	;;
-(pUStk)	mov ar.rnat=r24		// M2 must happen with RSE in lazy mode
-	nop 0
-#ifdef XEN    
-(pLvSys)mov r15=r0
-#else
-(pLvSys)mov r2=r0
-#endif
-
-	mov ar.rsc=r27		// M2
-	mov pr=r31,-1		// I0
-	rfi			// B
-
-#ifndef XEN
-	/*
-	 * On entry:
-	 *	r20 = &current->thread_info->pre_count (if CONFIG_PREEMPT)
-	 *	r31 = current->thread_info->flags
-	 * On exit:
-	 *	p6 = TRUE if work-pending-check needs to be redone
-	 */
-.work_pending_syscall:
-	add r2=-8,r2
-	add r3=-8,r3
-	;;
-	st8 [r2]=r8
-	st8 [r3]=r10
-.work_pending:
-	tbit.nz p6,p0=r31,TIF_SIGDELAYED		// signal delayed from  MCA/INIT/NMI/PMI context?
-(p6)	br.cond.sptk.few .sigdelayed
-	;;
-	tbit.z p6,p0=r31,TIF_NEED_RESCHED		// current_thread_info()->need_resched==0?
-(p6)	br.cond.sptk.few .notify
-#ifdef CONFIG_PREEMPT
-(pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1
-	;;
-(pKStk) st4 [r20]=r21
-	ssm psr.i		// enable interrupts
-#endif
-	br.call.spnt.many rp=schedule
-.ret9:	cmp.eq p6,p0=r0,r0				// p6 <- 1
-	rsm psr.i		// disable interrupts
-	;;
-#ifdef CONFIG_PREEMPT
-(pKStk)	adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
-	;;
-(pKStk)	st4 [r20]=r0		// preempt_count() <- 0
-#endif
-(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
-	br.cond.sptk.many .work_processed_kernel	// re-check
-
-.notify:
-(pUStk)	br.call.spnt.many rp=notify_resume_user
-.ret10:	cmp.ne p6,p0=r0,r0				// p6 <- 0
-(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
-	br.cond.sptk.many .work_processed_kernel	// don't re-check
-
-// There is a delayed signal that was detected in MCA/INIT/NMI/PMI context where
-// it could not be delivered.  Deliver it now.  The signal might be for us and
-// may set TIF_SIGPENDING, so redrive ia64_leave_* after processing the delayed
-// signal.
-
-.sigdelayed:
-	br.call.sptk.many rp=do_sigdelayed
-	cmp.eq p6,p0=r0,r0				// p6 <- 1, always re-check
-(pLvSys)br.cond.sptk.few  .work_pending_syscall_end
-	br.cond.sptk.many .work_processed_kernel	// re-check
-
-.work_pending_syscall_end:
-	adds r2=PT(R8)+16,r12
-	adds r3=PT(R10)+16,r12
-	;;
-	ld8 r8=[r2]
-	ld8 r10=[r3]
-	br.cond.sptk.many .work_processed_syscall	// re-check
-#endif
-
-END(ia64_leave_kernel)
-
-ENTRY(handle_syscall_error)
-	/*
-	 * Some system calls (e.g., ptrace, mmap) can return arbitrary values which could
-	 * lead us to mistake a negative return value as a failed syscall.  Those syscall
-	 * must deposit a non-zero value in pt_regs.r8 to indicate an error.  If
-	 * pt_regs.r8 is zero, we assume that the call completed successfully.
-	 */
-	PT_REGS_UNWIND_INFO(0)
-	ld8 r3=[r2]		// load pt_regs.r8
-	;;
-	cmp.eq p6,p7=r3,r0	// is pt_regs.r8==0?
-	;;
-(p7)	mov r10=-1
-(p7)	sub r8=0,r8		// negate return value to get errno
-	br.cond.sptk ia64_leave_syscall
-END(handle_syscall_error)
-
-	/*
-	 * Invoke schedule_tail(task) while preserving in0-in7, which may be needed
-	 * in case a system call gets restarted.
-	 */
-GLOBAL_ENTRY(ia64_invoke_schedule_tail)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,1,0
-	mov loc0=rp
-	mov out0=r8				// Address of previous task
-	;;
-	br.call.sptk.many rp=schedule_tail
-.ret11:	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(ia64_invoke_schedule_tail)
-
-#ifndef XEN
-	/*
-	 * Setup stack and call do_notify_resume_user().  Note that pSys and pNonSys need to
-	 * be set up by the caller.  We declare 8 input registers so the system call
-	 * args get preserved, in case we need to restart a system call.
-	 */
-ENTRY(notify_resume_user)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
-	mov r9=ar.unat
-	mov loc0=rp				// save return address
-	mov out0=0				// there is no "oldset"
-	adds out1=8,sp				// out1=&sigscratch->ar_pfs
-(pSys)	mov out2=1				// out2==1 => we're in a syscall
-	;;
-(pNonSys) mov out2=0				// out2==0 => not a syscall
-	.fframe 16
-	.spillsp ar.unat, 16
-	st8 [sp]=r9,-16				// allocate space for ar.unat and save it
-	st8 [out1]=loc1,-8			// save ar.pfs, out1=&sigscratch
-	.body
-	br.call.sptk.many rp=do_notify_resume_user
-.ret15:	.restore sp
-	adds sp=16,sp				// pop scratch stack space
-	;;
-	ld8 r9=[sp]				// load new unat from sigscratch->scratch_unat
-	mov rp=loc0
-	;;
-	mov ar.unat=r9
-	mov ar.pfs=loc1
-	br.ret.sptk.many rp
-END(notify_resume_user)
-
-GLOBAL_ENTRY(sys_rt_sigsuspend)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
-	alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
-	mov r9=ar.unat
-	mov loc0=rp				// save return address
-	mov out0=in0				// mask
-	mov out1=in1				// sigsetsize
-	adds out2=8,sp				// out2=&sigscratch->ar_pfs
-	;;
-	.fframe 16
-	.spillsp ar.unat, 16
-	st8 [sp]=r9,-16				// allocate space for ar.unat and save it
-	st8 [out2]=loc1,-8			// save ar.pfs, out2=&sigscratch
-	.body
-	br.call.sptk.many rp=ia64_rt_sigsuspend
-.ret17:	.restore sp
-	adds sp=16,sp				// pop scratch stack space
-	;;
-	ld8 r9=[sp]				// load new unat from sw->caller_unat
-	mov rp=loc0
-	;;
-	mov ar.unat=r9
-	mov ar.pfs=loc1
-	br.ret.sptk.many rp
-END(sys_rt_sigsuspend)
-
-ENTRY(sys_rt_sigreturn)
-	PT_REGS_UNWIND_INFO(0)
-	/*
-	 * Allocate 8 input registers since ptrace() may clobber them
-	 */
-	alloc r2=ar.pfs,8,0,1,0
-	.prologue
-	PT_REGS_SAVES(16)
-	adds sp=-16,sp
-	.body
-	cmp.eq pNonSys,pSys=r0,r0		// sigreturn isn't a normal syscall...
-	;;
-	/*
-	 * leave_kernel() restores f6-f11 from pt_regs, but since the streamlined
-	 * syscall-entry path does not save them we save them here instead.  Note: we
-	 * don't need to save any other registers that are not saved by the stream-lined
-	 * syscall path, because restore_sigcontext() restores them.
-	 */
-	adds r16=PT(F6)+32,sp
-	adds r17=PT(F7)+32,sp
-	;;
- 	stf.spill [r16]=f6,32
- 	stf.spill [r17]=f7,32
-	;;
- 	stf.spill [r16]=f8,32
- 	stf.spill [r17]=f9,32
-	;;
- 	stf.spill [r16]=f10
- 	stf.spill [r17]=f11
-	adds out0=16,sp				// out0 = &sigscratch
-	br.call.sptk.many rp=ia64_rt_sigreturn
-.ret19:	.restore sp,0
-	adds sp=16,sp
-	;;
-	ld8 r9=[sp]				// load new ar.unat
-	mov.sptk b7=r8,ia64_leave_kernel
-	;;
-	mov ar.unat=r9
-	br.many b7
-END(sys_rt_sigreturn)
-#endif
-
-GLOBAL_ENTRY(ia64_prepare_handle_unaligned)
-	.prologue
-	/*
-	 * r16 = fake ar.pfs, we simply need to make sure privilege is still 0
-	 */
-	mov r16=r0
-	DO_SAVE_SWITCH_STACK
-	br.call.sptk.many rp=ia64_handle_unaligned	// stack frame setup in ivt
-.ret21:	.body
-	DO_LOAD_SWITCH_STACK
-	br.cond.sptk.many rp				// goes to ia64_leave_kernel
-END(ia64_prepare_handle_unaligned)
-
-	//
-	// unw_init_running(void (*callback)(info, arg), void *arg)
-	//
-#	define EXTRA_FRAME_SIZE	((UNW_FRAME_INFO_SIZE+15)&~15)
-
-GLOBAL_ENTRY(unw_init_running)
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-	alloc loc1=ar.pfs,2,3,3,0
-	;;
-	ld8 loc2=[in0],8
-	mov loc0=rp
-	mov r16=loc1
-	DO_SAVE_SWITCH_STACK
-	.body
-
-	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-	.fframe IA64_SWITCH_STACK_SIZE+EXTRA_FRAME_SIZE
-	SWITCH_STACK_SAVES(EXTRA_FRAME_SIZE)
-	adds sp=-EXTRA_FRAME_SIZE,sp
-	.body
-	;;
-	adds out0=16,sp				// &info
-	mov out1=r13				// current
-	adds out2=16+EXTRA_FRAME_SIZE,sp	// &switch_stack
-	br.call.sptk.many rp=unw_init_frame_info
-1:	adds out0=16,sp				// &info
-	mov b6=loc2
-	mov loc2=gp				// save gp across indirect function call
-	;;
-	ld8 gp=[in0]
-	mov out1=in1				// arg
-	br.call.sptk.many rp=b6			// invoke the callback function
-1:	mov gp=loc2				// restore gp
-
-	// For now, we don't allow changing registers from within
-	// unw_init_running; if we ever want to allow that, we'd
-	// have to do a load_switch_stack here:
-	.restore sp
-	adds sp=IA64_SWITCH_STACK_SIZE+EXTRA_FRAME_SIZE,sp
-
-	mov ar.pfs=loc1
-	mov rp=loc0
-	br.ret.sptk.many rp
-END(unw_init_running)
-
-#ifdef XEN
-GLOBAL_ENTRY(ia64_do_multicall_call)
-	movl r2=ia64_hypercall_table;;
-	shladd r2=r38,3,r2;;
-	ld8 r2=[r2];;
-	mov b6=r2
-	br.sptk.many b6;;
-END(ia64_do_multicall_call)
-
-    
-	.rodata
-	.align 8
-	.globl ia64_hypercall_table
-ia64_hypercall_table:
-	data8 do_ni_hypercall		/* do_set_trap_table *//*  0 */
-	data8 do_ni_hypercall		/* do_mmu_update */
-	data8 do_ni_hypercall		/* do_set_gdt */
-	data8 do_ni_hypercall		/* do_stack_switch */
-	data8 do_ni_hypercall		/* do_set_callbacks */
-	data8 do_ni_hypercall		/* do_fpu_taskswitch *//*  5 */
-	data8 do_sched_op_compat
-	data8 do_platform_op
-	data8 do_ni_hypercall		/* do_set_debugreg */
-	data8 do_ni_hypercall		/* do_get_debugreg */
-	data8 do_ni_hypercall		/* do_update_descriptor * 10 */
-	data8 do_ni_hypercall		/* do_ni_hypercall */
-	data8 do_memory_op
-	data8 do_multicall
-	data8 do_ni_hypercall		/* do_update_va_mapping */
-	data8 do_ni_hypercall		/* do_set_timer_op */  /* 15 */
-	data8 do_ni_hypercall
-	data8 do_xen_version
-	data8 do_console_io
-	data8 do_ni_hypercall
-	data8 do_grant_table_op				       /* 20 */
-	data8 do_ni_hypercall		/* do_vm_assist */
-	data8 do_ni_hypercall		/* do_update_va_mapping_othe */
-	data8 do_ni_hypercall		/* (x86 only) */
-	data8 do_vcpu_op		/* do_vcpu_op */
-	data8 do_ni_hypercall		/* (x86_64 only) */    /* 25 */
-	data8 do_ni_hypercall		/* do_mmuext_op */
-	data8 do_ni_hypercall		/* do_acm_op */
-	data8 do_ni_hypercall		/* do_nmi_op */
-	data8 do_sched_op
-	data8 do_callback_op		/*  */                 /* 30 */
-	data8 do_xenoprof_op		/*  */
-	data8 do_event_channel_op
-	data8 do_physdev_op
-	data8 do_hvm_op			/*  */
-	data8 do_sysctl			/*  */                  /* 35 */
-	data8 do_domctl			/*  */
-	data8 do_kexec_op		/*  */
-	data8 do_tmem_op		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */                 /* 40 */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */                 /* 45 */
-	data8 do_ni_hypercall		/*  */
-	data8 do_ni_hypercall		/*  */
-	data8 do_dom0vp_op              /* dom0vp_op */
-	data8 do_pirq_guest_eoi		/* arch_1 */
-	data8 do_ia64_debug_op		/* arch_2 */           /* 50 */
-	data8 do_ni_hypercall		/* arch_3 */
-	data8 do_ni_hypercall		/* arch_4 */
-	data8 do_ni_hypercall		/* arch_5 */
-	data8 do_ni_hypercall		/* arch_6 */
-	data8 do_ni_hypercall		/* arch_7 */           /* 55 */
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall                                  /* 60 */
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-	data8 do_ni_hypercall
-
-	// guard against failures to increase NR_hypercalls
-	.org ia64_hypercall_table + 8*NR_hypercalls
-
-#else
-	.rodata
-	.align 8
-	.globl sys_call_table
-sys_call_table:
-	data8 sys_ni_syscall		//  This must be sys_ni_syscall!  See ivt.S.
-	data8 sys_exit				// 1025
-	data8 sys_read
-	data8 sys_write
-	data8 sys_open
-	data8 sys_close
-	data8 sys_creat				// 1030
-	data8 sys_link
-	data8 sys_unlink
-	data8 ia64_execve
-	data8 sys_chdir
-	data8 sys_fchdir			// 1035
-	data8 sys_utimes
-	data8 sys_mknod
-	data8 sys_chmod
-	data8 sys_chown
-	data8 sys_lseek				// 1040
-	data8 sys_getpid
-	data8 sys_getppid
-	data8 sys_mount
-	data8 sys_umount
-	data8 sys_setuid			// 1045
-	data8 sys_getuid
-	data8 sys_geteuid
-	data8 sys_ptrace
-	data8 sys_access
-	data8 sys_sync				// 1050
-	data8 sys_fsync
-	data8 sys_fdatasync
-	data8 sys_kill
-	data8 sys_rename
-	data8 sys_mkdir				// 1055
-	data8 sys_rmdir
-	data8 sys_dup
-	data8 sys_pipe
-	data8 sys_times
-	data8 ia64_brk				// 1060
-	data8 sys_setgid
-	data8 sys_getgid
-	data8 sys_getegid
-	data8 sys_acct
-	data8 sys_ioctl				// 1065
-	data8 sys_fcntl
-	data8 sys_umask
-	data8 sys_chroot
-	data8 sys_ustat
-	data8 sys_dup2				// 1070
-	data8 sys_setreuid
-	data8 sys_setregid
-	data8 sys_getresuid
-	data8 sys_setresuid
-	data8 sys_getresgid			// 1075
-	data8 sys_setresgid
-	data8 sys_getgroups
-	data8 sys_setgroups
-	data8 sys_getpgid
-	data8 sys_setpgid			// 1080
-	data8 sys_setsid
-	data8 sys_getsid
-	data8 sys_sethostname
-	data8 sys_setrlimit
-	data8 sys_getrlimit			// 1085
-	data8 sys_getrusage
-	data8 sys_gettimeofday
-	data8 sys_settimeofday
-	data8 sys_select
-	data8 sys_poll				// 1090
-	data8 sys_symlink
-	data8 sys_readlink
-	data8 sys_uselib
-	data8 sys_swapon
-	data8 sys_swapoff			// 1095
-	data8 sys_reboot
-	data8 sys_truncate
-	data8 sys_ftruncate
-	data8 sys_fchmod
-	data8 sys_fchown			// 1100
-	data8 ia64_getpriority
-	data8 sys_setpriority
-	data8 sys_statfs
-	data8 sys_fstatfs
-	data8 sys_gettid			// 1105
-	data8 sys_semget
-	data8 sys_semop
-	data8 sys_semctl
-	data8 sys_msgget
-	data8 sys_msgsnd			// 1110
-	data8 sys_msgrcv
-	data8 sys_msgctl
-	data8 sys_shmget
-	data8 sys_shmat
-	data8 sys_shmdt				// 1115
-	data8 sys_shmctl
-	data8 sys_syslog
-	data8 sys_setitimer
-	data8 sys_getitimer
-	data8 sys_ni_syscall			// 1120		/* was: ia64_oldstat */
-	data8 sys_ni_syscall					/* was: ia64_oldlstat */
-	data8 sys_ni_syscall					/* was: ia64_oldfstat */
-	data8 sys_vhangup
-	data8 sys_lchown
-	data8 sys_remap_file_pages		// 1125
-	data8 sys_wait4
-	data8 sys_sysinfo
-	data8 sys_clone
-	data8 sys_setdomainname
-	data8 sys_newuname			// 1130
-	data8 sys_adjtimex
-	data8 sys_ni_syscall					/* was: ia64_create_module */
-	data8 sys_init_module
-	data8 sys_delete_module
-	data8 sys_ni_syscall			// 1135		/* was: sys_get_kernel_syms */
-	data8 sys_ni_syscall					/* was: sys_query_module */
-	data8 sys_quotactl
-	data8 sys_bdflush
-	data8 sys_sysfs
-	data8 sys_personality			// 1140
-	data8 sys_ni_syscall		// sys_afs_syscall
-	data8 sys_setfsuid
-	data8 sys_setfsgid
-	data8 sys_getdents
-	data8 sys_flock				// 1145
-	data8 sys_readv
-	data8 sys_writev
-	data8 sys_pread64
-	data8 sys_pwrite64
-	data8 sys_sysctl			// 1150
-	data8 sys_mmap
-	data8 sys_munmap
-	data8 sys_mlock
-	data8 sys_mlockall
-	data8 sys_mprotect			// 1155
-	data8 ia64_mremap
-	data8 sys_msync
-	data8 sys_munlock
-	data8 sys_munlockall
-	data8 sys_sched_getparam		// 1160
-	data8 sys_sched_setparam
-	data8 sys_sched_getscheduler
-	data8 sys_sched_setscheduler
-	data8 sys_sched_yield
-	data8 sys_sched_get_priority_max	// 1165
-	data8 sys_sched_get_priority_min
-	data8 sys_sched_rr_get_interval
-	data8 sys_nanosleep
-	data8 sys_nfsservctl
-	data8 sys_prctl				// 1170
-	data8 sys_getpagesize
-	data8 sys_mmap2
-	data8 sys_pciconfig_read
-	data8 sys_pciconfig_write
-	data8 sys_perfmonctl			// 1175
-	data8 sys_sigaltstack
-	data8 sys_rt_sigaction
-	data8 sys_rt_sigpending
-	data8 sys_rt_sigprocmask
-	data8 sys_rt_sigqueueinfo		// 1180
-	data8 sys_rt_sigreturn
-	data8 sys_rt_sigsuspend
-	data8 sys_rt_sigtimedwait
-	data8 sys_getcwd
-	data8 sys_capget			// 1185
-	data8 sys_capset
-	data8 sys_sendfile64
-	data8 sys_ni_syscall		// sys_getpmsg (STREAMS)
-	data8 sys_ni_syscall		// sys_putpmsg (STREAMS)
-	data8 sys_socket			// 1190
-	data8 sys_bind
-	data8 sys_connect
-	data8 sys_listen
-	data8 sys_accept
-	data8 sys_getsockname			// 1195
-	data8 sys_getpeername
-	data8 sys_socketpair
-	data8 sys_send
-	data8 sys_sendto
-	data8 sys_recv				// 1200
-	data8 sys_recvfrom
-	data8 sys_shutdown
-	data8 sys_setsockopt
-	data8 sys_getsockopt
-	data8 sys_sendmsg			// 1205
-	data8 sys_recvmsg
-	data8 sys_pivot_root
-	data8 sys_mincore
-	data8 sys_madvise
-	data8 sys_newstat			// 1210
-	data8 sys_newlstat
-	data8 sys_newfstat
-	data8 sys_clone2
-	data8 sys_getdents64
-	data8 sys_getunwind			// 1215
-	data8 sys_readahead
-	data8 sys_setxattr
-	data8 sys_lsetxattr
-	data8 sys_fsetxattr
-	data8 sys_getxattr			// 1220
-	data8 sys_lgetxattr
-	data8 sys_fgetxattr
-	data8 sys_listxattr
-	data8 sys_llistxattr
-	data8 sys_flistxattr			// 1225
-	data8 sys_removexattr
-	data8 sys_lremovexattr
-	data8 sys_fremovexattr
-	data8 sys_tkill
-	data8 sys_futex				// 1230
-	data8 sys_sched_setaffinity
-	data8 sys_sched_getaffinity
-	data8 sys_set_tid_address
-	data8 sys_fadvise64_64
-	data8 sys_tgkill 			// 1235
-	data8 sys_exit_group
-	data8 sys_lookup_dcookie
-	data8 sys_io_setup
-	data8 sys_io_destroy
-	data8 sys_io_getevents			// 1240
-	data8 sys_io_submit
-	data8 sys_io_cancel
-	data8 sys_epoll_create
-	data8 sys_epoll_ctl
-	data8 sys_epoll_wait			// 1245
-	data8 sys_restart_syscall
-	data8 sys_semtimedop
-	data8 sys_timer_create
-	data8 sys_timer_settime
-	data8 sys_timer_gettime			// 1250
-	data8 sys_timer_getoverrun
-	data8 sys_timer_delete
-	data8 sys_clock_settime
-	data8 sys_clock_gettime
-	data8 sys_clock_getres			// 1255
-	data8 sys_clock_nanosleep
-	data8 sys_fstatfs64
-	data8 sys_statfs64
-	data8 sys_mbind
-	data8 sys_get_mempolicy			// 1260
-	data8 sys_set_mempolicy
-	data8 sys_mq_open
-	data8 sys_mq_unlink
-	data8 sys_mq_timedsend
-	data8 sys_mq_timedreceive		// 1265
-	data8 sys_mq_notify
-	data8 sys_mq_getsetattr
-	data8 sys_ni_syscall			// reserved for kexec_load
-	data8 sys_ni_syscall			// reserved for vserver
-	data8 sys_waitid			// 1270
-	data8 sys_add_key
-	data8 sys_request_key
-	data8 sys_keyctl
-	data8 sys_ioprio_set
-	data8 sys_ioprio_get			// 1275
-	data8 sys_ni_syscall
-	data8 sys_inotify_init
-	data8 sys_inotify_add_watch
-	data8 sys_inotify_rm_watch
-
-	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
-#endif
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/entry.h
--- a/xen/arch/ia64/linux-xen/entry.h	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-#include <linux/config.h>
-
-/*
- * Preserved registers that are shared between code in ivt.S and
- * entry.S.  Be careful not to step on these!
- */
-#define PRED_LEAVE_SYSCALL	1 /* TRUE iff leave from syscall */
-#define PRED_KERNEL_STACK	2 /* returning to kernel-stacks? */
-#define PRED_USER_STACK		3 /* returning to user-stacks? */
-#define PRED_SYSCALL		4 /* inside a system call? */
-#define PRED_NON_SYSCALL	5 /* complement of PRED_SYSCALL */
-
-#ifdef __ASSEMBLY__
-# define PASTE2(x,y)	x##y
-# define PASTE(x,y)	PASTE2(x,y)
-
-# define pLvSys		PASTE(p,PRED_LEAVE_SYSCALL)
-# define pKStk		PASTE(p,PRED_KERNEL_STACK)
-# define pUStk		PASTE(p,PRED_USER_STACK)
-# define pSys		PASTE(p,PRED_SYSCALL)
-# define pNonSys	PASTE(p,PRED_NON_SYSCALL)
-#endif
-
-#define PT(f)		(IA64_PT_REGS_##f##_OFFSET)
-#define SW(f)		(IA64_SWITCH_STACK_##f##_OFFSET)
-#ifdef  XEN
-#define VPD(f)      (VPD_##f##_START_OFFSET)
-#endif
-
-#define PT_REGS_SAVES(off)			\
-	.unwabi 3, 'i';				\
-	.fframe IA64_PT_REGS_SIZE+16+(off);	\
-	.spillsp rp, PT(CR_IIP)+16+(off);	\
-	.spillsp ar.pfs, PT(CR_IFS)+16+(off);	\
-	.spillsp ar.unat, PT(AR_UNAT)+16+(off);	\
-	.spillsp ar.fpsr, PT(AR_FPSR)+16+(off);	\
-	.spillsp pr, PT(PR)+16+(off);
-
-#define PT_REGS_UNWIND_INFO(off)		\
-	.prologue;				\
-	PT_REGS_SAVES(off);			\
-	.body
-
-#define SWITCH_STACK_SAVES(off)							\
-	.savesp ar.unat,SW(CALLER_UNAT)+16+(off);				\
-	.savesp ar.fpsr,SW(AR_FPSR)+16+(off);					\
-	.spillsp f2,SW(F2)+16+(off); .spillsp f3,SW(F3)+16+(off);		\
-	.spillsp f4,SW(F4)+16+(off); .spillsp f5,SW(F5)+16+(off);		\
-	.spillsp f16,SW(F16)+16+(off); .spillsp f17,SW(F17)+16+(off);		\
-	.spillsp f18,SW(F18)+16+(off); .spillsp f19,SW(F19)+16+(off);		\
-	.spillsp f20,SW(F20)+16+(off); .spillsp f21,SW(F21)+16+(off);		\
-	.spillsp f22,SW(F22)+16+(off); .spillsp f23,SW(F23)+16+(off);		\
-	.spillsp f24,SW(F24)+16+(off); .spillsp f25,SW(F25)+16+(off);		\
-	.spillsp f26,SW(F26)+16+(off); .spillsp f27,SW(F27)+16+(off);		\
-	.spillsp f28,SW(F28)+16+(off); .spillsp f29,SW(F29)+16+(off);		\
-	.spillsp f30,SW(F30)+16+(off); .spillsp f31,SW(F31)+16+(off);		\
-	.spillsp r4,SW(R4)+16+(off); .spillsp r5,SW(R5)+16+(off);		\
-	.spillsp r6,SW(R6)+16+(off); .spillsp r7,SW(R7)+16+(off);		\
-	.spillsp b0,SW(B0)+16+(off); .spillsp b1,SW(B1)+16+(off);		\
-	.spillsp b2,SW(B2)+16+(off); .spillsp b3,SW(B3)+16+(off);		\
-	.spillsp b4,SW(B4)+16+(off); .spillsp b5,SW(B5)+16+(off);		\
-	.spillsp ar.pfs,SW(AR_PFS)+16+(off); .spillsp ar.lc,SW(AR_LC)+16+(off);	\
-	.spillsp @priunat,SW(AR_UNAT)+16+(off);					\
-	.spillsp ar.rnat,SW(AR_RNAT)+16+(off);					\
-	.spillsp ar.bspstore,SW(AR_BSPSTORE)+16+(off);				\
-	.spillsp pr,SW(PR)+16+(off)
-
-#define DO_SAVE_SWITCH_STACK			\
-	movl r28=1f;				\
-	;;					\
-	.fframe IA64_SWITCH_STACK_SIZE;		\
-	adds sp=-IA64_SWITCH_STACK_SIZE,sp;	\
-	mov.ret.sptk b7=r28,1f;			\
-	SWITCH_STACK_SAVES(0);			\
-	br.cond.sptk.many save_switch_stack;	\
-1:
-
-#define DO_LOAD_SWITCH_STACK			\
-	movl r28=1f;				\
-	;;					\
-	invala;					\
-	mov.ret.sptk b7=r28,1f;			\
-	br.cond.sptk.many load_switch_stack;	\
-1:	.restore sp;				\
-	adds sp=IA64_SWITCH_STACK_SIZE,sp
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/head.S
--- a/xen/arch/ia64/linux-xen/head.S	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1298 +0,0 @@
-/*
- * Here is where the ball gets rolling as far as the kernel is concerned.
- * When control is transferred to _start, the bootload has already
- * loaded us to the correct address.  All that's left to do here is
- * to set up the kernel's global pointer and jump to the kernel
- * entry point.
- *
- * Copyright (C) 1998-2001, 2003, 2005 Hewlett-Packard Co
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *	Stephane Eranian <eranian@hpl.hp.com>
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- * Copyright (C) 1999 Intel Corp.
- * Copyright (C) 1999 Asit Mallick <Asit.K.Mallick@intel.com>
- * Copyright (C) 1999 Don Dugger <Don.Dugger@intel.com>
- * Copyright (C) 2002 Fenghua Yu <fenghua.yu@intel.com>
- *   -Optimize __ia64_save_fpu() and __ia64_load_fpu() for Itanium 2.
- * Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com>
- *   Support for CPU Hotplug
- */
-
-#include <linux/config.h>
-
-#include <asm/asmmacro.h>
-#include <asm/fpu.h>
-#include <asm/kregs.h>
-#include <asm/mmu_context.h>
-#include <asm/offsets.h>
-#include <asm/pal.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <asm/system.h>
-#include <asm/mca_asm.h>
-
-#ifdef CONFIG_HOTPLUG_CPU
-#define SAL_PSR_BITS_TO_SET				\
-	(IA64_PSR_AC | IA64_PSR_BN | IA64_PSR_MFH | IA64_PSR_MFL)
-
-#define SAVE_FROM_REG(src, ptr, dest)	\
-	mov dest=src;;						\
-	st8 [ptr]=dest,0x08
-
-#define RESTORE_REG(reg, ptr, _tmp)		\
-	ld8 _tmp=[ptr],0x08;;				\
-	mov reg=_tmp
-
-#define SAVE_BREAK_REGS(ptr, _idx, _breg, _dest)\
-	mov ar.lc=IA64_NUM_DBG_REGS-1;; 			\
-	mov _idx=0;; 								\
-1: 												\
-	SAVE_FROM_REG(_breg[_idx], ptr, _dest);;	\
-	add _idx=1,_idx;;							\
-	br.cloop.sptk.many 1b
-
-#define RESTORE_BREAK_REGS(ptr, _idx, _breg, _tmp, _lbl)\
-	mov ar.lc=IA64_NUM_DBG_REGS-1;;			\
-	mov _idx=0;;							\
-_lbl:  RESTORE_REG(_breg[_idx], ptr, _tmp);;	\
-	add _idx=1, _idx;;						\
-	br.cloop.sptk.many _lbl
-
-#define SAVE_ONE_RR(num, _reg, _tmp) \
-	movl _tmp=(num<<61);;	\
-	mov _reg=rr[_tmp]
-
-#define SAVE_REGION_REGS(_tmp, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7) \
-	SAVE_ONE_RR(0,_r0, _tmp);; \
-	SAVE_ONE_RR(1,_r1, _tmp);; \
-	SAVE_ONE_RR(2,_r2, _tmp);; \
-	SAVE_ONE_RR(3,_r3, _tmp);; \
-	SAVE_ONE_RR(4,_r4, _tmp);; \
-	SAVE_ONE_RR(5,_r5, _tmp);; \
-	SAVE_ONE_RR(6,_r6, _tmp);; \
-	SAVE_ONE_RR(7,_r7, _tmp);;
-
-#define STORE_REGION_REGS(ptr, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7) \
-	st8 [ptr]=_r0, 8;; \
-	st8 [ptr]=_r1, 8;; \
-	st8 [ptr]=_r2, 8;; \
-	st8 [ptr]=_r3, 8;; \
-	st8 [ptr]=_r4, 8;; \
-	st8 [ptr]=_r5, 8;; \
-	st8 [ptr]=_r6, 8;; \
-	st8 [ptr]=_r7, 8;;
-
-#define RESTORE_REGION_REGS(ptr, _idx1, _idx2, _tmp) \
-	mov		ar.lc=0x08-1;;						\
-	movl	_idx1=0x00;;						\
-RestRR:											\
-	dep.z	_idx2=_idx1,61,3;;					\
-	ld8		_tmp=[ptr],8;;						\
-	mov		rr[_idx2]=_tmp;;					\
-	srlz.d;;									\
-	add		_idx1=1,_idx1;;						\
-	br.cloop.sptk.few	RestRR
-
-#define SET_AREA_FOR_BOOTING_CPU(reg1, reg2) \
-	movl reg1=sal_state_for_booting_cpu;;	\
-	ld8 reg2=[reg1];;
-
-/*
- * Adjust region registers saved before starting to save
- * break regs and rest of the states that need to be preserved.
- */
-#define SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(_reg1,_reg2,_pred)  \
-	SAVE_FROM_REG(b0,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b1,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b2,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b3,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b4,_reg1,_reg2);;						\
-	SAVE_FROM_REG(b5,_reg1,_reg2);;						\
-	st8 [_reg1]=r1,0x08;;								\
-	st8 [_reg1]=r12,0x08;;								\
-	st8 [_reg1]=r13,0x08;;								\
-	SAVE_FROM_REG(ar.fpsr,_reg1,_reg2);;				\
-	SAVE_FROM_REG(ar.pfs,_reg1,_reg2);;					\
-	SAVE_FROM_REG(ar.rnat,_reg1,_reg2);;				\
-	SAVE_FROM_REG(ar.unat,_reg1,_reg2);;				\
-	SAVE_FROM_REG(ar.bspstore,_reg1,_reg2);;			\
-	SAVE_FROM_REG(cr.dcr,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.iva,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.pta,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.itv,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.pmv,_reg1,_reg2);;					\
-	SAVE_FROM_REG(cr.cmcv,_reg1,_reg2);;				\
-	SAVE_FROM_REG(cr.lrr0,_reg1,_reg2);;				\
-	SAVE_FROM_REG(cr.lrr1,_reg1,_reg2);;				\
-	st8 [_reg1]=r4,0x08;;								\
-	st8 [_reg1]=r5,0x08;;								\
-	st8 [_reg1]=r6,0x08;;								\
-	st8 [_reg1]=r7,0x08;;								\
-	st8 [_reg1]=_pred,0x08;;							\
-	SAVE_FROM_REG(ar.lc, _reg1, _reg2);;				\
-	stf.spill.nta [_reg1]=f2,16;;						\
-	stf.spill.nta [_reg1]=f3,16;;						\
-	stf.spill.nta [_reg1]=f4,16;;						\
-	stf.spill.nta [_reg1]=f5,16;;						\
-	stf.spill.nta [_reg1]=f16,16;;						\
-	stf.spill.nta [_reg1]=f17,16;;						\
-	stf.spill.nta [_reg1]=f18,16;;						\
-	stf.spill.nta [_reg1]=f19,16;;						\
-	stf.spill.nta [_reg1]=f20,16;;						\
-	stf.spill.nta [_reg1]=f21,16;;						\
-	stf.spill.nta [_reg1]=f22,16;;						\
-	stf.spill.nta [_reg1]=f23,16;;						\
-	stf.spill.nta [_reg1]=f24,16;;						\
-	stf.spill.nta [_reg1]=f25,16;;						\
-	stf.spill.nta [_reg1]=f26,16;;						\
-	stf.spill.nta [_reg1]=f27,16;;						\
-	stf.spill.nta [_reg1]=f28,16;;						\
-	stf.spill.nta [_reg1]=f29,16;;						\
-	stf.spill.nta [_reg1]=f30,16;;						\
-	stf.spill.nta [_reg1]=f31,16;;
-
-#else
-#define SET_AREA_FOR_BOOTING_CPU(a1, a2)
-#define SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(a1,a2, a3)
-#define SAVE_REGION_REGS(_tmp, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7)
-#define STORE_REGION_REGS(ptr, _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7)
-#endif
-
-#ifdef XEN
-#define SET_ONE_RR(num, pgsize, _tmp1, _tmp2, vhpt) \
-	movl _tmp1=(num << 61);;	\
-	movl _tmp2=((ia64_rid(IA64_REGION_ID_KERNEL, (num<<61)) << 8) | (pgsize << 2) | vhpt);; \
-	mov rr[_tmp1]=_tmp2
-#else
-#define SET_ONE_RR(num, pgsize, _tmp1, _tmp2, vhpt) \
-	movl _tmp1=(num << 61);;	\
-	mov _tmp2=((ia64_rid(IA64_REGION_ID_KERNEL, (num<<61)) << 8) | (pgsize << 2) | vhpt);; \
-	mov rr[_tmp1]=_tmp2
-#endif
-
-	.section __special_page_section,"ax"
-
-	.global empty_zero_page
-empty_zero_page:
-	.skip PAGE_SIZE
-
-#ifndef XEN
-	.global swapper_pg_dir
-swapper_pg_dir:
-	.skip PAGE_SIZE
-#endif
-
-#if defined(XEN) && defined(CONFIG_VIRTUAL_FRAME_TABLE)
-	.global frametable_pg_dir
-frametable_pg_dir:
-	.skip PAGE_SIZE
-#endif
-
-	.rodata
-halt_msg:
-	stringz "Halting kernel\n"
-
-	.text
-
-	.global start_ap
-
-	/*
-	 * Start the kernel.  When the bootloader passes control to _start(), r28
-	 * points to the address of the boot parameter area.  Execution reaches
-	 * here in physical mode.
-	 */
-GLOBAL_ENTRY(_start)
-start_ap:
-	.prologue
-	.save rp, r0		// terminate unwind chain with a NULL rp
-	.body
-
-	rsm psr.i | psr.ic
-	;;
-	srlz.i
-	;;
-	/*
-	 * Save the region registers, predicate before they get clobbered
-	 */
-	SAVE_REGION_REGS(r2, r8,r9,r10,r11,r12,r13,r14,r15);
-	mov r25=pr;;
-
-	/*
-	 * Initialize kernel region registers:
-	 *	rr[0]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[1]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[2]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[3]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[4]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[5]: VHPT enabled, page size = PAGE_SHIFT
-	 *	rr[6]: VHPT disabled, page size = IA64_GRANULE_SHIFT
-	 *	rr[7]: VHPT disabled, page size = IA64_GRANULE_SHIFT
-	 * We initialize all of them to prevent inadvertently assuming
-	 * something about the state of address translation early in boot.
-	 */
-	SET_ONE_RR(0, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(1, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(2, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(3, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(4, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(5, PAGE_SHIFT, r2, r16, 1);;
-	SET_ONE_RR(6, IA64_GRANULE_SHIFT, r2, r16, 0);;
-	SET_ONE_RR(7, IA64_GRANULE_SHIFT, r2, r16, 0);;
-	/*
-	 * Now pin mappings into the TLB for kernel text and data
-	 */
-	mov r18=KERNEL_TR_PAGE_SHIFT<<2
-	movl r17=KERNEL_START
-	;;
-	mov cr.itir=r18
-	mov cr.ifa=r17
-	mov r16=IA64_TR_KERNEL
-	mov r3=ip
-	movl r18=PAGE_KERNEL
-	;;
-	dep r2=0,r3,0,KERNEL_TR_PAGE_SHIFT
-	;;
-	or r18=r2,r18
-	;;
-	srlz.i
-	;;
-	itr.i itr[r16]=r18
-	;;
-	itr.d dtr[r16]=r18
-	;;
-	srlz.i
-
-	/*
-	 * Switch into virtual mode:
-	 */
-#ifdef XEN
-		movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \
-		  |IA64_PSR_DI|IA64_PSR_AC)
-#else
-	movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \
-		  |IA64_PSR_DI)
-#endif
-	;;
-	mov cr.ipsr=r16
-	movl r17=1f
-	;;
-	mov cr.iip=r17
-	mov cr.ifs=r0
-	;;
-	rfi
-	;;
-1:	// now we are in virtual mode
-
-	SET_AREA_FOR_BOOTING_CPU(r2, r16);
-
-	STORE_REGION_REGS(r16, r8,r9,r10,r11,r12,r13,r14,r15);
-	SAL_TO_OS_BOOT_HANDOFF_STATE_SAVE(r16,r17,r25)
-	;;
-
-	// set IVT entry point---can't access I/O ports without it
-	movl r3=ia64_ivt
-	;;
-	mov cr.iva=r3
-	movl r2=FPSR_DEFAULT
-	;;
-	srlz.i
-	movl gp=__gp
-	;;
-	mov ar.fpsr=r2
-	;;
-
-#define isAP	p2	// are we an Application Processor?
-#define isBP	p3	// are we the Bootstrap Processor?
-
-#ifdef XEN
-# define init_task	init_task_mem
-#endif
-
-#ifdef CONFIG_SMP
-	/*
-	 * Find the init_task for the currently booting CPU.  At poweron, and in
-	 * UP mode, task_for_booting_cpu is NULL.
-	 */
-	movl r3=task_for_booting_cpu
- 	;;
-	ld8 r3=[r3]
-	movl r2=init_task
-	;;
-	cmp.eq isBP,isAP=r3,r0
-	;;
-(isAP)	mov r2=r3
-#else
-	movl r2=init_task
-	cmp.eq isBP,isAP=r0,r0
-#endif
-	;;
-	tpa r3=r2		// r3 == phys addr of task struct
-	mov r16=-1
-#ifndef XEN
-(isBP)	br.cond.dpnt .load_current // BP stack is on region 5 --- no need to map it
-#endif
-
-	// load mapping for stack (virtaddr in r2, physaddr in r3)
-	rsm psr.ic
-	movl r17=PAGE_KERNEL
-	;;
-	srlz.d
-	dep r18=0,r3,0,12
-	;;
-	or r18=r17,r18
-#ifdef XEN
-	dep r2=-1,r3,60,4       // IMVA of task 
-#else
-	dep r2=-1,r3,61,3	// IMVA of task
-#endif
-	;;
-	mov r17=rr[r2]
-	shr.u r16=r3,IA64_GRANULE_SHIFT
-	;;
-	dep r17=0,r17,8,24
-	;;
-	mov cr.itir=r17
-	mov cr.ifa=r2
-
-	mov r19=IA64_TR_CURRENT_STACK
-	;;
-	itr.d dtr[r19]=r18
-	;;
-	ssm psr.ic
-	srlz.d
-  	;;
-	
-.load_current:
-	// load the "current" pointer (r13) and ar.k6 with the current task
-	mov IA64_KR(CURRENT)=r2		// virtual address
-	mov IA64_KR(CURRENT_STACK)=r16
-	mov r13=r2
-	/*
-	 * Reserve space at the top of the stack for "struct pt_regs".  Kernel
-	 * threads don't store interesting values in that structure, but the space
-	 * still needs to be there because time-critical stuff such as the context
-	 * switching can be implemented more efficiently (for example, __switch_to()
-	 * always sets the psr.dfh bit of the task it is switching to).
-	 */
-
-	addl r12=IA64_STK_OFFSET-IA64_PT_REGS_SIZE-16,r2
-	addl r2=IA64_RBS_OFFSET,r2	// initialize the RSE
-	mov ar.rsc=0		// place RSE in enforced lazy mode
-	;;
-	loadrs			// clear the dirty partition
-#ifdef XEN
-(isAP)	br.few 2f
-	movl r19=__phys_per_cpu_start
-	mov r18=PERCPU_PAGE_SIZE
-#ifndef CONFIG_SMP
-	add r19=r19,r18
-	;;
-#else
-	movl r20=__cpu0_per_cpu
-	;;
-	shr.u r18=r18,3
-1:
-	ld8 r21=[r19],8 ;;
-	st8[r20]=r21,8
-	adds r18=-1,r18
-	;;
-	cmp4.lt p7,p6=0,r18
-(p7)	br.cond.dptk.few 1b
-	;;
-#endif
-	movl r18=__per_cpu_offset
-	movl r19=__cpu0_per_cpu
-	movl r20=__per_cpu_start
-	;;
-	sub r20=r19,r20
-	;;
-	st8 [r18]=r20
-2:
-#endif
-	;;
-	mov ar.bspstore=r2	// establish the new RSE stack
-	;;
-	mov ar.rsc=0x3		// place RSE in eager mode
-
-#ifdef XEN
-(isBP)	dep r28=-1,r28,60,4	// make address virtual
-#else
-(isBP)	dep r28=-1,r28,61,3	// make address virtual
-#endif
-(isBP)	movl r2=ia64_boot_param
-	;;
-(isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
-
-#ifdef CONFIG_SMP
-(isAP)	br.call.sptk.many rp=start_secondary
-.ret0:
-(isAP)	br.cond.sptk self
-#endif
-
-	// This is executed by the bootstrap processor (bsp) only:
-
-#ifdef CONFIG_IA64_FW_EMU
-	// initialize PAL & SAL emulator:
-	br.call.sptk.many rp=sys_fw_init
-.ret1:
-#endif
-	br.call.sptk.many rp=start_kernel
-.ret2:	addl r3=@ltoff(halt_msg),gp
-	;;
-	alloc r2=ar.pfs,8,0,2,0
-	;;
-	ld8 out0=[r3]
-	br.call.sptk.many b0=console_print
-
-self:	hint @pause
-#ifdef XEN
-	;;
-	br.sptk.many self		// endless loop
-	;;
-#else
-	br.sptk.many self		// endless loop
-#endif
-END(_start)
-
-GLOBAL_ENTRY(ia64_save_debug_regs)
-	alloc r16=ar.pfs,1,0,0,0
-	mov r20=ar.lc			// preserve ar.lc
-	mov ar.lc=IA64_NUM_DBG_REGS-1
-	mov r18=0
-	add r19=IA64_NUM_DBG_REGS*8,in0
-	;;
-1:	mov r16=dbr[r18]
-#ifdef CONFIG_ITANIUM
-	;;
-	srlz.d
-#endif
-	mov r17=ibr[r18]
-	add r18=1,r18
-	;;
-	st8.nta [in0]=r16,8
-	st8.nta [r19]=r17,8
-	br.cloop.sptk.many 1b
-	;;
-	mov ar.lc=r20			// restore ar.lc
-	br.ret.sptk.many rp
-END(ia64_save_debug_regs)
-
-GLOBAL_ENTRY(ia64_load_debug_regs)
-	alloc r16=ar.pfs,1,0,0,0
-	lfetch.nta [in0]
-	mov r20=ar.lc			// preserve ar.lc
-	add r19=IA64_NUM_DBG_REGS*8,in0
-	mov ar.lc=IA64_NUM_DBG_REGS-1
-	mov r18=-1
-	;;
-1:	ld8.nta r16=[in0],8
-	ld8.nta r17=[r19],8
-	add r18=1,r18
-	;;
-	mov dbr[r18]=r16
-#ifdef CONFIG_ITANIUM
-	;;
-	srlz.d				// Errata 132 (NoFix status)
-#endif
-	mov ibr[r18]=r17
-	br.cloop.sptk.many 1b
-	;;
-	mov ar.lc=r20			// restore ar.lc
-	br.ret.sptk.many rp
-END(ia64_load_debug_regs)
-
-GLOBAL_ENTRY(__ia64_save_fpu)
-	alloc r2=ar.pfs,1,4,0,0
-	adds loc0=96*16-16,in0
-	adds loc1=96*16-16-128,in0
-	;;
-	stf.spill.nta [loc0]=f127,-256
-	stf.spill.nta [loc1]=f119,-256
-	;;
-	stf.spill.nta [loc0]=f111,-256
-	stf.spill.nta [loc1]=f103,-256
-	;;
-	stf.spill.nta [loc0]=f95,-256
-	stf.spill.nta [loc1]=f87,-256
-	;;
-	stf.spill.nta [loc0]=f79,-256
-	stf.spill.nta [loc1]=f71,-256
-	;;
-	stf.spill.nta [loc0]=f63,-256
-	stf.spill.nta [loc1]=f55,-256
-	adds loc2=96*16-32,in0
-	;;
-	stf.spill.nta [loc0]=f47,-256
-	stf.spill.nta [loc1]=f39,-256
-	adds loc3=96*16-32-128,in0
-	;;
-	stf.spill.nta [loc2]=f126,-256
-	stf.spill.nta [loc3]=f118,-256
-	;;
-	stf.spill.nta [loc2]=f110,-256
-	stf.spill.nta [loc3]=f102,-256
-	;;
-	stf.spill.nta [loc2]=f94,-256
-	stf.spill.nta [loc3]=f86,-256
-	;;
-	stf.spill.nta [loc2]=f78,-256
-	stf.spill.nta [loc3]=f70,-256
-	;;
-	stf.spill.nta [loc2]=f62,-256
-	stf.spill.nta [loc3]=f54,-256
-	adds loc0=96*16-48,in0
-	;;
-	stf.spill.nta [loc2]=f46,-256
-	stf.spill.nta [loc3]=f38,-256
-	adds loc1=96*16-48-128,in0
-	;;
-	stf.spill.nta [loc0]=f125,-256
-	stf.spill.nta [loc1]=f117,-256
-	;;
-	stf.spill.nta [loc0]=f109,-256
-	stf.spill.nta [loc1]=f101,-256
-	;;
-	stf.spill.nta [loc0]=f93,-256
-	stf.spill.nta [loc1]=f85,-256
-	;;
-	stf.spill.nta [loc0]=f77,-256
-	stf.spill.nta [loc1]=f69,-256
-	;;
-	stf.spill.nta [loc0]=f61,-256
-	stf.spill.nta [loc1]=f53,-256
-	adds loc2=96*16-64,in0
-	;;
-	stf.spill.nta [loc0]=f45,-256
-	stf.spill.nta [loc1]=f37,-256
-	adds loc3=96*16-64-128,in0
-	;;
-	stf.spill.nta [loc2]=f124,-256
-	stf.spill.nta [loc3]=f116,-256
-	;;
-	stf.spill.nta [loc2]=f108,-256
-	stf.spill.nta [loc3]=f100,-256
-	;;
-	stf.spill.nta [loc2]=f92,-256
-	stf.spill.nta [loc3]=f84,-256
-	;;
-	stf.spill.nta [loc2]=f76,-256
-	stf.spill.nta [loc3]=f68,-256
-	;;
-	stf.spill.nta [loc2]=f60,-256
-	stf.spill.nta [loc3]=f52,-256
-	adds loc0=96*16-80,in0
-	;;
-	stf.spill.nta [loc2]=f44,-256
-	stf.spill.nta [loc3]=f36,-256
-	adds loc1=96*16-80-128,in0
-	;;
-	stf.spill.nta [loc0]=f123,-256
-	stf.spill.nta [loc1]=f115,-256
-	;;
-	stf.spill.nta [loc0]=f107,-256
-	stf.spill.nta [loc1]=f99,-256
-	;;
-	stf.spill.nta [loc0]=f91,-256
-	stf.spill.nta [loc1]=f83,-256
-	;;
-	stf.spill.nta [loc0]=f75,-256
-	stf.spill.nta [loc1]=f67,-256
-	;;
-	stf.spill.nta [loc0]=f59,-256
-	stf.spill.nta [loc1]=f51,-256
-	adds loc2=96*16-96,in0
-	;;
-	stf.spill.nta [loc0]=f43,-256
-	stf.spill.nta [loc1]=f35,-256
-	adds loc3=96*16-96-128,in0
-	;;
-	stf.spill.nta [loc2]=f122,-256
-	stf.spill.nta [loc3]=f114,-256
-	;;
-	stf.spill.nta [loc2]=f106,-256
-	stf.spill.nta [loc3]=f98,-256
-	;;
-	stf.spill.nta [loc2]=f90,-256
-	stf.spill.nta [loc3]=f82,-256
-	;;
-	stf.spill.nta [loc2]=f74,-256
-	stf.spill.nta [loc3]=f66,-256
-	;;
-	stf.spill.nta [loc2]=f58,-256
-	stf.spill.nta [loc3]=f50,-256
-	adds loc0=96*16-112,in0
-	;;
-	stf.spill.nta [loc2]=f42,-256
-	stf.spill.nta [loc3]=f34,-256
-	adds loc1=96*16-112-128,in0
-	;;
-	stf.spill.nta [loc0]=f121,-256
-	stf.spill.nta [loc1]=f113,-256
-	;;
-	stf.spill.nta [loc0]=f105,-256
-	stf.spill.nta [loc1]=f97,-256
-	;;
-	stf.spill.nta [loc0]=f89,-256
-	stf.spill.nta [loc1]=f81,-256
-	;;
-	stf.spill.nta [loc0]=f73,-256
-	stf.spill.nta [loc1]=f65,-256
-	;;
-	stf.spill.nta [loc0]=f57,-256
-	stf.spill.nta [loc1]=f49,-256
-	adds loc2=96*16-128,in0
-	;;
-	stf.spill.nta [loc0]=f41,-256
-	stf.spill.nta [loc1]=f33,-256
-	adds loc3=96*16-128-128,in0
-	;;
-	stf.spill.nta [loc2]=f120,-256
-	stf.spill.nta [loc3]=f112,-256
-	;;
-	stf.spill.nta [loc2]=f104,-256
-	stf.spill.nta [loc3]=f96,-256
-	;;
-	stf.spill.nta [loc2]=f88,-256
-	stf.spill.nta [loc3]=f80,-256
-	;;
-	stf.spill.nta [loc2]=f72,-256
-	stf.spill.nta [loc3]=f64,-256
-	;;
-	stf.spill.nta [loc2]=f56,-256
-	stf.spill.nta [loc3]=f48,-256
-	;;
-	stf.spill.nta [loc2]=f40
-	stf.spill.nta [loc3]=f32
-	br.ret.sptk.many rp
-END(__ia64_save_fpu)
-
-GLOBAL_ENTRY(__ia64_load_fpu)
-	alloc r2=ar.pfs,1,2,0,0
-	adds r3=128,in0
-	adds r14=256,in0
-	adds r15=384,in0
-	mov loc0=512
-	mov loc1=-1024+16
-	;;
-	ldf.fill.nta f32=[in0],loc0
-	ldf.fill.nta f40=[ r3],loc0
-	ldf.fill.nta f48=[r14],loc0
-	ldf.fill.nta f56=[r15],loc0
-	;;
-	ldf.fill.nta f64=[in0],loc0
-	ldf.fill.nta f72=[ r3],loc0
-	ldf.fill.nta f80=[r14],loc0
-	ldf.fill.nta f88=[r15],loc0
-	;;
-	ldf.fill.nta f96=[in0],loc1
-	ldf.fill.nta f104=[ r3],loc1
-	ldf.fill.nta f112=[r14],loc1
-	ldf.fill.nta f120=[r15],loc1
-	;;
-	ldf.fill.nta f33=[in0],loc0
-	ldf.fill.nta f41=[ r3],loc0
-	ldf.fill.nta f49=[r14],loc0
-	ldf.fill.nta f57=[r15],loc0
-	;;
-	ldf.fill.nta f65=[in0],loc0
-	ldf.fill.nta f73=[ r3],loc0
-	ldf.fill.nta f81=[r14],loc0
-	ldf.fill.nta f89=[r15],loc0
-	;;
-	ldf.fill.nta f97=[in0],loc1
-	ldf.fill.nta f105=[ r3],loc1
-	ldf.fill.nta f113=[r14],loc1
-	ldf.fill.nta f121=[r15],loc1
-	;;
-	ldf.fill.nta f34=[in0],loc0
-	ldf.fill.nta f42=[ r3],loc0
-	ldf.fill.nta f50=[r14],loc0
-	ldf.fill.nta f58=[r15],loc0
-	;;
-	ldf.fill.nta f66=[in0],loc0
-	ldf.fill.nta f74=[ r3],loc0
-	ldf.fill.nta f82=[r14],loc0
-	ldf.fill.nta f90=[r15],loc0
-	;;
-	ldf.fill.nta f98=[in0],loc1
-	ldf.fill.nta f106=[ r3],loc1
-	ldf.fill.nta f114=[r14],loc1
-	ldf.fill.nta f122=[r15],loc1
-	;;
-	ldf.fill.nta f35=[in0],loc0
-	ldf.fill.nta f43=[ r3],loc0
-	ldf.fill.nta f51=[r14],loc0
-	ldf.fill.nta f59=[r15],loc0
-	;;
-	ldf.fill.nta f67=[in0],loc0
-	ldf.fill.nta f75=[ r3],loc0
-	ldf.fill.nta f83=[r14],loc0
-	ldf.fill.nta f91=[r15],loc0
-	;;
-	ldf.fill.nta f99=[in0],loc1
-	ldf.fill.nta f107=[ r3],loc1
-	ldf.fill.nta f115=[r14],loc1
-	ldf.fill.nta f123=[r15],loc1
-	;;
-	ldf.fill.nta f36=[in0],loc0
-	ldf.fill.nta f44=[ r3],loc0
-	ldf.fill.nta f52=[r14],loc0
-	ldf.fill.nta f60=[r15],loc0
-	;;
-	ldf.fill.nta f68=[in0],loc0
-	ldf.fill.nta f76=[ r3],loc0
-	ldf.fill.nta f84=[r14],loc0
-	ldf.fill.nta f92=[r15],loc0
-	;;
-	ldf.fill.nta f100=[in0],loc1
-	ldf.fill.nta f108=[ r3],loc1
-	ldf.fill.nta f116=[r14],loc1
-	ldf.fill.nta f124=[r15],loc1
-	;;
-	ldf.fill.nta f37=[in0],loc0
-	ldf.fill.nta f45=[ r3],loc0
-	ldf.fill.nta f53=[r14],loc0
-	ldf.fill.nta f61=[r15],loc0
-	;;
-	ldf.fill.nta f69=[in0],loc0
-	ldf.fill.nta f77=[ r3],loc0
-	ldf.fill.nta f85=[r14],loc0
-	ldf.fill.nta f93=[r15],loc0
-	;;
-	ldf.fill.nta f101=[in0],loc1
-	ldf.fill.nta f109=[ r3],loc1
-	ldf.fill.nta f117=[r14],loc1
-	ldf.fill.nta f125=[r15],loc1
-	;;
-	ldf.fill.nta f38 =[in0],loc0
-	ldf.fill.nta f46 =[ r3],loc0
-	ldf.fill.nta f54 =[r14],loc0
-	ldf.fill.nta f62 =[r15],loc0
-	;;
-	ldf.fill.nta f70 =[in0],loc0
-	ldf.fill.nta f78 =[ r3],loc0
-	ldf.fill.nta f86 =[r14],loc0
-	ldf.fill.nta f94 =[r15],loc0
-	;;
-	ldf.fill.nta f102=[in0],loc1
-	ldf.fill.nta f110=[ r3],loc1
-	ldf.fill.nta f118=[r14],loc1
-	ldf.fill.nta f126=[r15],loc1
-	;;
-	ldf.fill.nta f39 =[in0],loc0
-	ldf.fill.nta f47 =[ r3],loc0
-	ldf.fill.nta f55 =[r14],loc0
-	ldf.fill.nta f63 =[r15],loc0
-	;;
-	ldf.fill.nta f71 =[in0],loc0
-	ldf.fill.nta f79 =[ r3],loc0
-	ldf.fill.nta f87 =[r14],loc0
-	ldf.fill.nta f95 =[r15],loc0
-	;;
-	ldf.fill.nta f103=[in0]
-	ldf.fill.nta f111=[ r3]
-	ldf.fill.nta f119=[r14]
-	ldf.fill.nta f127=[r15]
-	br.ret.sptk.many rp
-END(__ia64_load_fpu)
-
-GLOBAL_ENTRY(__ia64_init_fpu)
-	stf.spill [sp]=f0		// M3
-	mov	 f32=f0			// F
-	nop.b	 0
-
-	ldfps	 f33,f34=[sp]		// M0
-	ldfps	 f35,f36=[sp]		// M1
-	mov      f37=f0			// F
-	;;
-
-	setf.s	 f38=r0			// M2
-	setf.s	 f39=r0			// M3
-	mov      f40=f0			// F
-
-	ldfps	 f41,f42=[sp]		// M0
-	ldfps	 f43,f44=[sp]		// M1
-	mov      f45=f0			// F
-
-	setf.s	 f46=r0			// M2
-	setf.s	 f47=r0			// M3
-	mov      f48=f0			// F
-
-	ldfps	 f49,f50=[sp]		// M0
-	ldfps	 f51,f52=[sp]		// M1
-	mov      f53=f0			// F
-
-	setf.s	 f54=r0			// M2
-	setf.s	 f55=r0			// M3
-	mov      f56=f0			// F
-
-	ldfps	 f57,f58=[sp]		// M0
-	ldfps	 f59,f60=[sp]		// M1
-	mov      f61=f0			// F
-
-	setf.s	 f62=r0			// M2
-	setf.s	 f63=r0			// M3
-	mov      f64=f0			// F
-
-	ldfps	 f65,f66=[sp]		// M0
-	ldfps	 f67,f68=[sp]		// M1
-	mov      f69=f0			// F
-
-	setf.s	 f70=r0			// M2
-	setf.s	 f71=r0			// M3
-	mov      f72=f0			// F
-
-	ldfps	 f73,f74=[sp]		// M0
-	ldfps	 f75,f76=[sp]		// M1
-	mov      f77=f0			// F
-
-	setf.s	 f78=r0			// M2
-	setf.s	 f79=r0			// M3
-	mov      f80=f0			// F
-
-	ldfps	 f81,f82=[sp]		// M0
-	ldfps	 f83,f84=[sp]		// M1
-	mov      f85=f0			// F
-
-	setf.s	 f86=r0			// M2
-	setf.s	 f87=r0			// M3
-	mov      f88=f0			// F
-
-	/*
-	 * When the instructions are cached, it would be faster to initialize
-	 * the remaining registers with simply mov instructions (F-unit).
-	 * This gets the time down to ~29 cycles.  However, this would use up
-	 * 33 bundles, whereas continuing with the above pattern yields
-	 * 10 bundles and ~30 cycles.
-	 */
-
-	ldfps	 f89,f90=[sp]		// M0
-	ldfps	 f91,f92=[sp]		// M1
-	mov      f93=f0			// F
-
-	setf.s	 f94=r0			// M2
-	setf.s	 f95=r0			// M3
-	mov      f96=f0			// F
-
-	ldfps	 f97,f98=[sp]		// M0
-	ldfps	 f99,f100=[sp]		// M1
-	mov      f101=f0		// F
-
-	setf.s	 f102=r0		// M2
-	setf.s	 f103=r0		// M3
-	mov      f104=f0		// F
-
-	ldfps	 f105,f106=[sp]		// M0
-	ldfps	 f107,f108=[sp]		// M1
-	mov      f109=f0		// F
-
-	setf.s	 f110=r0		// M2
-	setf.s	 f111=r0		// M3
-	mov      f112=f0		// F
-
-	ldfps	 f113,f114=[sp]		// M0
-	ldfps	 f115,f116=[sp]		// M1
-	mov      f117=f0		// F
-
-	setf.s	 f118=r0		// M2
-	setf.s	 f119=r0		// M3
-	mov      f120=f0		// F
-
-	ldfps	 f121,f122=[sp]		// M0
-	ldfps	 f123,f124=[sp]		// M1
-	mov      f125=f0		// F
-
-	setf.s	 f126=r0		// M2
-	setf.s	 f127=r0		// M3
-	br.ret.sptk.many rp		// F
-END(__ia64_init_fpu)
-
-/*
- * Switch execution mode from virtual to physical
- *
- * Inputs:
- *	r16 = new psr to establish
- * Output:
- *	r19 = old virtual address of ar.bsp
- *	r20 = old virtual address of sp
- *
- * Note: RSE must already be in enforced lazy mode
- */
-GLOBAL_ENTRY(ia64_switch_mode_phys)
- {
-	alloc r2=ar.pfs,0,0,0,0
-	rsm psr.i | psr.ic		// disable interrupts and interrupt collection
-	mov r15=ip
- }
-	;;
- {
-	flushrs				// must be first insn in group
-	srlz.i
- }
-	;;
-	mov cr.ipsr=r16			// set new PSR
-	add r3=1f-ia64_switch_mode_phys,r15
-
-	mov r19=ar.bsp
-	mov r20=sp
-	mov r14=rp			// get return address into a general register
-	;;
-
-	// going to physical mode, use tpa to translate virt->phys
-	tpa r17=r19
-	tpa r3=r3
-	tpa sp=sp
-	tpa r14=r14
-	;;
-
-	mov r18=ar.rnat			// save ar.rnat
-	mov ar.bspstore=r17		// this steps on ar.rnat
-	mov cr.iip=r3
-	mov cr.ifs=r0
-	;;
-	mov ar.rnat=r18			// restore ar.rnat
-	rfi				// must be last insn in group
-	;;
-1:	mov rp=r14
-	br.ret.sptk.many rp
-END(ia64_switch_mode_phys)
-
-/*
- * Switch execution mode from physical to virtual
- *
- * Inputs:
- *	r16 = new psr to establish
- *	r19 = new bspstore to establish
- *	r20 = new sp to establish
- *
- * Note: RSE must already be in enforced lazy mode
- */
-GLOBAL_ENTRY(ia64_switch_mode_virt)
- {
-	alloc r2=ar.pfs,0,0,0,0
-	rsm psr.i | psr.ic		// disable interrupts and interrupt collection
-	mov r15=ip
- }
-	;;
- {
-	flushrs				// must be first insn in group
-	srlz.i
- }
-	;;
-	mov cr.ipsr=r16			// set new PSR
-	add r3=1f-ia64_switch_mode_virt,r15
-
-	mov r14=rp			// get return address into a general register
-	;;
-
-	// going to virtual
-	//   - for code addresses, set upper bits of addr to KERNEL_START
-	//   - for stack addresses, copy from input argument
-	movl r18=KERNEL_START
-	dep r3=0,r3,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
-	dep r14=0,r14,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
-	mov sp=r20
-	;;
-	or r3=r3,r18
-	or r14=r14,r18
-	;;
-
-	mov r18=ar.rnat			// save ar.rnat
-	mov ar.bspstore=r19		// this steps on ar.rnat
-	mov cr.iip=r3
-	mov cr.ifs=r0
-	;;
-	mov ar.rnat=r18			// restore ar.rnat
-	rfi				// must be last insn in group
-	;;
-1:	mov rp=r14
-	br.ret.sptk.many rp
-END(ia64_switch_mode_virt)
-
-GLOBAL_ENTRY(ia64_delay_loop)
-	.prologue
-{	nop 0			// work around GAS unwind info generation bug...
-	.save ar.lc,r2
-	mov r2=ar.lc
-	.body
-	;;
-	mov ar.lc=r32
-}
-	;;
-	// force loop to be 32-byte aligned (GAS bug means we cannot use .align
-	// inside function body without corrupting unwind info).
-{	nop 0 }
-1:	br.cloop.sptk.few 1b
-	;;
-	mov ar.lc=r2
-	br.ret.sptk.many rp
-END(ia64_delay_loop)
-
-#ifndef XEN
-/*
- * Return a CPU-local timestamp in nano-seconds.  This timestamp is
- * NOT synchronized across CPUs its return value must never be
- * compared against the values returned on another CPU.  The usage in
- * kernel/sched.c ensures that.
- *
- * The return-value of sched_clock() is NOT supposed to wrap-around.
- * If it did, it would cause some scheduling hiccups (at the worst).
- * Fortunately, with a 64-bit cycle-counter ticking at 100GHz, even
- * that would happen only once every 5+ years.
- *
- * The code below basically calculates:
- *
- *   (ia64_get_itc() * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT
- *
- * except that the multiplication and the shift are done with 128-bit
- * intermediate precision so that we can produce a full 64-bit result.
- */
-GLOBAL_ENTRY(sched_clock)
-#ifdef XEN
-	movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
-#else
-	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
-#endif
-	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
-	;;
-	ldf8 f8=[r8]
-	;;
-	setf.sig f9=r9		// certain to stall, so issue it _after_ ldf8...
-	;;
-	xmpy.lu f10=f9,f8	// calculate low 64 bits of 128-bit product	(4 cyc)
-	xmpy.hu f11=f9,f8	// calculate high 64 bits of 128-bit product
-	;;
-	getf.sig r8=f10		//						(5 cyc)
-	getf.sig r9=f11
-	;;
-	shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
-	br.ret.sptk.many rp
-END(sched_clock)
-
-GLOBAL_ENTRY(start_kernel_thread)
-	.prologue
-	.save rp, r0				// this is the end of the call-chain
-	.body
-	alloc r2 = ar.pfs, 0, 0, 2, 0
-	mov out0 = r9
-	mov out1 = r11;;
-	br.call.sptk.many rp = kernel_thread_helper;;
-	mov out0 = r8
-	br.call.sptk.many rp = sys_exit;;
-1:	br.sptk.few 1b				// not reached
-END(start_kernel_thread)
-#endif /* XEN */
-
-#ifdef CONFIG_IA64_BRL_EMU
-
-/*
- *  Assembly routines used by brl_emu.c to set preserved register state.
- */
-
-#define SET_REG(reg)				\
- GLOBAL_ENTRY(ia64_set_##reg);			\
-	alloc r16=ar.pfs,1,0,0,0;		\
-	mov reg=r32;				\
-	;;					\
-	br.ret.sptk.many rp;			\
- END(ia64_set_##reg)
-
-SET_REG(b1);
-SET_REG(b2);
-SET_REG(b3);
-SET_REG(b4);
-SET_REG(b5);
-
-#endif /* CONFIG_IA64_BRL_EMU */
-
-#ifdef CONFIG_SMP
-	/*
-	 * This routine handles spinlock contention.  It uses a non-standard calling
-	 * convention to avoid converting leaf routines into interior routines.  Because
-	 * of this special convention, there are several restrictions:
-	 *
-	 * - do not use gp relative variables, this code is called from the kernel
-	 *   and from modules, r1 is undefined.
-	 * - do not use stacked registers, the caller owns them.
-	 * - do not use the scratch stack space, the caller owns it.
-	 * - do not use any registers other than the ones listed below
-	 *
-	 * Inputs:
-	 *   ar.pfs - saved CFM of caller
-	 *   ar.ccv - 0 (and available for use)
-	 *   r27    - flags from spin_lock_irqsave or 0.  Must be preserved.
-	 *   r28    - available for use.
-	 *   r29    - available for use.
-	 *   r30    - available for use.
-	 *   r31    - address of lock, available for use.
-	 *   b6     - return address
-	 *   p14    - available for use.
-	 *   p15    - used to track flag status.
-	 *
-	 * If you patch this code to use more registers, do not forget to update
-	 * the clobber lists for spin_lock() in include/asm-ia64/spinlock.h.
-	 */
-
-#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
-
-GLOBAL_ENTRY(ia64_spinlock_contention_pre3_4)
-	.prologue
-	.save ar.pfs, r0	// this code effectively has a zero frame size
-	.save rp, r28
-	.body
-	nop 0
-	tbit.nz p15,p0=r27,IA64_PSR_I_BIT
-	.restore sp		// pop existing prologue after next insn
-	mov b6 = r28
-	.prologue
-	.save ar.pfs, r0
-	.altrp b6
-	.body
-	;;
-(p15)	ssm psr.i		// reenable interrupts if they were on
-				// DavidM says that srlz.d is slow and is not required in this case
-.wait:
-	// exponential backoff, kdb, lockmeter etc. go in here
-	hint @pause
-	ld4 r30=[r31]		// don't use ld4.bias; if it's contended, we won't write the word
-	nop 0
-	;;
-	cmp4.ne p14,p0=r30,r0
-(p14)	br.cond.sptk.few .wait
-(p15)	rsm psr.i		// disable interrupts if we reenabled them
-	br.cond.sptk.few b6	// lock is now free, try to acquire
-	.global ia64_spinlock_contention_pre3_4_end	// for kernprof
-ia64_spinlock_contention_pre3_4_end:
-END(ia64_spinlock_contention_pre3_4)
-
-#else
-
-GLOBAL_ENTRY(ia64_spinlock_contention)
-	.prologue
-	.altrp b6
-	.body
-	tbit.nz p15,p0=r27,IA64_PSR_I_BIT
-	;;
-.wait:
-(p15)	ssm psr.i		// reenable interrupts if they were on
-				// DavidM says that srlz.d is slow and is not required in this case
-.wait2:
-	// exponential backoff, kdb, lockmeter etc. go in here
-	hint @pause
-	ld4 r30=[r31]		// don't use ld4.bias; if it's contended, we won't write the word
-	;;
-	cmp4.ne p14,p0=r30,r0
-	mov r30 = 1
-(p14)	br.cond.sptk.few .wait2
-(p15)	rsm psr.i		// disable interrupts if we reenabled them
-	;;
-	cmpxchg4.acq r30=[r31], r30, ar.ccv
-	;;
-	cmp4.ne p14,p0=r0,r30
-(p14)	br.cond.sptk.few .wait
-
-	br.ret.sptk.many b6	// lock is now taken
-END(ia64_spinlock_contention)
-
-#endif
-
-#ifdef CONFIG_HOTPLUG_CPU
-GLOBAL_ENTRY(ia64_jump_to_sal)
-	alloc r16=ar.pfs,1,0,0,0;;
-	rsm psr.i  | psr.ic
-{
-	flushrs
-	srlz.i
-}
-	tpa r25=in0
-	movl r18=tlb_purge_done;;
-	DATA_VA_TO_PA(r18);;
-	mov b1=r18 	// Return location
-	movl r18=ia64_do_tlb_purge;;
-	DATA_VA_TO_PA(r18);;
-	mov b2=r18 	// doing tlb_flush work
-	mov ar.rsc=0  // Put RSE  in enforced lazy, LE mode
-	movl r17=1f;;
-	DATA_VA_TO_PA(r17);;
-	mov cr.iip=r17
-	movl r16=SAL_PSR_BITS_TO_SET;;
-	mov cr.ipsr=r16
-	mov cr.ifs=r0;;
-	rfi;;
-1:
-	/*
-	 * Invalidate all TLB data/inst
-	 */
-	br.sptk.many b2;; // jump to tlb purge code
-
-tlb_purge_done:
-	RESTORE_REGION_REGS(r25, r17,r18,r19);;
-	RESTORE_REG(b0, r25, r17);;
-	RESTORE_REG(b1, r25, r17);;
-	RESTORE_REG(b2, r25, r17);;
-	RESTORE_REG(b3, r25, r17);;
-	RESTORE_REG(b4, r25, r17);;
-	RESTORE_REG(b5, r25, r17);;
-	ld8 r1=[r25],0x08;;
-	ld8 r12=[r25],0x08;;
-	ld8 r13=[r25],0x08;;
-	RESTORE_REG(ar.fpsr, r25, r17);;
-	RESTORE_REG(ar.pfs, r25, r17);;
-	RESTORE_REG(ar.rnat, r25, r17);;
-	RESTORE_REG(ar.unat, r25, r17);;
-	RESTORE_REG(ar.bspstore, r25, r17);;
-	RESTORE_REG(cr.dcr, r25, r17);;
-	RESTORE_REG(cr.iva, r25, r17);;
-	RESTORE_REG(cr.pta, r25, r17);;
-#ifdef XEN
-	dv_serialize_instruction
-#endif
-	RESTORE_REG(cr.itv, r25, r17);;
-	RESTORE_REG(cr.pmv, r25, r17);;
-	RESTORE_REG(cr.cmcv, r25, r17);;
-	RESTORE_REG(cr.lrr0, r25, r17);;
-	RESTORE_REG(cr.lrr1, r25, r17);;
-	ld8 r4=[r25],0x08;;
-	ld8 r5=[r25],0x08;;
-	ld8 r6=[r25],0x08;;
-	ld8 r7=[r25],0x08;;
-	ld8 r17=[r25],0x08;;
-	mov pr=r17,-1;;
-	RESTORE_REG(ar.lc, r25, r17);;
-	/*
-	 * Now Restore floating point regs
-	 */
-	ldf.fill.nta f2=[r25],16;;
-	ldf.fill.nta f3=[r25],16;;
-	ldf.fill.nta f4=[r25],16;;
-	ldf.fill.nta f5=[r25],16;;
-	ldf.fill.nta f16=[r25],16;;
-	ldf.fill.nta f17=[r25],16;;
-	ldf.fill.nta f18=[r25],16;;
-	ldf.fill.nta f19=[r25],16;;
-	ldf.fill.nta f20=[r25],16;;
-	ldf.fill.nta f21=[r25],16;;
-	ldf.fill.nta f22=[r25],16;;
-	ldf.fill.nta f23=[r25],16;;
-	ldf.fill.nta f24=[r25],16;;
-	ldf.fill.nta f25=[r25],16;;
-	ldf.fill.nta f26=[r25],16;;
-	ldf.fill.nta f27=[r25],16;;
-	ldf.fill.nta f28=[r25],16;;
-	ldf.fill.nta f29=[r25],16;;
-	ldf.fill.nta f30=[r25],16;;
-	ldf.fill.nta f31=[r25],16;;
-
-	/*
-	 * Now that we have done all the register restores
-	 * we are now ready for the big DIVE to SAL Land
-	 */
-	ssm psr.ic;;
-	srlz.d;;
-	br.ret.sptk.many b0;;
-END(ia64_jump_to_sal)
-#endif /* CONFIG_HOTPLUG_CPU */
-
-#endif /* CONFIG_SMP */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/hpsim_ssc.h
--- a/xen/arch/ia64/linux-xen/hpsim_ssc.h	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Platform dependent support for HP simulator.
- *
- * Copyright (C) 1998, 1999 Hewlett-Packard Co
- * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999 Vijay Chander <vijay@engr.sgi.com>
- */
-#ifndef _IA64_PLATFORM_HPSIM_SSC_H
-#define _IA64_PLATFORM_HPSIM_SSC_H
-
-/* Simulator system calls: */
-
-#define SSC_CONSOLE_INIT		20
-#define SSC_GETCHAR			21
-#define SSC_PUTCHAR			31
-#define SSC_CONNECT_INTERRUPT		58
-#define SSC_GENERATE_INTERRUPT		59
-#define SSC_SET_PERIODIC_INTERRUPT	60
-#define SSC_GET_RTC			65
-#define SSC_EXIT			66
-#define SSC_LOAD_SYMBOLS		69
-#define SSC_GET_TOD			74
-#define SSC_CTL_TRACE			76
-
-#define SSC_NETDEV_PROBE		100
-#define SSC_NETDEV_SEND			101
-#define SSC_NETDEV_RECV			102
-#define SSC_NETDEV_ATTACH		103
-#define SSC_NETDEV_DETACH		104
-
-/*
- * Simulator system call.
- */
-extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr);
-
-#ifdef XEN
-/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong
- * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */
-#define SSC_OPEN			50
-#define SSC_CLOSE			51
-#define SSC_READ			52
-#define SSC_WRITE			53
-#define SSC_GET_COMPLETION		54
-#define SSC_WAIT_COMPLETION		55
-
-#define SSC_WRITE_ACCESS		2
-#define SSC_READ_ACCESS			1
-
-struct ssc_disk_req {
-	unsigned long addr;
-	unsigned long len;
-};
-#endif
-
-#endif /* _IA64_PLATFORM_HPSIM_SSC_H */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1288 +0,0 @@
-/*
- * I/O SAPIC support.
- *
- * Copyright (C) 1999 Intel Corp.
- * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
- * Copyright (C) 2000-2002 J.I. Lee <jung-ik.lee@intel.com>
- * Copyright (C) 1999-2000, 2002-2003 Hewlett-Packard Co.
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999,2000 Walt Drummond <drummond@valinux.com>
- *
- * 00/04/19	D. Mosberger	Rewritten to mirror more closely the x86 I/O APIC code.
- *				In particular, we now have separate handlers for edge
- *				and level triggered interrupts.
- * 00/10/27	Asit Mallick, Goutham Rao <goutham.rao@intel.com> IRQ vector allocation
- *				PCI to vector mapping, shared PCI interrupts.
- * 00/10/27	D. Mosberger	Document things a bit more to make them more understandable.
- *				Clean up much of the old IOSAPIC cruft.
- * 01/07/27	J.I. Lee	PCI irq routing, Platform/Legacy interrupts and fixes for
- *				ACPI S5(SoftOff) support.
- * 02/01/23	J.I. Lee	iosapic pgm fixes for PCI irq routing from _PRT
- * 02/01/07     E. Focht        <efocht@ess.nec.de> Redirectable interrupt vectors in
- *                              iosapic_set_affinity(), initializations for
- *                              /proc/irq/#/smp_affinity
- * 02/04/02	P. Diefenbaugh	Cleaned up ACPI PCI IRQ routing.
- * 02/04/18	J.I. Lee	bug fix in iosapic_init_pci_irq
- * 02/04/30	J.I. Lee	bug fix in find_iosapic to fix ACPI PCI IRQ to IOSAPIC mapping
- *				error
- * 02/07/29	T. Kochi	Allocate interrupt vectors dynamically
- * 02/08/04	T. Kochi	Cleaned up terminology (irq, global system interrupt, vector, etc.)
- * 02/09/20	D. Mosberger	Simplified by taking advantage of ACPI's pci_irq code.
- * 03/02/19	B. Helgaas	Make pcat_compat system-wide, not per-IOSAPIC.
- *				Remove iosapic_address & gsi_base from external interfaces.
- *				Rationalize __init/__devinit attributes.
- * 04/12/04 Ashok Raj	<ashok.raj@intel.com> Intel Corporation 2004
- *				Updated to work with irq migration necessary for CPU Hotplug
- */
-/*
- * Here is what the interrupt logic between a PCI device and the kernel looks like:
- *
- * (1) A PCI device raises one of the four interrupt pins (INTA, INTB, INTC, INTD).  The
- *     device is uniquely identified by its bus--, and slot-number (the function
- *     number does not matter here because all functions share the same interrupt
- *     lines).
- *
- * (2) The motherboard routes the interrupt line to a pin on a IOSAPIC controller.
- *     Multiple interrupt lines may have to share the same IOSAPIC pin (if they're level
- *     triggered and use the same polarity).  Each interrupt line has a unique Global
- *     System Interrupt (GSI) number which can be calculated as the sum of the controller's
- *     base GSI number and the IOSAPIC pin number to which the line connects.
- *
- * (3) The IOSAPIC uses an internal routing table entries (RTEs) to map the IOSAPIC pin
- *     into the IA-64 interrupt vector.  This interrupt vector is then sent to the CPU.
- *
- * (4) The kernel recognizes an interrupt as an IRQ.  The IRQ interface is used as
- *     architecture-independent interrupt handling mechanism in Linux.  As an
- *     IRQ is a number, we have to have IA-64 interrupt vector number <-> IRQ number
- *     mapping.  On smaller systems, we use one-to-one mapping between IA-64 vector and
- *     IRQ.  A platform can implement platform_irq_to_vector(irq) and
- *     platform_local_vector_to_irq(vector) APIs to differentiate the mapping.
- *     Please see also include/asm-ia64/hw_irq.h for those APIs.
- *
- * To sum up, there are three levels of mappings involved:
- *
- *	PCI pin -> global system interrupt (GSI) -> IA-64 vector <-> IRQ
- *
- * Note: The term "IRQ" is loosely used everywhere in Linux kernel to describe interrupts.
- * Now we use "IRQ" only for Linux IRQ's.  ISA IRQ (isa_irq) is the only exception in this
- * source code.
- */
-#include <linux/config.h>
-
-#include <linux/acpi.h>
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/pci.h>
-#ifdef XEN
-#include <xen/errno.h>
-#endif
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/string.h>
-#include <linux/bootmem.h>
-
-#include <asm/delay.h>
-#include <asm/hw_irq.h>
-#include <asm/io.h>
-#include <asm/iosapic.h>
-#include <asm/machvec.h>
-#include <asm/processor.h>
-#include <asm/ptrace.h>
-#include <asm/system.h>
-
-#ifdef XEN
-static inline int iosapic_irq_to_vector (int irq)
-{
-	return irq;
-}
-
-#undef irq_to_vector
-#define irq_to_vector(irq)      iosapic_irq_to_vector(irq)
-#define AUTO_ASSIGN	AUTO_ASSIGN_IRQ
-#endif
-
-#undef DEBUG_INTERRUPT_ROUTING
-
-#ifdef DEBUG_INTERRUPT_ROUTING
-#define DBG(fmt...)	printk(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-#define NR_PREALLOCATE_RTE_ENTRIES	(PAGE_SIZE / sizeof(struct iosapic_rte_info))
-#define RTE_PREALLOCATED	(1)
-
-static DEFINE_SPINLOCK(iosapic_lock);
-
-/* These tables map IA-64 vectors to the IOSAPIC pin that generates this vector. */
-
-struct iosapic_rte_info {
-	struct list_head rte_list;	/* node in list of RTEs sharing the same vector */
-	char __iomem	*addr;		/* base address of IOSAPIC */
-	unsigned int	gsi_base;	/* first GSI assigned to this IOSAPIC */
-	char		rte_index;	/* IOSAPIC RTE index */
-	int		refcnt;		/* reference counter */
-	unsigned int	flags;		/* flags */
-} ____cacheline_aligned;
-
-static struct iosapic_intr_info {
-	struct list_head rtes;		/* RTEs using this vector (empty => not an IOSAPIC interrupt) */
-	int		count;		/* # of RTEs that shares this vector */
-	u32		low32;		/* current value of low word of Redirection table entry */
-	unsigned int	dest;		/* destination CPU physical ID */
-	unsigned char	dmode	: 3;	/* delivery mode (see iosapic.h) */
-	unsigned char 	polarity: 1;	/* interrupt polarity (see iosapic.h) */
-	unsigned char	trigger	: 1;	/* trigger mode (see iosapic.h) */
-} iosapic_intr_info[IA64_NUM_VECTORS];
-
-#ifndef XEN
-static struct iosapic {
-	char __iomem	*addr;		/* base address of IOSAPIC */
-	unsigned int 	gsi_base;	/* first GSI assigned to this IOSAPIC */
-	unsigned short 	num_rte;	/* number of RTE in this IOSAPIC */
-	int		rtes_inuse;	/* # of RTEs in use on this IOSAPIC */
-#ifdef CONFIG_NUMA
-	unsigned short	node;		/* numa node association via pxm */
-#endif
-} iosapic_lists[NR_IOSAPICS];
-#else
-struct iosapic iosapic_lists[NR_IOSAPICS];
-#endif
-
-static unsigned char pcat_compat __devinitdata;	/* 8259 compatibility flag */
-
-static int iosapic_kmalloc_ok;
-static LIST_HEAD(free_rte_list);
-
-/*
- * Find an IOSAPIC associated with a GSI
- */
-static inline int
-find_iosapic (unsigned int gsi)
-{
-	int i;
-
-	for (i = 0; i < NR_IOSAPICS; i++) {
-		if ((unsigned) (gsi - iosapic_lists[i].gsi_base) < iosapic_lists[i].num_rte)
-			return i;
-	}
-
-	return -1;
-}
-
-static inline int
-_gsi_to_vector (unsigned int gsi)
-{
-	struct iosapic_intr_info *info;
-	struct iosapic_rte_info *rte;
-
-	for (info = iosapic_intr_info; info < iosapic_intr_info + IA64_NUM_VECTORS; ++info)
-		list_for_each_entry(rte, &info->rtes, rte_list)
-			if (rte->gsi_base + rte->rte_index == gsi)
-				return info - iosapic_intr_info;
-	return -1;
-}
-
-/*
- * Translate GSI number to the corresponding IA-64 interrupt vector.  If no
- * entry exists, return -1.
- */
-inline int
-gsi_to_vector (unsigned int gsi)
-{
-	return _gsi_to_vector(gsi);
-}
-
-int
-gsi_to_irq (unsigned int gsi)
-{
-	unsigned long flags;
-	int irq;
-	/*
-	 * XXX fix me: this assumes an identity mapping vetween IA-64 vector and Linux irq
-	 * numbers...
-	 */
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		irq = _gsi_to_vector(gsi);
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	return irq;
-}
-
-static struct iosapic_rte_info *gsi_vector_to_rte(unsigned int gsi, unsigned int vec)
-{
-	struct iosapic_rte_info *rte;
-
-	list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list)
-		if (rte->gsi_base + rte->rte_index == gsi)
-			return rte;
-	return NULL;
-}
-
-static void
-set_rte (unsigned int gsi, unsigned int vector, unsigned int dest, int mask)
-{
-	unsigned long pol, trigger, dmode;
-	u32 low32, high32;
-	char __iomem *addr;
-	int rte_index;
-	char redir;
-	struct iosapic_rte_info *rte;
-
-	DBG(KERN_DEBUG"IOSAPIC: routing vector %d to 0x%x\n", vector, dest);
-
-	rte = gsi_vector_to_rte(gsi, vector);
-	if (!rte)
-		return;		/* not an IOSAPIC interrupt */
-
-	rte_index = rte->rte_index;
-	addr	= rte->addr;
-	pol     = iosapic_intr_info[vector].polarity;
-	trigger = iosapic_intr_info[vector].trigger;
-	dmode   = iosapic_intr_info[vector].dmode;
-
-	redir = (dmode == IOSAPIC_LOWEST_PRIORITY) ? 1 : 0;
-
-#ifdef CONFIG_SMP
-	{
-		unsigned int irq;
-
-		for (irq = 0; irq < NR_IRQS; ++irq)
-			if (irq_to_vector(irq) == vector) {
-				set_irq_affinity_info(irq, (int)(dest & 0xffff), redir);
-				break;
-			}
-	}
-#endif
-
-	low32 = ((pol << IOSAPIC_POLARITY_SHIFT) |
-		 (trigger << IOSAPIC_TRIGGER_SHIFT) |
-		 (dmode << IOSAPIC_DELIVERY_SHIFT) |
-		 ((mask ? 1 : 0) << IOSAPIC_MASK_SHIFT) |
-		 vector);
-
-	/* dest contains both id and eid */
-	high32 = (dest << IOSAPIC_DEST_SHIFT);
-
-	iosapic_write(addr, IOSAPIC_RTE_HIGH(rte_index), high32);
-	iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-	iosapic_intr_info[vector].low32 = low32;
-	iosapic_intr_info[vector].dest = dest;
-}
-
-void
-kexec_disable_iosapic(void)
-{
-        struct iosapic_intr_info *info;
-        struct iosapic_rte_info *rte;
-        u8 vec = 0;
-        for (info = iosapic_intr_info; info <
-                        iosapic_intr_info + IA64_NUM_VECTORS; ++info, ++vec) {
-                list_for_each_entry(rte, &info->rtes,
-                                rte_list) {
-                        iosapic_write(rte->addr,
-                                        IOSAPIC_RTE_LOW(rte->rte_index),
-                                        IOSAPIC_MASK|vec);
-                        iosapic_eoi(rte->addr, vec);
-                }
-        }
-}
-
-static void
-mask_irq (struct irq_desc *desc)
-{
-	unsigned long flags;
-	char __iomem *addr;
-	u32 low32;
-	int rte_index;
-	ia64_vector vec = irq_to_vector(desc->irq);
-	struct iosapic_rte_info *rte;
-
-	if (list_empty(&iosapic_intr_info[vec].rtes))
-		return;			/* not an IOSAPIC interrupt! */
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		/* set only the mask bit */
-		low32 = iosapic_intr_info[vec].low32 |= IOSAPIC_MASK;
-		list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) {
-			addr = rte->addr;
-			rte_index = rte->rte_index;
-			iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-}
-
-static void
-unmask_irq (struct irq_desc *desc)
-{
-	unsigned long flags;
-	char __iomem *addr;
-	u32 low32;
-	int rte_index;
-	ia64_vector vec = irq_to_vector(desc->irq);
-	struct iosapic_rte_info *rte;
-
-	if (list_empty(&iosapic_intr_info[vec].rtes))
-		return;			/* not an IOSAPIC interrupt! */
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		low32 = iosapic_intr_info[vec].low32 &= ~IOSAPIC_MASK;
-		list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) {
-			addr = rte->addr;
-			rte_index = rte->rte_index;
-			iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-}
-
-
-static void
-iosapic_set_affinity (struct irq_desc *desc, const cpumask_t *mask)
-{
-#ifdef CONFIG_SMP
-	unsigned long flags;
-	u32 high32, low32;
-	int dest, rte_index;
-	char __iomem *addr;
-	int redir = (desc->irq & IA64_IRQ_REDIRECTED) ? 1 : 0;
-	unsigned int irq = desc->irq & ~IA64_IRQ_REDIRECTED;
-	ia64_vector vec;
-	struct iosapic_rte_info *rte;
-
-	vec = irq_to_vector(irq);
-
-	if (cpumask_empty(mask))
-		return;
-
-	dest = cpu_physical_id(cpumask_first(mask));
-
-	if (list_empty(&iosapic_intr_info[vec].rtes))
-		return;			/* not an IOSAPIC interrupt */
-
-	set_irq_affinity_info(irq, dest, redir);
-
-	/* dest contains both id and eid */
-	high32 = dest << IOSAPIC_DEST_SHIFT;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		low32 = iosapic_intr_info[vec].low32 & ~(7 << IOSAPIC_DELIVERY_SHIFT);
-
-		if (redir)
-		        /* change delivery mode to lowest priority */
-			low32 |= (IOSAPIC_LOWEST_PRIORITY << IOSAPIC_DELIVERY_SHIFT);
-		else
-		        /* change delivery mode to fixed */
-			low32 |= (IOSAPIC_FIXED << IOSAPIC_DELIVERY_SHIFT);
-
-		iosapic_intr_info[vec].low32 = low32;
-		iosapic_intr_info[vec].dest = dest;
-		list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list) {
-			addr = rte->addr;
-			rte_index = rte->rte_index;
-			iosapic_write(addr, IOSAPIC_RTE_HIGH(rte_index), high32);
-			iosapic_write(addr, IOSAPIC_RTE_LOW(rte_index), low32);
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-#endif
-}
-
-/*
- * Handlers for level-triggered interrupts.
- */
-
-static unsigned int
-iosapic_startup_level_irq (struct irq_desc *desc)
-{
-	unmask_irq(desc);
-	return 0;
-}
-
-static void
-iosapic_end_level_irq (struct irq_desc *desc)
-{
-	ia64_vector vec = irq_to_vector(desc->irq);
-	struct iosapic_rte_info *rte;
-
-	move_irq(desc->irq);
-	list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list)
-		iosapic_eoi(rte->addr, vec);
-}
-
-#define iosapic_shutdown_level_irq	mask_irq
-#define iosapic_enable_level_irq	unmask_irq
-#define iosapic_disable_level_irq	mask_irq
-#define iosapic_ack_level_irq		irq_actor_none
-
-static hw_irq_controller irq_type_iosapic_level = {
-	.typename =	"IO-SAPIC-level",
-	.startup =	iosapic_startup_level_irq,
-	.shutdown =	iosapic_shutdown_level_irq,
-	.enable =	iosapic_enable_level_irq,
-	.disable =	iosapic_disable_level_irq,
-	.ack =		iosapic_ack_level_irq,
-	.end =		iosapic_end_level_irq,
-	.set_affinity =	iosapic_set_affinity
-};
-
-/*
- * Handlers for edge-triggered interrupts.
- */
-
-static unsigned int
-iosapic_startup_edge_irq (struct irq_desc *desc)
-{
-	unmask_irq(desc);
-	/*
-	 * IOSAPIC simply drops interrupts pended while the
-	 * corresponding pin was masked, so we can't know if an
-	 * interrupt is pending already.  Let's hope not...
-	 */
-	return 0;
-}
-
-static void
-iosapic_ack_edge_irq (struct irq_desc *desc)
-{
-	move_irq(idesc->irq);
-	/*
-	 * Once we have recorded IRQ_PENDING already, we can mask the
-	 * interrupt for real. This prevents IRQ storms from unhandled
-	 * devices.
-	 */
-	if ((desc->status & (IRQ_PENDING|IRQ_DISABLED)) == (IRQ_PENDING|IRQ_DISABLED))
-		mask_irq(desc);
-}
-
-#define iosapic_enable_edge_irq		unmask_irq
-#define iosapic_disable_edge_irq	irq_disable_none
-#define iosapic_end_edge_irq		irq_actor_none
-
-static hw_irq_controller irq_type_iosapic_edge = {
-	.typename =	"IO-SAPIC-edge",
-	.startup =	iosapic_startup_edge_irq,
-	.shutdown =	iosapic_disable_edge_irq,
-	.enable =	iosapic_enable_edge_irq,
-	.disable =	iosapic_disable_edge_irq,
-	.ack =		iosapic_ack_edge_irq,
-	.end =		iosapic_end_edge_irq,
-	.set_affinity =	iosapic_set_affinity
-};
-
-unsigned int
-iosapic_version (char __iomem *addr)
-{
-	/*
-	 * IOSAPIC Version Register return 32 bit structure like:
-	 * {
-	 *	unsigned int version   : 8;
-	 *	unsigned int reserved1 : 8;
-	 *	unsigned int max_redir : 8;
-	 *	unsigned int reserved2 : 8;
-	 * }
-	 */
-	return iosapic_read(addr, IOSAPIC_VERSION);
-}
-
-static int iosapic_find_sharable_vector (unsigned long trigger, unsigned long pol)
-{
-	int i, vector = -1, min_count = -1;
-	struct iosapic_intr_info *info;
-
-	/*
-	 * shared vectors for edge-triggered interrupts are not
-	 * supported yet
-	 */
-	if (trigger == IOSAPIC_EDGE)
-		return -1;
-
-	for (i = IA64_FIRST_DEVICE_VECTOR; i <= IA64_LAST_DEVICE_VECTOR; i++) {
-		info = &iosapic_intr_info[i];
-		if (info->trigger == trigger && info->polarity == pol &&
-		    (info->dmode == IOSAPIC_FIXED || info->dmode == IOSAPIC_LOWEST_PRIORITY)) {
-			if (min_count == -1 || info->count < min_count) {
-				vector = i;
-				min_count = info->count;
-			}
-		}
-	}
-
-	return vector;
-}
-
-/*
- * if the given vector is already owned by other,
- *  assign a new vector for the other and make the vector available
- */
-static void __init
-iosapic_reassign_vector (int vector)
-{
-	int new_vector;
-
-	if (!list_empty(&iosapic_intr_info[vector].rtes)) {
-		new_vector = assign_irq_vector(AUTO_ASSIGN);
-		if (new_vector < 0)
-			panic("%s: out of interrupt vectors!\n", __FUNCTION__);
-		printk(KERN_INFO "Reassigning vector %d to %d\n", vector, new_vector);
-		memcpy(&iosapic_intr_info[new_vector], &iosapic_intr_info[vector],
-		       sizeof(struct iosapic_intr_info));
-		INIT_LIST_HEAD(&iosapic_intr_info[new_vector].rtes);
-		list_move(iosapic_intr_info[vector].rtes.next, &iosapic_intr_info[new_vector].rtes);
-		memset(&iosapic_intr_info[vector], 0, sizeof(struct iosapic_intr_info));
-		iosapic_intr_info[vector].low32 = IOSAPIC_MASK;
-		INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes);
-	}
-}
-
-static struct iosapic_rte_info *iosapic_alloc_rte (void)
-{
-	int i;
-	struct iosapic_rte_info *rte;
-	int preallocated = 0;
-
-	if (!iosapic_kmalloc_ok && list_empty(&free_rte_list)) {
-#ifdef XEN
-		rte = xmalloc_bytes(sizeof(struct iosapic_rte_info) * NR_PREALLOCATE_RTE_ENTRIES);
-#else
-		rte = alloc_bootmem(sizeof(struct iosapic_rte_info) * NR_PREALLOCATE_RTE_ENTRIES);
-#endif
-		if (!rte)
-			return NULL;
-		for (i = 0; i < NR_PREALLOCATE_RTE_ENTRIES; i++, rte++)
-			list_add(&rte->rte_list, &free_rte_list);
-	}
-
-	if (!list_empty(&free_rte_list)) {
-		rte = list_entry(free_rte_list.next, struct iosapic_rte_info, rte_list);
-		list_del(&rte->rte_list);
-		preallocated++;
-	} else {
-		rte = kmalloc(sizeof(struct iosapic_rte_info), GFP_ATOMIC);
-		if (!rte)
-			return NULL;
-	}
-
-	memset(rte, 0, sizeof(struct iosapic_rte_info));
-	if (preallocated)
-		rte->flags |= RTE_PREALLOCATED;
-
-	return rte;
-}
-
-static void iosapic_free_rte (struct iosapic_rte_info *rte)
-{
-	if (rte->flags & RTE_PREALLOCATED)
-		list_add_tail(&rte->rte_list, &free_rte_list);
-	else
-		kfree(rte);
-}
-
-static inline int vector_is_shared (int vector)
-{
-	return (iosapic_intr_info[vector].count > 1);
-}
-
-static int
-register_intr (unsigned int gsi, int vector, unsigned char delivery,
-	       unsigned long polarity, unsigned long trigger)
-{
-	irq_desc_t *idesc;
-	hw_irq_controller *irq_type;
-	int rte_index;
-	int index;
-	unsigned long gsi_base;
-	void __iomem *iosapic_address;
-	struct iosapic_rte_info *rte;
-
-	index = find_iosapic(gsi);
-	if (index < 0) {
-		printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi);
-		return -ENODEV;
-	}
-
-	iosapic_address = iosapic_lists[index].addr;
-	gsi_base = iosapic_lists[index].gsi_base;
-
-	rte = gsi_vector_to_rte(gsi, vector);
-	if (!rte) {
-		rte = iosapic_alloc_rte();
-		if (!rte) {
-			printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__);
-			return -ENOMEM;
-		}
-
-		rte_index = gsi - gsi_base;
-		rte->rte_index	= rte_index;
-		rte->addr	= iosapic_address;
-		rte->gsi_base	= gsi_base;
-		rte->refcnt++;
-		list_add_tail(&rte->rte_list, &iosapic_intr_info[vector].rtes);
-		iosapic_intr_info[vector].count++;
-		iosapic_lists[index].rtes_inuse++;
-	}
-	else if (vector_is_shared(vector)) {
-		struct iosapic_intr_info *info = &iosapic_intr_info[vector];
-		if (info->trigger != trigger || info->polarity != polarity) {
-			printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__);
-			return -EINVAL;
-		}
-	}
-
-	iosapic_intr_info[vector].polarity = polarity;
-	iosapic_intr_info[vector].dmode    = delivery;
-	iosapic_intr_info[vector].trigger  = trigger;
-
-	if (trigger == IOSAPIC_EDGE)
-		irq_type = &irq_type_iosapic_edge;
-	else
-		irq_type = &irq_type_iosapic_level;
-
-	idesc = irq_descp(vector);
-	if (idesc->handler != irq_type) {
-		if (idesc->handler != &no_irq_type)
-			printk(KERN_WARNING "%s: changing vector %d from %s to %s\n",
-			       __FUNCTION__, vector, idesc->handler->typename, irq_type->typename);
-		idesc->handler = irq_type;
-	}
-	return 0;
-}
-
-static unsigned int
-get_target_cpu (unsigned int gsi, int vector)
-{
-#ifdef CONFIG_SMP
-	static int cpu = -1;
-
-	/*
-	 * In case of vector shared by multiple RTEs, all RTEs that
-	 * share the vector need to use the same destination CPU.
-	 */
-	if (!list_empty(&iosapic_intr_info[vector].rtes))
-		return iosapic_intr_info[vector].dest;
-
-	/*
-	 * If the platform supports redirection via XTP, let it
-	 * distribute interrupts.
-	 */
-	if (smp_int_redirect & SMP_IRQ_REDIRECTION)
-		return cpu_physical_id(smp_processor_id());
-
-	/*
-	 * Some interrupts (ACPI SCI, for instance) are registered
-	 * before the BSP is marked as online.
-	 */
-	if (!cpu_online(smp_processor_id()))
-		return cpu_physical_id(smp_processor_id());
-
-#ifdef CONFIG_NUMA
-	{
-		int num_cpus, cpu_index, iosapic_index, numa_cpu, i = 0;
-		cpumask_t cpu_mask;
-
-		iosapic_index = find_iosapic(gsi);
-		if (iosapic_index < 0 ||
-		    iosapic_lists[iosapic_index].node == MAX_NUMNODES)
-			goto skip_numa_setup;
-
-		cpu_mask = node_to_cpumask(iosapic_lists[iosapic_index].node);
-
-		for_each_cpu(numa_cpu, &cpu_mask) {
-			if (!cpu_online(numa_cpu))
-				cpumask_clear_cpu(numa_cpu, &cpu_mask);
-		}
-
-		num_cpus = cpumask_weight(&cpu_mask);
-
-		if (!num_cpus)
-			goto skip_numa_setup;
-
-		/* Use vector assigment to distribute across cpus in node */
-		cpu_index = vector % num_cpus;
-
-		for (numa_cpu = cpumask_first(&cpu_mask) ; i < cpu_index ; i++)
-			numa_cpu = cpumask_next(numa_cpu, &cpu_mask);
-
-		if (numa_cpu != NR_CPUS)
-			return cpu_physical_id(numa_cpu);
-	}
-skip_numa_setup:
-#endif
-	/*
-	 * Otherwise, round-robin interrupt vectors across all the
-	 * processors.  (It'd be nice if we could be smarter in the
-	 * case of NUMA.)
-	 */
-	do {
-		if (++cpu >= NR_CPUS)
-			cpu = 0;
-	} while (!cpu_online(cpu));
-
-	return cpu_physical_id(cpu);
-#else
-	return cpu_physical_id(smp_processor_id());
-#endif
-}
-
-/*
- * ACPI can describe IOSAPIC interrupts via static tables and namespace
- * methods.  This provides an interface to register those interrupts and
- * program the IOSAPIC RTE.
- */
-int
-iosapic_register_intr (unsigned int gsi,
-		       unsigned long polarity, unsigned long trigger)
-{
-	int vector, mask = 1, err;
-	unsigned int dest;
-	unsigned long flags;
-	struct iosapic_rte_info *rte;
-	u32 low32;
-again:
-	/*
-	 * If this GSI has already been registered (i.e., it's a
-	 * shared interrupt, or we lost a race to register it),
-	 * don't touch the RTE.
-	 */
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		vector = gsi_to_vector(gsi);
-		if (vector > 0) {
-			rte = gsi_vector_to_rte(gsi, vector);
-			rte->refcnt++;
-			spin_unlock_irqrestore(&iosapic_lock, flags);
-			return vector;
-		}
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	/* If vector is running out, we try to find a sharable vector */
-	vector = assign_irq_vector(AUTO_ASSIGN);
-	if (vector < 0) {
-		vector = iosapic_find_sharable_vector(trigger, polarity);
-  		if (vector < 0)
-			return -ENOSPC;
-	}
-
-	spin_lock_irqsave(&irq_descp(vector)->lock, flags);
-	spin_lock(&iosapic_lock);
-	{
-		if (gsi_to_vector(gsi) > 0) {
-			if (list_empty(&iosapic_intr_info[vector].rtes))
-				free_irq_vector(vector);
-			spin_unlock(&iosapic_lock);
-			spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
-			goto again;
-		}
-
-		dest = get_target_cpu(gsi, vector);
-		err = register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
-			      polarity, trigger);
-		if (err < 0) {
-			spin_unlock(&iosapic_lock);
-			spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
-			return err;
-		}
-
-		/*
-		 * If the vector is shared and already unmasked for
-		 * other interrupt sources, don't mask it.
-		 */
-		low32 = iosapic_intr_info[vector].low32;
-		if (vector_is_shared(vector) && !(low32 & IOSAPIC_MASK))
-			mask = 0;
-		set_rte(gsi, vector, dest, mask);
-	}
-	spin_unlock(&iosapic_lock);
-	spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
-
-	printk(KERN_INFO "GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d\n",
-	       gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"),
-	       (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
-	       cpu_logical_id(dest), dest, vector);
-
-	return vector;
-}
-
-void
-iosapic_unregister_intr (unsigned int gsi)
-{
-	unsigned long flags;
-	int irq, vector, index;
-	irq_desc_t *idesc;
-	u32 low32;
-	unsigned long trigger, polarity;
-	unsigned int dest;
-	struct iosapic_rte_info *rte;
-
-	/*
-	 * If the irq associated with the gsi is not found,
-	 * iosapic_unregister_intr() is unbalanced. We need to check
-	 * this again after getting locks.
-	 */
-	irq = gsi_to_irq(gsi);
-	if (irq < 0) {
-		printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n", gsi);
-		WARN_ON(1);
-		return;
-	}
-	vector = irq_to_vector(irq);
-
-	idesc = irq_descp(irq);
-	spin_lock_irqsave(&idesc->lock, flags);
-	spin_lock(&iosapic_lock);
-	{
-		if ((rte = gsi_vector_to_rte(gsi, vector)) == NULL) {
-			printk(KERN_ERR "iosapic_unregister_intr(%u) unbalanced\n", gsi);
-			WARN_ON(1);
-			goto out;
-		}
-
-		if (--rte->refcnt > 0)
-			goto out;
-
-		/* Mask the interrupt */
-		low32 = iosapic_intr_info[vector].low32 | IOSAPIC_MASK;
-		iosapic_write(rte->addr, IOSAPIC_RTE_LOW(rte->rte_index), low32);
-
-		/* Remove the rte entry from the list */
-		list_del(&rte->rte_list);
-		iosapic_intr_info[vector].count--;
-		iosapic_free_rte(rte);
-		index = find_iosapic(gsi);
-		iosapic_lists[index].rtes_inuse--;
-		WARN_ON(iosapic_lists[index].rtes_inuse < 0);
-
-		trigger	 = iosapic_intr_info[vector].trigger;
-		polarity = iosapic_intr_info[vector].polarity;
-		dest     = iosapic_intr_info[vector].dest;
-		printk(KERN_INFO "GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d unregistered\n",
-		       gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"),
-		       (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
-		       cpu_logical_id(dest), dest, vector);
-
-		if (list_empty(&iosapic_intr_info[vector].rtes)) {
-			/* Sanity check */
-			BUG_ON(iosapic_intr_info[vector].count);
-
-			/* Clear the interrupt controller descriptor */
-			idesc->handler = &no_irq_type;
-
-			/* Clear the interrupt information */
-			memset(&iosapic_intr_info[vector], 0, sizeof(struct iosapic_intr_info));
-			iosapic_intr_info[vector].low32 |= IOSAPIC_MASK;
-			INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes);
-
-			if (idesc->action) {
-				printk(KERN_ERR "interrupt handlers still exist on IRQ %u\n", irq);
-				WARN_ON(1);
-			}
-
-			/* Free the interrupt vector */
-			free_irq_vector(vector);
-		}
-	}
- out:
-	spin_unlock(&iosapic_lock);
-	spin_unlock_irqrestore(&idesc->lock, flags);
-}
-
-/*
- * ACPI calls this when it finds an entry for a platform interrupt.
- * Note that the irq_base and IOSAPIC address must be set in iosapic_init().
- */
-int __init
-iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
-				int iosapic_vector, u16 eid, u16 id,
-				unsigned long polarity, unsigned long trigger)
-{
-	static const char * const name[] = {"unknown", "PMI", "INIT", "CPEI"};
-	unsigned char delivery;
-	int vector, mask = 0;
-	unsigned int dest = ((id << 8) | eid) & 0xffff;
-
-	switch (int_type) {
-	      case ACPI_INTERRUPT_PMI:
-		vector = iosapic_vector;
-		/*
-		 * since PMI vector is alloc'd by FW(ACPI) not by kernel,
-		 * we need to make sure the vector is available
-		 */
-		iosapic_reassign_vector(vector);
-		delivery = IOSAPIC_PMI;
-		break;
-	      case ACPI_INTERRUPT_INIT:
-		vector = assign_irq_vector(AUTO_ASSIGN);
-		if (vector < 0)
-			panic("%s: out of interrupt vectors!\n", __FUNCTION__);
-		delivery = IOSAPIC_INIT;
-		break;
-	      case ACPI_INTERRUPT_CPEI:
-		vector = IA64_CPE_VECTOR;
-		delivery = IOSAPIC_LOWEST_PRIORITY;
-		mask = 1;
-		break;
-	      default:
-		printk(KERN_ERR "iosapic_register_platform_irq(): invalid int type 0x%x\n", int_type);
-		return -1;
-	}
-
-	register_intr(gsi, vector, delivery, polarity, trigger);
-
-	printk(KERN_INFO "PLATFORM int %s (0x%x): GSI %u (%s, %s) -> CPU %d (0x%04x) vector %d\n",
-	       int_type < ARRAY_SIZE(name) ? name[int_type] : "unknown",
-	       int_type, gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"),
-	       (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
-	       cpu_logical_id(dest), dest, vector);
-
-	set_rte(gsi, vector, dest, mask);
-	return vector;
-}
-
-
-/*
- * ACPI calls this when it finds an entry for a legacy ISA IRQ override.
- * Note that the gsi_base and IOSAPIC address must be set in iosapic_init().
- */
-void __init
-iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
-			  unsigned long polarity,
-			  unsigned long trigger)
-{
-	int vector;
-	unsigned int dest = cpu_physical_id(smp_processor_id());
-
-	vector = isa_irq_to_vector(isa_irq);
-
-	register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY, polarity, trigger);
-
-	DBG("ISA: IRQ %u -> GSI %u (%s,%s) -> CPU %d (0x%04x) vector %d\n",
-	    isa_irq, gsi, trigger == IOSAPIC_EDGE ? "edge" : "level",
-	    polarity == IOSAPIC_POL_HIGH ? "high" : "low",
-	    cpu_logical_id(dest), dest, vector);
-
-	set_rte(gsi, vector, dest, 1);
-}
-
-void __init
-iosapic_system_init (int system_pcat_compat)
-{
-	int vector;
-
-	for (vector = 0; vector < IA64_NUM_VECTORS; ++vector) {
-		iosapic_intr_info[vector].low32 = IOSAPIC_MASK;
-		INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes);	/* mark as unused */
-	}
-
-	pcat_compat = system_pcat_compat;
-	if (pcat_compat) {
-		/*
-		 * Disable the compatibility mode interrupts (8259 style), needs IN/OUT support
-		 * enabled.
-		 */
-		printk(KERN_INFO "%s: Disabling PC-AT compatible 8259 interrupts\n", __FUNCTION__);
-		outb(0xff, 0xA1);
-		outb(0xff, 0x21);
-	}
-}
-
-static inline int
-iosapic_alloc (void)
-{
-	int index;
-
-	for (index = 0; index < NR_IOSAPICS; index++)
-		if (!iosapic_lists[index].addr)
-			return index;
-
-	printk(KERN_WARNING "%s: failed to allocate iosapic\n", __FUNCTION__);
-	return -1;
-}
-
-static inline void
-iosapic_free (int index)
-{
-	memset(&iosapic_lists[index], 0, sizeof(iosapic_lists[0]));
-}
-
-static inline int
-iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver)
-{
-	int index;
-	unsigned int gsi_end, base, end;
-
-	/* check gsi range */
-	gsi_end = gsi_base + ((ver >> 16) & 0xff);
-	for (index = 0; index < NR_IOSAPICS; index++) {
-		if (!iosapic_lists[index].addr)
-			continue;
-
-		base = iosapic_lists[index].gsi_base;
-		end  = base + iosapic_lists[index].num_rte - 1;
-
-		if (gsi_base < base && gsi_end < base)
-			continue;/* OK */
-
-		if (gsi_base > end && gsi_end > end)
-			continue; /* OK */
-
-		return -EBUSY;
-	}
-	return 0;
-}
-
-int __devinit
-#ifndef XEN
-iosapic_init (unsigned long phys_addr, unsigned int gsi_base)
-#else	
-iosapic_init (unsigned long phys_addr, unsigned int gsi_base, unsigned int id)
-#endif
-{
-	int num_rte, err, index;
-	unsigned int isa_irq, ver;
-	char __iomem *addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		addr = ioremap(phys_addr, 0);
-		ver = iosapic_version(addr);
-
-		if ((err = iosapic_check_gsi_range(gsi_base, ver))) {
-			iounmap(addr);
-			spin_unlock_irqrestore(&iosapic_lock, flags);
-			return err;
-		}
-
-		/*
-		 * The MAX_REDIR register holds the highest input pin
-		 * number (starting from 0).
-		 * We add 1 so that we can use it for number of pins (= RTEs)
-		 */
-		num_rte = ((ver >> 16) & 0xff) + 1;
-
-		index = iosapic_alloc();
-		iosapic_lists[index].addr = addr;
-		iosapic_lists[index].gsi_base = gsi_base;
-		iosapic_lists[index].num_rte = num_rte;
-#ifdef XEN
-		iosapic_lists[index].id = id;
-#endif
-#ifdef CONFIG_NUMA
-		iosapic_lists[index].node = MAX_NUMNODES;
-#endif
-	}
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	if ((gsi_base == 0) && pcat_compat) {
-		/*
-		 * Map the legacy ISA devices into the IOSAPIC data.  Some of these may
-		 * get reprogrammed later on with data from the ACPI Interrupt Source
-		 * Override table.
-		 */
-		for (isa_irq = 0; isa_irq < 16; ++isa_irq)
-			iosapic_override_isa_irq(isa_irq, isa_irq, IOSAPIC_POL_HIGH, IOSAPIC_EDGE);
-	}
-	return 0;
-}
-
-#ifdef CONFIG_HOTPLUG
-int
-iosapic_remove (unsigned int gsi_base)
-{
-	int index, err = 0;
-	unsigned long flags;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	{
-		index = find_iosapic(gsi_base);
-		if (index < 0) {
-			printk(KERN_WARNING "%s: No IOSAPIC for GSI base %u\n",
-			       __FUNCTION__, gsi_base);
-			goto out;
-		}
-
-		if (iosapic_lists[index].rtes_inuse) {
-			err = -EBUSY;
-			printk(KERN_WARNING "%s: IOSAPIC for GSI base %u is busy\n",
-			       __FUNCTION__, gsi_base);
-			goto out;
-		}
-
-		iounmap(iosapic_lists[index].addr);
-		iosapic_free(index);
-	}
- out:
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-	return err;
-}
-#endif /* CONFIG_HOTPLUG */
-
-#ifdef CONFIG_NUMA
-void __devinit
-map_iosapic_to_node(unsigned int gsi_base, int node)
-{
-	int index;
-
-	index = find_iosapic(gsi_base);
-	if (index < 0) {
-		printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n",
-		       __FUNCTION__, gsi_base);
-		return;
-	}
-	iosapic_lists[index].node = node;
-	return;
-}
-#endif
-
-#ifndef XEN
-static int __init iosapic_enable_kmalloc (void)
-{
-	iosapic_kmalloc_ok = 1;
-	return 0;
-}
-core_initcall (iosapic_enable_kmalloc);
-#endif
-
-#ifdef XEN
-/* nop for now */
-void set_irq_affinity_info(unsigned int irq, int hwid, int redir) {}
-
-static int iosapic_physbase_to_id(unsigned long physbase)
-{
-	int i;
-	unsigned long addr = physbase | __IA64_UNCACHED_OFFSET;
-
-	for (i = 0; i < NR_IOSAPICS; i++) {
-	    if ((unsigned long)(iosapic_lists[i].addr) == addr)
-		return i;
-	}
-
-	return -1;
-}
-
-int iosapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval)
-{
-	int id;
-	unsigned long flags;
-
-	if ((id = (iosapic_physbase_to_id(physbase))) < 0)
-	    return id;
-
-	spin_lock_irqsave(&iosapic_lock, flags);
-	*pval = iosapic_read(iosapic_lists[id].addr, reg);
-	spin_unlock_irqrestore(&iosapic_lock, flags);
-
-	return 0;
-}
-
-int iosapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
-{
-	unsigned int id, gsi, vec, xen_vec, dest, high32;
-	char rte_index;
-	struct iosapic *ios;
-	struct iosapic_intr_info *info;
-	struct rte_entry rte;
-	unsigned long flags;
-
-	if ((id = (iosapic_physbase_to_id(physbase))) < 0)
-	    return -EINVAL;
-	ios = &iosapic_lists[id];
-
-	/* Only handle first half of RTE update */
-	if ((reg < 0x10) || (reg & 1))
-	    return 0;
-
-	rte.val = val;
-	rte_index = IOSAPIC_RTEINDEX(reg);
-	vec = rte.lo.vector;
-#if 0
-	/* Take PMI/NMI/INIT/EXTINT handled by xen */ 
-	if (rte.delivery_mode > IOSAPIC_LOWEST_PRIORITY) {
-	    printk("Attempt to write IOSAPIC dest mode owned by xen!\n");
-	    printk("IOSAPIC/PIN = (%d/%d), lo = 0x%x\n",
-		id, rte_index, val);
-	    return -EINVAL;
-	}
-#endif
-
-	/* Sanity check. Vector should be allocated before this update */
-	if ((rte_index > ios->num_rte) ||
-	    ((vec > IA64_FIRST_DEVICE_VECTOR) &&
-	     (vec < IA64_LAST_DEVICE_VECTOR) &&
-	     (!test_bit(vec - IA64_FIRST_DEVICE_VECTOR, ia64_vector_mask))))
-	    return -EINVAL;
-
-	gsi = ios->gsi_base + rte_index;
-	xen_vec = gsi_to_vector(gsi);
-	if (xen_vec >= 0 && test_bit(xen_vec, ia64_xen_vector)) {
-		printk("WARN: GSI %d in use by Xen.\n", gsi);
-		return -EINVAL;
-	}
-	info = &iosapic_intr_info[vec];
-	spin_lock_irqsave(&irq_descp(vec)->lock, flags);
-	spin_lock(&iosapic_lock);
-	if (!gsi_vector_to_rte(gsi, vec)) {
-	    register_intr(gsi, vec, IOSAPIC_LOWEST_PRIORITY,
-		rte.lo.polarity, rte.lo.trigger);
-	} else if (vector_is_shared(vec)) {
-	    if ((info->trigger != rte.lo.trigger) ||
-		(info->polarity != rte.lo.polarity)) {
-		printk("WARN: can't override shared interrupt vec\n");
-	        printk("IOSAPIC/PIN = (%d/%d), ori = 0x%x, new = 0x%x\n",
-			id, rte_index, info->low32, rte.val);
-		spin_unlock(&iosapic_lock);
-		spin_unlock_irqrestore(&irq_descp(vec)->lock, flags);
-		return -EINVAL;
-	    }
-
-	    /* If the vector is shared and already unmasked for other
-	     * interrupt sources, don't mask it.
-	     *
-	     * Same check may also apply to single gsi pin, which may
-	     * be shared by devices belonging to different domain. But
-	     * let's see how to act later on demand.
-	     */
-	    if (!(info->low32 & IOSAPIC_MASK))
-		rte.lo.mask = 0;
-	}
-
-	/* time to update physical RTE */
-	dest = cpu_physical_id(smp_processor_id());
-	high32 = (dest << IOSAPIC_DEST_SHIFT);
-	iosapic_write(iosapic_lists[id].addr, reg + 1, high32);
-	iosapic_write(iosapic_lists[id].addr, reg, rte.val);
-	info->low32 = rte.val;
-	info->dest = dest;
-	spin_unlock(&iosapic_lock);
-	spin_unlock_irqrestore(&irq_descp(vec)->lock, flags);
-	return 0;
-}
-
-/* for vtd interrupt remapping. xen/drivers/vtd/intremap.c */
-int iosapic_get_nr_iosapics(void)
-{
-	int index;
-
-	for (index = NR_IOSAPICS - 1; index >= 0; index--) {
-		if (iosapic_lists[index].addr)
-			break;
-	}
-
-	return index + 1;
-}
-
-int iosapic_get_nr_pins(int index)
-{
-	return iosapic_lists[index].num_rte;
-}
-#endif /* XEN */
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/irq_ia64.c
--- a/xen/arch/ia64/linux-xen/irq_ia64.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,350 +0,0 @@
-/*
- * linux/arch/ia64/kernel/irq.c
- *
- * Copyright (C) 1998-2001 Hewlett-Packard Co
- *	Stephane Eranian <eranian@hpl.hp.com>
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *
- *  6/10/99: Updated to bring in sync with x86 version to facilitate
- *	     support for SMP and different interrupt controllers.
- *
- * 09/15/00 Goutham Rao <goutham.rao@intel.com> Implemented pci_irq_to_vector
- *                      PCI to vector allocation routine.
- * 04/14/2004 Ashok Raj <ashok.raj@intel.com>
- *						Added CPU Hotplug handling for IPF.
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-
-#include <linux/jiffies.h>
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/kernel_stat.h>
-#include <linux/slab.h>
-#include <linux/ptrace.h>
-#include <linux/random.h>	/* for rand_initialize_irq() */
-#include <linux/signal.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/threads.h>
-#include <linux/bitops.h>
-
-#include <asm/delay.h>
-#include <asm/intrinsics.h>
-#include <asm/io.h>
-#include <asm/hw_irq.h>
-#include <asm/machvec.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-
-#ifdef XEN
-#include <xen/perfc.h>
-#endif
-
-#ifdef CONFIG_PERFMON
-# include <asm/perfmon.h>
-#endif
-
-#define IRQ_DEBUG	0
-
-/* default base addr of IPI table */
-void __iomem *ipi_base_addr = ((void __iomem *)
-			       (__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR));
-
-/*
- * Legacy IRQ to IA-64 vector translation table.
- */
-__u8 isa_irq_to_vector_map[16] = {
-	/* 8259 IRQ translation, first 16 entries */
-	0x2f, 0x20, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29,
-	0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21
-};
-EXPORT_SYMBOL(isa_irq_to_vector_map);
-
-#ifdef XEN
-unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)];
-#else
-static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)];
-#endif
-
-int
-assign_irq_vector (int irq)
-{
-	int pos, vector;
- again:
-	pos = find_first_zero_bit(ia64_vector_mask, IA64_NUM_DEVICE_VECTORS);
-	vector = IA64_FIRST_DEVICE_VECTOR + pos;
-	if (vector > IA64_LAST_DEVICE_VECTOR)
-		return -ENOSPC;
-	if (test_and_set_bit(pos, ia64_vector_mask))
-		goto again;
-	return vector;
-}
-
-void
-free_irq_vector (int vector)
-{
-	int pos;
-
-	if (vector < IA64_FIRST_DEVICE_VECTOR || vector > IA64_LAST_DEVICE_VECTOR)
-		return;
-
-	pos = vector - IA64_FIRST_DEVICE_VECTOR;
-	if (!test_and_clear_bit(pos, ia64_vector_mask))
-		printk(KERN_WARNING "%s: double free!\n", __FUNCTION__);
-}
-
-#ifdef CONFIG_SMP
-#	define IS_RESCHEDULE(vec)	(vec == IA64_IPI_RESCHEDULE)
-#else
-#	define IS_RESCHEDULE(vec)	(0)
-#endif
-/*
- * That's where the IVT branches when we get an external
- * interrupt. This branches to the correct hardware IRQ handler via
- * function ptr.
- */
-void
-ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
-{
-	unsigned long saved_tpr;
-
-#ifdef XEN
-	perfc_incr(irqs);
-#endif
-#if IRQ_DEBUG
-#ifdef XEN
-	xen_debug_irq(vector, regs);
-#endif
-	{
-		unsigned long bsp, sp;
-
-		/*
-		 * Note: if the interrupt happened while executing in
-		 * the context switch routine (ia64_switch_to), we may
-		 * get a spurious stack overflow here.  This is
-		 * because the register and the memory stack are not
-		 * switched atomically.
-		 */
-		bsp = ia64_getreg(_IA64_REG_AR_BSP);
-		sp = ia64_getreg(_IA64_REG_SP);
-
-		if ((sp - bsp) < 1024) {
-			static unsigned char count;
-			static long last_time;
-
-			if (jiffies - last_time > 5*HZ)
-				count = 0;
-			if (++count < 5) {
-				last_time = jiffies;
-				printk("ia64_handle_irq: DANGER: less than "
-				       "1KB of free stack space!!\n"
-				       "(bsp=0x%lx, sp=%lx)\n", bsp, sp);
-			}
-		}
-	}
-#endif /* IRQ_DEBUG */
-
-	/*
-	 * Always set TPR to limit maximum interrupt nesting depth to
-	 * 16 (without this, it would be ~240, which could easily lead
-	 * to kernel stack overflows).
-	 */
-	irq_enter();
-	saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
-	ia64_srlz_d();
-	while (vector != IA64_SPURIOUS_INT_VECTOR) {
-		if (!IS_RESCHEDULE(vector)) {
-			ia64_setreg(_IA64_REG_CR_TPR, vector);
-			ia64_srlz_d();
-
-			__do_IRQ(local_vector_to_irq(vector), regs);
-
-			/*
-			 * Disable interrupts and send EOI:
-			 */
-			local_irq_disable();
-			ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
-		}
-		ia64_eoi();
-		vector = ia64_get_ivr();
-	}
-	/*
-	 * This must be done *after* the ia64_eoi().  For example, the keyboard softirq
-	 * handler needs to be able to wait for further keyboard interrupts, which can't
-	 * come through until ia64_eoi() has been done.
-	 */
-	irq_exit();
-}
-
-#ifndef XEN
-#ifdef CONFIG_HOTPLUG_CPU
-/*
- * This function emulates a interrupt processing when a cpu is about to be
- * brought down.
- */
-void ia64_process_pending_intr(void)
-{
-	ia64_vector vector;
-	unsigned long saved_tpr;
-	extern unsigned int vectors_in_migration[NR_IRQS];
-
-	vector = ia64_get_ivr();
-
-	 irq_enter();
-	 saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
-	 ia64_srlz_d();
-
-	 /*
-	  * Perform normal interrupt style processing
-	  */
-	while (vector != IA64_SPURIOUS_INT_VECTOR) {
-		if (!IS_RESCHEDULE(vector)) {
-			ia64_setreg(_IA64_REG_CR_TPR, vector);
-			ia64_srlz_d();
-
-			/*
-			 * Now try calling normal ia64_handle_irq as it would have got called
-			 * from a real intr handler. Try passing null for pt_regs, hopefully
-			 * it will work. I hope it works!.
-			 * Probably could shared code.
-			 */
-			vectors_in_migration[local_vector_to_irq(vector)]=0;
-			__do_IRQ(local_vector_to_irq(vector), NULL);
-
-			/*
-			 * Disable interrupts and send EOI
-			 */
-			local_irq_disable();
-			ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
-		}
-		ia64_eoi();
-		vector = ia64_get_ivr();
-	}
-	irq_exit();
-}
-#endif
-#endif
-
-
-#ifdef CONFIG_SMP
-extern irqreturn_t handle_IPI (int irq, void *dev_id, struct pt_regs *regs);
-
-static struct irqaction __read_mostly ipi_irqaction = {
-	.handler =	handle_IPI,
-#ifndef XEN
-	.flags =	SA_INTERRUPT,
-#endif
-	.name =		"IPI"
-};
-#endif
-
-static hw_irq_controller irq_type_ia64_lsapic = {
-	.typename =	"LSAPIC",
-	.startup =	irq_startup_none,
-	.shutdown =	irq_shutdown_none,
-	.enable =	irq_enable_none,
-	.disable =	irq_disable_none,
-	.ack =		irq_actor_none,
-	.end =		irq_actor_none
-};
-
-void
-register_percpu_irq (ia64_vector vec, struct irqaction *action)
-{
-	irq_desc_t *desc;
-#ifndef XEN
-	unsigned int irq;
-
-	for (irq = 0; irq < NR_IRQS; ++irq)
-		if (irq_to_vector(irq) == vec) {
-			desc = irq_descp(irq);
-			desc->status |= IRQ_PER_CPU;
-			desc->handler = &irq_type_ia64_lsapic;
-			if (action)
-				setup_irq(irq, action);
-		}
-#else
-	desc = irq_descp(vec);
-	desc->status |= IRQ_PER_CPU;
-	desc->handler = &irq_type_ia64_lsapic;
-	if (action)
-		setup_vector(vec, action);
-#endif
-}
-
-#ifdef XEN
-int __init request_irq_vector(unsigned int vector,
-		void (*handler)(int, void *, struct cpu_user_regs *),
-		unsigned long irqflags, const char * devname, void *dev_id)
-{
-	struct irqaction * action;
-	int retval;
-
-	/*
-	 * Sanity-check: shared interrupts must pass in a real dev-ID,
-	 * otherwise we'll have trouble later trying to figure out
-	 * which interrupt is which (messes up the interrupt freeing logic etc).
-	 *                          */
-	if (vector >= NR_VECTORS)
-		return -EINVAL;
-	if (!handler)
-		return -EINVAL;
-
-	action = xmalloc(struct irqaction);
-	if (!action)
-		return -ENOMEM;
-
-	action->handler = handler;
-	action->name = devname;
-	action->dev_id = dev_id;
-
-	retval = setup_vector(vector, action);
-	if (retval)
-		xfree(action);
-
-	return retval;
-}
-#endif
-
-void __init
-init_IRQ (void)
-{
-#ifdef XEN
-	BUG_ON(init_irq_data());
-#endif
-	register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
-#ifdef CONFIG_SMP
-	register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
-#endif
-#ifdef CONFIG_PERFMON
-	pfm_init_percpu();
-#endif
-	platform_irq_init();
-}
-
-void
-ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect)
-{
-	void __iomem *ipi_addr;
-	unsigned long ipi_data;
-	unsigned long phys_cpu_id;
-
-#ifdef CONFIG_SMP
-	phys_cpu_id = cpu_physical_id(cpu);
-#else
-	phys_cpu_id = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff;
-#endif
-
-	/*
-	 * cpu number is in 8bit ID and 8bit EID
-	 */
-
-	ipi_data = (delivery_mode << 8) | (vector & 0xff);
-	ipi_addr = ipi_base_addr + ((phys_cpu_id << 4) | ((redirect & 1) << 3));
-
-	writeq(ipi_data, ipi_addr);
-}
diff -r 2386288b1bf1 -r 8aa1697d57e4 xen/arch/ia64/linux-xen/mca.c
--- a/xen/arch/ia64/linux-xen/mca.c	Mon Apr 02 18:14:31 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1963 +0,0 @@
-/*
- * File:	mca.c
- * Purpose:	Generic MCA handling layer
- *
- * Updated for latest kernel
- * Copyright (C) 2003 Hewlett-Packard Co
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *
- * Copyright (C) 2002 Dell Inc.
- * Copyright (C) Matt Domsch (Matt_Domsch@dell.com)
- *
- * Copyright (C) 2002 Intel
- * Copyright (C) Jenna Hall (jenna.s.hall@intel.com)
- *
- * Copyright (C) 2001 Intel
- * Copyright (C) Fred Lewis (frederick.v.lewis@intel.com)
- *
- * Copyright (C) 2000 Intel
- * Copyright (C) Chuck Fleckenstein (cfleck@co.intel.com)
- *
- * Copyright (C) 1999, 2004 Silicon Graphics, Inc.
- * Copyright (C) Vijay Chander(vijay@engr.sgi.com)
- *
- * 03/04/15 D. Mosberger Added INIT backtrace support.
- * 02/03/25 M. Domsch	GUID cleanups
- *
- * 02/01/04 J. Hall	Aligned MCA stack to 16 bytes, added platform vs. CPU
- *			error flag, set SAL default return values, changed
- *			error record structure to linked list, added init call
- *			to sal_get_state_info_size().
- *
- * 01/01/03 F. Lewis    Added setup of CMCI and CPEI IRQs, logging of corrected
- *                      platform errors, completed code for logging of
- *                      corrected & uncorrected machine check errors, and
- *                      updated for conformance with Nov. 2000 revision of the
- *                      SAL 3.0 spec.
- * 00/03/29 C. Fleckenstein  Fixed PAL/SAL update issues, began MCA bug fixes, logging issues,
- *                           added min save state dump, added INIT handler.
- *
- * 2003-12-08 Keith Owens <kaos@sgi.com>
- *            smp_call_function() must not be called from interrupt context (can
- *            deadlock on tasklist_lock).  Use keventd to call smp_call_function().
- *
- * 2004-02-01 Keith Owens <kaos@sgi.com>
- *            Avoid deadlock when using printk() for MCA and INIT records.
- *            Delete all record printing code, moved to salinfo_decode in user space.
- *            Mark variables and functions static where possible.
- *            Delete dead variables and functions.
- *            Reorder to remove the need for forward declarations and to consolidate
- *            related code.
- */
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/kallsyms.h>
-#include <linux/smp_lock.h>
-#include <linux/bootmem.h>
-#include <linux/acpi.h>
-#include <linux/timer.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/smp.h>
-#include <linux/workqueue.h>
-
-#include <asm/delay.h>
-#include <asm/machvec.h>
-#include <asm/meminit.h>
-#include <asm/page.h>
-#include <asm/ptrace.h>
-#include <asm/system.h>
-#include <asm/sal.h>
-#include <asm/mca.h>
-
-#include <asm/irq.h>
-#include <asm/hw_irq.h>
-
-#ifdef XEN
-#include <xen/symbols.h>
-#include <xen/mm.h>
-#include <xen/console.h>
-#include <xen/event.h>
-#include <xen/softirq.h>
-#include <asm/xenmca.h>
-#include <linux/shutdown.h>
-#endif
-
-#if defined(IA64_MCA_DEBUG_INFO)
-# define IA64_MCA_DEBUG(fmt...)	printk(fmt)
-#else
-# define IA64_MCA_DEBUG(fmt...)
-#endif
-
-/* Used by mca_asm.S */
-#ifndef XEN
-ia64_mca_sal_to_os_state_t	ia64_sal_to_os_handoff_state;
-#else
-ia64_mca_sal_to_os_state_t	ia64_sal_to_os_handoff_state[NR_CPUS];
-DEFINE_PER_CPU(u64, ia64_sal_to_os_handoff_state_addr); 
-#endif
-ia64_mca_os_to_sal_state_t	ia64_os_to_sal_handoff_state;
-u64				ia64_mca_serialize;
-DEFINE_PER_CPU(u64, ia64_mca_data); /* == __per_cpu_mca[smp_processor_id()] */
-DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */
-DEFINE_PER_CPU(u64, ia64_mca_pal_pte);	    /* PTE to map PAL code */
-DEFINE_PER_CPU(u64, ia64_mca_pal_base);    /* vaddr PAL code granule */
-
-unsigned long __per_cpu_mca[NR_CPUS];
-
-/* In mca_asm.S */
-extern void			ia64_monarch_init_handler (void);
-extern void			ia64_slave_init_handler (void);
-
-static ia64_mc_info_t		ia64_mc_info;
-
-#ifdef XEN
-#define jiffies			NOW()
-#undef HZ
-#define HZ			1000000000UL
-#endif
-
-#define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */
-#define MIN_CPE_POLL_INTERVAL (2*60*HZ)  /* 2 minutes */
-#define CMC_POLL_INTERVAL     (1*60*HZ)  /* 1 minute */
-#define CPE_HISTORY_LENGTH    5
-#define CMC_HISTORY_LENGTH    5
-
-#ifndef XEN 
-static struct timer_list cpe_poll_timer;
-static struct timer_list cmc_poll_timer;
-#else
-#define mod_timer(timer, expires)	set_timer(timer, expires)
-static struct timer cpe_poll_timer;
-static struct timer cmc_poll_timer;
-#endif
-/*
- * This variable tells whether we are currently in polling mode.
- * Start with this in the wrong state so we won't play w/ timers
- * before the system is ready.
- */
-static int cmc_polling_enabled = 1;
-
-/*
- * Clearing this variable prevents CPE polling from getting activated
- * in mca_late_init.  Use it if your system doesn't provide a CPEI,
- * but encounters problems retrieving CPE logs.  This should only be
- * necessary for debugging.
- */
-static int cpe_poll_enabled = 1;
-
-extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe);
-
-static int mca_init;
-
-/*
- * IA64_MCA log support
- */
-#define IA64_MAX_LOGS		2	/* Double-buffering for nested MCAs */
-#define IA64_MAX_LOG_TYPES      4   /* MCA, INIT, CMC, CPE */
-
-typedef struct ia64_state_log_s
-{
-	spinlock_t	isl_lock;
-	int		isl_index;
-	unsigned long	isl_count;
-	ia64_err_rec_t  *isl_log[IA64_MAX_LOGS]; /* need space to store header + error log */
-} ia64_state_log_t;
-
-static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES];
-
-#ifndef XEN
-#define IA64_LOG_ALLOCATE(it, size) \
-	{ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \
-		(ia64_err_rec_t *)alloc_bootmem(size); \
-	ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \
-		(ia64_err_rec_t *)alloc_bootmem(size);}
-#else
-#define IA64_LOG_ALLOCATE(it, size) \
-	do { \
-		unsigned int pageorder; \
-		struct page_info *page;	\
-		pageorder = get_order_from_bytes(size); \
-		page = alloc_domheap_pages(NULL, pageorder, 0); \
-		ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \
-			page? (ia64_err_rec_t *)page_to_virt(page): NULL;  \
-		page = alloc_domheap_pages(NULL, pageorder, 0); \
-		ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \
-			page? (ia64_err_rec_t *)page_to_virt(page): NULL; \
-	} while(0)
-#endif
-
-#define IA64_LOG_LOCK_INIT(it) spin_lock_init(&ia64_state_log[it].isl_lock)
-#define IA64_LOG_LOCK(it)      spin_lock_irqsave(&ia64_state_log[it].isl_lock, s)
-#define IA64_LOG_UNLOCK(it)    spin_unlock_irqrestore(&ia64_state_log[it].isl_lock,s)
-#define IA64_LOG_NEXT_INDEX(it)    ia64_state_log[it].isl_index
-#define IA64_LOG_CURR_INDEX(it)    1 - ia64_state_log[it].isl_index
-#define IA64_LOG_INDEX_INC(it) \
-    {ia64_state_log[it].isl_index = 1 - ia64_state_log[it].isl_index; \
-    ia64_state_log[it].isl_count++;}
-#define IA64_LOG_INDEX_DEC(it) \
-    ia64_state_log[it].isl_index = 1 - ia64_state_log[it].isl_index
-#define IA64_LOG_NEXT_BUFFER(it)   (void *)((ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)]))
-#define IA64_LOG_CURR_BUFFER(it)   (void *)((ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)]))
-#define IA64_LOG_COUNT(it)         ia64_state_log[it].isl_count
-
-#ifdef XEN
-sal_queue_entry_t sal_entry[NR_CPUS][IA64_MAX_LOG_TYPES];
-struct list_head *sal_queue, sal_log_queues[IA64_MAX_LOG_TYPES];
-sal_log_record_header_t *sal_record;
-DEFINE_SPINLOCK(sal_queue_lock);
-#endif
-
-/*
- * ia64_log_init
- *	Reset the OS ia64 log buffer
- * Inputs   :   info_type   (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE})
- * Outputs	:	None
- */
-static void
-ia64_log_init(int sal_info_type)
-{
-	u64	max_size = 0;
-
-	IA64_LOG_NEXT_INDEX(sal_info_type) = 0;
-	IA64_LOG_LOCK_INIT(sal_info_type);
-
-	// SAL will tell us the maximum size of any error record of this type
-	max_size = ia64_sal_get_state_info_size(sal_info_type);
-	if (!max_size)
-		/* alloc_bootmem() doesn't like zero-sized allocations! */
-		return;
-
-	// set up OS data structures to hold error info
-	IA64_LOG_ALLOCATE(sal_info_type, max_size);
-	memset(IA64_LOG_CURR_BUFFER(sal_info_type), 0, max_size);
-	memset(IA64_LOG_NEXT_BUFFER(sal_info_type), 0, max_size);
-
-#ifdef XEN
-	if (sal_record == NULL) {
-		unsigned int pageorder;
-		struct page_info *page;
-		pageorder  = get_order_from_bytes(max_size);
-		page = alloc_domheap_pages(NULL, pageorder, 0);
-		BUG_ON(page == NULL);
-		sal_record = (sal_log_record_header_t *)page_to_virt(page);
-		BUG_ON(sal_record == NULL);
-	}
-#endif
-}
-
-#ifndef XEN
-/*
- * ia64_log_get
- *
- *	Get the current MCA log from SAL and copy it into the OS log buffer.
- *
- *  Inputs  :   info_type   (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE})
- *              irq_safe    whether you can use printk at this point
- *  Outputs :   size        (total record length)
- *              *buffer     (ptr to error record)
- *
- */
-static u64
-ia64_log_get(int sal_info_type, u8 **buffer, int irq_safe)
-{
-	sal_log_record_header_t     *log_buffer;
-	u64                         total_len = 0;
-	int                         s;
-
-	IA64_LOG_LOCK(sal_info_type);
-
-	/* Get the process state information */
-	log_buffer = IA64_LOG_NEXT_BUFFER(sal_info_type);
-
-	total_len = ia64_sal_get_state_info(sal_info_type, (u64 *)log_buffer);
-
-	if (total_len) {
-		IA64_LOG_INDEX_INC(sal_info_type);
-		IA64_LOG_UNLOCK(sal_info_type);
-		if (irq_safe) {
-			IA64_MCA_DEBUG("%s: SAL error record type %d retrieved. "
-				       "Record length = %ld\n", __FUNCTION__, sal_info_type, total_len);
-		}
-		*buffer = (u8 *) log_buffer;
-		return total_len;
-	} else {
-		IA64_LOG_UNLOCK(sal_info_type);
-		return 0;
-	}
-}
-
-/*
- *  ia64_mca_log_sal_error_record
- *
- *  This function retrieves a specified error record type from SAL
- *  and wakes up any processes waiting for error records.
- *
- *  Inputs  :   sal_info_type   (Type of error record MCA/CMC/CPE/INIT)
- */
-static void
-ia64_mca_log_sal_error_record(int sal_info_type)
-{
-	u8 *buffer;
-	sal_log_record_header_t *rh;
-	u64 size;
-	int irq_safe = sal_info_type != SAL_INFO_TYPE_MCA && sal_info_type != SAL_INFO_TYPE_INIT;
-#ifdef IA64_MCA_DEBUG_INFO
-	static const char * const rec_name[] = { "MCA", "INIT", "CMC", "CPE" };
-#endif
-
-	size = ia64_log_get(sal_info_type, &buffer, irq_safe);
-	if (!size)
-		return;
-
-	salinfo_log_wakeup(sal_info_type, buffer, size, irq_safe);
-
-	if (irq_safe)
-		IA64_MCA_DEBUG("CPU %d: SAL log contains %s error record\n",
-			smp_processor_id(),
-			sal_info_type < ARRAY_SIZE(rec_name) ? rec_name[sal_info_type] : "UNKNOWN");
-
-	/* Clear logs from corrected errors in case there's no user-level logger */
-	rh = (sal_log_record_header_t *)buffer;
-	if (rh->severity == sal_log_severity_corrected)
-		ia64_sal_clear_state_info(sal_info_type);
-}
-#else /* !XEN */
-/*
- * ia64_log_queue
- *
- *	Get the current MCA log from SAL and copy it into the OS log buffer.
- *
- *  Inputs  :   info_type   (SAL_INFO_TYPE_{MCA,INIT,CMC,CPE})
- *  Outputs :   size        (total record length)
- *              *buffer     (ptr to error record)
- *
- */
-static u64
-ia64_log_queue(int sal_info_type, int virq)
-{
-	sal_log_record_header_t     *log_buffer;
-	u64                         total_len = 0;
-	int                         s;
-	sal_queue_entry_t	    *e;
-	unsigned long		    flags;
-
-	IA64_LOG_LOCK(sal_info_type);
-
-	/* Get the process state information */
-	log_buffer = IA64_LOG_NEXT_BUFFER(sal_info_type);
-
-	total_len = ia64_sal_get_state_info(sal_info_type, (u64 *)log_buffer);
-
-	if (total_len) {
-		int queue_type;
-		int cpuid = smp_processor_id();
-
-		spin_lock_irqsave(&sal_queue_lock, flags);
-
-		if (sal_info_type == SAL_INFO_TYPE_MCA && virq == VIRQ_MCA_CMC)
-			queue_type = SAL_INFO_TYPE_CMC;
-		else
-			queue_type = sal_info_type;
-
-		/* Skip if sal_entry is already listed in sal_queue */
-		list_for_each_entry(e, &sal_queue[queue_type], list) {
-			if (e == &sal_entry[cpuid][queue_type])
-				goto found;
-		}
-		e = &sal_entry[cpuid][queue_type];
-		memset(e, 0, sizeof(sal_queue_entry_t));
-		e->cpuid = cpuid;
-		e->sal_info_type = sal_info_type;
-		e->vector = IA64_CMC_VECTOR;
-		e->virq = virq;
-		e->length = total_len;
-
-		list_add_tail(&e->list, &sal_queue[queue_type]);
-
-	found:
-		spin_unlock_irqrestore(&sal_queue_lock, flags);
-
-		IA64_LOG_INDEX_INC(sal_info_type);
-		IA64_LOG_UNLOCK(sal_info_type);
-		if (sal_info_type != SAL_INFO_TYPE_MCA &&
-		    sal_info_type != SAL_INFO_TYPE_INIT) {
-			IA64_MCA_DEBUG("%s: SAL error record type %d retrieved. "
-				       "Record length = %ld\n", __FUNCTION__,
-			               sal_info_type, total_len);
-		}
-		return total_len;
-	} else {
-		IA64_LOG_UNLOCK(sal_info_type);
-		return 0;
-	}
-}
-#endif /* !XEN */
-
-/*
- * platform dependent error handling
- */
-#ifndef PLATFORM_MCA_HANDLERS
-
-#ifdef CONFIG_ACPI
-
-#ifdef XEN
-/**
- *	Copy from linux/kernel/irq/manage.c
- *
- *	disable_irq_nosync - disable an irq without waiting
- *	@irq: Interrupt to disable
- *
- *	Disable the selected interrupt line.  Disables and Enables are
- *	nested.
- *	Unlike disable_irq(), this function does not ensure existing
- *	instances of the IRQ handler have completed before returning.
- *
- *	This function may be called from IRQ context.
- */
-void disable_irq_nosync(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	if (irq >= NR_IRQS)
-		return;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	if (!desc->arch.depth++) {
-		desc->status |= IRQ_DISABLED;
-		desc->handler->disable(desc);
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/**
- *	Copy from linux/kernel/irq/manage.c
- *
- *	enable_irq - enable handling of an irq
- *	@irq: Interrupt to enable
- *
- *	Undoes the effect of one call to disable_irq().  If this
- *	matches the last disable, processing of interrupts on this
- *	IRQ line is re-enabled.
- *
- *	This function may be called from IRQ context.
- */
-void enable_irq(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	if (irq >= NR_IRQS)
-		return;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	switch (desc->arch.depth) {
-	case 0:
-		WARN_ON(1);
-		break;
-	case 1: {
-		unsigned int status = desc->status & ~IRQ_DISABLED;
-
-		desc->status = status;
-		if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
-			desc->status = status | IRQ_REPLAY;
-			hw_resend_irq(desc->handler,irq);
-		}
-		desc->handler->enable(desc);
-		/* fall-through */
-	}
-	default:
-		desc->arch.depth--;
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-#endif	/* XEN */
-
-int cpe_vector = -1;
-
-static irqreturn_t
-ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)
-{
-	static unsigned long	cpe_history[CPE_HISTORY_LENGTH];
-	static int		index;
-	static DEFINE_SPINLOCK(cpe_history_lock);
-
-	IA64_MCA_DEBUG("%s: received interrupt vector = %#x on CPU %d\n",
-		       __FUNCTION__, cpe_irq, smp_processor_id());
-
-	/* SAL spec states this should run w/ interrupts enabled */
-	local_irq_enable();
-
-#ifndef XEN
-	/* Get the CPE error record and log it */
-	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CPE);
-#else
-	ia64_log_queue(SAL_INFO_TYPE_CPE, VIRQ_MCA_CPE);
-	/* CPE error does not inform to dom0 but the following codes are 
-	   reserved for future implementation */
-/* 	send_guest_vcpu_virq(dom0->vcpu[0], VIRQ_MCA_CPE); */
-#endif
-
-	spin_lock(&cpe_history_lock);
-	if (!cpe_poll_enabled && cpe_vector >= 0) {
-
-		int i, count = 1; /* we know 1 happened now */
-		unsigned long now = jiffies;
-
-		for (i = 0; i < CPE_HISTORY_LENGTH; i++) {
-			if (now - cpe_history[i] <= HZ)
-				count++;
-		}
-
-		IA64_MCA_DEBUG(KERN_INFO "CPE threshold %d/%d\n", count, CPE_HISTORY_LENGTH);
-		if (count >= CPE_HISTORY_LENGTH) {
-
-			cpe_poll_enabled = 1;
-			spin_unlock(&cpe_history_lock);
-			disable_irq_nosync(local_vector_to_irq(IA64_CPE_VECTOR));
-
-			/*
-			 * Corrected errors will still be corrected, but
-			 * make sure there's a log somewhere that indicates
-			 * something is generating more than we can handle.
-			 */
-			printk(KERN_WARNING "WARNING: Switching to polling CPE handler; error records may be lost\n");
-
-			mod_timer(&cpe_poll_timer, jiffies + MIN_CPE_POLL_INTERVAL);
-
-			/* lock already released, get out now */
-			return IRQ_HANDLED;
-		} else {
-			cpe_history[index++] = now;
-			if (index == CPE_HISTORY_LENGTH)
-				index = 0;
-		}
-	}
-	spin_unlock(&cpe_history_lock);
-	return IRQ_HANDLED;
-}
-
-#endif /* CONFIG_ACPI */
-
-static void
-show_min_state (pal_min_state_area_t *minstate)
-{
-	u64 iip = minstate->pmsa_iip + ((struct ia64_psr *)(&minstate->pmsa_ipsr))->ri;
-	u64 xip = minstate->pmsa_xip + ((struct ia64_psr *)(&minstate->pmsa_xpsr))->ri;
-
-	printk("NaT bits\t%016lx\n", minstate->pmsa_nat_bits);
-	printk("pr\t\t%016lx\n", minstate->pmsa_pr);
-	printk("b0\t\t%016lx ", minstate->pmsa_br0); print_symbol("%s\n", minstate->pmsa_br0);
-	printk("ar.rsc\t\t%016lx\n", minstate->pmsa_rsc);
-	printk("cr.iip\t\t%016lx ", iip); print_symbol("%s\n", iip);
-	printk("cr.ipsr\t\t%016lx\n", minstate->pmsa_ipsr);
-	printk("cr.ifs\t\t%016lx\n", minstate->pmsa_ifs);
-	printk("xip\t\t%016lx ", xip); print_symbol("%s\n", xip);
-	printk("xpsr\t\t%016lx\n", minstate->pmsa_xpsr);
-	printk("xfs\t\t%016lx\n", minstate->pmsa_xfs);
-	printk("b1\t\t%016lx ", minstate->pmsa_br1);
-	print_symbol("%s\n", minstate->pmsa_br1);
-
-	printk("\nstatic registers r0-r15:\n");
-	printk(" r0- 3 %016lx %016lx %016lx %016lx\n",
-	       0UL, minstate->pmsa_gr[0], minstate->pmsa_gr[1], minstate->pmsa_gr[2]);
-	printk(" r4- 7 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_gr[3], minstate->pmsa_gr[4],
-	       minstate->pmsa_gr[5], minstate->pmsa_gr[6]);
-	printk(" r8-11 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_gr[7], minstate->pmsa_gr[8],
-	       minstate->pmsa_gr[9], minstate->pmsa_gr[10]);
-	printk("r12-15 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_gr[11], minstate->pmsa_gr[12],
-	       minstate->pmsa_gr[13], minstate->pmsa_gr[14]);
-
-	printk("\nbank 0:\n");
-	printk("r16-19 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[0], minstate->pmsa_bank0_gr[1],
-	       minstate->pmsa_bank0_gr[2], minstate->pmsa_bank0_gr[3]);
-	printk("r20-23 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[4], minstate->pmsa_bank0_gr[5],
-	       minstate->pmsa_bank0_gr[6], minstate->pmsa_bank0_gr[7]);
-	printk("r24-27 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[8], minstate->pmsa_bank0_gr[9],
-	       minstate->pmsa_bank0_gr[10], minstate->pmsa_bank0_gr[11]);
-	printk("r28-31 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank0_gr[12], minstate->pmsa_bank0_gr[13],
-	       minstate->pmsa_bank0_gr[14], minstate->pmsa_bank0_gr[15]);
-
-	printk("\nbank 1:\n");
-	printk("r16-19 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[0], minstate->pmsa_bank1_gr[1],
-	       minstate->pmsa_bank1_gr[2], minstate->pmsa_bank1_gr[3]);
-	printk("r20-23 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[4], minstate->pmsa_bank1_gr[5],
-	       minstate->pmsa_bank1_gr[6], minstate->pmsa_bank1_gr[7]);
-	printk("r24-27 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[8], minstate->pmsa_bank1_gr[9],
-	       minstate->pmsa_bank1_gr[10], minstate->pmsa_bank1_gr[11]);
-	printk("r28-31 %016lx %016lx %016lx %016lx\n",
-	       minstate->pmsa_bank1_gr[12], minstate->pmsa_bank1_gr[13],
-	       minstate->pmsa_bank1_gr[14], minstate->pmsa_bank1_gr[15]);
-}
-
-static void
-fetch_min_state (pal_min_state_area_t *ms, struct pt_regs *pt, struct switch_stack *sw)
-{
-	u64 *dst_banked, *src_banked, bit, shift, nat_bits;
-	int i;
-
-	/*
-	 * First, update the pt-regs and switch-stack structures with the contents stored
-	 * in the min-state area:
-	 */
-	if (((struct ia64_psr *) &ms->pmsa_ipsr)->ic == 0) {
-		pt->cr_ipsr = ms->pmsa_xpsr;
-		pt->cr_iip = ms->pmsa_xip;
-		pt->cr_ifs = ms->pmsa_xfs;
-	} else {
-		pt->cr_ipsr = ms->pmsa_ipsr;
-		pt->cr_iip = ms->pmsa_iip;
-		pt->cr_ifs = ms->pmsa_ifs;
-	}
-	pt->ar_rsc = ms->pmsa_rsc;
-	pt->pr = ms->pmsa_pr;
-	pt->r1 = ms->pmsa_gr[0];
-	pt->r2 = ms->pmsa_gr[1];
-	pt->r3 = ms->pmsa_gr[2];
-	sw->r4 = ms->pmsa_gr[3];
-	sw->r5 = ms->pmsa_gr[4];
-	sw->r6 = ms->pmsa_gr[5];
-	sw->r7 = ms->pmsa_gr[6];
-	pt->r8 = ms->pmsa_gr[7];
-	pt->r9 = ms->pmsa_gr[8];
-	pt->r10 = ms->pmsa_gr[9];
-	pt->r11 = ms->pmsa_gr[10];
-	pt->r12 = ms->pmsa_gr[11];
-	pt->r13 = ms->pmsa_gr[12];
-	pt->r14 = ms->pmsa_gr[13];
-	pt->r15 = ms->pmsa_gr[14];
-	dst_banked = &pt->r16;		/* r16-r31 are contiguous in struct pt_regs */
-	src_banked = ms->pmsa_bank1_gr;
-	for (i = 0; i < 16; ++i)
-		dst_banked[i] = src_banked[i];
-	pt->b0 = ms->pmsa_br0;
-	sw->b1 = ms->pmsa_br1;
-
-	/* construct the NaT bits for the pt-regs structure: */
-#	define PUT_NAT_BIT(dst, addr)					\
-	do {								\
-		bit = nat_bits & 1; nat_bits >>= 1;			\
-		shift = ((unsigned long) addr >> 3) & 0x3f;		\
-		dst = ((dst) & ~(1UL << shift)) | (bit << shift);	\
-	} while (0)
-
-	/* Rotate the saved NaT bits such that bit 0 corresponds to pmsa_gr[0]: */
-	shift = ((unsigned long) &ms->pmsa_gr[0] >> 3) & 0x3f;
-	nat_bits = (ms->pmsa_nat_bits >> shift) | (ms->pmsa_nat_bits << (64 - shift));
-
-	PUT_NAT_BIT(sw->caller_unat, &pt->r1);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r2);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r3);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r4);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r5);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r6);
-	PUT_NAT_BIT(sw->ar_unat, &sw->r7);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r8);	PUT_NAT_BIT(sw->caller_unat, &pt->r9);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r10);	PUT_NAT_BIT(sw->caller_unat, &pt->r11);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r12);	PUT_NAT_BIT(sw->caller_unat, &pt->r13);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r14);	PUT_NAT_BIT(sw->caller_unat, &pt->r15);
-	nat_bits >>= 16;	/* skip over bank0 NaT bits */
-	PUT_NAT_BIT(sw->caller_unat, &pt->r16);	PUT_NAT_BIT(sw->caller_unat, &pt->r17);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r18);	PUT_NAT_BIT(sw->caller_unat, &pt->r19);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r20);	PUT_NAT_BIT(sw->caller_unat, &pt->r21);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r22);	PUT_NAT_BIT(sw->caller_unat, &pt->r23);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r24);	PUT_NAT_BIT(sw->caller_unat, &pt->r25);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r26);	PUT_NAT_BIT(sw->caller_unat, &pt->r27);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r28);	PUT_NAT_BIT(sw->caller_unat, &pt->r29);
-	PUT_NAT_BIT(sw->caller_unat, &pt->r30);	PUT_NAT_BIT(sw->caller_unat, &pt->r31);
-}
-
-#ifdef XEN
-static spinlock_t init_dump_lock = SPIN_LOCK_UNLOCKED;
-static spinlock_t show_stack_lock = SPIN_LOCK_UNLOCKED;
-static atomic_t num_stopped_cpus = ATOMIC_INIT(0);
-extern void show_stack (struct task_struct *, unsigned long *);
-
-#define CPU_FLUSH_RETRY_MAX 5
-static void
-init_cache_flush (void)
-{
-	unsigned long flags;
-	int i;
-	s64 rval = 0;
-	u64 vector, progress = 0;
-
-	for (i = 0; i < CPU_FLUSH_RETRY_MAX; i++) {
-		local_irq_save(flags);
-		rval = ia64_pal_cache_flush(PAL_CACHE_TYPE_INSTRUCTION_DATA,
-		                            0, &progress, &vector);
-		local_irq_restore(flags);
-		if (rval == 0){
-			printk("\nPAL cache flush success\n");
-			return;
-		}
-	}
-	printk("\nPAL cache flush failed. status=%ld\n",rval);
-}
-
-static void inline
-save_ksp (struct unw_frame_info *info)
-{
-	current->arch._thread.ksp = (__u64)(info->sw) - 16;
-	wmb();
-	init_cache_flush();
-}	
-
-static void
-freeze_cpu_osinit (struct unw_frame_info *info, void *arg)
-{
-	save_ksp(info);
-	atomic_inc(&num_stopped_cpus);
-	printk("%s: CPU%d init handler done\n",
-	       __FUNCTION__, smp_processor_id());
-	for (;;)
-		local_irq_disable();
-}
-
-/* FIXME */
-static void
-try_crashdump(struct unw_frame_info *info, void *arg)
-{ 
-	save_ksp(info);
-	printk("\nINIT dump complete.  Please reboot now.\n");
-	for (;;)
-		local_irq_disable();
-}
-#endif /* XEN */
-
-static void
-init_handler_platform (pal_min_state_area_t *ms,
-		       struct pt_regs *pt, struct switch_stack *sw)
-{
-	struct unw_frame_info info;
-
-	/* if a kernel debugger is available call it here else just dump the registers */
-
-	/*
-	 * Wait for a bit.  On some machines (e.g., HP's zx2000 and zx6000, INIT can be
-	 * generated via the BMC's command-line interface, but since the console is on the
-	 * same serial line, the user will need some time to switch out of the BMC before
-	 * the dump begins.
-	 */
-	printk("Delaying for 5 seconds...\n");
-	udelay(5*1000000);
-#ifdef XEN
-	fetch_min_state(ms, pt, sw);
-	spin_lock(&show_stack_lock);
-#endif
-	show_min_state(ms);
-
-#ifdef XEN
-	printk("Backtrace of current vcpu (vcpu_id %d of domid %d)\n",
-	       current->vcpu_id, current->domain->domain_id);
-#else
-	printk("Backtrace of current task (pid %d, %s)\n", current->pid, current->comm);
-	fetch_min_state(ms, pt, sw);
-#endif
-	unw_init_from_interruption(&info, current, pt, sw);
-	ia64_do_show_stack(&info, NULL);
-#ifdef XEN
-	spin_unlock(&show_stack_lock);
-
-	if (spin_trylock(&init_dump_lock)) {
-		struct domain *d;
-		struct vcpu *v;
-#ifdef CONFIG_SMP
-		int other_cpus = num_online_cpus() - 1;
-		int wait = 1000 * other_cpus;
-
-		while ((atomic_read(&num_stopped_cpus) != other_cpus) && wait--)
-			udelay(1000);
-		if (other_cpus && wait < 0)
-			printk("timeout %d\n", atomic_read(&num_stopped_cpus));
-#endif
-		if (opt_noreboot) {
-			/* this route is for dump routine */
-			unw_init_running(try_crashdump, pt);
-		} else {
-			rcu_read_lock(&domlist_read_lock);
-			for_each_domain(d) {
-				for_each_vcpu(d, v) {
-					printk("Backtrace of current vcpu "
-					       "(vcpu_id %d of domid %d)\n",
-					       v->vcpu_id, d->domain_id);
-					show_stack(v, NULL);
-				}
-			}
-			rcu_read_unlock(&domlist_read_lock);
-		}
-	}
-	unw_init_running(freeze_cpu_osinit, NULL);
-#else /* XEN */
-#ifdef CONFIG_SMP
-	/* read_trylock() would be handy... */
-	if (!tasklist_lock.write_lock)
-		read_lock(&tasklist_lock);
-#endif
-	{
-		struct task_struct *g, *t;
-		do_each_thread (g, t) {
-			if (t == current)
-				continue;
-
-			printk("\nBacktrace of pid %d (%s)\n", t->pid, t->comm);
-			show_stack(t, NULL);
-		} while_each_thread (g, t);
-	}
-#ifdef CONFIG_SMP
-	if (!tasklist_lock.write_lock)
-		read_unlock(&tasklist_lock);
-#endif
-
-	printk("\nINIT dump complete.  Please reboot now.\n");
-#endif /* XEN */
-	while (1);			/* hang city if no debugger */
-}
-
-#ifdef CONFIG_ACPI
-/*
- * ia64_mca_register_cpev
- *
- *  Register the corrected platform error vector with SAL.
- *
- *  Inputs
- *      cpev        Corrected Platform Error Vector number
- *
- *  Outputs
- *      None
- */
-static void
-ia64_mca_register_cpev (int cpev)
-{
-	/* Register the CPE interrupt vector with SAL */
-	struct ia64_sal_retval isrv;
-
-	isrv = ia64_sal_mc_set_params(SAL_MC_PARAM_CPE_INT, SAL_MC_PARAM_MECHANISM_INT, cpev, 0, 0);
-	if (isrv.status) {
-		printk(KERN_ERR "Failed to register Corrected Platform "
-		       "Error interrupt vector with SAL (status %ld)\n", isrv.status);
-		return;
-	}
-
-	IA64_MCA_DEBUG("%s: corrected platform error "
-		       "vector %#x registered\n", __FUNCTION__, cpev);
-}
-#endif /* CONFIG_ACPI */
-
-#endif /* PLATFORM_MCA_HANDLERS */
-
-/*
- * ia64_mca_cmc_vector_setup
- *
- *  Setup the corrected machine check vector register in the processor.
- *  (The interrupt is masked on boot. ia64_mca_late_init unmask this.)
- *  This function is invoked on a per-processor basis.
- *
- * Inputs
- *      None
- *
- * Outputs
- *	None
- */
-void
-ia64_mca_cmc_vector_setup (void)
-{
-	cmcv_reg_t	cmcv;
-
-	cmcv.cmcv_regval	= 0;
-	cmcv.cmcv_mask		= 1;        /* Mask/disable interrupt at first */
-	cmcv.cmcv_vector	= IA64_CMC_VECTOR;
-	ia64_setreg(_IA64_REG_CR_CMCV, cmcv.cmcv_regval);
-
-	IA64_MCA_DEBUG("%s: CPU %d corrected "
-		       "machine check vector %#x registered.\n",
-		       __FUNCTION__, smp_processor_id(), IA64_CMC_VECTOR);
-
-	IA64_MCA_DEBUG("%s: CPU %d CMCV = %#016lx\n",
-		       __FUNCTION__, smp_processor_id(), ia64_getreg(_IA64_REG_CR_CMCV));
-}
-
-/*
- * ia64_mca_cmc_vector_disable
- *
- *  Mask the corrected machine check vector register in the processor.
- *  This function is invoked on a per-processor basis.
- *
- * Inputs
- *      dummy(unused)
- *
- * Outputs
- *	None
- */
-static void
-ia64_mca_cmc_vector_disable (void *dummy)
-{
-	cmcv_reg_t	cmcv;
-
-	cmcv.cmcv_regval = ia64_getreg(_IA64_REG_CR_CMCV);
-
-	cmcv.cmcv_mask = 1; /* Mask/disable interrupt */
-	ia64_setreg(_IA64_REG_CR_CMCV, cmcv.cmcv_regval);
-
-	IA64_MCA_DEBUG("%s: CPU %d corrected "
-		       "machine check vector %#x disabled.\n",
-		       __FUNCTION__, smp_processor_id(), cmcv.cmcv_vector);
-}
-
-/*
- * ia64_mca_cmc_vector_enable
- *
- *  Unmask the corrected machine check vector register in the processor.
- *  This function is invoked on a per-processor basis.
- *
- * Inputs
- *      dummy(unused)
- *
- * Outputs
- *	None
- */
-static void
-ia64_mca_cmc_vector_enable (void *dummy)
-{
-	cmcv_reg_t	cmcv;
-
-	cmcv.cmcv_regval = ia64_getreg(_IA64_REG_CR_CMCV);
-
-	cmcv.cmcv_mask = 0; /* Unmask/enable interrupt */
-	ia64_setreg(_IA64_REG_CR_CMCV, cmcv.cmcv_regval);
-
-	IA64_MCA_DEBUG("%s: CPU %d corrected "
-		       "machine check vector %#x enabled.\n",
-		       __FUNCTION__, smp_processor_id(), cmcv.cmcv_vector);
-}
-
-#ifndef XEN
-/*
- * ia64_mca_cmc_vector_disable_keventd
- *
- * Called via keventd (smp_call_function() is not safe in interrupt context) to
- * disable the cmc interrupt vector.
- */
-static void
-ia64_mca_cmc_vector_disable_keventd(void *unused)
-{
-	on_each_cpu(ia64_mca_cmc_vector_disable, NULL, 0);
-}
-
-/*
- * ia64_mca_cmc_vector_enable_keventd
- *
- * Called via keventd (smp_call_function() is not safe in interrupt context) to
- * enable the cmc interrupt vector.
- */
-static void
-ia64_mca_cmc_vector_enable_keventd(void *unused)
-{
-	on_each_cpu(ia64_mca_cmc_vector_enable, NULL, 0);
-}
-#endif /* !XEN	*/
-
-/*
- * ia64_mca_wakeup_ipi_wait
- *
- *	Wait for the inter-cpu interrupt to be sent by the
- *	monarch processor once it is done with handling the
- *	MCA.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-static void
-ia64_mca_wakeup_ipi_wait(void)
-{
-	int	irr_num = (IA64_MCA_WAKEUP_VECTOR >> 6);
-	int	irr_bit = (IA64_MCA_WAKEUP_VECTOR & 0x3f);
-	u64	irr = 0;
-
-	do {
-		switch(irr_num) {
-		      case 0:
-			irr = ia64_getreg(_IA64_REG_CR_IRR0);
-			break;
-		      case 1:
-			irr = ia64_getreg(_IA64_REG_CR_IRR1);
-			break;
-		      case 2:
-			irr = ia64_getreg(_IA64_REG_CR_IRR2);
-			break;
-		      case 3:
-			irr = ia64_getreg(_IA64_REG_CR_IRR3);
-			break;
-		}
-		cpu_relax();
-	} while (!(irr & (1UL << irr_bit))) ;
-}
-
-/*
- * ia64_mca_wakeup
- *
- *	Send an inter-cpu interrupt to wake-up a particular cpu
- *	and mark that cpu to be out of rendez.
- *
- *  Inputs  :   cpuid
- *  Outputs :   None
- */
-static void
-ia64_mca_wakeup(int cpu)
-{
-	platform_send_ipi(cpu, IA64_MCA_WAKEUP_VECTOR, IA64_IPI_DM_INT, 0);
-	ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_NOTDONE;
-
-}
-
-/*
- * ia64_mca_wakeup_all
- *
- *	Wakeup all the cpus which have rendez'ed previously.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-static void
-ia64_mca_wakeup_all(void)
-{
-	int cpu;
-
-	/* Clear the Rendez checkin flag for all cpus */
-	for(cpu = 0; cpu < NR_CPUS; cpu++) {
-		if (!cpu_online(cpu))
-			continue;
-		if (ia64_mc_info.imi_rendez_checkin[cpu] == IA64_MCA_RENDEZ_CHECKIN_DONE)
-			ia64_mca_wakeup(cpu);
-	}
-
-}
-
-/*
- * ia64_mca_rendez_interrupt_handler
- *
- *	This is handler used to put slave processors into spinloop
- *	while the monarch processor does the mca handling and later
- *	wake each slave up once the monarch is done.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-static irqreturn_t
-ia64_mca_rendez_int_handler(int rendez_irq, void *arg, struct pt_regs *ptregs)
-{
-	unsigned long flags;
-	int cpu = smp_processor_id();
-
-	/* Mask all interrupts */
-	local_irq_save(flags);
-
-	ia64_mc_info.imi_rendez_checkin[cpu] = IA64_MCA_RENDEZ_CHECKIN_DONE;
-	/* Register with the SAL monarch that the slave has
-	 * reached SAL
-	 */
-	ia64_sal_mc_rendez();
-
-	/* Wait for the wakeup IPI from the monarch
-	 * This waiting is done by polling on the wakeup-interrupt
-	 * vector bit in the processor's IRRs
-	 */
-	ia64_mca_wakeup_ipi_wait();
-
-	/* Enable all interrupts */
-	local_irq_restore(flags);
-	return IRQ_HANDLED;
-}
-
-/*
- * ia64_mca_wakeup_int_handler
- *
- *	The interrupt handler for processing the inter-cpu interrupt to the
- *	slave cpu which was spinning in the rendez loop.
- *	Since this spinning is done by turning off the interrupts and
- *	polling on the wakeup-interrupt bit in the IRR, there is
- *	nothing useful to be done in the handler.
- *
- *  Inputs  :   wakeup_irq  (Wakeup-interrupt bit)
- *	arg		(Interrupt handler specific argument)
- *	ptregs		(Exception frame at the time of the interrupt)
- *  Outputs :   None
- *
- */
-static irqreturn_t
-ia64_mca_wakeup_int_handler(int wakeup_irq, void *arg, struct pt_regs *ptregs)
-{
-	return IRQ_HANDLED;
-}
-
-/*
- * ia64_return_to_sal_check
- *
- *	This is function called before going back from the OS_MCA handler
- *	to the OS_MCA dispatch code which finally takes the control back
- *	to the SAL.
- *	The main purpose of this routine is to setup the OS_MCA to SAL
- *	return state which can be used by the OS_MCA dispatch code
- *	just before going back to SAL.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-
-static void
-ia64_return_to_sal_check(int recover)
-{
-#ifdef XEN
-	int cpu = smp_processor_id();
-#endif
-
-	/* Copy over some relevant stuff from the sal_to_os_mca_handoff
-	 * so that it can be used at the time of os_mca_to_sal_handoff
-	 */
-#ifdef XEN
-	ia64_os_to_sal_handoff_state.imots_sal_gp =
-		ia64_sal_to_os_handoff_state[cpu].imsto_sal_gp;
-
-	ia64_os_to_sal_handoff_state.imots_sal_check_ra =
-		ia64_sal_to_os_handoff_state[cpu].imsto_sal_check_ra;
-#else
-	ia64_os_to_sal_handoff_state.imots_sal_gp =
-		ia64_sal_to_os_handoff_state.imsto_sal_gp;
-
-	ia64_os_to_sal_handoff_state.imots_sal_check_ra =
-		ia64_sal_to_os_handoff_state.imsto_sal_check_ra;
-#endif
-
-	if (recover)
-		ia64_os_to_sal_handoff_state.imots_os_status = IA64_MCA_CORRECTED;
-	else
-		ia64_os_to_sal_handoff_state.imots_os_status = IA64_MCA_COLD_BOOT;
-
-	/* Default = tell SAL to return to same context */
-	ia64_os_to_sal_handoff_state.imots_context = IA64_MCA_SAME_CONTEXT;
-
-#ifdef XEN
-	ia64_os_to_sal_handoff_state.imots_new_min_state =
-		(u64 *)ia64_sal_to_os_handoff_state[cpu].pal_min_state;
-#else
-	ia64_os_to_sal_handoff_state.imots_new_min_state =
-		(u64 *)ia64_sal_to_os_handoff_state.pal_min_state;
-#endif
-
-}
-
-/* Function pointer for extra MCA recovery */
-int (*ia64_mca_ucmc_extension)
-	(void*,ia64_mca_sal_to_os_state_t*,ia64_mca_os_to_sal_state_t*)
-	= NULL;
-
-int
-ia64_reg_MCA_extension(void *fn)
-{
-	if (ia64_mca_ucmc_extension)
-		return 1;
-
-	ia64_mca_ucmc_extension = fn;
-	return 0;
-}
-
-void
-ia64_unreg_MCA_extension(void)
-{
-	if (ia64_mca_ucmc_extension)
-		ia64_mca_ucmc_extension = NULL;
-}
-
-EXPORT_SYMBOL(ia64_reg_MCA_extension);
-EXPORT_SYMBOL(ia64_unreg_MCA_extension);
-
-/*
- * ia64_mca_ucmc_handler
- *
- *	This is uncorrectable machine check handler called from OS_MCA
- *	dispatch code which is in turn called from SAL_CHECK().
- *	This is the place where the core of OS MCA handling is done.
- *	Right now the logs are extracted and displayed in a well-defined
- *	format. This handler code is supposed to be run only on the
- *	monarch processor. Once the monarch is done with MCA handling
- *	further MCA logging is enabled by clearing logs.
- *	Monarch also has the duty of sending wakeup-IPIs to pull the
- *	slave processors out of rendezvous spinloop.
- *
- *  Inputs  :   None
- *  Outputs :   None
- */
-void
-ia64_mca_ucmc_handler(void)
-{
-#ifdef XEN
-	int cpu = smp_processor_id();
-	pal_processor_state_info_t *psp = (pal_processor_state_info_t *)
-		&ia64_sal_to_os_handoff_state[cpu].proc_state_param;
-#else
-	pal_processor_state_info_t *psp = (pal_processor_state_info_t *)
-		&ia64_sal_to_os_handoff_state.proc_state_param;
-#endif
-	int recover; 
-
-#ifndef XEN
-	/* Get the MCA error record and log it */
-	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_MCA);
-#else
-	ia64_log_queue(SAL_INFO_TYPE_MCA, VIRQ_MCA_CMC);
-	send_guest_vcpu_virq(dom0->vcpu[0], VIRQ_MCA_CMC);
-#endif
-
-	/* TLB error is only exist in this SAL error record */
-	recover = (psp->tc && !(psp->cc || psp->bc || psp->rc || psp->uc))
-	/* other error recovery */
-#ifndef XEN
-	   || (ia64_mca_ucmc_extension 
-		&& ia64_mca_ucmc_extension(
-			IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA),
-			&ia64_sal_to_os_handoff_state,
-			&ia64_os_to_sal_handoff_state)); 
-#else
-	;
-#endif
-
-#ifndef XEN
-	if (recover) {
-		sal_log_record_header_t *rh = IA64_LOG_CURR_BUFFER(SAL_INFO_TYPE_MCA);
-		rh->severity = sal_log_severity_corrected;
-		ia64_sal_clear_state_info(SAL_INFO_TYPE_MCA);
-	}
-#endif
-	/*
-	 *  Wakeup all the processors which are spinning in the rendezvous
-	 *  loop.
-	 */
-	ia64_mca_wakeup_all();
-
-	/* Return to SAL */
-	ia64_return_to_sal_check(recover);
-}
-
-#ifndef XEN
-static DECLARE_WORK(cmc_disable_work, ia64_mca_cmc_vector_disable_keventd, NULL);
-static DECLARE_WORK(cmc_enable_work, ia64_mca_cmc_vector_enable_keventd, NULL);
-#endif
-
-/*
- * ia64_mca_cmc_int_handler
- *
- *  This is corrected machine check interrupt handler.
- *	Right now the logs are extracted and displayed in a well-defined
- *	format.
- *
- * Inputs
- *      interrupt number
- *      client data arg ptr
- *      saved registers ptr
- *
- * Outputs
- *	None
- */
-static irqreturn_t
-ia64_mca_cmc_int_handler(int cmc_irq, void *arg, struct pt_regs *ptregs)
-{
-	static unsigned long	cmc_history[CMC_HISTORY_LENGTH];
-	static int		index;
-	static DEFINE_SPINLOCK(cmc_history_lock);
-
-	IA64_MCA_DEBUG("%s: received interrupt vector = %#x on CPU %d\n",
-		       __FUNCTION__, cmc_irq, smp_processor_id());
-
-	/* SAL spec states this should run w/ interrupts enabled */
-	local_irq_enable();
-
-#ifndef XEN	
-	/* Get the CMC error record and log it */
-	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC);
-#else
-	ia64_log_queue(SAL_INFO_TYPE_CMC, VIRQ_MCA_CMC);
-	send_guest_vcpu_virq(dom0->vcpu[0], VIRQ_MCA_CMC);
-#endif
-
-	spin_lock(&cmc_history_lock);
-	if (!cmc_polling_enabled) {
-		int i, count = 1; /* we know 1 happened now */
-		unsigned long now = jiffies;
-
-		for (i = 0; i < CMC_HISTORY_LENGTH; i++) {
-			if (now - cmc_history[i] <= HZ)
-				count++;
-		}
-
-		IA64_MCA_DEBUG(KERN_INFO "CMC threshold %d/%d\n", count, CMC_HISTORY_LENGTH);
-		if (count >= CMC_HISTORY_LENGTH) {
-
-			cmc_polling_enabled = 1;
-			spin_unlock(&cmc_history_lock);
-#ifndef XEN	/* XXX FIXME */
-			schedule_work(&cmc_disable_work);
-#else
-			cpumask_raise_softirq(&cpu_online_map,
-			                      CMC_DISABLE_SOFTIRQ);
-#endif
-
-			/*
-			 * Corrected errors will still be corrected, but
-			 * make sure there's a log somewhere that indicates
-			 * something is generating more than we can handle.
-			 */
-			printk(KERN_WARNING "WARNING: Switching to polling CMC handler; error records may be lost\n");
-
-			mod_timer(&cmc_poll_timer, jiffies + CMC_POLL_INTERVAL);
-
-			/* lock already released, get out now */
-			return IRQ_HANDLED;
-		} else {
-			cmc_history[index++] = now;
-			if (index == CMC_HISTORY_LENGTH)
-				index = 0;
-		}
-	}
-	spin_unlock(&cmc_history_lock);
-	return IRQ_HANDLED;
-}
-
-/*
- *  ia64_mca_cmc_int_caller
- *
- * 	Triggered by sw interrupt from CMC polling routine.  Calls
- * 	real interrupt handler and either triggers a sw interrupt
- * 	on the next cpu or does cleanup at the end.
- *
- * Inputs
- *	interrupt number
- *	client data arg ptr
- *	saved registers ptr
- * Outputs
- * 	handled
- */
-static irqreturn_t
-ia64_mca_cmc_int_caller(int cmc_irq, void *arg, struct pt_regs *ptregs)
-{
-	static int start_count = -1;
-	unsigned int cpuid;
-
-	cpuid = smp_processor_id();
-
-	/* If first cpu, update count */
-	if (start_count == -1)
-		start_count = IA64_LOG_COUNT(SAL_INFO_TYPE_CMC);
-
-#ifndef XEN
-	ia64_mca_cmc_int_handler(cmc_irq, arg, ptregs);
-#else
-	IA64_MCA_DEBUG("%s: received polling vector = %#x on CPU %d\n",
-	               __FUNCTION__, cmc_irq, smp_processor_id());
-	ia64_log_queue(SAL_INFO_TYPE_CMC, VIRQ_MCA_CMC);
-#endif
-
-	for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
-
-	if (cpuid < NR_CPUS) {
-		platform_send_ipi(cpuid, IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
-	} else {
-		/* If no log record, switch out of polling mode */
-		if (start_count == IA64_LOG_COUNT(SAL_INFO_TYPE_CMC)) {
-
-			printk(KERN_WARNING "Returning to interrupt driven CMC handler\n");
-#ifndef XEN	/* XXX FIXME */
-			schedule_work(&cmc_enable_work);
-#else
-			cpumask_raise_softirq(&cpu_online_map,
-			                      CMC_ENABLE_SOFTIRQ);
-#endif
-			cmc_polling_enabled = 0;
-
-		} else {
-
-			mod_timer(&cmc_poll_timer, jiffies + CMC_POLL_INTERVAL);
-		}
-
-		start_count = -1;
-	}
-	return IRQ_HANDLED;
-}
-
-/*
- *  ia64_mca_cmc_poll
- *
- *	Poll for Corrected Machine Checks (CMCs)
- *
- * Inputs   :   dummy(unused)
- * Outputs  :   None
- *
- */
-static void
-#ifndef XEN
-ia64_mca_cmc_poll (unsigned long dummy)
-#else
-ia64_mca_cmc_poll (void *dummy)
-#endif
-{
-	/* Trigger a CMC interrupt cascade  */
-	platform_send_ipi(cpumask_first(&cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
-}
-
-/*
- *  ia64_mca_cpe_int_caller
- *
- * 	Triggered by sw interrupt from CPE polling routine.  Calls
- * 	real interrupt handler and either triggers a sw interrupt
- * 	on the next cpu or does cleanup at the end.
- *
- * Inputs
- *	interrupt number
- *	client data arg ptr
- *	saved registers ptr
- * Outputs
- * 	handled
- */
-#ifdef CONFIG_ACPI
-
-static irqreturn_t
-ia64_mca_cpe_int_caller(int cpe_irq, void *arg, struct pt_regs *ptregs)
-{
-	static int start_count = -1;
-#ifdef XEN
-	static unsigned long poll_time = MIN_CPE_POLL_INTERVAL;
-#else
-	static int poll_time = MIN_CPE_POLL_INTERVAL;
-#endif
-	unsigned int cpuid;
-
-	cpuid = smp_processor_id();
-
-	/* If first cpu, update count */
-	if (start_count == -1)
-		start_count = IA64_LOG_COUNT(SAL_INFO_TYPE_CPE);
-
-#ifndef XEN
-	ia64_mca_cpe_int_handler(cpe_irq, arg, ptregs);
-#else
-	IA64_MCA_DEBUG("%s: received polling vector = %#x on CPU %d\n",
-	               __FUNCTION__, cpe_irq, smp_processor_id());
-	ia64_log_queue(SAL_INFO_TYPE_CPE, VIRQ_MCA_CPE);
-#endif
-
-	for (++cpuid ; cpuid < NR_CPUS && !cpu_online(cpuid) ; cpuid++);
-
-	if (cpuid < NR_CPUS) {
-		platform_send_ipi(cpuid, IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
-	} else {
-		/*
-		 * If a log was recorded, increase our polling frequency,
-		 * otherwise, backoff or return to interrupt mode.
-		 */
-		if (start_count != IA64_LOG_COUNT(SAL_INFO_TYPE_CPE)) {
-			poll_time = max(MIN_CPE_POLL_INTERVAL, poll_time / 2);
-		} else if (cpe_vector < 0) {
-			poll_time = min(MAX_CPE_POLL_INTERVAL, poll_time * 2);
-		} else {
-			poll_time = MIN_CPE_POLL_INTERVAL;
-
-			printk(KERN_WARNING "Returning to interrupt driven CPE handler\n");
-			enable_irq(local_vector_to_irq(IA64_CPE_VECTOR));
-			cpe_poll_enabled = 0;
-		}
-
-		if (cpe_poll_enabled)
-			mod_timer(&cpe_poll_timer, jiffies + poll_time);
-		start_count = -1;
-	}
-	return IRQ_HANDLED;
-}
-
-/*
- *  ia64_mca_cpe_poll
- *
- *	Poll for Corrected Platform Errors (CPEs), trigger interrupt
- *	on first cpu, from there it will trickle through all the cpus.
- *
- * Inputs   :   dummy(unused)
- * Outputs  :   None
- *
- */
-static void
-#ifndef XEN
-ia64_mca_cpe_poll (unsigned long dummy)
-#else
-ia64_mca_cpe_poll (void *dummy)
-#endif
-{
-	/* Trigger a CPE interrupt cascade  */
-	platform_send_ipi(cpumask_first(&cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
-}
-
-#endif /* CONFIG_ACPI */
-
-/*
- * C portion of the OS INIT handler
- *
- * Called from ia64_monarch_init_handler
- *
- * Inputs: pointer to pt_regs where processor info was saved.
- *
- * Returns:
- *   0 if SAL must warm boot the System
- *   1 if SAL must return to interrupted context using PAL_MC_RESUME
- *
- */
-void
-ia64_init_handler (struct pt_regs *pt, struct switch_stack *sw)
-{
-	pal_min_state_area_t *ms;
-

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004XF-4g; Fri, 06 Apr 2012 02:33: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 1SFyzO-0004TB-3i
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:26 +0000
Received: from [85.158.143.99:18563] by server-3.bemta-4.messagelabs.com id
	B7/A7-05853-5F55E7F4; Fri, 06 Apr 2012 02:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1333679603!17288064!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8265 invoked from network); 6 Apr 2012 02:33:24 -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;
	6 Apr 2012 02:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzK-0003NU-Ll
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzK-0008Nn-Fd
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Message-Id: <E1SFyzK-0008Nn-Fd@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: add error code to
	indicate iommem passthrough
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333120147 -7200
# Node ID 4d4c0e57bd83ebf28cff7c3a0fee75a488762753
# Parent  83d3b4e2eb16c7b718f970ffacf62bf8755c6623
xenpaging: add error code to indicate iommem passthrough

Similar to the existing ENODEV and EXDEV error codes, add EMDEV to
indicate that iommu passthrough is not compatible with paging.
All error codes are just made-up return codes to give proper error
messages in the pager.

Also update the HAP related error message now that paging is enabled
also on AMD hosts.

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


diff -r 83d3b4e2eb16 -r 4d4c0e57bd83 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Wed Feb 22 17:37:50 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Fri Mar 30 17:09:07 2012 +0200
@@ -378,7 +378,10 @@ static struct xenpaging *xenpaging_init(
                 ERROR("xenpaging is (or was) active on this domain");
                 break;
             case ENODEV:
-                ERROR("EPT not supported for this guest");
+                ERROR("xenpaging requires Hardware Assisted Paging");
+                break;
+            case EMLINK:
+                ERROR("xenpaging not supported while iommu passthrough is enabled");
                 break;
             case EXDEV:
                 ERROR("xenpaging not supported in a PoD guest");
diff -r 83d3b4e2eb16 -r 4d4c0e57bd83 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Wed Feb 22 17:37:50 2012 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Fri Mar 30 17:09:07 2012 +0200
@@ -564,10 +564,11 @@ int mem_event_domctl(struct domain *d, x
                 break;
 
             /* No paging if iommu is used */
-            rc = -EXDEV;
+            rc = -EMLINK;
             if ( unlikely(need_iommu(d)) )
                 break;
 
+            rc = -EXDEV;
             /* Disallow paging in a PoD guest */
             if ( p2m->pod.entry_count )
                 break;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004XF-4g; Fri, 06 Apr 2012 02:33: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 1SFyzO-0004TB-3i
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:26 +0000
Received: from [85.158.143.99:18563] by server-3.bemta-4.messagelabs.com id
	B7/A7-05853-5F55E7F4; Fri, 06 Apr 2012 02:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1333679603!17288064!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8265 invoked from network); 6 Apr 2012 02:33:24 -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;
	6 Apr 2012 02:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzK-0003NU-Ll
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzK-0008Nn-Fd
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:22 +0000
Message-Id: <E1SFyzK-0008Nn-Fd@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: add error code to
	indicate iommem passthrough
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333120147 -7200
# Node ID 4d4c0e57bd83ebf28cff7c3a0fee75a488762753
# Parent  83d3b4e2eb16c7b718f970ffacf62bf8755c6623
xenpaging: add error code to indicate iommem passthrough

Similar to the existing ENODEV and EXDEV error codes, add EMDEV to
indicate that iommu passthrough is not compatible with paging.
All error codes are just made-up return codes to give proper error
messages in the pager.

Also update the HAP related error message now that paging is enabled
also on AMD hosts.

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


diff -r 83d3b4e2eb16 -r 4d4c0e57bd83 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Wed Feb 22 17:37:50 2012 +0100
+++ b/tools/xenpaging/xenpaging.c	Fri Mar 30 17:09:07 2012 +0200
@@ -378,7 +378,10 @@ static struct xenpaging *xenpaging_init(
                 ERROR("xenpaging is (or was) active on this domain");
                 break;
             case ENODEV:
-                ERROR("EPT not supported for this guest");
+                ERROR("xenpaging requires Hardware Assisted Paging");
+                break;
+            case EMLINK:
+                ERROR("xenpaging not supported while iommu passthrough is enabled");
                 break;
             case EXDEV:
                 ERROR("xenpaging not supported in a PoD guest");
diff -r 83d3b4e2eb16 -r 4d4c0e57bd83 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Wed Feb 22 17:37:50 2012 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Fri Mar 30 17:09:07 2012 +0200
@@ -564,10 +564,11 @@ int mem_event_domctl(struct domain *d, x
                 break;
 
             /* No paging if iommu is used */
-            rc = -EXDEV;
+            rc = -EMLINK;
             if ( unlikely(need_iommu(d)) )
                 break;
 
+            rc = -EXDEV;
             /* Disallow paging in a PoD guest */
             if ( p2m->pod.entry_count )
                 break;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004XN-7M; Fri, 06 Apr 2012 02:33: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 1SFyzO-0004Q8-8V
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:26 +0000
Received: from [85.158.143.99:18583] by server-1.bemta-4.messagelabs.com id
	DE/63-20925-6F55E7F4; Fri, 06 Apr 2012 02:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1333679603!22559765!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26290 invoked from network); 6 Apr 2012 02:33:24 -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;
	6 Apr 2012 02:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0003NX-AL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0008O2-1k
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Message-Id: <E1SFyzL-0008O2-1k@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] domctl.h: document non-standard
	error codes for enabling paging/access
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333466579 -7200
# Node ID 80e3ac42e5a1f1974afaff0292b69199dba589cb
# Parent  4d4c0e57bd83ebf28cff7c3a0fee75a488762753
domctl.h: document non-standard error codes for enabling paging/access

The domctl to enable paging and access returns some non-standard error
codes after failure. This can be used in the tools to print specific
error messages. xenpaging recognizes these errno values and shows them
if the init function fails.

Document the return codes in the public header file.

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


diff -r 4d4c0e57bd83 -r 80e3ac42e5a1 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Fri Mar 30 17:09:07 2012 +0200
+++ b/xen/include/public/domctl.h	Tue Apr 03 17:22:59 2012 +0200
@@ -716,6 +716,13 @@ struct xen_domctl_gdbsx_domstatus {
  * Domctl interface to set up and tear down the 
  * pager<->hypervisor interface. Use XENMEM_paging_op*
  * to perform per-page operations.
+ *
+ * The XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE domctl returns several
+ * non-standard error codes to indicate why paging could not be enabled:
+ * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
+ * EMLINK - guest has iommu passthrough enabled
+ * EXDEV  - guest has PoD enabled
+ * EBUSY  - guest has or had paging enabled, ring buffer still active
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING            1
 
@@ -735,6 +742,11 @@ struct xen_domctl_gdbsx_domstatus {
  *
  * The memory event handler can then resume the VCPU and redo the access 
  * with a XENMEM_access_op_resume hypercall.
+ *
+ * The XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE domctl returns several
+ * non-standard error codes to indicate why access could not be enabled:
+ * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
+ * EBUSY  - guest has or had access enabled, ring buffer still active
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS            2
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004XN-7M; Fri, 06 Apr 2012 02:33: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 1SFyzO-0004Q8-8V
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:26 +0000
Received: from [85.158.143.99:18583] by server-1.bemta-4.messagelabs.com id
	DE/63-20925-6F55E7F4; Fri, 06 Apr 2012 02:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1333679603!22559765!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26290 invoked from network); 6 Apr 2012 02:33:24 -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;
	6 Apr 2012 02:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0003NX-AL
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0008O2-1k
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Message-Id: <E1SFyzL-0008O2-1k@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] domctl.h: document non-standard
	error codes for enabling paging/access
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333466579 -7200
# Node ID 80e3ac42e5a1f1974afaff0292b69199dba589cb
# Parent  4d4c0e57bd83ebf28cff7c3a0fee75a488762753
domctl.h: document non-standard error codes for enabling paging/access

The domctl to enable paging and access returns some non-standard error
codes after failure. This can be used in the tools to print specific
error messages. xenpaging recognizes these errno values and shows them
if the init function fails.

Document the return codes in the public header file.

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


diff -r 4d4c0e57bd83 -r 80e3ac42e5a1 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Fri Mar 30 17:09:07 2012 +0200
+++ b/xen/include/public/domctl.h	Tue Apr 03 17:22:59 2012 +0200
@@ -716,6 +716,13 @@ struct xen_domctl_gdbsx_domstatus {
  * Domctl interface to set up and tear down the 
  * pager<->hypervisor interface. Use XENMEM_paging_op*
  * to perform per-page operations.
+ *
+ * The XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE domctl returns several
+ * non-standard error codes to indicate why paging could not be enabled:
+ * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
+ * EMLINK - guest has iommu passthrough enabled
+ * EXDEV  - guest has PoD enabled
+ * EBUSY  - guest has or had paging enabled, ring buffer still active
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING            1
 
@@ -735,6 +742,11 @@ struct xen_domctl_gdbsx_domstatus {
  *
  * The memory event handler can then resume the VCPU and redo the access 
  * with a XENMEM_access_op_resume hypercall.
+ *
+ * The XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE domctl returns several
+ * non-standard error codes to indicate why access could not be enabled:
+ * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
+ * EBUSY  - guest has or had access enabled, ring buffer still active
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS            2
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004Xm-Do; Fri, 06 Apr 2012 02:33: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 1SFyzO-0004TB-Jc
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:26 +0000
Received: from [85.158.143.99:32811] by server-3.bemta-4.messagelabs.com id
	19/A7-05853-6F55E7F4; Fri, 06 Apr 2012 02:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1333679604!12810379!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12835 invoked from network); 6 Apr 2012 02:33:25 -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;
	6 Apr 2012 02:33:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0003Nb-PC
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0008OH-L2
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Message-Id: <E1SFyzL-0008OH-L2@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Take care of domain
	reference for shared pages
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1333620363 -3600
# Node ID d690c7e896a26c54a5ab85458824059de72d5cba
# Parent  80e3ac42e5a1f1974afaff0292b69199dba589cb
x86/mm: Take care of domain reference for shared pages

Making a page sharable removes it from the previous owner's list. Making it
private adds it. These actions are similar to freeing or allocating a page.
Except that they were not minding the domain reference that is taken/dropped
when the first/last page is allocated/freed.

Without fixing this, a domain might remain zombie when destroyed if all its
pages are shared.

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


diff -r 80e3ac42e5a1 -r d690c7e896a2 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Tue Apr 03 17:22:59 2012 +0200
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Apr 05 11:06:03 2012 +0100
@@ -401,6 +401,7 @@ static int page_make_sharable(struct dom
                        struct page_info *page, 
                        int expected_refcnt)
 {
+    int drop_dom_ref;
     spin_lock(&d->page_alloc_lock);
 
     /* Change page type and count atomically */
@@ -430,8 +431,12 @@ static int page_make_sharable(struct dom
 
     page_set_owner(page, dom_cow);
     d->tot_pages--;
+    drop_dom_ref = (d->tot_pages == 0);
     page_list_del(page, &d->page_list);
     spin_unlock(&d->page_alloc_lock);
+
+    if ( drop_dom_ref )
+        put_domain(d);
     return 0;
 }
 
@@ -466,7 +471,8 @@ static int page_make_private(struct doma
     ASSERT(page_get_owner(page) == dom_cow);
     page_set_owner(page, d);
 
-    d->tot_pages++;
+    if ( d->tot_pages++ == 0 )
+        get_domain(d);
     page_list_add_tail(page, &d->page_list);
     spin_unlock(&d->page_alloc_lock);
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004Xm-Do; Fri, 06 Apr 2012 02:33: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 1SFyzO-0004TB-Jc
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:26 +0000
Received: from [85.158.143.99:32811] by server-3.bemta-4.messagelabs.com id
	19/A7-05853-6F55E7F4; Fri, 06 Apr 2012 02:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1333679604!12810379!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12835 invoked from network); 6 Apr 2012 02:33:25 -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;
	6 Apr 2012 02:33:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0003Nb-PC
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzL-0008OH-L2
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:23 +0000
Message-Id: <E1SFyzL-0008OH-L2@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Take care of domain
	reference for shared pages
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1333620363 -3600
# Node ID d690c7e896a26c54a5ab85458824059de72d5cba
# Parent  80e3ac42e5a1f1974afaff0292b69199dba589cb
x86/mm: Take care of domain reference for shared pages

Making a page sharable removes it from the previous owner's list. Making it
private adds it. These actions are similar to freeing or allocating a page.
Except that they were not minding the domain reference that is taken/dropped
when the first/last page is allocated/freed.

Without fixing this, a domain might remain zombie when destroyed if all its
pages are shared.

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


diff -r 80e3ac42e5a1 -r d690c7e896a2 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Tue Apr 03 17:22:59 2012 +0200
+++ b/xen/arch/x86/mm/mem_sharing.c	Thu Apr 05 11:06:03 2012 +0100
@@ -401,6 +401,7 @@ static int page_make_sharable(struct dom
                        struct page_info *page, 
                        int expected_refcnt)
 {
+    int drop_dom_ref;
     spin_lock(&d->page_alloc_lock);
 
     /* Change page type and count atomically */
@@ -430,8 +431,12 @@ static int page_make_sharable(struct dom
 
     page_set_owner(page, dom_cow);
     d->tot_pages--;
+    drop_dom_ref = (d->tot_pages == 0);
     page_list_del(page, &d->page_list);
     spin_unlock(&d->page_alloc_lock);
+
+    if ( drop_dom_ref )
+        put_domain(d);
     return 0;
 }
 
@@ -466,7 +471,8 @@ static int page_make_private(struct doma
     ASSERT(page_get_owner(page) == dom_cow);
     page_set_owner(page, d);
 
-    d->tot_pages++;
+    if ( d->tot_pages++ == 0 )
+        get_domain(d);
     page_list_add_tail(page, &d->page_list);
     spin_unlock(&d->page_alloc_lock);
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004YN-LW; Fri, 06 Apr 2012 02:33:28 +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 1SFyzO-0004Uj-Vy
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:27 +0000
Received: from [193.109.254.147:2377] by server-1.bemta-14.messagelabs.com id
	55/26-29372-6F55E7F4; Fri, 06 Apr 2012 02:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1333679600!3470662!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23459 invoked from network); 6 Apr 2012 02:33:21 -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;
	6 Apr 2012 02:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0003NF-NQ
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0008MX-KO
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Message-Id: <E1SFyzH-0008MX-KO@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PV-GRUB: add support for btrfs
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Matt Wilson <msw@amazon.com>
# Date 1333534155 -3600
# Node ID c2954b4acd69deae140328772028c8ef45818ae4
# Parent  d1c985425e7841891ec1e3c0d4dc224be7b8d3cc
PV-GRUB: add support for btrfs

This patch adds btrfs support to the GRUB tree used to build PV-GRUB.
The original patch is from Gentoo:
https://bugs.gentoo.org/show_bug.cgi?id=283637

Signed-off-by: Matt Wilson <msw@amazon.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r d1c985425e78 -r c2954b4acd69 stubdom/grub.patches/61btrfs.diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/grub.patches/61btrfs.diff	Wed Apr 04 11:09:15 2012 +0100
@@ -0,0 +1,3512 @@
+diff -up grub-upstream.wip/AUTHORS.btrfs grub-upstream.wip/AUTHORS
+--- grub-upstream.wip/AUTHORS.btrfs	2004-03-27 16:25:17.000000000 +0000
++++ grub-upstream.wip/AUTHORS	2012-03-20 05:07:09.000000000 +0000
+@@ -41,6 +41,8 @@ Kristoffer Branemyr added VSTa filesyste
+ 
+ Serguei Tzukanov added JFS and XFS support.
+ 
++Edward Shishkin added Btrfs support.
++
+ Jason Thomas added Linux DAC960 support and support for hiding/unhiding
+ logical partitions, and did a significant bugfix for the terminal stuff.
+ 
+diff -up grub-upstream.wip/configure.ac.btrfs grub-upstream.wip/configure.ac
+--- grub-upstream.wip/configure.ac.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/configure.ac	2012-03-20 05:07:09.000000000 +0000
+@@ -274,6 +274,13 @@ if test x"$enable_reiserfs" != xno; then
+   FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"
+ fi
+ 
++AC_ARG_ENABLE(btrfs,
++  [  --disable-btrfs         disable BtrFS support in Stage 2])
++
++if test x"$enable_btrfs" != xno; then
++  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_BTRFS=1"
++fi
++
+ AC_ARG_ENABLE(vstafs,
+   [  --disable-vstafs        disable VSTa FS support in Stage 2])
+ 
+diff -up grub-upstream.wip/docs/grub.texi.btrfs grub-upstream.wip/docs/grub.texi
+--- grub-upstream.wip/docs/grub.texi.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/docs/grub.texi	2012-03-20 05:07:09.000000000 +0000
+@@ -1761,6 +1761,7 @@ itself. Usually, this is put in a filesy
+ @itemx jfs_stage1_5
+ @itemx minix_stage1_5
+ @itemx reiserfs_stage1_5
++@itemx btrfs_stage1_5
+ @itemx vstafs_stage1_5
+ @itemx xfs_stage1_5
+ 
+diff -up grub-upstream.wip/grub/Makefile.am.btrfs grub-upstream.wip/grub/Makefile.am
+--- grub-upstream.wip/grub/Makefile.am.btrfs	2005-02-02 20:38:19.000000000 +0000
++++ grub-upstream.wip/grub/Makefile.am	2012-03-20 05:07:09.000000000 +0000
+@@ -8,7 +8,7 @@ endif
+ 
+ AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
+ 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
+-	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
++	-DFSYS_BTRFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+ 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
+ 	$(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \
+ 	-I$(top_srcdir)/stage1 -I$(top_srcdir)/lib
+diff -up grub-upstream.wip/INSTALL.btrfs grub-upstream.wip/INSTALL
+--- grub-upstream.wip/INSTALL.btrfs	2005-05-08 02:43:15.000000000 +0000
++++ grub-upstream.wip/INSTALL	2012-03-20 05:07:09.000000000 +0000
+@@ -207,6 +207,9 @@ operates.
+ `--disable-reiserfs'
+      Omit the ReiserFS support in Stage 2.
+ 
++`--disable-btrfs'
++     Omit the BtrFS support in Stage 2.
++
+ `--disable-vstafs'
+      Omit the VSTa filesystem support in Stage 2.
+ 
+diff -up /dev/null grub-upstream.wip/stage2/btrfs.h
+--- /dev/null	2009-06-03 06:46:26.160951000 +0000
++++ grub-upstream.wip/stage2/btrfs.h	2012-03-20 05:07:09.000000000 +0000
+@@ -0,0 +1,1415 @@
++/* btrfs.h - an extraction from btrfs-progs-0.18/ctree.h into one file
++ *
++ * Copyright (C) 2007 Oracle.  All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public
++ * License v2 as published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public
++ * License along with this program; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 021110-1307, USA.
++ */
++
++/* include/asm-i386/types.h */
++
++typedef __signed__ char __s8;
++typedef unsigned char __u8;
++typedef __signed__ short __s16;
++typedef unsigned short __u16;
++typedef __signed__ int __s32;
++typedef unsigned int __u32;
++typedef unsigned long long __u64;
++typedef __signed__ long long __s64;
++
++typedef __s8 s8;
++typedef __u8 u8;
++typedef __u16 u16;
++typedef __u32 u32;
++typedef __u64 u64;
++typedef __s64 s64;
++
++#define __bitwise
++
++typedef u16 __bitwise __le16;
++typedef u32 __bitwise __le32;
++typedef u64 __bitwise __le64;
++
++/* linux/posix_type.h */
++typedef long linux_off_t;
++
++/* linux/little_endian.h */
++#define cpu_to_le64(x) ((__u64) (x))
++#define le64_to_cpu(x) ((__u64) (x))
++#define cpu_to_le32(x) ((__u32) (x))
++#define le32_to_cpu(x) ((__u32) (x))
++#define cpu_to_le16(x) ((__u16) (x))
++#define le16_to_cpu(x) ((__u16) (x))
++#define le8_to_cpu(x) ((__u8) (x))
++#define cpu_to_le8(x) ((__u8) (x))
++
++/* linux/stat.h */
++#define S_IFMT  00170000
++#define S_IFLNK  0120000
++#define S_IFREG  0100000
++#define S_IFDIR  0040000
++#define S_ISLNK(m)     (((m) & S_IFMT) == S_IFLNK)
++#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
++#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
++
++struct btrfs_root;
++#define BTRFS_MAGIC "_BHRfS_M"
++
++#define BTRFS_SUPER_INFO_OFFSET (64 * 1024)
++#define BTRFS_SUPER_INFO_SIZE 4096
++
++#define BTRFS_SUPER_MIRROR_MAX  3
++#define BTRFS_SUPER_MIRROR_SHIFT 12
++
++#define PATH_MAX                1024   /* include/linux/limits.h */
++#define MAX_LINK_COUNT             5   /* number of symbolic links
++                                          to follow */
++#define BTRFS_MAX_LEVEL 8
++#define BTRFS_ROOT_TREE_OBJECTID 1ULL
++#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
++#define BTRFS_CHUNK_TREE_OBJECTID 3ULL
++#define BTRFS_DEV_TREE_OBJECTID 4ULL
++#define BTRFS_FS_TREE_OBJECTID 5ULL
++#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
++#define BTRFS_CSUM_TREE_OBJECTID 7ULL
++
++#define BTRFS_ORPHAN_OBJECTID -5ULL
++#define BTRFS_TREE_LOG_OBJECTID -6ULL
++#define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL
++#define BTRFS_TREE_RELOC_OBJECTID -8ULL
++#define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL
++#define BTRFS_EXTENT_CSUM_OBJECTID -10ULL
++
++#define BTRFS_MULTIPLE_OBJECTIDS -255ULL
++#define BTRFS_FIRST_FREE_OBJECTID 256ULL
++#define BTRFS_LAST_FREE_OBJECTID -256ULL
++#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
++#define BTRFS_DEV_ITEMS_OBJECTID 1ULL
++
++
++#define BTRFS_NAME_LEN 255
++#define BTRFS_CSUM_SIZE 32
++#define BTRFS_CSUM_TYPE_CRC32  0
++
++static int btrfs_csum_sizes[] = { 4, 0 };
++
++/* four bytes for CRC32 */
++#define BTRFS_CRC32_SIZE 4
++#define BTRFS_EMPTY_DIR_SIZE 0
++
++#define BTRFS_FT_UNKNOWN       0
++#define BTRFS_FT_REG_FILE      1
++#define BTRFS_FT_DIR           2
++#define BTRFS_FT_CHRDEV                3
++#define BTRFS_FT_BLKDEV                4
++#define BTRFS_FT_FIFO          5
++#define BTRFS_FT_SOCK          6
++#define BTRFS_FT_SYMLINK       7
++#define BTRFS_FT_XATTR         8
++#define BTRFS_FT_MAX           9
++
++#define BTRFS_UUID_SIZE 16
++
++#define BTRFS_DEFAULT_NUM_DEVICES     1
++#define BTRFS_DEFAULT_NODE_SIZE       4096
++#define BTRFS_DEFAULT_LEAF_SIZE       4096
++#define BTRFS_NUM_CACHED_DEVICES      128
++
++#define WARN_ON(c)
++#define cassert(cond) ({ switch (-1) { case (cond): case 0: break; } })
++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
++
++#define offsetof(type, memb) \
++       ((unsigned long)(&((type *)0)->memb))
++
++struct btrfs_disk_key {
++       __le64 objectid;
++       u8 type;
++       __le64 offset;
++} __attribute__ ((__packed__));
++
++/* cpu key */
++struct btrfs_key {
++       u64 objectid;
++       u8 type;
++       u64 offset;
++} __attribute__ ((__packed__));
++
++/* this represents a divice in a chunk tree */
++struct btrfs_dev_item {
++       __le64 devid; /* internal device id */
++       __le64 total_bytes; /* size of the device */
++       __le64 bytes_used;
++       __le32 io_align; /* optimal io alignment */
++       __le32 io_width; /* optimal io width */
++       __le32 sector_size; /* minimal io size */
++       __le64 type; /* type and info about this device */
++       __le64 generation; /* expected generation */
++        __le64 start_offset; /* of the partition on a device */
++
++       /* info for allocation decisions */
++       __le32 dev_group;
++
++        u8 seek_speed; /* 0-100 (100 is fastest) */
++       u8 bandwidth;  /* 0-100 (100 is fastest) */
++
++        u8 uuid[BTRFS_UUID_SIZE]; /* dev uuid generated by btrfs */
++       u8 fsid[BTRFS_UUID_SIZE]; /* uuid of the host FS */
++} __attribute__ ((__packed__));
++
++struct btrfs_stripe {
++       __le64 devid;
++       __le64 offset;
++       u8 dev_uuid[BTRFS_UUID_SIZE];
++} __attribute__ ((__packed__));
++
++struct btrfs_chunk {
++       /* size of this chunk in bytes */
++       __le64 length;
++       __le64 owner; /* objectid of the root referincing this chunk */
++       __le64 stripe_len;
++       __le64 type;
++       __le32 io_align; /* optimal io alignment for this chunk */
++       __le32 io_width; /* optimal io width for this chunk */
++       __le32 sector_size; /* minimal io size for this chunk */
++       __le16 num_stripes;
++       __le16 sub_stripes; /* sub stripes (for raid10) */
++       struct btrfs_stripe stripe;
++} __attribute__ ((__packed__));
++
++static inline unsigned long btrfs_chunk_item_size(int num_stripes)
++{
++       return sizeof(struct btrfs_chunk) +
++               sizeof(struct btrfs_stripe) * (num_stripes - 1);
++}
++
++#define BTRFS_FSID_SIZE 16
++#define BTRFS_HEADER_FLAG_WRITTEN (1 << 0)
++
++struct btrfs_header {
++       /* these first four must match the super block */
++       u8 csum[BTRFS_CSUM_SIZE];
++       u8 fsid[BTRFS_FSID_SIZE]; /* uuid of the host fs */
++       __le64 bytenr; /* which block this node is supposed to live in */
++       __le64 flags;
++
++       /* allowed to be different from the super from here on down */
++       u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
++       __le64 generation;
++       __le64 owner;
++       __le32 nritems;
++       u8 level;
++} __attribute__ ((__packed__));
++
++#define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->nodesize - \
++                               sizeof(struct btrfs_header)) / \
++                               sizeof(struct btrfs_key_ptr))
++#define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
++#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->leafsize))
++#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
++                                       sizeof(struct btrfs_item) - \
++                                       sizeof(struct btrfs_file_extent_item))
++
++#define BTRFS_SUPER_FLAG_SEEDING       (1ULL << 32)
++#define BTRFS_SUPER_FLAG_METADUMP      (1ULL << 33)
++
++/*
++ * a portion of superblock which is used
++ * for chunk translation (up to 14 chunks
++ * with 3 stripes each.
++ */
++#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
++#define BTRFS_LABEL_SIZE 256
++
++/*
++ * the super block basically lists the main trees of the FS
++ * it currently lacks any block count etc etc
++ */
++
++struct btrfs_super_block {
++       u8 csum[BTRFS_CSUM_SIZE];
++       /* the first 3 fields must match struct btrfs_header */
++       u8 fsid[BTRFS_FSID_SIZE];    /* FS specific uuid */
++       __le64 bytenr; /* this block number */
++       __le64 flags;
++
++       /* allowed to be different from the btrfs_header from here own down */
++       __le64 magic;
++       __le64 generation;
++       __le64 root;        /* tree root */
++       __le64 chunk_root;
++       __le64 log_root;
++
++       /* this will help find the new super based on the log root */
++       __le64 log_root_transid;
++       __le64 total_bytes;
++       __le64 bytes_used;
++       __le64 root_dir_objectid;
++       __le64 num_devices;
++       __le32 sectorsize;
++       __le32 nodesize;
++       __le32 leafsize;
++       __le32 stripesize;
++       __le32 sys_chunk_array_size;
++       __le64 chunk_root_generation;
++       __le64 compat_flags;
++       __le64 compat_ro_flags;
++       __le64 incompat_flags;
++       __le16 csum_type;
++       u8 root_level;
++       u8 chunk_root_level;
++       u8 log_root_level;
++       struct btrfs_dev_item dev_item;
++
++       char label[BTRFS_LABEL_SIZE];
++
++       /* future expansion */
++       __le64 reserved[32];
++       u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
++} __attribute__ ((__packed__));
++
++/*
++ * Compat flags that we support.  If any incompat flags are set other than the
++ * ones specified below then we will fail to mount
++ */
++#define BTRFS_FEATURE_COMPAT_SUPP      0x0
++#define BTRFS_FEATURE_COMPAT_RO_SUPP   0x0
++#define BTRFS_FEATURE_INCOMPAT_SUPP    0x0
++
++/* Item header for per-leaf lookup */
++struct btrfs_item {
++       struct btrfs_disk_key key;
++       __le32 offset;
++       __le32 size;
++} __attribute__ ((__packed__));
++
++/*
++ * Format of the leaves:
++ * [item0, item1....itemN] [free space] [dataN...data1, data0]
++ */
++struct btrfs_leaf {
++       struct btrfs_header header;
++       struct btrfs_item items[];
++} __attribute__ ((__packed__));
++
++/*
++ * keys-pointers pairs for per-node (non-leaf) lookup
++ */
++struct btrfs_key_ptr {
++       struct btrfs_disk_key key;
++       __le64 blockptr;
++       __le64 generation;
++} __attribute__ ((__packed__));
++
++struct btrfs_node {
++       struct btrfs_header header;
++       struct btrfs_key_ptr ptrs[];
++} __attribute__ ((__packed__));
++
++struct btrfs_device {
++	/* the internal btrfs device id */
++	u64 devid;
++	/* the internal grub device representation */
++	unsigned long drive;
++	unsigned long part;
++	unsigned long length;
++};
++
++struct extent_buffer {
++       /* metadata */
++       struct btrfs_device dev;
++       u64 start;
++       u64 dev_bytenr;
++       u32 len;
++       /* data */
++       char *data;
++};
++
++static inline void read_extent_buffer(struct extent_buffer *eb,
++                                     void *dst, unsigned long start,
++                                     unsigned long len)
++{
++       memcpy(dst, eb->data + start, len);
++}
++
++static inline void write_extent_buffer(struct extent_buffer *eb,
++                                      const void *src, unsigned long start,
++                                      unsigned long len)
++{
++       memcpy(eb->data + start, src, len);
++}
++
++/*
++ * NOTE:
++ * don't increase a number of levels for grub-0.97!
++ */
++typedef enum {
++       FIRST_EXTERNAL_LOOKUP_POOL,
++       SECOND_EXTERNAL_LOOKUP_POOL,
++       INTERNAL_LOOKUP_POOL,
++       LAST_LOOKUP_POOL
++} lookup_pool_id;
++
++/*             Relationship between lookup pools:
++ *  depth
++ *
++ *    ^             +----> INTERNAL <----+
++ *    |             |                    |
++ *    |             |                    |
++ *    -        FIRST_EXTERNAL     SECOND_EXTERNAL
++ */
++
++struct btrfs_path {
++       lookup_pool_id lpid;
++       struct extent_buffer nodes[BTRFS_MAX_LEVEL];
++       int slots[BTRFS_MAX_LEVEL];
++};
++
++/*
++ * items in the extent btree are used to record the objectid of the
++ * owner of the block and the number of references
++ */
++struct btrfs_extent_item {
++       __le32 refs;
++} __attribute__ ((__packed__));
++
++struct btrfs_extent_ref {
++       __le64 root;
++       __le64 generation;
++       __le64 objectid;
++       __le32 num_refs;
++} __attribute__ ((__packed__));
++
++/* dev extents record free space on individual devices.  The owner
++ * field points back to the chunk allocation mapping tree that allocated
++ * the extent.  The chunk tree uuid field is a way to double check the owner
++ */
++struct btrfs_dev_extent {
++       __le64 chunk_tree;
++       __le64 chunk_objectid;
++       __le64 chunk_offset;
++       __le64 length;
++       u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
++} __attribute__ ((__packed__));
++
++struct btrfs_inode_ref {
++       __le64 index;
++       __le16 name_len;
++       /* name goes here */
++} __attribute__ ((__packed__));
++
++struct btrfs_timespec {
++       __le64 sec;
++       __le32 nsec;
++} __attribute__ ((__packed__));
++
++typedef enum {
++       BTRFS_COMPRESS_NONE = 0,
++       BTRFS_COMPRESS_ZLIB = 1,
++       BTRFS_COMPRESS_LAST = 2,
++} btrfs_compression_type;
++
++/* we don't understand any encryption methods right now */
++typedef enum {
++       BTRFS_ENCRYPTION_NONE = 0,
++       BTRFS_ENCRYPTION_LAST = 1,
++} btrfs_encryption_type;
++
++struct btrfs_inode_item {
++       /* nfs style generation number */
++       __le64 generation;
++       /* transid that last touched this inode */
++       __le64 transid;
++       __le64 size;
++       __le64 nbytes;
++       __le64 block_group;
++       __le32 nlink;
++       __le32 uid;
++       __le32 gid;
++       __le32 mode;
++       __le64 rdev;
++       __le64 flags;
++
++       /* modification sequence number for NFS */
++       __le64 sequence;
++
++       /*
++        * a little future expansion, for more than this we can
++        * just grow the inode item and version it
++        */
++       __le64 reserved[4];
++       struct btrfs_timespec atime;
++       struct btrfs_timespec ctime;
++       struct btrfs_timespec mtime;
++       struct btrfs_timespec otime;
++} __attribute__ ((__packed__));
++
++struct btrfs_dir_item {
++       struct btrfs_disk_key location;
++       __le64 transid;
++       __le16 data_len;
++       __le16 name_len;
++       u8 type;
++} __attribute__ ((__packed__));
++
++struct btrfs_root_item {
++       struct btrfs_inode_item inode;
++       __le64 generation;
++       __le64 root_dirid;
++       __le64 bytenr;
++       __le64 byte_limit;
++       __le64 bytes_used;
++       __le64 last_snapshot;
++       __le64 flags;
++       __le32 refs;
++       struct btrfs_disk_key drop_progress;
++       u8 drop_level;
++       u8 level;
++} __attribute__ ((__packed__));
++
++/*
++ * this is used for both forward and backward root refs
++ */
++struct btrfs_root_ref {
++       __le64 dirid;
++       __le64 sequence;
++       __le16 name_len;
++} __attribute__ ((__packed__));
++
++#define BTRFS_FILE_EXTENT_INLINE 0
++#define BTRFS_FILE_EXTENT_REG 1
++#define BTRFS_FILE_EXTENT_PREALLOC 2
++
++struct btrfs_file_extent_item {
++       /*
++        * transaction id that created this extent
++        */
++       __le64 generation;
++       /*
++        * max number of bytes to hold this extent in ram
++        * when we split a compressed extent we can't know how big
++        * each of the resulting pieces will be.  So, this is
++        * an upper limit on the size of the extent in ram instead of
++        * an exact limit.
++        */
++       __le64 ram_bytes;
++
++       /*
++        * 32 bits for the various ways we might encode the data,
++        * including compression and encryption.  If any of these
++        * are set to something a given disk format doesn't understand
++        * it is treated like an incompat flag for reading and writing,
++        * but not for stat.
++        */
++       u8 compression;
++       u8 encryption;
++       __le16 other_encoding; /* spare for later use */
++
++       /* are we inline data or a real extent? */
++       u8 type;
++
++       /*
++        * disk space consumed by the extent, checksum blocks are included
++        * in these numbers
++        */
++       __le64 disk_bytenr;
++       __le64 disk_num_bytes;
++       /*
++        * the logical offset in file blocks (no csums)
++        * this extent record is for.  This allows a file extent to point
++        * into the middle of an existing extent on disk, sharing it
++        * between two snapshots (useful if some bytes in the middle of the
++        * extent have changed
++        */
++       __le64 offset;
++       /*
++        * the logical number of file blocks (no csums included)
++        */
++       __le64 num_bytes;
++
++} __attribute__ ((__packed__));
++
++struct btrfs_csum_item {
++       u8 csum;
++} __attribute__ ((__packed__));
++
++/* tag for the radix tree of block groups in ram */
++#define BTRFS_BLOCK_GROUP_DATA     (1 << 0)
++#define BTRFS_BLOCK_GROUP_SYSTEM   (1 << 1)
++#define BTRFS_BLOCK_GROUP_METADATA (1 << 2)
++#define BTRFS_BLOCK_GROUP_RAID0    (1 << 3)
++#define BTRFS_BLOCK_GROUP_RAID1    (1 << 4)
++#define BTRFS_BLOCK_GROUP_DUP     (1 << 5)
++#define BTRFS_BLOCK_GROUP_RAID10   (1 << 6)
++
++struct btrfs_block_group_item {
++       __le64 used;
++       __le64 chunk_objectid;
++       __le64 flags;
++} __attribute__ ((__packed__));
++
++/*
++ * in ram representation of the tree.  extent_root is used for all allocations
++ * and for the extent tree extent_root root.
++ */
++struct btrfs_root {
++       struct extent_buffer   node;
++       char                   data[4096];
++       struct btrfs_root_item root_item;
++       u64 objectid;
++       
++       /* data allocations are done in sectorsize units */
++       u32 sectorsize;
++
++       /* node allocations are done in nodesize units */
++       u32 nodesize;
++
++       /* leaf allocations are done in leafsize units */
++       u32 leafsize;
++
++       /* leaf allocations are done in leafsize units */
++       u32 stripesize;
++};
++
++struct btrfs_file_info {
++	struct btrfs_key key;
++};
++
++struct btrfs_root;
++struct btrfs_fs_devices;
++struct btrfs_fs_info {
++       u8 fsid[BTRFS_FSID_SIZE];
++       struct btrfs_root fs_root;
++       struct btrfs_root tree_root;
++       struct btrfs_root chunk_root;
++
++       struct btrfs_file_info file_info; /* currently opened file */
++       struct btrfs_path paths [LAST_LOOKUP_POOL];
++
++       char mbr[SECTOR_SIZE];
++
++       int sb_mirror;
++       u64 sb_transid;
++       struct btrfs_device sb_dev;
++       struct btrfs_super_block sb_copy;
++
++       struct btrfs_device devices[BTRFS_NUM_CACHED_DEVICES + 1];
++};
++
++/*
++ * inode items have the data typically returned from stat and store other
++ * info about object characteristics.  There is one for every file and dir in
++ * the FS
++ */
++#define BTRFS_INODE_ITEM_KEY           1
++#define BTRFS_INODE_REF_KEY            12
++#define BTRFS_XATTR_ITEM_KEY           24
++#define BTRFS_ORPHAN_ITEM_KEY          48
++
++#define BTRFS_DIR_LOG_ITEM_KEY  60
++#define BTRFS_DIR_LOG_INDEX_KEY 72
++/*
++ * dir items are the name -> inode pointers in a directory.  There is one
++ * for every name in a directory.
++ */
++#define BTRFS_DIR_ITEM_KEY     84
++#define BTRFS_DIR_INDEX_KEY    96
++
++/*
++ * extent data is for file data
++ */
++#define BTRFS_EXTENT_DATA_KEY  108
++
++/*
++ * csum items have the checksums for data in the extents
++ */
++#define BTRFS_CSUM_ITEM_KEY    120
++/*
++ * extent csums are stored in a separate tree and hold csums for
++ * an entire extent on disk.
++ */
++#define BTRFS_EXTENT_CSUM_KEY  128
++
++/*
++ * root items point to tree roots.  There are typically in the root
++ * tree used by the super block to find all the other trees
++ */
++#define BTRFS_ROOT_ITEM_KEY    132
++
++/*
++ * root backrefs tie subvols and snapshots to the directory entries that
++ * reference them
++ */
++#define BTRFS_ROOT_BACKREF_KEY 144
++
++/*
++ * root refs make a fast index for listing all of the snapshots and
++ * subvolumes referenced by a given root.  They point directly to the
++ * directory item in the root that references the subvol
++ */
++#define BTRFS_ROOT_REF_KEY     156
++
++/*
+++ * extent items are in the extent map tree.  These record which blocks
+++ * are used, and how many references there are to each block
+++ */
++#define BTRFS_EXTENT_ITEM_KEY  168
++#define BTRFS_EXTENT_REF_KEY   180
++
++/*
++ * block groups give us hints into the extent allocation trees.  Which
++ * blocks are free etc etc
++ */
++#define BTRFS_BLOCK_GROUP_ITEM_KEY 192
++
++#define BTRFS_DEV_EXTENT_KEY   204
++#define BTRFS_DEV_ITEM_KEY     216
++#define BTRFS_CHUNK_ITEM_KEY   228
++
++/*
++ * string items are for debugging.  They just store a short string of
++ * data in the FS
++ */
++#define BTRFS_STRING_ITEM_KEY  253
++/*
++ * Inode flags
++ */
++#define BTRFS_INODE_NODATASUM          (1 << 0)
++#define BTRFS_INODE_NODATACOW          (1 << 1)
++#define BTRFS_INODE_READONLY           (1 << 2)
++
++#define read_eb_member(eb, ptr, type, member, result) (                        \
++       read_extent_buffer(eb, (char *)(result),                        \
++                          ((unsigned long)(ptr)) +                     \
++                           offsetof(type, member),                     \
++                          sizeof(((type *)0)->member)))
++
++#define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits)            \
++static inline u##bits btrfs_##name(struct extent_buffer *eb)           \
++{                                                                      \
++       struct btrfs_header *h = (struct btrfs_header *)eb->data;       \
++       return le##bits##_to_cpu(h->member);                            \
++}                                                                      \
++static inline void btrfs_set_##name(struct extent_buffer *eb,          \
++                                   u##bits val)                        \
++{                                                                      \
++       struct btrfs_header *h = (struct btrfs_header *)eb->data;       \
++       h->member = cpu_to_le##bits(val);                               \
++}
++
++#define BTRFS_SETGET_FUNCS(name, type, member, bits)                   \
++static inline u##bits btrfs_##name(struct extent_buffer *eb,           \
++                                  type *s)                             \
++{                                                                      \
++       unsigned long offset = (unsigned long)s;                        \
++       type *p = (type *) (eb->data + offset);                         \
++       return le##bits##_to_cpu(p->member);                            \
++}                                                                      \
++static inline void btrfs_set_##name(struct extent_buffer *eb,          \
++                                   type *s, u##bits val)               \
++{                                                                      \
++       unsigned long offset = (unsigned long)s;                        \
++       type *p = (type *) (eb->data + offset);                         \
++       p->member = cpu_to_le##bits(val);                               \
++}
++
++#define BTRFS_SETGET_STACK_FUNCS(name, type, member, bits)             \
++static inline u##bits btrfs_##name(type *s)                            \
++{                                                                      \
++       return le##bits##_to_cpu(s->member);                            \
++}                                                                      \
++static inline void btrfs_set_##name(type *s, u##bits val)              \
++{                                                                      \
++       s->member = cpu_to_le##bits(val);                               \
++}
++
++BTRFS_SETGET_FUNCS(device_type, struct btrfs_dev_item, type, 64);
++BTRFS_SETGET_FUNCS(device_total_bytes, struct btrfs_dev_item, total_bytes, 64);
++BTRFS_SETGET_FUNCS(device_bytes_used, struct btrfs_dev_item, bytes_used, 64);
++BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32);
++BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32);
++BTRFS_SETGET_FUNCS(device_start_offset, struct btrfs_dev_item,
++                  start_offset, 64);
++BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32);
++BTRFS_SETGET_FUNCS(device_id, struct btrfs_dev_item, devid, 64);
++BTRFS_SETGET_FUNCS(device_group, struct btrfs_dev_item, dev_group, 32);
++BTRFS_SETGET_FUNCS(device_seek_speed, struct btrfs_dev_item, seek_speed, 8);
++BTRFS_SETGET_FUNCS(device_bandwidth, struct btrfs_dev_item, bandwidth, 8);
++BTRFS_SETGET_FUNCS(device_generation, struct btrfs_dev_item, generation, 64);
++
++BTRFS_SETGET_STACK_FUNCS(stack_device_type, struct btrfs_dev_item, type, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_total_bytes, struct btrfs_dev_item,
++                        total_bytes, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_bytes_used, struct btrfs_dev_item,
++                        bytes_used, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_io_align, struct btrfs_dev_item,
++                        io_align, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_io_width, struct btrfs_dev_item,
++                        io_width, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_sector_size, struct btrfs_dev_item,
++                        sector_size, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_id, struct btrfs_dev_item, devid, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_group, struct btrfs_dev_item,
++                        dev_group, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_seek_speed, struct btrfs_dev_item,
++                        seek_speed, 8);
++BTRFS_SETGET_STACK_FUNCS(stack_device_bandwidth, struct btrfs_dev_item,
++                        bandwidth, 8);
++BTRFS_SETGET_STACK_FUNCS(stack_device_generation, struct btrfs_dev_item,
++                        generation, 64);
++
++static inline char *btrfs_device_uuid(struct btrfs_dev_item *d)
++{
++       return (char *)d + offsetof(struct btrfs_dev_item, uuid);
++}
++
++static inline char *btrfs_device_fsid(struct btrfs_dev_item *d)
++{
++       return (char *)d + offsetof(struct btrfs_dev_item, fsid);
++}
++
++BTRFS_SETGET_FUNCS(chunk_length, struct btrfs_chunk, length, 64);
++BTRFS_SETGET_FUNCS(chunk_owner, struct btrfs_chunk, owner, 64);
++BTRFS_SETGET_FUNCS(chunk_stripe_len, struct btrfs_chunk, stripe_len, 64);
++BTRFS_SETGET_FUNCS(chunk_io_align, struct btrfs_chunk, io_align, 32);
++BTRFS_SETGET_FUNCS(chunk_io_width, struct btrfs_chunk, io_width, 32);
++BTRFS_SETGET_FUNCS(chunk_sector_size, struct btrfs_chunk, sector_size, 32);
++BTRFS_SETGET_FUNCS(chunk_type, struct btrfs_chunk, type, 64);
++BTRFS_SETGET_FUNCS(chunk_num_stripes, struct btrfs_chunk, num_stripes, 16);
++BTRFS_SETGET_FUNCS(chunk_sub_stripes, struct btrfs_chunk, sub_stripes, 16);
++BTRFS_SETGET_FUNCS(stripe_devid, struct btrfs_stripe, devid, 64);
++BTRFS_SETGET_FUNCS(stripe_offset, struct btrfs_stripe, offset, 64);
++
++static inline char *btrfs_stripe_dev_uuid(struct btrfs_stripe *s)
++{
++       return (char *)s + offsetof(struct btrfs_stripe, dev_uuid);
++}
++
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_length, struct btrfs_chunk, length, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_owner, struct btrfs_chunk, owner, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_stripe_len, struct btrfs_chunk,
++                        stripe_len, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_align, struct btrfs_chunk,
++                        io_align, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_width, struct btrfs_chunk,
++                        io_width, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_sector_size, struct btrfs_chunk,
++                        sector_size, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_type, struct btrfs_chunk, type, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_num_stripes, struct btrfs_chunk,
++                        num_stripes, 16);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_sub_stripes, struct btrfs_chunk,
++                        sub_stripes, 16);
++BTRFS_SETGET_STACK_FUNCS(stack_stripe_devid, struct btrfs_stripe, devid, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_stripe_offset, struct btrfs_stripe, offset, 64);
++
++static inline struct btrfs_stripe *btrfs_stripe_nr(struct btrfs_chunk *c,
++                                                  int nr)
++{
++       unsigned long offset = (unsigned long)c;
++       offset += offsetof(struct btrfs_chunk, stripe);
++       offset += nr * sizeof(struct btrfs_stripe);
++       return (struct btrfs_stripe *)offset;
++}
++
++static inline char *btrfs_stripe_dev_uuid_nr(struct btrfs_chunk *c, int nr)
++{
++       return btrfs_stripe_dev_uuid(btrfs_stripe_nr(c, nr));
++}
++
++static inline u64 btrfs_stripe_offset_nr(struct extent_buffer *eb,
++                                        struct btrfs_chunk *c, int nr)
++{
++       return btrfs_stripe_offset(eb, btrfs_stripe_nr(c, nr));
++}
++
++static inline void btrfs_set_stripe_offset_nr(struct extent_buffer *eb,
++                                            struct btrfs_chunk *c, int nr,
++                                            u64 val)
++{
++       btrfs_set_stripe_offset(eb, btrfs_stripe_nr(c, nr), val);
++}
++
++static inline u64 btrfs_stripe_devid_nr(struct extent_buffer *eb,
++                                        struct btrfs_chunk *c, int nr)
++{
++       return btrfs_stripe_devid(eb, btrfs_stripe_nr(c, nr));
++}
++
++static inline void btrfs_set_stripe_devid_nr(struct extent_buffer *eb,
++                                            struct btrfs_chunk *c, int nr,
++                                            u64 val)
++{
++       btrfs_set_stripe_devid(eb, btrfs_stripe_nr(c, nr), val);
++}
++
++/* struct btrfs_block_group_item */
++BTRFS_SETGET_STACK_FUNCS(block_group_used, struct btrfs_block_group_item,
++                        used, 64);
++BTRFS_SETGET_FUNCS(disk_block_group_used, struct btrfs_block_group_item,
++                        used, 64);
++BTRFS_SETGET_STACK_FUNCS(block_group_chunk_objectid,
++                       struct btrfs_block_group_item, chunk_objectid, 64);
++
++BTRFS_SETGET_FUNCS(disk_block_group_chunk_objectid,
++                  struct btrfs_block_group_item, chunk_objectid, 64);
++BTRFS_SETGET_FUNCS(disk_block_group_flags,
++                  struct btrfs_block_group_item, flags, 64);
++BTRFS_SETGET_STACK_FUNCS(block_group_flags,
++                       struct btrfs_block_group_item, flags, 64);
++
++/* struct btrfs_inode_ref */
++BTRFS_SETGET_FUNCS(inode_ref_name_len, struct btrfs_inode_ref, name_len, 16);
++BTRFS_SETGET_FUNCS(inode_ref_index, struct btrfs_inode_ref, index, 64);
++
++/* struct btrfs_inode_item */
++BTRFS_SETGET_FUNCS(inode_generation, struct btrfs_inode_item, generation, 64);
++BTRFS_SETGET_FUNCS(inode_sequence, struct btrfs_inode_item, sequence, 64);
++BTRFS_SETGET_FUNCS(inode_transid, struct btrfs_inode_item, transid, 64);
++BTRFS_SETGET_FUNCS(inode_size, struct btrfs_inode_item, size, 64);
++BTRFS_SETGET_FUNCS(inode_nbytes, struct btrfs_inode_item, nbytes, 64);
++BTRFS_SETGET_FUNCS(inode_block_group, struct btrfs_inode_item, block_group, 64);
++BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
++BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
++BTRFS_SETGET_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
++BTRFS_SETGET_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
++BTRFS_SETGET_FUNCS(inode_rdev, struct btrfs_inode_item, rdev, 64);
++BTRFS_SETGET_FUNCS(inode_flags, struct btrfs_inode_item, flags, 64);
++
++BTRFS_SETGET_STACK_FUNCS(stack_inode_generation,
++                        struct btrfs_inode_item, generation, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_sequence,
++                        struct btrfs_inode_item, generation, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_size,
++                        struct btrfs_inode_item, size, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes,
++                        struct btrfs_inode_item, nbytes, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_block_group,
++                        struct btrfs_inode_item, block_group, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_nlink,
++                        struct btrfs_inode_item, nlink, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_uid,
++                        struct btrfs_inode_item, uid, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_gid,
++                        struct btrfs_inode_item, gid, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_mode,
++                        struct btrfs_inode_item, mode, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_rdev,
++                        struct btrfs_inode_item, rdev, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_flags,
++                        struct btrfs_inode_item, flags, 64);
++
++BTRFS_SETGET_FUNCS(timespec_sec, struct btrfs_timespec, sec, 64);
++BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_timespec_sec, struct btrfs_timespec,
++                        sec, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_timespec_nsec, struct btrfs_timespec,
++                        nsec, 32);
++
++/* struct btrfs_dev_extent */
++BTRFS_SETGET_FUNCS(dev_extent_chunk_tree, struct btrfs_dev_extent,
++                  chunk_tree, 64);
++BTRFS_SETGET_FUNCS(dev_extent_chunk_objectid, struct btrfs_dev_extent,
++                  chunk_objectid, 64);
++BTRFS_SETGET_FUNCS(dev_extent_chunk_offset, struct btrfs_dev_extent,
++                  chunk_offset, 64);
++BTRFS_SETGET_FUNCS(dev_extent_length, struct btrfs_dev_extent, length, 64);
++
++static inline u8 *btrfs_dev_extent_chunk_tree_uuid(struct btrfs_dev_extent *dev)
++{
++       unsigned long ptr = offsetof(struct btrfs_dev_extent, chunk_tree_uuid);
++       return (u8 *)((unsigned long)dev + ptr);
++}
++
++/* struct btrfs_extent_ref */
++BTRFS_SETGET_FUNCS(ref_root, struct btrfs_extent_ref, root, 64);
++BTRFS_SETGET_FUNCS(ref_generation, struct btrfs_extent_ref, generation, 64);
++BTRFS_SETGET_FUNCS(ref_objectid, struct btrfs_extent_ref, objectid, 64);
++BTRFS_SETGET_FUNCS(ref_num_refs, struct btrfs_extent_ref, num_refs, 32);
++
++BTRFS_SETGET_STACK_FUNCS(stack_ref_root, struct btrfs_extent_ref, root, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_ref_generation, struct btrfs_extent_ref,
++                        generation, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_ref_objectid, struct btrfs_extent_ref,
++                        objectid, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_ref_num_refs, struct btrfs_extent_ref,
++                        num_refs, 32);
++
++/* struct btrfs_extent_item */
++BTRFS_SETGET_FUNCS(extent_refs, struct btrfs_extent_item, refs, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_extent_refs, struct btrfs_extent_item,
++                        refs, 32);
++
++/* struct btrfs_node */
++BTRFS_SETGET_FUNCS(key_blockptr, struct btrfs_key_ptr, blockptr, 64);
++BTRFS_SETGET_FUNCS(key_generation, struct btrfs_key_ptr, generation, 64);
++
++static inline u64 btrfs_node_blockptr(struct extent_buffer *eb, int nr)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       return btrfs_key_blockptr(eb, (struct btrfs_key_ptr *)ptr);
++}
++
++static inline void btrfs_set_node_blockptr(struct extent_buffer *eb,
++                                          int nr, u64 val)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       btrfs_set_key_blockptr(eb, (struct btrfs_key_ptr *)ptr, val);
++}
++
++static inline u64 btrfs_node_ptr_generation(struct extent_buffer *eb, int nr)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       return btrfs_key_generation(eb, (struct btrfs_key_ptr *)ptr);
++}
++
++static inline void btrfs_set_node_ptr_generation(struct extent_buffer *eb,
++                                                int nr, u64 val)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       btrfs_set_key_generation(eb, (struct btrfs_key_ptr *)ptr, val);
++}
++
++static inline unsigned long btrfs_node_key_ptr_offset(int nr)
++{
++       return offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++}
++
++static inline void btrfs_node_key(struct extent_buffer *eb,
++                                 struct btrfs_disk_key *disk_key, int nr)
++{
++       unsigned long ptr;
++       ptr = btrfs_node_key_ptr_offset(nr);
++       read_eb_member(eb, (struct btrfs_key_ptr *)ptr,
++                      struct btrfs_key_ptr, key, disk_key);
++}
++
++/* struct btrfs_item */
++BTRFS_SETGET_FUNCS(item_offset, struct btrfs_item, offset, 32);
++BTRFS_SETGET_FUNCS(item_size, struct btrfs_item, size, 32);
++
++static inline unsigned long btrfs_item_nr_offset(int nr)
++{
++       return offsetof(struct btrfs_leaf, items) +
++               sizeof(struct btrfs_item) * nr;
++}
++
++static inline struct btrfs_item *btrfs_item_nr(struct extent_buffer *eb,
++                                              int nr)
++{
++       return (struct btrfs_item *)btrfs_item_nr_offset(nr);
++}
++
++static inline u32 btrfs_item_end(struct extent_buffer *eb,
++                                struct btrfs_item *item)
++{
++       return btrfs_item_offset(eb, item) + btrfs_item_size(eb, item);
++}
++
++static inline u32 btrfs_item_end_nr(struct extent_buffer *eb, int nr)
++{
++       return btrfs_item_end(eb, btrfs_item_nr(eb, nr));
++}
++
++static inline u32 btrfs_item_offset_nr(struct extent_buffer *eb, int nr)
++{
++       return btrfs_item_offset(eb, btrfs_item_nr(eb, nr));
++}
++
++static inline u32 btrfs_item_size_nr(struct extent_buffer *eb, int nr)
++{
++       return btrfs_item_size(eb, btrfs_item_nr(eb, nr));
++}
++
++static inline void btrfs_item_key(struct extent_buffer *eb,
++                          struct btrfs_disk_key *disk_key, int nr)
++{
++       struct btrfs_item *item = btrfs_item_nr(eb, nr);
++       read_eb_member(eb, item, struct btrfs_item, key, disk_key);
++}
++
++/*
++ * struct btrfs_root_ref
++ */
++BTRFS_SETGET_FUNCS(root_ref_dirid, struct btrfs_root_ref, dirid, 64);
++BTRFS_SETGET_FUNCS(root_ref_sequence, struct btrfs_root_ref, sequence, 64);
++BTRFS_SETGET_FUNCS(root_ref_name_len, struct btrfs_root_ref, name_len, 16);
++
++/* struct btrfs_dir_item */
++BTRFS_SETGET_FUNCS(dir_data_len, struct btrfs_dir_item, data_len, 16);
++BTRFS_SETGET_FUNCS(dir_type, struct btrfs_dir_item, type, 8);
++BTRFS_SETGET_FUNCS(dir_name_len, struct btrfs_dir_item, name_len, 16);
++BTRFS_SETGET_FUNCS(dir_transid, struct btrfs_dir_item, transid, 64);
++
++static inline void btrfs_dir_item_key(struct extent_buffer *eb,
++                                     struct btrfs_dir_item *item,
++                                     struct btrfs_disk_key *key)
++{
++       read_eb_member(eb, item, struct btrfs_dir_item, location, key);
++}
++
++/* struct btrfs_disk_key */
++BTRFS_SETGET_STACK_FUNCS(disk_key_objectid, struct btrfs_disk_key,
++                        objectid, 64);
++BTRFS_SETGET_STACK_FUNCS(disk_key_offset, struct btrfs_disk_key, offset, 64);
++BTRFS_SETGET_STACK_FUNCS(disk_key_type, struct btrfs_disk_key, type, 8);
++
++static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
++                                        struct btrfs_disk_key *disk)
++{
++       cpu->offset = le64_to_cpu(disk->offset);
++       cpu->type = disk->type;
++       cpu->objectid = le64_to_cpu(disk->objectid);
++}
++
++static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
++                                        struct btrfs_key *cpu)
++{
++       disk->offset = cpu_to_le64(cpu->offset);
++       disk->type = cpu->type;
++       disk->objectid = cpu_to_le64(cpu->objectid);
++}
++
++static inline void btrfs_node_key_to_cpu(struct extent_buffer *eb,
++                                 struct btrfs_key *key, int nr)
++{
++       struct btrfs_disk_key disk_key;
++       btrfs_node_key(eb, &disk_key, nr);
++       btrfs_disk_key_to_cpu(key, &disk_key);
++}
++
++static inline void btrfs_item_key_to_cpu(struct extent_buffer *eb,
++                                 struct btrfs_key *key, int nr)
++{
++       struct btrfs_disk_key disk_key;
++       btrfs_item_key(eb, &disk_key, nr);
++       btrfs_disk_key_to_cpu(key, &disk_key);
++}
++
++static inline void btrfs_dir_item_key_to_cpu(struct extent_buffer *eb,
++                                     struct btrfs_dir_item *item,
++                                     struct btrfs_key *key)
++{
++       struct btrfs_disk_key disk_key;
++       btrfs_dir_item_key(eb, item, &disk_key);
++       btrfs_disk_key_to_cpu(key, &disk_key);
++}
++
++static inline u8 btrfs_key_type(struct btrfs_key *key)
++{
++       return key->type;
++}
++
++static inline void btrfs_set_key_type(struct btrfs_key *key, u8 val)
++{
++       key->type = val;
++}
++
++static inline u64 btrfs_super_devid(struct btrfs_super_block *disk_super)
++{
++	return le64_to_cpu(disk_super->dev_item.devid);
++}
++
++/* struct btrfs_header */
++BTRFS_SETGET_HEADER_FUNCS(header_bytenr, struct btrfs_header, bytenr, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_generation, struct btrfs_header,
++                         generation, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_owner, struct btrfs_header, owner, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_nritems, struct btrfs_header, nritems, 32);
++BTRFS_SETGET_HEADER_FUNCS(header_flags, struct btrfs_header, flags, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_level, struct btrfs_header, level, 8);
++
++/* struct btrfs_root_item */
++BTRFS_SETGET_FUNCS(disk_root_generation, struct btrfs_root_item,
++                  generation, 64);
++BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32);
++BTRFS_SETGET_FUNCS(disk_root_bytenr, struct btrfs_root_item, bytenr, 64);
++BTRFS_SETGET_FUNCS(disk_root_level, struct btrfs_root_item, level, 8);
++
++BTRFS_SETGET_STACK_FUNCS(root_generation, struct btrfs_root_item,
++                        generation, 64);
++BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64);
++BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8);
++BTRFS_SETGET_STACK_FUNCS(root_dirid, struct btrfs_root_item, root_dirid, 64);
++BTRFS_SETGET_STACK_FUNCS(root_refs, struct btrfs_root_item, refs, 32);
++BTRFS_SETGET_STACK_FUNCS(root_flags, struct btrfs_root_item, flags, 64);
++BTRFS_SETGET_STACK_FUNCS(root_used, struct btrfs_root_item, bytes_used, 64);
++BTRFS_SETGET_STACK_FUNCS(root_limit, struct btrfs_root_item, byte_limit, 64);
++BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
++                        last_snapshot, 64);
++
++/* struct btrfs_super_block */
++
++BTRFS_SETGET_STACK_FUNCS(super_bytenr, struct btrfs_super_block, bytenr, 64);
++BTRFS_SETGET_STACK_FUNCS(super_flags, struct btrfs_super_block, flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_generation, struct btrfs_super_block,
++                        generation, 64);
++BTRFS_SETGET_STACK_FUNCS(super_root, struct btrfs_super_block, root, 64);
++BTRFS_SETGET_STACK_FUNCS(super_sys_array_size,
++                        struct btrfs_super_block, sys_chunk_array_size, 32);
++BTRFS_SETGET_STACK_FUNCS(super_chunk_root_generation,
++                        struct btrfs_super_block, chunk_root_generation, 64);
++BTRFS_SETGET_STACK_FUNCS(super_root_level, struct btrfs_super_block,
++                        root_level, 8);
++BTRFS_SETGET_STACK_FUNCS(super_chunk_root, struct btrfs_super_block,
++                        chunk_root, 64);
++BTRFS_SETGET_STACK_FUNCS(super_chunk_root_level, struct btrfs_super_block,
++                        chunk_root_level, 8);
++BTRFS_SETGET_STACK_FUNCS(super_log_root, struct btrfs_super_block,
++                        log_root, 64);
++BTRFS_SETGET_STACK_FUNCS(super_log_root_transid, struct btrfs_super_block,
++                        log_root_transid, 64);
++BTRFS_SETGET_STACK_FUNCS(super_log_root_level, struct btrfs_super_block,
++                        log_root_level, 8);
++BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block,
++                        total_bytes, 64);
++BTRFS_SETGET_STACK_FUNCS(super_bytes_used, struct btrfs_super_block,
++                        bytes_used, 64);
++BTRFS_SETGET_STACK_FUNCS(super_sectorsize, struct btrfs_super_block,
++                        sectorsize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_nodesize, struct btrfs_super_block,
++                        nodesize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_leafsize, struct btrfs_super_block,
++                        leafsize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_stripesize, struct btrfs_super_block,
++                        stripesize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_root_dir, struct btrfs_super_block,
++                        root_dir_objectid, 64);
++BTRFS_SETGET_STACK_FUNCS(super_num_devices, struct btrfs_super_block,
++                        num_devices, 64);
++BTRFS_SETGET_STACK_FUNCS(super_compat_flags, struct btrfs_super_block,
++                        compat_flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_compat_ro_flags, struct btrfs_super_block,
++                        compat_flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_incompat_flags, struct btrfs_super_block,
++                        incompat_flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block,
++                        csum_type, 16);
++
++static inline int btrfs_super_csum_size(struct btrfs_super_block *s)
++{
++       int t = btrfs_super_csum_type(s);
++       //BUG_ON(t >= ARRAY_SIZE(btrfs_csum_sizes));
++       return btrfs_csum_sizes[t];
++}
++
++static inline unsigned long btrfs_leaf_data(struct extent_buffer *l)
++{
++       return offsetof(struct btrfs_leaf, items);
++}
++
++/* struct btrfs_file_extent_item */
++BTRFS_SETGET_FUNCS(file_extent_type, struct btrfs_file_extent_item, type, 8);
++
++static inline unsigned long btrfs_file_extent_inline_start(struct
++                                                  btrfs_file_extent_item *e)
++{
++       unsigned long offset = (unsigned long)e;
++       offset += offsetof(struct btrfs_file_extent_item, disk_bytenr);
++       return offset;
++}
++
++static inline u32 btrfs_file_extent_calc_inline_size(u32 datasize)
++{
++       return offsetof(struct btrfs_file_extent_item, disk_bytenr) + datasize;
++}
++
++BTRFS_SETGET_FUNCS(file_extent_disk_bytenr, struct btrfs_file_extent_item,
++                  disk_bytenr, 64);
++BTRFS_SETGET_FUNCS(file_extent_generation, struct btrfs_file_extent_item,
++                  generation, 64);
++BTRFS_SETGET_FUNCS(file_extent_disk_num_bytes, struct btrfs_file_extent_item,
++                  disk_num_bytes, 64);
++BTRFS_SETGET_FUNCS(file_extent_offset, struct btrfs_file_extent_item,
++                 offset, 64);
++BTRFS_SETGET_FUNCS(file_extent_num_bytes, struct btrfs_file_extent_item,
++                  num_bytes, 64);
++BTRFS_SETGET_FUNCS(file_extent_ram_bytes, struct btrfs_file_extent_item,
++                  ram_bytes, 64);
++BTRFS_SETGET_FUNCS(file_extent_compression, struct btrfs_file_extent_item,
++                  compression, 8);
++BTRFS_SETGET_FUNCS(file_extent_encryption, struct btrfs_file_extent_item,
++                  encryption, 8);
++BTRFS_SETGET_FUNCS(file_extent_other_encoding, struct btrfs_file_extent_item,
++                  other_encoding, 16);
++
++/* this returns the number of file bytes represented by the inline item.
++ * If an item is compressed, this is the uncompressed size
++ */
++static inline u32 btrfs_file_extent_inline_len(struct extent_buffer *eb,
++                                       struct btrfs_file_extent_item *e)
++{
++       return btrfs_file_extent_ram_bytes(eb, e);
++}
++
++/*
++ * this returns the number of bytes used by the item on disk, minus the
++ * size of any extent headers.  If a file is compressed on disk, this is
++ * the compressed size
++ */
++static inline u32 btrfs_file_extent_inline_item_len(struct extent_buffer *eb,
++                                                   struct btrfs_item *e)
++{
++       unsigned long offset;
++       offset = offsetof(struct btrfs_file_extent_item, disk_bytenr);
++       return btrfs_item_size(eb, e) - offset;
++}
++
++static inline u32 btrfs_level_size(struct btrfs_root *root, int level) {
++       if (level == 0)
++               return root->leafsize;
++       return root->nodesize;
++}
++
++static inline u32 btrfs_root_level_size(struct btrfs_super_block *sb) {
++       return btrfs_super_root_level(sb) == 0 ?
++               btrfs_super_leafsize(sb) :
++               btrfs_super_nodesize(sb);
++}
++
++static inline u32 btrfs_chunk_root_level_size(struct btrfs_super_block *sb) {
++       return btrfs_super_chunk_root_level(sb) == 0 ?
++               btrfs_super_leafsize(sb) :
++               btrfs_super_nodesize(sb);
++}
++
++/* helper function to cast into the data area of the leaf. */
++#define btrfs_item_ptr(leaf, slot, type) \
++       ((type *)(btrfs_leaf_data(leaf) + \
++       btrfs_item_offset_nr(leaf, slot)))
++
++#define btrfs_item_ptr_offset(leaf, slot) \
++       ((unsigned long)(btrfs_leaf_data(leaf) + \
++       btrfs_item_offset_nr(leaf, slot)))
++
++/*volumes.h */
++
++struct btrfs_fs_devices {
++       u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
++
++       /* the device with this id has the most recent coyp of the super */
++       u64 latest_devid;
++       u64 latest_trans;
++       u64 lowest_devid;
++       int latest_bdev;
++       int lowest_bdev;
++       int seeding;
++       struct btrfs_fs_devices *seed;
++};
++
++struct btrfs_bio_stripe {
++	struct btrfs_device dev;
++	u64 physical;
++};
++
++#define MAX_NRSTRIPES 8
++struct btrfs_multi_bio {
++       int error;
++       int num_stripes;
++       struct btrfs_bio_stripe stripes[MAX_NRSTRIPES];
++};
++
++#define btrfs_multi_bio_size(n) (sizeof(struct btrfs_multi_bio) + \
++                           (sizeof(struct btrfs_bio_stripe) * (n)))
++
++static int aux_tree_lookup(struct btrfs_root *root,
++                          struct btrfs_key *key,
++                          struct btrfs_path *path);
++
++struct cache_extent {
++       u64 start;
++       u64 size;
++};
++
++struct map_lookup {
++       struct cache_extent ce;
++       u64 type;
++       int io_align;
++       int io_width;
++       int stripe_len;
++       int sector_size;
++       int num_stripes;
++       int sub_stripes;
++        struct btrfs_bio_stripe stripes[MAX_NRSTRIPES];
++};
++
++/* "VFS" things */
++
++/* file types recognized by grub */
++typedef enum {
++       BTRFS_REGULAR_FILE,
++       BTRFS_DIRECTORY_FILE,
++       BTRFS_SYMLINK_FILE,
++       BTRFS_UNKNOWN_FILE
++} btrfs_file_type;
++
++static inline int coord_is_root(struct btrfs_root *root,
++                               struct btrfs_path *path)
++{
++       return btrfs_header_bytenr(&path->nodes[0]) ==
++               btrfs_header_bytenr(&root->node);
++}
++
++static inline btrfs_file_type btrfs_get_file_type (int mode)
++{
++       if (S_ISLNK(mode))
++               return BTRFS_SYMLINK_FILE;
++       if (S_ISREG(mode))
++               return BTRFS_REGULAR_FILE;
++       if (S_ISDIR(mode))
++               return BTRFS_DIRECTORY_FILE;
++       return BTRFS_UNKNOWN_FILE;
++}
++
++#define min_t(type,x,y)                                                       \
++       ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
++#define max_t(type,x,y)                                                       \
++       ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
++
++
++int sys_array_lookup(struct map_lookup *map, u64 logical);
++int tree_chunk_lookup(struct map_lookup *map,
++                     u64 logical);
++int __btrfs_map_block(u64 logical, u64 *length,
++                     struct btrfs_multi_bio *multi_ret, int mirror_num);
++int read_tree_block(struct btrfs_root *root,
++                   struct extent_buffer *eb,
++                   u64 bytenr, /* logical */
++                   u32 blocksize,
++                   u64 parent_transid,
++                   lookup_pool_id lpid);
++int check_read_chunk(struct btrfs_key *key,
++                    struct extent_buffer *leaf,
++                    struct btrfs_chunk *chunk,
++                    struct map_lookup *map,
++                    u64 logical);
++/*
++  Local variables:
++  c-indentation-style: "K&R"
++  mode-name: "LC"
++  c-basic-offset: 8
++  tab-width: 8
++  fill-column: 80
++  scroll-step: 1
++  End:
++*/
+\ No newline at end of file
+diff -up grub-upstream.wip/stage2/builtins.c.btrfs grub-upstream.wip/stage2/builtins.c
+--- grub-upstream.wip/stage2/builtins.c.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/builtins.c	2012-03-20 05:11:13.000000000 +0000
+@@ -2456,6 +2456,16 @@ install_func (char *arg, int flags)
+ 	  else
+ #endif /* GRUB_UTIL */
+ 	    {
++ 	      /*
++	       * FIXME: Ugly hack.
++	       * Do not write to btrfs partition
++	       * without a help of the file system!
++	       */
++ 	      if (!strcmp(fsys_table[fsys_type].name, "btrfs"))
++ 		{
++ 		  errnum = ERR_BAD_ARGUMENT;
++ 		  goto fail;
++ 		}
+ 	      if (! devwrite (saved_sector - part_start, 1, stage2_buffer))
+ 		goto fail;
+ 	    }
+@@ -4281,6 +4291,7 @@ setup_func (char *arg, int flags)
+     {"jfs",      "/jfs_stage1_5"},
+     {"minix",    "/minix_stage1_5"},
+     {"reiserfs", "/reiserfs_stage1_5"},
++    {"btrfs",    "/btrfs_stage1_5"},
+     {"vstafs",   "/vstafs_stage1_5"},
+     {"xfs",      "/xfs_stage1_5"}
+   };
+diff -up grub-upstream.wip/stage2/disk_io.c.btrfs grub-upstream.wip/stage2/disk_io.c
+--- grub-upstream.wip/stage2/disk_io.c.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/disk_io.c	2012-03-20 05:07:09.000000000 +0000
+@@ -78,6 +78,9 @@ struct fsys_entry fsys_table[NUM_FSYS + 
+ # ifdef FSYS_ISO9660
+   {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0},
+ # endif
++# ifdef FSYS_BTRFS
++  {"btrfs", btrfs_mount, btrfs_read, btrfs_dir, 0, btrfs_embed},
++# endif
+   /* XX FFS should come last as it's superblock is commonly crossing tracks
+      on floppies from track 1 to 2, while others only use 1.  */
+ # ifdef FSYS_FFS
+diff -up grub-upstream.wip/stage2/filesys.h.btrfs grub-upstream.wip/stage2/filesys.h
+--- grub-upstream.wip/stage2/filesys.h.btrfs	2004-05-14 19:36:43.000000000 +0000
++++ grub-upstream.wip/stage2/filesys.h	2012-03-20 05:07:09.000000000 +0000
+@@ -77,6 +77,16 @@ int reiserfs_embed (int *start_sector, i
+ #define FSYS_REISERFS_NUM 0
+ #endif
+ 
++#ifdef FSYS_BTRFS
++#define FSYS_BTRFS_NUM 1
++int btrfs_mount (void);
++int btrfs_read (char *buf, int len);
++int btrfs_dir (char *dirname);
++int btrfs_embed (int *start_sector, int needed_sectors);
++#else
++#define FSYS_BTRFS_NUM 0
++#endif
++
+ #ifdef FSYS_VSTAFS
+ #define FSYS_VSTAFS_NUM 1
+ int vstafs_mount (void);
+@@ -127,8 +137,8 @@ int iso9660_dir (char *dirname);
+ #ifndef NUM_FSYS
+ #define NUM_FSYS	\
+   (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM	\
+-   + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM	\
+-   + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
++   + FSYS_REISERFS_NUM + FSYS_BTRFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM \
++   + FSYS_XFS_NUM + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
+ #endif
+ 
+ /* defines for the block filesystem info area */
+diff -up /dev/null grub-upstream.wip/stage2/fsys_btrfs.c
+--- /dev/null	2009-06-03 06:46:26.160951000 +0000
++++ grub-upstream.wip/stage2/fsys_btrfs.c	2012-03-20 05:07:09.000000000 +0000
+@@ -0,0 +1,1820 @@
++/* fsys_btrfs.c - an implementation for the Btrfs filesystem
++ *
++ * Copyright 2009 Red Hat, Inc.  All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifdef FSYS_BTRFS
++
++#include "shared.h"
++#include "filesys.h"
++#include "btrfs.h"
++
++#define BTRFS_VERBOSE 0
++
++/* Cache layouts */
++
++#define LOOKUP_CACHE_BUF_SIZE   (4096)
++#define LOOKUP_CACHE_SIZE       (LOOKUP_CACHE_BUF_SIZE * LAST_LOOKUP_POOL)
++#define BTRFS_FS_INFO							\
++	((struct btrfs_fs_info *)((unsigned long)FSYS_BUF +		\
++				  LOOKUP_CACHE_SIZE))
++#define BTRFS_CACHE_SIZE         (sizeof(struct btrfs_fs_info) +	\
++				  LOOKUP_CACHE_SIZE)
++#define BTRFS_TREE_ROOT          (&BTRFS_FS_INFO->tree_root)
++#define BTRFS_CHUNK_ROOT         (&BTRFS_FS_INFO->chunk_root)
++#define BTRFS_FS_ROOT            (&BTRFS_FS_INFO->fs_root)
++#define BTRFS_SUPER              (&BTRFS_FS_INFO->sb_copy)
++#define BTRFS_DEVICES            (&BTRFS_FS_INFO->devices[0])
++#define BTRFS_FILE_INFO          (&BTRFS_FS_INFO->file_info)
++#define BTRFS_FILE_INFO_KEY      (&BTRFS_FILE_INFO->key)
++
++#define BTRFS_VOLATILE_DEV_CACHE				        \
++	(&BTRFS_FS_INFO->devices[BTRFS_NUM_CACHED_DEVICES])
++
++#define LOOKUP_CACHE_BUF(id) ((char *)((unsigned long)FSYS_BUF +	\
++				       id * LOOKUP_CACHE_BUF_SIZE))
++
++#define noop   do {; } while (0)
++
++#if BTRFS_VERBOSE
++#define btrfs_msg(format, ...) printf(format , ## __VA_ARGS__)
++#else
++#define btrfs_msg(format, args...) noop
++#endif
++
++/* compile-time check to make sure we don't overlap
++   filesystem buffer */
++static inline void check_btrfs_cache_size(void)
++{
++	cassert(BTRFS_CACHE_SIZE <= FSYS_BUFLEN);
++}
++
++static inline u64 btrfs_sb_offset(int mirror)
++{
++	u64 start = 16 * 1024;
++	if (mirror)
++		return start << (BTRFS_SUPER_MIRROR_SHIFT * mirror);
++	return BTRFS_SUPER_INFO_OFFSET;
++}
++
++static inline char *grab_lookup_cache(lookup_pool_id lpid)
++{
++	char *buf = LOOKUP_CACHE_BUF(lpid);
++	memset(buf, 0, LOOKUP_CACHE_BUF_SIZE);
++	return buf;
++}
++
++static inline struct btrfs_path *btrfs_grab_path(lookup_pool_id lpid)
++{
++	return &BTRFS_FS_INFO->paths[lpid];
++}
++
++static inline void btrfs_set_path_key(struct btrfs_path *path,
++				      struct btrfs_key *key)
++{
++	btrfs_item_key_to_cpu(&path->nodes[0],
++			      key,
++			      path->slots[0]);
++}
++
++static inline void btrfs_update_file_info(struct btrfs_path *path)
++{
++	btrfs_set_path_key(path, BTRFS_FILE_INFO_KEY);
++}
++
++static inline void btrfs_set_root_dir_key(struct btrfs_key *key)
++{
++	key->objectid = BTRFS_FIRST_FREE_OBJECTID;
++	btrfs_set_key_type(key, BTRFS_INODE_ITEM_KEY);
++	key->offset = 0;
++}
++
++static inline void copy_extent_buffer(struct extent_buffer *dst,
++				      struct extent_buffer *src)
++{
++	char *data = dst->data;
++	memcpy(dst, src, sizeof(*dst));
++	memcpy(data, src->data, 4096);
++	dst->data = data;
++}
++
++static inline void move_extent_buffer(struct extent_buffer *dst,
++				      struct extent_buffer *src)
++{
++	memcpy(dst, src, sizeof(*dst));
++}
++
++static inline void init_btrfs_root (struct btrfs_root *root)
++{
++	root->node.data = root->data;
++}
++
++static inline void init_btrfs_path(lookup_pool_id lpid)
++{
++	struct btrfs_path *path;
++	path = btrfs_grab_path(lpid);
++	path->lpid = lpid;
++}
++
++static inline void init_btrfs_info(void)
++{
++	int i;
++	
++	memset(BTRFS_FS_INFO, 0, sizeof(struct btrfs_fs_info));
++	for(i = 0; i < LAST_LOOKUP_POOL; i++)
++		init_btrfs_path(i);
++	init_btrfs_root(BTRFS_TREE_ROOT);
++	init_btrfs_root(BTRFS_CHUNK_ROOT);
++	init_btrfs_root(BTRFS_FS_ROOT);
++}
++
++static void setup_root(struct btrfs_root *root,
++		       u32 nodesize,
++		       u32 leafsize,
++		       u32 sectorsize,
++		       u32 stripesize,
++		       u64 objectid)
++{
++	root->nodesize = nodesize;
++	root->leafsize = leafsize;
++	root->sectorsize = sectorsize;
++	root->stripesize = stripesize;
++	root->objectid = objectid;
++}
++
++/*
++ * Pick up the latest root of a
++ * tree with specified @objectid
++ */
++static int btrfs_find_last_root(struct btrfs_root *tree_root,
++				u64 objectid,
++				struct btrfs_root_item *item,
++				lookup_pool_id lpid)
++{
++	int ret;
++	int slot;
++	struct btrfs_key search_key;
++	struct btrfs_key found_key;
++	struct btrfs_path *path;
++
++	search_key.objectid = objectid;
++	search_key.type = BTRFS_ROOT_ITEM_KEY;
++	search_key.offset = (u64)-1;
++	path = btrfs_grab_path(lpid);
++
++	ret = aux_tree_lookup(tree_root, &search_key, path);
++	if (ret < 0)
++		return 1;
++	slot = path->slots[0];
++	WARN_ON(slot == 0);
++	slot -= 1;
++	btrfs_item_key_to_cpu(&path->nodes[0], &found_key, slot);
++	if (found_key.objectid != objectid)
++		return 1;
++	
++	read_extent_buffer(&path->nodes[0], item,
++			   btrfs_item_ptr_offset(&path->nodes[0], slot),
++			   sizeof(*item));
++	return 0;
++}
++
++static int find_setup_root(struct btrfs_root *tree_root,
++			   u32 nodesize,
++			   u32 leafsize,
++			   u32 sectorsize,
++			   u32 stripesize,
++			   u64 objectid,
++			   struct btrfs_root *dest_root,
++			   u64 bytenr,
++			   u32 blocksize,
++			   u64 generation,
++			   lookup_pool_id lpid)
++{
++	int ret;
++	struct extent_buffer eb;
++
++	setup_root(dest_root,
++		   nodesize,
++		   leafsize,
++		   sectorsize,
++		   stripesize,
++		   objectid);
++	if (tree_root) {
++		/*
++		 * pick up the latest version
++		 * of the root we want to set up
++		 */
++		ret = btrfs_find_last_root(tree_root, objectid,
++					   &dest_root->root_item,
++					   lpid);
++		if (ret)
++			return ret;
++		bytenr = btrfs_root_bytenr(&dest_root->root_item);
++		blocksize = btrfs_level_size(dest_root,
++				       btrfs_root_level(&dest_root->root_item));
++		generation = btrfs_root_generation(&dest_root->root_item);
++	}
++	ret = read_tree_block(dest_root,
++			      &eb,
++			      bytenr,
++			      blocksize,
++			      generation,
++			      lpid);
++	if (!ret)
++		return 1;
++	copy_extent_buffer(&dest_root->node, &eb);
++	return 0;
++}
++
++static inline int btrfs_strncmp(const char *cs, const char *ct, int count)
++{
++	signed char __res = 0;
++
++	while (count) {
++		if ((__res = *cs - *ct++) != 0 || !*cs++)
++			break;
++		count--;
++	}
++	return __res;
++}
++
++/*
++ * the same as devread, but accepts
++ * device number, start and length.
++ */
++static int btrfs_devread(unsigned long drive, unsigned long part,
++			 unsigned long dev_len, int sector,
++			 int byte_offset, int byte_len, char *buf)
++{
++	if (sector < 0
++	    || ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS))
++		>= dev_len)) {
++		errnum = ERR_OUTSIDE_PART;
++		return 0;
++	}
++	sector += byte_offset >> SECTOR_BITS;
++	byte_offset &= SECTOR_SIZE - 1;
++#if !defined(STAGE1_5)
++	if (disk_read_hook && debug)
++		printf ("<%d, %d, %d>", sector, byte_offset, byte_len);
++#endif /* !STAGE1_5 */
++	return rawread(drive, part + sector, byte_offset,
++		       byte_len, buf);
++}
++
++static int btrfs_check_super(void)
++{
++	struct btrfs_super_block *sb = BTRFS_SUPER;
++
++	if (sb->nodesize != BTRFS_DEFAULT_NODE_SIZE) {
++		btrfs_msg("Btrfs node size (%d) != %d unsupported\n",
++			  sb->nodesize, BTRFS_DEFAULT_NODE_SIZE);
++		goto error;
++	}
++	if (sb->leafsize != BTRFS_DEFAULT_LEAF_SIZE) {
++ 	        btrfs_msg("Btrfs leaf size (%d) != %d unsupported\n",
++			  sb->leafsize, BTRFS_DEFAULT_LEAF_SIZE);
++		goto error;
++	}
++	
++ 	return 0;
++error:
++	return 1;
++}
++
++/* lift the super block */
++static int btrfs_uptodate_super_copy(struct btrfs_fs_info *fs)
++{
++	errnum = ERR_NONE;
++	btrfs_devread(BTRFS_FS_INFO->sb_dev.drive,
++		      BTRFS_FS_INFO->sb_dev.part,
++		      BTRFS_FS_INFO->sb_dev.length,
++		      btrfs_sb_offset(BTRFS_FS_INFO->sb_mirror) >> SECTOR_BITS,
++		      0,
++		      sizeof(struct btrfs_super_block),
++		      (char *)BTRFS_SUPER);
++	return btrfs_check_super();
++}
++  
++/*
++ * Looking for a btrfs super block by magic, @fsid and @devid
++ * (the last two ones are optional). Update latest transid (if
++ * any). Return 0, if such super block was found. Otherwise,
++ * return 1.
++ *
++ * NOTE:
++ * After calling this function the sb_copy of global btrfs_fs_info
++ * can contain garbage, so the caller is responsible for this to be
++ * uptodate (see the function btrfs_uptodate_super_copy()).
++ */
++static int btrfs_find_super(struct btrfs_device *dev, char *fsid, u64 *devid)
++{
++	int i, ret;
++	int found = 0;
++
++	for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
++		ret = btrfs_devread(dev->drive,
++				    dev->part,
++				    dev->length,
++				    btrfs_sb_offset(i) >> SECTOR_BITS,
++				    0,
++				    sizeof(struct btrfs_super_block),
++				    (char *)BTRFS_SUPER);
++		if (!ret) {
++			if (errnum == ERR_OUTSIDE_PART) {
++				errnum = ERR_NONE;
++				break;
++			} else {
++				errnum = ERR_NONE;
++				continue;
++			}
++		}
++		if (btrfs_super_bytenr(BTRFS_SUPER) != btrfs_sb_offset(i) ||
++		    btrfs_strncmp((char *)(&BTRFS_SUPER->magic),
++				  BTRFS_MAGIC,
++				  sizeof(BTRFS_SUPER->magic)))
++			continue;
++		if (fsid &&
++		    btrfs_strncmp(fsid,
++				  (char *)BTRFS_SUPER->fsid,
++				  BTRFS_FSID_SIZE))
++			return 1;
++		if (devid &&
++		    *devid != btrfs_super_devid(BTRFS_SUPER))
++			return 1;
++		found = 1;
++		dev->devid = btrfs_super_devid(BTRFS_SUPER);
++
++		if (btrfs_super_generation(BTRFS_SUPER) >
++		    BTRFS_FS_INFO->sb_transid) {
++			BTRFS_FS_INFO->sb_transid =
++				btrfs_super_generation(BTRFS_SUPER);
++			BTRFS_FS_INFO->sb_mirror = i;
++			BTRFS_FS_INFO->sb_dev.devid =
++				btrfs_super_devid(BTRFS_SUPER);
++			BTRFS_FS_INFO->sb_dev.drive = dev->drive;
++			BTRFS_FS_INFO->sb_dev.part = dev->part;
++			BTRFS_FS_INFO->sb_dev.length = dev->length;
++		}
++	}
++	return !found;
++}
++
++/*
++ * "Discern" a btrfs device by fsid and
++ * optionaly by devid (if lookup is set).
++ * Populate persistent device cache (if
++ * there are free slots).
++ */
++static int btrfs_discerner(struct btrfs_device **dev, int lookup)
++{
++	if (btrfs_find_super(*dev,
++			     (char *)BTRFS_FS_INFO->fsid,
++			     (lookup ? &(*dev)->devid : 0)))
++		/* not found */
++		return 0;
++	if (*dev < BTRFS_VOLATILE_DEV_CACHE) {
++		/* populate persistent device cache */
++		memcpy(*dev + 1, *dev, sizeof(struct btrfs_device));
++		(*dev)++;
++	}
++	return 1;
++}
++
++/*
++ * Scan available grub devices and call discerner
++ * for them. Return a number of discerned devices
++ * The scanner was stolen from print_completions().
++ *
++ * Preconditions:
++ * The global structure btrfs_fs_info contains
++ * the latest valid version of btrfs superblock
++ * (the field @sb_copy)
++ */
++static u64 scan_grub_devices(struct btrfs_device *dev,
++			     int (*discerner)(struct btrfs_device **, int),
++			     int lookup)
++{
++	int i, j;
++	u64 count = 0;
++	struct geometry geom;
++
++	for (i = 0; i < 2; i++)
++		for (j = 0; j < 8; j++) {
++			unsigned long part = 0xFFFFFF;
++			int type, entry, gpt_count, gpt_size;
++			unsigned long offset, ext_offset, gpt_offset;
++
++			dev->drive = (i * 0x80) + j;
++			if (get_diskinfo(dev->drive, &geom))
++				continue;
++			while (1) {
++				int ret;
++				buf_drive = -1;
++				errnum = ERR_NONE;
++				ret = next_partition(dev->drive, 0xFFFFFF,
++						     &part, &type, &dev->part,
++						     &dev->length, &offset,
++						     &entry, &ext_offset,
++						     &gpt_offset, &gpt_count,
++						     &gpt_size,
++						     BTRFS_FS_INFO->mbr);
++				if (!ret)
++					break;
++				if (discerner(&dev, lookup)) {
++					count++;
++					if (lookup)
++						goto exit;
++				}
++			}
++		}
++#if 0
++	errnum = ERR_NONE;
++	if (cdrom_drive != GRUB_INVALID_DRIVE &&
++	    !get_diskinfo(cdrom_drive, &geom)) {
++		dev->drive = cdrom_drive;
++		dev->part = 0;
++		dev->length = geom.total_sectors;
++		if (discerner(&dev, lookup)) {
++			count++;
++			if (lookup)
++				goto exit;
++		}
++	}
++#ifdef SUPPORT_NETBOOT
++	errnum = ERR_NONE;
++	if (network_ready &&
++	    !get_diskinfo(NETWORK_DRIVE, &geom)) {
++		dev->drive = NETWORK_DRIVE;
++		dev->part = 0;
++		dev->length = geom.total_sectors;
++		if (discerner(&dev, lookup)) {
++			count++;
++			if (lookup)
++				goto exit;
++		}
++	}
++#endif /* SUPPORT_NETBOOT */
++#endif /* 0 */
++ exit:
++	return count;
++}
++
++#if 0
++static int btrfs_next_item(struct btrfs_root *root,
++			   struct btrfs_path *path);
++
++/*
++ * Scan the chunk tree for dev items
++ * and call a seeker for all of them.
++ * Preconditions: chunk root is installed
++ * to the global btrfs_fs_info.
++ */
++static int scan_dev_tree(struct btrfs_device* (*seeker)(u64))
++{
++	int ret;
++	u64 num_devices = 0;
++	struct btrfs_key key;
++	struct btrfs_key found_key;
++	struct btrfs_path *path;
++	struct btrfs_root *root;
++
++	root = BTRFS_CHUNK_ROOT;
++	path = btrfs_grab_path(FIRST_EXTERNAL_LOOKUP_POOL);
++	key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
++	key.type = 0;
++	key.offset = 0;
++
++	ret = aux_tree_lookup(root, &key, path);
++	if (ret == -1)
++		goto corrupted;
++	while (1) {
++		struct btrfs_device *result;
++		struct btrfs_dev_item *dev_item;
++
++		btrfs_item_key_to_cpu(&path->nodes[0],
++				      &found_key,
++				      path->slots[0]);
++		if (found_key.objectid != BTRFS_DEV_ITEMS_OBJECTID)
++			break;
++		dev_item = btrfs_item_ptr(&path->nodes[0],
++					  path->slots[0],
++					  struct btrfs_dev_item);
++		result = seeker(btrfs_device_id(&path->nodes[0], dev_item));
++		if (result == NULL) {
++			btrfs_msg("Btrfs device %llu is not available\n",
++				  btrfs_device_id(&path->nodes[0], dev_item));
++			goto missed_dev;
++		}
++		num_devices++;
++		ret = btrfs_next_item(root, path);
++		if (ret)
++			break;
++	}
++	if (num_devices == btrfs_super_num_devices(BTRFS_SUPER))
++		return 0;
++ corrupted:
++	errnum = ERR_FSYS_CORRUPT;
++	return 1;
++ missed_dev:
++	errnum = ERR_FSYS_MOUNT;
++	return 1;
++}
++#endif /* 0 */
++
++/*
++ * Find a grub btrfs device by devid.
++ * Preconditions: global btrfs_fs_info
++ * contains a copy of btrfs super block.
++ *
++ * Return pointer to the cached device on success.
++ * Otherwise return NULL.
++ */
++static struct btrfs_device *btrfs_lookup_device(u64 devid)
++{
++	int i, result;
++	struct btrfs_device *cdev;
++
++	for (i = 0; i < BTRFS_NUM_CACHED_DEVICES; i++) {
++		cdev = &BTRFS_DEVICES[i];
++		if (cdev->devid == devid)
++			goto found_in_cache;
++		if (cdev->devid == 0)
++			goto not_found_in_cache;
++	}
++not_found_in_cache:
++	cdev = BTRFS_VOLATILE_DEV_CACHE;
++	cdev->devid = devid;
++	result = scan_grub_devices(cdev,
++				   btrfs_discerner,
++				   1);
++	if (result == 0)
++		/*
++		 * At mount time we have figured out that
++		 * number of available devices is not less
++		 * then number of devices recorded in the
++		 * super block. Hence we treat this case as
++		 * file system corruption.
++		 */
++		goto corrupt;
++	result = btrfs_uptodate_super_copy(BTRFS_FS_INFO);
++	if (result)
++		goto corrupt;
++found_in_cache:
++	return cdev;
++corrupt:
++	errnum = ERR_FSYS_CORRUPT;
++	return NULL;
++}
++
++static int btrfs_find_device(struct btrfs_device *dev)
++{
++	struct btrfs_device *cdev;
++
++	if (btrfs_super_num_devices(BTRFS_SUPER) == 1) {
++		dev->drive = current_drive;
++		dev->part = part_start;
++		dev->length = part_length;
++		return 0;
++	}
++	cdev = btrfs_lookup_device(dev->devid);
++	if (cdev == NULL)
++		return 1;
++	dev->drive  = cdev->drive;
++	dev->part   = cdev->part;
++	dev->length = cdev->length;
++	return 0;
++}
++
++static inline void init_btrfs_volatile_dev_cache(void)
++{
++	BTRFS_VOLATILE_DEV_CACHE->devid = 0;
++	BTRFS_VOLATILE_DEV_CACHE->drive = current_drive;
++	BTRFS_VOLATILE_DEV_CACHE->part = part_start;
++	BTRFS_VOLATILE_DEV_CACHE->length = part_length;
++}
++
++/*
++ * check availability of btrfs devices
++ * and populate the persistent device cache
++ */
++static int btrfs_check_devices(void)
++{
++	u64 num_dev;
++
++	if (btrfs_super_num_devices(BTRFS_SUPER) == 1)
++		return 0;
++	num_dev = scan_grub_devices(BTRFS_DEVICES,
++				    btrfs_discerner, 0);
++	if (btrfs_uptodate_super_copy(BTRFS_FS_INFO))
++		return 1;
++	if (num_dev < btrfs_super_num_devices(BTRFS_SUPER)) {
++		btrfs_msg("Some (%llu) Btrfs devices is not available\n",
++			  btrfs_super_num_devices(BTRFS_SUPER) - num_dev);
++	        return 1;
++	}
++	return 0;
++}
++
++int btrfs_mount(void)
++{
++	int ret;
++
++	check_btrfs_cache_size();
++	init_btrfs_info();
++	init_btrfs_volatile_dev_cache();
++
++	ret = btrfs_find_super(BTRFS_VOLATILE_DEV_CACHE, NULL, NULL);
++	if (ret) {
++		btrfs_msg("Drive %lu, partition %lu: no Btrfs metadata\n",
++			  current_drive, part_start);
++		goto error;
++	}
++	ret = btrfs_uptodate_super_copy(BTRFS_FS_INFO);
++	if (ret)
++		goto error;
++	BTRFS_FS_INFO->sb_transid =
++		btrfs_super_generation(BTRFS_SUPER);
++	memcpy(BTRFS_FS_INFO->fsid,
++	       BTRFS_SUPER->fsid,
++	       BTRFS_FSID_SIZE);
++	ret = btrfs_check_devices();
++	if (ret)
++		goto error;
++	/* setup chunk root */
++	ret = find_setup_root(NULL,
++			      btrfs_super_nodesize(BTRFS_SUPER),
++			      btrfs_super_leafsize(BTRFS_SUPER),
++			      btrfs_super_sectorsize(BTRFS_SUPER),
++			      btrfs_super_stripesize(BTRFS_SUPER),
++			      BTRFS_CHUNK_TREE_OBJECTID,
++			      BTRFS_CHUNK_ROOT,
++			      btrfs_super_chunk_root(BTRFS_SUPER),
++			      btrfs_chunk_root_level_size(BTRFS_SUPER),
++			      btrfs_super_chunk_root_generation(BTRFS_SUPER),
++			      FIRST_EXTERNAL_LOOKUP_POOL);
++	if (ret)
++		return 0;
++	/* setup tree root */
++	ret = find_setup_root(NULL,
++			      btrfs_super_nodesize(BTRFS_SUPER),
++			      btrfs_super_leafsize(BTRFS_SUPER),
++			      btrfs_super_sectorsize(BTRFS_SUPER),
++			      btrfs_super_stripesize(BTRFS_SUPER),
++			      BTRFS_ROOT_TREE_OBJECTID,
++			      BTRFS_TREE_ROOT,
++			      btrfs_super_root(BTRFS_SUPER),
++			      btrfs_root_level_size(BTRFS_SUPER),
++			      btrfs_super_generation(BTRFS_SUPER),
++			      FIRST_EXTERNAL_LOOKUP_POOL);
++	if (ret)
++		return 0;
++	/* setup fs_root */
++	ret = find_setup_root(BTRFS_TREE_ROOT,
++			      btrfs_super_nodesize(BTRFS_SUPER),
++			      btrfs_super_leafsize(BTRFS_SUPER),
++			      btrfs_super_sectorsize(BTRFS_SUPER),
++			      btrfs_super_stripesize(BTRFS_SUPER),
++			      BTRFS_FS_TREE_OBJECTID,
++			      BTRFS_FS_ROOT,
++			      0,
++			      0,
++			      0,
++			      FIRST_EXTERNAL_LOOKUP_POOL);
++	return !ret;
++
++error:
++	errnum = ERR_FSYS_MOUNT;
++	return 0;
++}
++
++/*
++ * Check, whether @chunk is the map for a
++ * block with @logical block number.
++ * If yes, then fill the @map.
++ * Return 1 on affirmative result,
++ * otherwise return 0.
++ */
++int check_read_chunk(struct btrfs_key *key,
++			    struct extent_buffer *leaf,
++			    struct btrfs_chunk *chunk,
++			    struct map_lookup *map,
++			    u64 logical)
++{
++	int i, ret;
++	u64 chunk_start;
++	u64 chunk_size;
++	int num_stripes;
++
++	chunk_start = key->offset;
++	chunk_size = btrfs_chunk_length(leaf, chunk);
++
++	if (logical + 1 > chunk_start + chunk_size ||
++	    logical < chunk_start)
++		/* not a fit */
++		return 0;
++	num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
++	map->ce.start = chunk_start;
++	map->ce.size = chunk_size;
++	map->num_stripes = num_stripes;
++	map->io_width = btrfs_chunk_io_width(leaf, chunk);
++	map->io_align = btrfs_chunk_io_align(leaf, chunk);
++	map->sector_size = btrfs_chunk_sector_size(leaf, chunk);
++	map->stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
++	map->type = btrfs_chunk_type(leaf, chunk);
++	map->sub_stripes = btrfs_chunk_sub_stripes(leaf, chunk);
++
++	for (i = 0; i < num_stripes; i++) {
++		map->stripes[i].physical =
++			btrfs_stripe_offset_nr(leaf, chunk, i);
++		map->stripes[i].dev.devid =
++			btrfs_stripe_devid_nr(leaf, chunk, i);
++		ret = btrfs_find_device(&map->stripes[i].dev);
++		if (ret)
++			return 0;
++	}
++	return 1;
++}
++
++static void init_extent_buffer(struct extent_buffer *eb,
++			       struct btrfs_device *dev,
++			       u64 logical,
++			       u32 blocksize,
++			       u64 physical,
++			       lookup_pool_id lpid)
++{
++	if (dev)
++		memcpy(&eb->dev, dev, sizeof(*dev));
++	eb->start = logical;
++	eb->len = blocksize;
++	eb->dev_bytenr = physical;
++	eb->data = grab_lookup_cache(lpid);
++}
++
++/*
++ * Search for a map by logical offset in sys array.
++ * Return -1 on errors;
++ * Return 1 if the map is found,
++ * Return 0 if the map is not found.
++ */
++int sys_array_lookup(struct map_lookup *map, u64 logical)
++{
++	struct extent_buffer sb;
++	struct btrfs_disk_key *disk_key;
++	struct btrfs_chunk *chunk;
++	struct btrfs_key key;
++	u32 num_stripes;
++	u32 array_size;
++	u32 len = 0;
++	u8 *ptr;
++	unsigned long sb_ptr;
++	u32 cur;
++	int ret;
++	int i = 0;
++
++	sb.data = (char *)BTRFS_SUPER;
++	array_size = btrfs_super_sys_array_size(BTRFS_SUPER);
++
++	ptr = BTRFS_SUPER->sys_chunk_array;
++	sb_ptr = offsetof(struct btrfs_super_block, sys_chunk_array);
++	cur = 0;
++
++	while (cur < array_size) {
++		disk_key = (struct btrfs_disk_key *)ptr;
++		btrfs_disk_key_to_cpu(&key, disk_key);
++
++		len = sizeof(*disk_key);
++		ptr += len;
++		sb_ptr += len;
++		cur += len;
++
++		if (key.type == BTRFS_CHUNK_ITEM_KEY) {
++			chunk = (struct btrfs_chunk *)sb_ptr;
++			ret = check_read_chunk(&key, &sb,
++					       chunk, map, logical);
++			if (ret)
++				/* map is found */
++				return ret;
++			num_stripes = btrfs_chunk_num_stripes(&sb, chunk);
++			len = btrfs_chunk_item_size(num_stripes);
++		} else {
++			errnum = ERR_FSYS_CORRUPT;
++			return -1;
++		}
++		ptr += len;
++		sb_ptr += len;
++		cur += len;
++		i++;
++	}
++	return 0;
++}
++
++/*
++ * Search for a map by logical offset in the chunk tree.
++ * Return 1 if map is found, otherwise return 0.
++ */
++static int chunk_tree_lookup(struct map_lookup *map,
++			     u64 logical)
++{
++	int ret;
++	int slot;
++	struct extent_buffer *leaf;
++	struct btrfs_key key;
++	struct btrfs_key found_key;
++	struct btrfs_chunk *chunk;
++	struct btrfs_path *path;
++
++	path = btrfs_grab_path(INTERNAL_LOOKUP_POOL);
++
++	key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
++	key.offset = logical;
++	key.type = BTRFS_CHUNK_ITEM_KEY;
++
++	ret = aux_tree_lookup(BTRFS_CHUNK_ROOT, &key, path);
++	if (ret < 0)
++		return 0;
++	leaf = &path->nodes[0];
++	slot = path->slots[0];
++	if (ret == 1) {
++		WARN_ON(slot == 0);
++		slot -= 1;
++	}
++	btrfs_item_key_to_cpu(leaf, &found_key, slot);
++	if (found_key.type != BTRFS_CHUNK_ITEM_KEY)
++		return 0;
++	chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk);
++	return check_read_chunk(&found_key, leaf,
++				chunk, map, logical);
++}
++
++/*
++ * Btrfs logical/physical block mapper.
++ * Look for an appropriate map-extent and
++ * perform a translation. Return 1 on errors.
++ */
++static int btrfs_map_block(u64 logical, u64 *length,
++			   struct btrfs_multi_bio *multi,
++			   int mirror_num)
++{
++	struct map_lookup map;
++	u64 offset;
++	u64 stripe_offset;
++	u64 stripe_nr;
++	struct cache_extent *ce;
++	int stripe_index;
++	int i;
++	int ret;
++
++	memset(&map, 0, sizeof(map));
++	ret = sys_array_lookup(&map, logical);
++	if (ret == -1) {
++		errnum = ERR_FSYS_CORRUPT;
++		return 1;
++	}
++	if (ret == 0) {
++		ret = chunk_tree_lookup(&map, logical);
++		if (!ret) {
++			/* something should be found! */
++			errnum = ERR_FSYS_CORRUPT;
++			return 1;
++		}
++	}
++	/* do translation */
++	ce = &map.ce;
++
++	offset = logical - ce->start;
++	stripe_nr = offset / map.stripe_len;
++	stripe_offset = stripe_nr * map.stripe_len;
++	WARN_ON(offset < stripe_offset);
++
++	stripe_offset = offset - stripe_offset;
++
++	if (map.type & (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
++			 BTRFS_BLOCK_GROUP_RAID10 |
++			 BTRFS_BLOCK_GROUP_DUP)) {
++		*length = min_t(u64, ce->size - offset,
++			      map.stripe_len - stripe_offset);
++	} else {
++		*length = ce->size - offset;
++	}
++	multi->num_stripes = 1;
++	stripe_index = 0;
++	if (map.type & BTRFS_BLOCK_GROUP_RAID1) {
++		if (mirror_num)
++			stripe_index = mirror_num - 1;
++		else
++			stripe_index = stripe_nr % map.num_stripes;
++	} else if (map.type & BTRFS_BLOCK_GROUP_RAID10) {
++		int factor = map.num_stripes / map.sub_stripes;
++
++		stripe_index = stripe_nr % factor;
++		stripe_index *= map.sub_stripes;
++
++		if (mirror_num)
++			stripe_index += mirror_num - 1;
++		else
++			stripe_index = stripe_nr % map.sub_stripes;
++
++		stripe_nr = stripe_nr / factor;
++	} else if (map.type & BTRFS_BLOCK_GROUP_DUP) {
++		if (mirror_num)
++			stripe_index = mirror_num - 1;
++	} else {
++		stripe_index = stripe_nr % map.num_stripes;
++		stripe_nr = stripe_nr / map.num_stripes;
++	}
++	WARN_ON(stripe_index >= map.num_stripes);
++
++	for (i = 0; i < multi->num_stripes; i++) {
++		asm("" : "+r"(multi));
++		multi->stripes[i].physical =
++			map.stripes[stripe_index].physical + stripe_offset +
++			stripe_nr * map.stripe_len;
++		memcpy(&multi->stripes[i].dev,
++		       &map.stripes[stripe_index].dev,
++		       sizeof(struct btrfs_device));
++		stripe_index++;
++	}
++	return 0;
++}
++
++static u64 read_data_extent(u64 logical_start, u64 to_read, char *pos)
++{
++	int ret;
++	u64 length;
++	struct btrfs_multi_bio multi;
++
++	while (to_read) {
++		ret = btrfs_map_block(logical_start, &length, &multi, 0);
++		if (ret) {
++			errnum = ERR_FSYS_CORRUPT;
++			return ret;
++		}
++		if (length > to_read)
++			length = to_read;
++		disk_read_func = disk_read_hook;
++		ret = btrfs_devread(multi.stripes[0].dev.drive,
++				    multi.stripes[0].dev.part,
++				    multi.stripes[0].dev.length,
++				    multi.stripes[0].physical >> SECTOR_BITS,
++				    logical_start & ((u64)SECTOR_SIZE - 1),
++				    length,
++				    pos);
++		disk_read_func = NULL;
++		if (!ret)
++			return 1;
++		btrfs_msg("BTRFS data extent: read %llu bytes\n", length);
++		to_read -= length;
++		pos += length;
++		logical_start += length;
++	}
++	return 0;
++}
++
++static int read_extent_from_disk(struct extent_buffer *eb)
++{
++	WARN_ON(eb->dev_bytenr % SECTOR_BITS);
++	return btrfs_devread(eb->dev.drive,
++			     eb->dev.part,
++			     eb->dev.length,
++			     eb->dev_bytenr >> SECTOR_BITS,
++			     0,
++			     eb->len,
++			     eb->data);
++}
++
++static int verify_parent_transid(struct extent_buffer *eb, u64 parent_transid)
++{
++	return parent_transid && (btrfs_header_generation(eb) != parent_transid);
++}
++
++static int btrfs_num_copies(u64 logical, u64 len)
++{
++	return 1;
++}
++
++static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
++{
++	return 0;
++}
++
++static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
++		    int verify)
++{
++	return 0;
++}
++
++/*
++ * Read a block of logical number @bytenr
++ * from disk to buffer @eb.
++ * Return 1 on success.
++ */
++int read_tree_block(struct btrfs_root *root,
++		    struct extent_buffer *eb,
++		    u64 bytenr, /* logical */
++		    u32 blocksize,
++		    u64 parent_transid,
++		    lookup_pool_id lpid)
++{
++	int ret;
++	int dev_nr;
++	u64 length;
++	struct btrfs_multi_bio multi;
++	int mirror_num = 0;
++	int num_copies;
++
++	dev_nr = 0;
++	length = blocksize;
++	while (1) {
++		ret = btrfs_map_block(bytenr,
++				      &length, &multi, mirror_num);
++		if (ret) {
++			errnum = ERR_FSYS_CORRUPT;
++			return 0;
++		}
++		init_extent_buffer(eb,
++				   &multi.stripes[0].dev,
++				   bytenr,
++				   blocksize,
++				   multi.stripes[0].physical,
++				   lpid);
++
++		ret = read_extent_from_disk(eb);
++		if (ret &&
++		    check_tree_block(root, eb) == 0 &&
++		    csum_tree_block(root, eb, 1) == 0 &&
++		    verify_parent_transid(eb, parent_transid) == 0)
++			return 1;
++
++		num_copies = btrfs_num_copies(eb->start, eb->len);
++		if (num_copies == 1)
++			break;
++		mirror_num++;
++		if (mirror_num > num_copies)
++			break;
++	}
++	return 0;
++}
++
++/*
++ * Read a child pointed by @slot node pointer
++ * of @parent. Put the result to @parent.
++ * Return 1 on success.
++ */
++static int parent2child(struct btrfs_root *root,
++			struct extent_buffer *parent,
++			int slot,
++			lookup_pool_id lpid)
++{
++	int level;
++
++	WARN_ON(slot < 0);
++	WARN_ON(slot >= btrfs_header_nritems(parent));
++
++	level = btrfs_header_level(parent);
++	WARN_ON(level <= 0);
++
++	return read_tree_block(root,
++			       parent,
++			       btrfs_node_blockptr(parent, slot),
++			       btrfs_level_size(root, level - 1),
++			       btrfs_node_ptr_generation(parent, slot),
++			       lpid);
++}
++
++static int btrfs_comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
++{
++	struct btrfs_key k1;
++
++	btrfs_disk_key_to_cpu(&k1, disk);
++
++	if (k1.objectid > k2->objectid)
++		return 1;
++	if (k1.objectid < k2->objectid)
++		return -1;
++	if (k1.type > k2->type)
++		return 1;
++	if (k1.type < k2->type)
++		return -1;
++	if (k1.offset > k2->offset)
++		return 1;
++	if (k1.offset < k2->offset)
++		return -1;
++	return 0;
++}
++
++static int bin_search(struct extent_buffer *eb, unsigned long p,
++		      int item_size, struct btrfs_key *key,
++		      int max, int *slot)
++{
++	int low = 0;
++	int high = max;
++	int mid;
++	int ret;
++	unsigned long offset;
++	struct btrfs_disk_key *tmp;
++
++	while(low < high) {
++		mid = (low + high) / 2;
++		offset = p + mid * item_size;
++
++		tmp = (struct btrfs_disk_key *)(eb->data + offset);
++		ret = btrfs_comp_keys(tmp, key);
++
++		if (ret < 0)
++			low = mid + 1;
++		else if (ret > 0)
++			high = mid;
++		else {
++			*slot = mid;
++			return 0;
++		}
++	}
++	*slot = low;
++	return 1;
++}
++
++/* look for a key in a node */
++static int node_lookup(struct extent_buffer *eb,
++		       struct btrfs_key *key,
++		       int *slot)
++{
++	if (btrfs_header_level(eb) == 0) {
++		return bin_search(eb,
++				  offsetof(struct btrfs_leaf, items),
++				  sizeof(struct btrfs_item),
++				  key, btrfs_header_nritems(eb),
++				  slot);
++	} else {
++		return bin_search(eb,
++				  offsetof(struct btrfs_node, ptrs),
++				  sizeof(struct btrfs_key_ptr),
++				  key, btrfs_header_nritems(eb),
++				  slot);
++	}
++	return -1;
++}
++
++static inline int check_node(struct extent_buffer *buf, int slot)
++{
++	return 0;
++}
++
++/*
++ * Look for an item by key in read-only tree.
++ * Return 0, if key was found. Return -1 on io errors.
++ *
++ * Preconditions: btrfs_mount already executed.
++ * Postconditions: if returned value is non-negative,
++ * then path[0] represents the found position in the
++ * tree. All components of the @path from leaf to root
++ * are valid except their data buffers (only path[0]
++ * has valid attached data buffer).
++ */
++
++int aux_tree_lookup(struct btrfs_root *root,
++		    struct btrfs_key *key,
++		    struct btrfs_path *path)
++{
++	int ret;
++	int slot = 0;
++	int level;
++	struct extent_buffer node;
++	init_extent_buffer(&node,
++			   NULL,
++			   0,
++			   0,
++			   0,
++			   path->lpid);
++	copy_extent_buffer(&node, &root->node);
++	do {
++		level = btrfs_header_level(&node);
++		ret = check_node(&node, slot);
++		if (ret)
++			return -1;
++		move_extent_buffer(&path->nodes[level],
++				   &node);
++		ret = node_lookup(&node, key, &slot);
++		if (ret < 0)
++			return ret;
++		if (level) {
++		        /*
++			 * non-leaf,
++			 * jump to the next level
++			 */
++			if (ret && slot > 0)
++			        slot -= 1;
++			ret = parent2child(root, &node, slot, path->lpid);
++			if (ret == 0)
++				return -1;
++		}
++		path->slots[level] = slot;
++	} while (level);
++	return ret;
++}
++
++static int readup_buffer(struct extent_buffer *buf, lookup_pool_id lpid)
++{
++	buf->data = grab_lookup_cache(lpid);
++	return read_extent_from_disk(buf);
++}
++
++/*
++ * Find the next leaf in accordance with tree order;
++ * walk up the tree as far as required to find it.
++ * Returns 0 if something was found, or 1 if there
++ * are no greater leaves. Returns < 0 on io errors.
++ *
++ * Preconditions: all @path components from leaf to
++ * root have valid meta-data fields. path[0] has a
++ * valid attached data buffer with initial leaf.
++ * Postcondition: the same as above, but path[0] has
++ * an attached data buffer with the next leaf.
++ */
++static int btrfs_next_leaf(struct btrfs_root *root,
++			   struct btrfs_path *path)
++{
++	int res;
++	int slot;
++	int level = 1;
++	struct extent_buffer *buf;
++
++	while(level < BTRFS_MAX_LEVEL) {
++		buf = &path->nodes[level];
++		slot = path->slots[level] + 1;
++		/*
++		 * lift data on this level
++		 */
++		res = readup_buffer(buf, path->lpid);
++		if (!res)
++			break;
++		if (slot >= btrfs_header_nritems(buf)) {
++			/* alas, go to parent (if any) */
++			level++;
++			res = 1;
++			continue;
++		}
++		break;
++	}
++	if (!res)
++		return 1;
++	/*
++	 * At this level slot points to
++	 * the subtree we are interested in.
++	 */
++	path->slots[level] = slot;
++	while(level) {
++		struct extent_buffer tmp;
++		move_extent_buffer(&tmp, &path->nodes[level]);
++		res = parent2child(root, &tmp, slot, path->lpid);
++		if (res == 0)
++			return -1;
++		level --;
++		slot = 0;
++		move_extent_buffer(&path->nodes[level], &tmp);
++		path->slots[level] = slot;
++	}
++	return 0;
++}
++
++/* Preconditions: path is valid, data buffer
++ * is attached to leaf node.
++ * Postcondition: path is updated to point to
++ * the next position with respect to the tree
++ * order.
++ *
++ * Return -1 on io errors.
++ * Return 0, if next item was found.
++ * Return 1, if next item wasn't found (no more items).
++ */
++static int btrfs_next_item(struct btrfs_root *root,
++			   struct btrfs_path *path)
++{
++	WARN_ON(path->slots[0] >= btrfs_header_nritems(&path->nodes[0]));
++
++	path->slots[0] += 1;
++
++	if (path->slots[0] < btrfs_header_nritems(&path->nodes[0]))
++		return 0;
++	if (coord_is_root(root, path))
++		/* no more items */
++		return 1;
++	return btrfs_next_leaf(root, path);
++}
++
++/*
++ * check if we can reuse results of previous
++ * search for read operation
++ */
++static int path_is_valid(struct btrfs_path *path,
++			 struct btrfs_key *key, u64 offset)
++{
++	btrfs_item_key_to_cpu(&path->nodes[0],
++			      key,
++			      path->slots[0]);
++	if (BTRFS_FILE_INFO_KEY->objectid != key->objectid)
++		return 0;
++	if (btrfs_key_type(key) == BTRFS_INODE_ITEM_KEY)
++		return 1;
++	if (btrfs_key_type(key) != BTRFS_EXTENT_DATA_KEY)
++		return 0;
++	return BTRFS_FILE_INFO_KEY->offset <= offset;
++}
++
++/* ->read_func() */
++int btrfs_read(char *buf, int len)
++{
++	int ret;
++	struct btrfs_root *fs_root;
++	struct btrfs_path *path;
++	struct btrfs_key  path_key;
++	u64 ioff;
++	u64 bytes;
++	int to_read;
++	char *pos = buf;
++
++	fs_root = BTRFS_FS_ROOT;
++	path = btrfs_grab_path(FIRST_EXTERNAL_LOOKUP_POOL);
++
++	if (!path_is_valid(path, &path_key, filepos)) {
++		ret = aux_tree_lookup(fs_root, BTRFS_FILE_INFO_KEY, path);
++		if (ret < 0)
++			errnum = ERR_FSYS_CORRUPT;
++	}
++	while (!errnum) {
++		struct btrfs_item *item;
++		struct btrfs_file_extent_item *fi;
++		u64 from;
++
++		btrfs_item_key_to_cpu(&path->nodes[0],
++				      &path_key,
++				      path->slots[0]);
++		if (BTRFS_FILE_INFO_KEY->objectid != path_key.objectid)
++			break;
++		if (btrfs_key_type(&path_key) != BTRFS_EXTENT_DATA_KEY)
++			goto next;
++		/*
++		 * current position is extent item
++		 */
++		item = btrfs_item_nr(&path->nodes[0], path->slots[0]);
++		fi = btrfs_item_ptr(&path->nodes[0],
++				    path->slots[0],
++				    struct btrfs_file_extent_item);
++		if (btrfs_file_extent_compression(&path->nodes[0], fi)) {
++		       btrfs_msg("Btrfs transparent compression unsupported\n");
++		       errnum = ERR_BAD_FILETYPE;
++		       goto exit;
++		}
++		ioff = filepos - path_key.offset;
++
++		switch (btrfs_file_extent_type(&path->nodes[0], fi)) {
++		case BTRFS_FILE_EXTENT_INLINE:
++			bytes = btrfs_file_extent_inline_item_len(&path->
++								  nodes[0],
++								  item);
++			if (path_key.offset + bytes < filepos)
++				goto next;
++			to_read = bytes - ioff;
++			if (to_read > len)
++				to_read = len;
++			from = ioff + btrfs_file_extent_inline_start(fi);
++			if (disk_read_hook != NULL) {
++				disk_read_func = disk_read_hook;
++				ret = btrfs_devread(path->nodes[0].dev.drive,
++						    path->nodes[0].dev.part,
++						    path->nodes[0].dev.length,
++						    path->nodes[0].dev_bytenr >>
++						    SECTOR_BITS,
++						    from,
++						    to_read,
++						    pos);
++				disk_read_func = NULL;
++				if (ret)
++					goto exit;
++			} else
++				memcpy(pos,
++				       path->nodes[0].data + from,
++				       to_read);
++			btrfs_msg("BTRFS inline extent: read %d bytes pos %d\n",
++				  to_read, filepos);
++			break;
++		case BTRFS_FILE_EXTENT_REG:
++			bytes = btrfs_file_extent_num_bytes(&path->nodes[0],
++							    fi);
++			if (path_key.offset + bytes < filepos)
++				goto next;
++			to_read = bytes - ioff;
++			if (to_read > len)
++				to_read = len;
++			from = ioff +
++				btrfs_file_extent_disk_bytenr(&path->nodes[0],
++							      fi) +
++				btrfs_file_extent_offset(&path->nodes[0],
++							 fi);
++			ret = read_data_extent(from, to_read, pos);
++			if (ret)
++				goto exit;
++			break;
++		case BTRFS_FILE_EXTENT_PREALLOC:
++			btrfs_msg("Btrfs preallocated extents unsupported\n");
++			errnum = ERR_BAD_FILETYPE;
++			goto exit;
++		default:
++			errnum = ERR_FSYS_CORRUPT;
++			goto exit;
++		}
++		len -= to_read;
++		pos += to_read;
++		filepos += to_read;
++		if (len == 0)
++			break;
++		/* not everything was read */
++	next:
++		ret = btrfs_next_item(fs_root, path);
++		if (ret < 0) {
++			errnum = ERR_FSYS_CORRUPT;
++			break;
++		}
++		btrfs_update_file_info(path);
++		continue;
++	}
++exit:
++	return errnum ? 0 : pos - buf;
++}
++
++static int btrfs_follow_link(struct btrfs_root *root,
++			     struct btrfs_path *path,
++			     char **dirname, char *linkbuf,
++			     int *link_count,
++			     struct btrfs_inode_item *sd)
++{
++	int ret;
++	int len;
++	char *name = *dirname;
++
++	if (++(*link_count) > MAX_LINK_COUNT) {
++		errnum = ERR_SYMLINK_LOOP;
++		return 0;
++	}
++	/* calculate remaining name size */
++	filemax = btrfs_inode_size(&path->nodes[0], sd);
++	for (len = 0;
++	     name[len] && isspace(name[len]);
++	     len ++);
++
++	if (filemax + len > PATH_MAX - 1) {
++		errnum = ERR_FILELENGTH;
++		return 0;
++	}
++	grub_memmove(linkbuf + filemax, name, len + 1);
++	btrfs_update_file_info(path);
++	filepos = 0;
++	/* extract symlink content */
++	while (1) {
++		u64 oid = BTRFS_FILE_INFO_KEY->objectid;
++		ret = btrfs_next_item(root, path);
++		if (ret)
++			break;
++		btrfs_update_file_info(path);
++		if (oid != BTRFS_FILE_INFO_KEY->objectid)
++			break;
++		if (btrfs_key_type(BTRFS_FILE_INFO_KEY) ==
++		    BTRFS_EXTENT_DATA_KEY)
++			goto found;
++	}
++	/* no target was found */
++	errnum = ERR_FSYS_CORRUPT;
++	return 0;
++found:
++	/* fill the rest of linkbuf with the content */
++	ret = btrfs_read(linkbuf, filemax);
++	if (ret != filemax) {
++		errnum = ERR_FSYS_CORRUPT;
++		return 0;
++	}
++	return 1;
++}
++
++static int update_fs_root(struct btrfs_root *fs_root,
++			  struct btrfs_key *location)
++{
++	int ret;
++	struct btrfs_root *tree_root;
++
++	if (location->offset != (u64)-1)
++		return 0;
++	tree_root = &BTRFS_FS_INFO->tree_root;
++	ret = find_setup_root(tree_root,
++			      tree_root->nodesize,
++			      tree_root->leafsize,
++			      tree_root->sectorsize,
++			      tree_root->stripesize,
++			      location->objectid,
++			      fs_root,
++			      0,
++			      0,
++			      0,
++			      SECOND_EXTERNAL_LOOKUP_POOL);
++	if (ret)
++		return ret;
++	location->objectid = btrfs_root_dirid(&fs_root->root_item);
++	btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY);
++	location->offset = 0;
++	return 0;
++}
++
++#ifndef STAGE1_5
++static inline void update_possibilities(void)
++{
++	if (print_possibilities > 0)
++		print_possibilities =
++			-print_possibilities;
++}
++#endif
++
++/*
++ * Look for a directory item by name.
++ * Print possibilities, if needed.
++ * Postconditions: on success @sd_key points
++ * to the key contained in the directory entry.
++ */
++static int btrfs_de_index_by_name(struct btrfs_root *root,
++				  struct btrfs_path *path,
++				  char **dirname,
++				  struct btrfs_key *sd_key)
++{
++	char ch;
++	int ret;
++	char *rest;
++	struct btrfs_dir_item *di;
++#ifndef STAGE1_5
++	int do_possibilities = 0;
++#endif
++	for (; **dirname == '/'; (*dirname)++);
++	for (rest = *dirname;
++	     (ch = *rest) && !isspace(ch) && ch != '/';
++	     rest++);
++	*rest = 0; /* for substrung() */
++#ifndef STAGE1_5
++	if (print_possibilities && ch != '/')
++		do_possibilities = 1;
++#endif
++	/* scan a directory */
++	while (1) {
++		u32 total;
++		u32 cur = 0;
++		u32 len;
++		struct btrfs_key di_key;
++		struct btrfs_disk_key location;
++		struct btrfs_item *item;
++
++		/* extract next dir entry */
++		ret = btrfs_next_item(root, path);
++		if (ret)
++			break;
++		item = btrfs_item_nr(&path->nodes[0],
++				     path->slots[0]);
++		btrfs_item_key_to_cpu(&path->nodes[0],
++				      &di_key,
++				      path->slots[0]);
++		if (di_key.objectid != sd_key->objectid)
++			/* no more entries */
++			break;
++		di = btrfs_item_ptr(&path->nodes[0],
++				    path->slots[0],
++				    struct btrfs_dir_item);
++		/*
++		 * working around special cases:
++		 * btrfs doesn't maintain directory entries
++		 * which contain names "." and ".."
++		 */
++		if (!substring(".", *dirname)) {
++#ifndef STAGE1_5
++			if (do_possibilities) {
++				update_possibilities();
++				return 1;
++			}
++#endif
++			goto found;
++		}
++		if (!substring("..", *dirname)) {
++			if (di_key.type != BTRFS_INODE_REF_KEY)
++				continue;
++			sd_key->objectid = di_key.offset;
++			btrfs_set_key_type(sd_key, BTRFS_INODE_ITEM_KEY);
++			sd_key->offset = 0;
++#ifndef STAGE1_5
++			if (do_possibilities) {
++				update_possibilities();
++				return 1;
++			}
++#endif
++			goto found;
++		}
++		if (di_key.type != BTRFS_DIR_ITEM_KEY)
++			continue;
++		total = btrfs_item_size(&path->nodes[0], item);
++		/* scan a directory item */
++		while (cur < total) {
++			char tmp;
++			int result;
++			char *filename;
++			char *end_of_name;
++			int name_len;
++			int data_len;
++
++			btrfs_dir_item_key(&path->nodes[0], di, &location);
++
++			name_len = btrfs_dir_name_len(&path->nodes[0], di);
++			data_len = btrfs_dir_data_len(&path->nodes[0], di);
++
++			WARN_ON(name_len > BTRFS_NAME_LEN);
++
++			filename = (char *)(path->nodes[0].data +
++					    (unsigned long)(di + 1));
++			end_of_name = filename + name_len;
++			/*
++			 * working around not null-terminated
++			 * directory names in btrfs: just
++			 * a short-term overwrite of the
++			 * cache with the following rollback
++			 * of the change.
++			 */
++			tmp = *end_of_name;
++			*end_of_name = 0;
++			result = substring(*dirname, filename);
++			*end_of_name = tmp;
++#ifndef STAGE1_5
++			if (do_possibilities) {
++				if (result <= 0) {
++					update_possibilities();
++					*end_of_name = 0;
++					print_a_completion(filename);
++					*end_of_name = tmp;
++				}
++			}
++			else
++#endif
++				if (result == 0) {
++				      btrfs_dir_item_key_to_cpu(&path->nodes[0],
++								di, sd_key);
++				      goto found;
++				}
++			len = sizeof(*di) + name_len + data_len;
++			di = (struct btrfs_dir_item *)((char *)di + len);
++			cur += len;
++		}
++	}
++#ifndef STAGE1_5
++	if (print_possibilities < 0)
++		return 1;
++#endif
++	errnum = ERR_FILE_NOT_FOUND;
++	*rest = ch;
++	return 0;
++ found:
++	*rest = ch;
++	*dirname = rest;
++	return 1;
++}
++
++/*
++ * ->dir_func().
++ * Postcondition: on a non-zero return BTRFS_FS_INFO
++ * contains the latest fs_root of file's subvolume.
++ * BTRFS_FS_INFO points to a subvolume of a file we
++ * were trying to look up.
++ * BTRFS_FILE_INFO contains info of the file we were
++ * trying to look up.
++ */
++
++int btrfs_dir(char *dirname)
++{
++	int ret;
++	int mode;
++	u64 size;
++	int linkcount = 0;
++	char linkbuf[PATH_MAX];
++
++	struct btrfs_path *path;
++	struct btrfs_root *root;
++
++	struct btrfs_key sd_key;
++	struct btrfs_inode_item *sd;
++	struct btrfs_key parent_sd_key;
++
++	root = BTRFS_FS_ROOT;
++	path = btrfs_grab_path(FIRST_EXTERNAL_LOOKUP_POOL);
++
++	btrfs_set_root_dir_key(&sd_key);
++	while (1) {
++		struct extent_buffer *leaf;
++		ret = aux_tree_lookup(root, &sd_key, path);
++		if (ret)
++			return 0;
++		leaf = &path->nodes[0];
++		sd = btrfs_item_ptr(leaf,
++				    path->slots[0],
++				    struct btrfs_inode_item);
++		mode = btrfs_inode_mode(leaf, sd);
++		size = btrfs_inode_size(leaf, sd);
++		switch (btrfs_get_file_type(mode)) {
++		case BTRFS_SYMLINK_FILE:
++			ret = btrfs_follow_link(root,
++						path,
++						&dirname,
++						linkbuf,
++						&linkcount,
++						sd);
++			if (!ret)
++				return 0;
++			dirname = linkbuf;
++			if (*dirname == '/')
++				/* absolute name */
++				btrfs_set_root_dir_key(&sd_key);
++			else
++				memcpy(&sd_key, &parent_sd_key,
++				       sizeof(sd_key));
++			continue;
++		case BTRFS_REGULAR_FILE:
++			/*
++			 * normally we want to exit here
++			 */
++			if (*dirname && !isspace (*dirname)) {
++				errnum = ERR_BAD_FILETYPE;
++				return 0;
++			}
++			filepos = 0;
++			filemax = btrfs_inode_size(leaf, sd);
++			btrfs_update_file_info(path);
++			return 1;
++		case BTRFS_DIRECTORY_FILE:
++			memcpy(&parent_sd_key, &sd_key, sizeof(sd_key));
++			ret = btrfs_de_index_by_name(root,
++						     path,
++						     &dirname,
++						     &sd_key);
++			if (!ret)
++				return 0;
++#ifndef STAGE1_5
++			if (print_possibilities < 0)
++				return 1;
++#endif
++			/*
++			 * update fs_tree:
++			 * subvolume stuff goes here
++			 */
++			ret = update_fs_root(root, &sd_key);
++			if (ret)
++				return 0;
++			continue;
++		case BTRFS_UNKNOWN_FILE:
++		default:
++			btrfs_msg("Btrfs: bad file type\n");
++			errnum = ERR_BAD_FILETYPE;
++			return 0;
++		}
++	}
++}
++
++int btrfs_embed(int *start_sector, int needed_sectors)
++{
++	int ret;
++	init_btrfs_info();
++	init_btrfs_volatile_dev_cache();
++
++	ret = btrfs_find_super(BTRFS_VOLATILE_DEV_CACHE, NULL, NULL);
++	if (ret)
++		return 0;
++	ret = btrfs_uptodate_super_copy(BTRFS_FS_INFO);
++	if (ret)
++		return 0;
++	*start_sector = 1; /* reserve first sector for stage1 */
++	return needed_sectors <=
++		((BTRFS_SUPER_INFO_OFFSET >> SECTOR_BITS) - 1);
++}
++#endif /* FSYS_BTRFS */
++
++/*
++  Local variables:
++  c-indentation-style: "K&R"
++  mode-name: "LC"
++  c-basic-offset: 8
++  tab-width: 8
++  fill-column: 80
++  scroll-step: 1
++  End:
++*/
+diff -up grub-upstream.wip/stage2/Makefile.am.btrfs grub-upstream.wip/stage2/Makefile.am
+--- grub-upstream.wip/stage2/Makefile.am.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/Makefile.am	2012-03-20 05:07:09.000000000 +0000
+@@ -17,13 +17,13 @@ INCLUDES = -I$(top_srcdir)/stage1
+ noinst_LIBRARIES = libgrub.a
+ libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
+ 	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
+-	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
++	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_btrfs.c fsys_ufs2.c \
+ 	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
+ 	terminfo.c tparm.c graphics.c
+ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
+ 	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
+ 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
+-	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
++	-DFSYS_BTRFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+ 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
+ 
+ # Stage 2 and Stage 1.5's.
+@@ -34,24 +34,26 @@ EXTRA_PROGRAMS = nbloader.exec pxeloader
+ if DISKLESS_SUPPORT
+ pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+-	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
+-	nbgrub pxegrub
++	reiserfs_stage1_5 btrfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
++	xfs_stage1_5 nbgrub pxegrub
+ noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
+ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
+ 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
+ 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
+-	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
+-	xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
++	reiserfs_stage1_5.exec btrfs_stage1_5.exec ufs2_stage1_5.exec \
++	vstafs_stage1_5.exec xfs_stage1_5.exec nbloader.exec \
++	pxeloader.exec diskless.exec
+ else
+ pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+-	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
++	reiserfs_stage1_5 btrfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
++	xfs_stage1_5
+ noinst_DATA = pre_stage2 start start_eltorito
+ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
+ 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
+ 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
+-	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
+-	xfs_stage1_5.exec
++	reiserfs_stage1_5.exec btrfs_stage1_5.exec ufs2_stage1_5.exec \
++	vstafs_stage1_5.exec xfs_stage1_5.exec
+ endif
+ MOSTLYCLEANFILES = $(noinst_PROGRAMS)
+ 
+@@ -95,15 +97,17 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DN
+ pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
+ 	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
+ 	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
+-	fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
+-	hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \
+-	graphics.c
++	fsys_reiserfs.c fsys_btrfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \
++	gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \
++	tparm.c graphics.c
+ pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
+ pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
+ pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
+ 
+ if NETBOOT_SUPPORT
+-pre_stage2_exec_LDADD = ../netboot/libdrivers.a
++pre_stage2_exec_LDADD = ../netboot/libdrivers.a -lgcc
++else
++pre_stage2_exec_LDADD = -lgcc
+ endif
+ 
+ if DISKLESS_SUPPORT
+@@ -197,6 +201,16 @@ reiserfs_stage1_5_exec_CCASFLAGS = $(STA
+ 	-DNO_BLOCK_FILES=1
+ reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+ 
++# For btrfs_stage1_5 target.
++btrfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
++       disk_io.c stage1_5.c fsys_btrfs.c bios.c
++btrfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_BTRFS=1 \
++       -DNO_BLOCK_FILES=1
++btrfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_BTRFS=1 \
++       -DNO_BLOCK_FILES=1
++btrfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
++btrfs_stage1_5_exec_LDADD = -lgcc
++
+ # For vstafs_stage1_5 target.
+ vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
+ 	disk_io.c stage1_5.c fsys_vstafs.c bios.c
+@@ -240,7 +254,7 @@ diskless_exec_CFLAGS = $(STAGE2_COMPILE)
+ diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \
+ 	-DSUPPORT_DISKLESS=1
+ diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK)
+-diskless_exec_LDADD = ../netboot/libdrivers.a
++diskless_exec_LDADD = ../netboot/libdrivers.a -lgcc
+ 
+ diskless_size.h: diskless
+ 	-rm -f $@
+diff -up grub-upstream.wip/stage2/shared.h.btrfs grub-upstream.wip/stage2/shared.h
+--- grub-upstream.wip/stage2/shared.h.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/shared.h	2012-03-20 05:07:09.000000000 +0000
+@@ -207,11 +207,12 @@ extern char *grub_scratch_mem;
+ #define STAGE2_ID_FAT_STAGE1_5		3
+ #define STAGE2_ID_MINIX_STAGE1_5	4
+ #define STAGE2_ID_REISERFS_STAGE1_5	5
+-#define STAGE2_ID_VSTAFS_STAGE1_5	6
+-#define STAGE2_ID_JFS_STAGE1_5		7
+-#define STAGE2_ID_XFS_STAGE1_5		8
+-#define STAGE2_ID_ISO9660_STAGE1_5	9
+-#define STAGE2_ID_UFS2_STAGE1_5		10
++#define STAGE2_ID_BTRFS_STAGE1_5	6
++#define STAGE2_ID_VSTAFS_STAGE1_5	7
++#define STAGE2_ID_JFS_STAGE1_5		8
++#define STAGE2_ID_XFS_STAGE1_5		9
++#define STAGE2_ID_ISO9660_STAGE1_5	10
++#define STAGE2_ID_UFS2_STAGE1_5		11
+ 
+ #ifndef STAGE1_5
+ # define STAGE2_ID	STAGE2_ID_STAGE2
+@@ -226,6 +227,8 @@ extern char *grub_scratch_mem;
+ #  define STAGE2_ID	STAGE2_ID_MINIX_STAGE1_5
+ # elif defined(FSYS_REISERFS)
+ #  define STAGE2_ID	STAGE2_ID_REISERFS_STAGE1_5
++# elif defined(FSYS_BTRFS)
++#  define STAGE2_ID	STAGE2_ID_BTRFS_STAGE1_5
+ # elif defined(FSYS_VSTAFS)
+ #  define STAGE2_ID	STAGE2_ID_VSTAFS_STAGE1_5
+ # elif defined(FSYS_JFS)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 06 02:33:29 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Apr 2012 02:33:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SFyzQ-0004YN-LW; Fri, 06 Apr 2012 02:33:28 +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 1SFyzO-0004Uj-Vy
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:27 +0000
Received: from [193.109.254.147:2377] by server-1.bemta-14.messagelabs.com id
	55/26-29372-6F55E7F4; Fri, 06 Apr 2012 02:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1333679600!3470662!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23459 invoked from network); 6 Apr 2012 02:33:21 -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;
	6 Apr 2012 02:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0003NF-NQ
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SFyzH-0008MX-KO
	for xen-changelog@lists.xensource.com; Fri, 06 Apr 2012 02:33:19 +0000
Message-Id: <E1SFyzH-0008MX-KO@xenbits.xen.org>
Date: Fri, 06 Apr 2012 02:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PV-GRUB: add support for btrfs
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Matt Wilson <msw@amazon.com>
# Date 1333534155 -3600
# Node ID c2954b4acd69deae140328772028c8ef45818ae4
# Parent  d1c985425e7841891ec1e3c0d4dc224be7b8d3cc
PV-GRUB: add support for btrfs

This patch adds btrfs support to the GRUB tree used to build PV-GRUB.
The original patch is from Gentoo:
https://bugs.gentoo.org/show_bug.cgi?id=283637

Signed-off-by: Matt Wilson <msw@amazon.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r d1c985425e78 -r c2954b4acd69 stubdom/grub.patches/61btrfs.diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stubdom/grub.patches/61btrfs.diff	Wed Apr 04 11:09:15 2012 +0100
@@ -0,0 +1,3512 @@
+diff -up grub-upstream.wip/AUTHORS.btrfs grub-upstream.wip/AUTHORS
+--- grub-upstream.wip/AUTHORS.btrfs	2004-03-27 16:25:17.000000000 +0000
++++ grub-upstream.wip/AUTHORS	2012-03-20 05:07:09.000000000 +0000
+@@ -41,6 +41,8 @@ Kristoffer Branemyr added VSTa filesyste
+ 
+ Serguei Tzukanov added JFS and XFS support.
+ 
++Edward Shishkin added Btrfs support.
++
+ Jason Thomas added Linux DAC960 support and support for hiding/unhiding
+ logical partitions, and did a significant bugfix for the terminal stuff.
+ 
+diff -up grub-upstream.wip/configure.ac.btrfs grub-upstream.wip/configure.ac
+--- grub-upstream.wip/configure.ac.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/configure.ac	2012-03-20 05:07:09.000000000 +0000
+@@ -274,6 +274,13 @@ if test x"$enable_reiserfs" != xno; then
+   FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"
+ fi
+ 
++AC_ARG_ENABLE(btrfs,
++  [  --disable-btrfs         disable BtrFS support in Stage 2])
++
++if test x"$enable_btrfs" != xno; then
++  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_BTRFS=1"
++fi
++
+ AC_ARG_ENABLE(vstafs,
+   [  --disable-vstafs        disable VSTa FS support in Stage 2])
+ 
+diff -up grub-upstream.wip/docs/grub.texi.btrfs grub-upstream.wip/docs/grub.texi
+--- grub-upstream.wip/docs/grub.texi.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/docs/grub.texi	2012-03-20 05:07:09.000000000 +0000
+@@ -1761,6 +1761,7 @@ itself. Usually, this is put in a filesy
+ @itemx jfs_stage1_5
+ @itemx minix_stage1_5
+ @itemx reiserfs_stage1_5
++@itemx btrfs_stage1_5
+ @itemx vstafs_stage1_5
+ @itemx xfs_stage1_5
+ 
+diff -up grub-upstream.wip/grub/Makefile.am.btrfs grub-upstream.wip/grub/Makefile.am
+--- grub-upstream.wip/grub/Makefile.am.btrfs	2005-02-02 20:38:19.000000000 +0000
++++ grub-upstream.wip/grub/Makefile.am	2012-03-20 05:07:09.000000000 +0000
+@@ -8,7 +8,7 @@ endif
+ 
+ AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
+ 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
+-	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
++	-DFSYS_BTRFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+ 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_HERCULES=1 \
+ 	$(SERIAL_FLAGS) -I$(top_srcdir)/stage2 \
+ 	-I$(top_srcdir)/stage1 -I$(top_srcdir)/lib
+diff -up grub-upstream.wip/INSTALL.btrfs grub-upstream.wip/INSTALL
+--- grub-upstream.wip/INSTALL.btrfs	2005-05-08 02:43:15.000000000 +0000
++++ grub-upstream.wip/INSTALL	2012-03-20 05:07:09.000000000 +0000
+@@ -207,6 +207,9 @@ operates.
+ `--disable-reiserfs'
+      Omit the ReiserFS support in Stage 2.
+ 
++`--disable-btrfs'
++     Omit the BtrFS support in Stage 2.
++
+ `--disable-vstafs'
+      Omit the VSTa filesystem support in Stage 2.
+ 
+diff -up /dev/null grub-upstream.wip/stage2/btrfs.h
+--- /dev/null	2009-06-03 06:46:26.160951000 +0000
++++ grub-upstream.wip/stage2/btrfs.h	2012-03-20 05:07:09.000000000 +0000
+@@ -0,0 +1,1415 @@
++/* btrfs.h - an extraction from btrfs-progs-0.18/ctree.h into one file
++ *
++ * Copyright (C) 2007 Oracle.  All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public
++ * License v2 as published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public
++ * License along with this program; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 021110-1307, USA.
++ */
++
++/* include/asm-i386/types.h */
++
++typedef __signed__ char __s8;
++typedef unsigned char __u8;
++typedef __signed__ short __s16;
++typedef unsigned short __u16;
++typedef __signed__ int __s32;
++typedef unsigned int __u32;
++typedef unsigned long long __u64;
++typedef __signed__ long long __s64;
++
++typedef __s8 s8;
++typedef __u8 u8;
++typedef __u16 u16;
++typedef __u32 u32;
++typedef __u64 u64;
++typedef __s64 s64;
++
++#define __bitwise
++
++typedef u16 __bitwise __le16;
++typedef u32 __bitwise __le32;
++typedef u64 __bitwise __le64;
++
++/* linux/posix_type.h */
++typedef long linux_off_t;
++
++/* linux/little_endian.h */
++#define cpu_to_le64(x) ((__u64) (x))
++#define le64_to_cpu(x) ((__u64) (x))
++#define cpu_to_le32(x) ((__u32) (x))
++#define le32_to_cpu(x) ((__u32) (x))
++#define cpu_to_le16(x) ((__u16) (x))
++#define le16_to_cpu(x) ((__u16) (x))
++#define le8_to_cpu(x) ((__u8) (x))
++#define cpu_to_le8(x) ((__u8) (x))
++
++/* linux/stat.h */
++#define S_IFMT  00170000
++#define S_IFLNK  0120000
++#define S_IFREG  0100000
++#define S_IFDIR  0040000
++#define S_ISLNK(m)     (((m) & S_IFMT) == S_IFLNK)
++#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
++#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
++
++struct btrfs_root;
++#define BTRFS_MAGIC "_BHRfS_M"
++
++#define BTRFS_SUPER_INFO_OFFSET (64 * 1024)
++#define BTRFS_SUPER_INFO_SIZE 4096
++
++#define BTRFS_SUPER_MIRROR_MAX  3
++#define BTRFS_SUPER_MIRROR_SHIFT 12
++
++#define PATH_MAX                1024   /* include/linux/limits.h */
++#define MAX_LINK_COUNT             5   /* number of symbolic links
++                                          to follow */
++#define BTRFS_MAX_LEVEL 8
++#define BTRFS_ROOT_TREE_OBJECTID 1ULL
++#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
++#define BTRFS_CHUNK_TREE_OBJECTID 3ULL
++#define BTRFS_DEV_TREE_OBJECTID 4ULL
++#define BTRFS_FS_TREE_OBJECTID 5ULL
++#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
++#define BTRFS_CSUM_TREE_OBJECTID 7ULL
++
++#define BTRFS_ORPHAN_OBJECTID -5ULL
++#define BTRFS_TREE_LOG_OBJECTID -6ULL
++#define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL
++#define BTRFS_TREE_RELOC_OBJECTID -8ULL
++#define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL
++#define BTRFS_EXTENT_CSUM_OBJECTID -10ULL
++
++#define BTRFS_MULTIPLE_OBJECTIDS -255ULL
++#define BTRFS_FIRST_FREE_OBJECTID 256ULL
++#define BTRFS_LAST_FREE_OBJECTID -256ULL
++#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
++#define BTRFS_DEV_ITEMS_OBJECTID 1ULL
++
++
++#define BTRFS_NAME_LEN 255
++#define BTRFS_CSUM_SIZE 32
++#define BTRFS_CSUM_TYPE_CRC32  0
++
++static int btrfs_csum_sizes[] = { 4, 0 };
++
++/* four bytes for CRC32 */
++#define BTRFS_CRC32_SIZE 4
++#define BTRFS_EMPTY_DIR_SIZE 0
++
++#define BTRFS_FT_UNKNOWN       0
++#define BTRFS_FT_REG_FILE      1
++#define BTRFS_FT_DIR           2
++#define BTRFS_FT_CHRDEV                3
++#define BTRFS_FT_BLKDEV                4
++#define BTRFS_FT_FIFO          5
++#define BTRFS_FT_SOCK          6
++#define BTRFS_FT_SYMLINK       7
++#define BTRFS_FT_XATTR         8
++#define BTRFS_FT_MAX           9
++
++#define BTRFS_UUID_SIZE 16
++
++#define BTRFS_DEFAULT_NUM_DEVICES     1
++#define BTRFS_DEFAULT_NODE_SIZE       4096
++#define BTRFS_DEFAULT_LEAF_SIZE       4096
++#define BTRFS_NUM_CACHED_DEVICES      128
++
++#define WARN_ON(c)
++#define cassert(cond) ({ switch (-1) { case (cond): case 0: break; } })
++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
++
++#define offsetof(type, memb) \
++       ((unsigned long)(&((type *)0)->memb))
++
++struct btrfs_disk_key {
++       __le64 objectid;
++       u8 type;
++       __le64 offset;
++} __attribute__ ((__packed__));
++
++/* cpu key */
++struct btrfs_key {
++       u64 objectid;
++       u8 type;
++       u64 offset;
++} __attribute__ ((__packed__));
++
++/* this represents a divice in a chunk tree */
++struct btrfs_dev_item {
++       __le64 devid; /* internal device id */
++       __le64 total_bytes; /* size of the device */
++       __le64 bytes_used;
++       __le32 io_align; /* optimal io alignment */
++       __le32 io_width; /* optimal io width */
++       __le32 sector_size; /* minimal io size */
++       __le64 type; /* type and info about this device */
++       __le64 generation; /* expected generation */
++        __le64 start_offset; /* of the partition on a device */
++
++       /* info for allocation decisions */
++       __le32 dev_group;
++
++        u8 seek_speed; /* 0-100 (100 is fastest) */
++       u8 bandwidth;  /* 0-100 (100 is fastest) */
++
++        u8 uuid[BTRFS_UUID_SIZE]; /* dev uuid generated by btrfs */
++       u8 fsid[BTRFS_UUID_SIZE]; /* uuid of the host FS */
++} __attribute__ ((__packed__));
++
++struct btrfs_stripe {
++       __le64 devid;
++       __le64 offset;
++       u8 dev_uuid[BTRFS_UUID_SIZE];
++} __attribute__ ((__packed__));
++
++struct btrfs_chunk {
++       /* size of this chunk in bytes */
++       __le64 length;
++       __le64 owner; /* objectid of the root referincing this chunk */
++       __le64 stripe_len;
++       __le64 type;
++       __le32 io_align; /* optimal io alignment for this chunk */
++       __le32 io_width; /* optimal io width for this chunk */
++       __le32 sector_size; /* minimal io size for this chunk */
++       __le16 num_stripes;
++       __le16 sub_stripes; /* sub stripes (for raid10) */
++       struct btrfs_stripe stripe;
++} __attribute__ ((__packed__));
++
++static inline unsigned long btrfs_chunk_item_size(int num_stripes)
++{
++       return sizeof(struct btrfs_chunk) +
++               sizeof(struct btrfs_stripe) * (num_stripes - 1);
++}
++
++#define BTRFS_FSID_SIZE 16
++#define BTRFS_HEADER_FLAG_WRITTEN (1 << 0)
++
++struct btrfs_header {
++       /* these first four must match the super block */
++       u8 csum[BTRFS_CSUM_SIZE];
++       u8 fsid[BTRFS_FSID_SIZE]; /* uuid of the host fs */
++       __le64 bytenr; /* which block this node is supposed to live in */
++       __le64 flags;
++
++       /* allowed to be different from the super from here on down */
++       u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
++       __le64 generation;
++       __le64 owner;
++       __le32 nritems;
++       u8 level;
++} __attribute__ ((__packed__));
++
++#define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->nodesize - \
++                               sizeof(struct btrfs_header)) / \
++                               sizeof(struct btrfs_key_ptr))
++#define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
++#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->leafsize))
++#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
++                                       sizeof(struct btrfs_item) - \
++                                       sizeof(struct btrfs_file_extent_item))
++
++#define BTRFS_SUPER_FLAG_SEEDING       (1ULL << 32)
++#define BTRFS_SUPER_FLAG_METADUMP      (1ULL << 33)
++
++/*
++ * a portion of superblock which is used
++ * for chunk translation (up to 14 chunks
++ * with 3 stripes each.
++ */
++#define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
++#define BTRFS_LABEL_SIZE 256
++
++/*
++ * the super block basically lists the main trees of the FS
++ * it currently lacks any block count etc etc
++ */
++
++struct btrfs_super_block {
++       u8 csum[BTRFS_CSUM_SIZE];
++       /* the first 3 fields must match struct btrfs_header */
++       u8 fsid[BTRFS_FSID_SIZE];    /* FS specific uuid */
++       __le64 bytenr; /* this block number */
++       __le64 flags;
++
++       /* allowed to be different from the btrfs_header from here own down */
++       __le64 magic;
++       __le64 generation;
++       __le64 root;        /* tree root */
++       __le64 chunk_root;
++       __le64 log_root;
++
++       /* this will help find the new super based on the log root */
++       __le64 log_root_transid;
++       __le64 total_bytes;
++       __le64 bytes_used;
++       __le64 root_dir_objectid;
++       __le64 num_devices;
++       __le32 sectorsize;
++       __le32 nodesize;
++       __le32 leafsize;
++       __le32 stripesize;
++       __le32 sys_chunk_array_size;
++       __le64 chunk_root_generation;
++       __le64 compat_flags;
++       __le64 compat_ro_flags;
++       __le64 incompat_flags;
++       __le16 csum_type;
++       u8 root_level;
++       u8 chunk_root_level;
++       u8 log_root_level;
++       struct btrfs_dev_item dev_item;
++
++       char label[BTRFS_LABEL_SIZE];
++
++       /* future expansion */
++       __le64 reserved[32];
++       u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
++} __attribute__ ((__packed__));
++
++/*
++ * Compat flags that we support.  If any incompat flags are set other than the
++ * ones specified below then we will fail to mount
++ */
++#define BTRFS_FEATURE_COMPAT_SUPP      0x0
++#define BTRFS_FEATURE_COMPAT_RO_SUPP   0x0
++#define BTRFS_FEATURE_INCOMPAT_SUPP    0x0
++
++/* Item header for per-leaf lookup */
++struct btrfs_item {
++       struct btrfs_disk_key key;
++       __le32 offset;
++       __le32 size;
++} __attribute__ ((__packed__));
++
++/*
++ * Format of the leaves:
++ * [item0, item1....itemN] [free space] [dataN...data1, data0]
++ */
++struct btrfs_leaf {
++       struct btrfs_header header;
++       struct btrfs_item items[];
++} __attribute__ ((__packed__));
++
++/*
++ * keys-pointers pairs for per-node (non-leaf) lookup
++ */
++struct btrfs_key_ptr {
++       struct btrfs_disk_key key;
++       __le64 blockptr;
++       __le64 generation;
++} __attribute__ ((__packed__));
++
++struct btrfs_node {
++       struct btrfs_header header;
++       struct btrfs_key_ptr ptrs[];
++} __attribute__ ((__packed__));
++
++struct btrfs_device {
++	/* the internal btrfs device id */
++	u64 devid;
++	/* the internal grub device representation */
++	unsigned long drive;
++	unsigned long part;
++	unsigned long length;
++};
++
++struct extent_buffer {
++       /* metadata */
++       struct btrfs_device dev;
++       u64 start;
++       u64 dev_bytenr;
++       u32 len;
++       /* data */
++       char *data;
++};
++
++static inline void read_extent_buffer(struct extent_buffer *eb,
++                                     void *dst, unsigned long start,
++                                     unsigned long len)
++{
++       memcpy(dst, eb->data + start, len);
++}
++
++static inline void write_extent_buffer(struct extent_buffer *eb,
++                                      const void *src, unsigned long start,
++                                      unsigned long len)
++{
++       memcpy(eb->data + start, src, len);
++}
++
++/*
++ * NOTE:
++ * don't increase a number of levels for grub-0.97!
++ */
++typedef enum {
++       FIRST_EXTERNAL_LOOKUP_POOL,
++       SECOND_EXTERNAL_LOOKUP_POOL,
++       INTERNAL_LOOKUP_POOL,
++       LAST_LOOKUP_POOL
++} lookup_pool_id;
++
++/*             Relationship between lookup pools:
++ *  depth
++ *
++ *    ^             +----> INTERNAL <----+
++ *    |             |                    |
++ *    |             |                    |
++ *    -        FIRST_EXTERNAL     SECOND_EXTERNAL
++ */
++
++struct btrfs_path {
++       lookup_pool_id lpid;
++       struct extent_buffer nodes[BTRFS_MAX_LEVEL];
++       int slots[BTRFS_MAX_LEVEL];
++};
++
++/*
++ * items in the extent btree are used to record the objectid of the
++ * owner of the block and the number of references
++ */
++struct btrfs_extent_item {
++       __le32 refs;
++} __attribute__ ((__packed__));
++
++struct btrfs_extent_ref {
++       __le64 root;
++       __le64 generation;
++       __le64 objectid;
++       __le32 num_refs;
++} __attribute__ ((__packed__));
++
++/* dev extents record free space on individual devices.  The owner
++ * field points back to the chunk allocation mapping tree that allocated
++ * the extent.  The chunk tree uuid field is a way to double check the owner
++ */
++struct btrfs_dev_extent {
++       __le64 chunk_tree;
++       __le64 chunk_objectid;
++       __le64 chunk_offset;
++       __le64 length;
++       u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
++} __attribute__ ((__packed__));
++
++struct btrfs_inode_ref {
++       __le64 index;
++       __le16 name_len;
++       /* name goes here */
++} __attribute__ ((__packed__));
++
++struct btrfs_timespec {
++       __le64 sec;
++       __le32 nsec;
++} __attribute__ ((__packed__));
++
++typedef enum {
++       BTRFS_COMPRESS_NONE = 0,
++       BTRFS_COMPRESS_ZLIB = 1,
++       BTRFS_COMPRESS_LAST = 2,
++} btrfs_compression_type;
++
++/* we don't understand any encryption methods right now */
++typedef enum {
++       BTRFS_ENCRYPTION_NONE = 0,
++       BTRFS_ENCRYPTION_LAST = 1,
++} btrfs_encryption_type;
++
++struct btrfs_inode_item {
++       /* nfs style generation number */
++       __le64 generation;
++       /* transid that last touched this inode */
++       __le64 transid;
++       __le64 size;
++       __le64 nbytes;
++       __le64 block_group;
++       __le32 nlink;
++       __le32 uid;
++       __le32 gid;
++       __le32 mode;
++       __le64 rdev;
++       __le64 flags;
++
++       /* modification sequence number for NFS */
++       __le64 sequence;
++
++       /*
++        * a little future expansion, for more than this we can
++        * just grow the inode item and version it
++        */
++       __le64 reserved[4];
++       struct btrfs_timespec atime;
++       struct btrfs_timespec ctime;
++       struct btrfs_timespec mtime;
++       struct btrfs_timespec otime;
++} __attribute__ ((__packed__));
++
++struct btrfs_dir_item {
++       struct btrfs_disk_key location;
++       __le64 transid;
++       __le16 data_len;
++       __le16 name_len;
++       u8 type;
++} __attribute__ ((__packed__));
++
++struct btrfs_root_item {
++       struct btrfs_inode_item inode;
++       __le64 generation;
++       __le64 root_dirid;
++       __le64 bytenr;
++       __le64 byte_limit;
++       __le64 bytes_used;
++       __le64 last_snapshot;
++       __le64 flags;
++       __le32 refs;
++       struct btrfs_disk_key drop_progress;
++       u8 drop_level;
++       u8 level;
++} __attribute__ ((__packed__));
++
++/*
++ * this is used for both forward and backward root refs
++ */
++struct btrfs_root_ref {
++       __le64 dirid;
++       __le64 sequence;
++       __le16 name_len;
++} __attribute__ ((__packed__));
++
++#define BTRFS_FILE_EXTENT_INLINE 0
++#define BTRFS_FILE_EXTENT_REG 1
++#define BTRFS_FILE_EXTENT_PREALLOC 2
++
++struct btrfs_file_extent_item {
++       /*
++        * transaction id that created this extent
++        */
++       __le64 generation;
++       /*
++        * max number of bytes to hold this extent in ram
++        * when we split a compressed extent we can't know how big
++        * each of the resulting pieces will be.  So, this is
++        * an upper limit on the size of the extent in ram instead of
++        * an exact limit.
++        */
++       __le64 ram_bytes;
++
++       /*
++        * 32 bits for the various ways we might encode the data,
++        * including compression and encryption.  If any of these
++        * are set to something a given disk format doesn't understand
++        * it is treated like an incompat flag for reading and writing,
++        * but not for stat.
++        */
++       u8 compression;
++       u8 encryption;
++       __le16 other_encoding; /* spare for later use */
++
++       /* are we inline data or a real extent? */
++       u8 type;
++
++       /*
++        * disk space consumed by the extent, checksum blocks are included
++        * in these numbers
++        */
++       __le64 disk_bytenr;
++       __le64 disk_num_bytes;
++       /*
++        * the logical offset in file blocks (no csums)
++        * this extent record is for.  This allows a file extent to point
++        * into the middle of an existing extent on disk, sharing it
++        * between two snapshots (useful if some bytes in the middle of the
++        * extent have changed
++        */
++       __le64 offset;
++       /*
++        * the logical number of file blocks (no csums included)
++        */
++       __le64 num_bytes;
++
++} __attribute__ ((__packed__));
++
++struct btrfs_csum_item {
++       u8 csum;
++} __attribute__ ((__packed__));
++
++/* tag for the radix tree of block groups in ram */
++#define BTRFS_BLOCK_GROUP_DATA     (1 << 0)
++#define BTRFS_BLOCK_GROUP_SYSTEM   (1 << 1)
++#define BTRFS_BLOCK_GROUP_METADATA (1 << 2)
++#define BTRFS_BLOCK_GROUP_RAID0    (1 << 3)
++#define BTRFS_BLOCK_GROUP_RAID1    (1 << 4)
++#define BTRFS_BLOCK_GROUP_DUP     (1 << 5)
++#define BTRFS_BLOCK_GROUP_RAID10   (1 << 6)
++
++struct btrfs_block_group_item {
++       __le64 used;
++       __le64 chunk_objectid;
++       __le64 flags;
++} __attribute__ ((__packed__));
++
++/*
++ * in ram representation of the tree.  extent_root is used for all allocations
++ * and for the extent tree extent_root root.
++ */
++struct btrfs_root {
++       struct extent_buffer   node;
++       char                   data[4096];
++       struct btrfs_root_item root_item;
++       u64 objectid;
++       
++       /* data allocations are done in sectorsize units */
++       u32 sectorsize;
++
++       /* node allocations are done in nodesize units */
++       u32 nodesize;
++
++       /* leaf allocations are done in leafsize units */
++       u32 leafsize;
++
++       /* leaf allocations are done in leafsize units */
++       u32 stripesize;
++};
++
++struct btrfs_file_info {
++	struct btrfs_key key;
++};
++
++struct btrfs_root;
++struct btrfs_fs_devices;
++struct btrfs_fs_info {
++       u8 fsid[BTRFS_FSID_SIZE];
++       struct btrfs_root fs_root;
++       struct btrfs_root tree_root;
++       struct btrfs_root chunk_root;
++
++       struct btrfs_file_info file_info; /* currently opened file */
++       struct btrfs_path paths [LAST_LOOKUP_POOL];
++
++       char mbr[SECTOR_SIZE];
++
++       int sb_mirror;
++       u64 sb_transid;
++       struct btrfs_device sb_dev;
++       struct btrfs_super_block sb_copy;
++
++       struct btrfs_device devices[BTRFS_NUM_CACHED_DEVICES + 1];
++};
++
++/*
++ * inode items have the data typically returned from stat and store other
++ * info about object characteristics.  There is one for every file and dir in
++ * the FS
++ */
++#define BTRFS_INODE_ITEM_KEY           1
++#define BTRFS_INODE_REF_KEY            12
++#define BTRFS_XATTR_ITEM_KEY           24
++#define BTRFS_ORPHAN_ITEM_KEY          48
++
++#define BTRFS_DIR_LOG_ITEM_KEY  60
++#define BTRFS_DIR_LOG_INDEX_KEY 72
++/*
++ * dir items are the name -> inode pointers in a directory.  There is one
++ * for every name in a directory.
++ */
++#define BTRFS_DIR_ITEM_KEY     84
++#define BTRFS_DIR_INDEX_KEY    96
++
++/*
++ * extent data is for file data
++ */
++#define BTRFS_EXTENT_DATA_KEY  108
++
++/*
++ * csum items have the checksums for data in the extents
++ */
++#define BTRFS_CSUM_ITEM_KEY    120
++/*
++ * extent csums are stored in a separate tree and hold csums for
++ * an entire extent on disk.
++ */
++#define BTRFS_EXTENT_CSUM_KEY  128
++
++/*
++ * root items point to tree roots.  There are typically in the root
++ * tree used by the super block to find all the other trees
++ */
++#define BTRFS_ROOT_ITEM_KEY    132
++
++/*
++ * root backrefs tie subvols and snapshots to the directory entries that
++ * reference them
++ */
++#define BTRFS_ROOT_BACKREF_KEY 144
++
++/*
++ * root refs make a fast index for listing all of the snapshots and
++ * subvolumes referenced by a given root.  They point directly to the
++ * directory item in the root that references the subvol
++ */
++#define BTRFS_ROOT_REF_KEY     156
++
++/*
+++ * extent items are in the extent map tree.  These record which blocks
+++ * are used, and how many references there are to each block
+++ */
++#define BTRFS_EXTENT_ITEM_KEY  168
++#define BTRFS_EXTENT_REF_KEY   180
++
++/*
++ * block groups give us hints into the extent allocation trees.  Which
++ * blocks are free etc etc
++ */
++#define BTRFS_BLOCK_GROUP_ITEM_KEY 192
++
++#define BTRFS_DEV_EXTENT_KEY   204
++#define BTRFS_DEV_ITEM_KEY     216
++#define BTRFS_CHUNK_ITEM_KEY   228
++
++/*
++ * string items are for debugging.  They just store a short string of
++ * data in the FS
++ */
++#define BTRFS_STRING_ITEM_KEY  253
++/*
++ * Inode flags
++ */
++#define BTRFS_INODE_NODATASUM          (1 << 0)
++#define BTRFS_INODE_NODATACOW          (1 << 1)
++#define BTRFS_INODE_READONLY           (1 << 2)
++
++#define read_eb_member(eb, ptr, type, member, result) (                        \
++       read_extent_buffer(eb, (char *)(result),                        \
++                          ((unsigned long)(ptr)) +                     \
++                           offsetof(type, member),                     \
++                          sizeof(((type *)0)->member)))
++
++#define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits)            \
++static inline u##bits btrfs_##name(struct extent_buffer *eb)           \
++{                                                                      \
++       struct btrfs_header *h = (struct btrfs_header *)eb->data;       \
++       return le##bits##_to_cpu(h->member);                            \
++}                                                                      \
++static inline void btrfs_set_##name(struct extent_buffer *eb,          \
++                                   u##bits val)                        \
++{                                                                      \
++       struct btrfs_header *h = (struct btrfs_header *)eb->data;       \
++       h->member = cpu_to_le##bits(val);                               \
++}
++
++#define BTRFS_SETGET_FUNCS(name, type, member, bits)                   \
++static inline u##bits btrfs_##name(struct extent_buffer *eb,           \
++                                  type *s)                             \
++{                                                                      \
++       unsigned long offset = (unsigned long)s;                        \
++       type *p = (type *) (eb->data + offset);                         \
++       return le##bits##_to_cpu(p->member);                            \
++}                                                                      \
++static inline void btrfs_set_##name(struct extent_buffer *eb,          \
++                                   type *s, u##bits val)               \
++{                                                                      \
++       unsigned long offset = (unsigned long)s;                        \
++       type *p = (type *) (eb->data + offset);                         \
++       p->member = cpu_to_le##bits(val);                               \
++}
++
++#define BTRFS_SETGET_STACK_FUNCS(name, type, member, bits)             \
++static inline u##bits btrfs_##name(type *s)                            \
++{                                                                      \
++       return le##bits##_to_cpu(s->member);                            \
++}                                                                      \
++static inline void btrfs_set_##name(type *s, u##bits val)              \
++{                                                                      \
++       s->member = cpu_to_le##bits(val);                               \
++}
++
++BTRFS_SETGET_FUNCS(device_type, struct btrfs_dev_item, type, 64);
++BTRFS_SETGET_FUNCS(device_total_bytes, struct btrfs_dev_item, total_bytes, 64);
++BTRFS_SETGET_FUNCS(device_bytes_used, struct btrfs_dev_item, bytes_used, 64);
++BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32);
++BTRFS_SETGET_FUNCS(device_io_width, struct btrfs_dev_item, io_width, 32);
++BTRFS_SETGET_FUNCS(device_start_offset, struct btrfs_dev_item,
++                  start_offset, 64);
++BTRFS_SETGET_FUNCS(device_sector_size, struct btrfs_dev_item, sector_size, 32);
++BTRFS_SETGET_FUNCS(device_id, struct btrfs_dev_item, devid, 64);
++BTRFS_SETGET_FUNCS(device_group, struct btrfs_dev_item, dev_group, 32);
++BTRFS_SETGET_FUNCS(device_seek_speed, struct btrfs_dev_item, seek_speed, 8);
++BTRFS_SETGET_FUNCS(device_bandwidth, struct btrfs_dev_item, bandwidth, 8);
++BTRFS_SETGET_FUNCS(device_generation, struct btrfs_dev_item, generation, 64);
++
++BTRFS_SETGET_STACK_FUNCS(stack_device_type, struct btrfs_dev_item, type, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_total_bytes, struct btrfs_dev_item,
++                        total_bytes, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_bytes_used, struct btrfs_dev_item,
++                        bytes_used, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_io_align, struct btrfs_dev_item,
++                        io_align, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_io_width, struct btrfs_dev_item,
++                        io_width, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_sector_size, struct btrfs_dev_item,
++                        sector_size, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_id, struct btrfs_dev_item, devid, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_device_group, struct btrfs_dev_item,
++                        dev_group, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_device_seek_speed, struct btrfs_dev_item,
++                        seek_speed, 8);
++BTRFS_SETGET_STACK_FUNCS(stack_device_bandwidth, struct btrfs_dev_item,
++                        bandwidth, 8);
++BTRFS_SETGET_STACK_FUNCS(stack_device_generation, struct btrfs_dev_item,
++                        generation, 64);
++
++static inline char *btrfs_device_uuid(struct btrfs_dev_item *d)
++{
++       return (char *)d + offsetof(struct btrfs_dev_item, uuid);
++}
++
++static inline char *btrfs_device_fsid(struct btrfs_dev_item *d)
++{
++       return (char *)d + offsetof(struct btrfs_dev_item, fsid);
++}
++
++BTRFS_SETGET_FUNCS(chunk_length, struct btrfs_chunk, length, 64);
++BTRFS_SETGET_FUNCS(chunk_owner, struct btrfs_chunk, owner, 64);
++BTRFS_SETGET_FUNCS(chunk_stripe_len, struct btrfs_chunk, stripe_len, 64);
++BTRFS_SETGET_FUNCS(chunk_io_align, struct btrfs_chunk, io_align, 32);
++BTRFS_SETGET_FUNCS(chunk_io_width, struct btrfs_chunk, io_width, 32);
++BTRFS_SETGET_FUNCS(chunk_sector_size, struct btrfs_chunk, sector_size, 32);
++BTRFS_SETGET_FUNCS(chunk_type, struct btrfs_chunk, type, 64);
++BTRFS_SETGET_FUNCS(chunk_num_stripes, struct btrfs_chunk, num_stripes, 16);
++BTRFS_SETGET_FUNCS(chunk_sub_stripes, struct btrfs_chunk, sub_stripes, 16);
++BTRFS_SETGET_FUNCS(stripe_devid, struct btrfs_stripe, devid, 64);
++BTRFS_SETGET_FUNCS(stripe_offset, struct btrfs_stripe, offset, 64);
++
++static inline char *btrfs_stripe_dev_uuid(struct btrfs_stripe *s)
++{
++       return (char *)s + offsetof(struct btrfs_stripe, dev_uuid);
++}
++
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_length, struct btrfs_chunk, length, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_owner, struct btrfs_chunk, owner, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_stripe_len, struct btrfs_chunk,
++                        stripe_len, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_align, struct btrfs_chunk,
++                        io_align, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_io_width, struct btrfs_chunk,
++                        io_width, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_sector_size, struct btrfs_chunk,
++                        sector_size, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_type, struct btrfs_chunk, type, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_num_stripes, struct btrfs_chunk,
++                        num_stripes, 16);
++BTRFS_SETGET_STACK_FUNCS(stack_chunk_sub_stripes, struct btrfs_chunk,
++                        sub_stripes, 16);
++BTRFS_SETGET_STACK_FUNCS(stack_stripe_devid, struct btrfs_stripe, devid, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_stripe_offset, struct btrfs_stripe, offset, 64);
++
++static inline struct btrfs_stripe *btrfs_stripe_nr(struct btrfs_chunk *c,
++                                                  int nr)
++{
++       unsigned long offset = (unsigned long)c;
++       offset += offsetof(struct btrfs_chunk, stripe);
++       offset += nr * sizeof(struct btrfs_stripe);
++       return (struct btrfs_stripe *)offset;
++}
++
++static inline char *btrfs_stripe_dev_uuid_nr(struct btrfs_chunk *c, int nr)
++{
++       return btrfs_stripe_dev_uuid(btrfs_stripe_nr(c, nr));
++}
++
++static inline u64 btrfs_stripe_offset_nr(struct extent_buffer *eb,
++                                        struct btrfs_chunk *c, int nr)
++{
++       return btrfs_stripe_offset(eb, btrfs_stripe_nr(c, nr));
++}
++
++static inline void btrfs_set_stripe_offset_nr(struct extent_buffer *eb,
++                                            struct btrfs_chunk *c, int nr,
++                                            u64 val)
++{
++       btrfs_set_stripe_offset(eb, btrfs_stripe_nr(c, nr), val);
++}
++
++static inline u64 btrfs_stripe_devid_nr(struct extent_buffer *eb,
++                                        struct btrfs_chunk *c, int nr)
++{
++       return btrfs_stripe_devid(eb, btrfs_stripe_nr(c, nr));
++}
++
++static inline void btrfs_set_stripe_devid_nr(struct extent_buffer *eb,
++                                            struct btrfs_chunk *c, int nr,
++                                            u64 val)
++{
++       btrfs_set_stripe_devid(eb, btrfs_stripe_nr(c, nr), val);
++}
++
++/* struct btrfs_block_group_item */
++BTRFS_SETGET_STACK_FUNCS(block_group_used, struct btrfs_block_group_item,
++                        used, 64);
++BTRFS_SETGET_FUNCS(disk_block_group_used, struct btrfs_block_group_item,
++                        used, 64);
++BTRFS_SETGET_STACK_FUNCS(block_group_chunk_objectid,
++                       struct btrfs_block_group_item, chunk_objectid, 64);
++
++BTRFS_SETGET_FUNCS(disk_block_group_chunk_objectid,
++                  struct btrfs_block_group_item, chunk_objectid, 64);
++BTRFS_SETGET_FUNCS(disk_block_group_flags,
++                  struct btrfs_block_group_item, flags, 64);
++BTRFS_SETGET_STACK_FUNCS(block_group_flags,
++                       struct btrfs_block_group_item, flags, 64);
++
++/* struct btrfs_inode_ref */
++BTRFS_SETGET_FUNCS(inode_ref_name_len, struct btrfs_inode_ref, name_len, 16);
++BTRFS_SETGET_FUNCS(inode_ref_index, struct btrfs_inode_ref, index, 64);
++
++/* struct btrfs_inode_item */
++BTRFS_SETGET_FUNCS(inode_generation, struct btrfs_inode_item, generation, 64);
++BTRFS_SETGET_FUNCS(inode_sequence, struct btrfs_inode_item, sequence, 64);
++BTRFS_SETGET_FUNCS(inode_transid, struct btrfs_inode_item, transid, 64);
++BTRFS_SETGET_FUNCS(inode_size, struct btrfs_inode_item, size, 64);
++BTRFS_SETGET_FUNCS(inode_nbytes, struct btrfs_inode_item, nbytes, 64);
++BTRFS_SETGET_FUNCS(inode_block_group, struct btrfs_inode_item, block_group, 64);
++BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
++BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
++BTRFS_SETGET_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
++BTRFS_SETGET_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
++BTRFS_SETGET_FUNCS(inode_rdev, struct btrfs_inode_item, rdev, 64);
++BTRFS_SETGET_FUNCS(inode_flags, struct btrfs_inode_item, flags, 64);
++
++BTRFS_SETGET_STACK_FUNCS(stack_inode_generation,
++                        struct btrfs_inode_item, generation, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_sequence,
++                        struct btrfs_inode_item, generation, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_size,
++                        struct btrfs_inode_item, size, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes,
++                        struct btrfs_inode_item, nbytes, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_block_group,
++                        struct btrfs_inode_item, block_group, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_nlink,
++                        struct btrfs_inode_item, nlink, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_uid,
++                        struct btrfs_inode_item, uid, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_gid,
++                        struct btrfs_inode_item, gid, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_mode,
++                        struct btrfs_inode_item, mode, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_rdev,
++                        struct btrfs_inode_item, rdev, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_inode_flags,
++                        struct btrfs_inode_item, flags, 64);
++
++BTRFS_SETGET_FUNCS(timespec_sec, struct btrfs_timespec, sec, 64);
++BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_timespec_sec, struct btrfs_timespec,
++                        sec, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_timespec_nsec, struct btrfs_timespec,
++                        nsec, 32);
++
++/* struct btrfs_dev_extent */
++BTRFS_SETGET_FUNCS(dev_extent_chunk_tree, struct btrfs_dev_extent,
++                  chunk_tree, 64);
++BTRFS_SETGET_FUNCS(dev_extent_chunk_objectid, struct btrfs_dev_extent,
++                  chunk_objectid, 64);
++BTRFS_SETGET_FUNCS(dev_extent_chunk_offset, struct btrfs_dev_extent,
++                  chunk_offset, 64);
++BTRFS_SETGET_FUNCS(dev_extent_length, struct btrfs_dev_extent, length, 64);
++
++static inline u8 *btrfs_dev_extent_chunk_tree_uuid(struct btrfs_dev_extent *dev)
++{
++       unsigned long ptr = offsetof(struct btrfs_dev_extent, chunk_tree_uuid);
++       return (u8 *)((unsigned long)dev + ptr);
++}
++
++/* struct btrfs_extent_ref */
++BTRFS_SETGET_FUNCS(ref_root, struct btrfs_extent_ref, root, 64);
++BTRFS_SETGET_FUNCS(ref_generation, struct btrfs_extent_ref, generation, 64);
++BTRFS_SETGET_FUNCS(ref_objectid, struct btrfs_extent_ref, objectid, 64);
++BTRFS_SETGET_FUNCS(ref_num_refs, struct btrfs_extent_ref, num_refs, 32);
++
++BTRFS_SETGET_STACK_FUNCS(stack_ref_root, struct btrfs_extent_ref, root, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_ref_generation, struct btrfs_extent_ref,
++                        generation, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_ref_objectid, struct btrfs_extent_ref,
++                        objectid, 64);
++BTRFS_SETGET_STACK_FUNCS(stack_ref_num_refs, struct btrfs_extent_ref,
++                        num_refs, 32);
++
++/* struct btrfs_extent_item */
++BTRFS_SETGET_FUNCS(extent_refs, struct btrfs_extent_item, refs, 32);
++BTRFS_SETGET_STACK_FUNCS(stack_extent_refs, struct btrfs_extent_item,
++                        refs, 32);
++
++/* struct btrfs_node */
++BTRFS_SETGET_FUNCS(key_blockptr, struct btrfs_key_ptr, blockptr, 64);
++BTRFS_SETGET_FUNCS(key_generation, struct btrfs_key_ptr, generation, 64);
++
++static inline u64 btrfs_node_blockptr(struct extent_buffer *eb, int nr)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       return btrfs_key_blockptr(eb, (struct btrfs_key_ptr *)ptr);
++}
++
++static inline void btrfs_set_node_blockptr(struct extent_buffer *eb,
++                                          int nr, u64 val)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       btrfs_set_key_blockptr(eb, (struct btrfs_key_ptr *)ptr, val);
++}
++
++static inline u64 btrfs_node_ptr_generation(struct extent_buffer *eb, int nr)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       return btrfs_key_generation(eb, (struct btrfs_key_ptr *)ptr);
++}
++
++static inline void btrfs_set_node_ptr_generation(struct extent_buffer *eb,
++                                                int nr, u64 val)
++{
++       unsigned long ptr;
++       ptr = offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++       btrfs_set_key_generation(eb, (struct btrfs_key_ptr *)ptr, val);
++}
++
++static inline unsigned long btrfs_node_key_ptr_offset(int nr)
++{
++       return offsetof(struct btrfs_node, ptrs) +
++               sizeof(struct btrfs_key_ptr) * nr;
++}
++
++static inline void btrfs_node_key(struct extent_buffer *eb,
++                                 struct btrfs_disk_key *disk_key, int nr)
++{
++       unsigned long ptr;
++       ptr = btrfs_node_key_ptr_offset(nr);
++       read_eb_member(eb, (struct btrfs_key_ptr *)ptr,
++                      struct btrfs_key_ptr, key, disk_key);
++}
++
++/* struct btrfs_item */
++BTRFS_SETGET_FUNCS(item_offset, struct btrfs_item, offset, 32);
++BTRFS_SETGET_FUNCS(item_size, struct btrfs_item, size, 32);
++
++static inline unsigned long btrfs_item_nr_offset(int nr)
++{
++       return offsetof(struct btrfs_leaf, items) +
++               sizeof(struct btrfs_item) * nr;
++}
++
++static inline struct btrfs_item *btrfs_item_nr(struct extent_buffer *eb,
++                                              int nr)
++{
++       return (struct btrfs_item *)btrfs_item_nr_offset(nr);
++}
++
++static inline u32 btrfs_item_end(struct extent_buffer *eb,
++                                struct btrfs_item *item)
++{
++       return btrfs_item_offset(eb, item) + btrfs_item_size(eb, item);
++}
++
++static inline u32 btrfs_item_end_nr(struct extent_buffer *eb, int nr)
++{
++       return btrfs_item_end(eb, btrfs_item_nr(eb, nr));
++}
++
++static inline u32 btrfs_item_offset_nr(struct extent_buffer *eb, int nr)
++{
++       return btrfs_item_offset(eb, btrfs_item_nr(eb, nr));
++}
++
++static inline u32 btrfs_item_size_nr(struct extent_buffer *eb, int nr)
++{
++       return btrfs_item_size(eb, btrfs_item_nr(eb, nr));
++}
++
++static inline void btrfs_item_key(struct extent_buffer *eb,
++                          struct btrfs_disk_key *disk_key, int nr)
++{
++       struct btrfs_item *item = btrfs_item_nr(eb, nr);
++       read_eb_member(eb, item, struct btrfs_item, key, disk_key);
++}
++
++/*
++ * struct btrfs_root_ref
++ */
++BTRFS_SETGET_FUNCS(root_ref_dirid, struct btrfs_root_ref, dirid, 64);
++BTRFS_SETGET_FUNCS(root_ref_sequence, struct btrfs_root_ref, sequence, 64);
++BTRFS_SETGET_FUNCS(root_ref_name_len, struct btrfs_root_ref, name_len, 16);
++
++/* struct btrfs_dir_item */
++BTRFS_SETGET_FUNCS(dir_data_len, struct btrfs_dir_item, data_len, 16);
++BTRFS_SETGET_FUNCS(dir_type, struct btrfs_dir_item, type, 8);
++BTRFS_SETGET_FUNCS(dir_name_len, struct btrfs_dir_item, name_len, 16);
++BTRFS_SETGET_FUNCS(dir_transid, struct btrfs_dir_item, transid, 64);
++
++static inline void btrfs_dir_item_key(struct extent_buffer *eb,
++                                     struct btrfs_dir_item *item,
++                                     struct btrfs_disk_key *key)
++{
++       read_eb_member(eb, item, struct btrfs_dir_item, location, key);
++}
++
++/* struct btrfs_disk_key */
++BTRFS_SETGET_STACK_FUNCS(disk_key_objectid, struct btrfs_disk_key,
++                        objectid, 64);
++BTRFS_SETGET_STACK_FUNCS(disk_key_offset, struct btrfs_disk_key, offset, 64);
++BTRFS_SETGET_STACK_FUNCS(disk_key_type, struct btrfs_disk_key, type, 8);
++
++static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
++                                        struct btrfs_disk_key *disk)
++{
++       cpu->offset = le64_to_cpu(disk->offset);
++       cpu->type = disk->type;
++       cpu->objectid = le64_to_cpu(disk->objectid);
++}
++
++static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
++                                        struct btrfs_key *cpu)
++{
++       disk->offset = cpu_to_le64(cpu->offset);
++       disk->type = cpu->type;
++       disk->objectid = cpu_to_le64(cpu->objectid);
++}
++
++static inline void btrfs_node_key_to_cpu(struct extent_buffer *eb,
++                                 struct btrfs_key *key, int nr)
++{
++       struct btrfs_disk_key disk_key;
++       btrfs_node_key(eb, &disk_key, nr);
++       btrfs_disk_key_to_cpu(key, &disk_key);
++}
++
++static inline void btrfs_item_key_to_cpu(struct extent_buffer *eb,
++                                 struct btrfs_key *key, int nr)
++{
++       struct btrfs_disk_key disk_key;
++       btrfs_item_key(eb, &disk_key, nr);
++       btrfs_disk_key_to_cpu(key, &disk_key);
++}
++
++static inline void btrfs_dir_item_key_to_cpu(struct extent_buffer *eb,
++                                     struct btrfs_dir_item *item,
++                                     struct btrfs_key *key)
++{
++       struct btrfs_disk_key disk_key;
++       btrfs_dir_item_key(eb, item, &disk_key);
++       btrfs_disk_key_to_cpu(key, &disk_key);
++}
++
++static inline u8 btrfs_key_type(struct btrfs_key *key)
++{
++       return key->type;
++}
++
++static inline void btrfs_set_key_type(struct btrfs_key *key, u8 val)
++{
++       key->type = val;
++}
++
++static inline u64 btrfs_super_devid(struct btrfs_super_block *disk_super)
++{
++	return le64_to_cpu(disk_super->dev_item.devid);
++}
++
++/* struct btrfs_header */
++BTRFS_SETGET_HEADER_FUNCS(header_bytenr, struct btrfs_header, bytenr, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_generation, struct btrfs_header,
++                         generation, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_owner, struct btrfs_header, owner, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_nritems, struct btrfs_header, nritems, 32);
++BTRFS_SETGET_HEADER_FUNCS(header_flags, struct btrfs_header, flags, 64);
++BTRFS_SETGET_HEADER_FUNCS(header_level, struct btrfs_header, level, 8);
++
++/* struct btrfs_root_item */
++BTRFS_SETGET_FUNCS(disk_root_generation, struct btrfs_root_item,
++                  generation, 64);
++BTRFS_SETGET_FUNCS(disk_root_refs, struct btrfs_root_item, refs, 32);
++BTRFS_SETGET_FUNCS(disk_root_bytenr, struct btrfs_root_item, bytenr, 64);
++BTRFS_SETGET_FUNCS(disk_root_level, struct btrfs_root_item, level, 8);
++
++BTRFS_SETGET_STACK_FUNCS(root_generation, struct btrfs_root_item,
++                        generation, 64);
++BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64);
++BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8);
++BTRFS_SETGET_STACK_FUNCS(root_dirid, struct btrfs_root_item, root_dirid, 64);
++BTRFS_SETGET_STACK_FUNCS(root_refs, struct btrfs_root_item, refs, 32);
++BTRFS_SETGET_STACK_FUNCS(root_flags, struct btrfs_root_item, flags, 64);
++BTRFS_SETGET_STACK_FUNCS(root_used, struct btrfs_root_item, bytes_used, 64);
++BTRFS_SETGET_STACK_FUNCS(root_limit, struct btrfs_root_item, byte_limit, 64);
++BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
++                        last_snapshot, 64);
++
++/* struct btrfs_super_block */
++
++BTRFS_SETGET_STACK_FUNCS(super_bytenr, struct btrfs_super_block, bytenr, 64);
++BTRFS_SETGET_STACK_FUNCS(super_flags, struct btrfs_super_block, flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_generation, struct btrfs_super_block,
++                        generation, 64);
++BTRFS_SETGET_STACK_FUNCS(super_root, struct btrfs_super_block, root, 64);
++BTRFS_SETGET_STACK_FUNCS(super_sys_array_size,
++                        struct btrfs_super_block, sys_chunk_array_size, 32);
++BTRFS_SETGET_STACK_FUNCS(super_chunk_root_generation,
++                        struct btrfs_super_block, chunk_root_generation, 64);
++BTRFS_SETGET_STACK_FUNCS(super_root_level, struct btrfs_super_block,
++                        root_level, 8);
++BTRFS_SETGET_STACK_FUNCS(super_chunk_root, struct btrfs_super_block,
++                        chunk_root, 64);
++BTRFS_SETGET_STACK_FUNCS(super_chunk_root_level, struct btrfs_super_block,
++                        chunk_root_level, 8);
++BTRFS_SETGET_STACK_FUNCS(super_log_root, struct btrfs_super_block,
++                        log_root, 64);
++BTRFS_SETGET_STACK_FUNCS(super_log_root_transid, struct btrfs_super_block,
++                        log_root_transid, 64);
++BTRFS_SETGET_STACK_FUNCS(super_log_root_level, struct btrfs_super_block,
++                        log_root_level, 8);
++BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block,
++                        total_bytes, 64);
++BTRFS_SETGET_STACK_FUNCS(super_bytes_used, struct btrfs_super_block,
++                        bytes_used, 64);
++BTRFS_SETGET_STACK_FUNCS(super_sectorsize, struct btrfs_super_block,
++                        sectorsize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_nodesize, struct btrfs_super_block,
++                        nodesize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_leafsize, struct btrfs_super_block,
++                        leafsize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_stripesize, struct btrfs_super_block,
++                        stripesize, 32);
++BTRFS_SETGET_STACK_FUNCS(super_root_dir, struct btrfs_super_block,
++                        root_dir_objectid, 64);
++BTRFS_SETGET_STACK_FUNCS(super_num_devices, struct btrfs_super_block,
++                        num_devices, 64);
++BTRFS_SETGET_STACK_FUNCS(super_compat_flags, struct btrfs_super_block,
++                        compat_flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_compat_ro_flags, struct btrfs_super_block,
++                        compat_flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_incompat_flags, struct btrfs_super_block,
++                        incompat_flags, 64);
++BTRFS_SETGET_STACK_FUNCS(super_csum_type, struct btrfs_super_block,
++                        csum_type, 16);
++
++static inline int btrfs_super_csum_size(struct btrfs_super_block *s)
++{
++       int t = btrfs_super_csum_type(s);
++       //BUG_ON(t >= ARRAY_SIZE(btrfs_csum_sizes));
++       return btrfs_csum_sizes[t];
++}
++
++static inline unsigned long btrfs_leaf_data(struct extent_buffer *l)
++{
++       return offsetof(struct btrfs_leaf, items);
++}
++
++/* struct btrfs_file_extent_item */
++BTRFS_SETGET_FUNCS(file_extent_type, struct btrfs_file_extent_item, type, 8);
++
++static inline unsigned long btrfs_file_extent_inline_start(struct
++                                                  btrfs_file_extent_item *e)
++{
++       unsigned long offset = (unsigned long)e;
++       offset += offsetof(struct btrfs_file_extent_item, disk_bytenr);
++       return offset;
++}
++
++static inline u32 btrfs_file_extent_calc_inline_size(u32 datasize)
++{
++       return offsetof(struct btrfs_file_extent_item, disk_bytenr) + datasize;
++}
++
++BTRFS_SETGET_FUNCS(file_extent_disk_bytenr, struct btrfs_file_extent_item,
++                  disk_bytenr, 64);
++BTRFS_SETGET_FUNCS(file_extent_generation, struct btrfs_file_extent_item,
++                  generation, 64);
++BTRFS_SETGET_FUNCS(file_extent_disk_num_bytes, struct btrfs_file_extent_item,
++                  disk_num_bytes, 64);
++BTRFS_SETGET_FUNCS(file_extent_offset, struct btrfs_file_extent_item,
++                 offset, 64);
++BTRFS_SETGET_FUNCS(file_extent_num_bytes, struct btrfs_file_extent_item,
++                  num_bytes, 64);
++BTRFS_SETGET_FUNCS(file_extent_ram_bytes, struct btrfs_file_extent_item,
++                  ram_bytes, 64);
++BTRFS_SETGET_FUNCS(file_extent_compression, struct btrfs_file_extent_item,
++                  compression, 8);
++BTRFS_SETGET_FUNCS(file_extent_encryption, struct btrfs_file_extent_item,
++                  encryption, 8);
++BTRFS_SETGET_FUNCS(file_extent_other_encoding, struct btrfs_file_extent_item,
++                  other_encoding, 16);
++
++/* this returns the number of file bytes represented by the inline item.
++ * If an item is compressed, this is the uncompressed size
++ */
++static inline u32 btrfs_file_extent_inline_len(struct extent_buffer *eb,
++                                       struct btrfs_file_extent_item *e)
++{
++       return btrfs_file_extent_ram_bytes(eb, e);
++}
++
++/*
++ * this returns the number of bytes used by the item on disk, minus the
++ * size of any extent headers.  If a file is compressed on disk, this is
++ * the compressed size
++ */
++static inline u32 btrfs_file_extent_inline_item_len(struct extent_buffer *eb,
++                                                   struct btrfs_item *e)
++{
++       unsigned long offset;
++       offset = offsetof(struct btrfs_file_extent_item, disk_bytenr);
++       return btrfs_item_size(eb, e) - offset;
++}
++
++static inline u32 btrfs_level_size(struct btrfs_root *root, int level) {
++       if (level == 0)
++               return root->leafsize;
++       return root->nodesize;
++}
++
++static inline u32 btrfs_root_level_size(struct btrfs_super_block *sb) {
++       return btrfs_super_root_level(sb) == 0 ?
++               btrfs_super_leafsize(sb) :
++               btrfs_super_nodesize(sb);
++}
++
++static inline u32 btrfs_chunk_root_level_size(struct btrfs_super_block *sb) {
++       return btrfs_super_chunk_root_level(sb) == 0 ?
++               btrfs_super_leafsize(sb) :
++               btrfs_super_nodesize(sb);
++}
++
++/* helper function to cast into the data area of the leaf. */
++#define btrfs_item_ptr(leaf, slot, type) \
++       ((type *)(btrfs_leaf_data(leaf) + \
++       btrfs_item_offset_nr(leaf, slot)))
++
++#define btrfs_item_ptr_offset(leaf, slot) \
++       ((unsigned long)(btrfs_leaf_data(leaf) + \
++       btrfs_item_offset_nr(leaf, slot)))
++
++/*volumes.h */
++
++struct btrfs_fs_devices {
++       u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
++
++       /* the device with this id has the most recent coyp of the super */
++       u64 latest_devid;
++       u64 latest_trans;
++       u64 lowest_devid;
++       int latest_bdev;
++       int lowest_bdev;
++       int seeding;
++       struct btrfs_fs_devices *seed;
++};
++
++struct btrfs_bio_stripe {
++	struct btrfs_device dev;
++	u64 physical;
++};
++
++#define MAX_NRSTRIPES 8
++struct btrfs_multi_bio {
++       int error;
++       int num_stripes;
++       struct btrfs_bio_stripe stripes[MAX_NRSTRIPES];
++};
++
++#define btrfs_multi_bio_size(n) (sizeof(struct btrfs_multi_bio) + \
++                           (sizeof(struct btrfs_bio_stripe) * (n)))
++
++static int aux_tree_lookup(struct btrfs_root *root,
++                          struct btrfs_key *key,
++                          struct btrfs_path *path);
++
++struct cache_extent {
++       u64 start;
++       u64 size;
++};
++
++struct map_lookup {
++       struct cache_extent ce;
++       u64 type;
++       int io_align;
++       int io_width;
++       int stripe_len;
++       int sector_size;
++       int num_stripes;
++       int sub_stripes;
++        struct btrfs_bio_stripe stripes[MAX_NRSTRIPES];
++};
++
++/* "VFS" things */
++
++/* file types recognized by grub */
++typedef enum {
++       BTRFS_REGULAR_FILE,
++       BTRFS_DIRECTORY_FILE,
++       BTRFS_SYMLINK_FILE,
++       BTRFS_UNKNOWN_FILE
++} btrfs_file_type;
++
++static inline int coord_is_root(struct btrfs_root *root,
++                               struct btrfs_path *path)
++{
++       return btrfs_header_bytenr(&path->nodes[0]) ==
++               btrfs_header_bytenr(&root->node);
++}
++
++static inline btrfs_file_type btrfs_get_file_type (int mode)
++{
++       if (S_ISLNK(mode))
++               return BTRFS_SYMLINK_FILE;
++       if (S_ISREG(mode))
++               return BTRFS_REGULAR_FILE;
++       if (S_ISDIR(mode))
++               return BTRFS_DIRECTORY_FILE;
++       return BTRFS_UNKNOWN_FILE;
++}
++
++#define min_t(type,x,y)                                                       \
++       ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
++#define max_t(type,x,y)                                                       \
++       ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
++
++
++int sys_array_lookup(struct map_lookup *map, u64 logical);
++int tree_chunk_lookup(struct map_lookup *map,
++                     u64 logical);
++int __btrfs_map_block(u64 logical, u64 *length,
++                     struct btrfs_multi_bio *multi_ret, int mirror_num);
++int read_tree_block(struct btrfs_root *root,
++                   struct extent_buffer *eb,
++                   u64 bytenr, /* logical */
++                   u32 blocksize,
++                   u64 parent_transid,
++                   lookup_pool_id lpid);
++int check_read_chunk(struct btrfs_key *key,
++                    struct extent_buffer *leaf,
++                    struct btrfs_chunk *chunk,
++                    struct map_lookup *map,
++                    u64 logical);
++/*
++  Local variables:
++  c-indentation-style: "K&R"
++  mode-name: "LC"
++  c-basic-offset: 8
++  tab-width: 8
++  fill-column: 80
++  scroll-step: 1
++  End:
++*/
+\ No newline at end of file
+diff -up grub-upstream.wip/stage2/builtins.c.btrfs grub-upstream.wip/stage2/builtins.c
+--- grub-upstream.wip/stage2/builtins.c.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/builtins.c	2012-03-20 05:11:13.000000000 +0000
+@@ -2456,6 +2456,16 @@ install_func (char *arg, int flags)
+ 	  else
+ #endif /* GRUB_UTIL */
+ 	    {
++ 	      /*
++	       * FIXME: Ugly hack.
++	       * Do not write to btrfs partition
++	       * without a help of the file system!
++	       */
++ 	      if (!strcmp(fsys_table[fsys_type].name, "btrfs"))
++ 		{
++ 		  errnum = ERR_BAD_ARGUMENT;
++ 		  goto fail;
++ 		}
+ 	      if (! devwrite (saved_sector - part_start, 1, stage2_buffer))
+ 		goto fail;
+ 	    }
+@@ -4281,6 +4291,7 @@ setup_func (char *arg, int flags)
+     {"jfs",      "/jfs_stage1_5"},
+     {"minix",    "/minix_stage1_5"},
+     {"reiserfs", "/reiserfs_stage1_5"},
++    {"btrfs",    "/btrfs_stage1_5"},
+     {"vstafs",   "/vstafs_stage1_5"},
+     {"xfs",      "/xfs_stage1_5"}
+   };
+diff -up grub-upstream.wip/stage2/disk_io.c.btrfs grub-upstream.wip/stage2/disk_io.c
+--- grub-upstream.wip/stage2/disk_io.c.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/disk_io.c	2012-03-20 05:07:09.000000000 +0000
+@@ -78,6 +78,9 @@ struct fsys_entry fsys_table[NUM_FSYS + 
+ # ifdef FSYS_ISO9660
+   {"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0},
+ # endif
++# ifdef FSYS_BTRFS
++  {"btrfs", btrfs_mount, btrfs_read, btrfs_dir, 0, btrfs_embed},
++# endif
+   /* XX FFS should come last as it's superblock is commonly crossing tracks
+      on floppies from track 1 to 2, while others only use 1.  */
+ # ifdef FSYS_FFS
+diff -up grub-upstream.wip/stage2/filesys.h.btrfs grub-upstream.wip/stage2/filesys.h
+--- grub-upstream.wip/stage2/filesys.h.btrfs	2004-05-14 19:36:43.000000000 +0000
++++ grub-upstream.wip/stage2/filesys.h	2012-03-20 05:07:09.000000000 +0000
+@@ -77,6 +77,16 @@ int reiserfs_embed (int *start_sector, i
+ #define FSYS_REISERFS_NUM 0
+ #endif
+ 
++#ifdef FSYS_BTRFS
++#define FSYS_BTRFS_NUM 1
++int btrfs_mount (void);
++int btrfs_read (char *buf, int len);
++int btrfs_dir (char *dirname);
++int btrfs_embed (int *start_sector, int needed_sectors);
++#else
++#define FSYS_BTRFS_NUM 0
++#endif
++
+ #ifdef FSYS_VSTAFS
+ #define FSYS_VSTAFS_NUM 1
+ int vstafs_mount (void);
+@@ -127,8 +137,8 @@ int iso9660_dir (char *dirname);
+ #ifndef NUM_FSYS
+ #define NUM_FSYS	\
+   (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM	\
+-   + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM	\
+-   + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
++   + FSYS_REISERFS_NUM + FSYS_BTRFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM \
++   + FSYS_XFS_NUM + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
+ #endif
+ 
+ /* defines for the block filesystem info area */
+diff -up /dev/null grub-upstream.wip/stage2/fsys_btrfs.c
+--- /dev/null	2009-06-03 06:46:26.160951000 +0000
++++ grub-upstream.wip/stage2/fsys_btrfs.c	2012-03-20 05:07:09.000000000 +0000
+@@ -0,0 +1,1820 @@
++/* fsys_btrfs.c - an implementation for the Btrfs filesystem
++ *
++ * Copyright 2009 Red Hat, Inc.  All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifdef FSYS_BTRFS
++
++#include "shared.h"
++#include "filesys.h"
++#include "btrfs.h"
++
++#define BTRFS_VERBOSE 0
++
++/* Cache layouts */
++
++#define LOOKUP_CACHE_BUF_SIZE   (4096)
++#define LOOKUP_CACHE_SIZE       (LOOKUP_CACHE_BUF_SIZE * LAST_LOOKUP_POOL)
++#define BTRFS_FS_INFO							\
++	((struct btrfs_fs_info *)((unsigned long)FSYS_BUF +		\
++				  LOOKUP_CACHE_SIZE))
++#define BTRFS_CACHE_SIZE         (sizeof(struct btrfs_fs_info) +	\
++				  LOOKUP_CACHE_SIZE)
++#define BTRFS_TREE_ROOT          (&BTRFS_FS_INFO->tree_root)
++#define BTRFS_CHUNK_ROOT         (&BTRFS_FS_INFO->chunk_root)
++#define BTRFS_FS_ROOT            (&BTRFS_FS_INFO->fs_root)
++#define BTRFS_SUPER              (&BTRFS_FS_INFO->sb_copy)
++#define BTRFS_DEVICES            (&BTRFS_FS_INFO->devices[0])
++#define BTRFS_FILE_INFO          (&BTRFS_FS_INFO->file_info)
++#define BTRFS_FILE_INFO_KEY      (&BTRFS_FILE_INFO->key)
++
++#define BTRFS_VOLATILE_DEV_CACHE				        \
++	(&BTRFS_FS_INFO->devices[BTRFS_NUM_CACHED_DEVICES])
++
++#define LOOKUP_CACHE_BUF(id) ((char *)((unsigned long)FSYS_BUF +	\
++				       id * LOOKUP_CACHE_BUF_SIZE))
++
++#define noop   do {; } while (0)
++
++#if BTRFS_VERBOSE
++#define btrfs_msg(format, ...) printf(format , ## __VA_ARGS__)
++#else
++#define btrfs_msg(format, args...) noop
++#endif
++
++/* compile-time check to make sure we don't overlap
++   filesystem buffer */
++static inline void check_btrfs_cache_size(void)
++{
++	cassert(BTRFS_CACHE_SIZE <= FSYS_BUFLEN);
++}
++
++static inline u64 btrfs_sb_offset(int mirror)
++{
++	u64 start = 16 * 1024;
++	if (mirror)
++		return start << (BTRFS_SUPER_MIRROR_SHIFT * mirror);
++	return BTRFS_SUPER_INFO_OFFSET;
++}
++
++static inline char *grab_lookup_cache(lookup_pool_id lpid)
++{
++	char *buf = LOOKUP_CACHE_BUF(lpid);
++	memset(buf, 0, LOOKUP_CACHE_BUF_SIZE);
++	return buf;
++}
++
++static inline struct btrfs_path *btrfs_grab_path(lookup_pool_id lpid)
++{
++	return &BTRFS_FS_INFO->paths[lpid];
++}
++
++static inline void btrfs_set_path_key(struct btrfs_path *path,
++				      struct btrfs_key *key)
++{
++	btrfs_item_key_to_cpu(&path->nodes[0],
++			      key,
++			      path->slots[0]);
++}
++
++static inline void btrfs_update_file_info(struct btrfs_path *path)
++{
++	btrfs_set_path_key(path, BTRFS_FILE_INFO_KEY);
++}
++
++static inline void btrfs_set_root_dir_key(struct btrfs_key *key)
++{
++	key->objectid = BTRFS_FIRST_FREE_OBJECTID;
++	btrfs_set_key_type(key, BTRFS_INODE_ITEM_KEY);
++	key->offset = 0;
++}
++
++static inline void copy_extent_buffer(struct extent_buffer *dst,
++				      struct extent_buffer *src)
++{
++	char *data = dst->data;
++	memcpy(dst, src, sizeof(*dst));
++	memcpy(data, src->data, 4096);
++	dst->data = data;
++}
++
++static inline void move_extent_buffer(struct extent_buffer *dst,
++				      struct extent_buffer *src)
++{
++	memcpy(dst, src, sizeof(*dst));
++}
++
++static inline void init_btrfs_root (struct btrfs_root *root)
++{
++	root->node.data = root->data;
++}
++
++static inline void init_btrfs_path(lookup_pool_id lpid)
++{
++	struct btrfs_path *path;
++	path = btrfs_grab_path(lpid);
++	path->lpid = lpid;
++}
++
++static inline void init_btrfs_info(void)
++{
++	int i;
++	
++	memset(BTRFS_FS_INFO, 0, sizeof(struct btrfs_fs_info));
++	for(i = 0; i < LAST_LOOKUP_POOL; i++)
++		init_btrfs_path(i);
++	init_btrfs_root(BTRFS_TREE_ROOT);
++	init_btrfs_root(BTRFS_CHUNK_ROOT);
++	init_btrfs_root(BTRFS_FS_ROOT);
++}
++
++static void setup_root(struct btrfs_root *root,
++		       u32 nodesize,
++		       u32 leafsize,
++		       u32 sectorsize,
++		       u32 stripesize,
++		       u64 objectid)
++{
++	root->nodesize = nodesize;
++	root->leafsize = leafsize;
++	root->sectorsize = sectorsize;
++	root->stripesize = stripesize;
++	root->objectid = objectid;
++}
++
++/*
++ * Pick up the latest root of a
++ * tree with specified @objectid
++ */
++static int btrfs_find_last_root(struct btrfs_root *tree_root,
++				u64 objectid,
++				struct btrfs_root_item *item,
++				lookup_pool_id lpid)
++{
++	int ret;
++	int slot;
++	struct btrfs_key search_key;
++	struct btrfs_key found_key;
++	struct btrfs_path *path;
++
++	search_key.objectid = objectid;
++	search_key.type = BTRFS_ROOT_ITEM_KEY;
++	search_key.offset = (u64)-1;
++	path = btrfs_grab_path(lpid);
++
++	ret = aux_tree_lookup(tree_root, &search_key, path);
++	if (ret < 0)
++		return 1;
++	slot = path->slots[0];
++	WARN_ON(slot == 0);
++	slot -= 1;
++	btrfs_item_key_to_cpu(&path->nodes[0], &found_key, slot);
++	if (found_key.objectid != objectid)
++		return 1;
++	
++	read_extent_buffer(&path->nodes[0], item,
++			   btrfs_item_ptr_offset(&path->nodes[0], slot),
++			   sizeof(*item));
++	return 0;
++}
++
++static int find_setup_root(struct btrfs_root *tree_root,
++			   u32 nodesize,
++			   u32 leafsize,
++			   u32 sectorsize,
++			   u32 stripesize,
++			   u64 objectid,
++			   struct btrfs_root *dest_root,
++			   u64 bytenr,
++			   u32 blocksize,
++			   u64 generation,
++			   lookup_pool_id lpid)
++{
++	int ret;
++	struct extent_buffer eb;
++
++	setup_root(dest_root,
++		   nodesize,
++		   leafsize,
++		   sectorsize,
++		   stripesize,
++		   objectid);
++	if (tree_root) {
++		/*
++		 * pick up the latest version
++		 * of the root we want to set up
++		 */
++		ret = btrfs_find_last_root(tree_root, objectid,
++					   &dest_root->root_item,
++					   lpid);
++		if (ret)
++			return ret;
++		bytenr = btrfs_root_bytenr(&dest_root->root_item);
++		blocksize = btrfs_level_size(dest_root,
++				       btrfs_root_level(&dest_root->root_item));
++		generation = btrfs_root_generation(&dest_root->root_item);
++	}
++	ret = read_tree_block(dest_root,
++			      &eb,
++			      bytenr,
++			      blocksize,
++			      generation,
++			      lpid);
++	if (!ret)
++		return 1;
++	copy_extent_buffer(&dest_root->node, &eb);
++	return 0;
++}
++
++static inline int btrfs_strncmp(const char *cs, const char *ct, int count)
++{
++	signed char __res = 0;
++
++	while (count) {
++		if ((__res = *cs - *ct++) != 0 || !*cs++)
++			break;
++		count--;
++	}
++	return __res;
++}
++
++/*
++ * the same as devread, but accepts
++ * device number, start and length.
++ */
++static int btrfs_devread(unsigned long drive, unsigned long part,
++			 unsigned long dev_len, int sector,
++			 int byte_offset, int byte_len, char *buf)
++{
++	if (sector < 0
++	    || ((sector + ((byte_offset + byte_len - 1) >> SECTOR_BITS))
++		>= dev_len)) {
++		errnum = ERR_OUTSIDE_PART;
++		return 0;
++	}
++	sector += byte_offset >> SECTOR_BITS;
++	byte_offset &= SECTOR_SIZE - 1;
++#if !defined(STAGE1_5)
++	if (disk_read_hook && debug)
++		printf ("<%d, %d, %d>", sector, byte_offset, byte_len);
++#endif /* !STAGE1_5 */
++	return rawread(drive, part + sector, byte_offset,
++		       byte_len, buf);
++}
++
++static int btrfs_check_super(void)
++{
++	struct btrfs_super_block *sb = BTRFS_SUPER;
++
++	if (sb->nodesize != BTRFS_DEFAULT_NODE_SIZE) {
++		btrfs_msg("Btrfs node size (%d) != %d unsupported\n",
++			  sb->nodesize, BTRFS_DEFAULT_NODE_SIZE);
++		goto error;
++	}
++	if (sb->leafsize != BTRFS_DEFAULT_LEAF_SIZE) {
++ 	        btrfs_msg("Btrfs leaf size (%d) != %d unsupported\n",
++			  sb->leafsize, BTRFS_DEFAULT_LEAF_SIZE);
++		goto error;
++	}
++	
++ 	return 0;
++error:
++	return 1;
++}
++
++/* lift the super block */
++static int btrfs_uptodate_super_copy(struct btrfs_fs_info *fs)
++{
++	errnum = ERR_NONE;
++	btrfs_devread(BTRFS_FS_INFO->sb_dev.drive,
++		      BTRFS_FS_INFO->sb_dev.part,
++		      BTRFS_FS_INFO->sb_dev.length,
++		      btrfs_sb_offset(BTRFS_FS_INFO->sb_mirror) >> SECTOR_BITS,
++		      0,
++		      sizeof(struct btrfs_super_block),
++		      (char *)BTRFS_SUPER);
++	return btrfs_check_super();
++}
++  
++/*
++ * Looking for a btrfs super block by magic, @fsid and @devid
++ * (the last two ones are optional). Update latest transid (if
++ * any). Return 0, if such super block was found. Otherwise,
++ * return 1.
++ *
++ * NOTE:
++ * After calling this function the sb_copy of global btrfs_fs_info
++ * can contain garbage, so the caller is responsible for this to be
++ * uptodate (see the function btrfs_uptodate_super_copy()).
++ */
++static int btrfs_find_super(struct btrfs_device *dev, char *fsid, u64 *devid)
++{
++	int i, ret;
++	int found = 0;
++
++	for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
++		ret = btrfs_devread(dev->drive,
++				    dev->part,
++				    dev->length,
++				    btrfs_sb_offset(i) >> SECTOR_BITS,
++				    0,
++				    sizeof(struct btrfs_super_block),
++				    (char *)BTRFS_SUPER);
++		if (!ret) {
++			if (errnum == ERR_OUTSIDE_PART) {
++				errnum = ERR_NONE;
++				break;
++			} else {
++				errnum = ERR_NONE;
++				continue;
++			}
++		}
++		if (btrfs_super_bytenr(BTRFS_SUPER) != btrfs_sb_offset(i) ||
++		    btrfs_strncmp((char *)(&BTRFS_SUPER->magic),
++				  BTRFS_MAGIC,
++				  sizeof(BTRFS_SUPER->magic)))
++			continue;
++		if (fsid &&
++		    btrfs_strncmp(fsid,
++				  (char *)BTRFS_SUPER->fsid,
++				  BTRFS_FSID_SIZE))
++			return 1;
++		if (devid &&
++		    *devid != btrfs_super_devid(BTRFS_SUPER))
++			return 1;
++		found = 1;
++		dev->devid = btrfs_super_devid(BTRFS_SUPER);
++
++		if (btrfs_super_generation(BTRFS_SUPER) >
++		    BTRFS_FS_INFO->sb_transid) {
++			BTRFS_FS_INFO->sb_transid =
++				btrfs_super_generation(BTRFS_SUPER);
++			BTRFS_FS_INFO->sb_mirror = i;
++			BTRFS_FS_INFO->sb_dev.devid =
++				btrfs_super_devid(BTRFS_SUPER);
++			BTRFS_FS_INFO->sb_dev.drive = dev->drive;
++			BTRFS_FS_INFO->sb_dev.part = dev->part;
++			BTRFS_FS_INFO->sb_dev.length = dev->length;
++		}
++	}
++	return !found;
++}
++
++/*
++ * "Discern" a btrfs device by fsid and
++ * optionaly by devid (if lookup is set).
++ * Populate persistent device cache (if
++ * there are free slots).
++ */
++static int btrfs_discerner(struct btrfs_device **dev, int lookup)
++{
++	if (btrfs_find_super(*dev,
++			     (char *)BTRFS_FS_INFO->fsid,
++			     (lookup ? &(*dev)->devid : 0)))
++		/* not found */
++		return 0;
++	if (*dev < BTRFS_VOLATILE_DEV_CACHE) {
++		/* populate persistent device cache */
++		memcpy(*dev + 1, *dev, sizeof(struct btrfs_device));
++		(*dev)++;
++	}
++	return 1;
++}
++
++/*
++ * Scan available grub devices and call discerner
++ * for them. Return a number of discerned devices
++ * The scanner was stolen from print_completions().
++ *
++ * Preconditions:
++ * The global structure btrfs_fs_info contains
++ * the latest valid version of btrfs superblock
++ * (the field @sb_copy)
++ */
++static u64 scan_grub_devices(struct btrfs_device *dev,
++			     int (*discerner)(struct btrfs_device **, int),
++			     int lookup)
++{
++	int i, j;
++	u64 count = 0;
++	struct geometry geom;
++
++	for (i = 0; i < 2; i++)
++		for (j = 0; j < 8; j++) {
++			unsigned long part = 0xFFFFFF;
++			int type, entry, gpt_count, gpt_size;
++			unsigned long offset, ext_offset, gpt_offset;
++
++			dev->drive = (i * 0x80) + j;
++			if (get_diskinfo(dev->drive, &geom))
++				continue;
++			while (1) {
++				int ret;
++				buf_drive = -1;
++				errnum = ERR_NONE;
++				ret = next_partition(dev->drive, 0xFFFFFF,
++						     &part, &type, &dev->part,
++						     &dev->length, &offset,
++						     &entry, &ext_offset,
++						     &gpt_offset, &gpt_count,
++						     &gpt_size,
++						     BTRFS_FS_INFO->mbr);
++				if (!ret)
++					break;
++				if (discerner(&dev, lookup)) {
++					count++;
++					if (lookup)
++						goto exit;
++				}
++			}
++		}
++#if 0
++	errnum = ERR_NONE;
++	if (cdrom_drive != GRUB_INVALID_DRIVE &&
++	    !get_diskinfo(cdrom_drive, &geom)) {
++		dev->drive = cdrom_drive;
++		dev->part = 0;
++		dev->length = geom.total_sectors;
++		if (discerner(&dev, lookup)) {
++			count++;
++			if (lookup)
++				goto exit;
++		}
++	}
++#ifdef SUPPORT_NETBOOT
++	errnum = ERR_NONE;
++	if (network_ready &&
++	    !get_diskinfo(NETWORK_DRIVE, &geom)) {
++		dev->drive = NETWORK_DRIVE;
++		dev->part = 0;
++		dev->length = geom.total_sectors;
++		if (discerner(&dev, lookup)) {
++			count++;
++			if (lookup)
++				goto exit;
++		}
++	}
++#endif /* SUPPORT_NETBOOT */
++#endif /* 0 */
++ exit:
++	return count;
++}
++
++#if 0
++static int btrfs_next_item(struct btrfs_root *root,
++			   struct btrfs_path *path);
++
++/*
++ * Scan the chunk tree for dev items
++ * and call a seeker for all of them.
++ * Preconditions: chunk root is installed
++ * to the global btrfs_fs_info.
++ */
++static int scan_dev_tree(struct btrfs_device* (*seeker)(u64))
++{
++	int ret;
++	u64 num_devices = 0;
++	struct btrfs_key key;
++	struct btrfs_key found_key;
++	struct btrfs_path *path;
++	struct btrfs_root *root;
++
++	root = BTRFS_CHUNK_ROOT;
++	path = btrfs_grab_path(FIRST_EXTERNAL_LOOKUP_POOL);
++	key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
++	key.type = 0;
++	key.offset = 0;
++
++	ret = aux_tree_lookup(root, &key, path);
++	if (ret == -1)
++		goto corrupted;
++	while (1) {
++		struct btrfs_device *result;
++		struct btrfs_dev_item *dev_item;
++
++		btrfs_item_key_to_cpu(&path->nodes[0],
++				      &found_key,
++				      path->slots[0]);
++		if (found_key.objectid != BTRFS_DEV_ITEMS_OBJECTID)
++			break;
++		dev_item = btrfs_item_ptr(&path->nodes[0],
++					  path->slots[0],
++					  struct btrfs_dev_item);
++		result = seeker(btrfs_device_id(&path->nodes[0], dev_item));
++		if (result == NULL) {
++			btrfs_msg("Btrfs device %llu is not available\n",
++				  btrfs_device_id(&path->nodes[0], dev_item));
++			goto missed_dev;
++		}
++		num_devices++;
++		ret = btrfs_next_item(root, path);
++		if (ret)
++			break;
++	}
++	if (num_devices == btrfs_super_num_devices(BTRFS_SUPER))
++		return 0;
++ corrupted:
++	errnum = ERR_FSYS_CORRUPT;
++	return 1;
++ missed_dev:
++	errnum = ERR_FSYS_MOUNT;
++	return 1;
++}
++#endif /* 0 */
++
++/*
++ * Find a grub btrfs device by devid.
++ * Preconditions: global btrfs_fs_info
++ * contains a copy of btrfs super block.
++ *
++ * Return pointer to the cached device on success.
++ * Otherwise return NULL.
++ */
++static struct btrfs_device *btrfs_lookup_device(u64 devid)
++{
++	int i, result;
++	struct btrfs_device *cdev;
++
++	for (i = 0; i < BTRFS_NUM_CACHED_DEVICES; i++) {
++		cdev = &BTRFS_DEVICES[i];
++		if (cdev->devid == devid)
++			goto found_in_cache;
++		if (cdev->devid == 0)
++			goto not_found_in_cache;
++	}
++not_found_in_cache:
++	cdev = BTRFS_VOLATILE_DEV_CACHE;
++	cdev->devid = devid;
++	result = scan_grub_devices(cdev,
++				   btrfs_discerner,
++				   1);
++	if (result == 0)
++		/*
++		 * At mount time we have figured out that
++		 * number of available devices is not less
++		 * then number of devices recorded in the
++		 * super block. Hence we treat this case as
++		 * file system corruption.
++		 */
++		goto corrupt;
++	result = btrfs_uptodate_super_copy(BTRFS_FS_INFO);
++	if (result)
++		goto corrupt;
++found_in_cache:
++	return cdev;
++corrupt:
++	errnum = ERR_FSYS_CORRUPT;
++	return NULL;
++}
++
++static int btrfs_find_device(struct btrfs_device *dev)
++{
++	struct btrfs_device *cdev;
++
++	if (btrfs_super_num_devices(BTRFS_SUPER) == 1) {
++		dev->drive = current_drive;
++		dev->part = part_start;
++		dev->length = part_length;
++		return 0;
++	}
++	cdev = btrfs_lookup_device(dev->devid);
++	if (cdev == NULL)
++		return 1;
++	dev->drive  = cdev->drive;
++	dev->part   = cdev->part;
++	dev->length = cdev->length;
++	return 0;
++}
++
++static inline void init_btrfs_volatile_dev_cache(void)
++{
++	BTRFS_VOLATILE_DEV_CACHE->devid = 0;
++	BTRFS_VOLATILE_DEV_CACHE->drive = current_drive;
++	BTRFS_VOLATILE_DEV_CACHE->part = part_start;
++	BTRFS_VOLATILE_DEV_CACHE->length = part_length;
++}
++
++/*
++ * check availability of btrfs devices
++ * and populate the persistent device cache
++ */
++static int btrfs_check_devices(void)
++{
++	u64 num_dev;
++
++	if (btrfs_super_num_devices(BTRFS_SUPER) == 1)
++		return 0;
++	num_dev = scan_grub_devices(BTRFS_DEVICES,
++				    btrfs_discerner, 0);
++	if (btrfs_uptodate_super_copy(BTRFS_FS_INFO))
++		return 1;
++	if (num_dev < btrfs_super_num_devices(BTRFS_SUPER)) {
++		btrfs_msg("Some (%llu) Btrfs devices is not available\n",
++			  btrfs_super_num_devices(BTRFS_SUPER) - num_dev);
++	        return 1;
++	}
++	return 0;
++}
++
++int btrfs_mount(void)
++{
++	int ret;
++
++	check_btrfs_cache_size();
++	init_btrfs_info();
++	init_btrfs_volatile_dev_cache();
++
++	ret = btrfs_find_super(BTRFS_VOLATILE_DEV_CACHE, NULL, NULL);
++	if (ret) {
++		btrfs_msg("Drive %lu, partition %lu: no Btrfs metadata\n",
++			  current_drive, part_start);
++		goto error;
++	}
++	ret = btrfs_uptodate_super_copy(BTRFS_FS_INFO);
++	if (ret)
++		goto error;
++	BTRFS_FS_INFO->sb_transid =
++		btrfs_super_generation(BTRFS_SUPER);
++	memcpy(BTRFS_FS_INFO->fsid,
++	       BTRFS_SUPER->fsid,
++	       BTRFS_FSID_SIZE);
++	ret = btrfs_check_devices();
++	if (ret)
++		goto error;
++	/* setup chunk root */
++	ret = find_setup_root(NULL,
++			      btrfs_super_nodesize(BTRFS_SUPER),
++			      btrfs_super_leafsize(BTRFS_SUPER),
++			      btrfs_super_sectorsize(BTRFS_SUPER),
++			      btrfs_super_stripesize(BTRFS_SUPER),
++			      BTRFS_CHUNK_TREE_OBJECTID,
++			      BTRFS_CHUNK_ROOT,
++			      btrfs_super_chunk_root(BTRFS_SUPER),
++			      btrfs_chunk_root_level_size(BTRFS_SUPER),
++			      btrfs_super_chunk_root_generation(BTRFS_SUPER),
++			      FIRST_EXTERNAL_LOOKUP_POOL);
++	if (ret)
++		return 0;
++	/* setup tree root */
++	ret = find_setup_root(NULL,
++			      btrfs_super_nodesize(BTRFS_SUPER),
++			      btrfs_super_leafsize(BTRFS_SUPER),
++			      btrfs_super_sectorsize(BTRFS_SUPER),
++			      btrfs_super_stripesize(BTRFS_SUPER),
++			      BTRFS_ROOT_TREE_OBJECTID,
++			      BTRFS_TREE_ROOT,
++			      btrfs_super_root(BTRFS_SUPER),
++			      btrfs_root_level_size(BTRFS_SUPER),
++			      btrfs_super_generation(BTRFS_SUPER),
++			      FIRST_EXTERNAL_LOOKUP_POOL);
++	if (ret)
++		return 0;
++	/* setup fs_root */
++	ret = find_setup_root(BTRFS_TREE_ROOT,
++			      btrfs_super_nodesize(BTRFS_SUPER),
++			      btrfs_super_leafsize(BTRFS_SUPER),
++			      btrfs_super_sectorsize(BTRFS_SUPER),
++			      btrfs_super_stripesize(BTRFS_SUPER),
++			      BTRFS_FS_TREE_OBJECTID,
++			      BTRFS_FS_ROOT,
++			      0,
++			      0,
++			      0,
++			      FIRST_EXTERNAL_LOOKUP_POOL);
++	return !ret;
++
++error:
++	errnum = ERR_FSYS_MOUNT;
++	return 0;
++}
++
++/*
++ * Check, whether @chunk is the map for a
++ * block with @logical block number.
++ * If yes, then fill the @map.
++ * Return 1 on affirmative result,
++ * otherwise return 0.
++ */
++int check_read_chunk(struct btrfs_key *key,
++			    struct extent_buffer *leaf,
++			    struct btrfs_chunk *chunk,
++			    struct map_lookup *map,
++			    u64 logical)
++{
++	int i, ret;
++	u64 chunk_start;
++	u64 chunk_size;
++	int num_stripes;
++
++	chunk_start = key->offset;
++	chunk_size = btrfs_chunk_length(leaf, chunk);
++
++	if (logical + 1 > chunk_start + chunk_size ||
++	    logical < chunk_start)
++		/* not a fit */
++		return 0;
++	num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
++	map->ce.start = chunk_start;
++	map->ce.size = chunk_size;
++	map->num_stripes = num_stripes;
++	map->io_width = btrfs_chunk_io_width(leaf, chunk);
++	map->io_align = btrfs_chunk_io_align(leaf, chunk);
++	map->sector_size = btrfs_chunk_sector_size(leaf, chunk);
++	map->stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
++	map->type = btrfs_chunk_type(leaf, chunk);
++	map->sub_stripes = btrfs_chunk_sub_stripes(leaf, chunk);
++
++	for (i = 0; i < num_stripes; i++) {
++		map->stripes[i].physical =
++			btrfs_stripe_offset_nr(leaf, chunk, i);
++		map->stripes[i].dev.devid =
++			btrfs_stripe_devid_nr(leaf, chunk, i);
++		ret = btrfs_find_device(&map->stripes[i].dev);
++		if (ret)
++			return 0;
++	}
++	return 1;
++}
++
++static void init_extent_buffer(struct extent_buffer *eb,
++			       struct btrfs_device *dev,
++			       u64 logical,
++			       u32 blocksize,
++			       u64 physical,
++			       lookup_pool_id lpid)
++{
++	if (dev)
++		memcpy(&eb->dev, dev, sizeof(*dev));
++	eb->start = logical;
++	eb->len = blocksize;
++	eb->dev_bytenr = physical;
++	eb->data = grab_lookup_cache(lpid);
++}
++
++/*
++ * Search for a map by logical offset in sys array.
++ * Return -1 on errors;
++ * Return 1 if the map is found,
++ * Return 0 if the map is not found.
++ */
++int sys_array_lookup(struct map_lookup *map, u64 logical)
++{
++	struct extent_buffer sb;
++	struct btrfs_disk_key *disk_key;
++	struct btrfs_chunk *chunk;
++	struct btrfs_key key;
++	u32 num_stripes;
++	u32 array_size;
++	u32 len = 0;
++	u8 *ptr;
++	unsigned long sb_ptr;
++	u32 cur;
++	int ret;
++	int i = 0;
++
++	sb.data = (char *)BTRFS_SUPER;
++	array_size = btrfs_super_sys_array_size(BTRFS_SUPER);
++
++	ptr = BTRFS_SUPER->sys_chunk_array;
++	sb_ptr = offsetof(struct btrfs_super_block, sys_chunk_array);
++	cur = 0;
++
++	while (cur < array_size) {
++		disk_key = (struct btrfs_disk_key *)ptr;
++		btrfs_disk_key_to_cpu(&key, disk_key);
++
++		len = sizeof(*disk_key);
++		ptr += len;
++		sb_ptr += len;
++		cur += len;
++
++		if (key.type == BTRFS_CHUNK_ITEM_KEY) {
++			chunk = (struct btrfs_chunk *)sb_ptr;
++			ret = check_read_chunk(&key, &sb,
++					       chunk, map, logical);
++			if (ret)
++				/* map is found */
++				return ret;
++			num_stripes = btrfs_chunk_num_stripes(&sb, chunk);
++			len = btrfs_chunk_item_size(num_stripes);
++		} else {
++			errnum = ERR_FSYS_CORRUPT;
++			return -1;
++		}
++		ptr += len;
++		sb_ptr += len;
++		cur += len;
++		i++;
++	}
++	return 0;
++}
++
++/*
++ * Search for a map by logical offset in the chunk tree.
++ * Return 1 if map is found, otherwise return 0.
++ */
++static int chunk_tree_lookup(struct map_lookup *map,
++			     u64 logical)
++{
++	int ret;
++	int slot;
++	struct extent_buffer *leaf;
++	struct btrfs_key key;
++	struct btrfs_key found_key;
++	struct btrfs_chunk *chunk;
++	struct btrfs_path *path;
++
++	path = btrfs_grab_path(INTERNAL_LOOKUP_POOL);
++
++	key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
++	key.offset = logical;
++	key.type = BTRFS_CHUNK_ITEM_KEY;
++
++	ret = aux_tree_lookup(BTRFS_CHUNK_ROOT, &key, path);
++	if (ret < 0)
++		return 0;
++	leaf = &path->nodes[0];
++	slot = path->slots[0];
++	if (ret == 1) {
++		WARN_ON(slot == 0);
++		slot -= 1;
++	}
++	btrfs_item_key_to_cpu(leaf, &found_key, slot);
++	if (found_key.type != BTRFS_CHUNK_ITEM_KEY)
++		return 0;
++	chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk);
++	return check_read_chunk(&found_key, leaf,
++				chunk, map, logical);
++}
++
++/*
++ * Btrfs logical/physical block mapper.
++ * Look for an appropriate map-extent and
++ * perform a translation. Return 1 on errors.
++ */
++static int btrfs_map_block(u64 logical, u64 *length,
++			   struct btrfs_multi_bio *multi,
++			   int mirror_num)
++{
++	struct map_lookup map;
++	u64 offset;
++	u64 stripe_offset;
++	u64 stripe_nr;
++	struct cache_extent *ce;
++	int stripe_index;
++	int i;
++	int ret;
++
++	memset(&map, 0, sizeof(map));
++	ret = sys_array_lookup(&map, logical);
++	if (ret == -1) {
++		errnum = ERR_FSYS_CORRUPT;
++		return 1;
++	}
++	if (ret == 0) {
++		ret = chunk_tree_lookup(&map, logical);
++		if (!ret) {
++			/* something should be found! */
++			errnum = ERR_FSYS_CORRUPT;
++			return 1;
++		}
++	}
++	/* do translation */
++	ce = &map.ce;
++
++	offset = logical - ce->start;
++	stripe_nr = offset / map.stripe_len;
++	stripe_offset = stripe_nr * map.stripe_len;
++	WARN_ON(offset < stripe_offset);
++
++	stripe_offset = offset - stripe_offset;
++
++	if (map.type & (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
++			 BTRFS_BLOCK_GROUP_RAID10 |
++			 BTRFS_BLOCK_GROUP_DUP)) {
++		*length = min_t(u64, ce->size - offset,
++			      map.stripe_len - stripe_offset);
++	} else {
++		*length = ce->size - offset;
++	}
++	multi->num_stripes = 1;
++	stripe_index = 0;
++	if (map.type & BTRFS_BLOCK_GROUP_RAID1) {
++		if (mirror_num)
++			stripe_index = mirror_num - 1;
++		else
++			stripe_index = stripe_nr % map.num_stripes;
++	} else if (map.type & BTRFS_BLOCK_GROUP_RAID10) {
++		int factor = map.num_stripes / map.sub_stripes;
++
++		stripe_index = stripe_nr % factor;
++		stripe_index *= map.sub_stripes;
++
++		if (mirror_num)
++			stripe_index += mirror_num - 1;
++		else
++			stripe_index = stripe_nr % map.sub_stripes;
++
++		stripe_nr = stripe_nr / factor;
++	} else if (map.type & BTRFS_BLOCK_GROUP_DUP) {
++		if (mirror_num)
++			stripe_index = mirror_num - 1;
++	} else {
++		stripe_index = stripe_nr % map.num_stripes;
++		stripe_nr = stripe_nr / map.num_stripes;
++	}
++	WARN_ON(stripe_index >= map.num_stripes);
++
++	for (i = 0; i < multi->num_stripes; i++) {
++		asm("" : "+r"(multi));
++		multi->stripes[i].physical =
++			map.stripes[stripe_index].physical + stripe_offset +
++			stripe_nr * map.stripe_len;
++		memcpy(&multi->stripes[i].dev,
++		       &map.stripes[stripe_index].dev,
++		       sizeof(struct btrfs_device));
++		stripe_index++;
++	}
++	return 0;
++}
++
++static u64 read_data_extent(u64 logical_start, u64 to_read, char *pos)
++{
++	int ret;
++	u64 length;
++	struct btrfs_multi_bio multi;
++
++	while (to_read) {
++		ret = btrfs_map_block(logical_start, &length, &multi, 0);
++		if (ret) {
++			errnum = ERR_FSYS_CORRUPT;
++			return ret;
++		}
++		if (length > to_read)
++			length = to_read;
++		disk_read_func = disk_read_hook;
++		ret = btrfs_devread(multi.stripes[0].dev.drive,
++				    multi.stripes[0].dev.part,
++				    multi.stripes[0].dev.length,
++				    multi.stripes[0].physical >> SECTOR_BITS,
++				    logical_start & ((u64)SECTOR_SIZE - 1),
++				    length,
++				    pos);
++		disk_read_func = NULL;
++		if (!ret)
++			return 1;
++		btrfs_msg("BTRFS data extent: read %llu bytes\n", length);
++		to_read -= length;
++		pos += length;
++		logical_start += length;
++	}
++	return 0;
++}
++
++static int read_extent_from_disk(struct extent_buffer *eb)
++{
++	WARN_ON(eb->dev_bytenr % SECTOR_BITS);
++	return btrfs_devread(eb->dev.drive,
++			     eb->dev.part,
++			     eb->dev.length,
++			     eb->dev_bytenr >> SECTOR_BITS,
++			     0,
++			     eb->len,
++			     eb->data);
++}
++
++static int verify_parent_transid(struct extent_buffer *eb, u64 parent_transid)
++{
++	return parent_transid && (btrfs_header_generation(eb) != parent_transid);
++}
++
++static int btrfs_num_copies(u64 logical, u64 len)
++{
++	return 1;
++}
++
++static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
++{
++	return 0;
++}
++
++static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
++		    int verify)
++{
++	return 0;
++}
++
++/*
++ * Read a block of logical number @bytenr
++ * from disk to buffer @eb.
++ * Return 1 on success.
++ */
++int read_tree_block(struct btrfs_root *root,
++		    struct extent_buffer *eb,
++		    u64 bytenr, /* logical */
++		    u32 blocksize,
++		    u64 parent_transid,
++		    lookup_pool_id lpid)
++{
++	int ret;
++	int dev_nr;
++	u64 length;
++	struct btrfs_multi_bio multi;
++	int mirror_num = 0;
++	int num_copies;
++
++	dev_nr = 0;
++	length = blocksize;
++	while (1) {
++		ret = btrfs_map_block(bytenr,
++				      &length, &multi, mirror_num);
++		if (ret) {
++			errnum = ERR_FSYS_CORRUPT;
++			return 0;
++		}
++		init_extent_buffer(eb,
++				   &multi.stripes[0].dev,
++				   bytenr,
++				   blocksize,
++				   multi.stripes[0].physical,
++				   lpid);
++
++		ret = read_extent_from_disk(eb);
++		if (ret &&
++		    check_tree_block(root, eb) == 0 &&
++		    csum_tree_block(root, eb, 1) == 0 &&
++		    verify_parent_transid(eb, parent_transid) == 0)
++			return 1;
++
++		num_copies = btrfs_num_copies(eb->start, eb->len);
++		if (num_copies == 1)
++			break;
++		mirror_num++;
++		if (mirror_num > num_copies)
++			break;
++	}
++	return 0;
++}
++
++/*
++ * Read a child pointed by @slot node pointer
++ * of @parent. Put the result to @parent.
++ * Return 1 on success.
++ */
++static int parent2child(struct btrfs_root *root,
++			struct extent_buffer *parent,
++			int slot,
++			lookup_pool_id lpid)
++{
++	int level;
++
++	WARN_ON(slot < 0);
++	WARN_ON(slot >= btrfs_header_nritems(parent));
++
++	level = btrfs_header_level(parent);
++	WARN_ON(level <= 0);
++
++	return read_tree_block(root,
++			       parent,
++			       btrfs_node_blockptr(parent, slot),
++			       btrfs_level_size(root, level - 1),
++			       btrfs_node_ptr_generation(parent, slot),
++			       lpid);
++}
++
++static int btrfs_comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
++{
++	struct btrfs_key k1;
++
++	btrfs_disk_key_to_cpu(&k1, disk);
++
++	if (k1.objectid > k2->objectid)
++		return 1;
++	if (k1.objectid < k2->objectid)
++		return -1;
++	if (k1.type > k2->type)
++		return 1;
++	if (k1.type < k2->type)
++		return -1;
++	if (k1.offset > k2->offset)
++		return 1;
++	if (k1.offset < k2->offset)
++		return -1;
++	return 0;
++}
++
++static int bin_search(struct extent_buffer *eb, unsigned long p,
++		      int item_size, struct btrfs_key *key,
++		      int max, int *slot)
++{
++	int low = 0;
++	int high = max;
++	int mid;
++	int ret;
++	unsigned long offset;
++	struct btrfs_disk_key *tmp;
++
++	while(low < high) {
++		mid = (low + high) / 2;
++		offset = p + mid * item_size;
++
++		tmp = (struct btrfs_disk_key *)(eb->data + offset);
++		ret = btrfs_comp_keys(tmp, key);
++
++		if (ret < 0)
++			low = mid + 1;
++		else if (ret > 0)
++			high = mid;
++		else {
++			*slot = mid;
++			return 0;
++		}
++	}
++	*slot = low;
++	return 1;
++}
++
++/* look for a key in a node */
++static int node_lookup(struct extent_buffer *eb,
++		       struct btrfs_key *key,
++		       int *slot)
++{
++	if (btrfs_header_level(eb) == 0) {
++		return bin_search(eb,
++				  offsetof(struct btrfs_leaf, items),
++				  sizeof(struct btrfs_item),
++				  key, btrfs_header_nritems(eb),
++				  slot);
++	} else {
++		return bin_search(eb,
++				  offsetof(struct btrfs_node, ptrs),
++				  sizeof(struct btrfs_key_ptr),
++				  key, btrfs_header_nritems(eb),
++				  slot);
++	}
++	return -1;
++}
++
++static inline int check_node(struct extent_buffer *buf, int slot)
++{
++	return 0;
++}
++
++/*
++ * Look for an item by key in read-only tree.
++ * Return 0, if key was found. Return -1 on io errors.
++ *
++ * Preconditions: btrfs_mount already executed.
++ * Postconditions: if returned value is non-negative,
++ * then path[0] represents the found position in the
++ * tree. All components of the @path from leaf to root
++ * are valid except their data buffers (only path[0]
++ * has valid attached data buffer).
++ */
++
++int aux_tree_lookup(struct btrfs_root *root,
++		    struct btrfs_key *key,
++		    struct btrfs_path *path)
++{
++	int ret;
++	int slot = 0;
++	int level;
++	struct extent_buffer node;
++	init_extent_buffer(&node,
++			   NULL,
++			   0,
++			   0,
++			   0,
++			   path->lpid);
++	copy_extent_buffer(&node, &root->node);
++	do {
++		level = btrfs_header_level(&node);
++		ret = check_node(&node, slot);
++		if (ret)
++			return -1;
++		move_extent_buffer(&path->nodes[level],
++				   &node);
++		ret = node_lookup(&node, key, &slot);
++		if (ret < 0)
++			return ret;
++		if (level) {
++		        /*
++			 * non-leaf,
++			 * jump to the next level
++			 */
++			if (ret && slot > 0)
++			        slot -= 1;
++			ret = parent2child(root, &node, slot, path->lpid);
++			if (ret == 0)
++				return -1;
++		}
++		path->slots[level] = slot;
++	} while (level);
++	return ret;
++}
++
++static int readup_buffer(struct extent_buffer *buf, lookup_pool_id lpid)
++{
++	buf->data = grab_lookup_cache(lpid);
++	return read_extent_from_disk(buf);
++}
++
++/*
++ * Find the next leaf in accordance with tree order;
++ * walk up the tree as far as required to find it.
++ * Returns 0 if something was found, or 1 if there
++ * are no greater leaves. Returns < 0 on io errors.
++ *
++ * Preconditions: all @path components from leaf to
++ * root have valid meta-data fields. path[0] has a
++ * valid attached data buffer with initial leaf.
++ * Postcondition: the same as above, but path[0] has
++ * an attached data buffer with the next leaf.
++ */
++static int btrfs_next_leaf(struct btrfs_root *root,
++			   struct btrfs_path *path)
++{
++	int res;
++	int slot;
++	int level = 1;
++	struct extent_buffer *buf;
++
++	while(level < BTRFS_MAX_LEVEL) {
++		buf = &path->nodes[level];
++		slot = path->slots[level] + 1;
++		/*
++		 * lift data on this level
++		 */
++		res = readup_buffer(buf, path->lpid);
++		if (!res)
++			break;
++		if (slot >= btrfs_header_nritems(buf)) {
++			/* alas, go to parent (if any) */
++			level++;
++			res = 1;
++			continue;
++		}
++		break;
++	}
++	if (!res)
++		return 1;
++	/*
++	 * At this level slot points to
++	 * the subtree we are interested in.
++	 */
++	path->slots[level] = slot;
++	while(level) {
++		struct extent_buffer tmp;
++		move_extent_buffer(&tmp, &path->nodes[level]);
++		res = parent2child(root, &tmp, slot, path->lpid);
++		if (res == 0)
++			return -1;
++		level --;
++		slot = 0;
++		move_extent_buffer(&path->nodes[level], &tmp);
++		path->slots[level] = slot;
++	}
++	return 0;
++}
++
++/* Preconditions: path is valid, data buffer
++ * is attached to leaf node.
++ * Postcondition: path is updated to point to
++ * the next position with respect to the tree
++ * order.
++ *
++ * Return -1 on io errors.
++ * Return 0, if next item was found.
++ * Return 1, if next item wasn't found (no more items).
++ */
++static int btrfs_next_item(struct btrfs_root *root,
++			   struct btrfs_path *path)
++{
++	WARN_ON(path->slots[0] >= btrfs_header_nritems(&path->nodes[0]));
++
++	path->slots[0] += 1;
++
++	if (path->slots[0] < btrfs_header_nritems(&path->nodes[0]))
++		return 0;
++	if (coord_is_root(root, path))
++		/* no more items */
++		return 1;
++	return btrfs_next_leaf(root, path);
++}
++
++/*
++ * check if we can reuse results of previous
++ * search for read operation
++ */
++static int path_is_valid(struct btrfs_path *path,
++			 struct btrfs_key *key, u64 offset)
++{
++	btrfs_item_key_to_cpu(&path->nodes[0],
++			      key,
++			      path->slots[0]);
++	if (BTRFS_FILE_INFO_KEY->objectid != key->objectid)
++		return 0;
++	if (btrfs_key_type(key) == BTRFS_INODE_ITEM_KEY)
++		return 1;
++	if (btrfs_key_type(key) != BTRFS_EXTENT_DATA_KEY)
++		return 0;
++	return BTRFS_FILE_INFO_KEY->offset <= offset;
++}
++
++/* ->read_func() */
++int btrfs_read(char *buf, int len)
++{
++	int ret;
++	struct btrfs_root *fs_root;
++	struct btrfs_path *path;
++	struct btrfs_key  path_key;
++	u64 ioff;
++	u64 bytes;
++	int to_read;
++	char *pos = buf;
++
++	fs_root = BTRFS_FS_ROOT;
++	path = btrfs_grab_path(FIRST_EXTERNAL_LOOKUP_POOL);
++
++	if (!path_is_valid(path, &path_key, filepos)) {
++		ret = aux_tree_lookup(fs_root, BTRFS_FILE_INFO_KEY, path);
++		if (ret < 0)
++			errnum = ERR_FSYS_CORRUPT;
++	}
++	while (!errnum) {
++		struct btrfs_item *item;
++		struct btrfs_file_extent_item *fi;
++		u64 from;
++
++		btrfs_item_key_to_cpu(&path->nodes[0],
++				      &path_key,
++				      path->slots[0]);
++		if (BTRFS_FILE_INFO_KEY->objectid != path_key.objectid)
++			break;
++		if (btrfs_key_type(&path_key) != BTRFS_EXTENT_DATA_KEY)
++			goto next;
++		/*
++		 * current position is extent item
++		 */
++		item = btrfs_item_nr(&path->nodes[0], path->slots[0]);
++		fi = btrfs_item_ptr(&path->nodes[0],
++				    path->slots[0],
++				    struct btrfs_file_extent_item);
++		if (btrfs_file_extent_compression(&path->nodes[0], fi)) {
++		       btrfs_msg("Btrfs transparent compression unsupported\n");
++		       errnum = ERR_BAD_FILETYPE;
++		       goto exit;
++		}
++		ioff = filepos - path_key.offset;
++
++		switch (btrfs_file_extent_type(&path->nodes[0], fi)) {
++		case BTRFS_FILE_EXTENT_INLINE:
++			bytes = btrfs_file_extent_inline_item_len(&path->
++								  nodes[0],
++								  item);
++			if (path_key.offset + bytes < filepos)
++				goto next;
++			to_read = bytes - ioff;
++			if (to_read > len)
++				to_read = len;
++			from = ioff + btrfs_file_extent_inline_start(fi);
++			if (disk_read_hook != NULL) {
++				disk_read_func = disk_read_hook;
++				ret = btrfs_devread(path->nodes[0].dev.drive,
++						    path->nodes[0].dev.part,
++						    path->nodes[0].dev.length,
++						    path->nodes[0].dev_bytenr >>
++						    SECTOR_BITS,
++						    from,
++						    to_read,
++						    pos);
++				disk_read_func = NULL;
++				if (ret)
++					goto exit;
++			} else
++				memcpy(pos,
++				       path->nodes[0].data + from,
++				       to_read);
++			btrfs_msg("BTRFS inline extent: read %d bytes pos %d\n",
++				  to_read, filepos);
++			break;
++		case BTRFS_FILE_EXTENT_REG:
++			bytes = btrfs_file_extent_num_bytes(&path->nodes[0],
++							    fi);
++			if (path_key.offset + bytes < filepos)
++				goto next;
++			to_read = bytes - ioff;
++			if (to_read > len)
++				to_read = len;
++			from = ioff +
++				btrfs_file_extent_disk_bytenr(&path->nodes[0],
++							      fi) +
++				btrfs_file_extent_offset(&path->nodes[0],
++							 fi);
++			ret = read_data_extent(from, to_read, pos);
++			if (ret)
++				goto exit;
++			break;
++		case BTRFS_FILE_EXTENT_PREALLOC:
++			btrfs_msg("Btrfs preallocated extents unsupported\n");
++			errnum = ERR_BAD_FILETYPE;
++			goto exit;
++		default:
++			errnum = ERR_FSYS_CORRUPT;
++			goto exit;
++		}
++		len -= to_read;
++		pos += to_read;
++		filepos += to_read;
++		if (len == 0)
++			break;
++		/* not everything was read */
++	next:
++		ret = btrfs_next_item(fs_root, path);
++		if (ret < 0) {
++			errnum = ERR_FSYS_CORRUPT;
++			break;
++		}
++		btrfs_update_file_info(path);
++		continue;
++	}
++exit:
++	return errnum ? 0 : pos - buf;
++}
++
++static int btrfs_follow_link(struct btrfs_root *root,
++			     struct btrfs_path *path,
++			     char **dirname, char *linkbuf,
++			     int *link_count,
++			     struct btrfs_inode_item *sd)
++{
++	int ret;
++	int len;
++	char *name = *dirname;
++
++	if (++(*link_count) > MAX_LINK_COUNT) {
++		errnum = ERR_SYMLINK_LOOP;
++		return 0;
++	}
++	/* calculate remaining name size */
++	filemax = btrfs_inode_size(&path->nodes[0], sd);
++	for (len = 0;
++	     name[len] && isspace(name[len]);
++	     len ++);
++
++	if (filemax + len > PATH_MAX - 1) {
++		errnum = ERR_FILELENGTH;
++		return 0;
++	}
++	grub_memmove(linkbuf + filemax, name, len + 1);
++	btrfs_update_file_info(path);
++	filepos = 0;
++	/* extract symlink content */
++	while (1) {
++		u64 oid = BTRFS_FILE_INFO_KEY->objectid;
++		ret = btrfs_next_item(root, path);
++		if (ret)
++			break;
++		btrfs_update_file_info(path);
++		if (oid != BTRFS_FILE_INFO_KEY->objectid)
++			break;
++		if (btrfs_key_type(BTRFS_FILE_INFO_KEY) ==
++		    BTRFS_EXTENT_DATA_KEY)
++			goto found;
++	}
++	/* no target was found */
++	errnum = ERR_FSYS_CORRUPT;
++	return 0;
++found:
++	/* fill the rest of linkbuf with the content */
++	ret = btrfs_read(linkbuf, filemax);
++	if (ret != filemax) {
++		errnum = ERR_FSYS_CORRUPT;
++		return 0;
++	}
++	return 1;
++}
++
++static int update_fs_root(struct btrfs_root *fs_root,
++			  struct btrfs_key *location)
++{
++	int ret;
++	struct btrfs_root *tree_root;
++
++	if (location->offset != (u64)-1)
++		return 0;
++	tree_root = &BTRFS_FS_INFO->tree_root;
++	ret = find_setup_root(tree_root,
++			      tree_root->nodesize,
++			      tree_root->leafsize,
++			      tree_root->sectorsize,
++			      tree_root->stripesize,
++			      location->objectid,
++			      fs_root,
++			      0,
++			      0,
++			      0,
++			      SECOND_EXTERNAL_LOOKUP_POOL);
++	if (ret)
++		return ret;
++	location->objectid = btrfs_root_dirid(&fs_root->root_item);
++	btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY);
++	location->offset = 0;
++	return 0;
++}
++
++#ifndef STAGE1_5
++static inline void update_possibilities(void)
++{
++	if (print_possibilities > 0)
++		print_possibilities =
++			-print_possibilities;
++}
++#endif
++
++/*
++ * Look for a directory item by name.
++ * Print possibilities, if needed.
++ * Postconditions: on success @sd_key points
++ * to the key contained in the directory entry.
++ */
++static int btrfs_de_index_by_name(struct btrfs_root *root,
++				  struct btrfs_path *path,
++				  char **dirname,
++				  struct btrfs_key *sd_key)
++{
++	char ch;
++	int ret;
++	char *rest;
++	struct btrfs_dir_item *di;
++#ifndef STAGE1_5
++	int do_possibilities = 0;
++#endif
++	for (; **dirname == '/'; (*dirname)++);
++	for (rest = *dirname;
++	     (ch = *rest) && !isspace(ch) && ch != '/';
++	     rest++);
++	*rest = 0; /* for substrung() */
++#ifndef STAGE1_5
++	if (print_possibilities && ch != '/')
++		do_possibilities = 1;
++#endif
++	/* scan a directory */
++	while (1) {
++		u32 total;
++		u32 cur = 0;
++		u32 len;
++		struct btrfs_key di_key;
++		struct btrfs_disk_key location;
++		struct btrfs_item *item;
++
++		/* extract next dir entry */
++		ret = btrfs_next_item(root, path);
++		if (ret)
++			break;
++		item = btrfs_item_nr(&path->nodes[0],
++				     path->slots[0]);
++		btrfs_item_key_to_cpu(&path->nodes[0],
++				      &di_key,
++				      path->slots[0]);
++		if (di_key.objectid != sd_key->objectid)
++			/* no more entries */
++			break;
++		di = btrfs_item_ptr(&path->nodes[0],
++				    path->slots[0],
++				    struct btrfs_dir_item);
++		/*
++		 * working around special cases:
++		 * btrfs doesn't maintain directory entries
++		 * which contain names "." and ".."
++		 */
++		if (!substring(".", *dirname)) {
++#ifndef STAGE1_5
++			if (do_possibilities) {
++				update_possibilities();
++				return 1;
++			}
++#endif
++			goto found;
++		}
++		if (!substring("..", *dirname)) {
++			if (di_key.type != BTRFS_INODE_REF_KEY)
++				continue;
++			sd_key->objectid = di_key.offset;
++			btrfs_set_key_type(sd_key, BTRFS_INODE_ITEM_KEY);
++			sd_key->offset = 0;
++#ifndef STAGE1_5
++			if (do_possibilities) {
++				update_possibilities();
++				return 1;
++			}
++#endif
++			goto found;
++		}
++		if (di_key.type != BTRFS_DIR_ITEM_KEY)
++			continue;
++		total = btrfs_item_size(&path->nodes[0], item);
++		/* scan a directory item */
++		while (cur < total) {
++			char tmp;
++			int result;
++			char *filename;
++			char *end_of_name;
++			int name_len;
++			int data_len;
++
++			btrfs_dir_item_key(&path->nodes[0], di, &location);
++
++			name_len = btrfs_dir_name_len(&path->nodes[0], di);
++			data_len = btrfs_dir_data_len(&path->nodes[0], di);
++
++			WARN_ON(name_len > BTRFS_NAME_LEN);
++
++			filename = (char *)(path->nodes[0].data +
++					    (unsigned long)(di + 1));
++			end_of_name = filename + name_len;
++			/*
++			 * working around not null-terminated
++			 * directory names in btrfs: just
++			 * a short-term overwrite of the
++			 * cache with the following rollback
++			 * of the change.
++			 */
++			tmp = *end_of_name;
++			*end_of_name = 0;
++			result = substring(*dirname, filename);
++			*end_of_name = tmp;
++#ifndef STAGE1_5
++			if (do_possibilities) {
++				if (result <= 0) {
++					update_possibilities();
++					*end_of_name = 0;
++					print_a_completion(filename);
++					*end_of_name = tmp;
++				}
++			}
++			else
++#endif
++				if (result == 0) {
++				      btrfs_dir_item_key_to_cpu(&path->nodes[0],
++								di, sd_key);
++				      goto found;
++				}
++			len = sizeof(*di) + name_len + data_len;
++			di = (struct btrfs_dir_item *)((char *)di + len);
++			cur += len;
++		}
++	}
++#ifndef STAGE1_5
++	if (print_possibilities < 0)
++		return 1;
++#endif
++	errnum = ERR_FILE_NOT_FOUND;
++	*rest = ch;
++	return 0;
++ found:
++	*rest = ch;
++	*dirname = rest;
++	return 1;
++}
++
++/*
++ * ->dir_func().
++ * Postcondition: on a non-zero return BTRFS_FS_INFO
++ * contains the latest fs_root of file's subvolume.
++ * BTRFS_FS_INFO points to a subvolume of a file we
++ * were trying to look up.
++ * BTRFS_FILE_INFO contains info of the file we were
++ * trying to look up.
++ */
++
++int btrfs_dir(char *dirname)
++{
++	int ret;
++	int mode;
++	u64 size;
++	int linkcount = 0;
++	char linkbuf[PATH_MAX];
++
++	struct btrfs_path *path;
++	struct btrfs_root *root;
++
++	struct btrfs_key sd_key;
++	struct btrfs_inode_item *sd;
++	struct btrfs_key parent_sd_key;
++
++	root = BTRFS_FS_ROOT;
++	path = btrfs_grab_path(FIRST_EXTERNAL_LOOKUP_POOL);
++
++	btrfs_set_root_dir_key(&sd_key);
++	while (1) {
++		struct extent_buffer *leaf;
++		ret = aux_tree_lookup(root, &sd_key, path);
++		if (ret)
++			return 0;
++		leaf = &path->nodes[0];
++		sd = btrfs_item_ptr(leaf,
++				    path->slots[0],
++				    struct btrfs_inode_item);
++		mode = btrfs_inode_mode(leaf, sd);
++		size = btrfs_inode_size(leaf, sd);
++		switch (btrfs_get_file_type(mode)) {
++		case BTRFS_SYMLINK_FILE:
++			ret = btrfs_follow_link(root,
++						path,
++						&dirname,
++						linkbuf,
++						&linkcount,
++						sd);
++			if (!ret)
++				return 0;
++			dirname = linkbuf;
++			if (*dirname == '/')
++				/* absolute name */
++				btrfs_set_root_dir_key(&sd_key);
++			else
++				memcpy(&sd_key, &parent_sd_key,
++				       sizeof(sd_key));
++			continue;
++		case BTRFS_REGULAR_FILE:
++			/*
++			 * normally we want to exit here
++			 */
++			if (*dirname && !isspace (*dirname)) {
++				errnum = ERR_BAD_FILETYPE;
++				return 0;
++			}
++			filepos = 0;
++			filemax = btrfs_inode_size(leaf, sd);
++			btrfs_update_file_info(path);
++			return 1;
++		case BTRFS_DIRECTORY_FILE:
++			memcpy(&parent_sd_key, &sd_key, sizeof(sd_key));
++			ret = btrfs_de_index_by_name(root,
++						     path,
++						     &dirname,
++						     &sd_key);
++			if (!ret)
++				return 0;
++#ifndef STAGE1_5
++			if (print_possibilities < 0)
++				return 1;
++#endif
++			/*
++			 * update fs_tree:
++			 * subvolume stuff goes here
++			 */
++			ret = update_fs_root(root, &sd_key);
++			if (ret)
++				return 0;
++			continue;
++		case BTRFS_UNKNOWN_FILE:
++		default:
++			btrfs_msg("Btrfs: bad file type\n");
++			errnum = ERR_BAD_FILETYPE;
++			return 0;
++		}
++	}
++}
++
++int btrfs_embed(int *start_sector, int needed_sectors)
++{
++	int ret;
++	init_btrfs_info();
++	init_btrfs_volatile_dev_cache();
++
++	ret = btrfs_find_super(BTRFS_VOLATILE_DEV_CACHE, NULL, NULL);
++	if (ret)
++		return 0;
++	ret = btrfs_uptodate_super_copy(BTRFS_FS_INFO);
++	if (ret)
++		return 0;
++	*start_sector = 1; /* reserve first sector for stage1 */
++	return needed_sectors <=
++		((BTRFS_SUPER_INFO_OFFSET >> SECTOR_BITS) - 1);
++}
++#endif /* FSYS_BTRFS */
++
++/*
++  Local variables:
++  c-indentation-style: "K&R"
++  mode-name: "LC"
++  c-basic-offset: 8
++  tab-width: 8
++  fill-column: 80
++  scroll-step: 1
++  End:
++*/
+diff -up grub-upstream.wip/stage2/Makefile.am.btrfs grub-upstream.wip/stage2/Makefile.am
+--- grub-upstream.wip/stage2/Makefile.am.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/Makefile.am	2012-03-20 05:07:09.000000000 +0000
+@@ -17,13 +17,13 @@ INCLUDES = -I$(top_srcdir)/stage1
+ noinst_LIBRARIES = libgrub.a
+ libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
+ 	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
+-	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
++	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_btrfs.c fsys_ufs2.c \
+ 	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
+ 	terminfo.c tparm.c graphics.c
+ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
+ 	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
+ 	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
+-	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
++	-DFSYS_BTRFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+ 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
+ 
+ # Stage 2 and Stage 1.5's.
+@@ -34,24 +34,26 @@ EXTRA_PROGRAMS = nbloader.exec pxeloader
+ if DISKLESS_SUPPORT
+ pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+-	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
+-	nbgrub pxegrub
++	reiserfs_stage1_5 btrfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
++	xfs_stage1_5 nbgrub pxegrub
+ noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
+ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
+ 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
+ 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
+-	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
+-	xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
++	reiserfs_stage1_5.exec btrfs_stage1_5.exec ufs2_stage1_5.exec \
++	vstafs_stage1_5.exec xfs_stage1_5.exec nbloader.exec \
++	pxeloader.exec diskless.exec
+ else
+ pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
+ 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
+-	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
++	reiserfs_stage1_5 btrfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
++	xfs_stage1_5
+ noinst_DATA = pre_stage2 start start_eltorito
+ noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
+ 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
+ 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
+-	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
+-	xfs_stage1_5.exec
++	reiserfs_stage1_5.exec btrfs_stage1_5.exec ufs2_stage1_5.exec \
++	vstafs_stage1_5.exec xfs_stage1_5.exec
+ endif
+ MOSTLYCLEANFILES = $(noinst_PROGRAMS)
+ 
+@@ -95,15 +97,17 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DN
+ pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
+ 	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
+ 	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
+-	fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
+-	hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \
+-	graphics.c
++	fsys_reiserfs.c fsys_btrfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \
++	gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \
++	tparm.c graphics.c
+ pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
+ pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
+ pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
+ 
+ if NETBOOT_SUPPORT
+-pre_stage2_exec_LDADD = ../netboot/libdrivers.a
++pre_stage2_exec_LDADD = ../netboot/libdrivers.a -lgcc
++else
++pre_stage2_exec_LDADD = -lgcc
+ endif
+ 
+ if DISKLESS_SUPPORT
+@@ -197,6 +201,16 @@ reiserfs_stage1_5_exec_CCASFLAGS = $(STA
+ 	-DNO_BLOCK_FILES=1
+ reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+ 
++# For btrfs_stage1_5 target.
++btrfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
++       disk_io.c stage1_5.c fsys_btrfs.c bios.c
++btrfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_BTRFS=1 \
++       -DNO_BLOCK_FILES=1
++btrfs_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_BTRFS=1 \
++       -DNO_BLOCK_FILES=1
++btrfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
++btrfs_stage1_5_exec_LDADD = -lgcc
++
+ # For vstafs_stage1_5 target.
+ vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
+ 	disk_io.c stage1_5.c fsys_vstafs.c bios.c
+@@ -240,7 +254,7 @@ diskless_exec_CFLAGS = $(STAGE2_COMPILE)
+ diskless_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \
+ 	-DSUPPORT_DISKLESS=1
+ diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK)
+-diskless_exec_LDADD = ../netboot/libdrivers.a
++diskless_exec_LDADD = ../netboot/libdrivers.a -lgcc
+ 
+ diskless_size.h: diskless
+ 	-rm -f $@
+diff -up grub-upstream.wip/stage2/shared.h.btrfs grub-upstream.wip/stage2/shared.h
+--- grub-upstream.wip/stage2/shared.h.btrfs	2012-03-20 05:06:49.000000000 +0000
++++ grub-upstream.wip/stage2/shared.h	2012-03-20 05:07:09.000000000 +0000
+@@ -207,11 +207,12 @@ extern char *grub_scratch_mem;
+ #define STAGE2_ID_FAT_STAGE1_5		3
+ #define STAGE2_ID_MINIX_STAGE1_5	4
+ #define STAGE2_ID_REISERFS_STAGE1_5	5
+-#define STAGE2_ID_VSTAFS_STAGE1_5	6
+-#define STAGE2_ID_JFS_STAGE1_5		7
+-#define STAGE2_ID_XFS_STAGE1_5		8
+-#define STAGE2_ID_ISO9660_STAGE1_5	9
+-#define STAGE2_ID_UFS2_STAGE1_5		10
++#define STAGE2_ID_BTRFS_STAGE1_5	6
++#define STAGE2_ID_VSTAFS_STAGE1_5	7
++#define STAGE2_ID_JFS_STAGE1_5		8
++#define STAGE2_ID_XFS_STAGE1_5		9
++#define STAGE2_ID_ISO9660_STAGE1_5	10
++#define STAGE2_ID_UFS2_STAGE1_5		11
+ 
+ #ifndef STAGE1_5
+ # define STAGE2_ID	STAGE2_ID_STAGE2
+@@ -226,6 +227,8 @@ extern char *grub_scratch_mem;
+ #  define STAGE2_ID	STAGE2_ID_MINIX_STAGE1_5
+ # elif defined(FSYS_REISERFS)
+ #  define STAGE2_ID	STAGE2_ID_REISERFS_STAGE1_5
++# elif defined(FSYS_BTRFS)
++#  define STAGE2_ID	STAGE2_ID_BTRFS_STAGE1_5
+ # elif defined(FSYS_VSTAFS)
+ #  define STAGE2_ID	STAGE2_ID_VSTAFS_STAGE1_5
+ # elif defined(FSYS_JFS)

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33: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 1SI4E0-0007mw-Vq; Wed, 11 Apr 2012 20:33:08 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Dz-0007mf-QI
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:07 +0000
Received: from [85.158.138.51:50904] by server-6.bemta-3.messagelabs.com id
	C3/ED-05145-28AE58F4; Wed, 11 Apr 2012 20:33:06 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-174.messagelabs.com!1334176385!21659749!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18558 invoked from network); 11 Apr 2012 20:33:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Dw-0004JG-Jw
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Dw-0001Bj-4E
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:04 +0000
Date: Wed, 11 Apr 2012 20:33:04 +0000
Message-Id: <E1SI4Dw-0001Bj-4E@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Version 1.0.1
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 3ffb4001c2e28624cd59a2b3598858784d0718d0
Author: Justin M. Forbes <jforbes@redhat.com>
Date:   Thu Feb 2 16:44:08 2012 -0600

    Version 1.0.1
    
    Signed-off-by: Justin M. Forbes <jforbes@redhat.com>
---
 VERSION |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/VERSION b/VERSION
index d3827e7..b70c292 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0
+1.0,1
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33: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 1SI4E0-0007mw-Vq; Wed, 11 Apr 2012 20:33:08 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Dz-0007mf-QI
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:07 +0000
Received: from [85.158.138.51:50904] by server-6.bemta-3.messagelabs.com id
	C3/ED-05145-28AE58F4; Wed, 11 Apr 2012 20:33:06 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-174.messagelabs.com!1334176385!21659749!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18558 invoked from network); 11 Apr 2012 20:33:06 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Dw-0004JG-Jw
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Dw-0001Bj-4E
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:04 +0000
Date: Wed, 11 Apr 2012 20:33:04 +0000
Message-Id: <E1SI4Dw-0001Bj-4E@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Version 1.0.1
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 3ffb4001c2e28624cd59a2b3598858784d0718d0
Author: Justin M. Forbes <jforbes@redhat.com>
Date:   Thu Feb 2 16:44:08 2012 -0600

    Version 1.0.1
    
    Signed-off-by: Justin M. Forbes <jforbes@redhat.com>
---
 VERSION |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/VERSION b/VERSION
index d3827e7..b70c292 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0
+1.0,1
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4EB-0007o7-2J; Wed, 11 Apr 2012 20:33:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4E9-0007np-T4
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:18 +0000
Received: from [85.158.139.83:39732] by server-2.bemta-5.messagelabs.com id
	34/E4-17016-D8AE58F4; Wed, 11 Apr 2012 20:33:17 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334176395!23408370!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19830 invoked from network); 11 Apr 2012 20:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4E6-0004JJ-VW
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4E6-0001C9-O7
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:14 +0000
Date: Wed, 11 Apr 2012 20:33:14 +0000
Message-Id: <E1SI4E6-0001C9-O7@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] qemu-1.0.1/VERSION
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit be94aaec72dbacd0d948946ebab482864454b8ff
Author: Kenneth Salerno <kennethsalerno@yahoo.com>
Date:   Sat Feb 18 16:05:44 2012 -0800

    qemu-1.0.1/VERSION
    
    Hello,
    
    The VERSION file in stable release qemu-1.0.1 has what I believe might be a typo: "1.0,1" rather than "1.0.1". This is causing a parsing issue for windres.exe in Win32 which chokes on:
       #define CONFIG_FILEVERSION 1,0,1,0,1,0
       #define CONFIG_PRODUCTVERSION 1,0,1,0,1,0
    
    when it should be seeing this:
       #define CONFIG_FILEVERSION 1,0,1,0
       #define CONFIG_PRODUCTVERSION 1,0,1,0
    
    Patch:
    
    Signed-off-by: Justin M. Forbes <jforbes@redhat.com>
---
 VERSION |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/VERSION b/VERSION
index b70c292..7dea76e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0,1
+1.0.1
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4EB-0007o7-2J; Wed, 11 Apr 2012 20:33:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4E9-0007np-T4
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:18 +0000
Received: from [85.158.139.83:39732] by server-2.bemta-5.messagelabs.com id
	34/E4-17016-D8AE58F4; Wed, 11 Apr 2012 20:33:17 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334176395!23408370!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19830 invoked from network); 11 Apr 2012 20:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:16 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4E6-0004JJ-VW
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4E6-0001C9-O7
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:14 +0000
Date: Wed, 11 Apr 2012 20:33:14 +0000
Message-Id: <E1SI4E6-0001C9-O7@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] qemu-1.0.1/VERSION
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit be94aaec72dbacd0d948946ebab482864454b8ff
Author: Kenneth Salerno <kennethsalerno@yahoo.com>
Date:   Sat Feb 18 16:05:44 2012 -0800

    qemu-1.0.1/VERSION
    
    Hello,
    
    The VERSION file in stable release qemu-1.0.1 has what I believe might be a typo: "1.0,1" rather than "1.0.1". This is causing a parsing issue for windres.exe in Win32 which chokes on:
       #define CONFIG_FILEVERSION 1,0,1,0,1,0
       #define CONFIG_PRODUCTVERSION 1,0,1,0,1,0
    
    when it should be seeing this:
       #define CONFIG_FILEVERSION 1,0,1,0
       #define CONFIG_PRODUCTVERSION 1,0,1,0
    
    Patch:
    
    Signed-off-by: Justin M. Forbes <jforbes@redhat.com>
---
 VERSION |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/VERSION b/VERSION
index b70c292..7dea76e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0,1
+1.0.1
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:34 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4EM-0007qG-5J; Wed, 11 Apr 2012 20:33:30 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4EK-0007pn-Qx
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:28 +0000
Received: from [193.109.254.147:24342] by server-1.bemta-14.messagelabs.com id
	6A/BC-29372-79AE58F4; Wed, 11 Apr 2012 20:33:27 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334176405!1703256!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1684 invoked from network); 11 Apr 2012 20:33:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:26 -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 1SI4EH-0004JP-7H
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4EH-0001CV-2z
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:25 +0000
Date: Wed, 11 Apr 2012 20:33:25 +0000
Message-Id: <E1SI4EH-0001CV-2z@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] cirrus_vga: do not reset
	videoram
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 0ea2d40b85ca8af409492959d20c5504d0699bfe
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Jan 24 12:04:42 2012 +0000

    cirrus_vga: do not reset videoram
    
    There is no need to set the videoram to 0xff in cirrus_reset, because it
    is the BIOS' job.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Reviewed-by: Avi Kivity <avi@redhat.com>
---
 hw/cirrus_vga.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index c7e365b..9724efe 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2784,10 +2784,6 @@ static void cirrus_reset(void *opaque)
     }
     s->vga.cr[0x27] = s->device_id;
 
-    /* Win2K seems to assume that the pattern buffer is at 0xff
-       initially ! */
-    memset(s->vga.vram_ptr, 0xff, s->real_vram_size);
-
     s->cirrus_hidden_dac_lockindex = 5;
     s->cirrus_hidden_dac_data = 0;
 }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:34 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4EM-0007qG-5J; Wed, 11 Apr 2012 20:33:30 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4EK-0007pn-Qx
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:28 +0000
Received: from [193.109.254.147:24342] by server-1.bemta-14.messagelabs.com id
	6A/BC-29372-79AE58F4; Wed, 11 Apr 2012 20:33:27 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334176405!1703256!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1684 invoked from network); 11 Apr 2012 20:33:26 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:26 -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 1SI4EH-0004JP-7H
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4EH-0001CV-2z
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:25 +0000
Date: Wed, 11 Apr 2012 20:33:25 +0000
Message-Id: <E1SI4EH-0001CV-2z@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] cirrus_vga: do not reset
	videoram
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 0ea2d40b85ca8af409492959d20c5504d0699bfe
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Jan 24 12:04:42 2012 +0000

    cirrus_vga: do not reset videoram
    
    There is no need to set the videoram to 0xff in cirrus_reset, because it
    is the BIOS' job.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Reviewed-by: Avi Kivity <avi@redhat.com>
---
 hw/cirrus_vga.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index c7e365b..9724efe 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2784,10 +2784,6 @@ static void cirrus_reset(void *opaque)
     }
     s->vga.cr[0x27] = s->device_id;
 
-    /* Win2K seems to assume that the pattern buffer is at 0xff
-       initially ! */
-    memset(s->vga.vram_ptr, 0xff, s->real_vram_size);
-
     s->cirrus_hidden_dac_lockindex = 5;
     s->cirrus_hidden_dac_data = 0;
 }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:45 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4EW-0007sC-8W; Wed, 11 Apr 2012 20:33:40 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4EU-0007ro-RT
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:39 +0000
Received: from [193.109.254.147:51125] by server-8.bemta-14.messagelabs.com id
	17/92-23244-2AAE58F4; Wed, 11 Apr 2012 20:33:38 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-27.messagelabs.com!1334176415!4193589!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.0 required=7.0 tests=BODY_RANDOMQ
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30970 invoked from network); 11 Apr 2012 20:33:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:36 -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 1SI4ER-0004JY-G1
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4ER-0001Cs-AX
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:35 +0000
Date: Wed, 11 Apr 2012 20:33:35 +0000
Message-Id: <E1SI4ER-0001Cs-AX@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Introduce
	"xen-save-devices-state"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 929dff3af59d8dd6f1e87f6894eb37b3c43fa6fd
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Wed Jan 25 12:24:51 2012 +0000

    Introduce "xen-save-devices-state"
    
    - add an "is_ram" flag to SaveStateEntry;
    
    - register_savevm_live sets is_ram for live_savevm devices;
    
    - introduce a "xen-save-devices-state" QAPI command that can be used to save
    the state of all devices, but not the RAM or the block devices of the
    VM.
    
    Changes in v8:
    
    - rename save-devices-state to xen-save-devices-state.
    
    Changes in v7:
    
    - rename save_devices to save-devices-state.
    
    Changes in v6:
    
    - remove the is_ram parameter from register_savevm_live and sets is_ram
    if the device is a live_savevm device;
    
    - introduce save_devices as a QAPI command, write a better description
    for it;
    
    - fix CODING_STYLE;
    
    - introduce a new doc to explain the save format used by save_devices.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
    Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 docs/xen-save-devices-state.txt |   34 ++++++++++++++++++
 qapi-schema.json                |   18 ++++++++++
 qmp-commands.hx                 |   27 +++++++++++++++
 savevm.c                        |   71 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 150 insertions(+), 0 deletions(-)

diff --git a/docs/xen-save-devices-state.txt b/docs/xen-save-devices-state.txt
new file mode 100644
index 0000000..92e08db
--- /dev/null
+++ b/docs/xen-save-devices-state.txt
@@ -0,0 +1,34 @@
+= Save Devices =
+
+QEMU has code to load/save the state of the guest that it is running.
+These are two complementary operations.  Saving the state just does
+that, saves the state for each device that the guest is running.
+
+These operations are normally used with migration (see migration.txt),
+however it is also possible to save the state of all devices to file,
+without saving the RAM or the block devices of the VM.
+
+This operation is called "xen-save-devices-state" (see
+QMP/qmp-commands.txt)
+
+
+The binary format used in the file is the following:
+
+
+-------------------------------------------
+
+32 bit big endian: QEMU_VM_FILE_MAGIC
+32 bit big endian: QEMU_VM_FILE_VERSION
+
+for_each_device
+{
+    8 bit:              QEMU_VM_SECTION_FULL
+    32 bit big endian:  section_id
+    8 bit:              idstr (ID string) length
+    string:             idstr (ID string)
+    32 bit big endian:  instance_id
+    32 bit big endian:  version_id
+    buffer:             device specific data
+}
+
+8 bit: QEMU_VM_EOF
diff --git a/qapi-schema.json b/qapi-schema.json
index cb1ba77..a669e98 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -887,3 +887,21 @@
 # Notes: Do not use this command.
 ##
 { 'command': 'cpu', 'data': {'index': 'int'} }
+
+##
+# @xen-save-devices-state:
+#
+# Save the state of all devices to file. The RAM and the block devices
+# of the VM are not saved by this command.
+#
+# @filename: the file to save the state of the devices to as binary
+# data. See xen-save-devices-state.txt for a description of the binary
+# format.
+#
+# Returns: Nothing on success
+#          If @filename cannot be opened, OpenFileFailed
+#          If an error occurs return QERR_UNDEFINED_ERROR
+#
+# Since: 1.1
+##
+{ 'command': 'xen-save-devices-state', 'data': {'filename': 'str'} }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 97975a5..bf1df49 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -445,6 +445,33 @@ Note: inject-nmi is only supported for x86 guest currently, it will
 EQMP
 
     {
+        .name       = "xen-save-devices-state",
+        .args_type  = "filename:F",
+    .mhandler.cmd_new = qmp_marshal_input_xen_save_devices_state,
+    },
+
+SQMP
+xen-save-devices-state
+-------
+
+Save the state of all devices to file. The RAM and the block devices
+of the VM are not saved by this command.
+
+Arguments:
+
+- "filename": the file to save the state of the devices to as binary
+data. See xen-save-devices-state.txt for a description of the binary
+format.
+
+Example:
+
+-> { "execute": "xen-save-devices-state",
+     "arguments": { "filename": "/tmp/save" } }
+<- { "return": {} }
+
+EQMP
+
+    {
         .name       = "migrate",
         .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
         .params     = "[-d] [-b] [-i] uri",
diff --git a/savevm.c b/savevm.c
index f53cd4c..4906f44 100644
--- a/savevm.c
+++ b/savevm.c
@@ -83,6 +83,7 @@
 #include "qemu-queue.h"
 #include "qemu-timer.h"
 #include "cpus.h"
+#include "qmp-commands.h"
 
 #define SELF_ANNOUNCE_ROUNDS 5
 
@@ -1125,6 +1126,7 @@ typedef struct SaveStateEntry {
     void *opaque;
     CompatEntry *compat;
     int no_migrate;
+    int is_ram;
 } SaveStateEntry;
 
 
@@ -1189,6 +1191,10 @@ int register_savevm_live(DeviceState *dev,
     se->opaque = opaque;
     se->vmsd = NULL;
     se->no_migrate = 0;
+    /* if this is a live_savem then set is_ram */
+    if (save_live_state != NULL) {
+        se->is_ram = 1;
+    }
 
     if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {
         char *id = dev->parent_bus->info->get_dev_path(dev);
@@ -1676,6 +1682,45 @@ out:
     return ret;
 }
 
+static int qemu_save_device_state(QEMUFile *f)
+{
+    SaveStateEntry *se;
+
+    qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
+    qemu_put_be32(f, QEMU_VM_FILE_VERSION);
+
+    cpu_synchronize_all_states();
+
+    QTAILQ_FOREACH(se, &savevm_handlers, entry) {
+        int len;
+
+        if (se->is_ram) {
+            continue;
+        }
+        if (se->save_state == NULL && se->vmsd == NULL) {
+            continue;
+        }
+
+        /* Section type */
+        qemu_put_byte(f, QEMU_VM_SECTION_FULL);
+        qemu_put_be32(f, se->section_id);
+
+        /* ID string */
+        len = strlen(se->idstr);
+        qemu_put_byte(f, len);
+        qemu_put_buffer(f, (uint8_t *)se->idstr, len);
+
+        qemu_put_be32(f, se->instance_id);
+        qemu_put_be32(f, se->version_id);
+
+        vmstate_save(f, se);
+    }
+
+    qemu_put_byte(f, QEMU_VM_EOF);
+
+    return qemu_file_get_error(f);
+}
+
 static SaveStateEntry *find_se(const char *idstr, int instance_id)
 {
     SaveStateEntry *se;
@@ -2057,6 +2102,32 @@ void do_savevm(Monitor *mon, const QDict *qdict)
         vm_start();
 }
 
+void qmp_xen_save_devices_state(const char *filename, Error **errp)
+{
+    QEMUFile *f;
+    int saved_vm_running;
+    int ret;
+
+    saved_vm_running = runstate_is_running();
+    vm_stop(RUN_STATE_SAVE_VM);
+
+    f = qemu_fopen(filename, "wb");
+    if (!f) {
+        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        goto the_end;
+    }
+    ret = qemu_save_device_state(f);
+    qemu_fclose(f);
+    if (ret < 0) {
+        error_set(errp, QERR_UNDEFINED_ERROR);
+    }
+
+ the_end:
+    if (saved_vm_running)
+        vm_start();
+    return;
+}
+
 int load_vmstate(const char *name)
 {
     BlockDriverState *bs, *bs_vm_state;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:45 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4EW-0007sC-8W; Wed, 11 Apr 2012 20:33:40 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4EU-0007ro-RT
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:39 +0000
Received: from [193.109.254.147:51125] by server-8.bemta-14.messagelabs.com id
	17/92-23244-2AAE58F4; Wed, 11 Apr 2012 20:33:38 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-27.messagelabs.com!1334176415!4193589!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=1.0 required=7.0 tests=BODY_RANDOMQ
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30970 invoked from network); 11 Apr 2012 20:33:36 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:36 -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 1SI4ER-0004JY-G1
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4ER-0001Cs-AX
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:35 +0000
Date: Wed, 11 Apr 2012 20:33:35 +0000
Message-Id: <E1SI4ER-0001Cs-AX@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Introduce
	"xen-save-devices-state"
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 929dff3af59d8dd6f1e87f6894eb37b3c43fa6fd
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Wed Jan 25 12:24:51 2012 +0000

    Introduce "xen-save-devices-state"
    
    - add an "is_ram" flag to SaveStateEntry;
    
    - register_savevm_live sets is_ram for live_savevm devices;
    
    - introduce a "xen-save-devices-state" QAPI command that can be used to save
    the state of all devices, but not the RAM or the block devices of the
    VM.
    
    Changes in v8:
    
    - rename save-devices-state to xen-save-devices-state.
    
    Changes in v7:
    
    - rename save_devices to save-devices-state.
    
    Changes in v6:
    
    - remove the is_ram parameter from register_savevm_live and sets is_ram
    if the device is a live_savevm device;
    
    - introduce save_devices as a QAPI command, write a better description
    for it;
    
    - fix CODING_STYLE;
    
    - introduce a new doc to explain the save format used by save_devices.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
    Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 docs/xen-save-devices-state.txt |   34 ++++++++++++++++++
 qapi-schema.json                |   18 ++++++++++
 qmp-commands.hx                 |   27 +++++++++++++++
 savevm.c                        |   71 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 150 insertions(+), 0 deletions(-)

diff --git a/docs/xen-save-devices-state.txt b/docs/xen-save-devices-state.txt
new file mode 100644
index 0000000..92e08db
--- /dev/null
+++ b/docs/xen-save-devices-state.txt
@@ -0,0 +1,34 @@
+= Save Devices =
+
+QEMU has code to load/save the state of the guest that it is running.
+These are two complementary operations.  Saving the state just does
+that, saves the state for each device that the guest is running.
+
+These operations are normally used with migration (see migration.txt),
+however it is also possible to save the state of all devices to file,
+without saving the RAM or the block devices of the VM.
+
+This operation is called "xen-save-devices-state" (see
+QMP/qmp-commands.txt)
+
+
+The binary format used in the file is the following:
+
+
+-------------------------------------------
+
+32 bit big endian: QEMU_VM_FILE_MAGIC
+32 bit big endian: QEMU_VM_FILE_VERSION
+
+for_each_device
+{
+    8 bit:              QEMU_VM_SECTION_FULL
+    32 bit big endian:  section_id
+    8 bit:              idstr (ID string) length
+    string:             idstr (ID string)
+    32 bit big endian:  instance_id
+    32 bit big endian:  version_id
+    buffer:             device specific data
+}
+
+8 bit: QEMU_VM_EOF
diff --git a/qapi-schema.json b/qapi-schema.json
index cb1ba77..a669e98 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -887,3 +887,21 @@
 # Notes: Do not use this command.
 ##
 { 'command': 'cpu', 'data': {'index': 'int'} }
+
+##
+# @xen-save-devices-state:
+#
+# Save the state of all devices to file. The RAM and the block devices
+# of the VM are not saved by this command.
+#
+# @filename: the file to save the state of the devices to as binary
+# data. See xen-save-devices-state.txt for a description of the binary
+# format.
+#
+# Returns: Nothing on success
+#          If @filename cannot be opened, OpenFileFailed
+#          If an error occurs return QERR_UNDEFINED_ERROR
+#
+# Since: 1.1
+##
+{ 'command': 'xen-save-devices-state', 'data': {'filename': 'str'} }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 97975a5..bf1df49 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -445,6 +445,33 @@ Note: inject-nmi is only supported for x86 guest currently, it will
 EQMP
 
     {
+        .name       = "xen-save-devices-state",
+        .args_type  = "filename:F",
+    .mhandler.cmd_new = qmp_marshal_input_xen_save_devices_state,
+    },
+
+SQMP
+xen-save-devices-state
+-------
+
+Save the state of all devices to file. The RAM and the block devices
+of the VM are not saved by this command.
+
+Arguments:
+
+- "filename": the file to save the state of the devices to as binary
+data. See xen-save-devices-state.txt for a description of the binary
+format.
+
+Example:
+
+-> { "execute": "xen-save-devices-state",
+     "arguments": { "filename": "/tmp/save" } }
+<- { "return": {} }
+
+EQMP
+
+    {
         .name       = "migrate",
         .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
         .params     = "[-d] [-b] [-i] uri",
diff --git a/savevm.c b/savevm.c
index f53cd4c..4906f44 100644
--- a/savevm.c
+++ b/savevm.c
@@ -83,6 +83,7 @@
 #include "qemu-queue.h"
 #include "qemu-timer.h"
 #include "cpus.h"
+#include "qmp-commands.h"
 
 #define SELF_ANNOUNCE_ROUNDS 5
 
@@ -1125,6 +1126,7 @@ typedef struct SaveStateEntry {
     void *opaque;
     CompatEntry *compat;
     int no_migrate;
+    int is_ram;
 } SaveStateEntry;
 
 
@@ -1189,6 +1191,10 @@ int register_savevm_live(DeviceState *dev,
     se->opaque = opaque;
     se->vmsd = NULL;
     se->no_migrate = 0;
+    /* if this is a live_savem then set is_ram */
+    if (save_live_state != NULL) {
+        se->is_ram = 1;
+    }
 
     if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {
         char *id = dev->parent_bus->info->get_dev_path(dev);
@@ -1676,6 +1682,45 @@ out:
     return ret;
 }
 
+static int qemu_save_device_state(QEMUFile *f)
+{
+    SaveStateEntry *se;
+
+    qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
+    qemu_put_be32(f, QEMU_VM_FILE_VERSION);
+
+    cpu_synchronize_all_states();
+
+    QTAILQ_FOREACH(se, &savevm_handlers, entry) {
+        int len;
+
+        if (se->is_ram) {
+            continue;
+        }
+        if (se->save_state == NULL && se->vmsd == NULL) {
+            continue;
+        }
+
+        /* Section type */
+        qemu_put_byte(f, QEMU_VM_SECTION_FULL);
+        qemu_put_be32(f, se->section_id);
+
+        /* ID string */
+        len = strlen(se->idstr);
+        qemu_put_byte(f, len);
+        qemu_put_buffer(f, (uint8_t *)se->idstr, len);
+
+        qemu_put_be32(f, se->instance_id);
+        qemu_put_be32(f, se->version_id);
+
+        vmstate_save(f, se);
+    }
+
+    qemu_put_byte(f, QEMU_VM_EOF);
+
+    return qemu_file_get_error(f);
+}
+
 static SaveStateEntry *find_se(const char *idstr, int instance_id)
 {
     SaveStateEntry *se;
@@ -2057,6 +2102,32 @@ void do_savevm(Monitor *mon, const QDict *qdict)
         vm_start();
 }
 
+void qmp_xen_save_devices_state(const char *filename, Error **errp)
+{
+    QEMUFile *f;
+    int saved_vm_running;
+    int ret;
+
+    saved_vm_running = runstate_is_running();
+    vm_stop(RUN_STATE_SAVE_VM);
+
+    f = qemu_fopen(filename, "wb");
+    if (!f) {
+        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
+        goto the_end;
+    }
+    ret = qemu_save_device_state(f);
+    qemu_fclose(f);
+    if (ret < 0) {
+        error_set(errp, QERR_UNDEFINED_ERROR);
+    }
+
+ the_end:
+    if (saved_vm_running)
+        vm_start();
+    return;
+}
+
 int load_vmstate(const char *name)
 {
     BlockDriverState *bs, *bs_vm_state;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4Eg-0007u6-BU; Wed, 11 Apr 2012 20:33:50 +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 1SI4Ee-0007tg-TQ
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:49 +0000
Received: from [85.158.143.35:27000] by server-2.bemta-4.messagelabs.com id
	5A/9E-17550-CAAE58F4; Wed, 11 Apr 2012 20:33:48 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-16.tower-21.messagelabs.com!1334176426!8411875!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23688 invoked from network); 11 Apr 2012 20:33:47 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:47 -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 1SI4Eb-0004Je-Qn
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Eb-0001DH-Je
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:45 +0000
Date: Wed, 11 Apr 2012 20:33:45 +0000
Message-Id: <E1SI4Eb-0001DH-Je@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Set runstate to INMIGRATE
	earlier
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit cc85b5da60cfd2408be457d6e65088ab8ae44318
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Wed Jan 18 12:23:13 2012 +0000

    Set runstate to INMIGRATE earlier
    
    Set runstate to RUN_STATE_INMIGRATE as soon as we can on resume.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vl.c b/vl.c
index a50842b..ed81c2c 100644
--- a/vl.c
+++ b/vl.c
@@ -2976,6 +2976,7 @@ int main(int argc, char **argv, char **envp)
                 break;
             case QEMU_OPTION_incoming:
                 incoming = optarg;
+                runstate_set(RUN_STATE_INMIGRATE);
                 break;
             case QEMU_OPTION_nodefaults:
                 default_serial = 0;
@@ -3468,7 +3469,6 @@ int main(int argc, char **argv, char **envp)
     }
 
     if (incoming) {
-        runstate_set(RUN_STATE_INMIGRATE);
         int ret = qemu_start_incoming_migration(incoming);
         if (ret < 0) {
             fprintf(stderr, "Migration failed. Exit code %s(%d), exiting.\n",
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:33:53 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4Eg-0007u6-BU; Wed, 11 Apr 2012 20:33:50 +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 1SI4Ee-0007tg-TQ
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:49 +0000
Received: from [85.158.143.35:27000] by server-2.bemta-4.messagelabs.com id
	5A/9E-17550-CAAE58F4; Wed, 11 Apr 2012 20:33:48 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-16.tower-21.messagelabs.com!1334176426!8411875!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23688 invoked from network); 11 Apr 2012 20:33:47 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:33:47 -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 1SI4Eb-0004Je-Qn
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Eb-0001DH-Je
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:45 +0000
Date: Wed, 11 Apr 2012 20:33:45 +0000
Message-Id: <E1SI4Eb-0001DH-Je@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Set runstate to INMIGRATE
	earlier
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit cc85b5da60cfd2408be457d6e65088ab8ae44318
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Wed Jan 18 12:23:13 2012 +0000

    Set runstate to INMIGRATE earlier
    
    Set runstate to RUN_STATE_INMIGRATE as soon as we can on resume.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vl.c b/vl.c
index a50842b..ed81c2c 100644
--- a/vl.c
+++ b/vl.c
@@ -2976,6 +2976,7 @@ int main(int argc, char **argv, char **envp)
                 break;
             case QEMU_OPTION_incoming:
                 incoming = optarg;
+                runstate_set(RUN_STATE_INMIGRATE);
                 break;
             case QEMU_OPTION_nodefaults:
                 default_serial = 0;
@@ -3468,7 +3469,6 @@ int main(int argc, char **argv, char **envp)
     }
 
     if (incoming) {
-        runstate_set(RUN_STATE_INMIGRATE);
         int ret = qemu_start_incoming_migration(incoming);
         if (ret < 0) {
             fprintf(stderr, "Migration failed. Exit code %s(%d), exiting.\n",
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:34:02 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:34:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4Eq-0007w4-Ea; Wed, 11 Apr 2012 20:34:00 +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 1SI4Ep-0007vo-Ak
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:59 +0000
Received: from [85.158.139.83:41507] by server-4.bemta-5.messagelabs.com id
	03/17-10788-6BAE58F4; Wed, 11 Apr 2012 20:33:58 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-15.tower-182.messagelabs.com!1334176436!23317702!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1231 invoked from network); 11 Apr 2012 20:33:57 -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;
	11 Apr 2012 20:33:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Em-0004Jn-BC
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:56 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4El-0001Dd-UG
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:55 +0000
Date: Wed, 11 Apr 2012 20:33:55 +0000
Message-Id: <E1SI4El-0001Dd-UG@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: record physmap
	changes to xenstore
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 2fc024d0746bddec0d5af4a2ea05cece613c817c
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Thu Jan 19 15:56:11 2012 +0000

    xen: record physmap changes to xenstore
    
    Write to xenstore any physmap changes so that the hypervisor can be
    aware of them.
    Read physmap changes from xenstore on boot.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index b5e28ab..4d50270 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -59,6 +59,7 @@ static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu)
 typedef struct XenPhysmap {
     target_phys_addr_t start_addr;
     ram_addr_t size;
+    char *name;
     target_phys_addr_t phys_offset;
 
     QLIST_ENTRY(XenPhysmap) list;
@@ -229,6 +230,7 @@ static int xen_add_to_physmap(XenIOState *state,
     XenPhysmap *physmap = NULL;
     target_phys_addr_t pfn, start_gpfn;
     RAMBlock *block;
+    char path[80], value[17];
 
     if (get_physmapping(state, start_addr, size)) {
         return 0;
@@ -271,6 +273,7 @@ go_physmap:
 
     physmap->start_addr = start_addr;
     physmap->size = size;
+    physmap->name = block->idstr;
     physmap->phys_offset = phys_offset;
 
     QLIST_INSERT_HEAD(&state->physmap, physmap, list);
@@ -279,6 +282,30 @@ go_physmap:
                                    start_addr >> TARGET_PAGE_BITS,
                                    (start_addr + size) >> TARGET_PAGE_BITS,
                                    XEN_DOMCTL_MEM_CACHEATTR_WB);
+
+    snprintf(path, sizeof(path),
+            "/local/domain/0/device-model/%d/physmap/%"PRIx64"/start_addr",
+            xen_domid, (uint64_t)phys_offset);
+    snprintf(value, sizeof(value), "%"PRIx64, (uint64_t)start_addr);
+    if (!xs_write(state->xenstore, 0, path, value, strlen(value))) {
+        return -1;
+    }
+    snprintf(path, sizeof(path),
+            "/local/domain/0/device-model/%d/physmap/%"PRIx64"/size",
+            xen_domid, (uint64_t)phys_offset);
+    snprintf(value, sizeof(value), "%"PRIx64, (uint64_t)size);
+    if (!xs_write(state->xenstore, 0, path, value, strlen(value))) {
+        return -1;
+    }
+    if (block->idstr) {
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%"PRIx64"/name",
+                xen_domid, (uint64_t)phys_offset);
+        if (!xs_write(state->xenstore, 0, path, block->idstr, strlen(block->idstr))) {
+            return -1;
+        }
+    }
+
     return 0;
 }
 
@@ -884,6 +911,55 @@ int xen_init(void)
     return 0;
 }
 
+static void xen_read_physmap(XenIOState *state)
+{
+    XenPhysmap *physmap = NULL;
+    unsigned int len, num, i;
+    char path[80], *value = NULL;
+    char **entries = NULL;
+
+    snprintf(path, sizeof(path),
+            "/local/domain/0/device-model/%d/physmap", xen_domid);
+    entries = xs_directory(state->xenstore, 0, path, &num);
+    if (entries == NULL)
+        return;
+
+    for (i = 0; i < num; i++) {
+        physmap = g_malloc(sizeof (XenPhysmap));
+        physmap->phys_offset = strtoull(entries[i], NULL, 16);
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%s/start_addr",
+                xen_domid, entries[i]);
+        value = xs_read(state->xenstore, 0, path, &len);
+        if (value == NULL) {
+            free(physmap);
+            continue;
+        }
+        physmap->start_addr = strtoull(value, NULL, 16);
+        free(value);
+
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%s/size",
+                xen_domid, entries[i]);
+        value = xs_read(state->xenstore, 0, path, &len);
+        if (value == NULL) {
+            free(physmap);
+            continue;
+        }
+        physmap->size = strtoull(value, NULL, 16);
+        free(value);
+
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%s/name",
+                xen_domid, entries[i]);
+        physmap->name = xs_read(state->xenstore, 0, path, &len);
+
+        QLIST_INSERT_HEAD(&state->physmap, physmap, list);
+    }
+    free(entries);
+    return;
+}
+
 int xen_hvm_init(void)
 {
     int i, rc;
@@ -956,6 +1032,7 @@ int xen_hvm_init(void)
     xen_be_register("console", &xen_console_ops);
     xen_be_register("vkbd", &xen_kbdmouse_ops);
     xen_be_register("qdisk", &xen_blkdev_ops);
+    xen_read_physmap(state);
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:34:02 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:34:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4Eq-0007w4-Ea; Wed, 11 Apr 2012 20:34:00 +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 1SI4Ep-0007vo-Ak
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:59 +0000
Received: from [85.158.139.83:41507] by server-4.bemta-5.messagelabs.com id
	03/17-10788-6BAE58F4; Wed, 11 Apr 2012 20:33:58 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-15.tower-182.messagelabs.com!1334176436!23317702!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1231 invoked from network); 11 Apr 2012 20:33:57 -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;
	11 Apr 2012 20:33:57 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Em-0004Jn-BC
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:56 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4El-0001Dd-UG
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:33:55 +0000
Date: Wed, 11 Apr 2012 20:33:55 +0000
Message-Id: <E1SI4El-0001Dd-UG@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: record physmap
	changes to xenstore
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 2fc024d0746bddec0d5af4a2ea05cece613c817c
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Thu Jan 19 15:56:11 2012 +0000

    xen: record physmap changes to xenstore
    
    Write to xenstore any physmap changes so that the hypervisor can be
    aware of them.
    Read physmap changes from xenstore on boot.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index b5e28ab..4d50270 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -59,6 +59,7 @@ static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu)
 typedef struct XenPhysmap {
     target_phys_addr_t start_addr;
     ram_addr_t size;
+    char *name;
     target_phys_addr_t phys_offset;
 
     QLIST_ENTRY(XenPhysmap) list;
@@ -229,6 +230,7 @@ static int xen_add_to_physmap(XenIOState *state,
     XenPhysmap *physmap = NULL;
     target_phys_addr_t pfn, start_gpfn;
     RAMBlock *block;
+    char path[80], value[17];
 
     if (get_physmapping(state, start_addr, size)) {
         return 0;
@@ -271,6 +273,7 @@ go_physmap:
 
     physmap->start_addr = start_addr;
     physmap->size = size;
+    physmap->name = block->idstr;
     physmap->phys_offset = phys_offset;
 
     QLIST_INSERT_HEAD(&state->physmap, physmap, list);
@@ -279,6 +282,30 @@ go_physmap:
                                    start_addr >> TARGET_PAGE_BITS,
                                    (start_addr + size) >> TARGET_PAGE_BITS,
                                    XEN_DOMCTL_MEM_CACHEATTR_WB);
+
+    snprintf(path, sizeof(path),
+            "/local/domain/0/device-model/%d/physmap/%"PRIx64"/start_addr",
+            xen_domid, (uint64_t)phys_offset);
+    snprintf(value, sizeof(value), "%"PRIx64, (uint64_t)start_addr);
+    if (!xs_write(state->xenstore, 0, path, value, strlen(value))) {
+        return -1;
+    }
+    snprintf(path, sizeof(path),
+            "/local/domain/0/device-model/%d/physmap/%"PRIx64"/size",
+            xen_domid, (uint64_t)phys_offset);
+    snprintf(value, sizeof(value), "%"PRIx64, (uint64_t)size);
+    if (!xs_write(state->xenstore, 0, path, value, strlen(value))) {
+        return -1;
+    }
+    if (block->idstr) {
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%"PRIx64"/name",
+                xen_domid, (uint64_t)phys_offset);
+        if (!xs_write(state->xenstore, 0, path, block->idstr, strlen(block->idstr))) {
+            return -1;
+        }
+    }
+
     return 0;
 }
 
@@ -884,6 +911,55 @@ int xen_init(void)
     return 0;
 }
 
+static void xen_read_physmap(XenIOState *state)
+{
+    XenPhysmap *physmap = NULL;
+    unsigned int len, num, i;
+    char path[80], *value = NULL;
+    char **entries = NULL;
+
+    snprintf(path, sizeof(path),
+            "/local/domain/0/device-model/%d/physmap", xen_domid);
+    entries = xs_directory(state->xenstore, 0, path, &num);
+    if (entries == NULL)
+        return;
+
+    for (i = 0; i < num; i++) {
+        physmap = g_malloc(sizeof (XenPhysmap));
+        physmap->phys_offset = strtoull(entries[i], NULL, 16);
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%s/start_addr",
+                xen_domid, entries[i]);
+        value = xs_read(state->xenstore, 0, path, &len);
+        if (value == NULL) {
+            free(physmap);
+            continue;
+        }
+        physmap->start_addr = strtoull(value, NULL, 16);
+        free(value);
+
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%s/size",
+                xen_domid, entries[i]);
+        value = xs_read(state->xenstore, 0, path, &len);
+        if (value == NULL) {
+            free(physmap);
+            continue;
+        }
+        physmap->size = strtoull(value, NULL, 16);
+        free(value);
+
+        snprintf(path, sizeof(path),
+                "/local/domain/0/device-model/%d/physmap/%s/name",
+                xen_domid, entries[i]);
+        physmap->name = xs_read(state->xenstore, 0, path, &len);
+
+        QLIST_INSERT_HEAD(&state->physmap, physmap, list);
+    }
+    free(entries);
+    return;
+}
+
 int xen_hvm_init(void)
 {
     int i, rc;
@@ -956,6 +1032,7 @@ int xen_hvm_init(void)
     xen_be_register("console", &xen_console_ops);
     xen_be_register("vkbd", &xen_kbdmouse_ops);
     xen_be_register("qdisk", &xen_blkdev_ops);
+    xen_read_physmap(state);
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:34:12 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:34:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4F0-0007y3-HZ; Wed, 11 Apr 2012 20:34:10 +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 1SI4Ez-0007xj-G1
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:09 +0000
Received: from [85.158.143.99:8506] by server-2.bemta-4.messagelabs.com id
	2E/BE-17550-0CAE58F4; Wed, 11 Apr 2012 20:34:08 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334176446!22932058!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22617 invoked from network); 11 Apr 2012 20:34:07 -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;
	11 Apr 2012 20:34:07 -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 1SI4Ew-0004KN-GY
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:06 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Ew-0001Ed-FM
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:06 +0000
Date: Wed, 11 Apr 2012 20:34:06 +0000
Message-Id: <E1SI4Ew-0001Ed-FM@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen mapcache: check if
	memory region has moved.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 71c854db03ff7b6f837fc69b6e5c56783ca9e2b9
Author: Anthony PERARD <anthony.perard@citrix.com>
Date:   Wed Jan 18 12:21:38 2012 +0000

    xen mapcache: check if memory region has moved.
    
    This patch changes the xen_map_cache behavior. Before trying to map a guest
    addr, mapcache will look into the list of range of address that have been moved
    (physmap/set_memory). There is currently one memory space like this, the vram,
    "moved" from were it's allocated to were the guest will look into.
    
    This help to have a succefull migration.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c      |   18 +++++++++++++++++-
 xen-mapcache.c |   22 +++++++++++++++++++---
 xen-mapcache.h |    9 +++++++--
 3 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 4d50270..6293fbb 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -219,6 +219,22 @@ static XenPhysmap *get_physmapping(XenIOState *state,
     return NULL;
 }
 
+static target_phys_addr_t xen_phys_offset_to_gaddr(target_phys_addr_t start_addr,
+                                                   ram_addr_t size, void *opaque)
+{
+    target_phys_addr_t addr = start_addr & TARGET_PAGE_MASK;
+    XenIOState *xen_io_state = opaque;
+    XenPhysmap *physmap = NULL;
+
+    QLIST_FOREACH(physmap, &xen_io_state->physmap, list) {
+        if (range_covers_byte(physmap->phys_offset, physmap->size, addr)) {
+            return physmap->start_addr;
+        }
+    }
+
+    return start_addr;
+}
+
 #if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 340
 static int xen_add_to_physmap(XenIOState *state,
                               target_phys_addr_t start_addr,
@@ -1014,7 +1030,7 @@ int xen_hvm_init(void)
     }
 
     /* Init RAM management */
-    xen_map_cache_init();
+    xen_map_cache_init(xen_phys_offset_to_gaddr, state);
     xen_ram_init(ram_size);
 
     qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
diff --git a/xen-mapcache.c b/xen-mapcache.c
index 7bcb86e..d5f52b2 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -76,6 +76,9 @@ typedef struct MapCache {
     uint8_t *last_address_vaddr;
     unsigned long max_mcache_size;
     unsigned int mcache_bucket_shift;
+
+    phys_offset_to_gaddr_t phys_offset_to_gaddr;
+    void *opaque;
 } MapCache;
 
 static MapCache *mapcache;
@@ -89,13 +92,16 @@ static inline int test_bits(int nr, int size, const unsigned long *addr)
         return 0;
 }
 
-void xen_map_cache_init(void)
+void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque)
 {
     unsigned long size;
     struct rlimit rlimit_as;
 
     mapcache = g_malloc0(sizeof (MapCache));
 
+    mapcache->phys_offset_to_gaddr = f;
+    mapcache->opaque = opaque;
+
     QTAILQ_INIT(&mapcache->locked_entries);
     mapcache->last_address_index = -1;
 
@@ -191,9 +197,14 @@ uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
                        uint8_t lock)
 {
     MapCacheEntry *entry, *pentry = NULL;
-    target_phys_addr_t address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
-    target_phys_addr_t address_offset = phys_addr & (MCACHE_BUCKET_SIZE - 1);
+    target_phys_addr_t address_index;
+    target_phys_addr_t address_offset;
     target_phys_addr_t __size = size;
+    bool translated = false;
+
+tryagain:
+    address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
+    address_offset = phys_addr & (MCACHE_BUCKET_SIZE - 1);
 
     trace_xen_map_cache(phys_addr);
 
@@ -235,6 +246,11 @@ uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
     if(!test_bits(address_offset >> XC_PAGE_SHIFT, size >> XC_PAGE_SHIFT,
                 entry->valid_mapping)) {
         mapcache->last_address_index = -1;
+        if (!translated && mapcache->phys_offset_to_gaddr) {
+            phys_addr = mapcache->phys_offset_to_gaddr(phys_addr, size, mapcache->opaque);
+            translated = true;
+            goto tryagain;
+        }
         trace_xen_map_cache_return(NULL);
         return NULL;
     }
diff --git a/xen-mapcache.h b/xen-mapcache.h
index da874ca..70301a5 100644
--- a/xen-mapcache.h
+++ b/xen-mapcache.h
@@ -11,9 +11,13 @@
 
 #include <stdlib.h>
 
+typedef target_phys_addr_t (*phys_offset_to_gaddr_t)(target_phys_addr_t start_addr,
+                                                     ram_addr_t size,
+                                                     void *opaque);
 #ifdef CONFIG_XEN
 
-void xen_map_cache_init(void);
+void xen_map_cache_init(phys_offset_to_gaddr_t f,
+                        void *opaque);
 uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
                        uint8_t lock);
 ram_addr_t xen_ram_addr_from_mapcache(void *ptr);
@@ -22,7 +26,8 @@ void xen_invalidate_map_cache(void);
 
 #else
 
-static inline void xen_map_cache_init(void)
+static inline void xen_map_cache_init(phys_offset_to_gaddr_t f,
+                                      void *opaque)
 {
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:34:12 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:34:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SI4F0-0007y3-HZ; Wed, 11 Apr 2012 20:34:10 +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 1SI4Ez-0007xj-G1
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:09 +0000
Received: from [85.158.143.99:8506] by server-2.bemta-4.messagelabs.com id
	2E/BE-17550-0CAE58F4; Wed, 11 Apr 2012 20:34:08 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334176446!22932058!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22617 invoked from network); 11 Apr 2012 20:34:07 -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;
	11 Apr 2012 20:34:07 -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 1SI4Ew-0004KN-GY
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:06 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4Ew-0001Ed-FM
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:06 +0000
Date: Wed, 11 Apr 2012 20:34:06 +0000
Message-Id: <E1SI4Ew-0001Ed-FM@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen mapcache: check if
	memory region has moved.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 71c854db03ff7b6f837fc69b6e5c56783ca9e2b9
Author: Anthony PERARD <anthony.perard@citrix.com>
Date:   Wed Jan 18 12:21:38 2012 +0000

    xen mapcache: check if memory region has moved.
    
    This patch changes the xen_map_cache behavior. Before trying to map a guest
    addr, mapcache will look into the list of range of address that have been moved
    (physmap/set_memory). There is currently one memory space like this, the vram,
    "moved" from were it's allocated to were the guest will look into.
    
    This help to have a succefull migration.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c      |   18 +++++++++++++++++-
 xen-mapcache.c |   22 +++++++++++++++++++---
 xen-mapcache.h |    9 +++++++--
 3 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 4d50270..6293fbb 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -219,6 +219,22 @@ static XenPhysmap *get_physmapping(XenIOState *state,
     return NULL;
 }
 
+static target_phys_addr_t xen_phys_offset_to_gaddr(target_phys_addr_t start_addr,
+                                                   ram_addr_t size, void *opaque)
+{
+    target_phys_addr_t addr = start_addr & TARGET_PAGE_MASK;
+    XenIOState *xen_io_state = opaque;
+    XenPhysmap *physmap = NULL;
+
+    QLIST_FOREACH(physmap, &xen_io_state->physmap, list) {
+        if (range_covers_byte(physmap->phys_offset, physmap->size, addr)) {
+            return physmap->start_addr;
+        }
+    }
+
+    return start_addr;
+}
+
 #if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 340
 static int xen_add_to_physmap(XenIOState *state,
                               target_phys_addr_t start_addr,
@@ -1014,7 +1030,7 @@ int xen_hvm_init(void)
     }
 
     /* Init RAM management */
-    xen_map_cache_init();
+    xen_map_cache_init(xen_phys_offset_to_gaddr, state);
     xen_ram_init(ram_size);
 
     qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);
diff --git a/xen-mapcache.c b/xen-mapcache.c
index 7bcb86e..d5f52b2 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -76,6 +76,9 @@ typedef struct MapCache {
     uint8_t *last_address_vaddr;
     unsigned long max_mcache_size;
     unsigned int mcache_bucket_shift;
+
+    phys_offset_to_gaddr_t phys_offset_to_gaddr;
+    void *opaque;
 } MapCache;
 
 static MapCache *mapcache;
@@ -89,13 +92,16 @@ static inline int test_bits(int nr, int size, const unsigned long *addr)
         return 0;
 }
 
-void xen_map_cache_init(void)
+void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque)
 {
     unsigned long size;
     struct rlimit rlimit_as;
 
     mapcache = g_malloc0(sizeof (MapCache));
 
+    mapcache->phys_offset_to_gaddr = f;
+    mapcache->opaque = opaque;
+
     QTAILQ_INIT(&mapcache->locked_entries);
     mapcache->last_address_index = -1;
 
@@ -191,9 +197,14 @@ uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
                        uint8_t lock)
 {
     MapCacheEntry *entry, *pentry = NULL;
-    target_phys_addr_t address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
-    target_phys_addr_t address_offset = phys_addr & (MCACHE_BUCKET_SIZE - 1);
+    target_phys_addr_t address_index;
+    target_phys_addr_t address_offset;
     target_phys_addr_t __size = size;
+    bool translated = false;
+
+tryagain:
+    address_index  = phys_addr >> MCACHE_BUCKET_SHIFT;
+    address_offset = phys_addr & (MCACHE_BUCKET_SIZE - 1);
 
     trace_xen_map_cache(phys_addr);
 
@@ -235,6 +246,11 @@ uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
     if(!test_bits(address_offset >> XC_PAGE_SHIFT, size >> XC_PAGE_SHIFT,
                 entry->valid_mapping)) {
         mapcache->last_address_index = -1;
+        if (!translated && mapcache->phys_offset_to_gaddr) {
+            phys_addr = mapcache->phys_offset_to_gaddr(phys_addr, size, mapcache->opaque);
+            translated = true;
+            goto tryagain;
+        }
         trace_xen_map_cache_return(NULL);
         return NULL;
     }
diff --git a/xen-mapcache.h b/xen-mapcache.h
index da874ca..70301a5 100644
--- a/xen-mapcache.h
+++ b/xen-mapcache.h
@@ -11,9 +11,13 @@
 
 #include <stdlib.h>
 
+typedef target_phys_addr_t (*phys_offset_to_gaddr_t)(target_phys_addr_t start_addr,
+                                                     ram_addr_t size,
+                                                     void *opaque);
 #ifdef CONFIG_XEN
 
-void xen_map_cache_init(void);
+void xen_map_cache_init(phys_offset_to_gaddr_t f,
+                        void *opaque);
 uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size,
                        uint8_t lock);
 ram_addr_t xen_ram_addr_from_mapcache(void *ptr);
@@ -22,7 +26,8 @@ void xen_invalidate_map_cache(void);
 
 #else
 
-static inline void xen_map_cache_init(void)
+static inline void xen_map_cache_init(phys_offset_to_gaddr_t f,
+                                      void *opaque)
 {
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:34:36 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:34: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 1SI4FO-00082Z-Mn; Wed, 11 Apr 2012 20:34:34 +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 1SI4FN-000825-0m
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:33 +0000
Received: from [85.158.143.35:17175] by server-1.bemta-4.messagelabs.com id
	03/85-20925-8DAE58F4; Wed, 11 Apr 2012 20:34:32 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-6.tower-21.messagelabs.com!1334176456!10917684!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28512 invoked from network); 11 Apr 2012 20:34:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:34: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 1SI4F6-0004KS-Kw
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4F6-0001F2-Jq
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:16 +0000
Date: Wed, 11 Apr 2012 20:34:16 +0000
Message-Id: <E1SI4F6-0001F2-Jq@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: do not allocate RAM
	during INMIGRATE runstate
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit e1615984e765751b430f86be679c0b74b5d5cd15
Author: Anthony PERARD <anthony.perard@citrix.com>
Date:   Wed Jan 25 12:36:06 2012 +0000

    xen: do not allocate RAM during INMIGRATE runstate
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 6293fbb..8d12915 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -188,6 +188,14 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size)
     xen_pfn_t *pfn_list;
     int i;
 
+    if (runstate_check(RUN_STATE_INMIGRATE)) {
+        /* RAM already populated in Xen */
+        fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT
+                " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRATE\n",
+                __func__, size, ram_addr); 
+        return;
+    }
+
     trace_xen_ram_alloc(ram_addr, size);
 
     nr_pfn = size >> TARGET_PAGE_BITS;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:34:36 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:34: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 1SI4FO-00082Z-Mn; Wed, 11 Apr 2012 20:34:34 +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 1SI4FN-000825-0m
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:33 +0000
Received: from [85.158.143.35:17175] by server-1.bemta-4.messagelabs.com id
	03/85-20925-8DAE58F4; Wed, 11 Apr 2012 20:34:32 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-6.tower-21.messagelabs.com!1334176456!10917684!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28512 invoked from network); 11 Apr 2012 20:34:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Apr 2012 20:34: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 1SI4F6-0004KS-Kw
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SI4F6-0001F2-Jq
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:34:16 +0000
Date: Wed, 11 Apr 2012 20:34:16 +0000
Message-Id: <E1SI4F6-0001F2-Jq@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: do not allocate RAM
	during INMIGRATE runstate
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit e1615984e765751b430f86be679c0b74b5d5cd15
Author: Anthony PERARD <anthony.perard@citrix.com>
Date:   Wed Jan 25 12:36:06 2012 +0000

    xen: do not allocate RAM during INMIGRATE runstate
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 6293fbb..8d12915 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -188,6 +188,14 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size)
     xen_pfn_t *pfn_list;
     int i;
 
+    if (runstate_check(RUN_STATE_INMIGRATE)) {
+        /* RAM already populated in Xen */
+        fprintf(stderr, "%s: do not alloc "RAM_ADDR_FMT
+                " bytes of ram at "RAM_ADDR_FMT" when runstate is INMIGRATE\n",
+                __func__, size, ram_addr); 
+        return;
+    }
+
     trace_xen_ram_alloc(ram_addr, size);
 
     nr_pfn = size >> TARGET_PAGE_BITS;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:44:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:44: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 1SI4Oi-0008MM-WC; Wed, 11 Apr 2012 20:44: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 1SI4Oh-0008M1-5s
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:11 +0000
Received: from [85.158.143.35:49450] by server-3.bemta-4.messagelabs.com id
	8C/1C-05853-A1DE58F4; Wed, 11 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1334177048!6655062!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18763 invoked from network); 11 Apr 2012 20:44:09 -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;
	11 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0004Qq-OG
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0001Wh-N6
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Message-Id: <E1SI4Oe-0001Wh-N6@xenbits.xen.org>
Date: Wed, 11 Apr 2012 20:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen,
	cpupools: Fix cpupool-move to make more consistent
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334050955 -3600
# Node ID 5bbda657a0160d3eec024bef2e7a59f199e84b10
# Parent  b2a467527d68b0b021038a8f714b69974e37ca6c
xen, cpupools: Fix cpupool-move to make more consistent

The full order for creating new private data structures when moving
from one pool to another is now:
* Allocate all new structures
 - Allocate a new private domain structure (but don't point there yet)
 - Allocate per-vcpu data structures (but don't point there yet)
* Remove old structures
 - Remove each vcpu, freeing the associated data structure
 - Free the domain data structure
* Switch to the new structures
 - Set the domain to the new cpupool, with the new private domain
 structure
 - Set each vcpu to the respective new structure, and insert

This is in line with a (fairly reasonable) assumption in credit2 that
the private structure of the domain will be the private structure
pointed to by the per-vcpu private structure.

Also fix a bug, in which insert_vcpu was called with the *old* vcpu
ops rather than the new ones.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r b2a467527d68 -r 5bbda657a016 xen/common/schedule.c
--- a/xen/common/schedule.c	Tue Apr 10 10:41:55 2012 +0100
+++ b/xen/common/schedule.c	Tue Apr 10 10:42:35 2012 +0100
@@ -261,6 +261,18 @@ int sched_move_domain(struct domain *d, 
 
     domain_pause(d);
 
+    for_each_vcpu ( d, v )
+    {
+        SCHED_OP(VCPU2OP(v), remove_vcpu, v);
+        SCHED_OP(VCPU2OP(v), free_vdata, v->sched_priv);
+        v->sched_priv = NULL;
+    }
+
+    SCHED_OP(DOM2OP(d), free_domdata, d->sched_priv);
+
+    d->cpupool = c;
+    d->sched_priv = domdata;
+
     new_p = cpumask_first(c->cpu_valid);
     for_each_vcpu ( d, v )
     {
@@ -268,9 +280,6 @@ int sched_move_domain(struct domain *d, 
         migrate_timer(&v->singleshot_timer, new_p);
         migrate_timer(&v->poll_timer, new_p);
 
-        SCHED_OP(VCPU2OP(v), remove_vcpu, v);
-        SCHED_OP(VCPU2OP(v), free_vdata, v->sched_priv);
-
         cpumask_setall(v->cpu_affinity);
         v->processor = new_p;
         v->sched_priv = vcpu_priv[v->vcpu_id];
@@ -278,13 +287,9 @@ int sched_move_domain(struct domain *d, 
 
         new_p = cpumask_cycle(new_p, c->cpu_valid);
 
-        SCHED_OP(VCPU2OP(v), insert_vcpu, v);
+        SCHED_OP(c->sched, insert_vcpu, v);
     }
 
-    d->cpupool = c;
-    SCHED_OP(DOM2OP(d), free_domdata, d->sched_priv);
-    d->sched_priv = domdata;
-
     domain_update_node_affinity(d);
 
     domain_unpause(d);

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:44:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:44: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 1SI4Oi-0008MM-WC; Wed, 11 Apr 2012 20:44: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 1SI4Oh-0008M1-5s
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:11 +0000
Received: from [85.158.143.35:49450] by server-3.bemta-4.messagelabs.com id
	8C/1C-05853-A1DE58F4; Wed, 11 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1334177048!6655062!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18763 invoked from network); 11 Apr 2012 20:44:09 -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;
	11 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0004Qq-OG
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0001Wh-N6
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Message-Id: <E1SI4Oe-0001Wh-N6@xenbits.xen.org>
Date: Wed, 11 Apr 2012 20:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen,
	cpupools: Fix cpupool-move to make more consistent
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334050955 -3600
# Node ID 5bbda657a0160d3eec024bef2e7a59f199e84b10
# Parent  b2a467527d68b0b021038a8f714b69974e37ca6c
xen, cpupools: Fix cpupool-move to make more consistent

The full order for creating new private data structures when moving
from one pool to another is now:
* Allocate all new structures
 - Allocate a new private domain structure (but don't point there yet)
 - Allocate per-vcpu data structures (but don't point there yet)
* Remove old structures
 - Remove each vcpu, freeing the associated data structure
 - Free the domain data structure
* Switch to the new structures
 - Set the domain to the new cpupool, with the new private domain
 structure
 - Set each vcpu to the respective new structure, and insert

This is in line with a (fairly reasonable) assumption in credit2 that
the private structure of the domain will be the private structure
pointed to by the per-vcpu private structure.

Also fix a bug, in which insert_vcpu was called with the *old* vcpu
ops rather than the new ones.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r b2a467527d68 -r 5bbda657a016 xen/common/schedule.c
--- a/xen/common/schedule.c	Tue Apr 10 10:41:55 2012 +0100
+++ b/xen/common/schedule.c	Tue Apr 10 10:42:35 2012 +0100
@@ -261,6 +261,18 @@ int sched_move_domain(struct domain *d, 
 
     domain_pause(d);
 
+    for_each_vcpu ( d, v )
+    {
+        SCHED_OP(VCPU2OP(v), remove_vcpu, v);
+        SCHED_OP(VCPU2OP(v), free_vdata, v->sched_priv);
+        v->sched_priv = NULL;
+    }
+
+    SCHED_OP(DOM2OP(d), free_domdata, d->sched_priv);
+
+    d->cpupool = c;
+    d->sched_priv = domdata;
+
     new_p = cpumask_first(c->cpu_valid);
     for_each_vcpu ( d, v )
     {
@@ -268,9 +280,6 @@ int sched_move_domain(struct domain *d, 
         migrate_timer(&v->singleshot_timer, new_p);
         migrate_timer(&v->poll_timer, new_p);
 
-        SCHED_OP(VCPU2OP(v), remove_vcpu, v);
-        SCHED_OP(VCPU2OP(v), free_vdata, v->sched_priv);
-
         cpumask_setall(v->cpu_affinity);
         v->processor = new_p;
         v->sched_priv = vcpu_priv[v->vcpu_id];
@@ -278,13 +287,9 @@ int sched_move_domain(struct domain *d, 
 
         new_p = cpumask_cycle(new_p, c->cpu_valid);
 
-        SCHED_OP(VCPU2OP(v), insert_vcpu, v);
+        SCHED_OP(c->sched, insert_vcpu, v);
     }
 
-    d->cpupool = c;
-    SCHED_OP(DOM2OP(d), free_domdata, d->sched_priv);
-    d->sched_priv = domdata;
-
     domain_update_node_affinity(d);
 
     domain_unpause(d);

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:44:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:44: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 1SI4Oj-0008MT-2d; Wed, 11 Apr 2012 20: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 1SI4Oi-0008M2-52
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:12 +0000
Received: from [85.158.143.99:23730] by server-2.bemta-4.messagelabs.com id
	3E/43-17550-A1DE58F4; Wed, 11 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1334177048!18006575!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16922 invoked from network); 11 Apr 2012 20:44:09 -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;
	11 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0004Qk-3z
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Od-0001WD-Lw
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:07 +0000
Message-Id: <E1SI4Od-0001WD-Lw@xenbits.xen.org>
Date: Wed, 11 Apr 2012 20:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Fix schedule()'s grabbing of
	the schedule lock
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334050890 -3600
# Node ID 478bec603d3d666a67d1e49e450e553105416407
# Parent  d690c7e896a26c54a5ab85458824059de72d5cba
xen: Fix schedule()'s grabbing of the schedule lock

Because the location of the lock can change between the time you read
it and the time you grab it, the per-cpu schedule locks need to check
after lock acquisition that the lock location hasn't changed, and
release and re-try if so.  This change was effected throughout the
source code, but one very important place was apparently missed: in
schedule() itself.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d690c7e896a2 -r 478bec603d3d xen/common/schedule.c
--- a/xen/common/schedule.c	Thu Apr 05 11:06:03 2012 +0100
+++ b/xen/common/schedule.c	Tue Apr 10 10:41:30 2012 +0100
@@ -1075,6 +1075,7 @@ static void schedule(void)
     bool_t                tasklet_work_scheduled = 0;
     struct schedule_data *sd;
     struct task_slice     next_slice;
+    int cpu = smp_processor_id();
 
     ASSERT(!in_atomic());
 
@@ -1099,7 +1100,7 @@ static void schedule(void)
         BUG();
     }
 
-    spin_lock_irq(sd->schedule_lock);
+    pcpu_schedule_lock_irq(cpu);
 
     stop_timer(&sd->s_timer);
     
@@ -1116,7 +1117,7 @@ static void schedule(void)
 
     if ( unlikely(prev == next) )
     {
-        spin_unlock_irq(sd->schedule_lock);
+        pcpu_schedule_unlock_irq(cpu);
         trace_continue_running(next);
         return continue_running(prev);
     }
@@ -1154,7 +1155,7 @@ static void schedule(void)
     ASSERT(!next->is_running);
     next->is_running = 1;
 
-    spin_unlock_irq(sd->schedule_lock);
+    pcpu_schedule_unlock_irq(cpu);
 
     perfc_incr(sched_ctx);
 

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:44:14 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:44: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 1SI4Oj-0008MT-2d; Wed, 11 Apr 2012 20: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 1SI4Oi-0008M2-52
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:12 +0000
Received: from [85.158.143.99:23730] by server-2.bemta-4.messagelabs.com id
	3E/43-17550-A1DE58F4; Wed, 11 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1334177048!18006575!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16922 invoked from network); 11 Apr 2012 20:44:09 -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;
	11 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0004Qk-3z
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Od-0001WD-Lw
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:07 +0000
Message-Id: <E1SI4Od-0001WD-Lw@xenbits.xen.org>
Date: Wed, 11 Apr 2012 20:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Fix schedule()'s grabbing of
	the schedule lock
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334050890 -3600
# Node ID 478bec603d3d666a67d1e49e450e553105416407
# Parent  d690c7e896a26c54a5ab85458824059de72d5cba
xen: Fix schedule()'s grabbing of the schedule lock

Because the location of the lock can change between the time you read
it and the time you grab it, the per-cpu schedule locks need to check
after lock acquisition that the lock location hasn't changed, and
release and re-try if so.  This change was effected throughout the
source code, but one very important place was apparently missed: in
schedule() itself.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d690c7e896a2 -r 478bec603d3d xen/common/schedule.c
--- a/xen/common/schedule.c	Thu Apr 05 11:06:03 2012 +0100
+++ b/xen/common/schedule.c	Tue Apr 10 10:41:30 2012 +0100
@@ -1075,6 +1075,7 @@ static void schedule(void)
     bool_t                tasklet_work_scheduled = 0;
     struct schedule_data *sd;
     struct task_slice     next_slice;
+    int cpu = smp_processor_id();
 
     ASSERT(!in_atomic());
 
@@ -1099,7 +1100,7 @@ static void schedule(void)
         BUG();
     }
 
-    spin_lock_irq(sd->schedule_lock);
+    pcpu_schedule_lock_irq(cpu);
 
     stop_timer(&sd->s_timer);
     
@@ -1116,7 +1117,7 @@ static void schedule(void)
 
     if ( unlikely(prev == next) )
     {
-        spin_unlock_irq(sd->schedule_lock);
+        pcpu_schedule_unlock_irq(cpu);
         trace_continue_running(next);
         return continue_running(prev);
     }
@@ -1154,7 +1155,7 @@ static void schedule(void)
     ASSERT(!next->is_running);
     next->is_running = 1;
 
-    spin_unlock_irq(sd->schedule_lock);
+    pcpu_schedule_unlock_irq(cpu);
 
     perfc_incr(sched_ctx);
 

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:44:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:44: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 1SI4Oi-0008MH-Rn; Wed, 11 Apr 2012 20:44: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 1SI4Og-0008Lz-Ry
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:10 +0000
Received: from [85.158.143.35:21398] by server-1.bemta-4.messagelabs.com id
	52/E9-20925-A1DE58F4; Wed, 11 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-21.messagelabs.com!1334177048!12005331!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11973 invoked from network); 11 Apr 2012 20:44:09 -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;
	11 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0004Qn-BD
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0001WS-6p
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Message-Id: <E1SI4Oe-0001WS-6p@xenbits.xen.org>
Date: Wed, 11 Apr 2012 20:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen,
	credit2: Put the per-cpu schedule lock back to the default lock
	when releasing cpu
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334050915 -3600
# Node ID b2a467527d68b0b021038a8f714b69974e37ca6c
# Parent  478bec603d3d666a67d1e49e450e553105416407
xen, credit2: Put the per-cpu schedule lock back to the default lock when releasing cpu

This fixes a bug that happens when you remove cpus from a credit2
cpupool.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 478bec603d3d -r b2a467527d68 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Tue Apr 10 10:41:30 2012 +0100
+++ b/xen/common/sched_credit2.c	Tue Apr 10 10:41:55 2012 +0100
@@ -1952,6 +1952,7 @@ csched_free_pdata(const struct scheduler
     unsigned long flags;
     struct csched_private *prv = CSCHED_PRIV(ops);
     struct csched_runqueue_data *rqd;
+    struct schedule_data *sd = &per_cpu(schedule_data, cpu);
     int rqi;
 
     spin_lock_irqsave(&prv->lock, flags);
@@ -1979,6 +1980,11 @@ csched_free_pdata(const struct scheduler
         deactivate_runqueue(prv, rqi);
     }
 
+    /* Move spinlock to the original lock.  */
+    ASSERT(sd->schedule_lock == &rqd->lock);
+    ASSERT(!spin_is_locked(&sd->_lock));
+    sd->schedule_lock = &sd->_lock;
+
     spin_unlock(&rqd->lock);
 
     cpumask_clear_cpu(cpu, &prv->initialized);

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

From xen-changelog-bounces@lists.xen.org Wed Apr 11 20:44:15 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Apr 2012 20:44: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 1SI4Oi-0008MH-Rn; Wed, 11 Apr 2012 20:44: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 1SI4Og-0008Lz-Ry
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:10 +0000
Received: from [85.158.143.35:21398] by server-1.bemta-4.messagelabs.com id
	52/E9-20925-A1DE58F4; Wed, 11 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-21.messagelabs.com!1334177048!12005331!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11973 invoked from network); 11 Apr 2012 20:44:09 -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;
	11 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0004Qn-BD
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SI4Oe-0001WS-6p
	for xen-changelog@lists.xensource.com; Wed, 11 Apr 2012 20:44:08 +0000
Message-Id: <E1SI4Oe-0001WS-6p@xenbits.xen.org>
Date: Wed, 11 Apr 2012 20:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen,
	credit2: Put the per-cpu schedule lock back to the default lock
	when releasing cpu
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334050915 -3600
# Node ID b2a467527d68b0b021038a8f714b69974e37ca6c
# Parent  478bec603d3d666a67d1e49e450e553105416407
xen, credit2: Put the per-cpu schedule lock back to the default lock when releasing cpu

This fixes a bug that happens when you remove cpus from a credit2
cpupool.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 478bec603d3d -r b2a467527d68 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Tue Apr 10 10:41:30 2012 +0100
+++ b/xen/common/sched_credit2.c	Tue Apr 10 10:41:55 2012 +0100
@@ -1952,6 +1952,7 @@ csched_free_pdata(const struct scheduler
     unsigned long flags;
     struct csched_private *prv = CSCHED_PRIV(ops);
     struct csched_runqueue_data *rqd;
+    struct schedule_data *sd = &per_cpu(schedule_data, cpu);
     int rqi;
 
     spin_lock_irqsave(&prv->lock, flags);
@@ -1979,6 +1980,11 @@ csched_free_pdata(const struct scheduler
         deactivate_runqueue(prv, rqi);
     }
 
+    /* Move spinlock to the original lock.  */
+    ASSERT(sd->schedule_lock == &rqd->lock);
+    ASSERT(!spin_is_locked(&sd->_lock));
+    sd->schedule_lock = &sd->_lock;
+
     spin_unlock(&rqd->lock);
 
     cpumask_clear_cpu(cpu, &prv->initialized);

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:00:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:00: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 1SIbQS-0003KJ-0X; Fri, 13 Apr 2012 08:00:12 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQR-0003K8-1Z
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:11 +0000
Received: from [85.158.138.51:19580] by server-9.bemta-3.messagelabs.com id
	15/08-26691-A0DD78F4; Fri, 13 Apr 2012 08:00:10 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-174.messagelabs.com!1334304008!10967376!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31099 invoked from network); 13 Apr 2012 08:00:09 -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 Apr 2012 08:00:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQN-0006Qp-73
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQM-00086P-9S
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:06 +0000
Date: Fri, 13 Apr 2012 08:00:06 +0000
Message-Id: <E1SIbQM-00086P-9S@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_console: ignore
	console disconnect events from console/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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 66b7aa32a8f3b07cef3adb8470c37f48b4c07413
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Mar 27 16:02:21 2012 +0000

    xen_console: ignore console disconnect events from console/0
    
    The first console has a different location compared to other PV devices
    (console, rather than device/console/0) and doesn't obey the xenstore
    state protocol. We already special case the first console in con_init
    and con_initialise, we should also do it in con_disconnect.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_console.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/xen_console.c b/hw/xen_console.c
index edcb31c..3794b19 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -248,6 +248,9 @@ static void con_disconnect(struct XenDevice *xendev)
 {
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
 
+    if (!xendev->dev) {
+        return;
+    }
     if (con->chr)
         qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL);
     xen_be_unbind_evtchn(&con->xendev);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:00:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:00: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 1SIbQS-0003KJ-0X; Fri, 13 Apr 2012 08:00:12 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQR-0003K8-1Z
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:11 +0000
Received: from [85.158.138.51:19580] by server-9.bemta-3.messagelabs.com id
	15/08-26691-A0DD78F4; Fri, 13 Apr 2012 08:00:10 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-174.messagelabs.com!1334304008!10967376!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31099 invoked from network); 13 Apr 2012 08:00:09 -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 Apr 2012 08:00:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQN-0006Qp-73
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQM-00086P-9S
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:06 +0000
Date: Fri, 13 Apr 2012 08:00:06 +0000
Message-Id: <E1SIbQM-00086P-9S@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_console: ignore
	console disconnect events from console/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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 66b7aa32a8f3b07cef3adb8470c37f48b4c07413
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Mar 27 16:02:21 2012 +0000

    xen_console: ignore console disconnect events from console/0
    
    The first console has a different location compared to other PV devices
    (console, rather than device/console/0) and doesn't obey the xenstore
    state protocol. We already special case the first console in con_init
    and con_initialise, we should also do it in con_disconnect.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_console.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/xen_console.c b/hw/xen_console.c
index edcb31c..3794b19 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -248,6 +248,9 @@ static void con_disconnect(struct XenDevice *xendev)
 {
     struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);
 
+    if (!xendev->dev) {
+        return;
+    }
     if (con->chr)
         qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL);
     xen_be_unbind_evtchn(&con->xendev);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:00:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:00:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIbQd-0003MH-LM; Fri, 13 Apr 2012 08:00:23 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQd-0003Lw-0y
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:23 +0000
Received: from [193.109.254.147:33314] by server-8.bemta-14.messagelabs.com id
	54/30-23244-61DD78F4; Fri, 13 Apr 2012 08:00:22 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-27.messagelabs.com!1334304019!4404724!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3212 invoked from network); 13 Apr 2012 08:00:20 -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 Apr 2012 08:00:20 -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 1SIbQZ-0006RM-DD
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQZ-00087Z-1P
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:19 +0000
Date: Fri, 13 Apr 2012 08:00:19 +0000
Message-Id: <E1SIbQZ-00087Z-1P@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_disk: detach the
	blkdev before bdrv_delete
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 1fb722ad994eb72aeed64adadf59d5758175429c
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Mar 27 16:03:07 2012 +0000

    xen_disk: detach the blkdev before bdrv_delete
    
    We need to detach the blkdev from the BlockDriverState before calling
    bdrv_delete.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 286bbac..285a951 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -805,6 +805,7 @@ static void blk_disconnect(struct XenDevice *xendev)
         if (!blkdev->dinfo) {
             /* close/delete only if we created it ourself */
             bdrv_close(blkdev->bs);
+            bdrv_detach_dev(blkdev->bs, blkdev);
             bdrv_delete(blkdev->bs);
         }
         blkdev->bs = NULL;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:00:30 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:00:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIbQd-0003MH-LM; Fri, 13 Apr 2012 08:00:23 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQd-0003Lw-0y
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:23 +0000
Received: from [193.109.254.147:33314] by server-8.bemta-14.messagelabs.com id
	54/30-23244-61DD78F4; Fri, 13 Apr 2012 08:00:22 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-27.messagelabs.com!1334304019!4404724!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3212 invoked from network); 13 Apr 2012 08:00:20 -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 Apr 2012 08:00:20 -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 1SIbQZ-0006RM-DD
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQZ-00087Z-1P
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:19 +0000
Date: Fri, 13 Apr 2012 08:00:19 +0000
Message-Id: <E1SIbQZ-00087Z-1P@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_disk: detach the
	blkdev before bdrv_delete
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 1fb722ad994eb72aeed64adadf59d5758175429c
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Tue Mar 27 16:03:07 2012 +0000

    xen_disk: detach the blkdev before bdrv_delete
    
    We need to detach the blkdev from the BlockDriverState before calling
    bdrv_delete.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 286bbac..285a951 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -805,6 +805,7 @@ static void blk_disconnect(struct XenDevice *xendev)
         if (!blkdev->dinfo) {
             /* close/delete only if we created it ourself */
             bdrv_close(blkdev->bs);
+            bdrv_detach_dev(blkdev->bs, blkdev);
             bdrv_delete(blkdev->bs);
         }
         blkdev->bs = NULL;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:00:40 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIbQq-0003Oa-OE; Fri, 13 Apr 2012 08:00: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 1SIbQq-0003OJ-0z
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:36 +0000
Received: from [85.158.143.35:8313] by server-1.bemta-4.messagelabs.com id
	40/FD-20925-32DD78F4; Fri, 13 Apr 2012 08:00:35 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-21.messagelabs.com!1334304032!12240869!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6613 invoked from network); 13 Apr 2012 08:00:33 -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 Apr 2012 08:00: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 1SIbQm-0006RX-EB
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:32 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQj-00088T-GQ
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:32 +0000
Date: Fri, 13 Apr 2012 08:00:29 +0000
Message-Id: <E1SIbQj-00088T-GQ@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_disk: open disks with
	BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 47982cb00584371928e44ab6dfc6865d605a52fd
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Mar 23 14:36:18 2012 +0000

    xen_disk: open disks with BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 285a951..16c3e66 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -663,10 +663,10 @@ static int blk_init(struct XenDevice *xendev)
     }
 
     /* read-only ? */
+    qflags = BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO;
     if (strcmp(blkdev->mode, "w") == 0) {
-        qflags = BDRV_O_RDWR;
+        qflags |= BDRV_O_RDWR;
     } else {
-        qflags = 0;
         info  |= VDISK_READONLY;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:00:40 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:00:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIbQq-0003Oa-OE; Fri, 13 Apr 2012 08:00: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 1SIbQq-0003OJ-0z
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:36 +0000
Received: from [85.158.143.35:8313] by server-1.bemta-4.messagelabs.com id
	40/FD-20925-32DD78F4; Fri, 13 Apr 2012 08:00:35 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-21.messagelabs.com!1334304032!12240869!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6613 invoked from network); 13 Apr 2012 08:00:33 -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 Apr 2012 08:00: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 1SIbQm-0006RX-EB
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:32 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQj-00088T-GQ
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:32 +0000
Date: Fri, 13 Apr 2012 08:00:29 +0000
Message-Id: <E1SIbQj-00088T-GQ@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_disk: open disks with
	BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 47982cb00584371928e44ab6dfc6865d605a52fd
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Mar 23 14:36:18 2012 +0000

    xen_disk: open disks with BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 285a951..16c3e66 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -663,10 +663,10 @@ static int blk_init(struct XenDevice *xendev)
     }
 
     /* read-only ? */
+    qflags = BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO;
     if (strcmp(blkdev->mode, "w") == 0) {
-        qflags = BDRV_O_RDWR;
+        qflags |= BDRV_O_RDWR;
     } else {
-        qflags = 0;
         info  |= VDISK_READONLY;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:01:00 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:01:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIbRB-0003TE-RP; Fri, 13 Apr 2012 08:00:57 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbRA-0003Ss-Pz
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:56 +0000
Received: from [193.109.254.147:19473] by server-3.bemta-14.messagelabs.com id
	49/EE-23274-83DD78F4; Fri, 13 Apr 2012 08:00:56 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-27.messagelabs.com!1334304053!4429753!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29482 invoked from network); 13 Apr 2012 08:00:54 -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;
	13 Apr 2012 08:00:54 -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 1SIbR7-0006Rj-5K
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQw-00089U-Gv
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:50 +0000
Date: Fri, 13 Apr 2012 08:00:42 +0000
Message-Id: <E1SIbQw-00089U-Gv@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_disk: when using AIO
	flush after the operation is completed
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 4db776322827f0930d53b9e162dc1c6600d918d0
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Mar 23 11:37:25 2012 +0000

    xen_disk: when using AIO flush after the operation is completed
    
    If ioreq->postsync call bdrv_flush when the AIO operation is actually
    completed.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 16c3e66..e9bbbf7 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -398,6 +398,9 @@ static void qemu_aio_complete(void *opaque, int ret)
     if (ioreq->aio_inflight > 0) {
         return;
     }
+    if (ioreq->postsync) {
+        bdrv_flush(ioreq->blkdev->bs);
+    }
 
     ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
     ioreq_unmap(ioreq);
@@ -444,9 +447,6 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
         goto err;
     }
 
-    if (ioreq->postsync) {
-        bdrv_flush(blkdev->bs); /* FIXME: aio_flush() ??? */
-    }
     qemu_aio_complete(ioreq, 0);
 
     return 0;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 08:01:00 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 08:01:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIbRB-0003TE-RP; Fri, 13 Apr 2012 08:00:57 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbRA-0003Ss-Pz
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:56 +0000
Received: from [193.109.254.147:19473] by server-3.bemta-14.messagelabs.com id
	49/EE-23274-83DD78F4; Fri, 13 Apr 2012 08:00:56 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-10.tower-27.messagelabs.com!1334304053!4429753!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29482 invoked from network); 13 Apr 2012 08:00:54 -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;
	13 Apr 2012 08:00:54 -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 1SIbR7-0006Rj-5K
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:53 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SIbQw-00089U-Gv
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 08:00:50 +0000
Date: Fri, 13 Apr 2012 08:00:42 +0000
Message-Id: <E1SIbQw-00089U-Gv@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen_disk: when using AIO
	flush after the operation is completed
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 4db776322827f0930d53b9e162dc1c6600d918d0
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Mar 23 11:37:25 2012 +0000

    xen_disk: when using AIO flush after the operation is completed
    
    If ioreq->postsync call bdrv_flush when the AIO operation is actually
    completed.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 16c3e66..e9bbbf7 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -398,6 +398,9 @@ static void qemu_aio_complete(void *opaque, int ret)
     if (ioreq->aio_inflight > 0) {
         return;
     }
+    if (ioreq->postsync) {
+        bdrv_flush(ioreq->blkdev->bs);
+    }
 
     ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
     ioreq_unmap(ioreq);
@@ -444,9 +447,6 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
         goto err;
     }
 
-    if (ioreq->postsync) {
-        bdrv_flush(blkdev->bs); /* FIXME: aio_flush() ??? */
-    }
     qemu_aio_complete(ioreq, 0);
 
     return 0;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 11:00: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 1SIeEl-0007SU-Cl; Fri, 13 Apr 2012 11:00: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 1SIeEj-0007SA-J3
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:18 +0000
Received: from [193.109.254.147:51305] by server-1.bemta-14.messagelabs.com id
	25/51-29372-047088F4; Fri, 13 Apr 2012 11:00:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1334314813!4452695!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8059 invoked from network); 13 Apr 2012 11:00:14 -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;
	13 Apr 2012 11: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 1SIeEf-00009T-Kl
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEf-0004a8-GO
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:13 +0000
Message-Id: <E1SIeEf-0004a8-GO@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:12 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] svm: implement instruction fetch
	part of DecodeAssist (on #PF/#NPF)
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andre Przywara <andre.przywara@amd.com>
# Date 1334217962 -3600
# Node ID 0aa6bc8f38a9a270f910f37e664ea6fcbece0073
# Parent  80130491806f42cfe9c8b93b755c3852ae55733d
svm: implement instruction fetch part of DecodeAssist (on #PF/#NPF)

Newer SVM implementations (Bulldozer) copy up to 15 bytes from the
instruction stream into the VMCB when a #PF or #NPF exception is
intercepted. This patch makes use of this information if available.
This saves us from a) traversing the guest's page tables, b) mapping
the guest's memory and c) copy the instructions from there into the
hypervisor's address space.
This speeds up #NPF intercepts quite a lot and avoids cache and TLB
trashing.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23238:60f5df2afcbb
xen-unstable date:        Mon Apr 18 13:36:10 2011 +0100

svm: decode-assists feature must depend on nextrip feature.

...since the decode-assist fast paths assume nextrip vmcb field is
valid.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23237:381ab77db71a
xen-unstable date:        Mon Apr 18 10:10:02 2011 +0100

svm: implement INVLPG part of DecodeAssist

Newer SVM implementations (Bulldozer) give the desired address on
a INVLPG intercept explicitly in the EXITINFO1 field of the VMCB.
Use this address to avoid a costly instruction fetch and decode
cycle.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
xen-unstable changeset:   23236:e324c4d1dd6e
xen-unstable date:        Mon Apr 18 10:06:37 2011 +0100

svm: implement CR access part of DecodeAssist

Newer SVM implementations (Bulldozer) now give the used general
purpose register on a MOV-CR intercept explictly. This avoids
fetching and decoding the instruction from guest's memory and speeds
up some Windows guest, which exercise CR8 quite often.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23235:2c8ad607ece1
xen-unstable date:        Mon Apr 18 10:01:06 2011 +0100

svm: add bit definitions for SVM DecodeAssist

Chapter 15.33 of recent APM Vol.2 manuals describe some additions
to SVM called DecodeAssist. Add the newly added fields to the VMCB
structure and name the associated CPUID bit.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
xen-unstable changeset:   23234:bf7afd48339a
xen-unstable date:        Mon Apr 18 09:49:13 2011 +0100

vmx/hvm: move mov-cr handling functions to generic HVM code

Currently the handling of CR accesses intercepts is done much
differently in SVM and VMX. For future usage move the VMX part
into the generic HVM path and use the exported functions.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23233:1276926e3795
xen-unstable date:        Mon Apr 18 09:47:12 2011 +0100
---


diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/emulate.c	Thu Apr 12 09:06:02 2012 +0100
@@ -996,6 +996,8 @@ int hvm_emulate_one(
 
     hvmemul_ctxt->insn_buf_eip = regs->eip;
     hvmemul_ctxt->insn_buf_bytes =
+        hvm_get_insn_bytes(curr, hvmemul_ctxt->insn_buf)
+        ? :
         (hvm_virtual_to_linear_addr(
             x86_seg_cs, &hvmemul_ctxt->seg_reg[x86_seg_cs],
             regs->eip, sizeof(hvmemul_ctxt->insn_buf),
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Thu Apr 12 09:06:02 2012 +0100
@@ -1306,6 +1306,86 @@ static void hvm_set_uc_mode(struct vcpu 
         return hvm_funcs.set_uc_mode(v);
 }
 
+int hvm_mov_to_cr(unsigned int cr, unsigned int gpr)
+{
+    struct vcpu *curr = current;
+    unsigned long val, *reg;
+
+    if ( (reg = get_x86_gpr(guest_cpu_user_regs(), gpr)) == NULL )
+    {
+        gdprintk(XENLOG_ERR, "invalid gpr: %u\n", gpr);
+        goto exit_and_crash;
+    }
+
+    val = *reg;
+    HVMTRACE_LONG_2D(CR_WRITE, cr, TRC_PAR_LONG(val));
+    HVM_DBG_LOG(DBG_LEVEL_1, "CR%u, value = %lx", cr, val);
+
+    switch ( cr )
+    {
+    case 0:
+        return hvm_set_cr0(val);
+
+    case 3:
+        return hvm_set_cr3(val);
+
+    case 4:
+        return hvm_set_cr4(val);
+
+    case 8:
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, ((val & 0x0f) << 4));
+        break;
+
+    default:
+        gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
+        goto exit_and_crash;
+    }
+
+    return X86EMUL_OKAY;
+
+ exit_and_crash:
+    domain_crash(curr->domain);
+    return X86EMUL_UNHANDLEABLE;
+}
+
+int hvm_mov_from_cr(unsigned int cr, unsigned int gpr)
+{
+    struct vcpu *curr = current;
+    unsigned long val = 0, *reg;
+
+    if ( (reg = get_x86_gpr(guest_cpu_user_regs(), gpr)) == NULL )
+    {
+        gdprintk(XENLOG_ERR, "invalid gpr: %u\n", gpr);
+        goto exit_and_crash;
+    }
+
+    switch ( cr )
+    {
+    case 0:
+    case 2:
+    case 3:
+    case 4:
+        val = curr->arch.hvm_vcpu.guest_cr[cr];
+        break;
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+    default:
+        gdprintk(XENLOG_ERR, "invalid cr: %u\n", cr);
+        goto exit_and_crash;
+    }
+
+    *reg = val;
+    HVMTRACE_LONG_2D(CR_READ, cr, TRC_PAR_LONG(val));
+    HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR%u, value = %lx", cr, val);
+
+    return X86EMUL_OKAY;
+
+ exit_and_crash:
+    domain_crash(curr->domain);
+    return X86EMUL_UNHANDLEABLE;
+}
+
 int hvm_set_cr0(unsigned long value)
 {
     struct vcpu *v = current;
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:06:02 2012 +0100
@@ -603,6 +603,21 @@ static void svm_set_rdtsc_exiting(struct
     vmcb_set_general1_intercepts(vmcb, general1_intercepts);
 }
 
+static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
+{
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    unsigned int len = v->arch.hvm_svm.cached_insn_len;
+
+    if ( len != 0 )
+    {
+        /* Latch and clear the cached instruction. */
+        memcpy(buf, vmcb->guest_ins, 15);
+        v->arch.hvm_svm.cached_insn_len = 0;
+    }
+
+    return len;
+}
+
 static void svm_init_hypercall_page(struct domain *d, void *hypercall_page)
 {
     char *p;
@@ -928,11 +943,16 @@ struct hvm_function_table * __init start
 
     printk("SVM: Supported advanced features:\n");
 
+    /* DecodeAssists fast paths assume nextrip is valid for fast rIP update. */
+    if ( !cpu_has_svm_nrips )
+        clear_bit(SVM_FEATURE_DECODEASSISTS, &svm_feature_flags);
+
 #define P(p,s) if ( p ) { printk(" - %s\n", s); printed = 1; }
     P(cpu_has_svm_npt, "Nested Page Tables (NPT)");
     P(cpu_has_svm_lbrv, "Last Branch Record (LBR) Virtualisation");
     P(cpu_has_svm_nrips, "Next-RIP Saved on #VMEXIT");
     P(cpu_has_svm_cleanbits, "VMCB Clean Bits");
+    P(cpu_has_svm_decode, "DecodeAssists");
     P(cpu_has_pause_filter, "Pause-Intercept Filter");
 #undef P
 
@@ -1034,6 +1054,22 @@ static void svm_vmexit_do_cpuid(struct c
     __update_guest_eip(regs, inst_len);
 }
 
+static void svm_vmexit_do_cr_access(
+    struct vmcb_struct *vmcb, struct cpu_user_regs *regs)
+{
+    int gp, cr, dir, rc;
+
+    cr = vmcb->exitcode - VMEXIT_CR0_READ;
+    dir = (cr > 15);
+    cr &= 0xf;
+    gp = vmcb->exitinfo1 & 0xf;
+
+    rc = dir ? hvm_mov_to_cr(cr, gp) : hvm_mov_from_cr(cr, gp);
+
+    if ( rc == X86EMUL_OKAY )
+        __update_guest_eip(regs, vmcb->nextrip - vmcb->rip);
+}
+
 static void svm_dr_access(struct vcpu *v, struct cpu_user_regs *regs)
 {
     HVMTRACE_0D(DR_WRITE);
@@ -1427,7 +1463,8 @@ static struct hvm_function_table __read_
     .msr_read_intercept   = svm_msr_read_intercept,
     .msr_write_intercept  = svm_msr_write_intercept,
     .invlpg_intercept     = svm_invlpg_intercept,
-    .set_rdtsc_exiting    = svm_set_rdtsc_exiting
+    .set_rdtsc_exiting    = svm_set_rdtsc_exiting,
+    .get_insn_bytes       = svm_get_insn_bytes,
 };
 
 asmlinkage void svm_vmexit_handler(struct cpu_user_regs *regs)
@@ -1533,7 +1570,12 @@ asmlinkage void svm_vmexit_handler(struc
                     (unsigned long)regs->ecx, (unsigned long)regs->edx,
                     (unsigned long)regs->esi, (unsigned long)regs->edi);
 
-        if ( paging_fault(va, regs) )
+        if ( cpu_has_svm_decode )
+            v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
+        rc = paging_fault(va, regs);
+        v->arch.hvm_svm.cached_insn_len = 0;
+
+        if ( rc )
         {
             if ( trace_will_trace_event(TRC_SHADOW) )
                 break;
@@ -1615,12 +1657,29 @@ asmlinkage void svm_vmexit_handler(struc
             int dir = (vmcb->exitinfo1 & 1) ? IOREQ_READ : IOREQ_WRITE;
             if ( handle_pio(port, bytes, dir) )
                 __update_guest_eip(regs, vmcb->exitinfo2 - vmcb->rip);
-            break;
         }
-        /* fallthrough to emulation if a string instruction */
+        else if ( !handle_mmio() )
+            hvm_inject_exception(TRAP_gp_fault, 0, 0);
+        break;
+
     case VMEXIT_CR0_READ ... VMEXIT_CR15_READ:
     case VMEXIT_CR0_WRITE ... VMEXIT_CR15_WRITE:
+        if ( cpu_has_svm_decode && (vmcb->exitinfo1 & (1ULL << 63)) )
+            svm_vmexit_do_cr_access(vmcb, regs);
+        else if ( !handle_mmio() ) 
+            hvm_inject_exception(TRAP_gp_fault, 0, 0);
+        break;
+
     case VMEXIT_INVLPG:
+        if ( cpu_has_svm_decode )
+        {
+            svm_invlpg_intercept(vmcb->exitinfo1);
+            __update_guest_eip(regs, vmcb->nextrip - vmcb->rip);
+        }
+        else if ( !handle_mmio() )
+            hvm_inject_exception(TRAP_gp_fault, 0, 0);
+        break;
+
     case VMEXIT_INVLPGA:
         if ( !handle_mmio() )
             hvm_inject_exception(TRAP_gp_fault, 0, 0);
@@ -1680,7 +1739,10 @@ asmlinkage void svm_vmexit_handler(struc
     case VMEXIT_NPF:
         perfc_incra(svmexits, VMEXIT_NPF_PERFC);
         regs->error_code = vmcb->exitinfo1;
+        if ( cpu_has_svm_decode )
+            v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         svm_do_nested_pgfault(vmcb->exitinfo2);
+        v->arch.hvm_svm.cached_insn_len = 0;
         break;
 
     case VMEXIT_IRET: {
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Apr 12 09:06:02 2012 +0100
@@ -1545,182 +1545,42 @@ static void vmx_invlpg_intercept(unsigne
         vpid_sync_vcpu_gva(curr, vaddr);
 }
 
-#define CASE_SET_REG(REG, reg)      \
-    case VMX_CONTROL_REG_ACCESS_GPR_ ## REG: regs->reg = value; break
-#define CASE_GET_REG(REG, reg)      \
-    case VMX_CONTROL_REG_ACCESS_GPR_ ## REG: value = regs->reg; break
+static int vmx_cr_access(unsigned long exit_qualification)
+{
+    struct vcpu *curr = current;
 
-#define CASE_EXTEND_SET_REG         \
-    CASE_EXTEND_REG(S)
-#define CASE_EXTEND_GET_REG         \
-    CASE_EXTEND_REG(G)
-
-#ifdef __i386__
-#define CASE_EXTEND_REG(T)
-#else
-#define CASE_EXTEND_REG(T)          \
-    CASE_ ## T ## ET_REG(R8, r8);   \
-    CASE_ ## T ## ET_REG(R9, r9);   \
-    CASE_ ## T ## ET_REG(R10, r10); \
-    CASE_ ## T ## ET_REG(R11, r11); \
-    CASE_ ## T ## ET_REG(R12, r12); \
-    CASE_ ## T ## ET_REG(R13, r13); \
-    CASE_ ## T ## ET_REG(R14, r14); \
-    CASE_ ## T ## ET_REG(R15, r15)
-#endif
-
-static int mov_to_cr(int gp, int cr, struct cpu_user_regs *regs)
-{
-    unsigned long value;
-    struct vcpu *v = current;
-    struct vlapic *vlapic = vcpu_vlapic(v);
-    int rc = 0;
-    unsigned long old;
-
-    switch ( gp )
+    switch ( VMX_CONTROL_REG_ACCESS_TYPE(exit_qualification) )
     {
-    CASE_GET_REG(EAX, eax);
-    CASE_GET_REG(ECX, ecx);
-    CASE_GET_REG(EDX, edx);
-    CASE_GET_REG(EBX, ebx);
-    CASE_GET_REG(EBP, ebp);
-    CASE_GET_REG(ESI, esi);
-    CASE_GET_REG(EDI, edi);
-    CASE_GET_REG(ESP, esp);
-    CASE_EXTEND_GET_REG;
-    default:
-        gdprintk(XENLOG_ERR, "invalid gp: %d\n", gp);
-        goto exit_and_crash;
+    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR: {
+        unsigned long gp = VMX_CONTROL_REG_ACCESS_GPR(exit_qualification);
+        unsigned long cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification);
+        return hvm_mov_to_cr(cr, gp);
     }
-
-    HVMTRACE_LONG_2D(CR_WRITE, cr, TRC_PAR_LONG(value));
-
-    HVM_DBG_LOG(DBG_LEVEL_1, "CR%d, value = %lx", cr, value);
-
-    switch ( cr )
-    {
-    case 0:
-        old = v->arch.hvm_vcpu.guest_cr[0];
-        rc = !hvm_set_cr0(value);
-        if (rc)
-            hvm_memory_event_cr0(value, old);
-        return rc;
-
-    case 3:
-        old = v->arch.hvm_vcpu.guest_cr[3];
-        rc = !hvm_set_cr3(value);
-        if (rc)
-            hvm_memory_event_cr3(value, old);        
-        return rc;
-
-    case 4:
-        old = v->arch.hvm_vcpu.guest_cr[4];
-        rc = !hvm_set_cr4(value);
-        if (rc)
-            hvm_memory_event_cr4(value, old);
-        return rc; 
-
-    case 8:
-        vlapic_set_reg(vlapic, APIC_TASKPRI, ((value & 0x0F) << 4));
-        break;
-
-    default:
-        gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
-        goto exit_and_crash;
+    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR: {
+        unsigned long gp = VMX_CONTROL_REG_ACCESS_GPR(exit_qualification);
+        unsigned long cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification);
+        return hvm_mov_from_cr(cr, gp);
     }
-
-    return 1;
-
- exit_and_crash:
-    domain_crash(v->domain);
-    return 0;
-}
-
-/*
- * Read from control registers. CR0 and CR4 are read from the shadow.
- */
-static void mov_from_cr(int cr, int gp, struct cpu_user_regs *regs)
-{
-    unsigned long value = 0;
-    struct vcpu *v = current;
-    struct vlapic *vlapic = vcpu_vlapic(v);
-
-    switch ( cr )
-    {
-    case 3:
-        value = (unsigned long)v->arch.hvm_vcpu.guest_cr[3];
-        break;
-    case 8:
-        value = (unsigned long)vlapic_get_reg(vlapic, APIC_TASKPRI);
-        value = (value & 0xF0) >> 4;
-        break;
-    default:
-        gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
-        domain_crash(v->domain);
-        break;
-    }
-
-    switch ( gp ) {
-    CASE_SET_REG(EAX, eax);
-    CASE_SET_REG(ECX, ecx);
-    CASE_SET_REG(EDX, edx);
-    CASE_SET_REG(EBX, ebx);
-    CASE_SET_REG(EBP, ebp);
-    CASE_SET_REG(ESI, esi);
-    CASE_SET_REG(EDI, edi);
-    CASE_SET_REG(ESP, esp);
-    CASE_EXTEND_SET_REG;
-    default:
-        printk("invalid gp: %d\n", gp);
-        domain_crash(v->domain);
-        break;
-    }
-
-    HVMTRACE_LONG_2D(CR_READ, cr, TRC_PAR_LONG(value));
-
-    HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR%d, value = %lx", cr, value);
-}
-
-static int vmx_cr_access(unsigned long exit_qualification,
-                         struct cpu_user_regs *regs)
-{
-    unsigned int gp, cr;
-    unsigned long value;
-    struct vcpu *v = current;
-
-    switch ( exit_qualification & VMX_CONTROL_REG_ACCESS_TYPE )
-    {
-    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR:
-        gp = exit_qualification & VMX_CONTROL_REG_ACCESS_GPR;
-        cr = exit_qualification & VMX_CONTROL_REG_ACCESS_NUM;
-        return mov_to_cr(gp, cr, regs);
-    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR:
-        gp = exit_qualification & VMX_CONTROL_REG_ACCESS_GPR;
-        cr = exit_qualification & VMX_CONTROL_REG_ACCESS_NUM;
-        mov_from_cr(cr, gp, regs);
-        break;
-    case VMX_CONTROL_REG_ACCESS_TYPE_CLTS: 
-    {
-        unsigned long old = v->arch.hvm_vcpu.guest_cr[0];
-        v->arch.hvm_vcpu.guest_cr[0] &= ~X86_CR0_TS;
-        vmx_update_guest_cr(v, 0);
-
-        hvm_memory_event_cr0(v->arch.hvm_vcpu.guest_cr[0], old);
-
+    case VMX_CONTROL_REG_ACCESS_TYPE_CLTS: {
+        unsigned long old = curr->arch.hvm_vcpu.guest_cr[0];
+        curr->arch.hvm_vcpu.guest_cr[0] &= ~X86_CR0_TS;
+        vmx_update_guest_cr(curr, 0);
+        hvm_memory_event_cr0(curr->arch.hvm_vcpu.guest_cr[0], old);
         HVMTRACE_0D(CLTS);
         break;
     }
-    case VMX_CONTROL_REG_ACCESS_TYPE_LMSW:
-        value = v->arch.hvm_vcpu.guest_cr[0];
+    case VMX_CONTROL_REG_ACCESS_TYPE_LMSW: {
+        unsigned long value = curr->arch.hvm_vcpu.guest_cr[0];
         /* LMSW can: (1) set bits 0-3; (2) clear bits 1-3. */
         value = (value & ~0xe) | ((exit_qualification >> 16) & 0xf);
         HVMTRACE_LONG_1D(LMSW, value);
-        return !hvm_set_cr0(value);
+        return hvm_set_cr0(value);
+    }
     default:
         BUG();
     }
 
-    return 1;
+    return X86EMUL_OKAY;
 }
 
 static const struct lbr_info {
@@ -2525,7 +2385,7 @@ asmlinkage void vmx_vmexit_handler(struc
     case EXIT_REASON_CR_ACCESS:
     {
         exit_qualification = __vmread(EXIT_QUALIFICATION);
-        if ( vmx_cr_access(exit_qualification, regs) )
+        if ( vmx_cr_access(exit_qualification) == X86EMUL_OKAY )
             update_guest_eip(); /* Safe: MOV Cn, LMSW, CLTS */
         break;
     }
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/traps.c	Thu Apr 12 09:06:02 2012 +0100
@@ -368,6 +368,36 @@ void vcpu_show_execution_state(struct vc
     vcpu_unpause(v);
 }
 
+unsigned long *get_x86_gpr(struct cpu_user_regs *regs, unsigned int modrm_reg)
+{
+    void *p;
+
+    switch ( modrm_reg )
+    {
+    case  0: p = &regs->eax; break;
+    case  1: p = &regs->ecx; break;
+    case  2: p = &regs->edx; break;
+    case  3: p = &regs->ebx; break;
+    case  4: p = &regs->esp; break;
+    case  5: p = &regs->ebp; break;
+    case  6: p = &regs->esi; break;
+    case  7: p = &regs->edi; break;
+#if defined(__x86_64__)
+    case  8: p = &regs->r8;  break;
+    case  9: p = &regs->r9;  break;
+    case 10: p = &regs->r10; break;
+    case 11: p = &regs->r11; break;
+    case 12: p = &regs->r12; break;
+    case 13: p = &regs->r13; break;
+    case 14: p = &regs->r14; break;
+    case 15: p = &regs->r15; break;
+#endif
+    default: p = NULL; break;
+    }
+
+    return p;
+}
+
 static char *trapstr(int trapnr)
 {
     static char *strings[] = { 
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h	Thu Apr 12 09:06:02 2012 +0100
@@ -132,6 +132,9 @@ struct hvm_function_table {
     int  (*cpu_up)(void);
     void (*cpu_down)(void);
 
+    /* Copy up to 15 bytes from cached instruction bytes at current rIP. */
+    unsigned int (*get_insn_bytes)(struct vcpu *v, uint8_t *buf);
+
     /* Instruction intercepts: non-void return values are X86EMUL codes. */
     void (*cpuid_intercept)(
         unsigned int *eax, unsigned int *ebx,
@@ -328,6 +331,11 @@ static inline void hvm_cpu_down(void)
         hvm_funcs.cpu_down();
 }
 
+static inline unsigned int hvm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
+{
+    return (hvm_funcs.get_insn_bytes ? hvm_funcs.get_insn_bytes(v, buf) : 0);
+}
+
 enum hvm_task_switch_reason { TSW_jmp, TSW_iret, TSW_call_or_int };
 void hvm_task_switch(
     uint16_t tss_sel, enum hvm_task_switch_reason taskswitch_reason,
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/support.h	Thu Apr 12 09:06:02 2012 +0100
@@ -137,5 +137,7 @@ int hvm_set_cr3(unsigned long value);
 int hvm_set_cr4(unsigned long value);
 int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content);
 int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content);
+int hvm_mov_to_cr(unsigned int cr, unsigned int gpr);
+int hvm_mov_from_cr(unsigned int cr, unsigned int gpr);
 
 #endif /* __ASM_X86_HVM_SUPPORT_H__ */
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/svm/svm.h	Thu Apr 12 09:06:02 2012 +0100
@@ -80,6 +80,7 @@ extern u32 svm_feature_flags;
 #define cpu_has_svm_svml      cpu_has_svm_feature(SVM_FEATURE_SVML)
 #define cpu_has_svm_nrips     cpu_has_svm_feature(SVM_FEATURE_NRIPS)
 #define cpu_has_svm_cleanbits cpu_has_svm_feature(SVM_FEATURE_VMCBCLEAN)
+#define cpu_has_svm_decode    cpu_has_svm_feature(SVM_FEATURE_DECODEASSISTS)
 #define cpu_has_pause_filter  cpu_has_svm_feature(SVM_FEATURE_PAUSEFILTER)
 
 #endif /* __ASM_X86_HVM_SVM_H__ */
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h	Thu Apr 12 09:06:02 2012 +0100
@@ -432,7 +432,9 @@ struct vmcb_struct {
     vmcbcleanbits_t cleanbits;  /* offset 0xC0 */
     u32 res09;                  /* offset 0xC4 */
     u64 nextrip;                /* offset 0xC8 */
-    u64 res10a[102];            /* offset 0xD0 pad to save area */
+    u8  guest_ins_len;          /* offset 0xD0 */
+    u8  guest_ins[15];          /* offset 0xD1 */
+    u64 res10a[100];            /* offset 0xE0 pad to save area */
 
     svm_segment_register_t es;  /* offset 1024 - cleanbit 8 */
     svm_segment_register_t cs;  /* cleanbit 8 */
@@ -496,6 +498,9 @@ struct arch_svm_struct {
     int    launch_core;
     bool_t vmcb_in_sync;    /* VMCB sync'ed with VMSAVE? */
 
+    /* VMCB has a cached instruction from #PF/#NPF Decode Assist? */
+    uint8_t cached_insn_len; /* Zero if no cached instruction. */
+
     /* Upper four bytes are undefined in the VMCB, therefore we can't
      * use the fields in the VMCB. Write a 64bit value and then read a 64bit
      * value is fine unless there's a VMRUN/VMEXIT in between which clears
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Thu Apr 12 09:06:02 2012 +0100
@@ -144,31 +144,15 @@ void vmx_update_cpu_exec_control(struct 
  * Exit Qualifications for MOV for Control Register Access
  */
  /* 3:0 - control register number (CRn) */
-#define VMX_CONTROL_REG_ACCESS_NUM      0xf
+#define VMX_CONTROL_REG_ACCESS_NUM(eq)  ((eq) & 0xf)
  /* 5:4 - access type (CR write, CR read, CLTS, LMSW) */
-#define VMX_CONTROL_REG_ACCESS_TYPE     0x30
+#define VMX_CONTROL_REG_ACCESS_TYPE(eq) (((eq) >> 4) & 0x3)
+# define VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR   0
+# define VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR 1
+# define VMX_CONTROL_REG_ACCESS_TYPE_CLTS        2
+# define VMX_CONTROL_REG_ACCESS_TYPE_LMSW        3
  /* 10:8 - general purpose register operand */
-#define VMX_CONTROL_REG_ACCESS_GPR      0xf00
-#define VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR   (0 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR (1 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_CLTS        (2 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_LMSW        (3 << 4)
-#define VMX_CONTROL_REG_ACCESS_GPR_EAX  (0 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ECX  (1 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EDX  (2 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EBX  (3 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ESP  (4 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EBP  (5 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ESI  (6 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EDI  (7 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R8   (8 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R9   (9 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R10  (10 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R11  (11 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R12  (12 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R13  (13 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R14  (14 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R15  (15 << 8)
+#define VMX_CONTROL_REG_ACCESS_GPR(eq)  (((eq) >> 8) & 0xf)
 
 /*
  * Access Rights
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/processor.h	Thu Apr 12 09:06:02 2012 +0100
@@ -593,6 +593,8 @@ int wrmsr_hypervisor_regs(uint32_t idx, 
 int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
 int microcode_resume_cpu(int cpu);
 
+unsigned long *get_x86_gpr(struct cpu_user_regs *regs, unsigned int modrm_reg);
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_X86_PROCESSOR_H */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 11:00: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 1SIeEl-0007SU-Cl; Fri, 13 Apr 2012 11:00: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 1SIeEj-0007SA-J3
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:18 +0000
Received: from [193.109.254.147:51305] by server-1.bemta-14.messagelabs.com id
	25/51-29372-047088F4; Fri, 13 Apr 2012 11:00:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1334314813!4452695!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8059 invoked from network); 13 Apr 2012 11:00:14 -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;
	13 Apr 2012 11: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 1SIeEf-00009T-Kl
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEf-0004a8-GO
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:13 +0000
Message-Id: <E1SIeEf-0004a8-GO@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:12 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] svm: implement instruction fetch
	part of DecodeAssist (on #PF/#NPF)
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andre Przywara <andre.przywara@amd.com>
# Date 1334217962 -3600
# Node ID 0aa6bc8f38a9a270f910f37e664ea6fcbece0073
# Parent  80130491806f42cfe9c8b93b755c3852ae55733d
svm: implement instruction fetch part of DecodeAssist (on #PF/#NPF)

Newer SVM implementations (Bulldozer) copy up to 15 bytes from the
instruction stream into the VMCB when a #PF or #NPF exception is
intercepted. This patch makes use of this information if available.
This saves us from a) traversing the guest's page tables, b) mapping
the guest's memory and c) copy the instructions from there into the
hypervisor's address space.
This speeds up #NPF intercepts quite a lot and avoids cache and TLB
trashing.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23238:60f5df2afcbb
xen-unstable date:        Mon Apr 18 13:36:10 2011 +0100

svm: decode-assists feature must depend on nextrip feature.

...since the decode-assist fast paths assume nextrip vmcb field is
valid.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23237:381ab77db71a
xen-unstable date:        Mon Apr 18 10:10:02 2011 +0100

svm: implement INVLPG part of DecodeAssist

Newer SVM implementations (Bulldozer) give the desired address on
a INVLPG intercept explicitly in the EXITINFO1 field of the VMCB.
Use this address to avoid a costly instruction fetch and decode
cycle.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
xen-unstable changeset:   23236:e324c4d1dd6e
xen-unstable date:        Mon Apr 18 10:06:37 2011 +0100

svm: implement CR access part of DecodeAssist

Newer SVM implementations (Bulldozer) now give the used general
purpose register on a MOV-CR intercept explictly. This avoids
fetching and decoding the instruction from guest's memory and speeds
up some Windows guest, which exercise CR8 quite often.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23235:2c8ad607ece1
xen-unstable date:        Mon Apr 18 10:01:06 2011 +0100

svm: add bit definitions for SVM DecodeAssist

Chapter 15.33 of recent APM Vol.2 manuals describe some additions
to SVM called DecodeAssist. Add the newly added fields to the VMCB
structure and name the associated CPUID bit.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
xen-unstable changeset:   23234:bf7afd48339a
xen-unstable date:        Mon Apr 18 09:49:13 2011 +0100

vmx/hvm: move mov-cr handling functions to generic HVM code

Currently the handling of CR accesses intercepts is done much
differently in SVM and VMX. For future usage move the VMX part
into the generic HVM path and use the exported functions.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23233:1276926e3795
xen-unstable date:        Mon Apr 18 09:47:12 2011 +0100
---


diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/emulate.c	Thu Apr 12 09:06:02 2012 +0100
@@ -996,6 +996,8 @@ int hvm_emulate_one(
 
     hvmemul_ctxt->insn_buf_eip = regs->eip;
     hvmemul_ctxt->insn_buf_bytes =
+        hvm_get_insn_bytes(curr, hvmemul_ctxt->insn_buf)
+        ? :
         (hvm_virtual_to_linear_addr(
             x86_seg_cs, &hvmemul_ctxt->seg_reg[x86_seg_cs],
             regs->eip, sizeof(hvmemul_ctxt->insn_buf),
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Thu Apr 12 09:06:02 2012 +0100
@@ -1306,6 +1306,86 @@ static void hvm_set_uc_mode(struct vcpu 
         return hvm_funcs.set_uc_mode(v);
 }
 
+int hvm_mov_to_cr(unsigned int cr, unsigned int gpr)
+{
+    struct vcpu *curr = current;
+    unsigned long val, *reg;
+
+    if ( (reg = get_x86_gpr(guest_cpu_user_regs(), gpr)) == NULL )
+    {
+        gdprintk(XENLOG_ERR, "invalid gpr: %u\n", gpr);
+        goto exit_and_crash;
+    }
+
+    val = *reg;
+    HVMTRACE_LONG_2D(CR_WRITE, cr, TRC_PAR_LONG(val));
+    HVM_DBG_LOG(DBG_LEVEL_1, "CR%u, value = %lx", cr, val);
+
+    switch ( cr )
+    {
+    case 0:
+        return hvm_set_cr0(val);
+
+    case 3:
+        return hvm_set_cr3(val);
+
+    case 4:
+        return hvm_set_cr4(val);
+
+    case 8:
+        vlapic_set_reg(vcpu_vlapic(curr), APIC_TASKPRI, ((val & 0x0f) << 4));
+        break;
+
+    default:
+        gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
+        goto exit_and_crash;
+    }
+
+    return X86EMUL_OKAY;
+
+ exit_and_crash:
+    domain_crash(curr->domain);
+    return X86EMUL_UNHANDLEABLE;
+}
+
+int hvm_mov_from_cr(unsigned int cr, unsigned int gpr)
+{
+    struct vcpu *curr = current;
+    unsigned long val = 0, *reg;
+
+    if ( (reg = get_x86_gpr(guest_cpu_user_regs(), gpr)) == NULL )
+    {
+        gdprintk(XENLOG_ERR, "invalid gpr: %u\n", gpr);
+        goto exit_and_crash;
+    }
+
+    switch ( cr )
+    {
+    case 0:
+    case 2:
+    case 3:
+    case 4:
+        val = curr->arch.hvm_vcpu.guest_cr[cr];
+        break;
+    case 8:
+        val = (vlapic_get_reg(vcpu_vlapic(curr), APIC_TASKPRI) & 0xf0) >> 4;
+        break;
+    default:
+        gdprintk(XENLOG_ERR, "invalid cr: %u\n", cr);
+        goto exit_and_crash;
+    }
+
+    *reg = val;
+    HVMTRACE_LONG_2D(CR_READ, cr, TRC_PAR_LONG(val));
+    HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR%u, value = %lx", cr, val);
+
+    return X86EMUL_OKAY;
+
+ exit_and_crash:
+    domain_crash(curr->domain);
+    return X86EMUL_UNHANDLEABLE;
+}
+
 int hvm_set_cr0(unsigned long value)
 {
     struct vcpu *v = current;
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:06:02 2012 +0100
@@ -603,6 +603,21 @@ static void svm_set_rdtsc_exiting(struct
     vmcb_set_general1_intercepts(vmcb, general1_intercepts);
 }
 
+static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
+{
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    unsigned int len = v->arch.hvm_svm.cached_insn_len;
+
+    if ( len != 0 )
+    {
+        /* Latch and clear the cached instruction. */
+        memcpy(buf, vmcb->guest_ins, 15);
+        v->arch.hvm_svm.cached_insn_len = 0;
+    }
+
+    return len;
+}
+
 static void svm_init_hypercall_page(struct domain *d, void *hypercall_page)
 {
     char *p;
@@ -928,11 +943,16 @@ struct hvm_function_table * __init start
 
     printk("SVM: Supported advanced features:\n");
 
+    /* DecodeAssists fast paths assume nextrip is valid for fast rIP update. */
+    if ( !cpu_has_svm_nrips )
+        clear_bit(SVM_FEATURE_DECODEASSISTS, &svm_feature_flags);
+
 #define P(p,s) if ( p ) { printk(" - %s\n", s); printed = 1; }
     P(cpu_has_svm_npt, "Nested Page Tables (NPT)");
     P(cpu_has_svm_lbrv, "Last Branch Record (LBR) Virtualisation");
     P(cpu_has_svm_nrips, "Next-RIP Saved on #VMEXIT");
     P(cpu_has_svm_cleanbits, "VMCB Clean Bits");
+    P(cpu_has_svm_decode, "DecodeAssists");
     P(cpu_has_pause_filter, "Pause-Intercept Filter");
 #undef P
 
@@ -1034,6 +1054,22 @@ static void svm_vmexit_do_cpuid(struct c
     __update_guest_eip(regs, inst_len);
 }
 
+static void svm_vmexit_do_cr_access(
+    struct vmcb_struct *vmcb, struct cpu_user_regs *regs)
+{
+    int gp, cr, dir, rc;
+
+    cr = vmcb->exitcode - VMEXIT_CR0_READ;
+    dir = (cr > 15);
+    cr &= 0xf;
+    gp = vmcb->exitinfo1 & 0xf;
+
+    rc = dir ? hvm_mov_to_cr(cr, gp) : hvm_mov_from_cr(cr, gp);
+
+    if ( rc == X86EMUL_OKAY )
+        __update_guest_eip(regs, vmcb->nextrip - vmcb->rip);
+}
+
 static void svm_dr_access(struct vcpu *v, struct cpu_user_regs *regs)
 {
     HVMTRACE_0D(DR_WRITE);
@@ -1427,7 +1463,8 @@ static struct hvm_function_table __read_
     .msr_read_intercept   = svm_msr_read_intercept,
     .msr_write_intercept  = svm_msr_write_intercept,
     .invlpg_intercept     = svm_invlpg_intercept,
-    .set_rdtsc_exiting    = svm_set_rdtsc_exiting
+    .set_rdtsc_exiting    = svm_set_rdtsc_exiting,
+    .get_insn_bytes       = svm_get_insn_bytes,
 };
 
 asmlinkage void svm_vmexit_handler(struct cpu_user_regs *regs)
@@ -1533,7 +1570,12 @@ asmlinkage void svm_vmexit_handler(struc
                     (unsigned long)regs->ecx, (unsigned long)regs->edx,
                     (unsigned long)regs->esi, (unsigned long)regs->edi);
 
-        if ( paging_fault(va, regs) )
+        if ( cpu_has_svm_decode )
+            v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
+        rc = paging_fault(va, regs);
+        v->arch.hvm_svm.cached_insn_len = 0;
+
+        if ( rc )
         {
             if ( trace_will_trace_event(TRC_SHADOW) )
                 break;
@@ -1615,12 +1657,29 @@ asmlinkage void svm_vmexit_handler(struc
             int dir = (vmcb->exitinfo1 & 1) ? IOREQ_READ : IOREQ_WRITE;
             if ( handle_pio(port, bytes, dir) )
                 __update_guest_eip(regs, vmcb->exitinfo2 - vmcb->rip);
-            break;
         }
-        /* fallthrough to emulation if a string instruction */
+        else if ( !handle_mmio() )
+            hvm_inject_exception(TRAP_gp_fault, 0, 0);
+        break;
+
     case VMEXIT_CR0_READ ... VMEXIT_CR15_READ:
     case VMEXIT_CR0_WRITE ... VMEXIT_CR15_WRITE:
+        if ( cpu_has_svm_decode && (vmcb->exitinfo1 & (1ULL << 63)) )
+            svm_vmexit_do_cr_access(vmcb, regs);
+        else if ( !handle_mmio() ) 
+            hvm_inject_exception(TRAP_gp_fault, 0, 0);
+        break;
+
     case VMEXIT_INVLPG:
+        if ( cpu_has_svm_decode )
+        {
+            svm_invlpg_intercept(vmcb->exitinfo1);
+            __update_guest_eip(regs, vmcb->nextrip - vmcb->rip);
+        }
+        else if ( !handle_mmio() )
+            hvm_inject_exception(TRAP_gp_fault, 0, 0);
+        break;
+
     case VMEXIT_INVLPGA:
         if ( !handle_mmio() )
             hvm_inject_exception(TRAP_gp_fault, 0, 0);
@@ -1680,7 +1739,10 @@ asmlinkage void svm_vmexit_handler(struc
     case VMEXIT_NPF:
         perfc_incra(svmexits, VMEXIT_NPF_PERFC);
         regs->error_code = vmcb->exitinfo1;
+        if ( cpu_has_svm_decode )
+            v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
         svm_do_nested_pgfault(vmcb->exitinfo2);
+        v->arch.hvm_svm.cached_insn_len = 0;
         break;
 
     case VMEXIT_IRET: {
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Apr 12 09:06:02 2012 +0100
@@ -1545,182 +1545,42 @@ static void vmx_invlpg_intercept(unsigne
         vpid_sync_vcpu_gva(curr, vaddr);
 }
 
-#define CASE_SET_REG(REG, reg)      \
-    case VMX_CONTROL_REG_ACCESS_GPR_ ## REG: regs->reg = value; break
-#define CASE_GET_REG(REG, reg)      \
-    case VMX_CONTROL_REG_ACCESS_GPR_ ## REG: value = regs->reg; break
+static int vmx_cr_access(unsigned long exit_qualification)
+{
+    struct vcpu *curr = current;
 
-#define CASE_EXTEND_SET_REG         \
-    CASE_EXTEND_REG(S)
-#define CASE_EXTEND_GET_REG         \
-    CASE_EXTEND_REG(G)
-
-#ifdef __i386__
-#define CASE_EXTEND_REG(T)
-#else
-#define CASE_EXTEND_REG(T)          \
-    CASE_ ## T ## ET_REG(R8, r8);   \
-    CASE_ ## T ## ET_REG(R9, r9);   \
-    CASE_ ## T ## ET_REG(R10, r10); \
-    CASE_ ## T ## ET_REG(R11, r11); \
-    CASE_ ## T ## ET_REG(R12, r12); \
-    CASE_ ## T ## ET_REG(R13, r13); \
-    CASE_ ## T ## ET_REG(R14, r14); \
-    CASE_ ## T ## ET_REG(R15, r15)
-#endif
-
-static int mov_to_cr(int gp, int cr, struct cpu_user_regs *regs)
-{
-    unsigned long value;
-    struct vcpu *v = current;
-    struct vlapic *vlapic = vcpu_vlapic(v);
-    int rc = 0;
-    unsigned long old;
-
-    switch ( gp )
+    switch ( VMX_CONTROL_REG_ACCESS_TYPE(exit_qualification) )
     {
-    CASE_GET_REG(EAX, eax);
-    CASE_GET_REG(ECX, ecx);
-    CASE_GET_REG(EDX, edx);
-    CASE_GET_REG(EBX, ebx);
-    CASE_GET_REG(EBP, ebp);
-    CASE_GET_REG(ESI, esi);
-    CASE_GET_REG(EDI, edi);
-    CASE_GET_REG(ESP, esp);
-    CASE_EXTEND_GET_REG;
-    default:
-        gdprintk(XENLOG_ERR, "invalid gp: %d\n", gp);
-        goto exit_and_crash;
+    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR: {
+        unsigned long gp = VMX_CONTROL_REG_ACCESS_GPR(exit_qualification);
+        unsigned long cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification);
+        return hvm_mov_to_cr(cr, gp);
     }
-
-    HVMTRACE_LONG_2D(CR_WRITE, cr, TRC_PAR_LONG(value));
-
-    HVM_DBG_LOG(DBG_LEVEL_1, "CR%d, value = %lx", cr, value);
-
-    switch ( cr )
-    {
-    case 0:
-        old = v->arch.hvm_vcpu.guest_cr[0];
-        rc = !hvm_set_cr0(value);
-        if (rc)
-            hvm_memory_event_cr0(value, old);
-        return rc;
-
-    case 3:
-        old = v->arch.hvm_vcpu.guest_cr[3];
-        rc = !hvm_set_cr3(value);
-        if (rc)
-            hvm_memory_event_cr3(value, old);        
-        return rc;
-
-    case 4:
-        old = v->arch.hvm_vcpu.guest_cr[4];
-        rc = !hvm_set_cr4(value);
-        if (rc)
-            hvm_memory_event_cr4(value, old);
-        return rc; 
-
-    case 8:
-        vlapic_set_reg(vlapic, APIC_TASKPRI, ((value & 0x0F) << 4));
-        break;
-
-    default:
-        gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
-        goto exit_and_crash;
+    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR: {
+        unsigned long gp = VMX_CONTROL_REG_ACCESS_GPR(exit_qualification);
+        unsigned long cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification);
+        return hvm_mov_from_cr(cr, gp);
     }
-
-    return 1;
-
- exit_and_crash:
-    domain_crash(v->domain);
-    return 0;
-}
-
-/*
- * Read from control registers. CR0 and CR4 are read from the shadow.
- */
-static void mov_from_cr(int cr, int gp, struct cpu_user_regs *regs)
-{
-    unsigned long value = 0;
-    struct vcpu *v = current;
-    struct vlapic *vlapic = vcpu_vlapic(v);
-
-    switch ( cr )
-    {
-    case 3:
-        value = (unsigned long)v->arch.hvm_vcpu.guest_cr[3];
-        break;
-    case 8:
-        value = (unsigned long)vlapic_get_reg(vlapic, APIC_TASKPRI);
-        value = (value & 0xF0) >> 4;
-        break;
-    default:
-        gdprintk(XENLOG_ERR, "invalid cr: %d\n", cr);
-        domain_crash(v->domain);
-        break;
-    }
-
-    switch ( gp ) {
-    CASE_SET_REG(EAX, eax);
-    CASE_SET_REG(ECX, ecx);
-    CASE_SET_REG(EDX, edx);
-    CASE_SET_REG(EBX, ebx);
-    CASE_SET_REG(EBP, ebp);
-    CASE_SET_REG(ESI, esi);
-    CASE_SET_REG(EDI, edi);
-    CASE_SET_REG(ESP, esp);
-    CASE_EXTEND_SET_REG;
-    default:
-        printk("invalid gp: %d\n", gp);
-        domain_crash(v->domain);
-        break;
-    }
-
-    HVMTRACE_LONG_2D(CR_READ, cr, TRC_PAR_LONG(value));
-
-    HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR%d, value = %lx", cr, value);
-}
-
-static int vmx_cr_access(unsigned long exit_qualification,
-                         struct cpu_user_regs *regs)
-{
-    unsigned int gp, cr;
-    unsigned long value;
-    struct vcpu *v = current;
-
-    switch ( exit_qualification & VMX_CONTROL_REG_ACCESS_TYPE )
-    {
-    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR:
-        gp = exit_qualification & VMX_CONTROL_REG_ACCESS_GPR;
-        cr = exit_qualification & VMX_CONTROL_REG_ACCESS_NUM;
-        return mov_to_cr(gp, cr, regs);
-    case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR:
-        gp = exit_qualification & VMX_CONTROL_REG_ACCESS_GPR;
-        cr = exit_qualification & VMX_CONTROL_REG_ACCESS_NUM;
-        mov_from_cr(cr, gp, regs);
-        break;
-    case VMX_CONTROL_REG_ACCESS_TYPE_CLTS: 
-    {
-        unsigned long old = v->arch.hvm_vcpu.guest_cr[0];
-        v->arch.hvm_vcpu.guest_cr[0] &= ~X86_CR0_TS;
-        vmx_update_guest_cr(v, 0);
-
-        hvm_memory_event_cr0(v->arch.hvm_vcpu.guest_cr[0], old);
-
+    case VMX_CONTROL_REG_ACCESS_TYPE_CLTS: {
+        unsigned long old = curr->arch.hvm_vcpu.guest_cr[0];
+        curr->arch.hvm_vcpu.guest_cr[0] &= ~X86_CR0_TS;
+        vmx_update_guest_cr(curr, 0);
+        hvm_memory_event_cr0(curr->arch.hvm_vcpu.guest_cr[0], old);
         HVMTRACE_0D(CLTS);
         break;
     }
-    case VMX_CONTROL_REG_ACCESS_TYPE_LMSW:
-        value = v->arch.hvm_vcpu.guest_cr[0];
+    case VMX_CONTROL_REG_ACCESS_TYPE_LMSW: {
+        unsigned long value = curr->arch.hvm_vcpu.guest_cr[0];
         /* LMSW can: (1) set bits 0-3; (2) clear bits 1-3. */
         value = (value & ~0xe) | ((exit_qualification >> 16) & 0xf);
         HVMTRACE_LONG_1D(LMSW, value);
-        return !hvm_set_cr0(value);
+        return hvm_set_cr0(value);
+    }
     default:
         BUG();
     }
 
-    return 1;
+    return X86EMUL_OKAY;
 }
 
 static const struct lbr_info {
@@ -2525,7 +2385,7 @@ asmlinkage void vmx_vmexit_handler(struc
     case EXIT_REASON_CR_ACCESS:
     {
         exit_qualification = __vmread(EXIT_QUALIFICATION);
-        if ( vmx_cr_access(exit_qualification, regs) )
+        if ( vmx_cr_access(exit_qualification) == X86EMUL_OKAY )
             update_guest_eip(); /* Safe: MOV Cn, LMSW, CLTS */
         break;
     }
diff -r 80130491806f -r 0aa6bc8f38a9 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/arch/x86/traps.c	Thu Apr 12 09:06:02 2012 +0100
@@ -368,6 +368,36 @@ void vcpu_show_execution_state(struct vc
     vcpu_unpause(v);
 }
 
+unsigned long *get_x86_gpr(struct cpu_user_regs *regs, unsigned int modrm_reg)
+{
+    void *p;
+
+    switch ( modrm_reg )
+    {
+    case  0: p = &regs->eax; break;
+    case  1: p = &regs->ecx; break;
+    case  2: p = &regs->edx; break;
+    case  3: p = &regs->ebx; break;
+    case  4: p = &regs->esp; break;
+    case  5: p = &regs->ebp; break;
+    case  6: p = &regs->esi; break;
+    case  7: p = &regs->edi; break;
+#if defined(__x86_64__)
+    case  8: p = &regs->r8;  break;
+    case  9: p = &regs->r9;  break;
+    case 10: p = &regs->r10; break;
+    case 11: p = &regs->r11; break;
+    case 12: p = &regs->r12; break;
+    case 13: p = &regs->r13; break;
+    case 14: p = &regs->r14; break;
+    case 15: p = &regs->r15; break;
+#endif
+    default: p = NULL; break;
+    }
+
+    return p;
+}
+
 static char *trapstr(int trapnr)
 {
     static char *strings[] = { 
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h	Thu Apr 12 09:06:02 2012 +0100
@@ -132,6 +132,9 @@ struct hvm_function_table {
     int  (*cpu_up)(void);
     void (*cpu_down)(void);
 
+    /* Copy up to 15 bytes from cached instruction bytes at current rIP. */
+    unsigned int (*get_insn_bytes)(struct vcpu *v, uint8_t *buf);
+
     /* Instruction intercepts: non-void return values are X86EMUL codes. */
     void (*cpuid_intercept)(
         unsigned int *eax, unsigned int *ebx,
@@ -328,6 +331,11 @@ static inline void hvm_cpu_down(void)
         hvm_funcs.cpu_down();
 }
 
+static inline unsigned int hvm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
+{
+    return (hvm_funcs.get_insn_bytes ? hvm_funcs.get_insn_bytes(v, buf) : 0);
+}
+
 enum hvm_task_switch_reason { TSW_jmp, TSW_iret, TSW_call_or_int };
 void hvm_task_switch(
     uint16_t tss_sel, enum hvm_task_switch_reason taskswitch_reason,
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/support.h	Thu Apr 12 09:06:02 2012 +0100
@@ -137,5 +137,7 @@ int hvm_set_cr3(unsigned long value);
 int hvm_set_cr4(unsigned long value);
 int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content);
 int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content);
+int hvm_mov_to_cr(unsigned int cr, unsigned int gpr);
+int hvm_mov_from_cr(unsigned int cr, unsigned int gpr);
 
 #endif /* __ASM_X86_HVM_SUPPORT_H__ */
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/svm/svm.h	Thu Apr 12 09:06:02 2012 +0100
@@ -80,6 +80,7 @@ extern u32 svm_feature_flags;
 #define cpu_has_svm_svml      cpu_has_svm_feature(SVM_FEATURE_SVML)
 #define cpu_has_svm_nrips     cpu_has_svm_feature(SVM_FEATURE_NRIPS)
 #define cpu_has_svm_cleanbits cpu_has_svm_feature(SVM_FEATURE_VMCBCLEAN)
+#define cpu_has_svm_decode    cpu_has_svm_feature(SVM_FEATURE_DECODEASSISTS)
 #define cpu_has_pause_filter  cpu_has_svm_feature(SVM_FEATURE_PAUSEFILTER)
 
 #endif /* __ASM_X86_HVM_SVM_H__ */
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h	Thu Apr 12 09:06:02 2012 +0100
@@ -432,7 +432,9 @@ struct vmcb_struct {
     vmcbcleanbits_t cleanbits;  /* offset 0xC0 */
     u32 res09;                  /* offset 0xC4 */
     u64 nextrip;                /* offset 0xC8 */
-    u64 res10a[102];            /* offset 0xD0 pad to save area */
+    u8  guest_ins_len;          /* offset 0xD0 */
+    u8  guest_ins[15];          /* offset 0xD1 */
+    u64 res10a[100];            /* offset 0xE0 pad to save area */
 
     svm_segment_register_t es;  /* offset 1024 - cleanbit 8 */
     svm_segment_register_t cs;  /* cleanbit 8 */
@@ -496,6 +498,9 @@ struct arch_svm_struct {
     int    launch_core;
     bool_t vmcb_in_sync;    /* VMCB sync'ed with VMSAVE? */
 
+    /* VMCB has a cached instruction from #PF/#NPF Decode Assist? */
+    uint8_t cached_insn_len; /* Zero if no cached instruction. */
+
     /* Upper four bytes are undefined in the VMCB, therefore we can't
      * use the fields in the VMCB. Write a 64bit value and then read a 64bit
      * value is fine unless there's a VMRUN/VMEXIT in between which clears
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Thu Apr 12 09:06:02 2012 +0100
@@ -144,31 +144,15 @@ void vmx_update_cpu_exec_control(struct 
  * Exit Qualifications for MOV for Control Register Access
  */
  /* 3:0 - control register number (CRn) */
-#define VMX_CONTROL_REG_ACCESS_NUM      0xf
+#define VMX_CONTROL_REG_ACCESS_NUM(eq)  ((eq) & 0xf)
  /* 5:4 - access type (CR write, CR read, CLTS, LMSW) */
-#define VMX_CONTROL_REG_ACCESS_TYPE     0x30
+#define VMX_CONTROL_REG_ACCESS_TYPE(eq) (((eq) >> 4) & 0x3)
+# define VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR   0
+# define VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR 1
+# define VMX_CONTROL_REG_ACCESS_TYPE_CLTS        2
+# define VMX_CONTROL_REG_ACCESS_TYPE_LMSW        3
  /* 10:8 - general purpose register operand */
-#define VMX_CONTROL_REG_ACCESS_GPR      0xf00
-#define VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR   (0 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR (1 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_CLTS        (2 << 4)
-#define VMX_CONTROL_REG_ACCESS_TYPE_LMSW        (3 << 4)
-#define VMX_CONTROL_REG_ACCESS_GPR_EAX  (0 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ECX  (1 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EDX  (2 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EBX  (3 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ESP  (4 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EBP  (5 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_ESI  (6 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_EDI  (7 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R8   (8 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R9   (9 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R10  (10 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R11  (11 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R12  (12 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R13  (13 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R14  (14 << 8)
-#define VMX_CONTROL_REG_ACCESS_GPR_R15  (15 << 8)
+#define VMX_CONTROL_REG_ACCESS_GPR(eq)  (((eq) >> 8) & 0xf)
 
 /*
  * Access Rights
diff -r 80130491806f -r 0aa6bc8f38a9 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Wed Apr 11 19:41:14 2012 +0100
+++ b/xen/include/asm-x86/processor.h	Thu Apr 12 09:06:02 2012 +0100
@@ -593,6 +593,8 @@ int wrmsr_hypervisor_regs(uint32_t idx, 
 int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
 int microcode_resume_cpu(int cpu);
 
+unsigned long *get_x86_gpr(struct cpu_user_regs *regs, unsigned int modrm_reg);
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_X86_PROCESSOR_H */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIeEk-0007SK-AL; Fri, 13 Apr 2012 11:00: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 1SIeEi-0007S6-V7
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:17 +0000
Received: from [193.109.254.147:51265] by server-8.bemta-14.messagelabs.com id
	0B/1F-23244-047088F4; Fri, 13 Apr 2012 11:00:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1334314813!4476275!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1494 invoked from network); 13 Apr 2012 11:00:14 -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 Apr 2012 11: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 1SIeEf-00009Q-4u
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEc-0004Zp-Rp
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:11 +0000
Message-Id: <E1SIeEc-0004Zp-Rp@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:10 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86: fix delta calculation in TSC
	deadline timer emulation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1334169674 -3600
# Node ID 80130491806f42cfe9c8b93b755c3852ae55733d
# Parent  6f224431eca2ecea490fdcbd401942de5b20c3dd
x86: fix delta calculation in TSC deadline timer emulation

In the virtual LAPIC, correct the delta calculation when emulating the
TSC deadline timer.

Without this fix, XenServer (which is based on Xen 4.1) does not work
when running as an HVM guest.  dom0 fails to boot because its timer
interrupts are very delayed (by several minutes in some cases).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25191:a95fc7decc83
xen-unstable date:        Wed Apr 11 16:49:45 2012 +0100
---


diff -r 6f224431eca2 -r 80130491806f xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c	Wed Apr 04 16:09:25 2012 +0100
+++ b/xen/arch/x86/hvm/vlapic.c	Wed Apr 11 19:41:14 2012 +0100
@@ -889,7 +889,6 @@ uint64_t  vlapic_tdt_msr_get(struct vlap
 void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value)
 {
     uint64_t guest_tsc;
-    uint64_t guest_time;
     struct vcpu *v = vlapic_vcpu(vlapic);
 
     /* may need to exclude some other conditions like vlapic->hw.disabled */
@@ -901,12 +900,10 @@ void vlapic_tdt_msr_set(struct vlapic *v
     
     /* new_value = 0, >0 && <= now, > now */
     guest_tsc = hvm_get_guest_tsc(v);
-    guest_time = hvm_get_guest_time(v);
     if ( value > guest_tsc )
     {
-        uint64_t delta = value - v->arch.hvm_vcpu.cache_tsc_offset;
-        delta = gtsc_to_gtime(v->domain, delta);
-        delta = max_t(s64, delta - guest_time, 0);
+        uint64_t delta = gtsc_to_gtime(v->domain, value - guest_tsc);
+        delta = max_t(s64, delta, 0);
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "delta[0x%016"PRIx64"]", delta);
 
@@ -940,9 +937,8 @@ void vlapic_tdt_msr_set(struct vlapic *v
 
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
                 "tdt_msr[0x%016"PRIx64"],"
-                " gtsc[0x%016"PRIx64"],"
-                " gtime[0x%016"PRIx64"]",
-                vlapic->hw.tdt_msr, guest_tsc, guest_time);
+                " gtsc[0x%016"PRIx64"]",
+                vlapic->hw.tdt_msr, guest_tsc);
 }
 
 static int __vlapic_accept_pic_intr(struct vcpu *v)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIeEk-0007SK-AL; Fri, 13 Apr 2012 11:00: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 1SIeEi-0007S6-V7
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:17 +0000
Received: from [193.109.254.147:51265] by server-8.bemta-14.messagelabs.com id
	0B/1F-23244-047088F4; Fri, 13 Apr 2012 11:00:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1334314813!4476275!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1494 invoked from network); 13 Apr 2012 11:00:14 -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 Apr 2012 11: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 1SIeEf-00009Q-4u
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEc-0004Zp-Rp
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:11 +0000
Message-Id: <E1SIeEc-0004Zp-Rp@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:10 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86: fix delta calculation in TSC
	deadline timer emulation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1334169674 -3600
# Node ID 80130491806f42cfe9c8b93b755c3852ae55733d
# Parent  6f224431eca2ecea490fdcbd401942de5b20c3dd
x86: fix delta calculation in TSC deadline timer emulation

In the virtual LAPIC, correct the delta calculation when emulating the
TSC deadline timer.

Without this fix, XenServer (which is based on Xen 4.1) does not work
when running as an HVM guest.  dom0 fails to boot because its timer
interrupts are very delayed (by several minutes in some cases).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25191:a95fc7decc83
xen-unstable date:        Wed Apr 11 16:49:45 2012 +0100
---


diff -r 6f224431eca2 -r 80130491806f xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c	Wed Apr 04 16:09:25 2012 +0100
+++ b/xen/arch/x86/hvm/vlapic.c	Wed Apr 11 19:41:14 2012 +0100
@@ -889,7 +889,6 @@ uint64_t  vlapic_tdt_msr_get(struct vlap
 void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value)
 {
     uint64_t guest_tsc;
-    uint64_t guest_time;
     struct vcpu *v = vlapic_vcpu(vlapic);
 
     /* may need to exclude some other conditions like vlapic->hw.disabled */
@@ -901,12 +900,10 @@ void vlapic_tdt_msr_set(struct vlapic *v
     
     /* new_value = 0, >0 && <= now, > now */
     guest_tsc = hvm_get_guest_tsc(v);
-    guest_time = hvm_get_guest_time(v);
     if ( value > guest_tsc )
     {
-        uint64_t delta = value - v->arch.hvm_vcpu.cache_tsc_offset;
-        delta = gtsc_to_gtime(v->domain, delta);
-        delta = max_t(s64, delta - guest_time, 0);
+        uint64_t delta = gtsc_to_gtime(v->domain, value - guest_tsc);
+        delta = max_t(s64, delta, 0);
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "delta[0x%016"PRIx64"]", delta);
 
@@ -940,9 +937,8 @@ void vlapic_tdt_msr_set(struct vlapic *v
 
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
                 "tdt_msr[0x%016"PRIx64"],"
-                " gtsc[0x%016"PRIx64"],"
-                " gtime[0x%016"PRIx64"]",
-                vlapic->hw.tdt_msr, guest_tsc, guest_time);
+                " gtsc[0x%016"PRIx64"]",
+                vlapic->hw.tdt_msr, guest_tsc);
 }
 
 static int __vlapic_accept_pic_intr(struct vcpu *v)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 11: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 1SIeEn-0007Sq-Hu; Fri, 13 Apr 2012 11: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 1SIeEl-0007SX-SE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:20 +0000
Received: from [193.109.254.147:28812] by server-11.bemta-14.messagelabs.com
	id 97/87-05858-347088F4; Fri, 13 Apr 2012 11:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334314814!1972132!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2342 invoked from network); 13 Apr 2012 11:00:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 11:00: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 1SIeEg-00009W-5Z
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEg-0004aP-0k
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Message-Id: <E1SIeEg-0004aP-0k@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] hvm: vpmu: Add support for AMD
	Family 15h processors
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jacob Shin <jacob.shin@amd.com>
# Date 1334218093 -3600
# Node ID 7d9df818d302a593ab2e1b3e795ee8f369af96ae
# Parent  0aa6bc8f38a9a270f910f37e664ea6fcbece0073
hvm: vpmu: Add support for AMD Family 15h processors

AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates HVM VPMU
to take advantage of the new counters.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
xen-unstable changeset:   23306:e787d4f2e5ac
xen-unstable date:        Mon May 09 09:54:46 2011 +0100

xenoprof: Add support for AMD Family 15h processors

AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates xenoprof
to take advantage of the new counters.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>

Rename fam15h -> amd_fam15h in a few places, as suggested by Jan
Beulich.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23305:014ee4e09644
xen-unstable date:        Mon May 09 09:53:07 2011 +0100

xenoprof: Update cpu_type to sync with upstream oprofile

Update xenoprof's cpu_type to match upstream oprofile. Currently AMD
Family 11h ~ Family 15h are broken due to string mismatches.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
xen-unstable changeset:   23304:8981b582be3e
xen-unstable date:        Mon May 09 09:49:14 2011 +0100
---


diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:08:13 2012 +0100
@@ -1142,6 +1142,18 @@ static int svm_msr_read_intercept(unsign
     case MSR_K7_EVNTSEL1:
     case MSR_K7_EVNTSEL2:
     case MSR_K7_EVNTSEL3:
+    case MSR_AMD_FAM15H_PERFCTR0:
+    case MSR_AMD_FAM15H_PERFCTR1:
+    case MSR_AMD_FAM15H_PERFCTR2:
+    case MSR_AMD_FAM15H_PERFCTR3:
+    case MSR_AMD_FAM15H_PERFCTR4:
+    case MSR_AMD_FAM15H_PERFCTR5:
+    case MSR_AMD_FAM15H_EVNTSEL0:
+    case MSR_AMD_FAM15H_EVNTSEL1:
+    case MSR_AMD_FAM15H_EVNTSEL2:
+    case MSR_AMD_FAM15H_EVNTSEL3:
+    case MSR_AMD_FAM15H_EVNTSEL4:
+    case MSR_AMD_FAM15H_EVNTSEL5:
         vpmu_do_rdmsr(msr, msr_content);
         break;
 
@@ -1237,6 +1249,18 @@ static int svm_msr_write_intercept(unsig
     case MSR_K7_EVNTSEL1:
     case MSR_K7_EVNTSEL2:
     case MSR_K7_EVNTSEL3:
+    case MSR_AMD_FAM15H_PERFCTR0:
+    case MSR_AMD_FAM15H_PERFCTR1:
+    case MSR_AMD_FAM15H_PERFCTR2:
+    case MSR_AMD_FAM15H_PERFCTR3:
+    case MSR_AMD_FAM15H_PERFCTR4:
+    case MSR_AMD_FAM15H_PERFCTR5:
+    case MSR_AMD_FAM15H_EVNTSEL0:
+    case MSR_AMD_FAM15H_EVNTSEL1:
+    case MSR_AMD_FAM15H_EVNTSEL2:
+    case MSR_AMD_FAM15H_EVNTSEL3:
+    case MSR_AMD_FAM15H_EVNTSEL4:
+    case MSR_AMD_FAM15H_EVNTSEL5:
         vpmu_do_wrmsr(msr, msr_content);
         break;
 
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/hvm/svm/vpmu.c
--- a/xen/arch/x86/hvm/svm/vpmu.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/hvm/svm/vpmu.c	Thu Apr 12 09:08:13 2012 +0100
@@ -36,7 +36,9 @@
 #include <public/hvm/save.h>
 #include <asm/hvm/vpmu.h>
 
-#define NUM_COUNTERS 4
+#define F10H_NUM_COUNTERS 4
+#define F15H_NUM_COUNTERS 6
+#define MAX_NUM_COUNTERS F15H_NUM_COUNTERS
 
 #define MSR_F10H_EVNTSEL_GO_SHIFT   40
 #define MSR_F10H_EVNTSEL_EN_SHIFT   22
@@ -47,6 +49,11 @@
 #define set_guest_mode(msr) (msr |= (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
 #define is_overflowed(msr) (!((msr) & (1ULL << (MSR_F10H_COUNTER_LENGTH-1))))
 
+static int __read_mostly num_counters = 0;
+static u32 __read_mostly *counters = NULL;
+static u32 __read_mostly *ctrls = NULL;
+static bool_t __read_mostly k7_counters_mirrored = 0;
+
 /* PMU Counter MSRs. */
 u32 AMD_F10H_COUNTERS[] = {
     MSR_K7_PERFCTR0,
@@ -63,10 +70,28 @@ u32 AMD_F10H_CTRLS[] = {
     MSR_K7_EVNTSEL3
 };
 
+u32 AMD_F15H_COUNTERS[] = {
+    MSR_AMD_FAM15H_PERFCTR0,
+    MSR_AMD_FAM15H_PERFCTR1,
+    MSR_AMD_FAM15H_PERFCTR2,
+    MSR_AMD_FAM15H_PERFCTR3,
+    MSR_AMD_FAM15H_PERFCTR4,
+    MSR_AMD_FAM15H_PERFCTR5
+};
+
+u32 AMD_F15H_CTRLS[] = {
+    MSR_AMD_FAM15H_EVNTSEL0,
+    MSR_AMD_FAM15H_EVNTSEL1,
+    MSR_AMD_FAM15H_EVNTSEL2,
+    MSR_AMD_FAM15H_EVNTSEL3,
+    MSR_AMD_FAM15H_EVNTSEL4,
+    MSR_AMD_FAM15H_EVNTSEL5
+};
+
 /* storage for context switching */
 struct amd_vpmu_context {
-    u64 counters[NUM_COUNTERS];
-    u64 ctrls[NUM_COUNTERS];
+    u64 counters[MAX_NUM_COUNTERS];
+    u64 ctrls[MAX_NUM_COUNTERS];
     u32 hw_lapic_lvtpc;
 };
 
@@ -78,10 +103,45 @@ static inline int get_pmu_reg_type(u32 a
     if ( (addr >= MSR_K7_PERFCTR0) && (addr <= MSR_K7_PERFCTR3) )
         return MSR_TYPE_COUNTER;
 
+    if ( (addr >= MSR_AMD_FAM15H_EVNTSEL0) &&
+         (addr <= MSR_AMD_FAM15H_PERFCTR5 ) )
+    {
+        if (addr & 1)
+            return MSR_TYPE_COUNTER;
+        else
+            return MSR_TYPE_CTRL;
+    }
+
     /* unsupported registers */
     return -1;
 }
 
+static inline u32 get_fam15h_addr(u32 addr)
+{
+    switch ( addr )
+    {
+    case MSR_K7_PERFCTR0:
+        return MSR_AMD_FAM15H_PERFCTR0;
+    case MSR_K7_PERFCTR1:
+        return MSR_AMD_FAM15H_PERFCTR1;
+    case MSR_K7_PERFCTR2:
+        return MSR_AMD_FAM15H_PERFCTR2;
+    case MSR_K7_PERFCTR3:
+        return MSR_AMD_FAM15H_PERFCTR3;
+    case MSR_K7_EVNTSEL0:
+        return MSR_AMD_FAM15H_EVNTSEL0;
+    case MSR_K7_EVNTSEL1:
+        return MSR_AMD_FAM15H_EVNTSEL1;
+    case MSR_K7_EVNTSEL2:
+        return MSR_AMD_FAM15H_EVNTSEL2;
+    case MSR_K7_EVNTSEL3:
+        return MSR_AMD_FAM15H_EVNTSEL3;
+    default:
+        break;
+    }
+
+    return addr;
+}
 
 static int amd_vpmu_do_interrupt(struct cpu_user_regs *regs)
 {
@@ -110,12 +170,12 @@ static inline void context_restore(struc
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        wrmsrl(AMD_F10H_CTRLS[i], ctxt->ctrls[i]);
+    for ( i = 0; i < num_counters; i++ )
+        wrmsrl(ctrls[i], ctxt->ctrls[i]);
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
+    for ( i = 0; i < num_counters; i++ )
     {
-        wrmsrl(AMD_F10H_COUNTERS[i], ctxt->counters[i]);
+        wrmsrl(counters[i], ctxt->counters[i]);
 
         /* Force an interrupt to allow guest reset the counter,
         if the value is positive */
@@ -147,11 +207,11 @@ static inline void context_save(struct v
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        rdmsrl(AMD_F10H_COUNTERS[i], ctxt->counters[i]);
+    for ( i = 0; i < num_counters; i++ )
+        rdmsrl(counters[i], ctxt->counters[i]);
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        rdmsrl(AMD_F10H_CTRLS[i], ctxt->ctrls[i]);
+    for ( i = 0; i < num_counters; i++ )
+        rdmsrl(ctrls[i], ctxt->ctrls[i]);
 }
 
 static void amd_vpmu_save(struct vcpu *v)
@@ -175,12 +235,18 @@ static void context_update(unsigned int 
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        if ( msr == AMD_F10H_COUNTERS[i] )
+    if ( k7_counters_mirrored &&
+        ((msr >= MSR_K7_EVNTSEL0) && (msr <= MSR_K7_PERFCTR3)) )
+    {
+        msr = get_fam15h_addr(msr);
+    }
+
+    for ( i = 0; i < num_counters; i++ )
+        if ( msr == counters[i] )
             ctxt->counters[i] = msr_content;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        if ( msr == AMD_F10H_CTRLS[i] )
+    for ( i = 0; i < num_counters; i++ )
+        if ( msr == ctrls[i] )
             ctxt->ctrls[i] = msr_content;
 
     ctxt->hw_lapic_lvtpc = apic_read(APIC_LVTPC);
@@ -235,10 +301,31 @@ static void amd_vpmu_initialise(struct v
 {
     struct amd_vpmu_context *ctxt = NULL;
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
+    __u8 family = current_cpu_data.x86;
 
     if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED )
         return;
 
+    if ( counters == NULL )
+    {
+         switch ( family )
+	 {
+	 case 0x15:
+	     num_counters = F15H_NUM_COUNTERS;
+	     counters = AMD_F15H_COUNTERS;
+	     ctrls = AMD_F15H_CTRLS;
+	     k7_counters_mirrored = 1;
+	     break;
+	 case 0x10:
+	 default:
+	     num_counters = F10H_NUM_COUNTERS;
+	     counters = AMD_F10H_COUNTERS;
+	     ctrls = AMD_F10H_CTRLS;
+	     k7_counters_mirrored = 0;
+	     break;
+	 }
+    }
+
     ctxt = xmalloc_bytes(sizeof(struct amd_vpmu_context));
 
     if ( !ctxt )
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/hvm/vpmu.c	Thu Apr 12 09:08:13 2012 +0100
@@ -101,6 +101,7 @@ void vpmu_initialise(struct vcpu *v)
         switch ( family )
         {
         case 0x10:
+        case 0x15:
             vpmu->arch_vpmu_ops = &amd_vpmu_ops;
             break;
         default:
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Apr 12 09:08:13 2012 +0100
@@ -30,7 +30,7 @@
 struct op_counter_config counter_config[OP_MAX_COUNTER];
 struct op_ibs_config ibs_config;
 
-static struct op_x86_model_spec const *__read_mostly model;
+struct op_x86_model_spec const *__read_mostly model;
 static struct op_msrs cpu_msrs[NR_CPUS];
 static unsigned long saved_lvtpc[NR_CPUS];
 
@@ -435,19 +435,19 @@ static int __init nmi_init(void)
 				break;
 			case 0x11:
 				model = &op_athlon_spec;
-				cpu_type = "x86-64/family11";
+				cpu_type = "x86-64/family11h";
 				break;
                         case 0x12:
 				model = &op_athlon_spec;
-				cpu_type = "x86-64/family12";
+				cpu_type = "x86-64/family12h";
 				break;
 			case 0x14:
                                 model = &op_athlon_spec;
-                                cpu_type = "x86-64/family14";
+                                cpu_type = "x86-64/family14h";
                                 break;
                         case 0x15:
-                                model = &op_athlon_spec;
-                                cpu_type = "x86-64/family15";
+                                model = &op_amd_fam15h_spec;
+                                cpu_type = "x86-64/family15h";
                                 break;
 			}
 			break;
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/oprofile/op_model_athlon.c
--- a/xen/arch/x86/oprofile/op_model_athlon.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/oprofile/op_model_athlon.c	Thu Apr 12 09:08:13 2012 +0100
@@ -24,8 +24,13 @@
 #include "op_x86_model.h"
 #include "op_counter.h"
 
-#define NUM_COUNTERS 4
-#define NUM_CONTROLS 4
+#define K7_NUM_COUNTERS 4
+#define K7_NUM_CONTROLS 4
+
+#define FAM15H_NUM_COUNTERS 6
+#define FAM15H_NUM_CONTROLS 6
+
+#define MAX_COUNTERS FAM15H_NUM_COUNTERS
 
 #define CTR_READ(msr_content,msrs,c) do {rdmsrl(msrs->counters[(c)].addr, (msr_content));} while (0)
 #define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1);} while (0)
@@ -44,9 +49,10 @@
 #define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 0x1ULL) << 41))
 #define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 0x1ULL) << 40))
 
-static unsigned long reset_value[NUM_COUNTERS];
+static unsigned long reset_value[MAX_COUNTERS];
 
 extern char svm_stgi_label[];
+extern struct op_x86_model_spec const *__read_mostly model;
 
 #ifdef CONFIG_X86_64
 u32 ibs_caps = 0;
@@ -175,26 +181,44 @@ static void athlon_fill_in_addresses(str
 	msrs->controls[3].addr = MSR_K7_EVNTSEL3;
 }
 
- 
+static void fam15h_fill_in_addresses(struct op_msrs * const msrs)
+{
+	msrs->counters[0].addr = MSR_AMD_FAM15H_PERFCTR0;
+	msrs->counters[1].addr = MSR_AMD_FAM15H_PERFCTR1;
+	msrs->counters[2].addr = MSR_AMD_FAM15H_PERFCTR2;
+	msrs->counters[3].addr = MSR_AMD_FAM15H_PERFCTR3;
+	msrs->counters[4].addr = MSR_AMD_FAM15H_PERFCTR4;
+	msrs->counters[5].addr = MSR_AMD_FAM15H_PERFCTR5;
+
+	msrs->controls[0].addr = MSR_AMD_FAM15H_EVNTSEL0;
+	msrs->controls[1].addr = MSR_AMD_FAM15H_EVNTSEL1;
+	msrs->controls[2].addr = MSR_AMD_FAM15H_EVNTSEL2;
+	msrs->controls[3].addr = MSR_AMD_FAM15H_EVNTSEL3;
+	msrs->controls[4].addr = MSR_AMD_FAM15H_EVNTSEL4;
+	msrs->controls[5].addr = MSR_AMD_FAM15H_EVNTSEL5;
+}
+
 static void athlon_setup_ctrs(struct op_msrs const * const msrs)
 {
 	uint64_t msr_content;
 	int i;
+	unsigned int const nr_ctrs = model->num_counters;
+	unsigned int const nr_ctrls = model->num_controls;
  
 	/* clear all counters */
-	for (i = 0 ; i < NUM_CONTROLS; ++i) {
+	for (i = 0 ; i < nr_ctrls; ++i) {
 		CTRL_READ(msr_content, msrs, i);
 		CTRL_CLEAR(msr_content);
 		CTRL_WRITE(msr_content, msrs, i);
 	}
 	
 	/* avoid a false detection of ctr overflows in NMI handler */
-	for (i = 0; i < NUM_COUNTERS; ++i) {
+	for (i = 0; i < nr_ctrs; ++i) {
 		CTR_WRITE(1, msrs, i);
 	}
 
 	/* enable active counters */
-	for (i = 0; i < NUM_COUNTERS; ++i) {
+	for (i = 0; i < nr_ctrs; ++i) {
 		if (counter_config[i].enabled) {
 			reset_value[i] = counter_config[i].count;
 
@@ -300,6 +324,7 @@ static int athlon_check_ctrs(unsigned in
 	int mode = 0;
 	struct vcpu *v = current;
 	struct cpu_user_regs *guest_regs = guest_cpu_user_regs();
+	unsigned int const nr_ctrs = model->num_counters;
 
 	if (!guest_mode(regs) &&
 	    (regs->eip == (unsigned long)svm_stgi_label)) {
@@ -312,7 +337,7 @@ static int athlon_check_ctrs(unsigned in
 		mode = xenoprofile_get_mode(v, regs);
 	}
 
-	for (i = 0 ; i < NUM_COUNTERS; ++i) {
+	for (i = 0 ; i < nr_ctrs; ++i) {
 		CTR_READ(msr_content, msrs, i);
 		if (CTR_OVERFLOWED(msr_content)) {
 			xenoprof_log_event(current, regs, eip, mode, i);
@@ -373,7 +398,8 @@ static void athlon_start(struct op_msrs 
 {
 	uint64_t msr_content;
 	int i;
-	for (i = 0 ; i < NUM_COUNTERS ; ++i) {
+	unsigned int const nr_ctrs = model->num_counters;
+	for (i = 0 ; i < nr_ctrs ; ++i) {
 		if (reset_value[i]) {
 			CTRL_READ(msr_content, msrs, i);
 			CTRL_SET_ACTIVE(msr_content);
@@ -401,10 +427,11 @@ static void athlon_stop(struct op_msrs c
 {
 	uint64_t msr_content;
 	int i;
+	unsigned int const nr_ctrs = model->num_counters;
 
 	/* Subtle: stop on all counters to avoid race with
 	 * setting our pm callback */
-	for (i = 0 ; i < NUM_COUNTERS ; ++i) {
+	for (i = 0 ; i < nr_ctrs ; ++i) {
 		CTRL_READ(msr_content, msrs, i);
 		CTRL_SET_INACTIVE(msr_content);
 		CTRL_WRITE(msr_content, msrs, i);
@@ -512,11 +539,21 @@ void __init ibs_init(void)
 #endif /* CONFIG_X86_64 */
 
 struct op_x86_model_spec const op_athlon_spec = {
-	.num_counters = NUM_COUNTERS,
-	.num_controls = NUM_CONTROLS,
+	.num_counters = K7_NUM_COUNTERS,
+	.num_controls = K7_NUM_CONTROLS,
 	.fill_in_addresses = &athlon_fill_in_addresses,
 	.setup_ctrs = &athlon_setup_ctrs,
 	.check_ctrs = &athlon_check_ctrs,
 	.start = &athlon_start,
 	.stop = &athlon_stop
 };
+
+struct op_x86_model_spec const op_amd_fam15h_spec = {
+	.num_counters = FAM15H_NUM_COUNTERS,
+	.num_controls = FAM15H_NUM_CONTROLS,
+	.fill_in_addresses = &fam15h_fill_in_addresses,
+	.setup_ctrs = &athlon_setup_ctrs,
+	.check_ctrs = &athlon_check_ctrs,
+	.start = &athlon_start,
+	.stop = &athlon_stop
+};
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/oprofile/op_x86_model.h
--- a/xen/arch/x86/oprofile/op_x86_model.h	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/oprofile/op_x86_model.h	Thu Apr 12 09:08:13 2012 +0100
@@ -48,6 +48,7 @@ extern struct op_x86_model_spec op_arch_
 extern struct op_x86_model_spec const op_p4_spec;
 extern struct op_x86_model_spec const op_p4_ht2_spec;
 extern struct op_x86_model_spec const op_athlon_spec;
+extern struct op_x86_model_spec const op_amd_fam15h_spec;
 
 void arch_perfmon_setup_counters(void);
 #endif /* OP_X86_MODEL_H */
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:08:13 2012 +0100
@@ -223,6 +223,19 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
+#define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
+#define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
+#define MSR_AMD_FAM15H_PERFCTR1		0xc0010203
+#define MSR_AMD_FAM15H_EVNTSEL2		0xc0010204
+#define MSR_AMD_FAM15H_PERFCTR2		0xc0010205
+#define MSR_AMD_FAM15H_EVNTSEL3		0xc0010206
+#define MSR_AMD_FAM15H_PERFCTR3		0xc0010207
+#define MSR_AMD_FAM15H_EVNTSEL4		0xc0010208
+#define MSR_AMD_FAM15H_PERFCTR4		0xc0010209
+#define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
+#define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
+
 #define MSR_K8_FEATURE_MASK		0xc0011004
 #define MSR_K8_EXT_FEATURE_MASK		0xc0011005
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 11: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 1SIeEn-0007Sq-Hu; Fri, 13 Apr 2012 11: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 1SIeEl-0007SX-SE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:20 +0000
Received: from [193.109.254.147:28812] by server-11.bemta-14.messagelabs.com
	id 97/87-05858-347088F4; Fri, 13 Apr 2012 11:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334314814!1972132!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2342 invoked from network); 13 Apr 2012 11:00:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 11:00: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 1SIeEg-00009W-5Z
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEg-0004aP-0k
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Message-Id: <E1SIeEg-0004aP-0k@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] hvm: vpmu: Add support for AMD
	Family 15h processors
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jacob Shin <jacob.shin@amd.com>
# Date 1334218093 -3600
# Node ID 7d9df818d302a593ab2e1b3e795ee8f369af96ae
# Parent  0aa6bc8f38a9a270f910f37e664ea6fcbece0073
hvm: vpmu: Add support for AMD Family 15h processors

AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates HVM VPMU
to take advantage of the new counters.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
xen-unstable changeset:   23306:e787d4f2e5ac
xen-unstable date:        Mon May 09 09:54:46 2011 +0100

xenoprof: Add support for AMD Family 15h processors

AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates xenoprof
to take advantage of the new counters.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>

Rename fam15h -> amd_fam15h in a few places, as suggested by Jan
Beulich.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23305:014ee4e09644
xen-unstable date:        Mon May 09 09:53:07 2011 +0100

xenoprof: Update cpu_type to sync with upstream oprofile

Update xenoprof's cpu_type to match upstream oprofile. Currently AMD
Family 11h ~ Family 15h are broken due to string mismatches.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
xen-unstable changeset:   23304:8981b582be3e
xen-unstable date:        Mon May 09 09:49:14 2011 +0100
---


diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:08:13 2012 +0100
@@ -1142,6 +1142,18 @@ static int svm_msr_read_intercept(unsign
     case MSR_K7_EVNTSEL1:
     case MSR_K7_EVNTSEL2:
     case MSR_K7_EVNTSEL3:
+    case MSR_AMD_FAM15H_PERFCTR0:
+    case MSR_AMD_FAM15H_PERFCTR1:
+    case MSR_AMD_FAM15H_PERFCTR2:
+    case MSR_AMD_FAM15H_PERFCTR3:
+    case MSR_AMD_FAM15H_PERFCTR4:
+    case MSR_AMD_FAM15H_PERFCTR5:
+    case MSR_AMD_FAM15H_EVNTSEL0:
+    case MSR_AMD_FAM15H_EVNTSEL1:
+    case MSR_AMD_FAM15H_EVNTSEL2:
+    case MSR_AMD_FAM15H_EVNTSEL3:
+    case MSR_AMD_FAM15H_EVNTSEL4:
+    case MSR_AMD_FAM15H_EVNTSEL5:
         vpmu_do_rdmsr(msr, msr_content);
         break;
 
@@ -1237,6 +1249,18 @@ static int svm_msr_write_intercept(unsig
     case MSR_K7_EVNTSEL1:
     case MSR_K7_EVNTSEL2:
     case MSR_K7_EVNTSEL3:
+    case MSR_AMD_FAM15H_PERFCTR0:
+    case MSR_AMD_FAM15H_PERFCTR1:
+    case MSR_AMD_FAM15H_PERFCTR2:
+    case MSR_AMD_FAM15H_PERFCTR3:
+    case MSR_AMD_FAM15H_PERFCTR4:
+    case MSR_AMD_FAM15H_PERFCTR5:
+    case MSR_AMD_FAM15H_EVNTSEL0:
+    case MSR_AMD_FAM15H_EVNTSEL1:
+    case MSR_AMD_FAM15H_EVNTSEL2:
+    case MSR_AMD_FAM15H_EVNTSEL3:
+    case MSR_AMD_FAM15H_EVNTSEL4:
+    case MSR_AMD_FAM15H_EVNTSEL5:
         vpmu_do_wrmsr(msr, msr_content);
         break;
 
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/hvm/svm/vpmu.c
--- a/xen/arch/x86/hvm/svm/vpmu.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/hvm/svm/vpmu.c	Thu Apr 12 09:08:13 2012 +0100
@@ -36,7 +36,9 @@
 #include <public/hvm/save.h>
 #include <asm/hvm/vpmu.h>
 
-#define NUM_COUNTERS 4
+#define F10H_NUM_COUNTERS 4
+#define F15H_NUM_COUNTERS 6
+#define MAX_NUM_COUNTERS F15H_NUM_COUNTERS
 
 #define MSR_F10H_EVNTSEL_GO_SHIFT   40
 #define MSR_F10H_EVNTSEL_EN_SHIFT   22
@@ -47,6 +49,11 @@
 #define set_guest_mode(msr) (msr |= (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
 #define is_overflowed(msr) (!((msr) & (1ULL << (MSR_F10H_COUNTER_LENGTH-1))))
 
+static int __read_mostly num_counters = 0;
+static u32 __read_mostly *counters = NULL;
+static u32 __read_mostly *ctrls = NULL;
+static bool_t __read_mostly k7_counters_mirrored = 0;
+
 /* PMU Counter MSRs. */
 u32 AMD_F10H_COUNTERS[] = {
     MSR_K7_PERFCTR0,
@@ -63,10 +70,28 @@ u32 AMD_F10H_CTRLS[] = {
     MSR_K7_EVNTSEL3
 };
 
+u32 AMD_F15H_COUNTERS[] = {
+    MSR_AMD_FAM15H_PERFCTR0,
+    MSR_AMD_FAM15H_PERFCTR1,
+    MSR_AMD_FAM15H_PERFCTR2,
+    MSR_AMD_FAM15H_PERFCTR3,
+    MSR_AMD_FAM15H_PERFCTR4,
+    MSR_AMD_FAM15H_PERFCTR5
+};
+
+u32 AMD_F15H_CTRLS[] = {
+    MSR_AMD_FAM15H_EVNTSEL0,
+    MSR_AMD_FAM15H_EVNTSEL1,
+    MSR_AMD_FAM15H_EVNTSEL2,
+    MSR_AMD_FAM15H_EVNTSEL3,
+    MSR_AMD_FAM15H_EVNTSEL4,
+    MSR_AMD_FAM15H_EVNTSEL5
+};
+
 /* storage for context switching */
 struct amd_vpmu_context {
-    u64 counters[NUM_COUNTERS];
-    u64 ctrls[NUM_COUNTERS];
+    u64 counters[MAX_NUM_COUNTERS];
+    u64 ctrls[MAX_NUM_COUNTERS];
     u32 hw_lapic_lvtpc;
 };
 
@@ -78,10 +103,45 @@ static inline int get_pmu_reg_type(u32 a
     if ( (addr >= MSR_K7_PERFCTR0) && (addr <= MSR_K7_PERFCTR3) )
         return MSR_TYPE_COUNTER;
 
+    if ( (addr >= MSR_AMD_FAM15H_EVNTSEL0) &&
+         (addr <= MSR_AMD_FAM15H_PERFCTR5 ) )
+    {
+        if (addr & 1)
+            return MSR_TYPE_COUNTER;
+        else
+            return MSR_TYPE_CTRL;
+    }
+
     /* unsupported registers */
     return -1;
 }
 
+static inline u32 get_fam15h_addr(u32 addr)
+{
+    switch ( addr )
+    {
+    case MSR_K7_PERFCTR0:
+        return MSR_AMD_FAM15H_PERFCTR0;
+    case MSR_K7_PERFCTR1:
+        return MSR_AMD_FAM15H_PERFCTR1;
+    case MSR_K7_PERFCTR2:
+        return MSR_AMD_FAM15H_PERFCTR2;
+    case MSR_K7_PERFCTR3:
+        return MSR_AMD_FAM15H_PERFCTR3;
+    case MSR_K7_EVNTSEL0:
+        return MSR_AMD_FAM15H_EVNTSEL0;
+    case MSR_K7_EVNTSEL1:
+        return MSR_AMD_FAM15H_EVNTSEL1;
+    case MSR_K7_EVNTSEL2:
+        return MSR_AMD_FAM15H_EVNTSEL2;
+    case MSR_K7_EVNTSEL3:
+        return MSR_AMD_FAM15H_EVNTSEL3;
+    default:
+        break;
+    }
+
+    return addr;
+}
 
 static int amd_vpmu_do_interrupt(struct cpu_user_regs *regs)
 {
@@ -110,12 +170,12 @@ static inline void context_restore(struc
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        wrmsrl(AMD_F10H_CTRLS[i], ctxt->ctrls[i]);
+    for ( i = 0; i < num_counters; i++ )
+        wrmsrl(ctrls[i], ctxt->ctrls[i]);
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
+    for ( i = 0; i < num_counters; i++ )
     {
-        wrmsrl(AMD_F10H_COUNTERS[i], ctxt->counters[i]);
+        wrmsrl(counters[i], ctxt->counters[i]);
 
         /* Force an interrupt to allow guest reset the counter,
         if the value is positive */
@@ -147,11 +207,11 @@ static inline void context_save(struct v
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        rdmsrl(AMD_F10H_COUNTERS[i], ctxt->counters[i]);
+    for ( i = 0; i < num_counters; i++ )
+        rdmsrl(counters[i], ctxt->counters[i]);
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        rdmsrl(AMD_F10H_CTRLS[i], ctxt->ctrls[i]);
+    for ( i = 0; i < num_counters; i++ )
+        rdmsrl(ctrls[i], ctxt->ctrls[i]);
 }
 
 static void amd_vpmu_save(struct vcpu *v)
@@ -175,12 +235,18 @@ static void context_update(unsigned int 
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     struct amd_vpmu_context *ctxt = vpmu->context;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        if ( msr == AMD_F10H_COUNTERS[i] )
+    if ( k7_counters_mirrored &&
+        ((msr >= MSR_K7_EVNTSEL0) && (msr <= MSR_K7_PERFCTR3)) )
+    {
+        msr = get_fam15h_addr(msr);
+    }
+
+    for ( i = 0; i < num_counters; i++ )
+        if ( msr == counters[i] )
             ctxt->counters[i] = msr_content;
 
-    for ( i = 0; i < NUM_COUNTERS; i++ )
-        if ( msr == AMD_F10H_CTRLS[i] )
+    for ( i = 0; i < num_counters; i++ )
+        if ( msr == ctrls[i] )
             ctxt->ctrls[i] = msr_content;
 
     ctxt->hw_lapic_lvtpc = apic_read(APIC_LVTPC);
@@ -235,10 +301,31 @@ static void amd_vpmu_initialise(struct v
 {
     struct amd_vpmu_context *ctxt = NULL;
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
+    __u8 family = current_cpu_data.x86;
 
     if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED )
         return;
 
+    if ( counters == NULL )
+    {
+         switch ( family )
+	 {
+	 case 0x15:
+	     num_counters = F15H_NUM_COUNTERS;
+	     counters = AMD_F15H_COUNTERS;
+	     ctrls = AMD_F15H_CTRLS;
+	     k7_counters_mirrored = 1;
+	     break;
+	 case 0x10:
+	 default:
+	     num_counters = F10H_NUM_COUNTERS;
+	     counters = AMD_F10H_COUNTERS;
+	     ctrls = AMD_F10H_CTRLS;
+	     k7_counters_mirrored = 0;
+	     break;
+	 }
+    }
+
     ctxt = xmalloc_bytes(sizeof(struct amd_vpmu_context));
 
     if ( !ctxt )
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/hvm/vpmu.c	Thu Apr 12 09:08:13 2012 +0100
@@ -101,6 +101,7 @@ void vpmu_initialise(struct vcpu *v)
         switch ( family )
         {
         case 0x10:
+        case 0x15:
             vpmu->arch_vpmu_ops = &amd_vpmu_ops;
             break;
         default:
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/oprofile/nmi_int.c	Thu Apr 12 09:08:13 2012 +0100
@@ -30,7 +30,7 @@
 struct op_counter_config counter_config[OP_MAX_COUNTER];
 struct op_ibs_config ibs_config;
 
-static struct op_x86_model_spec const *__read_mostly model;
+struct op_x86_model_spec const *__read_mostly model;
 static struct op_msrs cpu_msrs[NR_CPUS];
 static unsigned long saved_lvtpc[NR_CPUS];
 
@@ -435,19 +435,19 @@ static int __init nmi_init(void)
 				break;
 			case 0x11:
 				model = &op_athlon_spec;
-				cpu_type = "x86-64/family11";
+				cpu_type = "x86-64/family11h";
 				break;
                         case 0x12:
 				model = &op_athlon_spec;
-				cpu_type = "x86-64/family12";
+				cpu_type = "x86-64/family12h";
 				break;
 			case 0x14:
                                 model = &op_athlon_spec;
-                                cpu_type = "x86-64/family14";
+                                cpu_type = "x86-64/family14h";
                                 break;
                         case 0x15:
-                                model = &op_athlon_spec;
-                                cpu_type = "x86-64/family15";
+                                model = &op_amd_fam15h_spec;
+                                cpu_type = "x86-64/family15h";
                                 break;
 			}
 			break;
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/oprofile/op_model_athlon.c
--- a/xen/arch/x86/oprofile/op_model_athlon.c	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/oprofile/op_model_athlon.c	Thu Apr 12 09:08:13 2012 +0100
@@ -24,8 +24,13 @@
 #include "op_x86_model.h"
 #include "op_counter.h"
 
-#define NUM_COUNTERS 4
-#define NUM_CONTROLS 4
+#define K7_NUM_COUNTERS 4
+#define K7_NUM_CONTROLS 4
+
+#define FAM15H_NUM_COUNTERS 6
+#define FAM15H_NUM_CONTROLS 6
+
+#define MAX_COUNTERS FAM15H_NUM_COUNTERS
 
 #define CTR_READ(msr_content,msrs,c) do {rdmsrl(msrs->counters[(c)].addr, (msr_content));} while (0)
 #define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1);} while (0)
@@ -44,9 +49,10 @@
 #define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 0x1ULL) << 41))
 #define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 0x1ULL) << 40))
 
-static unsigned long reset_value[NUM_COUNTERS];
+static unsigned long reset_value[MAX_COUNTERS];
 
 extern char svm_stgi_label[];
+extern struct op_x86_model_spec const *__read_mostly model;
 
 #ifdef CONFIG_X86_64
 u32 ibs_caps = 0;
@@ -175,26 +181,44 @@ static void athlon_fill_in_addresses(str
 	msrs->controls[3].addr = MSR_K7_EVNTSEL3;
 }
 
- 
+static void fam15h_fill_in_addresses(struct op_msrs * const msrs)
+{
+	msrs->counters[0].addr = MSR_AMD_FAM15H_PERFCTR0;
+	msrs->counters[1].addr = MSR_AMD_FAM15H_PERFCTR1;
+	msrs->counters[2].addr = MSR_AMD_FAM15H_PERFCTR2;
+	msrs->counters[3].addr = MSR_AMD_FAM15H_PERFCTR3;
+	msrs->counters[4].addr = MSR_AMD_FAM15H_PERFCTR4;
+	msrs->counters[5].addr = MSR_AMD_FAM15H_PERFCTR5;
+
+	msrs->controls[0].addr = MSR_AMD_FAM15H_EVNTSEL0;
+	msrs->controls[1].addr = MSR_AMD_FAM15H_EVNTSEL1;
+	msrs->controls[2].addr = MSR_AMD_FAM15H_EVNTSEL2;
+	msrs->controls[3].addr = MSR_AMD_FAM15H_EVNTSEL3;
+	msrs->controls[4].addr = MSR_AMD_FAM15H_EVNTSEL4;
+	msrs->controls[5].addr = MSR_AMD_FAM15H_EVNTSEL5;
+}
+
 static void athlon_setup_ctrs(struct op_msrs const * const msrs)
 {
 	uint64_t msr_content;
 	int i;
+	unsigned int const nr_ctrs = model->num_counters;
+	unsigned int const nr_ctrls = model->num_controls;
  
 	/* clear all counters */
-	for (i = 0 ; i < NUM_CONTROLS; ++i) {
+	for (i = 0 ; i < nr_ctrls; ++i) {
 		CTRL_READ(msr_content, msrs, i);
 		CTRL_CLEAR(msr_content);
 		CTRL_WRITE(msr_content, msrs, i);
 	}
 	
 	/* avoid a false detection of ctr overflows in NMI handler */
-	for (i = 0; i < NUM_COUNTERS; ++i) {
+	for (i = 0; i < nr_ctrs; ++i) {
 		CTR_WRITE(1, msrs, i);
 	}
 
 	/* enable active counters */
-	for (i = 0; i < NUM_COUNTERS; ++i) {
+	for (i = 0; i < nr_ctrs; ++i) {
 		if (counter_config[i].enabled) {
 			reset_value[i] = counter_config[i].count;
 
@@ -300,6 +324,7 @@ static int athlon_check_ctrs(unsigned in
 	int mode = 0;
 	struct vcpu *v = current;
 	struct cpu_user_regs *guest_regs = guest_cpu_user_regs();
+	unsigned int const nr_ctrs = model->num_counters;
 
 	if (!guest_mode(regs) &&
 	    (regs->eip == (unsigned long)svm_stgi_label)) {
@@ -312,7 +337,7 @@ static int athlon_check_ctrs(unsigned in
 		mode = xenoprofile_get_mode(v, regs);
 	}
 
-	for (i = 0 ; i < NUM_COUNTERS; ++i) {
+	for (i = 0 ; i < nr_ctrs; ++i) {
 		CTR_READ(msr_content, msrs, i);
 		if (CTR_OVERFLOWED(msr_content)) {
 			xenoprof_log_event(current, regs, eip, mode, i);
@@ -373,7 +398,8 @@ static void athlon_start(struct op_msrs 
 {
 	uint64_t msr_content;
 	int i;
-	for (i = 0 ; i < NUM_COUNTERS ; ++i) {
+	unsigned int const nr_ctrs = model->num_counters;
+	for (i = 0 ; i < nr_ctrs ; ++i) {
 		if (reset_value[i]) {
 			CTRL_READ(msr_content, msrs, i);
 			CTRL_SET_ACTIVE(msr_content);
@@ -401,10 +427,11 @@ static void athlon_stop(struct op_msrs c
 {
 	uint64_t msr_content;
 	int i;
+	unsigned int const nr_ctrs = model->num_counters;
 
 	/* Subtle: stop on all counters to avoid race with
 	 * setting our pm callback */
-	for (i = 0 ; i < NUM_COUNTERS ; ++i) {
+	for (i = 0 ; i < nr_ctrs ; ++i) {
 		CTRL_READ(msr_content, msrs, i);
 		CTRL_SET_INACTIVE(msr_content);
 		CTRL_WRITE(msr_content, msrs, i);
@@ -512,11 +539,21 @@ void __init ibs_init(void)
 #endif /* CONFIG_X86_64 */
 
 struct op_x86_model_spec const op_athlon_spec = {
-	.num_counters = NUM_COUNTERS,
-	.num_controls = NUM_CONTROLS,
+	.num_counters = K7_NUM_COUNTERS,
+	.num_controls = K7_NUM_CONTROLS,
 	.fill_in_addresses = &athlon_fill_in_addresses,
 	.setup_ctrs = &athlon_setup_ctrs,
 	.check_ctrs = &athlon_check_ctrs,
 	.start = &athlon_start,
 	.stop = &athlon_stop
 };
+
+struct op_x86_model_spec const op_amd_fam15h_spec = {
+	.num_counters = FAM15H_NUM_COUNTERS,
+	.num_controls = FAM15H_NUM_CONTROLS,
+	.fill_in_addresses = &fam15h_fill_in_addresses,
+	.setup_ctrs = &athlon_setup_ctrs,
+	.check_ctrs = &athlon_check_ctrs,
+	.start = &athlon_start,
+	.stop = &athlon_stop
+};
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/arch/x86/oprofile/op_x86_model.h
--- a/xen/arch/x86/oprofile/op_x86_model.h	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/arch/x86/oprofile/op_x86_model.h	Thu Apr 12 09:08:13 2012 +0100
@@ -48,6 +48,7 @@ extern struct op_x86_model_spec op_arch_
 extern struct op_x86_model_spec const op_p4_spec;
 extern struct op_x86_model_spec const op_p4_ht2_spec;
 extern struct op_x86_model_spec const op_athlon_spec;
+extern struct op_x86_model_spec const op_amd_fam15h_spec;
 
 void arch_perfmon_setup_counters(void);
 #endif /* OP_X86_MODEL_H */
diff -r 0aa6bc8f38a9 -r 7d9df818d302 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:06:02 2012 +0100
+++ b/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:08:13 2012 +0100
@@ -223,6 +223,19 @@
 #define MSR_K8_VM_CR			0xc0010114
 #define MSR_K8_VM_HSAVE_PA		0xc0010117
 
+#define MSR_AMD_FAM15H_EVNTSEL0		0xc0010200
+#define MSR_AMD_FAM15H_PERFCTR0		0xc0010201
+#define MSR_AMD_FAM15H_EVNTSEL1		0xc0010202
+#define MSR_AMD_FAM15H_PERFCTR1		0xc0010203
+#define MSR_AMD_FAM15H_EVNTSEL2		0xc0010204
+#define MSR_AMD_FAM15H_PERFCTR2		0xc0010205
+#define MSR_AMD_FAM15H_EVNTSEL3		0xc0010206
+#define MSR_AMD_FAM15H_PERFCTR3		0xc0010207
+#define MSR_AMD_FAM15H_EVNTSEL4		0xc0010208
+#define MSR_AMD_FAM15H_PERFCTR4		0xc0010209
+#define MSR_AMD_FAM15H_EVNTSEL5		0xc001020a
+#define MSR_AMD_FAM15H_PERFCTR5		0xc001020b
+
 #define MSR_K8_FEATURE_MASK		0xc0011004
 #define MSR_K8_EXT_FEATURE_MASK		0xc0011005
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:31 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 11:00:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIeEr-0007UB-Km; Fri, 13 Apr 2012 11:00:25 +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 1SIeEq-0007TH-3m
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:24 +0000
Received: from [85.158.139.83:60125] by server-3.bemta-5.messagelabs.com id
	14/44-25237-747088F4; Fri, 13 Apr 2012 11:00:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1334314814!16320994!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27102 invoked from network); 13 Apr 2012 11:00:15 -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;
	13 Apr 2012 11:00: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 1SIeEg-00009Z-Jz
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEg-0004ae-H1
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Message-Id: <E1SIeEg-0004ae-H1@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:14 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] HVM/SVM: enable tsc scaling ratio
	for SVM
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Wei Huang <wei.huang2@amd.com>
# Date 1334218394 -3600
# Node ID 4ad262a48a715a022582567fa7a996389cb37e6c
# Parent  7d9df818d302a593ab2e1b3e795ee8f369af96ae
HVM/SVM: enable tsc scaling ratio for SVM

Future AMD CPUs support TSC scaling. It allows guests to have a
different TSC frequency from host system using this formula: guest_tsc
= host_tsc * tsc_ratio + vmcb_offset. The tsc_ratio is a 64bit MSR
contains a fixed-point number in 8.32 format (8 bits for integer part
and 32bits for fractional part). For instance 0x00000003_80000000
means tsc_ratio=3.5.

This patch enables TSC scaling ratio for SVM. With it, guest VMs don't
need take #VMEXIT to calculate a translated TSC value when it is
running under TSC emulation mode. This can substancially reduce the
rdtsc overhead.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
xen-unstable changeset:   23437:d7c755c25bb9
xen-unstable date:        Sat May 28 08:58:08 2011 +0100
---


diff -r 7d9df818d302 -r 4ad262a48a71 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:13:14 2012 +0100
@@ -588,6 +588,22 @@ static void svm_set_segment_register(str
 static void svm_set_tsc_offset(struct vcpu *v, u64 offset)
 {
     struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct domain *d = v->domain;
+
+    /* Re-adjust the offset value when TSC_RATIO is available */
+    if ( cpu_has_tsc_ratio && d->arch.vtsc )
+    {
+        uint64_t host_tsc, guest_tsc;
+
+        rdtscll(host_tsc);
+        guest_tsc = hvm_get_guest_tsc(v);
+            
+        /* calculate hi,lo parts in 64bits to prevent overflow */
+        offset = (((host_tsc >> 32) * d->arch.tsc_khz / cpu_khz) << 32) +
+            (host_tsc & 0xffffffffULL) * d->arch.tsc_khz / cpu_khz;
+        offset = guest_tsc - offset;
+    }
+
     vmcb_set_tsc_offset(vmcb, offset);
 }
 
@@ -638,6 +654,19 @@ static void svm_init_hypercall_page(stru
     *(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */
 }
 
+static inline void svm_tsc_ratio_save(struct vcpu *v)
+{
+    /* Other vcpus might not have vtsc enabled. So disable TSC_RATIO here. */
+    if ( cpu_has_tsc_ratio && v->domain->arch.vtsc )
+        wrmsrl(MSR_AMD64_TSC_RATIO, DEFAULT_TSC_RATIO);
+}
+
+static inline void svm_tsc_ratio_load(struct vcpu *v)
+{
+    if ( cpu_has_tsc_ratio && v->domain->arch.vtsc ) 
+        wrmsrl(MSR_AMD64_TSC_RATIO, vcpu_tsc_ratio(v));
+}
+
 static void svm_ctxt_switch_from(struct vcpu *v)
 {
     int cpu = smp_processor_id();
@@ -646,6 +675,7 @@ static void svm_ctxt_switch_from(struct 
 
     svm_save_dr(v);
     vpmu_save(v);
+    svm_tsc_ratio_save(v);
 
     svm_sync_vmcb(v);
     svm_vmload(per_cpu(root_vmcb, cpu));
@@ -689,6 +719,7 @@ static void svm_ctxt_switch_to(struct vc
     svm_vmload(vmcb);
     vmcb->cleanbits.bytes = 0;
     vpmu_load(v);
+    svm_tsc_ratio_load(v);
 
     if ( cpu_has_rdtscp )
         wrmsrl(MSR_TSC_AUX, hvm_msr_tsc_aux(v));
diff -r 7d9df818d302 -r 4ad262a48a71 xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/arch/x86/hvm/svm/vmcb.c	Thu Apr 12 09:13:14 2012 +0100
@@ -165,7 +165,9 @@ static int construct_vmcb(struct vcpu *v
 
     /* TSC. */
     vmcb->_tsc_offset = 0;
-    if ( v->domain->arch.vtsc )
+
+    /* Don't need to intercept RDTSC if CPU supports TSC rate scaling */
+    if ( v->domain->arch.vtsc && !cpu_has_tsc_ratio )
     {
         vmcb->_general1_intercepts |= GENERAL1_INTERCEPT_RDTSC;
         vmcb->_general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP;
diff -r 7d9df818d302 -r 4ad262a48a71 xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/include/asm-x86/hvm/svm/svm.h	Thu Apr 12 09:13:14 2012 +0100
@@ -82,5 +82,13 @@ extern u32 svm_feature_flags;
 #define cpu_has_svm_cleanbits cpu_has_svm_feature(SVM_FEATURE_VMCBCLEAN)
 #define cpu_has_svm_decode    cpu_has_svm_feature(SVM_FEATURE_DECODEASSISTS)
 #define cpu_has_pause_filter  cpu_has_svm_feature(SVM_FEATURE_PAUSEFILTER)
+#define cpu_has_tsc_ratio     cpu_has_svm_feature(SVM_FEATURE_TSCRATEMSR)
+
+/* TSC rate */
+#define DEFAULT_TSC_RATIO       0x0000000100000000ULL
+#define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
+#define TSC_RATIO(g_khz, h_khz) ( (((u64)(g_khz)<<32)/(u64)(h_khz)) & \
+                                  ~TSC_RATIO_RSVD_BITS )
+#define vcpu_tsc_ratio(v)       TSC_RATIO((v)->domain->arch.tsc_khz, cpu_khz)
 
 #endif /* __ASM_X86_HVM_SVM_H__ */
diff -r 7d9df818d302 -r 4ad262a48a71 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:13:14 2012 +0100
@@ -265,6 +265,9 @@
 #define MSR_AMD_PATCHLEVEL		0x0000008b
 #define MSR_AMD_PATCHLOADER		0xc0010020
 
+/* AMD TSC RATE MSR */
+#define MSR_AMD64_TSC_RATIO		0xc0000104
+
 /* AMD OS Visible Workaround MSRs */
 #define MSR_AMD_OSVW_ID_LENGTH          0xc0010140
 #define MSR_AMD_OSVW_STATUS             0xc0010141

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 11:00:31 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 11:00:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIeEr-0007UB-Km; Fri, 13 Apr 2012 11:00:25 +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 1SIeEq-0007TH-3m
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:24 +0000
Received: from [85.158.139.83:60125] by server-3.bemta-5.messagelabs.com id
	14/44-25237-747088F4; Fri, 13 Apr 2012 11:00:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1334314814!16320994!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27102 invoked from network); 13 Apr 2012 11:00:15 -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;
	13 Apr 2012 11:00: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 1SIeEg-00009Z-Jz
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIeEg-0004ae-H1
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 11:00:14 +0000
Message-Id: <E1SIeEg-0004ae-H1@xenbits.xen.org>
Date: Fri, 13 Apr 2012 11:00:14 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] HVM/SVM: enable tsc scaling ratio
	for SVM
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Wei Huang <wei.huang2@amd.com>
# Date 1334218394 -3600
# Node ID 4ad262a48a715a022582567fa7a996389cb37e6c
# Parent  7d9df818d302a593ab2e1b3e795ee8f369af96ae
HVM/SVM: enable tsc scaling ratio for SVM

Future AMD CPUs support TSC scaling. It allows guests to have a
different TSC frequency from host system using this formula: guest_tsc
= host_tsc * tsc_ratio + vmcb_offset. The tsc_ratio is a 64bit MSR
contains a fixed-point number in 8.32 format (8 bits for integer part
and 32bits for fractional part). For instance 0x00000003_80000000
means tsc_ratio=3.5.

This patch enables TSC scaling ratio for SVM. With it, guest VMs don't
need take #VMEXIT to calculate a translated TSC value when it is
running under TSC emulation mode. This can substancially reduce the
rdtsc overhead.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
xen-unstable changeset:   23437:d7c755c25bb9
xen-unstable date:        Sat May 28 08:58:08 2011 +0100
---


diff -r 7d9df818d302 -r 4ad262a48a71 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 12 09:13:14 2012 +0100
@@ -588,6 +588,22 @@ static void svm_set_segment_register(str
 static void svm_set_tsc_offset(struct vcpu *v, u64 offset)
 {
     struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct domain *d = v->domain;
+
+    /* Re-adjust the offset value when TSC_RATIO is available */
+    if ( cpu_has_tsc_ratio && d->arch.vtsc )
+    {
+        uint64_t host_tsc, guest_tsc;
+
+        rdtscll(host_tsc);
+        guest_tsc = hvm_get_guest_tsc(v);
+            
+        /* calculate hi,lo parts in 64bits to prevent overflow */
+        offset = (((host_tsc >> 32) * d->arch.tsc_khz / cpu_khz) << 32) +
+            (host_tsc & 0xffffffffULL) * d->arch.tsc_khz / cpu_khz;
+        offset = guest_tsc - offset;
+    }
+
     vmcb_set_tsc_offset(vmcb, offset);
 }
 
@@ -638,6 +654,19 @@ static void svm_init_hypercall_page(stru
     *(u16 *)(hypercall_page + (__HYPERVISOR_iret * 32)) = 0x0b0f; /* ud2 */
 }
 
+static inline void svm_tsc_ratio_save(struct vcpu *v)
+{
+    /* Other vcpus might not have vtsc enabled. So disable TSC_RATIO here. */
+    if ( cpu_has_tsc_ratio && v->domain->arch.vtsc )
+        wrmsrl(MSR_AMD64_TSC_RATIO, DEFAULT_TSC_RATIO);
+}
+
+static inline void svm_tsc_ratio_load(struct vcpu *v)
+{
+    if ( cpu_has_tsc_ratio && v->domain->arch.vtsc ) 
+        wrmsrl(MSR_AMD64_TSC_RATIO, vcpu_tsc_ratio(v));
+}
+
 static void svm_ctxt_switch_from(struct vcpu *v)
 {
     int cpu = smp_processor_id();
@@ -646,6 +675,7 @@ static void svm_ctxt_switch_from(struct 
 
     svm_save_dr(v);
     vpmu_save(v);
+    svm_tsc_ratio_save(v);
 
     svm_sync_vmcb(v);
     svm_vmload(per_cpu(root_vmcb, cpu));
@@ -689,6 +719,7 @@ static void svm_ctxt_switch_to(struct vc
     svm_vmload(vmcb);
     vmcb->cleanbits.bytes = 0;
     vpmu_load(v);
+    svm_tsc_ratio_load(v);
 
     if ( cpu_has_rdtscp )
         wrmsrl(MSR_TSC_AUX, hvm_msr_tsc_aux(v));
diff -r 7d9df818d302 -r 4ad262a48a71 xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/arch/x86/hvm/svm/vmcb.c	Thu Apr 12 09:13:14 2012 +0100
@@ -165,7 +165,9 @@ static int construct_vmcb(struct vcpu *v
 
     /* TSC. */
     vmcb->_tsc_offset = 0;
-    if ( v->domain->arch.vtsc )
+
+    /* Don't need to intercept RDTSC if CPU supports TSC rate scaling */
+    if ( v->domain->arch.vtsc && !cpu_has_tsc_ratio )
     {
         vmcb->_general1_intercepts |= GENERAL1_INTERCEPT_RDTSC;
         vmcb->_general2_intercepts |= GENERAL2_INTERCEPT_RDTSCP;
diff -r 7d9df818d302 -r 4ad262a48a71 xen/include/asm-x86/hvm/svm/svm.h
--- a/xen/include/asm-x86/hvm/svm/svm.h	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/include/asm-x86/hvm/svm/svm.h	Thu Apr 12 09:13:14 2012 +0100
@@ -82,5 +82,13 @@ extern u32 svm_feature_flags;
 #define cpu_has_svm_cleanbits cpu_has_svm_feature(SVM_FEATURE_VMCBCLEAN)
 #define cpu_has_svm_decode    cpu_has_svm_feature(SVM_FEATURE_DECODEASSISTS)
 #define cpu_has_pause_filter  cpu_has_svm_feature(SVM_FEATURE_PAUSEFILTER)
+#define cpu_has_tsc_ratio     cpu_has_svm_feature(SVM_FEATURE_TSCRATEMSR)
+
+/* TSC rate */
+#define DEFAULT_TSC_RATIO       0x0000000100000000ULL
+#define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
+#define TSC_RATIO(g_khz, h_khz) ( (((u64)(g_khz)<<32)/(u64)(h_khz)) & \
+                                  ~TSC_RATIO_RSVD_BITS )
+#define vcpu_tsc_ratio(v)       TSC_RATIO((v)->domain->arch.tsc_khz, cpu_khz)
 
 #endif /* __ASM_X86_HVM_SVM_H__ */
diff -r 7d9df818d302 -r 4ad262a48a71 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:08:13 2012 +0100
+++ b/xen/include/asm-x86/msr-index.h	Thu Apr 12 09:13:14 2012 +0100
@@ -265,6 +265,9 @@
 #define MSR_AMD_PATCHLEVEL		0x0000008b
 #define MSR_AMD_PATCHLOADER		0xc0010020
 
+/* AMD TSC RATE MSR */
+#define MSR_AMD64_TSC_RATIO		0xc0000104
+
 /* AMD OS Visible Workaround MSRs */
 #define MSR_AMD_OSVW_ID_LENGTH          0xc0010140
 #define MSR_AMD_OSVW_STATUS             0xc0010141

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQw-0000iD-0i; Fri, 13 Apr 2012 16:33: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 1SIjQv-0000i0-5P
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Received: from [193.109.254.147:27661] by server-5.bemta-14.messagelabs.com id
	6D/12-30733-845588F4; Fri, 13 Apr 2012 16:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1334334790!1400274!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7331 invoked from network); 13 Apr 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;
	13 Apr 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 1SIjQs-0004Vk-6J
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQs-0004Sd-26
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Message-Id: <E1SIjQs-0004Sd-26@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Another couple of
	comparisons of unsigned vars with < 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID ff880458e0c0fc4dadb23700665a4d2118ccad00
# Parent  ee4c7012ff63cf6a53af4052e893d98217449f87
x86/mm: Another couple of comparisons of unsigned vars with < 0.

Adding the explicit (unsigned) casts in case enums ever end up signed.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ee4c7012ff63 -r ff880458e0c0 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
@@ -1305,7 +1305,7 @@ int p2m_set_mem_access(struct domain *d,
         p2m->default_access,
     };
 
-    if ( access >= HVMMEM_access_default || access < 0 )
+    if ( (unsigned) access >= HVMMEM_access_default )
         return -EINVAL;
 
     a = memaccess[access];
@@ -1367,7 +1367,7 @@ int p2m_get_mem_access(struct domain *d,
     if ( mfn_x(mfn) == INVALID_MFN )
         return -ESRCH;
     
-    if ( a >= ARRAY_SIZE(memaccess) || a < 0 )
+    if ( (unsigned) a >= ARRAY_SIZE(memaccess) )
         return -ERANGE;
 
     *access =  memaccess[a];

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:16 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQw-0000iD-0i; Fri, 13 Apr 2012 16:33: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 1SIjQv-0000i0-5P
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Received: from [193.109.254.147:27661] by server-5.bemta-14.messagelabs.com id
	6D/12-30733-845588F4; Fri, 13 Apr 2012 16:33:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1334334790!1400274!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7331 invoked from network); 13 Apr 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;
	13 Apr 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 1SIjQs-0004Vk-6J
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQs-0004Sd-26
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Message-Id: <E1SIjQs-0004Sd-26@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Another couple of
	comparisons of unsigned vars with < 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID ff880458e0c0fc4dadb23700665a4d2118ccad00
# Parent  ee4c7012ff63cf6a53af4052e893d98217449f87
x86/mm: Another couple of comparisons of unsigned vars with < 0.

Adding the explicit (unsigned) casts in case enums ever end up signed.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ee4c7012ff63 -r ff880458e0c0 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
@@ -1305,7 +1305,7 @@ int p2m_set_mem_access(struct domain *d,
         p2m->default_access,
     };
 
-    if ( access >= HVMMEM_access_default || access < 0 )
+    if ( (unsigned) access >= HVMMEM_access_default )
         return -EINVAL;
 
     a = memaccess[access];
@@ -1367,7 +1367,7 @@ int p2m_get_mem_access(struct domain *d,
     if ( mfn_x(mfn) == INVALID_MFN )
         return -ESRCH;
     
-    if ( a >= ARRAY_SIZE(memaccess) || a < 0 )
+    if ( (unsigned) a >= ARRAY_SIZE(memaccess) )
         return -ERANGE;
 
     *access =  memaccess[a];

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjQy-0000is-3K; Fri, 13 Apr 2012 16:33: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 1SIjQw-0000i8-Ti
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [193.109.254.147:40062] by server-3.bemta-14.messagelabs.com id
	C9/88-23274-945588F4; Fri, 13 Apr 2012 16:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1334334790!4450925!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25206 invoked from network); 13 Apr 2012 16:33: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;
	13 Apr 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 1SIjQr-0004Vh-TE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQr-0004SO-Gd
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:09 +0000
Message-Id: <E1SIjQr-0004SO-Gd@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Add -Wno-unused-value to the
	clang CFLAGS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID ee4c7012ff63cf6a53af4052e893d98217449f87
# Parent  5bbda657a0160d3eec024bef2e7a59f199e84b10
xen: Add -Wno-unused-value to the clang CFLAGS

clang complains about a lot of functions and macros whose return value
is unused.  I started on patches to drop some functions' return values
and scatter (void)s around callers, but it was getting too messy.
Just turn off the warning instead.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 5bbda657a016 -r ee4c7012ff63 Config.mk
--- a/Config.mk	Tue Apr 10 10:42:35 2012 +0100
+++ b/Config.mk	Wed Apr 11 13:10:33 2012 +0100
@@ -159,7 +159,8 @@ CFLAGS += -Wall -Wstrict-prototypes
 
 # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
 # and is over-zealous with the printf format lint
-CFLAGS-$(clang) += -Wno-parentheses -Wno-format
+# and is a bit too fierce about unused return values
+CFLAGS-$(clang) += -Wno-parentheses -Wno-format -Wno-unused-value
 
 $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
 $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjQy-0000is-3K; Fri, 13 Apr 2012 16:33: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 1SIjQw-0000i8-Ti
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [193.109.254.147:40062] by server-3.bemta-14.messagelabs.com id
	C9/88-23274-945588F4; Fri, 13 Apr 2012 16:33:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1334334790!4450925!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25206 invoked from network); 13 Apr 2012 16:33: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;
	13 Apr 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 1SIjQr-0004Vh-TE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQr-0004SO-Gd
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:09 +0000
Message-Id: <E1SIjQr-0004SO-Gd@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Add -Wno-unused-value to the
	clang CFLAGS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID ee4c7012ff63cf6a53af4052e893d98217449f87
# Parent  5bbda657a0160d3eec024bef2e7a59f199e84b10
xen: Add -Wno-unused-value to the clang CFLAGS

clang complains about a lot of functions and macros whose return value
is unused.  I started on patches to drop some functions' return values
and scatter (void)s around callers, but it was getting too messy.
Just turn off the warning instead.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 5bbda657a016 -r ee4c7012ff63 Config.mk
--- a/Config.mk	Tue Apr 10 10:42:35 2012 +0100
+++ b/Config.mk	Wed Apr 11 13:10:33 2012 +0100
@@ -159,7 +159,8 @@ CFLAGS += -Wall -Wstrict-prototypes
 
 # Clang complains about macros that expand to 'if ( ( foo == bar ) ) ...'
 # and is over-zealous with the printf format lint
-CFLAGS-$(clang) += -Wno-parentheses -Wno-format
+# and is a bit too fierce about unused return values
+CFLAGS-$(clang) += -Wno-parentheses -Wno-format -Wno-unused-value
 
 $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
 $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQy-0000ix-5U; Fri, 13 Apr 2012 16:33: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 1SIjQx-0000iM-0w
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [85.158.143.35:4839] by server-1.bemta-4.messagelabs.com id
	92/11-20925-A45588F4; Fri, 13 Apr 2012 16:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1334334791!11239912!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7492 invoked from network); 13 Apr 2012 16:33:12 -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;
	13 Apr 2012 16:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQs-0004Vn-Rp
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQs-0004Sv-J9
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Message-Id: <E1SIjQs-0004Sv-J9@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: fix logical ANDs used to mask
	bitfields.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID 2badbf64a582ed62f39ca465c189f759c67350c8
# Parent  ff880458e0c0fc4dadb23700665a4d2118ccad00
x86: fix logical ANDs used to mask bitfields.

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


diff -r ff880458e0c0 -r 2badbf64a582 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Wed Apr 11 13:10:33 2012 +0100
@@ -752,7 +752,7 @@ static void svm_lwp_interrupt(struct cpu
     ack_APIC_irq();
     vlapic_set_irq(
         vcpu_vlapic(curr),
-        (curr->arch.hvm_svm.guest_lwp_cfg >> 40) && 0xff,
+        (curr->arch.hvm_svm.guest_lwp_cfg >> 40) & 0xff,
         0);
 }
 
diff -r ff880458e0c0 -r 2badbf64a582 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Apr 11 13:10:33 2012 +0100
@@ -1382,7 +1382,7 @@ void vmx_inject_extint(int trap)
     if ( nestedhvm_vcpu_in_guestmode(v) ) {
         pin_based_cntrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, 
                                      PIN_BASED_VM_EXEC_CONTROL);
-        if ( pin_based_cntrl && PIN_BASED_EXT_INTR_MASK ) {
+        if ( pin_based_cntrl & PIN_BASED_EXT_INTR_MASK ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK | (X86_EVENTTYPE_EXT_INTR<<8) | trap,
                HVM_DELIVER_NO_ERROR_CODE);
@@ -1401,7 +1401,7 @@ void vmx_inject_nmi(void)
     if ( nestedhvm_vcpu_in_guestmode(v) ) {
         pin_based_cntrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, 
                                      PIN_BASED_VM_EXEC_CONTROL);
-        if ( pin_based_cntrl && PIN_BASED_NMI_EXITING ) {
+        if ( pin_based_cntrl & PIN_BASED_NMI_EXITING ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK | (X86_EVENTTYPE_NMI<<8) | TRAP_nmi,
                HVM_DELIVER_NO_ERROR_CODE);

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQy-0000j2-8P; Fri, 13 Apr 2012 16:33: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 1SIjQx-0000iM-GT
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [85.158.143.99:32664] by server-1.bemta-4.messagelabs.com id
	16/11-20925-B45588F4; Fri, 13 Apr 2012 16:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1334334793!12357605!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5606 invoked from network); 13 Apr 2012 16:33: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;
	13 Apr 2012 16:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Vz-Mo
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Tw-LV
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Message-Id: <E1SIjQu-0004Tw-LV@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: explicitly mark __initdata
	variables as used when building with clang.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID f4bd73fe01adbc0fe6e8559dbdf36b7abc4668cc
# Parent  6c604c0c3525d85b279738e72c8b2c61cc12c35b
x86: explicitly mark __initdata variables as used when building with clang.

This stops LLVM from replacing it with a different, auto-generated
variable as part of an optimization.  (The auto-generated variable
ends up in the normal data section.)

Remove stray __read_mostly annotations on declarations that this unmasked.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 6c604c0c3525 -r f4bd73fe01ad xen/arch/x86/oprofile/op_x86_model.h
--- a/xen/arch/x86/oprofile/op_x86_model.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/oprofile/op_x86_model.h	Wed Apr 11 13:10:33 2012 +0100
@@ -53,6 +53,6 @@ extern struct op_x86_model_spec const op
 void arch_perfmon_setup_counters(void);
 
 extern int ppro_has_global_ctrl;
-extern struct op_x86_model_spec const *__read_mostly model;
+extern struct op_x86_model_spec const *model;
 
 #endif /* OP_X86_MODEL_H */
diff -r 6c604c0c3525 -r f4bd73fe01ad xen/include/acpi/cpufreq/cpufreq.h
--- a/xen/include/acpi/cpufreq/cpufreq.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/acpi/cpufreq/cpufreq.h	Wed Apr 11 13:10:33 2012 +0100
@@ -22,7 +22,7 @@
 
 DECLARE_PER_CPU(spinlock_t, cpufreq_statistic_lock);
 
-extern bool_t __read_mostly cpufreq_verbose;
+extern bool_t cpufreq_verbose;
 
 struct cpufreq_governor;
 
diff -r 6c604c0c3525 -r f4bd73fe01ad xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
@@ -14,7 +14,13 @@
 #define always_inline __inline__ __attribute__ ((always_inline))
 #define noinline      __attribute__((noinline))
 
+#ifdef __clang__
+/* Clang can replace some vars with new automatic ones that go in .data;
+ * mark all explicit-segment vars 'used' to prevent that. */
+#define __section(s)      __attribute_used__ __attribute__((__section__(s)))
+#else
 #define __section(s)      __attribute__((__section__(s)))
+#endif
 #define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
 #define __text_section(s) __attribute__((__section__(s)))
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQy-0000ix-5U; Fri, 13 Apr 2012 16:33: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 1SIjQx-0000iM-0w
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [85.158.143.35:4839] by server-1.bemta-4.messagelabs.com id
	92/11-20925-A45588F4; Fri, 13 Apr 2012 16:33:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1334334791!11239912!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7492 invoked from network); 13 Apr 2012 16:33:12 -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;
	13 Apr 2012 16:33:12 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQs-0004Vn-Rp
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQs-0004Sv-J9
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:10 +0000
Message-Id: <E1SIjQs-0004Sv-J9@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: fix logical ANDs used to mask
	bitfields.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID 2badbf64a582ed62f39ca465c189f759c67350c8
# Parent  ff880458e0c0fc4dadb23700665a4d2118ccad00
x86: fix logical ANDs used to mask bitfields.

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


diff -r ff880458e0c0 -r 2badbf64a582 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Wed Apr 11 13:10:33 2012 +0100
@@ -752,7 +752,7 @@ static void svm_lwp_interrupt(struct cpu
     ack_APIC_irq();
     vlapic_set_irq(
         vcpu_vlapic(curr),
-        (curr->arch.hvm_svm.guest_lwp_cfg >> 40) && 0xff,
+        (curr->arch.hvm_svm.guest_lwp_cfg >> 40) & 0xff,
         0);
 }
 
diff -r ff880458e0c0 -r 2badbf64a582 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Apr 11 13:10:33 2012 +0100
@@ -1382,7 +1382,7 @@ void vmx_inject_extint(int trap)
     if ( nestedhvm_vcpu_in_guestmode(v) ) {
         pin_based_cntrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, 
                                      PIN_BASED_VM_EXEC_CONTROL);
-        if ( pin_based_cntrl && PIN_BASED_EXT_INTR_MASK ) {
+        if ( pin_based_cntrl & PIN_BASED_EXT_INTR_MASK ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK | (X86_EVENTTYPE_EXT_INTR<<8) | trap,
                HVM_DELIVER_NO_ERROR_CODE);
@@ -1401,7 +1401,7 @@ void vmx_inject_nmi(void)
     if ( nestedhvm_vcpu_in_guestmode(v) ) {
         pin_based_cntrl = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, 
                                      PIN_BASED_VM_EXEC_CONTROL);
-        if ( pin_based_cntrl && PIN_BASED_NMI_EXITING ) {
+        if ( pin_based_cntrl & PIN_BASED_NMI_EXITING ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK | (X86_EVENTTYPE_NMI<<8) | TRAP_nmi,
                HVM_DELIVER_NO_ERROR_CODE);

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQy-0000j2-8P; Fri, 13 Apr 2012 16:33: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 1SIjQx-0000iM-GT
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [85.158.143.99:32664] by server-1.bemta-4.messagelabs.com id
	16/11-20925-B45588F4; Fri, 13 Apr 2012 16:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1334334793!12357605!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5606 invoked from network); 13 Apr 2012 16:33: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;
	13 Apr 2012 16:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Vz-Mo
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Tw-LV
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Message-Id: <E1SIjQu-0004Tw-LV@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: explicitly mark __initdata
	variables as used when building with clang.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID f4bd73fe01adbc0fe6e8559dbdf36b7abc4668cc
# Parent  6c604c0c3525d85b279738e72c8b2c61cc12c35b
x86: explicitly mark __initdata variables as used when building with clang.

This stops LLVM from replacing it with a different, auto-generated
variable as part of an optimization.  (The auto-generated variable
ends up in the normal data section.)

Remove stray __read_mostly annotations on declarations that this unmasked.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 6c604c0c3525 -r f4bd73fe01ad xen/arch/x86/oprofile/op_x86_model.h
--- a/xen/arch/x86/oprofile/op_x86_model.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/oprofile/op_x86_model.h	Wed Apr 11 13:10:33 2012 +0100
@@ -53,6 +53,6 @@ extern struct op_x86_model_spec const op
 void arch_perfmon_setup_counters(void);
 
 extern int ppro_has_global_ctrl;
-extern struct op_x86_model_spec const *__read_mostly model;
+extern struct op_x86_model_spec const *model;
 
 #endif /* OP_X86_MODEL_H */
diff -r 6c604c0c3525 -r f4bd73fe01ad xen/include/acpi/cpufreq/cpufreq.h
--- a/xen/include/acpi/cpufreq/cpufreq.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/acpi/cpufreq/cpufreq.h	Wed Apr 11 13:10:33 2012 +0100
@@ -22,7 +22,7 @@
 
 DECLARE_PER_CPU(spinlock_t, cpufreq_statistic_lock);
 
-extern bool_t __read_mostly cpufreq_verbose;
+extern bool_t cpufreq_verbose;
 
 struct cpufreq_governor;
 
diff -r 6c604c0c3525 -r f4bd73fe01ad xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
@@ -14,7 +14,13 @@
 #define always_inline __inline__ __attribute__ ((always_inline))
 #define noinline      __attribute__((noinline))
 
+#ifdef __clang__
+/* Clang can replace some vars with new automatic ones that go in .data;
+ * mark all explicit-segment vars 'used' to prevent that. */
+#define __section(s)      __attribute_used__ __attribute__((__section__(s)))
+#else
 #define __section(s)      __attribute__((__section__(s)))
+#endif
 #define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
 #define __text_section(s) __attribute__((__section__(s)))
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR0-0000kh-Iw; Fri, 13 Apr 2012 16:33: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 1SIjQz-0000jJ-8E
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from [85.158.139.83:48771] by server-1.bemta-5.messagelabs.com id
	13/4C-28458-C45588F4; Fri, 13 Apr 2012 16:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1334334792!12456978!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19634 invoked from network); 13 Apr 2012 16:33:13 -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;
	13 Apr 2012 16: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 1SIjQt-0004Vq-7T
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQt-0004TA-3E
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Message-Id: <E1SIjQt-0004TA-3E@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: fix memset(ptr, 0, sizeof ptr).
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID d5f9005dfc4ac2edb444e342a427dbe0f2cdf2f5
# Parent  2badbf64a582ed62f39ca465c189f759c67350c8
x86: fix memset(ptr, 0, sizeof ptr).

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 2badbf64a582 -r d5f9005dfc4a xen/arch/x86/cpu/mcheck/amd_f10.c
--- a/xen/arch/x86/cpu/mcheck/amd_f10.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/amd_f10.c	Wed Apr 11 13:10:33 2012 +0100
@@ -73,9 +73,9 @@ amd_f10_handler(struct mc_info *mi, uint
 		return NULL;
 	}
 
-	memset(mc_ext, 0, sizeof(mc_ext));
+	memset(mc_ext, 0, sizeof(*mc_ext));
 	mc_ext->common.type = MC_TYPE_EXTENDED;
-	mc_ext->common.size = sizeof(mc_ext);
+	mc_ext->common.size = sizeof(*mc_ext);
 	mc_ext->mc_msrs = 3;
 
 	mc_ext->mc_msr[0].reg = MSR_F10_MC4_MISC1;
diff -r 2badbf64a582 -r d5f9005dfc4a xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
@@ -1232,11 +1232,10 @@ bool_t p2m_mem_access_check(unsigned lon
     }
 
     *req_ptr = NULL;
-    req = xmalloc(mem_event_request_t);
+    req = xzalloc(mem_event_request_t);
     if ( req )
     {
         *req_ptr = req;
-        memset(req, 0, sizeof(req));
         req->reason = MEM_EVENT_REASON_VIOLATION;
 
         /* Pause the current VCPU */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR0-0000kh-Iw; Fri, 13 Apr 2012 16:33: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 1SIjQz-0000jJ-8E
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from [85.158.139.83:48771] by server-1.bemta-5.messagelabs.com id
	13/4C-28458-C45588F4; Fri, 13 Apr 2012 16:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-182.messagelabs.com!1334334792!12456978!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19634 invoked from network); 13 Apr 2012 16:33:13 -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;
	13 Apr 2012 16: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 1SIjQt-0004Vq-7T
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQt-0004TA-3E
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Message-Id: <E1SIjQt-0004TA-3E@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: fix memset(ptr, 0, sizeof ptr).
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID d5f9005dfc4ac2edb444e342a427dbe0f2cdf2f5
# Parent  2badbf64a582ed62f39ca465c189f759c67350c8
x86: fix memset(ptr, 0, sizeof ptr).

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 2badbf64a582 -r d5f9005dfc4a xen/arch/x86/cpu/mcheck/amd_f10.c
--- a/xen/arch/x86/cpu/mcheck/amd_f10.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/cpu/mcheck/amd_f10.c	Wed Apr 11 13:10:33 2012 +0100
@@ -73,9 +73,9 @@ amd_f10_handler(struct mc_info *mi, uint
 		return NULL;
 	}
 
-	memset(mc_ext, 0, sizeof(mc_ext));
+	memset(mc_ext, 0, sizeof(*mc_ext));
 	mc_ext->common.type = MC_TYPE_EXTENDED;
-	mc_ext->common.size = sizeof(mc_ext);
+	mc_ext->common.size = sizeof(*mc_ext);
 	mc_ext->mc_msrs = 3;
 
 	mc_ext->mc_msr[0].reg = MSR_F10_MC4_MISC1;
diff -r 2badbf64a582 -r d5f9005dfc4a xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Wed Apr 11 13:10:33 2012 +0100
@@ -1232,11 +1232,10 @@ bool_t p2m_mem_access_check(unsigned lon
     }
 
     *req_ptr = NULL;
-    req = xmalloc(mem_event_request_t);
+    req = xzalloc(mem_event_request_t);
     if ( req )
     {
         *req_ptr = req;
-        memset(req, 0, sizeof(req));
         req->reason = MEM_EVENT_REASON_VIOLATION;
 
         /* Pause the current VCPU */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQz-0000jd-BQ; Fri, 13 Apr 2012 16:33:17 +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 1SIjQx-0000ia-RA
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [193.109.254.147:31096] by server-1.bemta-14.messagelabs.com id
	8C/9B-29372-B45588F4; Fri, 13 Apr 2012 16:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-27.messagelabs.com!1334334793!4477868!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7637 invoked from network); 13 Apr 2012 16:33:14 -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;
	13 Apr 2012 16:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004W2-78
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004UB-61
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Message-Id: <E1SIjQv-0004UB-61@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore: Add a missing 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150047 -3600
# Node ID d3e4b3ef77834bc879788a450aecc5ada0d41643
# Parent  f4bd73fe01adbc0fe6e8559dbdf36b7abc4668cc
.gitignore: Add a missing file

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


diff -r f4bd73fe01ad -r d3e4b3ef7783 .gitignore
--- a/.gitignore	Wed Apr 11 13:10:33 2012 +0100
+++ b/.gitignore	Wed Apr 11 14:14:07 2012 +0100
@@ -357,6 +357,7 @@ tools/firmware/etherboot/eb-roms.h
 tools/firmware/etherboot/gpxe-git-snapshot.tar.gz
 tools/misc/xenwatchdogd
 tools/misc/xen-hvmcrash
+tools/misc/xen-lowmemd
 tools/libvchan/vchan-node[12]
 tools/ocaml/*/.ocamldep.make
 tools/ocaml/*/*.cm[ixao]

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQz-0000jd-BQ; Fri, 13 Apr 2012 16:33:17 +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 1SIjQx-0000ia-RA
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from [193.109.254.147:31096] by server-1.bemta-14.messagelabs.com id
	8C/9B-29372-B45588F4; Fri, 13 Apr 2012 16:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-27.messagelabs.com!1334334793!4477868!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7637 invoked from network); 13 Apr 2012 16:33:14 -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;
	13 Apr 2012 16:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004W2-78
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004UB-61
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Message-Id: <E1SIjQv-0004UB-61@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] .gitignore: Add a missing 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150047 -3600
# Node ID d3e4b3ef77834bc879788a450aecc5ada0d41643
# Parent  f4bd73fe01adbc0fe6e8559dbdf36b7abc4668cc
.gitignore: Add a missing file

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


diff -r f4bd73fe01ad -r d3e4b3ef7783 .gitignore
--- a/.gitignore	Wed Apr 11 13:10:33 2012 +0100
+++ b/.gitignore	Wed Apr 11 14:14:07 2012 +0100
@@ -357,6 +357,7 @@ tools/firmware/etherboot/eb-roms.h
 tools/firmware/etherboot/gpxe-git-snapshot.tar.gz
 tools/misc/xenwatchdogd
 tools/misc/xen-hvmcrash
+tools/misc/xen-lowmemd
 tools/libvchan/vchan-node[12]
 tools/ocaml/*/.ocamldep.make
 tools/ocaml/*/*.cm[ixao]

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQz-0000jk-EG; Fri, 13 Apr 2012 16:33: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 1SIjQy-0000io-EN
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Received: from [85.158.143.99:10513] by server-3.bemta-4.messagelabs.com id
	39/27-05853-B45588F4; Fri, 13 Apr 2012 16:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1334334792!17182378!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12951 invoked from network); 13 Apr 2012 16:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16: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 1SIjQt-0004Vt-TK
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQt-0004TR-Jy
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Message-Id: <E1SIjQt-0004TR-Jy@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: don't use .subsection when
	compiling with clang
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID 1d8fb1330f98d3eae982c2540c8a2acab7f00009
# Parent  d5f9005dfc4ac2edb444e342a427dbe0f2cdf2f5
x86: don't use .subsection when compiling with clang

LLVM's assembler doesn't support the .subsection directive, so put
the out-of-line failure path in .fixup instead.

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


diff -r d5f9005dfc4a -r 1d8fb1330f98 xen/include/asm-x86/spinlock.h
--- a/xen/include/asm-x86/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
@@ -45,11 +45,19 @@ static always_inline int _raw_read_trylo
     asm volatile (
         "    lock; decl %0         \n"
         "    jns 2f                \n"
+#ifdef __clang__ /* clang's builtin assember can't do .subsection */
+        "1:  .pushsection .fixup,\"ax\"\n"
+#else
         "1:  .subsection 1         \n"
+#endif
         "2:  lock; incl %0         \n"
         "    decl %1               \n"
         "    jmp 1b                \n"
+#ifdef __clang__
+        "    .popsection           \n"
+#else
         "    .subsection 0         \n"
+#endif
         : "=m" (rw->lock), "=r" (acquired) : "1" (1) : "memory" );
 
     return acquired;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjQz-0000jk-EG; Fri, 13 Apr 2012 16:33: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 1SIjQy-0000io-EN
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Received: from [85.158.143.99:10513] by server-3.bemta-4.messagelabs.com id
	39/27-05853-B45588F4; Fri, 13 Apr 2012 16:33:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1334334792!17182378!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12951 invoked from network); 13 Apr 2012 16:33:13 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16: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 1SIjQt-0004Vt-TK
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQt-0004TR-Jy
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:11 +0000
Message-Id: <E1SIjQt-0004TR-Jy@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: don't use .subsection when
	compiling with clang
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID 1d8fb1330f98d3eae982c2540c8a2acab7f00009
# Parent  d5f9005dfc4ac2edb444e342a427dbe0f2cdf2f5
x86: don't use .subsection when compiling with clang

LLVM's assembler doesn't support the .subsection directive, so put
the out-of-line failure path in .fixup instead.

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


diff -r d5f9005dfc4a -r 1d8fb1330f98 xen/include/asm-x86/spinlock.h
--- a/xen/include/asm-x86/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
@@ -45,11 +45,19 @@ static always_inline int _raw_read_trylo
     asm volatile (
         "    lock; decl %0         \n"
         "    jns 2f                \n"
+#ifdef __clang__ /* clang's builtin assember can't do .subsection */
+        "1:  .pushsection .fixup,\"ax\"\n"
+#else
         "1:  .subsection 1         \n"
+#endif
         "2:  lock; incl %0         \n"
         "    decl %1               \n"
         "    jmp 1b                \n"
+#ifdef __clang__
+        "    .popsection           \n"
+#else
         "    .subsection 0         \n"
+#endif
         : "=m" (rw->lock), "=r" (acquired) : "1" (1) : "memory" );
 
     return acquired;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR1-0000lZ-NH; Fri, 13 Apr 2012 16:33:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0000jg-VE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Received: from [85.158.139.83:50219] by server-8.bemta-5.messagelabs.com id
	3E/9A-26964-D45588F4; Fri, 13 Apr 2012 16:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334334793!23729798!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 567 invoked from network); 13 Apr 2012 16:33:14 -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 Apr 2012 16:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Vw-5t
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Th-4d
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Message-Id: <E1SIjQu-0004Th-4d@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: define __section() and friends
	and use them for section annotations.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID 6c604c0c3525d85b279738e72c8b2c61cc12c35b
# Parent  1d8fb1330f98d3eae982c2540c8a2acab7f00009
xen: define __section() and friends and use them for section annotations.

By itself this is just code-tidying, but it's also useful for the
following patch, which will adjust __section() for clang compiles.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-arm/cache.h
--- a/xen/include/asm-arm/cache.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-arm/cache.h	Wed Apr 11 13:10:33 2012 +0100
@@ -7,7 +7,7 @@
 #define L1_CACHE_SHIFT  (CONFIG_ARM_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
 
 #endif
 /*
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-arm/percpu.h
--- a/xen/include/asm-arm/percpu.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-arm/percpu.h	Wed Apr 11 13:10:33 2012 +0100
@@ -8,7 +8,7 @@ void percpu_init_areas(void);
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
-    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __section(".bss.percpu" #suffix)                            \
     __typeof__(type) per_cpu_##name
 
 
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-x86/cache.h
--- a/xen/include/asm-x86/cache.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/cache.h	Wed Apr 11 13:10:33 2012 +0100
@@ -10,6 +10,6 @@
 #define L1_CACHE_SHIFT	(CONFIG_X86_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES	(1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
 
 #endif
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-x86/percpu.h
--- a/xen/include/asm-x86/percpu.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/percpu.h	Wed Apr 11 13:10:33 2012 +0100
@@ -9,7 +9,7 @@ void percpu_init_areas(void);
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
-    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __section(".bss.percpu" #suffix)                            \
     __typeof__(type) per_cpu_##name
 
 /* var is in discarded region: offset to particular copy we want */
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
@@ -14,6 +14,10 @@
 #define always_inline __inline__ __attribute__ ((always_inline))
 #define noinline      __attribute__((noinline))
 
+#define __section(s)      __attribute__((__section__(s)))
+#define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
+#define __text_section(s) __attribute__((__section__(s)))
+
 #ifdef INIT_SECTIONS_ONLY
 /*
  * For sources indicated to have only init code, make sure even
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/init.h
--- a/xen/include/xen/init.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/init.h	Wed Apr 11 13:10:33 2012 +0100
@@ -7,20 +7,13 @@
  * Mark functions and data as being only used at initialization
  * or exit time.
  */
-#define __init       \
-    __attribute__ ((__section__ (".init.text")))
-#define __exit       \
-    __attribute_used__ __attribute__ ((__section__(".exit.text")))
-#define __initdata   \
-    __attribute__ ((__section__ (".init.data")))
-#define __exitdata   \
-    __attribute_used__ __attribute__ ((__section__ (".exit.data")))
-#define __initsetup  \
-    __attribute_used__ __attribute__ ((__section__ (".init.setup")))
-#define __init_call(lvl)  \
-    __attribute_used__ __attribute__ ((__section__ (".initcall" lvl ".init")))
-#define __exit_call  \
-    __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+#define __init            __text_section(".init.text")
+#define __exit            __text_section(".exit.text")
+#define __initdata        __section(".init.data")
+#define __exitdata        __used_section(".exit.data")
+#define __initsetup       __used_section(".init.setup")
+#define __init_call(lvl)  __used_section(".initcall" lvl ".init")
+#define __exit_call       __used_section(".exitcall.exit")
 
 /* These macros are used to mark some functions or 
  * initialized data (doesn't apply to uninitialized data)
@@ -95,7 +88,7 @@ struct kernel_param {
 extern struct kernel_param __setup_start, __setup_end;
 
 #define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __attribute_used__ __initsetup struct kernel_param
+#define __kparam static __initsetup struct kernel_param
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/spinlock.h
--- a/xen/include/xen/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
@@ -77,8 +77,8 @@ struct lock_profile_qhead {
 
 #define _LOCK_PROFILE(name) { 0, #name, &name, 0, 0, 0, 0, 0 }
 #define _LOCK_PROFILE_PTR(name)                                               \
-    static struct lock_profile *__lock_profile_##name __attribute_used__      \
-    __attribute__ ((__section__(".lockprofile.data"))) =                      \
+    static struct lock_profile *__lock_profile_##name                         \
+    __used_section(".lockprofile.data") =                                     \
     &__lock_profile_data_##name
 #define _SPIN_LOCK_UNLOCKED(x) { _RAW_SPIN_LOCK_UNLOCKED, 0xfffu, 0,          \
                                  _LOCK_DEBUG, x }
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xsm/xsm.h	Wed Apr 11 13:10:33 2012 +0100
@@ -44,7 +44,7 @@ extern xsm_initcall_t __xsm_initcall_sta
 
 #define xsm_initcall(fn) \
     static xsm_initcall_t __initcall_##fn \
-    __attribute_used__ __attribute__((__section__(".xsm_initcall.init"))) = fn
+    __used_section(".xsm_initcall.init") = fn
 
 struct xsm_operations {
     void (*security_domaininfo) (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 Fri Apr 13 16:33:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR1-0000lZ-NH; Fri, 13 Apr 2012 16:33:19 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0000jg-VE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Received: from [85.158.139.83:50219] by server-8.bemta-5.messagelabs.com id
	3E/9A-26964-D45588F4; Fri, 13 Apr 2012 16:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334334793!23729798!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 567 invoked from network); 13 Apr 2012 16:33:14 -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 Apr 2012 16:33:14 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Vw-5t
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQu-0004Th-4d
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:12 +0000
Message-Id: <E1SIjQu-0004Th-4d@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: define __section() and friends
	and use them for section annotations.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334146233 -3600
# Node ID 6c604c0c3525d85b279738e72c8b2c61cc12c35b
# Parent  1d8fb1330f98d3eae982c2540c8a2acab7f00009
xen: define __section() and friends and use them for section annotations.

By itself this is just code-tidying, but it's also useful for the
following patch, which will adjust __section() for clang compiles.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-arm/cache.h
--- a/xen/include/asm-arm/cache.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-arm/cache.h	Wed Apr 11 13:10:33 2012 +0100
@@ -7,7 +7,7 @@
 #define L1_CACHE_SHIFT  (CONFIG_ARM_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
 
 #endif
 /*
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-arm/percpu.h
--- a/xen/include/asm-arm/percpu.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-arm/percpu.h	Wed Apr 11 13:10:33 2012 +0100
@@ -8,7 +8,7 @@ void percpu_init_areas(void);
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
-    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __section(".bss.percpu" #suffix)                            \
     __typeof__(type) per_cpu_##name
 
 
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-x86/cache.h
--- a/xen/include/asm-x86/cache.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/cache.h	Wed Apr 11 13:10:33 2012 +0100
@@ -10,6 +10,6 @@
 #define L1_CACHE_SHIFT	(CONFIG_X86_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES	(1 << L1_CACHE_SHIFT)
 
-#define __read_mostly __attribute__((__section__(".data.read_mostly")))
+#define __read_mostly __section(".data.read_mostly")
 
 #endif
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/asm-x86/percpu.h
--- a/xen/include/asm-x86/percpu.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/asm-x86/percpu.h	Wed Apr 11 13:10:33 2012 +0100
@@ -9,7 +9,7 @@ void percpu_init_areas(void);
 
 /* Separate out the type, so (int[3], foo) works. */
 #define __DEFINE_PER_CPU(type, name, suffix)                    \
-    __attribute__((__section__(".bss.percpu" #suffix)))         \
+    __section(".bss.percpu" #suffix)                            \
     __typeof__(type) per_cpu_##name
 
 /* var is in discarded region: offset to particular copy we want */
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/compiler.h	Wed Apr 11 13:10:33 2012 +0100
@@ -14,6 +14,10 @@
 #define always_inline __inline__ __attribute__ ((always_inline))
 #define noinline      __attribute__((noinline))
 
+#define __section(s)      __attribute__((__section__(s)))
+#define __used_section(s) __attribute_used__ __attribute__((__section__(s)))
+#define __text_section(s) __attribute__((__section__(s)))
+
 #ifdef INIT_SECTIONS_ONLY
 /*
  * For sources indicated to have only init code, make sure even
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/init.h
--- a/xen/include/xen/init.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/init.h	Wed Apr 11 13:10:33 2012 +0100
@@ -7,20 +7,13 @@
  * Mark functions and data as being only used at initialization
  * or exit time.
  */
-#define __init       \
-    __attribute__ ((__section__ (".init.text")))
-#define __exit       \
-    __attribute_used__ __attribute__ ((__section__(".exit.text")))
-#define __initdata   \
-    __attribute__ ((__section__ (".init.data")))
-#define __exitdata   \
-    __attribute_used__ __attribute__ ((__section__ (".exit.data")))
-#define __initsetup  \
-    __attribute_used__ __attribute__ ((__section__ (".init.setup")))
-#define __init_call(lvl)  \
-    __attribute_used__ __attribute__ ((__section__ (".initcall" lvl ".init")))
-#define __exit_call  \
-    __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+#define __init            __text_section(".init.text")
+#define __exit            __text_section(".exit.text")
+#define __initdata        __section(".init.data")
+#define __exitdata        __used_section(".exit.data")
+#define __initsetup       __used_section(".init.setup")
+#define __init_call(lvl)  __used_section(".initcall" lvl ".init")
+#define __exit_call       __used_section(".exitcall.exit")
 
 /* These macros are used to mark some functions or 
  * initialized data (doesn't apply to uninitialized data)
@@ -95,7 +88,7 @@ struct kernel_param {
 extern struct kernel_param __setup_start, __setup_end;
 
 #define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __attribute_used__ __initsetup struct kernel_param
+#define __kparam static __initsetup struct kernel_param
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xen/spinlock.h
--- a/xen/include/xen/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xen/spinlock.h	Wed Apr 11 13:10:33 2012 +0100
@@ -77,8 +77,8 @@ struct lock_profile_qhead {
 
 #define _LOCK_PROFILE(name) { 0, #name, &name, 0, 0, 0, 0, 0 }
 #define _LOCK_PROFILE_PTR(name)                                               \
-    static struct lock_profile *__lock_profile_##name __attribute_used__      \
-    __attribute__ ((__section__(".lockprofile.data"))) =                      \
+    static struct lock_profile *__lock_profile_##name                         \
+    __used_section(".lockprofile.data") =                                     \
     &__lock_profile_data_##name
 #define _SPIN_LOCK_UNLOCKED(x) { _RAW_SPIN_LOCK_UNLOCKED, 0xfffu, 0,          \
                                  _LOCK_DEBUG, x }
diff -r 1d8fb1330f98 -r 6c604c0c3525 xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Wed Apr 11 13:10:33 2012 +0100
+++ b/xen/include/xsm/xsm.h	Wed Apr 11 13:10:33 2012 +0100
@@ -44,7 +44,7 @@ extern xsm_initcall_t __xsm_initcall_sta
 
 #define xsm_initcall(fn) \
     static xsm_initcall_t __initcall_##fn \
-    __attribute_used__ __attribute__((__section__(".xsm_initcall.init"))) = fn
+    __used_section(".xsm_initcall.init") = fn
 
 struct xsm_operations {
     void (*security_domaininfo) (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 Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR2-0000nd-RA; Fri, 13 Apr 2012 16:33: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 1SIjR1-0000ko-3d
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from [85.158.143.35:41649] by server-2.bemta-4.messagelabs.com id
	D7/75-17550-E45588F4; Fri, 13 Apr 2012 16:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1334334795!16026747!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15689 invoked from network); 13 Apr 2012 16:33:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33: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 1SIjQx-0004WE-8y
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQx-0004V9-7r
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Message-Id: <E1SIjQx-0004V9-7r@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove poller from list in
	libxl__poller_get
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@citrix.com>
# Date 1334150050 -3600
# Node ID 0dd557cb56724f4d25885c59a416399c762e3eb9
# Parent  081230edcb5e508e622bdd8b806862f76d452e2d
libxl: remove poller from list in libxl__poller_get

Remove poller from the list once it has been requested.
Fixes a double-free bug.

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


diff -r 081230edcb5e -r 0dd557cb5672 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:09 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:10 2012 +0100
@@ -1010,8 +1010,10 @@ libxl__poller *libxl__poller_get(libxl_c
     int rc;
 
     libxl__poller *p = LIBXL_LIST_FIRST(&ctx->pollers_idle);
-    if (p)
+    if (p) {
+        LIBXL_LIST_REMOVE(p, entry);
         return p;
+    }
 
     p = malloc(sizeof(*p));
     if (!p) {

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR2-0000nd-RA; Fri, 13 Apr 2012 16:33: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 1SIjR1-0000ko-3d
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from [85.158.143.35:41649] by server-2.bemta-4.messagelabs.com id
	D7/75-17550-E45588F4; Fri, 13 Apr 2012 16:33:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1334334795!16026747!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15689 invoked from network); 13 Apr 2012 16:33:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33: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 1SIjQx-0004WE-8y
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQx-0004V9-7r
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Message-Id: <E1SIjQx-0004V9-7r@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove poller from list in
	libxl__poller_get
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Roger Pau Monne <roger.pau@citrix.com>
# Date 1334150050 -3600
# Node ID 0dd557cb56724f4d25885c59a416399c762e3eb9
# Parent  081230edcb5e508e622bdd8b806862f76d452e2d
libxl: remove poller from list in libxl__poller_get

Remove poller from the list once it has been requested.
Fixes a double-free bug.

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


diff -r 081230edcb5e -r 0dd557cb5672 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:09 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:10 2012 +0100
@@ -1010,8 +1010,10 @@ libxl__poller *libxl__poller_get(libxl_c
     int rc;
 
     libxl__poller *p = LIBXL_LIST_FIRST(&ctx->pollers_idle);
-    if (p)
+    if (p) {
+        LIBXL_LIST_REMOVE(p, entry);
         return p;
+    }
 
     p = malloc(sizeof(*p));
     if (!p) {

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR3-0000oH-2X; Fri, 13 Apr 2012 16:33: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 1SIjR1-0000ko-Hk
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from [85.158.143.99:10729] by server-2.bemta-4.messagelabs.com id
	0E/75-17550-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1334334797!13784870!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24332 invoked from network); 13 Apr 2012 16:33:18 -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;
	13 Apr 2012 16:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004WN-RK
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004Vs-Q8
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Message-Id: <E1SIjQy-0004Vs-Q8@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Use PTHREAD_CFLAGS, LDFLAGS,
	LIBS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150052 -3600
# Node ID 22d34c10797b496a1da2f242512911f92f8f145b
# Parent  181478052ea2d2db5f7edc724d13c79058dcf538
libxl: Use PTHREAD_CFLAGS, LDFLAGS, LIBS

This is going to be needed for pthread_atfork.  It is a mystery why it
hasn't been needed before.

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


diff -r 181478052ea2 -r 22d34c10797b tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 11 14:14:11 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 11 14:14:12 2012 +0100
@@ -22,6 +22,10 @@ endif
 LIBXL_LIBS =
 LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS)
 
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
+LIBXL_LIBS += $(PTHREAD_LIBS)
+
 LIBXLU_LIBS =
 
 LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o flexarray.o

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR3-0000oH-2X; Fri, 13 Apr 2012 16:33: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 1SIjR1-0000ko-Hk
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from [85.158.143.99:10729] by server-2.bemta-4.messagelabs.com id
	0E/75-17550-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1334334797!13784870!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24332 invoked from network); 13 Apr 2012 16:33:18 -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;
	13 Apr 2012 16:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004WN-RK
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004Vs-Q8
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Message-Id: <E1SIjQy-0004Vs-Q8@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Use PTHREAD_CFLAGS, LDFLAGS,
	LIBS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150052 -3600
# Node ID 22d34c10797b496a1da2f242512911f92f8f145b
# Parent  181478052ea2d2db5f7edc724d13c79058dcf538
libxl: Use PTHREAD_CFLAGS, LDFLAGS, LIBS

This is going to be needed for pthread_atfork.  It is a mystery why it
hasn't been needed before.

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


diff -r 181478052ea2 -r 22d34c10797b tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 11 14:14:11 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 11 14:14:12 2012 +0100
@@ -22,6 +22,10 @@ endif
 LIBXL_LIBS =
 LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS)
 
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
+LIBXL_LIBS += $(PTHREAD_LIBS)
+
 LIBXLU_LIBS =
 
 LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o flexarray.o

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR3-0000on-9k; Fri, 13 Apr 2012 16:33:21 +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 1SIjR2-0000mJ-JB
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.138.51:24931] by server-7.bemta-3.messagelabs.com id
	24/6F-03078-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1334334797!22090450!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28353 invoked from network); 13 Apr 2012 16:33:18 -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;
	13 Apr 2012 16:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004WQ-Bt
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004W7-Ae
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Message-Id: <E1SIjQz-0004W7-Ae@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Use PTHREAD_CFLAGS, _LDFLAGS,
	_LIBS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150053 -3600
# Node ID 0ff2b4d05c2eaf7ab4cf62ec87f1ceea24f8830c
# Parent  22d34c10797b496a1da2f242512911f92f8f145b
tools: Use PTHREAD_CFLAGS, _LDFLAGS, _LIBS

Replace all literal occurrences of -lpthread and -pthread in Makefiles
by references to PTHREAD_CFLAGS, PTHREAD_LDFLAGS and PTHREAD_LIBS.
These are the new variables set by configure, and currently expand to
-pthread on the compilation and link lines as is required.

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


diff -r 22d34c10797b -r 0ff2b4d05c2e tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/blktap/drivers/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -35,8 +35,11 @@ else
 AIOLIBS     := -laio
 endif
 
-LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread
-LDLIBS_img := $(AIOLIBS) $(CRYPT_LIB) -lpthread -lz
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
+
+LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm $(PTHREAD_LIBS)
+LDLIBS_img := $(AIOLIBS) $(CRYPT_LIB) $(PTHREAD_LIBS) -lz
 
 BLK-OBJS-y  := block-aio.o
 BLK-OBJS-y  += block-sync.o
diff -r 22d34c10797b -r 0ff2b4d05c2e tools/libfsimage/common/Makefile
--- a/tools/libfsimage/common/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/libfsimage/common/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -8,6 +8,9 @@ LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,map
 LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
 LDFLAGS = $(LDFLAGS-y)
 
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
+
 LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
 
 PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
@@ -37,7 +40,7 @@ libfsimage.so.$(MAJOR): libfsimage.so.$(
 	ln -sf $< $@
 
 libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ -lpthread
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS)
 
 -include $(DEPS)
 
diff -r 22d34c10797b -r 0ff2b4d05c2e tools/vtpm_manager/manager/Makefile
--- a/tools/vtpm_manager/manager/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/vtpm_manager/manager/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -33,4 +33,6 @@ mrproper: clean
 
 # libraries
 LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
-LIBS += -lcrypto -lpthread -lm
+LIBS += -lcrypto $(PTHREAD_LIBS) -lm
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
diff -r 22d34c10797b -r 0ff2b4d05c2e tools/xenpaging/Makefile
--- a/tools/xenpaging/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/xenpaging/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -1,8 +1,9 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore)
-LDLIBS += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -pthread
+CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(PTHREAD_CFLAGS)
+LDLIBS += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(PTHREAD_LIBS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
 
 POLICY    = default
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR3-0000oZ-7R; Fri, 13 Apr 2012 16:33: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 1SIjR2-0000mM-IL
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.139.83:50357] by server-3.bemta-5.messagelabs.com id
	E2/AB-25237-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334334795!23729806!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 662 invoked from network); 13 Apr 2012 16:33:17 -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 Apr 2012 16:33: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 1SIjQw-0004WB-Ok
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQw-0004Uu-NS
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Message-Id: <E1SIjQw-0004Uu-NS@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix eventloop_iteration
	over-locking
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150049 -3600
# Node ID 081230edcb5e508e622bdd8b806862f76d452e2d
# Parent  352e75baadeac4edc0e062d41692f1d428827204
libxl: Fix eventloop_iteration over-locking

eventloop_iteration's head comment says that it must be called with
the ctx locked exactly once, and this is indeed true, and it's done
correctly at both the call sites.

However, it takes out the lock an additional time itself.  This is
wrong because it prevents the unlocks around poll from being
effective.  This would mean that a multithreaded event-loop using
program might suffer from undesired blocking, as one thread trying to
enter libxl might end up stalled by another thread waiting for a slow
event.  So remove those two lock calls.

Also add a couple of comments documenting the locking behaviour of
libxl__ao_inprogress and libxl__egc_cleanup.

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


diff -r 352e75baadea -r 081230edcb5e tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:09 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:09 2012 +0100
@@ -1058,8 +1058,6 @@ static int eventloop_iteration(libxl__eg
     int rc;
     struct timeval now;
     
-    CTX_LOCK;
-
     rc = libxl__gettimeofday(gc, &now);
     if (rc) goto out;
 
@@ -1102,8 +1100,6 @@ static int eventloop_iteration(libxl__eg
     afterpoll_internal(egc, poller,
                        poller->fd_polls_allocd, poller->fd_polls, now);
 
-    CTX_UNLOCK;
-
     rc = 0;
  out:
     return rc;
diff -r 352e75baadea -r 081230edcb5e tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:09 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:09 2012 +0100
@@ -1191,7 +1191,7 @@ libxl__device_model_version_running(libx
 _hidden void libxl__egc_cleanup(libxl__egc *egc);
   /* Frees memory allocated within this egc's gc, and and report all
    * occurred events via callback, if applicable.  May reenter the
-   * application; see restrictions above. */
+   * application; see restrictions above.  The ctx must be UNLOCKED. */
 
 /* convenience macros: */
 
@@ -1287,7 +1287,7 @@ _hidden void libxl__egc_cleanup(libxl__e
  * libxl__ao_inprogress MUST be called with the ctx locked exactly once. */
 _hidden libxl__ao *libxl__ao_create(libxl_ctx*, uint32_t domid,
                                     const libxl_asyncop_how*);
-_hidden int libxl__ao_inprogress(libxl__ao *ao);
+_hidden int libxl__ao_inprogress(libxl__ao *ao); /* temporarily unlocks */
 _hidden void libxl__ao_abort(libxl__ao *ao);
 _hidden void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc);
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR2-0000o0-Vj; Fri, 13 Apr 2012 16:33:20 +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 1SIjR1-0000k7-7w
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from [193.109.254.147:31280] by server-8.bemta-14.messagelabs.com id
	18/99-23244-D45588F4; Fri, 13 Apr 2012 16:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334334796!2027578!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 403 invoked from network); 13 Apr 2012 16:33:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33: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 1SIjQx-0004WH-QH
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQx-0004VO-P9
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Message-Id: <E1SIjQx-0004VO-P9@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix leak of ctx->lock
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150050 -3600
# Node ID fe49c1c9bd6bb3f3cffe784cc6f7f6e283bb661e
# Parent  0dd557cb56724f4d25885c59a416399c762e3eb9
libxl: Fix leak of ctx->lock

A mutex created with pthread_mutex_init, like ctx->lock, may need to
be destroyed with pthread_mutex_destroy.

Also, previously, if libxl__init_recursive_mutex failed, the nascent
ctx would be leaked.  Add some comments which will hopefully make
these kind of mistakes less likely in future.

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


diff -r 0dd557cb5672 -r fe49c1c9bd6b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:10 2012 +0100
@@ -39,10 +39,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
     memset(ctx, 0, sizeof(libxl_ctx));
     ctx->lg = lg;
 
-    if (libxl__init_recursive_mutex(ctx, &ctx->lock) < 0) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
-        return ERROR_FAIL;
-    }
+    /* First initialise pointers (cannot fail) */
 
     LIBXL_TAILQ_INIT(&ctx->occurred);
 
@@ -61,6 +58,16 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
     LIBXL_TAILQ_INIT(&ctx->death_list);
     libxl__ev_xswatch_init(&ctx->death_watch);
 
+    /* The mutex is special because we can't idempotently destroy it */
+
+    if (libxl__init_recursive_mutex(ctx, &ctx->lock) < 0) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
+        free(ctx);
+        ctx = 0;
+    }
+
+    /* Now ctx is safe for ctx_free; failures simply set rc and "goto out" */
+
     rc = libxl__poller_init(ctx, &ctx->poller_app);
     if (rc) goto out;
 
@@ -150,6 +157,8 @@ int libxl_ctx_free(libxl_ctx *ctx)
 
     discard_events(&ctx->occurred);
 
+    pthread_mutex_destroy(&ctx->lock);
+
     GC_FREE;
     free(ctx);
     return 0;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR3-0000on-9k; Fri, 13 Apr 2012 16:33:21 +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 1SIjR2-0000mJ-JB
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.138.51:24931] by server-7.bemta-3.messagelabs.com id
	24/6F-03078-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1334334797!22090450!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28353 invoked from network); 13 Apr 2012 16:33:18 -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;
	13 Apr 2012 16:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004WQ-Bt
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004W7-Ae
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Message-Id: <E1SIjQz-0004W7-Ae@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Use PTHREAD_CFLAGS, _LDFLAGS,
	_LIBS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150053 -3600
# Node ID 0ff2b4d05c2eaf7ab4cf62ec87f1ceea24f8830c
# Parent  22d34c10797b496a1da2f242512911f92f8f145b
tools: Use PTHREAD_CFLAGS, _LDFLAGS, _LIBS

Replace all literal occurrences of -lpthread and -pthread in Makefiles
by references to PTHREAD_CFLAGS, PTHREAD_LDFLAGS and PTHREAD_LIBS.
These are the new variables set by configure, and currently expand to
-pthread on the compilation and link lines as is required.

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


diff -r 22d34c10797b -r 0ff2b4d05c2e tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/blktap/drivers/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -35,8 +35,11 @@ else
 AIOLIBS     := -laio
 endif
 
-LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm -lpthread
-LDLIBS_img := $(AIOLIBS) $(CRYPT_LIB) -lpthread -lz
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
+
+LDLIBS_blktapctrl := $(MEMSHRLIBS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -L../lib -lblktap -lrt -lm $(PTHREAD_LIBS)
+LDLIBS_img := $(AIOLIBS) $(CRYPT_LIB) $(PTHREAD_LIBS) -lz
 
 BLK-OBJS-y  := block-aio.o
 BLK-OBJS-y  += block-sync.o
diff -r 22d34c10797b -r 0ff2b4d05c2e tools/libfsimage/common/Makefile
--- a/tools/libfsimage/common/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/libfsimage/common/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -8,6 +8,9 @@ LDFLAGS-$(CONFIG_SunOS) = -Wl,-M -Wl,map
 LDFLAGS-$(CONFIG_Linux) = -Wl,mapfile-GNU
 LDFLAGS = $(LDFLAGS-y)
 
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
+
 LIB_SRCS-y = fsimage.c fsimage_plugin.c fsimage_grub.c
 
 PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
@@ -37,7 +40,7 @@ libfsimage.so.$(MAJOR): libfsimage.so.$(
 	ln -sf $< $@
 
 libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ -lpthread
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS)
 
 -include $(DEPS)
 
diff -r 22d34c10797b -r 0ff2b4d05c2e tools/vtpm_manager/manager/Makefile
--- a/tools/vtpm_manager/manager/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/vtpm_manager/manager/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -33,4 +33,6 @@ mrproper: clean
 
 # libraries
 LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
-LIBS += -lcrypto -lpthread -lm
+LIBS += -lcrypto $(PTHREAD_LIBS) -lm
+CFLAGS += $(PTHREAD_CFLAGS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
diff -r 22d34c10797b -r 0ff2b4d05c2e tools/xenpaging/Makefile
--- a/tools/xenpaging/Makefile	Wed Apr 11 14:14:12 2012 +0100
+++ b/tools/xenpaging/Makefile	Wed Apr 11 14:14:13 2012 +0100
@@ -1,8 +1,9 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore)
-LDLIBS += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) -pthread
+CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(PTHREAD_CFLAGS)
+LDLIBS += $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) $(PTHREAD_LIBS)
+LDFLAGS += $(PTHREAD_LDFLAGS)
 
 POLICY    = default
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR3-0000oZ-7R; Fri, 13 Apr 2012 16:33: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 1SIjR2-0000mM-IL
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.139.83:50357] by server-3.bemta-5.messagelabs.com id
	E2/AB-25237-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334334795!23729806!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 662 invoked from network); 13 Apr 2012 16:33:17 -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 Apr 2012 16:33: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 1SIjQw-0004WB-Ok
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQw-0004Uu-NS
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Message-Id: <E1SIjQw-0004Uu-NS@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix eventloop_iteration
	over-locking
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150049 -3600
# Node ID 081230edcb5e508e622bdd8b806862f76d452e2d
# Parent  352e75baadeac4edc0e062d41692f1d428827204
libxl: Fix eventloop_iteration over-locking

eventloop_iteration's head comment says that it must be called with
the ctx locked exactly once, and this is indeed true, and it's done
correctly at both the call sites.

However, it takes out the lock an additional time itself.  This is
wrong because it prevents the unlocks around poll from being
effective.  This would mean that a multithreaded event-loop using
program might suffer from undesired blocking, as one thread trying to
enter libxl might end up stalled by another thread waiting for a slow
event.  So remove those two lock calls.

Also add a couple of comments documenting the locking behaviour of
libxl__ao_inprogress and libxl__egc_cleanup.

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


diff -r 352e75baadea -r 081230edcb5e tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:09 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:09 2012 +0100
@@ -1058,8 +1058,6 @@ static int eventloop_iteration(libxl__eg
     int rc;
     struct timeval now;
     
-    CTX_LOCK;
-
     rc = libxl__gettimeofday(gc, &now);
     if (rc) goto out;
 
@@ -1102,8 +1100,6 @@ static int eventloop_iteration(libxl__eg
     afterpoll_internal(egc, poller,
                        poller->fd_polls_allocd, poller->fd_polls, now);
 
-    CTX_UNLOCK;
-
     rc = 0;
  out:
     return rc;
diff -r 352e75baadea -r 081230edcb5e tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:09 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:09 2012 +0100
@@ -1191,7 +1191,7 @@ libxl__device_model_version_running(libx
 _hidden void libxl__egc_cleanup(libxl__egc *egc);
   /* Frees memory allocated within this egc's gc, and and report all
    * occurred events via callback, if applicable.  May reenter the
-   * application; see restrictions above. */
+   * application; see restrictions above.  The ctx must be UNLOCKED. */
 
 /* convenience macros: */
 
@@ -1287,7 +1287,7 @@ _hidden void libxl__egc_cleanup(libxl__e
  * libxl__ao_inprogress MUST be called with the ctx locked exactly once. */
 _hidden libxl__ao *libxl__ao_create(libxl_ctx*, uint32_t domid,
                                     const libxl_asyncop_how*);
-_hidden int libxl__ao_inprogress(libxl__ao *ao);
+_hidden int libxl__ao_inprogress(libxl__ao *ao); /* temporarily unlocks */
 _hidden void libxl__ao_abort(libxl__ao *ao);
 _hidden void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc);
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR0-0000kc-Gf; Fri, 13 Apr 2012 16:33:18 +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 1SIjQz-0000jI-66
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from [85.158.138.51:24667] by server-9.bemta-3.messagelabs.com id
	35/E2-26691-C45588F4; Fri, 13 Apr 2012 16:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1334334794!22091035!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9157 invoked from network); 13 Apr 2012 16:33:15 -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;
	13 Apr 2012 16:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004W5-NY
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004UQ-MF
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Message-Id: <E1SIjQv-0004UQ-MF@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: ao: allow immediate completion
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150048 -3600
# Node ID a0499ee197007b64b1e3379d5f8356abb0c5b045
# Parent  d3e4b3ef77834bc879788a450aecc5ada0d41643
libxl: ao: allow immediate completion

Make it possible to complete an ao during its initating function.

Previously this was not generally possible because initiators did not
have an egc.  But there is no reason why an ao initiator should not
have an egc, so make the standard macros provide one.

Change the internal documentation comments accordingly.  (This change,
which means that an initiator function may call a completion callback
directly, is already consistent with the documented external API.)

We also invent of a new state flag "constructing" which indicates
whether we are between ao__create and ao__inprogress.  This is a
slightly optimisation which allows ao_complete to not bother poking
the wakeup pipe, since the logic in ao__inprogress will not run the
event loop if the ao is complete on entry.

Also fix the wording in the libxl_internal.h comment forbidding use of
ao_how-taking functions from within libxl.  (There are sadly currently
some such functions.)

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


diff -r d3e4b3ef7783 -r a0499ee19700 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:07 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:08 2012 +0100
@@ -1225,7 +1225,9 @@ void libxl__ao_complete(libxl__egc *egc,
 
     if (ao->poller) {
         assert(ao->in_initiator);
-        libxl__poller_wakeup(egc, ao->poller);
+        if (!ao->constructing)
+            /* don't bother with this if we're not in the event loop */
+            libxl__poller_wakeup(egc, ao->poller);
     } else if (ao->how.callback) {
         LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback);
     } else {
@@ -1251,6 +1253,7 @@ libxl__ao *libxl__ao_create(libxl_ctx *c
     if (!ao) goto out;
 
     ao->magic = LIBXL__AO_MAGIC;
+    ao->constructing = 1;
     ao->in_initiator = 1;
     ao->poller = 0;
     ao->domid = domid;
@@ -1275,7 +1278,9 @@ int libxl__ao_inprogress(libxl__ao *ao)
     int rc;
 
     assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(ao->constructing);
     assert(ao->in_initiator);
+    ao->constructing = 0;
 
     if (ao->poller) {
         /* Caller wants it done synchronously. */
diff -r d3e4b3ef7783 -r a0499ee19700 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:07 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:08 2012 +0100
@@ -347,7 +347,7 @@ struct libxl__egc {
 
 struct libxl__ao {
     uint32_t magic;
-    unsigned in_initiator:1, complete:1, notified:1;
+    unsigned constructing:1, in_initiator:1, complete:1, notified:1;
     int rc;
     libxl__gc gc;
     libxl_asyncop_how how;
@@ -1209,7 +1209,11 @@ _hidden void libxl__egc_cleanup(libxl__e
  * operation ("ao") machinery.  The function should take a parameter
  * const libxl_asyncop_how *ao_how and must start with a call to
  * AO_INITIATOR_ENTRY.  These functions MAY NOT be called from
- * outside libxl, because they can cause reentrancy callbacks.
+ * inside libxl, because they can cause reentrancy callbacks.
+ *
+ * For the same reason functions taking an ao_how may make themselves
+ * an egc with EGC_INIT (and they will generally want to, to be able
+ * to immediately complete an ao during its setup).
  *
  * Lifecycle of an ao:
  *
@@ -1240,8 +1244,7 @@ _hidden void libxl__egc_cleanup(libxl__e
  *   directly or indirectly, should call libxl__ao_complete (with the
  *   ctx locked, as it will generally already be in any event callback
  *   function).  This must happen exactly once for each ao (and not if
- *   the ao has been destroyed, obviously), and it may not happen
- *   until libxl__ao_inprogress has been called on the ao.
+ *   the ao has been destroyed, obviously).
  *
  * - Note that during callback functions, two gcs are available:
  *    - The one in egc, whose lifetime is only this callback
@@ -1255,12 +1258,14 @@ _hidden void libxl__egc_cleanup(libxl__e
     libxl__ctx_lock(ctx);                                       \
     libxl__ao *ao = libxl__ao_create(ctx, domid, ao_how);       \
     if (!ao) { libxl__ctx_unlock(ctx); return ERROR_NOMEM; }    \
+    libxl__egc egc[1]; LIBXL_INIT_EGC(egc[0],ctx);              \
     AO_GC;
 
 #define AO_INPROGRESS ({                                        \
         libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
         int ao__rc = libxl__ao_inprogress(ao);                  \
         libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        EGC_FREE;                                               \
         (ao__rc);                                               \
    })
 
@@ -1269,6 +1274,7 @@ _hidden void libxl__egc_cleanup(libxl__e
         assert(rc);                                             \
         libxl__ao_abort(ao);                                    \
         libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        EGC_FREE;                                               \
         (rc);                                                   \
     })
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR0-0000kc-Gf; Fri, 13 Apr 2012 16:33:18 +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 1SIjQz-0000jI-66
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from [85.158.138.51:24667] by server-9.bemta-3.messagelabs.com id
	35/E2-26691-C45588F4; Fri, 13 Apr 2012 16:33:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1334334794!22091035!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9157 invoked from network); 13 Apr 2012 16:33:15 -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;
	13 Apr 2012 16:33:15 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004W5-NY
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQv-0004UQ-MF
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:13 +0000
Message-Id: <E1SIjQv-0004UQ-MF@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: ao: allow immediate completion
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150048 -3600
# Node ID a0499ee197007b64b1e3379d5f8356abb0c5b045
# Parent  d3e4b3ef77834bc879788a450aecc5ada0d41643
libxl: ao: allow immediate completion

Make it possible to complete an ao during its initating function.

Previously this was not generally possible because initiators did not
have an egc.  But there is no reason why an ao initiator should not
have an egc, so make the standard macros provide one.

Change the internal documentation comments accordingly.  (This change,
which means that an initiator function may call a completion callback
directly, is already consistent with the documented external API.)

We also invent of a new state flag "constructing" which indicates
whether we are between ao__create and ao__inprogress.  This is a
slightly optimisation which allows ao_complete to not bother poking
the wakeup pipe, since the logic in ao__inprogress will not run the
event loop if the ao is complete on entry.

Also fix the wording in the libxl_internal.h comment forbidding use of
ao_how-taking functions from within libxl.  (There are sadly currently
some such functions.)

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


diff -r d3e4b3ef7783 -r a0499ee19700 tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:07 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:08 2012 +0100
@@ -1225,7 +1225,9 @@ void libxl__ao_complete(libxl__egc *egc,
 
     if (ao->poller) {
         assert(ao->in_initiator);
-        libxl__poller_wakeup(egc, ao->poller);
+        if (!ao->constructing)
+            /* don't bother with this if we're not in the event loop */
+            libxl__poller_wakeup(egc, ao->poller);
     } else if (ao->how.callback) {
         LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback);
     } else {
@@ -1251,6 +1253,7 @@ libxl__ao *libxl__ao_create(libxl_ctx *c
     if (!ao) goto out;
 
     ao->magic = LIBXL__AO_MAGIC;
+    ao->constructing = 1;
     ao->in_initiator = 1;
     ao->poller = 0;
     ao->domid = domid;
@@ -1275,7 +1278,9 @@ int libxl__ao_inprogress(libxl__ao *ao)
     int rc;
 
     assert(ao->magic == LIBXL__AO_MAGIC);
+    assert(ao->constructing);
     assert(ao->in_initiator);
+    ao->constructing = 0;
 
     if (ao->poller) {
         /* Caller wants it done synchronously. */
diff -r d3e4b3ef7783 -r a0499ee19700 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:07 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:08 2012 +0100
@@ -347,7 +347,7 @@ struct libxl__egc {
 
 struct libxl__ao {
     uint32_t magic;
-    unsigned in_initiator:1, complete:1, notified:1;
+    unsigned constructing:1, in_initiator:1, complete:1, notified:1;
     int rc;
     libxl__gc gc;
     libxl_asyncop_how how;
@@ -1209,7 +1209,11 @@ _hidden void libxl__egc_cleanup(libxl__e
  * operation ("ao") machinery.  The function should take a parameter
  * const libxl_asyncop_how *ao_how and must start with a call to
  * AO_INITIATOR_ENTRY.  These functions MAY NOT be called from
- * outside libxl, because they can cause reentrancy callbacks.
+ * inside libxl, because they can cause reentrancy callbacks.
+ *
+ * For the same reason functions taking an ao_how may make themselves
+ * an egc with EGC_INIT (and they will generally want to, to be able
+ * to immediately complete an ao during its setup).
  *
  * Lifecycle of an ao:
  *
@@ -1240,8 +1244,7 @@ _hidden void libxl__egc_cleanup(libxl__e
  *   directly or indirectly, should call libxl__ao_complete (with the
  *   ctx locked, as it will generally already be in any event callback
  *   function).  This must happen exactly once for each ao (and not if
- *   the ao has been destroyed, obviously), and it may not happen
- *   until libxl__ao_inprogress has been called on the ao.
+ *   the ao has been destroyed, obviously).
  *
  * - Note that during callback functions, two gcs are available:
  *    - The one in egc, whose lifetime is only this callback
@@ -1255,12 +1258,14 @@ _hidden void libxl__egc_cleanup(libxl__e
     libxl__ctx_lock(ctx);                                       \
     libxl__ao *ao = libxl__ao_create(ctx, domid, ao_how);       \
     if (!ao) { libxl__ctx_unlock(ctx); return ERROR_NOMEM; }    \
+    libxl__egc egc[1]; LIBXL_INIT_EGC(egc[0],ctx);              \
     AO_GC;
 
 #define AO_INPROGRESS ({                                        \
         libxl_ctx *ao__ctx = libxl__gc_owner(&ao->gc);          \
         int ao__rc = libxl__ao_inprogress(ao);                  \
         libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        EGC_FREE;                                               \
         (ao__rc);                                               \
    })
 
@@ -1269,6 +1274,7 @@ _hidden void libxl__egc_cleanup(libxl__e
         assert(rc);                                             \
         libxl__ao_abort(ao);                                    \
         libxl__ctx_unlock(ao__ctx); /* gc is now invalid */     \
+        EGC_FREE;                                               \
         (rc);                                                   \
     })
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 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 1SIjR2-0000o0-Vj; Fri, 13 Apr 2012 16:33:20 +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 1SIjR1-0000k7-7w
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from [193.109.254.147:31280] by server-8.bemta-14.messagelabs.com id
	18/99-23244-D45588F4; Fri, 13 Apr 2012 16:33:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334334796!2027578!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 403 invoked from network); 13 Apr 2012 16:33:17 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33: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 1SIjQx-0004WH-QH
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQx-0004VO-P9
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:15 +0000
Message-Id: <E1SIjQx-0004VO-P9@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Fix leak of ctx->lock
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150050 -3600
# Node ID fe49c1c9bd6bb3f3cffe784cc6f7f6e283bb661e
# Parent  0dd557cb56724f4d25885c59a416399c762e3eb9
libxl: Fix leak of ctx->lock

A mutex created with pthread_mutex_init, like ctx->lock, may need to
be destroyed with pthread_mutex_destroy.

Also, previously, if libxl__init_recursive_mutex failed, the nascent
ctx would be leaked.  Add some comments which will hopefully make
these kind of mistakes less likely in future.

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


diff -r 0dd557cb5672 -r fe49c1c9bd6b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:10 2012 +0100
@@ -39,10 +39,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
     memset(ctx, 0, sizeof(libxl_ctx));
     ctx->lg = lg;
 
-    if (libxl__init_recursive_mutex(ctx, &ctx->lock) < 0) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
-        return ERROR_FAIL;
-    }
+    /* First initialise pointers (cannot fail) */
 
     LIBXL_TAILQ_INIT(&ctx->occurred);
 
@@ -61,6 +58,16 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
     LIBXL_TAILQ_INIT(&ctx->death_list);
     libxl__ev_xswatch_init(&ctx->death_watch);
 
+    /* The mutex is special because we can't idempotently destroy it */
+
+    if (libxl__init_recursive_mutex(ctx, &ctx->lock) < 0) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
+        free(ctx);
+        ctx = 0;
+    }
+
+    /* Now ctx is safe for ctx_free; failures simply set rc and "goto out" */
+
     rc = libxl__poller_init(ctx, &ctx->poller_app);
     if (rc) goto out;
 
@@ -150,6 +157,8 @@ int libxl_ctx_free(libxl_ctx *ctx)
 
     discard_events(&ctx->occurred);
 
+    pthread_mutex_destroy(&ctx->lock);
+
     GC_FREE;
     free(ctx);
     return 0;

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR3-0000oS-5B; Fri, 13 Apr 2012 16:33: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 1SIjR2-0000mL-GZ
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.139.83:48963] by server-9.bemta-5.messagelabs.com id
	FE/DA-09826-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1334334795!19122590!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22863 invoked from network); 13 Apr 2012 16:33:17 -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;
	13 Apr 2012 16:33: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 1SIjQw-0004W8-B6
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQw-0004Uf-6g
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Message-Id: <E1SIjQw-0004Uf-6g@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix hang due to
	libxl__initiate_device_remove
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150049 -3600
# Node ID 352e75baadeac4edc0e062d41692f1d428827204
# Parent  a0499ee197007b64b1e3379d5f8356abb0c5b045
libxl: fix hang due to libxl__initiate_device_remove

libxl__initiate_device_remove might discover that the operation was
complete, immediately (typically, if the device is already removed).

Previously, in this situation, it would return 0 to the caller but
never call libxl__ao_complete.  Fix this.  This necessitates passing
the egc in from the functions which are the ao initiators.

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


diff -r a0499ee19700 -r 352e75baadea tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:08 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:09 2012 +0100
@@ -1406,7 +1406,7 @@ int libxl_device_disk_remove(libxl_ctx *
     rc = libxl__device_from_disk(gc, domid, disk, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
@@ -1873,7 +1873,7 @@ int libxl_device_nic_remove(libxl_ctx *c
     rc = libxl__device_from_nic(gc, domid, nic, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
@@ -2220,7 +2220,7 @@ int libxl_device_vkb_remove(libxl_ctx *c
     rc = libxl__device_from_vkb(gc, domid, vkb, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
@@ -2353,7 +2353,7 @@ int libxl_device_vfb_remove(libxl_ctx *c
     rc = libxl__device_from_vfb(gc, domid, vfb, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
diff -r a0499ee19700 -r 352e75baadea tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Wed Apr 11 14:14:08 2012 +0100
+++ b/tools/libxl/libxl_device.c	Wed Apr 11 14:14:09 2012 +0100
@@ -376,7 +376,8 @@ static void device_remove_callback(libxl
     device_remove_cleanup(gc, aorm);
 }
 
-int libxl__initiate_device_remove(libxl__ao *ao, libxl__device *dev)
+int libxl__initiate_device_remove(libxl__egc *egc, libxl__ao *ao,
+                                  libxl__device *dev)
 {
     AO_GC;
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -388,11 +389,11 @@ int libxl__initiate_device_remove(libxl_
     libxl__ao_device_remove *aorm = 0;
 
     if (!state)
-        goto out;
+        goto out_ok;
     if (atoi(state) != 4) {
         libxl__device_destroy_tapdisk(gc, be_path);
         xs_rm(ctx->xsh, XBT_NULL, be_path);
-        goto out;
+        goto out_ok;
     }
 
 retry_transaction:
@@ -404,7 +405,7 @@ retry_transaction:
             goto retry_transaction;
         else {
             rc = ERROR_FAIL;
-            goto out;
+            goto out_fail;
         }
     }
 
@@ -417,13 +418,18 @@ retry_transaction:
     rc = libxl__ev_devstate_wait(gc, &aorm->ds, device_remove_callback,
                                  state_path, XenbusStateClosed,
                                  LIBXL_DESTROY_TIMEOUT * 1000);
-    if (rc) goto out;
+    if (rc) goto out_fail;
 
     return 0;
 
- out:
+ out_fail:
+    assert(rc);
     device_remove_cleanup(gc, aorm);
     return rc;
+
+ out_ok:
+    libxl__ao_complete(egc, ao, 0);
+    return 0;
 }
 
 int libxl__device_destroy(libxl__gc *gc, libxl__device *dev)
diff -r a0499ee19700 -r 352e75baadea tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:08 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:09 2012 +0100
@@ -692,7 +692,8 @@ _hidden int libxl__wait_for_backend(libx
  * this is done, the ao will be completed.  An error
  * return from libxl__initiate_device_remove means that the ao
  * will _not_ be completed and the caller must do so. */
-_hidden int libxl__initiate_device_remove(libxl__ao*, libxl__device *dev);
+_hidden int libxl__initiate_device_remove(libxl__egc*, libxl__ao*,
+                                          libxl__device *dev);
 
 /*
  * libxl__ev_devstate - waits a given time for a device to

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR3-0000oS-5B; Fri, 13 Apr 2012 16:33: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 1SIjR2-0000mL-GZ
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.139.83:48963] by server-9.bemta-5.messagelabs.com id
	FE/DA-09826-F45588F4; Fri, 13 Apr 2012 16:33:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1334334795!19122590!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22863 invoked from network); 13 Apr 2012 16:33:17 -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;
	13 Apr 2012 16:33: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 1SIjQw-0004W8-B6
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQw-0004Uf-6g
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:14 +0000
Message-Id: <E1SIjQw-0004Uf-6g@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix hang due to
	libxl__initiate_device_remove
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150049 -3600
# Node ID 352e75baadeac4edc0e062d41692f1d428827204
# Parent  a0499ee197007b64b1e3379d5f8356abb0c5b045
libxl: fix hang due to libxl__initiate_device_remove

libxl__initiate_device_remove might discover that the operation was
complete, immediately (typically, if the device is already removed).

Previously, in this situation, it would return 0 to the caller but
never call libxl__ao_complete.  Fix this.  This necessitates passing
the egc in from the functions which are the ao initiators.

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


diff -r a0499ee19700 -r 352e75baadea tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:08 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:09 2012 +0100
@@ -1406,7 +1406,7 @@ int libxl_device_disk_remove(libxl_ctx *
     rc = libxl__device_from_disk(gc, domid, disk, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
@@ -1873,7 +1873,7 @@ int libxl_device_nic_remove(libxl_ctx *c
     rc = libxl__device_from_nic(gc, domid, nic, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
@@ -2220,7 +2220,7 @@ int libxl_device_vkb_remove(libxl_ctx *c
     rc = libxl__device_from_vkb(gc, domid, vkb, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
@@ -2353,7 +2353,7 @@ int libxl_device_vfb_remove(libxl_ctx *c
     rc = libxl__device_from_vfb(gc, domid, vfb, &device);
     if (rc != 0) goto out;
 
-    rc = libxl__initiate_device_remove(ao, &device);
+    rc = libxl__initiate_device_remove(egc, ao, &device);
     if (rc) goto out;
 
     return AO_INPROGRESS;
diff -r a0499ee19700 -r 352e75baadea tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Wed Apr 11 14:14:08 2012 +0100
+++ b/tools/libxl/libxl_device.c	Wed Apr 11 14:14:09 2012 +0100
@@ -376,7 +376,8 @@ static void device_remove_callback(libxl
     device_remove_cleanup(gc, aorm);
 }
 
-int libxl__initiate_device_remove(libxl__ao *ao, libxl__device *dev)
+int libxl__initiate_device_remove(libxl__egc *egc, libxl__ao *ao,
+                                  libxl__device *dev)
 {
     AO_GC;
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -388,11 +389,11 @@ int libxl__initiate_device_remove(libxl_
     libxl__ao_device_remove *aorm = 0;
 
     if (!state)
-        goto out;
+        goto out_ok;
     if (atoi(state) != 4) {
         libxl__device_destroy_tapdisk(gc, be_path);
         xs_rm(ctx->xsh, XBT_NULL, be_path);
-        goto out;
+        goto out_ok;
     }
 
 retry_transaction:
@@ -404,7 +405,7 @@ retry_transaction:
             goto retry_transaction;
         else {
             rc = ERROR_FAIL;
-            goto out;
+            goto out_fail;
         }
     }
 
@@ -417,13 +418,18 @@ retry_transaction:
     rc = libxl__ev_devstate_wait(gc, &aorm->ds, device_remove_callback,
                                  state_path, XenbusStateClosed,
                                  LIBXL_DESTROY_TIMEOUT * 1000);
-    if (rc) goto out;
+    if (rc) goto out_fail;
 
     return 0;
 
- out:
+ out_fail:
+    assert(rc);
     device_remove_cleanup(gc, aorm);
     return rc;
+
+ out_ok:
+    libxl__ao_complete(egc, ao, 0);
+    return 0;
 }
 
 int libxl__device_destroy(libxl__gc *gc, libxl__device *dev)
diff -r a0499ee19700 -r 352e75baadea tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:08 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:09 2012 +0100
@@ -692,7 +692,8 @@ _hidden int libxl__wait_for_backend(libx
  * this is done, the ao will be completed.  An error
  * return from libxl__initiate_device_remove means that the ao
  * will _not_ be completed and the caller must do so. */
-_hidden int libxl__initiate_device_remove(libxl__ao*, libxl__device *dev);
+_hidden int libxl__initiate_device_remove(libxl__egc*, libxl__ao*,
+                                          libxl__device *dev);
 
 /*
  * libxl__ev_devstate - waits a given time for a device to

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR3-0000ow-CW; Fri, 13 Apr 2012 16:33: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 1SIjR2-0000io-LC
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.143.35:41737] by server-3.bemta-4.messagelabs.com id
	10/47-05853-055588F4; Fri, 13 Apr 2012 16:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1334334796!12601263!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3379 invoked from network); 13 Apr 2012 16:33:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004WK-Ax
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004Vd-9p
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Message-Id: <E1SIjQy-0004Vd-9p@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Correct PTHREAD options in
	config/StdGNU.mk
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150051 -3600
# Node ID 181478052ea2d2db5f7edc724d13c79058dcf538
# Parent  fe49c1c9bd6bb3f3cffe784cc6f7f6e283bb661e
tools: Correct PTHREAD options in config/StdGNU.mk

It is not correct to say -lpthread.  The correct option is -pthread,
which may have sundry other effects on code generation etc.  It needs
to be passed both to compilation and linking.

Fix the configure test to test -pthread, and plumb the resulting flag
through to PTHREAD_{CFLAGS,LDFLAGS} in Tools.mk; also substitute
PTHREAD_LIBS (although this will currently always be empty).
Remove PTHREAD_LIBS setting from StdGNU.mk.

Fix the one user (libxc) to use PTHREAD_{CFLAGS,LDFLAGS} too.

There are still some other users in tree which pass -pthread or
-lpthread by adding it as a literal to their own compiler options.
These will be fixed in a later patch.

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


diff -r fe49c1c9bd6b -r 181478052ea2 config/StdGNU.mk
--- a/config/StdGNU.mk	Wed Apr 11 14:14:10 2012 +0100
+++ b/config/StdGNU.mk	Wed Apr 11 14:14:11 2012 +0100
@@ -67,7 +67,6 @@ XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
 
 SOCKET_LIBS =
-PTHREAD_LIBS = -lpthread
 UTIL_LIBS = -lutil
 DLOPEN_LIBS = -ldl
 
diff -r fe49c1c9bd6b -r 181478052ea2 config/Tools.mk.in
--- a/config/Tools.mk.in	Wed Apr 11 14:14:10 2012 +0100
+++ b/config/Tools.mk.in	Wed Apr 11 14:14:11 2012 +0100
@@ -26,6 +26,10 @@ PREPEND_LIB         := @PREPEND_LIB@
 APPEND_INCLUDES     := @APPEND_INCLUDES@
 APPEND_LIB          := @APPEND_LIB@
 
+PTHREAD_CFLAGS      := @PTHREAD_CFLAGS@
+PTHREAD_LDFLAGS     := @PTHREAD_LDFLAGS@
+PTHREAD_LIBS        := @PTHREAD_LIBS@
+
 # Download GIT repositories via HTTP or GIT's own protocol?
 # GIT's protocol is faster and more robust, when it works at all (firewalls
 # may block it). We make it the default, but if your GIT repository downloads
diff -r fe49c1c9bd6b -r 181478052ea2 tools/configure
--- a/tools/configure	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/configure	Wed Apr 11 14:14:11 2012 +0100
@@ -602,6 +602,9 @@ POW_LIB
 LIBOBJS
 ALLOCA
 libiconv
+PTHREAD_LIBS
+PTHREAD_LDFLAGS
+PTHREAD_CFLAGS
 libgcrypt
 libext2fs
 system_aio
@@ -3861,6 +3864,9 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+
+
+
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 #
@@ -3924,6 +3930,22 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+# We define, separately, PTHREAD_CFLAGS, _LDFLAGS and _LIBS
+# even though currently we don't set them very separately.
+# This means that the makefiles will not need to change in
+# the future if we make the test more sophisticated.
+
+
+
+# We invoke AX_PTHREAD_VARS with the name of another macro
+# which is then expanded once for each variable.
+
+
+
+
+
+
+
 
 # Enable/disable options
 
@@ -7228,47 +7250,70 @@ else
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread flag" >&5
+$as_echo_n "checking for pthread flag... " >&6; }
+if test "${ax_cv_pthread_flags+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        ax_cv_pthread_flags=-pthread
+
+    PTHREAD_CFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LDFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LIBS=""
+
+
+    saved_CFLAGS="$CFLAGS"
+
+    saved_LDFLAGS="$LDFLAGS"
+
+    saved_LIBS="$LIBS"
+
+
+    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+    LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
+
+    LIBS="$LIBS $PTHREAD_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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
-  ;
-  return 0;
+#include <pthread.h>
+int main(void) {
+  pthread_atfork(0,0,0);
+  pthread_create(0,0,0,0);
 }
+
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_pthread_pthread_create=yes
-else
-  ac_cv_lib_pthread_pthread_create=no
+
+else
+  ax_cv_pthread_flags=failed
 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_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then :
-
-else
-  as_fn_error $? "Could not find libpthread" "$LINENO" 5
-fi
+
+    CFLAGS="$saved_CFLAGS"
+
+    LDFLAGS="$saved_LDFLAGS"
+
+    LIBS="$saved_LIBS"
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_pthread_flags" >&5
+$as_echo "$ax_cv_pthread_flags" >&6; }
+    if test "x$ax_cv_pthread_flags" = xfailed; then
+        as_fn_error $? "-pthread does not work" "$LINENO" 5
+    fi
+
+    PTHREAD_CFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LDFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LIBS=""
+
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
 $as_echo_n "checking for clock_gettime in -lrt... " >&6; }
diff -r fe49c1c9bd6b -r 181478052ea2 tools/configure.ac
--- a/tools/configure.ac	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/configure.ac	Wed Apr 11 14:14:11 2012 +0100
@@ -23,6 +23,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_CANONICAL_HOST
 
 # M4 Macro includes
+m4_include([m4/savevar.m4])
 m4_include([m4/features.m4])
 m4_include([m4/path_or_fail.m4])
 m4_include([m4/python_version.m4])
@@ -33,6 +34,7 @@ m4_include([m4/set_cflags_ldflags.m4])
 m4_include([m4/uuid.m4])
 m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
+m4_include([m4/pthread.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -129,8 +131,7 @@ AC_CHECK_LIB([ext2fs], [ext2fs_open2], [
 AC_SUBST(libext2fs)
 AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
 AC_SUBST(libgcrypt)
-AC_CHECK_LIB([pthread], [pthread_create], [] ,
-    [AC_MSG_ERROR([Could not find libpthread])])
+AX_CHECK_PTHREAD
 AC_CHECK_LIB([rt], [clock_gettime])
 AC_CHECK_LIB([yajl], [yajl_alloc], [],
     [AC_MSG_ERROR([Could not find yajl])])
diff -r fe49c1c9bd6b -r 181478052ea2 tools/libxc/Makefile
--- a/tools/libxc/Makefile	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/libxc/Makefile	Wed Apr 11 14:14:11 2012 +0100
@@ -73,6 +73,8 @@ CFLAGS   += -I. $(CFLAGS_xeninclude)
 # Needed for posix_fadvise64() in xc_linux.c
 CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
 
+CFLAGS	+= $(PTHREAD_CFLAGS)
+
 # Define this to make it possible to run valgrind on code linked with these
 # libraries.
 #CFLAGS   += -DVALGRIND -O0 -ggdb3
@@ -157,7 +159,7 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$(
 	ln -sf $< $@
 
 libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
 
 # libxenguest
 
diff -r fe49c1c9bd6b -r 181478052ea2 tools/m4/pthread.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/pthread.m4	Wed Apr 11 14:14:11 2012 +0100
@@ -0,0 +1,41 @@
+# We define, separately, PTHREAD_CFLAGS, _LDFLAGS and _LIBS
+# even though currently we don't set them very separately.
+# This means that the makefiles will not need to change in
+# the future if we make the test more sophisticated.
+
+AC_DEFUN([AX_PTHREAD_CV2VARS],[
+    PTHREAD_CFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LDFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LIBS=""
+])
+
+# We invoke AX_PTHREAD_VARS with the name of another macro
+# which is then expanded once for each variable.
+AC_DEFUN([AX_PTHREAD_VARS],[$1(CFLAGS) $1(LDFLAGS) $1(LIBS)])
+
+AC_DEFUN([AX_PTHREAD_VAR_APPLY],[
+    $1="$$1 $PTHREAD_$1"
+])
+AC_DEFUN([AX_PTHREAD_VAR_SUBST],[AC_SUBST(PTHREAD_$1)])
+
+AC_DEFUN([AX_CHECK_PTHREAD],[
+    AC_CACHE_CHECK([for pthread flag], [ax_cv_pthread_flags], [
+        ax_cv_pthread_flags=-pthread
+        AX_PTHREAD_CV2VARS
+        AX_PTHREAD_VARS([AX_SAVEVAR_SAVE])
+        AX_PTHREAD_VARS([AX_PTHREAD_VAR_APPLY])
+        AC_LINK_IFELSE([
+#include <pthread.h>
+int main(void) {
+  pthread_atfork(0,0,0);
+  pthread_create(0,0,0,0);
+}
+],[],[ax_cv_pthread_flags=failed])
+        AX_PTHREAD_VARS([AX_SAVEVAR_RESTORE])
+    ])
+    if test "x$ax_cv_pthread_flags" = xfailed; then
+        AC_MSG_ERROR([-pthread does not work])
+    fi
+    AX_PTHREAD_CV2VARS
+    AX_PTHREAD_VARS([AX_PTHREAD_VAR_SUBST])
+])
diff -r fe49c1c9bd6b -r 181478052ea2 tools/m4/savevar.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/savevar.m4	Wed Apr 11 14:14:11 2012 +0100
@@ -0,0 +1,6 @@
+AC_DEFUN([AX_SAVEVAR_SAVE],[
+    saved_$1="$$1"
+])
+AC_DEFUN([AX_SAVEVAR_RESTORE],[
+    $1="$saved_$1"
+])

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16: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 1SIjR3-0000ow-CW; Fri, 13 Apr 2012 16:33: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 1SIjR2-0000io-LC
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from [85.158.143.35:41737] by server-3.bemta-4.messagelabs.com id
	10/47-05853-055588F4; Fri, 13 Apr 2012 16:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1334334796!12601263!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3379 invoked from network); 13 Apr 2012 16:33:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:18 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004WK-Ax
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQy-0004Vd-9p
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:16 +0000
Message-Id: <E1SIjQy-0004Vd-9p@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Correct PTHREAD options in
	config/StdGNU.mk
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150051 -3600
# Node ID 181478052ea2d2db5f7edc724d13c79058dcf538
# Parent  fe49c1c9bd6bb3f3cffe784cc6f7f6e283bb661e
tools: Correct PTHREAD options in config/StdGNU.mk

It is not correct to say -lpthread.  The correct option is -pthread,
which may have sundry other effects on code generation etc.  It needs
to be passed both to compilation and linking.

Fix the configure test to test -pthread, and plumb the resulting flag
through to PTHREAD_{CFLAGS,LDFLAGS} in Tools.mk; also substitute
PTHREAD_LIBS (although this will currently always be empty).
Remove PTHREAD_LIBS setting from StdGNU.mk.

Fix the one user (libxc) to use PTHREAD_{CFLAGS,LDFLAGS} too.

There are still some other users in tree which pass -pthread or
-lpthread by adding it as a literal to their own compiler options.
These will be fixed in a later patch.

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


diff -r fe49c1c9bd6b -r 181478052ea2 config/StdGNU.mk
--- a/config/StdGNU.mk	Wed Apr 11 14:14:10 2012 +0100
+++ b/config/StdGNU.mk	Wed Apr 11 14:14:11 2012 +0100
@@ -67,7 +67,6 @@ XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
 
 SOCKET_LIBS =
-PTHREAD_LIBS = -lpthread
 UTIL_LIBS = -lutil
 DLOPEN_LIBS = -ldl
 
diff -r fe49c1c9bd6b -r 181478052ea2 config/Tools.mk.in
--- a/config/Tools.mk.in	Wed Apr 11 14:14:10 2012 +0100
+++ b/config/Tools.mk.in	Wed Apr 11 14:14:11 2012 +0100
@@ -26,6 +26,10 @@ PREPEND_LIB         := @PREPEND_LIB@
 APPEND_INCLUDES     := @APPEND_INCLUDES@
 APPEND_LIB          := @APPEND_LIB@
 
+PTHREAD_CFLAGS      := @PTHREAD_CFLAGS@
+PTHREAD_LDFLAGS     := @PTHREAD_LDFLAGS@
+PTHREAD_LIBS        := @PTHREAD_LIBS@
+
 # Download GIT repositories via HTTP or GIT's own protocol?
 # GIT's protocol is faster and more robust, when it works at all (firewalls
 # may block it). We make it the default, but if your GIT repository downloads
diff -r fe49c1c9bd6b -r 181478052ea2 tools/configure
--- a/tools/configure	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/configure	Wed Apr 11 14:14:11 2012 +0100
@@ -602,6 +602,9 @@ POW_LIB
 LIBOBJS
 ALLOCA
 libiconv
+PTHREAD_LIBS
+PTHREAD_LDFLAGS
+PTHREAD_CFLAGS
 libgcrypt
 libext2fs
 system_aio
@@ -3861,6 +3864,9 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+
+
+
 # pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
 # serial 1 (pkg-config-0.24)
 #
@@ -3924,6 +3930,22 @@ case $host_os in *\ *) host_os=`echo "$h
 
 
 
+# We define, separately, PTHREAD_CFLAGS, _LDFLAGS and _LIBS
+# even though currently we don't set them very separately.
+# This means that the makefiles will not need to change in
+# the future if we make the test more sophisticated.
+
+
+
+# We invoke AX_PTHREAD_VARS with the name of another macro
+# which is then expanded once for each variable.
+
+
+
+
+
+
+
 
 # Enable/disable options
 
@@ -7228,47 +7250,70 @@ else
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread flag" >&5
+$as_echo_n "checking for pthread flag... " >&6; }
+if test "${ax_cv_pthread_flags+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        ax_cv_pthread_flags=-pthread
+
+    PTHREAD_CFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LDFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LIBS=""
+
+
+    saved_CFLAGS="$CFLAGS"
+
+    saved_LDFLAGS="$LDFLAGS"
+
+    saved_LIBS="$LIBS"
+
+
+    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+    LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
+
+    LIBS="$LIBS $PTHREAD_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 pthread_create ();
-int
-main ()
-{
-return pthread_create ();
-  ;
-  return 0;
+#include <pthread.h>
+int main(void) {
+  pthread_atfork(0,0,0);
+  pthread_create(0,0,0,0);
 }
+
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_pthread_pthread_create=yes
-else
-  ac_cv_lib_pthread_pthread_create=no
+
+else
+  ax_cv_pthread_flags=failed
 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_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then :
-
-else
-  as_fn_error $? "Could not find libpthread" "$LINENO" 5
-fi
+
+    CFLAGS="$saved_CFLAGS"
+
+    LDFLAGS="$saved_LDFLAGS"
+
+    LIBS="$saved_LIBS"
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_pthread_flags" >&5
+$as_echo "$ax_cv_pthread_flags" >&6; }
+    if test "x$ax_cv_pthread_flags" = xfailed; then
+        as_fn_error $? "-pthread does not work" "$LINENO" 5
+    fi
+
+    PTHREAD_CFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LDFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LIBS=""
+
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
 $as_echo_n "checking for clock_gettime in -lrt... " >&6; }
diff -r fe49c1c9bd6b -r 181478052ea2 tools/configure.ac
--- a/tools/configure.ac	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/configure.ac	Wed Apr 11 14:14:11 2012 +0100
@@ -23,6 +23,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_CANONICAL_HOST
 
 # M4 Macro includes
+m4_include([m4/savevar.m4])
 m4_include([m4/features.m4])
 m4_include([m4/path_or_fail.m4])
 m4_include([m4/python_version.m4])
@@ -33,6 +34,7 @@ m4_include([m4/set_cflags_ldflags.m4])
 m4_include([m4/uuid.m4])
 m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
+m4_include([m4/pthread.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -129,8 +131,7 @@ AC_CHECK_LIB([ext2fs], [ext2fs_open2], [
 AC_SUBST(libext2fs)
 AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
 AC_SUBST(libgcrypt)
-AC_CHECK_LIB([pthread], [pthread_create], [] ,
-    [AC_MSG_ERROR([Could not find libpthread])])
+AX_CHECK_PTHREAD
 AC_CHECK_LIB([rt], [clock_gettime])
 AC_CHECK_LIB([yajl], [yajl_alloc], [],
     [AC_MSG_ERROR([Could not find yajl])])
diff -r fe49c1c9bd6b -r 181478052ea2 tools/libxc/Makefile
--- a/tools/libxc/Makefile	Wed Apr 11 14:14:10 2012 +0100
+++ b/tools/libxc/Makefile	Wed Apr 11 14:14:11 2012 +0100
@@ -73,6 +73,8 @@ CFLAGS   += -I. $(CFLAGS_xeninclude)
 # Needed for posix_fadvise64() in xc_linux.c
 CFLAGS-$(CONFIG_Linux) += -D_GNU_SOURCE
 
+CFLAGS	+= $(PTHREAD_CFLAGS)
+
 # Define this to make it possible to run valgrind on code linked with these
 # libraries.
 #CFLAGS   += -DVALGRIND -O0 -ggdb3
@@ -157,7 +159,7 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$(
 	ln -sf $< $@
 
 libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
 
 # libxenguest
 
diff -r fe49c1c9bd6b -r 181478052ea2 tools/m4/pthread.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/pthread.m4	Wed Apr 11 14:14:11 2012 +0100
@@ -0,0 +1,41 @@
+# We define, separately, PTHREAD_CFLAGS, _LDFLAGS and _LIBS
+# even though currently we don't set them very separately.
+# This means that the makefiles will not need to change in
+# the future if we make the test more sophisticated.
+
+AC_DEFUN([AX_PTHREAD_CV2VARS],[
+    PTHREAD_CFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LDFLAGS="$ax_cv_pthread_flags"
+    PTHREAD_LIBS=""
+])
+
+# We invoke AX_PTHREAD_VARS with the name of another macro
+# which is then expanded once for each variable.
+AC_DEFUN([AX_PTHREAD_VARS],[$1(CFLAGS) $1(LDFLAGS) $1(LIBS)])
+
+AC_DEFUN([AX_PTHREAD_VAR_APPLY],[
+    $1="$$1 $PTHREAD_$1"
+])
+AC_DEFUN([AX_PTHREAD_VAR_SUBST],[AC_SUBST(PTHREAD_$1)])
+
+AC_DEFUN([AX_CHECK_PTHREAD],[
+    AC_CACHE_CHECK([for pthread flag], [ax_cv_pthread_flags], [
+        ax_cv_pthread_flags=-pthread
+        AX_PTHREAD_CV2VARS
+        AX_PTHREAD_VARS([AX_SAVEVAR_SAVE])
+        AX_PTHREAD_VARS([AX_PTHREAD_VAR_APPLY])
+        AC_LINK_IFELSE([
+#include <pthread.h>
+int main(void) {
+  pthread_atfork(0,0,0);
+  pthread_create(0,0,0,0);
+}
+],[],[ax_cv_pthread_flags=failed])
+        AX_PTHREAD_VARS([AX_SAVEVAR_RESTORE])
+    ])
+    if test "x$ax_cv_pthread_flags" = xfailed; then
+        AC_MSG_ERROR([-pthread does not work])
+    fi
+    AX_PTHREAD_CV2VARS
+    AX_PTHREAD_VARS([AX_PTHREAD_VAR_SUBST])
+])
diff -r fe49c1c9bd6b -r 181478052ea2 tools/m4/savevar.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/m4/savevar.m4	Wed Apr 11 14:14:11 2012 +0100
@@ -0,0 +1,6 @@
+AC_DEFUN([AX_SAVEVAR_SAVE],[
+    saved_$1="$$1"
+])
+AC_DEFUN([AX_SAVEVAR_RESTORE],[
+    $1="$saved_$1"
+])

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tn-Qf; Fri, 13 Apr 2012 16:33: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 1SIjR4-0000pW-9F
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from [85.158.138.51:24978] by server-4.bemta-3.messagelabs.com id
	FF/59-15341-055588F4; Fri, 13 Apr 2012 16:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1334334798!22082603!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24552 invoked from network); 13 Apr 2012 16:33:19 -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;
	13 Apr 2012 16:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004WT-Sc
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004WM-RP
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Message-Id: <E1SIjQz-0004WM-RP@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Crash (more sensibly) on
	malloc 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150053 -3600
# Node ID 26f72d923cb90fad0dd212348f5f8b85588780b0
# Parent  0ff2b4d05c2eaf7ab4cf62ec87f1ceea24f8830c
libxl: Crash (more sensibly) on malloc failure

Formally change the libxl memory allocation failure policy to "crash".

Previously we had a very uneven approach; much code assumed that
libxl__sprintf (for example) would never return NULL, but some code
was written more carefully.

We think it is unlikely that we will be able to make the library
actually robust against allocation failure (since that would be an
awful lot of never-tested error paths) and few calling environments
will be able to cope anyway.  So, instead, adopt the alternative
approach: provide allocation functions which never return null, but
will crash the whole process instead.

Consequently,
 - New noreturn function libxl__alloc_failed which may be used for
   printing a vaguely-useful error message, rather than simply
   dereferencing a null pointer.
 - libxl__ptr_add now returns void as it crashes on failure.
 - libxl__zalloc, _calloc, _strdup, _strndup, crash on failure using
   libxl__alloc_failed.  So all the code that uses these can no longer
   dereference null on malloc failure.

While we're at it, make libxl__ptr_add use realloc rather than
emulating it with calloc and free, and make it grow the array
exponentially rather than linearly.

Things left to do:
 - Remove a lot of now-spurious error handling.
 - Remove the ERROR_NOMEM error code.

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


diff -r 0ff2b4d05c2e -r 26f72d923cb9 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 11 14:14:13 2012 +0100
@@ -194,6 +194,10 @@
  * No temporary objects allocated from the pool may be explicitly freed.
  * Therefore public functions which initialize a libxl__gc MUST call
  * libxl__free_all() before returning.
+ *
+ * Memory allocation failures are not handled gracefully.  If malloc
+ * (or realloc) fails, libxl will cause the entire process to print
+ * a message to stderr and exit with status 255.
  */
 /*
  * libxl types
diff -r 0ff2b4d05c2e -r 26f72d923cb9 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:13 2012 +0100
@@ -17,40 +17,45 @@
 
 #include "libxl_internal.h"
 
-int libxl__error_set(libxl__gc *gc, int code)
-{
-    return 0;
+void libxl__alloc_failed(libxl_ctx *ctx, const char *func,
+                         size_t nmemb, size_t size) {
+#define M "libxl: FATAL ERROR: memory allocation failure"
+#define L (size ? M " (%s, %lu x %lu)\n" : M " (%s)\n"), \
+          func, (unsigned long)nmemb, (unsigned long)size
+    libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, L);
+    fprintf(stderr, L);
+    fflush(stderr);
+    _exit(-1);
+#undef M
+#undef L
 }
 
-int libxl__ptr_add(libxl__gc *gc, void *ptr)
+void libxl__ptr_add(libxl__gc *gc, void *ptr)
 {
     int i;
-    void **re;
 
     if (!ptr)
-        return 0;
+        return;
 
     /* fast case: we have space in the array for storing the pointer */
     for (i = 0; i < gc->alloc_maxsize; i++) {
         if (!gc->alloc_ptrs[i]) {
             gc->alloc_ptrs[i] = ptr;
-            return 0;
+            return;
         }
     }
-    /* realloc alloc_ptrs manually with calloc/free/replace */
-    re = calloc(gc->alloc_maxsize + 25, sizeof(void *));
-    if (!re)
-        return -1;
-    for (i = 0; i < gc->alloc_maxsize; i++)
-        re[i] = gc->alloc_ptrs[i];
-    /* assign the next pointer */
-    re[i] = ptr;
+    int new_maxsize = gc->alloc_maxsize * 2 + 25;
+    assert(new_maxsize < INT_MAX / sizeof(void*) / 2);
+    gc->alloc_ptrs = realloc(gc->alloc_ptrs, new_maxsize * sizeof(void *));
+    if (!gc->alloc_ptrs)
+        libxl__alloc_failed(CTX, __func__, new_maxsize, sizeof(void*));
 
-    /* replace the old alloc_ptr */
-    free(gc->alloc_ptrs);
-    gc->alloc_ptrs = re;
-    gc->alloc_maxsize += 25;
-    return 0;
+    gc->alloc_ptrs[gc->alloc_maxsize++] = ptr;
+
+    while (gc->alloc_maxsize < new_maxsize)
+        gc->alloc_ptrs[gc->alloc_maxsize++] = 0;
+
+    return;
 }
 
 void libxl__free_all(libxl__gc *gc)
@@ -71,10 +76,7 @@ void libxl__free_all(libxl__gc *gc)
 void *libxl__zalloc(libxl__gc *gc, int bytes)
 {
     void *ptr = calloc(bytes, 1);
-    if (!ptr) {
-        libxl__error_set(gc, ENOMEM);
-        return NULL;
-    }
+    if (!ptr) libxl__alloc_failed(CTX, __func__, bytes, 1);
 
     libxl__ptr_add(gc, ptr);
     return ptr;
@@ -83,10 +85,7 @@ void *libxl__zalloc(libxl__gc *gc, int b
 void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size)
 {
     void *ptr = calloc(nmemb, size);
-    if (!ptr) {
-        libxl__error_set(gc, ENOMEM);
-        return NULL;
-    }
+    if (!ptr) libxl__alloc_failed(CTX, __func__, nmemb, size);
 
     libxl__ptr_add(gc, ptr);
     return ptr;
@@ -97,9 +96,8 @@ void *libxl__realloc(libxl__gc *gc, void
     void *new_ptr = realloc(ptr, new_size);
     int i = 0;
 
-    if (new_ptr == NULL && new_size != 0) {
-        return NULL;
-    }
+    if (new_ptr == NULL && new_size != 0)
+        libxl__alloc_failed(CTX, __func__, new_size, 1);
 
     if (ptr == NULL) {
         libxl__ptr_add(gc, new_ptr);
@@ -112,7 +110,6 @@ void *libxl__realloc(libxl__gc *gc, void
         }
     }
 
-
     return new_ptr;
 }
 
@@ -126,16 +123,13 @@ char *libxl__sprintf(libxl__gc *gc, cons
     ret = vsnprintf(NULL, 0, fmt, ap);
     va_end(ap);
 
-    if (ret < 0) {
-        return NULL;
-    }
+    assert(ret >= 0);
 
     s = libxl__zalloc(gc, ret + 1);
-    if (s) {
-        va_start(ap, fmt);
-        ret = vsnprintf(s, ret + 1, fmt, ap);
-        va_end(ap);
-    }
+    va_start(ap, fmt);
+    ret = vsnprintf(s, ret + 1, fmt, ap);
+    va_end(ap);
+
     return s;
 }
 
@@ -143,8 +137,9 @@ char *libxl__strdup(libxl__gc *gc, const
 {
     char *s = strdup(c);
 
-    if (s)
-        libxl__ptr_add(gc, s);
+    if (!s) libxl__alloc_failed(CTX, __func__, strlen(c), 1);
+
+    libxl__ptr_add(gc, s);
 
     return s;
 }
@@ -153,8 +148,7 @@ char *libxl__strndup(libxl__gc *gc, cons
 {
     char *s = strndup(c, n);
 
-    if (s)
-        libxl__ptr_add(gc, s);
+    if (!s) libxl__alloc_failed(CTX, __func__, n, 1);
 
     return s;
 }
@@ -175,6 +169,9 @@ void libxl__logv(libxl_ctx *ctx, xentool
              const char *file, int line, const char *func,
              const char *fmt, va_list ap)
 {
+    /* WARNING this function may not call any libxl-provided
+     * memory allocation function, as those may
+     * call libxl__alloc_failed which calls libxl__logv. */
     char *enomem = "[out of memory formatting log message]";
     char *base = NULL;
     int rc, esave;
diff -r 0ff2b4d05c2e -r 26f72d923cb9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:13 2012 +0100
@@ -116,6 +116,12 @@ typedef struct libxl__gc libxl__gc;
 typedef struct libxl__egc libxl__egc;
 typedef struct libxl__ao libxl__ao;
 
+void libxl__alloc_failed(libxl_ctx *, const char *func,
+                         size_t nmemb, size_t size) __attribute__((noreturn));
+  /* func, size and nmemb are used only in the log message.
+   * You may pass size==0 if size and nmemb are not meaningful
+   * and should not be printed. */
+
 typedef struct libxl__ev_fd libxl__ev_fd;
 typedef void libxl__ev_fd_callback(libxl__egc *egc, libxl__ev_fd *ev,
                                    int fd, short events, short revents);
@@ -380,7 +386,7 @@ static inline libxl_ctx *libxl__gc_owner
  * collection on exit from the outermost libxl callframe.
  */
 /* register @ptr in @gc for free on exit from outermost libxl callframe. */
-_hidden int libxl__ptr_add(libxl__gc *gc, void *ptr);
+_hidden void libxl__ptr_add(libxl__gc *gc, void *ptr);
 /* if this is the outermost libxl callframe then free all pointers in @gc */
 _hidden void libxl__free_all(libxl__gc *gc);
 /* allocate and zero @bytes. (similar to a gc'd malloc(3)+memzero()) */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tn-Qf; Fri, 13 Apr 2012 16:33: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 1SIjR4-0000pW-9F
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from [85.158.138.51:24978] by server-4.bemta-3.messagelabs.com id
	FF/59-15341-055588F4; Fri, 13 Apr 2012 16:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1334334798!22082603!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24552 invoked from network); 13 Apr 2012 16:33:19 -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;
	13 Apr 2012 16:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004WT-Sc
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjQz-0004WM-RP
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:17 +0000
Message-Id: <E1SIjQz-0004WM-RP@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Crash (more sensibly) on
	malloc 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150053 -3600
# Node ID 26f72d923cb90fad0dd212348f5f8b85588780b0
# Parent  0ff2b4d05c2eaf7ab4cf62ec87f1ceea24f8830c
libxl: Crash (more sensibly) on malloc failure

Formally change the libxl memory allocation failure policy to "crash".

Previously we had a very uneven approach; much code assumed that
libxl__sprintf (for example) would never return NULL, but some code
was written more carefully.

We think it is unlikely that we will be able to make the library
actually robust against allocation failure (since that would be an
awful lot of never-tested error paths) and few calling environments
will be able to cope anyway.  So, instead, adopt the alternative
approach: provide allocation functions which never return null, but
will crash the whole process instead.

Consequently,
 - New noreturn function libxl__alloc_failed which may be used for
   printing a vaguely-useful error message, rather than simply
   dereferencing a null pointer.
 - libxl__ptr_add now returns void as it crashes on failure.
 - libxl__zalloc, _calloc, _strdup, _strndup, crash on failure using
   libxl__alloc_failed.  So all the code that uses these can no longer
   dereference null on malloc failure.

While we're at it, make libxl__ptr_add use realloc rather than
emulating it with calloc and free, and make it grow the array
exponentially rather than linearly.

Things left to do:
 - Remove a lot of now-spurious error handling.
 - Remove the ERROR_NOMEM error code.

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


diff -r 0ff2b4d05c2e -r 26f72d923cb9 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 11 14:14:13 2012 +0100
@@ -194,6 +194,10 @@
  * No temporary objects allocated from the pool may be explicitly freed.
  * Therefore public functions which initialize a libxl__gc MUST call
  * libxl__free_all() before returning.
+ *
+ * Memory allocation failures are not handled gracefully.  If malloc
+ * (or realloc) fails, libxl will cause the entire process to print
+ * a message to stderr and exit with status 255.
  */
 /*
  * libxl types
diff -r 0ff2b4d05c2e -r 26f72d923cb9 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:13 2012 +0100
@@ -17,40 +17,45 @@
 
 #include "libxl_internal.h"
 
-int libxl__error_set(libxl__gc *gc, int code)
-{
-    return 0;
+void libxl__alloc_failed(libxl_ctx *ctx, const char *func,
+                         size_t nmemb, size_t size) {
+#define M "libxl: FATAL ERROR: memory allocation failure"
+#define L (size ? M " (%s, %lu x %lu)\n" : M " (%s)\n"), \
+          func, (unsigned long)nmemb, (unsigned long)size
+    libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, L);
+    fprintf(stderr, L);
+    fflush(stderr);
+    _exit(-1);
+#undef M
+#undef L
 }
 
-int libxl__ptr_add(libxl__gc *gc, void *ptr)
+void libxl__ptr_add(libxl__gc *gc, void *ptr)
 {
     int i;
-    void **re;
 
     if (!ptr)
-        return 0;
+        return;
 
     /* fast case: we have space in the array for storing the pointer */
     for (i = 0; i < gc->alloc_maxsize; i++) {
         if (!gc->alloc_ptrs[i]) {
             gc->alloc_ptrs[i] = ptr;
-            return 0;
+            return;
         }
     }
-    /* realloc alloc_ptrs manually with calloc/free/replace */
-    re = calloc(gc->alloc_maxsize + 25, sizeof(void *));
-    if (!re)
-        return -1;
-    for (i = 0; i < gc->alloc_maxsize; i++)
-        re[i] = gc->alloc_ptrs[i];
-    /* assign the next pointer */
-    re[i] = ptr;
+    int new_maxsize = gc->alloc_maxsize * 2 + 25;
+    assert(new_maxsize < INT_MAX / sizeof(void*) / 2);
+    gc->alloc_ptrs = realloc(gc->alloc_ptrs, new_maxsize * sizeof(void *));
+    if (!gc->alloc_ptrs)
+        libxl__alloc_failed(CTX, __func__, new_maxsize, sizeof(void*));
 
-    /* replace the old alloc_ptr */
-    free(gc->alloc_ptrs);
-    gc->alloc_ptrs = re;
-    gc->alloc_maxsize += 25;
-    return 0;
+    gc->alloc_ptrs[gc->alloc_maxsize++] = ptr;
+
+    while (gc->alloc_maxsize < new_maxsize)
+        gc->alloc_ptrs[gc->alloc_maxsize++] = 0;
+
+    return;
 }
 
 void libxl__free_all(libxl__gc *gc)
@@ -71,10 +76,7 @@ void libxl__free_all(libxl__gc *gc)
 void *libxl__zalloc(libxl__gc *gc, int bytes)
 {
     void *ptr = calloc(bytes, 1);
-    if (!ptr) {
-        libxl__error_set(gc, ENOMEM);
-        return NULL;
-    }
+    if (!ptr) libxl__alloc_failed(CTX, __func__, bytes, 1);
 
     libxl__ptr_add(gc, ptr);
     return ptr;
@@ -83,10 +85,7 @@ void *libxl__zalloc(libxl__gc *gc, int b
 void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size)
 {
     void *ptr = calloc(nmemb, size);
-    if (!ptr) {
-        libxl__error_set(gc, ENOMEM);
-        return NULL;
-    }
+    if (!ptr) libxl__alloc_failed(CTX, __func__, nmemb, size);
 
     libxl__ptr_add(gc, ptr);
     return ptr;
@@ -97,9 +96,8 @@ void *libxl__realloc(libxl__gc *gc, void
     void *new_ptr = realloc(ptr, new_size);
     int i = 0;
 
-    if (new_ptr == NULL && new_size != 0) {
-        return NULL;
-    }
+    if (new_ptr == NULL && new_size != 0)
+        libxl__alloc_failed(CTX, __func__, new_size, 1);
 
     if (ptr == NULL) {
         libxl__ptr_add(gc, new_ptr);
@@ -112,7 +110,6 @@ void *libxl__realloc(libxl__gc *gc, void
         }
     }
 
-
     return new_ptr;
 }
 
@@ -126,16 +123,13 @@ char *libxl__sprintf(libxl__gc *gc, cons
     ret = vsnprintf(NULL, 0, fmt, ap);
     va_end(ap);
 
-    if (ret < 0) {
-        return NULL;
-    }
+    assert(ret >= 0);
 
     s = libxl__zalloc(gc, ret + 1);
-    if (s) {
-        va_start(ap, fmt);
-        ret = vsnprintf(s, ret + 1, fmt, ap);
-        va_end(ap);
-    }
+    va_start(ap, fmt);
+    ret = vsnprintf(s, ret + 1, fmt, ap);
+    va_end(ap);
+
     return s;
 }
 
@@ -143,8 +137,9 @@ char *libxl__strdup(libxl__gc *gc, const
 {
     char *s = strdup(c);
 
-    if (s)
-        libxl__ptr_add(gc, s);
+    if (!s) libxl__alloc_failed(CTX, __func__, strlen(c), 1);
+
+    libxl__ptr_add(gc, s);
 
     return s;
 }
@@ -153,8 +148,7 @@ char *libxl__strndup(libxl__gc *gc, cons
 {
     char *s = strndup(c, n);
 
-    if (s)
-        libxl__ptr_add(gc, s);
+    if (!s) libxl__alloc_failed(CTX, __func__, n, 1);
 
     return s;
 }
@@ -175,6 +169,9 @@ void libxl__logv(libxl_ctx *ctx, xentool
              const char *file, int line, const char *func,
              const char *fmt, va_list ap)
 {
+    /* WARNING this function may not call any libxl-provided
+     * memory allocation function, as those may
+     * call libxl__alloc_failed which calls libxl__logv. */
     char *enomem = "[out of memory formatting log message]";
     char *base = NULL;
     int rc, esave;
diff -r 0ff2b4d05c2e -r 26f72d923cb9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:13 2012 +0100
@@ -116,6 +116,12 @@ typedef struct libxl__gc libxl__gc;
 typedef struct libxl__egc libxl__egc;
 typedef struct libxl__ao libxl__ao;
 
+void libxl__alloc_failed(libxl_ctx *, const char *func,
+                         size_t nmemb, size_t size) __attribute__((noreturn));
+  /* func, size and nmemb are used only in the log message.
+   * You may pass size==0 if size and nmemb are not meaningful
+   * and should not be printed. */
+
 typedef struct libxl__ev_fd libxl__ev_fd;
 typedef void libxl__ev_fd_callback(libxl__egc *egc, libxl__ev_fd *ev,
                                    int fd, short events, short revents);
@@ -380,7 +386,7 @@ static inline libxl_ctx *libxl__gc_owner
  * collection on exit from the outermost libxl callframe.
  */
 /* register @ptr in @gc for free on exit from outermost libxl callframe. */
-_hidden int libxl__ptr_add(libxl__gc *gc, void *ptr);
+_hidden void libxl__ptr_add(libxl__gc *gc, void *ptr);
 /* if this is the outermost libxl callframe then free all pointers in @gc */
 _hidden void libxl__free_all(libxl__gc *gc);
 /* allocate and zero @bytes. (similar to a gc'd malloc(3)+memzero()) */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000td-OH; Fri, 13 Apr 2012 16:33:23 +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 1SIjR4-0000pI-12
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from [193.109.254.147:34033] by server-4.bemta-14.messagelabs.com id
	9B/27-11570-155588F4; Fri, 13 Apr 2012 16:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1334334799!4502761!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20430 invoked from network); 13 Apr 2012 16:33:20 -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;
	13 Apr 2012 16:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004Wg-DF
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004X5-C7
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Message-Id: <E1SIjR1-0004X5-C7@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: include <ctype.h> and
	introduce CTYPE helper macro
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150055 -3600
# Node ID e6db36100b1db9e67c9fed0ed087d10ec2625493
# Parent  f3c835decf4696e35730e319b17bff8136bfb27e
libxl: include <ctype.h> and introduce CTYPE helper macro

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


diff -r f3c835decf46 -r e6db36100b1d tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:15 2012 +0100
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <ctype.h>
 
 #include <sys/mman.h>
 #include <sys/poll.h>
@@ -1469,6 +1470,25 @@ static inline void libxl__ctx_unlock(lib
     } while(0)
 
 
+/*
+ * int CTYPE(ISFOO, char c);
+ * int CTYPE(toupper, char c);
+ * int CTYPE(tolower, char c);
+ *
+ * This is necessary because passing a simple char to a ctype.h
+ * is forbidden.  ctype.h macros take ints derived from _unsigned_ chars.
+ *
+ * If you have a char which might be EOF then you should already have
+ * it in an int representing an unsigned char, and you can use the
+ * <ctype.h> macros directly.  This generally happens only with values
+ * from fgetc et al.
+ *
+ * For any value known to be a character (eg, anything that came from
+ * a char[]), use CTYPE.
+ */
+#define CTYPE(isfoo,c) (isfoo((unsigned char)(c)))
+
+
 #endif
 
 /*

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000td-OH; Fri, 13 Apr 2012 16:33:23 +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 1SIjR4-0000pI-12
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from [193.109.254.147:34033] by server-4.bemta-14.messagelabs.com id
	9B/27-11570-155588F4; Fri, 13 Apr 2012 16:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1334334799!4502761!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20430 invoked from network); 13 Apr 2012 16:33:20 -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;
	13 Apr 2012 16:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004Wg-DF
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004X5-C7
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Message-Id: <E1SIjR1-0004X5-C7@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: include <ctype.h> and
	introduce CTYPE helper macro
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150055 -3600
# Node ID e6db36100b1db9e67c9fed0ed087d10ec2625493
# Parent  f3c835decf4696e35730e319b17bff8136bfb27e
libxl: include <ctype.h> and introduce CTYPE helper macro

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


diff -r f3c835decf46 -r e6db36100b1d tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:15 2012 +0100
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <ctype.h>
 
 #include <sys/mman.h>
 #include <sys/poll.h>
@@ -1469,6 +1470,25 @@ static inline void libxl__ctx_unlock(lib
     } while(0)
 
 
+/*
+ * int CTYPE(ISFOO, char c);
+ * int CTYPE(toupper, char c);
+ * int CTYPE(tolower, char c);
+ *
+ * This is necessary because passing a simple char to a ctype.h
+ * is forbidden.  ctype.h macros take ints derived from _unsigned_ chars.
+ *
+ * If you have a char which might be EOF then you should already have
+ * it in an int representing an unsigned char, and you can use the
+ * <ctype.h> macros directly.  This generally happens only with values
+ * from fgetc et al.
+ *
+ * For any value known to be a character (eg, anything that came from
+ * a char[]), use CTYPE.
+ */
+#define CTYPE(isfoo,c) (isfoo((unsigned char)(c)))
+
+
 #endif
 
 /*

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tJ-IE; Fri, 13 Apr 2012 16:33:23 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0000oM-II
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Received: from [85.158.143.99:10816] by server-1.bemta-4.messagelabs.com id
	6C/21-20925-055588F4; Fri, 13 Apr 2012 16:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334334798!23231534!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2513 invoked from network); 13 Apr 2012 16:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004WX-Cx
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004Wb-Bs
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Message-Id: <E1SIjR0-0004Wb-Bs@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Make libxl__zalloc et al
	tolerate a NULL gc
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150054 -3600
# Node ID 6c3345d7e9d91e274c342d6687eae941163add5a
# Parent  26f72d923cb90fad0dd212348f5f8b85588780b0
libxl: Make libxl__zalloc et al tolerate a NULL gc

Arrange that if we pass NULL as a gc, we simply don't register the
pointer.  This instantly gives us non-gc'ing but error-checking
versions of malloc, realloc, vasprintf, etc.

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


diff -r 26f72d923cb9 -r 6c3345d7e9d9 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:14 2012 +0100
@@ -34,6 +34,9 @@ void libxl__ptr_add(libxl__gc *gc, void 
 {
     int i;
 
+    if (!gc)
+        return;
+
     if (!ptr)
         return;
 
@@ -101,7 +104,7 @@ void *libxl__realloc(libxl__gc *gc, void
 
     if (ptr == NULL) {
         libxl__ptr_add(gc, new_ptr);
-    } else if (new_ptr != ptr) {
+    } else if (new_ptr != ptr && gc != NULL) {
         for (i = 0; i < gc->alloc_maxsize; i++) {
             if (gc->alloc_ptrs[i] == ptr) {
                 gc->alloc_ptrs[i] = new_ptr;
diff -r 26f72d923cb9 -r 6c3345d7e9d9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
@@ -384,30 +384,35 @@ static inline libxl_ctx *libxl__gc_owner
  *
  * All pointers returned by these functions are registered for garbage
  * collection on exit from the outermost libxl callframe.
+ *
+ * However, where the argument is stated to be "gc_opt", NULL may be
+ * passed instead, in which case no garbage collection will occur; the
+ * pointer must later be freed with free().  This is for memory
+ * allocations of types (b) and (c).
  */
 /* register @ptr in @gc for free on exit from outermost libxl callframe. */
-_hidden void libxl__ptr_add(libxl__gc *gc, void *ptr);
+_hidden void libxl__ptr_add(libxl__gc *gc_opt, void *ptr);
 /* if this is the outermost libxl callframe then free all pointers in @gc */
 _hidden void libxl__free_all(libxl__gc *gc);
 /* allocate and zero @bytes. (similar to a gc'd malloc(3)+memzero()) */
-_hidden void *libxl__zalloc(libxl__gc *gc, int bytes);
+_hidden void *libxl__zalloc(libxl__gc *gc_opt, int bytes);
 /* allocate and zero memory for an array of @nmemb members of @size each.
  * (similar to a gc'd calloc(3)). */
-_hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
+_hidden void *libxl__calloc(libxl__gc *gc_opt, size_t nmemb, size_t size);
 /* change the size of the memory block pointed to by @ptr to @new_size bytes.
  * unlike other allocation functions here any additional space between the
  * oldsize and @new_size is not initialised (similar to a gc'd realloc(3)). */
-_hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
+_hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size);
 /* print @fmt into an allocated string large enoughto contain the result.
  * (similar to gc'd asprintf(3)). */
-_hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
+_hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
 /* duplicate the string @c (similar to a gc'd strdup(3)). */
-_hidden char *libxl__strdup(libxl__gc *gc, const char *c);
+_hidden char *libxl__strdup(libxl__gc *gc_opt, const char *c);
 /* duplicate at most @n bytes of string @c (similar to a gc'd strndup(3)). */
-_hidden char *libxl__strndup(libxl__gc *gc, const char *c, size_t n);
+_hidden char *libxl__strndup(libxl__gc *gc_opt, const char *c, size_t n);
 /* strip the last path component from @s and return as a newly allocated
  * string. (similar to a gc'd dirname(3)). */
-_hidden char *libxl__dirname(libxl__gc *gc, const char *s);
+_hidden char *libxl__dirname(libxl__gc *gc_opt, const char *s);
 
 _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length);
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tJ-IE; Fri, 13 Apr 2012 16:33:23 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0000oM-II
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Received: from [85.158.143.99:10816] by server-1.bemta-4.messagelabs.com id
	6C/21-20925-055588F4; Fri, 13 Apr 2012 16:33:20 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334334798!23231534!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2513 invoked from network); 13 Apr 2012 16:33:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:19 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004WX-Cx
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004Wb-Bs
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Message-Id: <E1SIjR0-0004Wb-Bs@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Make libxl__zalloc et al
	tolerate a NULL gc
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150054 -3600
# Node ID 6c3345d7e9d91e274c342d6687eae941163add5a
# Parent  26f72d923cb90fad0dd212348f5f8b85588780b0
libxl: Make libxl__zalloc et al tolerate a NULL gc

Arrange that if we pass NULL as a gc, we simply don't register the
pointer.  This instantly gives us non-gc'ing but error-checking
versions of malloc, realloc, vasprintf, etc.

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


diff -r 26f72d923cb9 -r 6c3345d7e9d9 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.c	Wed Apr 11 14:14:14 2012 +0100
@@ -34,6 +34,9 @@ void libxl__ptr_add(libxl__gc *gc, void 
 {
     int i;
 
+    if (!gc)
+        return;
+
     if (!ptr)
         return;
 
@@ -101,7 +104,7 @@ void *libxl__realloc(libxl__gc *gc, void
 
     if (ptr == NULL) {
         libxl__ptr_add(gc, new_ptr);
-    } else if (new_ptr != ptr) {
+    } else if (new_ptr != ptr && gc != NULL) {
         for (i = 0; i < gc->alloc_maxsize; i++) {
             if (gc->alloc_ptrs[i] == ptr) {
                 gc->alloc_ptrs[i] = new_ptr;
diff -r 26f72d923cb9 -r 6c3345d7e9d9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:13 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
@@ -384,30 +384,35 @@ static inline libxl_ctx *libxl__gc_owner
  *
  * All pointers returned by these functions are registered for garbage
  * collection on exit from the outermost libxl callframe.
+ *
+ * However, where the argument is stated to be "gc_opt", NULL may be
+ * passed instead, in which case no garbage collection will occur; the
+ * pointer must later be freed with free().  This is for memory
+ * allocations of types (b) and (c).
  */
 /* register @ptr in @gc for free on exit from outermost libxl callframe. */
-_hidden void libxl__ptr_add(libxl__gc *gc, void *ptr);
+_hidden void libxl__ptr_add(libxl__gc *gc_opt, void *ptr);
 /* if this is the outermost libxl callframe then free all pointers in @gc */
 _hidden void libxl__free_all(libxl__gc *gc);
 /* allocate and zero @bytes. (similar to a gc'd malloc(3)+memzero()) */
-_hidden void *libxl__zalloc(libxl__gc *gc, int bytes);
+_hidden void *libxl__zalloc(libxl__gc *gc_opt, int bytes);
 /* allocate and zero memory for an array of @nmemb members of @size each.
  * (similar to a gc'd calloc(3)). */
-_hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
+_hidden void *libxl__calloc(libxl__gc *gc_opt, size_t nmemb, size_t size);
 /* change the size of the memory block pointed to by @ptr to @new_size bytes.
  * unlike other allocation functions here any additional space between the
  * oldsize and @new_size is not initialised (similar to a gc'd realloc(3)). */
-_hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
+_hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size);
 /* print @fmt into an allocated string large enoughto contain the result.
  * (similar to gc'd asprintf(3)). */
-_hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
+_hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
 /* duplicate the string @c (similar to a gc'd strdup(3)). */
-_hidden char *libxl__strdup(libxl__gc *gc, const char *c);
+_hidden char *libxl__strdup(libxl__gc *gc_opt, const char *c);
 /* duplicate at most @n bytes of string @c (similar to a gc'd strndup(3)). */
-_hidden char *libxl__strndup(libxl__gc *gc, const char *c, size_t n);
+_hidden char *libxl__strndup(libxl__gc *gc_opt, const char *c, size_t n);
 /* strip the last path component from @s and return as a newly allocated
  * string. (similar to a gc'd dirname(3)). */
-_hidden char *libxl__dirname(libxl__gc *gc, const char *s);
+_hidden char *libxl__dirname(libxl__gc *gc_opt, const char *s);
 
 _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length);
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tT-L3; Fri, 13 Apr 2012 16:33:23 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0000ko-JT
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Received: from [85.158.143.99:10852] by server-2.bemta-4.messagelabs.com id
	84/85-17550-155588F4; Fri, 13 Apr 2012 16:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1334334799!23507263!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19859 invoked from network); 13 Apr 2012 16:33:20 -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;
	13 Apr 2012 16:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004Wa-TE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004Wq-S4
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Message-Id: <E1SIjR0-0004Wq-S4@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce some convenience
	macros
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150054 -3600
# Node ID f3c835decf4696e35730e319b17bff8136bfb27e
# Parent  6c3345d7e9d91e274c342d6687eae941163add5a
libxl: Introduce some convenience macros

We introduce:
   <type> *GCNEW(<type> *var);
   <type> *GCNEW_ARRAY(<type> *var, ssize_t nmemb);
   <type> *GCREALLOC_ARRAY(<type> *var, size_t nmemb);
   char *GCSPRINTF(const char *fmt, ...);
   void LOG(<xtl_level_suffix>, const char *fmt, ...);
   void LOGE(<xtl_level_suffix>, const char *fmt, ...);
   void LOGEV(<xtl_level_suffix>, int errnoval, const char *fmt, ...);
all of which expect, in the calling context,
   libxl__gc *gc;

Most of these will find callers in subsequent patches.  The exceptions
are the orthogonally necessary LOGE and LOGEV, and GCREALLOC_ARRAY.

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


diff -r 6c3345d7e9d9 -r f3c835decf46 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
@@ -1349,6 +1349,78 @@ _hidden void libxl__ao__destroy(libxl_ct
 #define GC_FREE       libxl__free_all(gc)
 #define CTX           libxl__gc_owner(gc)
 
+/* Allocation macros all of which use the gc. */
+
+#define ARRAY_SIZE_OK(ptr, nmemb) ((nmemb) < INT_MAX / (sizeof(*(ptr)) * 2))
+
+/*
+ * Expression statement  <type> *GCNEW(<type> *var);
+ * Uses                  libxl__gc *gc;
+ *
+ * Allocates a new object of type <type> from the gc and zeroes it
+ * with memset.  Sets var to point to the new object or zero (setting
+ * errno).  Returns the new value of var.
+ */
+#define GCNEW(var)                                      \
+    (((var) = libxl__zalloc((gc),sizeof(*(var)))))
+
+/*
+ * Expression statement  <type> *GCNEW_ARRAY(<type> *var, ssize_t nmemb);
+ * Uses                  libxl__gc *gc;
+ *
+ * Like GCNEW but allocates an array of nmemb elements, as if from
+ * calloc.  Does check for integer overflow due to large nmemb.  If
+ * nmemb is 0 may succeed by returning 0.
+ */
+#define GCNEW_ARRAY(var, nmemb)                                 \
+    ((var) = libxl__calloc((gc), (nmemb), sizeof(*(var))))
+    
+/*
+ * Expression statement  <type> *GCREALLOC_ARRAY(<type> *var, size_t nmemb);
+ * Uses                  libxl__gc *gc;
+ *
+ * Reallocates the array var to be of size nmemb elements.  Updates
+ * var and returns the new value of var.  Does check for integer
+ * overflow due to large nmemb.
+ *
+ * Do not pass nmemb==0.  old may be 0 on entry.
+ */
+#define GCREALLOC_ARRAY(var, nmemb)                                     \
+    (assert(nmemb > 0),                                                 \
+     assert(ARRAY_SIZE_OK((var), (nmemb))),                             \
+     (var) = libxl__realloc((gc), (var), (nmemb)*sizeof(*(var)))))
+
+
+/*
+ * Expression            char *GCSPRINTF(const char *fmt, ...);
+ * Uses                  libxl__gc *gc;
+ *
+ * Trivial convenience wrapper for libxl__sprintf.
+ */
+#define GCSPRINTF(fmt, ...) (libxl__sprintf((gc), (fmt), __VA_ARGS__))
+
+
+/*
+ * Expression statements
+ *    void LOG(<xtl_level_suffix>, const char *fmt, ...);
+ *    void LOGE(<xtl_level_suffix>, const char *fmt, ...);
+ *    void LOGEV(<xtl_level_suffix>, int errnoval, const char *fmt, ...);
+ * Use
+ *    libxl__gc *gc;
+ *
+ * Trivial convenience wrappers for LIBXL__LOG, LIBXL__LOG_ERRNO and
+ * LIBXL__LOG_ERRNOVAL, respectively (and thus for libxl__log).
+ *
+ * XTL_<xtl_level_suffix> should exist and be an xentoollog.h log level
+ * So <xtl_level_suffix> should be one of
+ *   DEBUG VERBOSE DETAIL PROGRESS INFO NOTICE WARN ERROR ERROR CRITICAL
+ * Of these, most of libxl uses
+ *   DEBUG INFO WARN ERROR
+ */
+#define LOG(l,f, ...)     LIBXL__LOG(CTX,XTL_##l,(f),##__VA_ARGS__)
+#define LOGE(l,f, ...)    LIBXL__LOG_ERRNO(CTX,XTL_##l,(f),##__VA_ARGS__)
+#define LOGEV(l,e,f, ...) LIBXL__LOG_ERRNOVAL(CTX,XTL_##l,(e),(f),##__VA_ARGS__)
+
 
 /* Locking functions.  See comment for "lock" member of libxl__ctx. */
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tz-TI; Fri, 13 Apr 2012 16:33:23 +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 1SIjR4-0000rZ-Qu
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from [193.109.254.147:40670] by server-5.bemta-14.messagelabs.com id
	DB/22-30733-255588F4; Fri, 13 Apr 2012 16:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334334800!2027583!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 664 invoked from network); 13 Apr 2012 16:33:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004Wj-UG
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004XK-T9
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Message-Id: <E1SIjR1-0004XK-T9@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Provide
	libxl_string_list_length
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150055 -3600
# Node ID 6fc016d74c40c972f82c4da38e80b448713e4665
# Parent  e6db36100b1db9e67c9fed0ed087d10ec2625493
libxl: Provide libxl_string_list_length

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


diff -r e6db36100b1d -r 6fc016d74c40 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:15 2012 +0100
@@ -177,6 +177,14 @@ void libxl_string_list_dispose(libxl_str
     free(sl);
 }
 
+int libxl_string_list_length(const libxl_string_list *psl)
+{
+    if (!psl) return 0;
+    int i = 0;
+    while (*psl++) i++;
+    return i;
+}
+
 void libxl_key_value_list_dispose(libxl_key_value_list *pkvl)
 {
     int i;
diff -r e6db36100b1d -r 6fc016d74c40 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 11 14:14:15 2012 +0100
@@ -273,6 +273,7 @@ typedef uint8_t libxl_mac[6];
 
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
+int libxl_string_list_length(const libxl_string_list *sl);
 
 typedef char **libxl_key_value_list;
 void libxl_key_value_list_dispose(libxl_key_value_list *kvl);

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tz-TI; Fri, 13 Apr 2012 16:33:23 +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 1SIjR4-0000rZ-Qu
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from [193.109.254.147:40670] by server-5.bemta-14.messagelabs.com id
	DB/22-30733-255588F4; Fri, 13 Apr 2012 16:33:22 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1334334800!2027583!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 664 invoked from network); 13 Apr 2012 16:33:21 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:21 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004Wj-UG
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR1-0004XK-T9
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:19 +0000
Message-Id: <E1SIjR1-0004XK-T9@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Provide
	libxl_string_list_length
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150055 -3600
# Node ID 6fc016d74c40c972f82c4da38e80b448713e4665
# Parent  e6db36100b1db9e67c9fed0ed087d10ec2625493
libxl: Provide libxl_string_list_length

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


diff -r e6db36100b1d -r 6fc016d74c40 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:15 2012 +0100
@@ -177,6 +177,14 @@ void libxl_string_list_dispose(libxl_str
     free(sl);
 }
 
+int libxl_string_list_length(const libxl_string_list *psl)
+{
+    if (!psl) return 0;
+    int i = 0;
+    while (*psl++) i++;
+    return i;
+}
+
 void libxl_key_value_list_dispose(libxl_key_value_list *pkvl)
 {
     int i;
diff -r e6db36100b1d -r 6fc016d74c40 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 11 14:14:15 2012 +0100
@@ -273,6 +273,7 @@ typedef uint8_t libxl_mac[6];
 
 typedef char **libxl_string_list;
 void libxl_string_list_dispose(libxl_string_list *sl);
+int libxl_string_list_length(const libxl_string_list *sl);
 
 typedef char **libxl_key_value_list;
 void libxl_key_value_list_dispose(libxl_key_value_list *kvl);

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR5-0000tT-L3; Fri, 13 Apr 2012 16:33:23 +0000
Received: from mail6.bemta4.messagelabs.com ([85.158.143.247])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0000ko-JT
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Received: from [85.158.143.99:10852] by server-2.bemta-4.messagelabs.com id
	84/85-17550-155588F4; Fri, 13 Apr 2012 16:33:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1334334799!23507263!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19859 invoked from network); 13 Apr 2012 16:33:20 -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;
	13 Apr 2012 16:33:20 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004Wa-TE
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR0-0004Wq-S4
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:18 +0000
Message-Id: <E1SIjR0-0004Wq-S4@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce some convenience
	macros
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150054 -3600
# Node ID f3c835decf4696e35730e319b17bff8136bfb27e
# Parent  6c3345d7e9d91e274c342d6687eae941163add5a
libxl: Introduce some convenience macros

We introduce:
   <type> *GCNEW(<type> *var);
   <type> *GCNEW_ARRAY(<type> *var, ssize_t nmemb);
   <type> *GCREALLOC_ARRAY(<type> *var, size_t nmemb);
   char *GCSPRINTF(const char *fmt, ...);
   void LOG(<xtl_level_suffix>, const char *fmt, ...);
   void LOGE(<xtl_level_suffix>, const char *fmt, ...);
   void LOGEV(<xtl_level_suffix>, int errnoval, const char *fmt, ...);
all of which expect, in the calling context,
   libxl__gc *gc;

Most of these will find callers in subsequent patches.  The exceptions
are the orthogonally necessary LOGE and LOGEV, and GCREALLOC_ARRAY.

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


diff -r 6c3345d7e9d9 -r f3c835decf46 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:14 2012 +0100
@@ -1349,6 +1349,78 @@ _hidden void libxl__ao__destroy(libxl_ct
 #define GC_FREE       libxl__free_all(gc)
 #define CTX           libxl__gc_owner(gc)
 
+/* Allocation macros all of which use the gc. */
+
+#define ARRAY_SIZE_OK(ptr, nmemb) ((nmemb) < INT_MAX / (sizeof(*(ptr)) * 2))
+
+/*
+ * Expression statement  <type> *GCNEW(<type> *var);
+ * Uses                  libxl__gc *gc;
+ *
+ * Allocates a new object of type <type> from the gc and zeroes it
+ * with memset.  Sets var to point to the new object or zero (setting
+ * errno).  Returns the new value of var.
+ */
+#define GCNEW(var)                                      \
+    (((var) = libxl__zalloc((gc),sizeof(*(var)))))
+
+/*
+ * Expression statement  <type> *GCNEW_ARRAY(<type> *var, ssize_t nmemb);
+ * Uses                  libxl__gc *gc;
+ *
+ * Like GCNEW but allocates an array of nmemb elements, as if from
+ * calloc.  Does check for integer overflow due to large nmemb.  If
+ * nmemb is 0 may succeed by returning 0.
+ */
+#define GCNEW_ARRAY(var, nmemb)                                 \
+    ((var) = libxl__calloc((gc), (nmemb), sizeof(*(var))))
+    
+/*
+ * Expression statement  <type> *GCREALLOC_ARRAY(<type> *var, size_t nmemb);
+ * Uses                  libxl__gc *gc;
+ *
+ * Reallocates the array var to be of size nmemb elements.  Updates
+ * var and returns the new value of var.  Does check for integer
+ * overflow due to large nmemb.
+ *
+ * Do not pass nmemb==0.  old may be 0 on entry.
+ */
+#define GCREALLOC_ARRAY(var, nmemb)                                     \
+    (assert(nmemb > 0),                                                 \
+     assert(ARRAY_SIZE_OK((var), (nmemb))),                             \
+     (var) = libxl__realloc((gc), (var), (nmemb)*sizeof(*(var)))))
+
+
+/*
+ * Expression            char *GCSPRINTF(const char *fmt, ...);
+ * Uses                  libxl__gc *gc;
+ *
+ * Trivial convenience wrapper for libxl__sprintf.
+ */
+#define GCSPRINTF(fmt, ...) (libxl__sprintf((gc), (fmt), __VA_ARGS__))
+
+
+/*
+ * Expression statements
+ *    void LOG(<xtl_level_suffix>, const char *fmt, ...);
+ *    void LOGE(<xtl_level_suffix>, const char *fmt, ...);
+ *    void LOGEV(<xtl_level_suffix>, int errnoval, const char *fmt, ...);
+ * Use
+ *    libxl__gc *gc;
+ *
+ * Trivial convenience wrappers for LIBXL__LOG, LIBXL__LOG_ERRNO and
+ * LIBXL__LOG_ERRNOVAL, respectively (and thus for libxl__log).
+ *
+ * XTL_<xtl_level_suffix> should exist and be an xentoollog.h log level
+ * So <xtl_level_suffix> should be one of
+ *   DEBUG VERBOSE DETAIL PROGRESS INFO NOTICE WARN ERROR ERROR CRITICAL
+ * Of these, most of libxl uses
+ *   DEBUG INFO WARN ERROR
+ */
+#define LOG(l,f, ...)     LIBXL__LOG(CTX,XTL_##l,(f),##__VA_ARGS__)
+#define LOGE(l,f, ...)    LIBXL__LOG_ERRNO(CTX,XTL_##l,(f),##__VA_ARGS__)
+#define LOGEV(l,e,f, ...) LIBXL__LOG_ERRNOVAL(CTX,XTL_##l,(e),(f),##__VA_ARGS__)
+
 
 /* Locking functions.  See comment for "lock" member of libxl__ctx. */
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR7-0000wv-1g; Fri, 13 Apr 2012 16:33:25 +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 1SIjR5-0000k7-Qe
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:24 +0000
Received: from [193.109.254.147:31620] by server-8.bemta-14.messagelabs.com id
	DE/99-23244-355588F4; Fri, 13 Apr 2012 16:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1334334801!4508662!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4206 invoked from network); 13 Apr 2012 16:33:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0004Wx-Fn
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0004Y3-Ef
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Message-Id: <E1SIjR3-0004Y3-Ef@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl:
	libxl_event.c:beforepoll_internal, REQUIRE_FDS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150057 -3600
# Node ID 4fef2701410b48ad3de422ed4e9a6b4cee527195
# Parent  24bb3350102c130985c2f04849c64446c2c1144f
libxl: libxl_event.c:beforepoll_internal, REQUIRE_FDS

Introduce definition and use of a new function-local macro REQUIRE_FDS
to avoid repeatedly spelling out which fds we are interested in.

We are going to introduce a new fd for the SIGCHLD self-pipe.

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


diff -r 24bb3350102c -r 4fef2701410b tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:17 2012 +0100
@@ -593,6 +593,45 @@ static int beforepoll_internal(libxl__gc
     int rc;
 
     /*
+     * We need to look at the fds we want twice: firstly, to count
+     * them so we can make the rindex array big enough, and secondly
+     * to actually fill the arrays in.
+     *
+     * To ensure correctness and avoid repeating the logic for
+     * deciding which fds are relevant, we define a macro
+     *    REQUIRE_FDS( BODY )
+     * which calls
+     *    do{
+     *        int req_fd;
+     *        int req_events;
+     *        BODY;
+     *    }while(0)
+     * for each fd with a nonzero events.  This is invoked twice.
+     *
+     * The definition of REQUIRE_FDS is simplified with the helper
+     * macro
+     *    void REQUIRE_FD(int req_fd, int req_events, BODY);
+     */
+
+#define REQUIRE_FDS(BODY) do{                                          \
+                                                                       \
+        LIBXL_LIST_FOREACH(efd, &CTX->efds, entry)                     \
+            REQUIRE_FD(efd->fd, efd->events, BODY);                    \
+                                                                       \
+        REQUIRE_FD(poller->wakeup_pipe[0], POLLIN, BODY);              \
+                                                                       \
+    }while(0)
+
+#define REQUIRE_FD(req_fd_, req_events_, BODY) do{      \
+        int req_events = (req_events_);                 \
+        int req_fd = (req_fd_);                         \
+        if (req_events) {                               \
+            BODY;                                       \
+        }                                               \
+    }while(0)
+
+
+    /*
      * In order to be able to efficiently find the libxl__ev_fd
      * for a struct poll during _afterpoll, we maintain a shadow
      * data structure in CTX->fd_beforepolled: each slot in
@@ -609,13 +648,13 @@ static int beforepoll_internal(libxl__gc
          * not to mess with fd_rindex.
          */
 
-        int maxfd = poller->wakeup_pipe[0] + 1;
-        LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
-            if (!efd->events)
-                continue;
-            if (efd->fd >= maxfd)
-                maxfd = efd->fd + 1;
-        }
+        int maxfd = 0;
+
+        REQUIRE_FDS({
+            if (req_fd >= maxfd)
+                maxfd = req_fd + 1;
+        });
+
         /* make sure our array is as big as *nfds_io */
         if (poller->fd_rindex_allocd < maxfd) {
             assert(maxfd < INT_MAX / sizeof(int) / 2);
@@ -630,25 +669,16 @@ static int beforepoll_internal(libxl__gc
 
     int used = 0;
 
-#define REQUIRE_FD(req_fd, req_events, efd) do{                 \
-        if ((req_events)) {                                     \
-            if (used < *nfds_io) {                              \
-                fds[used].fd = (req_fd);                        \
-                fds[used].events = (req_events);                \
-                fds[used].revents = 0;                          \
-                assert((req_fd) < poller->fd_rindex_allocd);    \
-                poller->fd_rindex[(req_fd)] = used;             \
-            }                                                   \
-            used++;                                             \
-        }                                                       \
-    }while(0)
-
-    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry)
-        REQUIRE_FD(efd->fd, efd->events, efd);
-
-    REQUIRE_FD(poller->wakeup_pipe[0], POLLIN, 0);
-
-#undef REQUIRE_FD
+    REQUIRE_FDS({
+        if (used < *nfds_io) {
+            fds[used].fd = req_fd;
+            fds[used].events = req_events;
+            fds[used].revents = 0;
+            assert(req_fd < poller->fd_rindex_allocd);
+            poller->fd_rindex[req_fd] = used;
+        }
+        used++;
+    });
 
     rc = used <= *nfds_io ? 0 : ERROR_BUFFERFULL;
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR7-0000wv-1g; Fri, 13 Apr 2012 16:33:25 +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 1SIjR5-0000k7-Qe
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:24 +0000
Received: from [193.109.254.147:31620] by server-8.bemta-14.messagelabs.com id
	DE/99-23244-355588F4; Fri, 13 Apr 2012 16:33:23 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1334334801!4508662!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4206 invoked from network); 13 Apr 2012 16:33:22 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:22 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0004Wx-Fn
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0004Y3-Ef
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Message-Id: <E1SIjR3-0004Y3-Ef@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl:
	libxl_event.c:beforepoll_internal, REQUIRE_FDS
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150057 -3600
# Node ID 4fef2701410b48ad3de422ed4e9a6b4cee527195
# Parent  24bb3350102c130985c2f04849c64446c2c1144f
libxl: libxl_event.c:beforepoll_internal, REQUIRE_FDS

Introduce definition and use of a new function-local macro REQUIRE_FDS
to avoid repeatedly spelling out which fds we are interested in.

We are going to introduce a new fd for the SIGCHLD self-pipe.

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


diff -r 24bb3350102c -r 4fef2701410b tools/libxl/libxl_event.c
--- a/tools/libxl/libxl_event.c	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl_event.c	Wed Apr 11 14:14:17 2012 +0100
@@ -593,6 +593,45 @@ static int beforepoll_internal(libxl__gc
     int rc;
 
     /*
+     * We need to look at the fds we want twice: firstly, to count
+     * them so we can make the rindex array big enough, and secondly
+     * to actually fill the arrays in.
+     *
+     * To ensure correctness and avoid repeating the logic for
+     * deciding which fds are relevant, we define a macro
+     *    REQUIRE_FDS( BODY )
+     * which calls
+     *    do{
+     *        int req_fd;
+     *        int req_events;
+     *        BODY;
+     *    }while(0)
+     * for each fd with a nonzero events.  This is invoked twice.
+     *
+     * The definition of REQUIRE_FDS is simplified with the helper
+     * macro
+     *    void REQUIRE_FD(int req_fd, int req_events, BODY);
+     */
+
+#define REQUIRE_FDS(BODY) do{                                          \
+                                                                       \
+        LIBXL_LIST_FOREACH(efd, &CTX->efds, entry)                     \
+            REQUIRE_FD(efd->fd, efd->events, BODY);                    \
+                                                                       \
+        REQUIRE_FD(poller->wakeup_pipe[0], POLLIN, BODY);              \
+                                                                       \
+    }while(0)
+
+#define REQUIRE_FD(req_fd_, req_events_, BODY) do{      \
+        int req_events = (req_events_);                 \
+        int req_fd = (req_fd_);                         \
+        if (req_events) {                               \
+            BODY;                                       \
+        }                                               \
+    }while(0)
+
+
+    /*
      * In order to be able to efficiently find the libxl__ev_fd
      * for a struct poll during _afterpoll, we maintain a shadow
      * data structure in CTX->fd_beforepolled: each slot in
@@ -609,13 +648,13 @@ static int beforepoll_internal(libxl__gc
          * not to mess with fd_rindex.
          */
 
-        int maxfd = poller->wakeup_pipe[0] + 1;
-        LIBXL_LIST_FOREACH(efd, &CTX->efds, entry) {
-            if (!efd->events)
-                continue;
-            if (efd->fd >= maxfd)
-                maxfd = efd->fd + 1;
-        }
+        int maxfd = 0;
+
+        REQUIRE_FDS({
+            if (req_fd >= maxfd)
+                maxfd = req_fd + 1;
+        });
+
         /* make sure our array is as big as *nfds_io */
         if (poller->fd_rindex_allocd < maxfd) {
             assert(maxfd < INT_MAX / sizeof(int) / 2);
@@ -630,25 +669,16 @@ static int beforepoll_internal(libxl__gc
 
     int used = 0;
 
-#define REQUIRE_FD(req_fd, req_events, efd) do{                 \
-        if ((req_events)) {                                     \
-            if (used < *nfds_io) {                              \
-                fds[used].fd = (req_fd);                        \
-                fds[used].events = (req_events);                \
-                fds[used].revents = 0;                          \
-                assert((req_fd) < poller->fd_rindex_allocd);    \
-                poller->fd_rindex[(req_fd)] = used;             \
-            }                                                   \
-            used++;                                             \
-        }                                                       \
-    }while(0)
-
-    LIBXL_LIST_FOREACH(efd, &CTX->efds, entry)
-        REQUIRE_FD(efd->fd, efd->events, efd);
-
-    REQUIRE_FD(poller->wakeup_pipe[0], POLLIN, 0);
-
-#undef REQUIRE_FD
+    REQUIRE_FDS({
+        if (used < *nfds_io) {
+            fds[used].fd = req_fd;
+            fds[used].events = req_events;
+            fds[used].revents = 0;
+            assert(req_fd < poller->fd_rindex_allocd);
+            poller->fd_rindex[req_fd] = used;
+        }
+        used++;
+    });
 
     rc = used <= *nfds_io ? 0 : ERROR_BUFFERFULL;
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR9-000102-7C; Fri, 13 Apr 2012 16:33:27 +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 1SIjR7-0000ko-Cv
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:25 +0000
Received: from [85.158.143.99:11018] by server-2.bemta-4.messagelabs.com id
	50/95-17550-555588F4; Fri, 13 Apr 2012 16:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1334334802!12357621!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5879 invoked from network); 13 Apr 2012 16:33:23 -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;
	13 Apr 2012 16:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004X1-0Y
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0004YI-Vf
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Message-Id: <E1SIjR3-0004YI-Vf@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Protect fds with CLOEXEC even
	with forking threads
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150058 -3600
# Node ID 8a88f6e209dbecfeb0426970540df22351f74fe4
# Parent  4fef2701410b48ad3de422ed4e9a6b4cee527195
libxl: Protect fds with CLOEXEC even with forking threads

We introduce a new "carefd" concept, which relates to fds that we care
about not being inherited by long-lived children.

As yet we do not use this anywhere in libxl.  Until all locations in
libxl which make such fds are converted, libxl__postfork may not work
entirely properly.  If these locations do not use O_CLOEXEC (or use
calls for which there is no O_CLOEXEC) then multithreaded programs may
not work properly.

This introduces a new API call libxl_postfork_child_noexec which must
be called by applications which make long-running non-execing
children.  Add the appropriate call to xl's postfork function.

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


diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 11 14:14:18 2012 +0100
@@ -53,7 +53,7 @@ LIBXL_LIBS += -lyajl
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
-			libxl_qmp.o libxl_event.o $(LIBXL_OBJS-y)
+			libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:18 2012 +0100
@@ -68,6 +68,9 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
 
     /* Now ctx is safe for ctx_free; failures simply set rc and "goto out" */
 
+    rc = libxl__atfork_init(ctx);
+    if (rc) goto out;
+
     rc = libxl__poller_init(ctx, &ctx->poller_app);
     if (rc) goto out;
 
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl_event.h
--- a/tools/libxl/libxl_event.h	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl_event.h	Wed Apr 11 14:14:18 2012 +0100
@@ -371,6 +371,19 @@ void libxl_osevent_occurred_fd(libxl_ctx
  */
 void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl);
 
+
+/*
+ * An application which initialises a libxl_ctx in a parent process
+ * and then forks a child which does not quickly exec, must
+ * instead libxl_postfork_child_noexec in the child.  One call
+ * on any existing (or specially made) ctx is sufficient; after
+ * this all previously existing libxl_ctx's are invalidated and
+ * must not be used - or even freed.  It is harmless to call this
+ * postfork function and then exec anyway.
+ */
+void libxl_postfork_child_noexec(libxl_ctx *ctx);
+
+
 #endif
 
 /*
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl_fork.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_fork.c	Wed Apr 11 14:14:18 2012 +0100
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012      Citrix Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+/*
+ * Internal child process machinery for use by other parts of libxl
+ */
+
+#include "libxl_osdeps.h" /* must come before any other headers */
+
+#include "libxl_internal.h"
+
+/*
+ * carefd arrangements
+ *
+ * carefd_begin and _unlock take out the no_forking lock, which we
+ * also take and release in our pthread_atfork handlers.  So when this
+ * lock is held the whole process cannot fork.  We therefore protect
+ * our fds from leaking into children made by other threads.
+ *
+ * We maintain a list of all the carefds, so that if the application
+ * wants to fork a long-running but non-execing child, we can close
+ * them all.
+ *
+ * So the record function sets CLOEXEC for the benefit of execing
+ * children, and makes a note of the fd for the benefit of non-execing
+ * ones.
+ */
+
+struct libxl__carefd {
+    LIBXL_LIST_ENTRY(libxl__carefd) entry;
+    int fd;
+};
+
+static pthread_mutex_t no_forking = PTHREAD_MUTEX_INITIALIZER;
+static int atfork_registered;
+static LIBXL_LIST_HEAD(, libxl__carefd) carefds =
+    LIBXL_LIST_HEAD_INITIALIZER(carefds);
+
+static void atfork_lock(void)
+{
+    int r = pthread_mutex_lock(&no_forking);
+    assert(!r);
+}
+
+static void atfork_unlock(void)
+{
+    int r = pthread_mutex_unlock(&no_forking);
+    assert(!r);
+}
+
+int libxl__atfork_init(libxl_ctx *ctx)
+{
+    int r, rc;
+    
+    atfork_lock();
+    if (atfork_registered) { rc = 0; goto out; }
+
+    r = pthread_atfork(atfork_lock, atfork_unlock, atfork_unlock);
+    if (r) {
+        assert(r == ENOMEM);
+        libxl__alloc_failed(ctx, __func__, 0,0);
+    }
+
+    atfork_registered = 1;
+    rc = 0;
+ out:
+    atfork_unlock();
+    return rc;
+}
+
+void libxl__carefd_begin(void) { atfork_lock(); }
+void libxl__carefd_unlock(void) { atfork_unlock(); }
+
+libxl__carefd *libxl__carefd_record(libxl_ctx *ctx, int fd)
+{
+    libxl__carefd *cf = 0;
+
+    libxl_fd_set_cloexec(ctx, fd, 1);
+    cf = libxl__zalloc(NULL, sizeof(*cf));
+    cf->fd = fd;
+    LIBXL_LIST_INSERT_HEAD(&carefds, cf, entry);
+    return cf;
+}
+
+libxl__carefd *libxl__carefd_opened(libxl_ctx *ctx, int fd)
+{
+    libxl__carefd *cf = 0;
+
+    cf = libxl__carefd_record(ctx, fd);
+    libxl__carefd_unlock();
+    return cf;
+}
+
+void libxl_postfork_child_noexec(libxl_ctx *ctx)
+{
+    libxl__carefd *cf, *cf_tmp;
+    int r;
+
+    atfork_lock();
+    LIBXL_LIST_FOREACH_SAFE(cf, &carefds, entry, cf_tmp) {
+        if (cf->fd >= 0) {
+            r = close(cf->fd);
+            if (r)
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_WARNING,
+                                 "failed to close fd=%d"
+                                 " (perhaps of another libxl ctx)", cf->fd);
+        }
+        free(cf);
+    }
+    LIBXL_LIST_INIT(&carefds);
+    atfork_unlock();
+}
+
+int libxl__carefd_close(libxl__carefd *cf)
+{
+    if (!cf) return 0;
+    int r = cf->fd < 0 ? 0 : close(cf->fd);
+    int esave = errno;
+    atfork_lock();
+    LIBXL_LIST_REMOVE(cf, entry);
+    atfork_unlock();
+    free(cf);
+    errno = esave;
+    return r;
+}
+
+int libxl__carefd_fd(const libxl__carefd *cf)
+{
+    if (!cf) return -1;
+    return cf->fd;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:18 2012 +0100
@@ -611,6 +611,9 @@ void libxl__poller_put(libxl_ctx *ctx, l
 void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p);
 
 
+int libxl__atfork_init(libxl_ctx *ctx);
+
+
 /* from xl_dom */
 _hidden libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid);
 _hidden int libxl__domain_shutdown_reason(libxl__gc *gc, uint32_t domid);
@@ -1307,6 +1310,66 @@ _hidden void libxl__ao_complete(libxl__e
 /* For use by ao machinery ONLY */
 _hidden void libxl__ao__destroy(libxl_ctx*, libxl__ao *ao);
 
+
+/*
+ * File descriptors and CLOEXEC
+ */
+
+/*
+ * For libxl functions which create file descriptors, at least one
+ * of the following must be true:
+ *  (a) libxl does not care if copies of this open-file are inherited
+ *      by random children and might remain open indefinitely
+ *  (b) libxl must take extra care for the fd (the actual descriptor,
+ *      not the open-file) as below.  We call this a "carefd".
+ *
+ * The rules for opening a carefd are:
+ *  (i)   Before bringing any carefds into existence,
+ *        libxl code must call libxl__carefd_begin.
+ *  (ii)  Then for each carefd brought into existence,
+ *        libxl code must call libxl__carefd_record
+ *        and remember the libxl__carefd_record*.
+ *  (iii) Then it must call libxl__carefd_unlock.
+ *  (iv)  When in a child process the fd is to be passed across
+ *        exec by libxl, the libxl code must unset FD_CLOEXEC
+ *        on the fd eg by using libxl_fd_set_cloexec.
+ *  (v)   Later, when the fd is to be closed in the same process,
+ *        libxl code must not call close.  Instead, it must call
+ *        libxl__carefd_close.
+ * Steps (ii) and (iii) can be combined by calling the convenience
+ * function libxl__carefd_opened.
+ */
+/* libxl__carefd_begin and _unlock (or _opened) must be called always
+ * in pairs.  They may be called with the CTX lock held.  In between
+ * _begin and _unlock, the following are prohibited:
+ *   - anything which might block
+ *   - any callbacks to the application
+ *   - nested calls to libxl__carefd_begin
+ *   - fork (libxl__fork)
+ * In general nothing should be done before _unlock that could be done
+ * afterwards.
+ */
+typedef struct libxl__carefd libxl__carefd;
+
+void libxl__carefd_begin(void);
+void libxl__carefd_unlock(void);
+
+/* fd may be -1, in which case this returns a dummy libxl__fd_record
+ * on which it _carefd_close is a no-op.  Cannot fail. */
+libxl__carefd *libxl__carefd_record(libxl_ctx *ctx, int fd);
+
+/* Combines _record and _unlock in a single call.  If fd==-1,
+ * still does the unlock, but returns 0.  Cannot fail. */
+libxl__carefd *libxl__carefd_opened(libxl_ctx *ctx, int fd);
+
+/* Works just like close(2).  You may pass NULL, in which case it's
+ * a successful no-op. */
+int libxl__carefd_close(libxl__carefd*);
+
+/* You may pass NULL in which case the answer is -1. */
+int libxl__carefd_fd(const libxl__carefd*);
+
+
 /*
  * Convenience macros.
  */
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/xl.c
--- a/tools/libxl/xl.c	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/xl.c	Wed Apr 11 14:14:18 2012 +0100
@@ -96,6 +96,9 @@ static void parse_global_config(const ch
 
 void postfork(void)
 {
+    libxl_postfork_child_noexec(ctx); /* in case we don't exit/exec */
+    ctx = 0;
+
     if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (xentoollog_logger*)logger)) {
         fprintf(stderr, "cannot reinit xl context after fork\n");
         exit(-1);

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR9-000102-7C; Fri, 13 Apr 2012 16:33:27 +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 1SIjR7-0000ko-Cv
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:25 +0000
Received: from [85.158.143.99:11018] by server-2.bemta-4.messagelabs.com id
	50/95-17550-555588F4; Fri, 13 Apr 2012 16:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1334334802!12357621!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5879 invoked from network); 13 Apr 2012 16:33:23 -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;
	13 Apr 2012 16:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004X1-0Y
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR3-0004YI-Vf
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:21 +0000
Message-Id: <E1SIjR3-0004YI-Vf@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Protect fds with CLOEXEC even
	with forking threads
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150058 -3600
# Node ID 8a88f6e209dbecfeb0426970540df22351f74fe4
# Parent  4fef2701410b48ad3de422ed4e9a6b4cee527195
libxl: Protect fds with CLOEXEC even with forking threads

We introduce a new "carefd" concept, which relates to fds that we care
about not being inherited by long-lived children.

As yet we do not use this anywhere in libxl.  Until all locations in
libxl which make such fds are converted, libxl__postfork may not work
entirely properly.  If these locations do not use O_CLOEXEC (or use
calls for which there is no O_CLOEXEC) then multithreaded programs may
not work properly.

This introduces a new API call libxl_postfork_child_noexec which must
be called by applications which make long-running non-execing
children.  Add the appropriate call to xl's postfork function.

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


diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 11 14:14:18 2012 +0100
@@ -53,7 +53,7 @@ LIBXL_LIBS += -lyajl
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
-			libxl_qmp.o libxl_event.o $(LIBXL_OBJS-y)
+			libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl.c	Wed Apr 11 14:14:18 2012 +0100
@@ -68,6 +68,9 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
 
     /* Now ctx is safe for ctx_free; failures simply set rc and "goto out" */
 
+    rc = libxl__atfork_init(ctx);
+    if (rc) goto out;
+
     rc = libxl__poller_init(ctx, &ctx->poller_app);
     if (rc) goto out;
 
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl_event.h
--- a/tools/libxl/libxl_event.h	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl_event.h	Wed Apr 11 14:14:18 2012 +0100
@@ -371,6 +371,19 @@ void libxl_osevent_occurred_fd(libxl_ctx
  */
 void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl);
 
+
+/*
+ * An application which initialises a libxl_ctx in a parent process
+ * and then forks a child which does not quickly exec, must
+ * instead libxl_postfork_child_noexec in the child.  One call
+ * on any existing (or specially made) ctx is sufficient; after
+ * this all previously existing libxl_ctx's are invalidated and
+ * must not be used - or even freed.  It is harmless to call this
+ * postfork function and then exec anyway.
+ */
+void libxl_postfork_child_noexec(libxl_ctx *ctx);
+
+
 #endif
 
 /*
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl_fork.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_fork.c	Wed Apr 11 14:14:18 2012 +0100
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012      Citrix Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+/*
+ * Internal child process machinery for use by other parts of libxl
+ */
+
+#include "libxl_osdeps.h" /* must come before any other headers */
+
+#include "libxl_internal.h"
+
+/*
+ * carefd arrangements
+ *
+ * carefd_begin and _unlock take out the no_forking lock, which we
+ * also take and release in our pthread_atfork handlers.  So when this
+ * lock is held the whole process cannot fork.  We therefore protect
+ * our fds from leaking into children made by other threads.
+ *
+ * We maintain a list of all the carefds, so that if the application
+ * wants to fork a long-running but non-execing child, we can close
+ * them all.
+ *
+ * So the record function sets CLOEXEC for the benefit of execing
+ * children, and makes a note of the fd for the benefit of non-execing
+ * ones.
+ */
+
+struct libxl__carefd {
+    LIBXL_LIST_ENTRY(libxl__carefd) entry;
+    int fd;
+};
+
+static pthread_mutex_t no_forking = PTHREAD_MUTEX_INITIALIZER;
+static int atfork_registered;
+static LIBXL_LIST_HEAD(, libxl__carefd) carefds =
+    LIBXL_LIST_HEAD_INITIALIZER(carefds);
+
+static void atfork_lock(void)
+{
+    int r = pthread_mutex_lock(&no_forking);
+    assert(!r);
+}
+
+static void atfork_unlock(void)
+{
+    int r = pthread_mutex_unlock(&no_forking);
+    assert(!r);
+}
+
+int libxl__atfork_init(libxl_ctx *ctx)
+{
+    int r, rc;
+    
+    atfork_lock();
+    if (atfork_registered) { rc = 0; goto out; }
+
+    r = pthread_atfork(atfork_lock, atfork_unlock, atfork_unlock);
+    if (r) {
+        assert(r == ENOMEM);
+        libxl__alloc_failed(ctx, __func__, 0,0);
+    }
+
+    atfork_registered = 1;
+    rc = 0;
+ out:
+    atfork_unlock();
+    return rc;
+}
+
+void libxl__carefd_begin(void) { atfork_lock(); }
+void libxl__carefd_unlock(void) { atfork_unlock(); }
+
+libxl__carefd *libxl__carefd_record(libxl_ctx *ctx, int fd)
+{
+    libxl__carefd *cf = 0;
+
+    libxl_fd_set_cloexec(ctx, fd, 1);
+    cf = libxl__zalloc(NULL, sizeof(*cf));
+    cf->fd = fd;
+    LIBXL_LIST_INSERT_HEAD(&carefds, cf, entry);
+    return cf;
+}
+
+libxl__carefd *libxl__carefd_opened(libxl_ctx *ctx, int fd)
+{
+    libxl__carefd *cf = 0;
+
+    cf = libxl__carefd_record(ctx, fd);
+    libxl__carefd_unlock();
+    return cf;
+}
+
+void libxl_postfork_child_noexec(libxl_ctx *ctx)
+{
+    libxl__carefd *cf, *cf_tmp;
+    int r;
+
+    atfork_lock();
+    LIBXL_LIST_FOREACH_SAFE(cf, &carefds, entry, cf_tmp) {
+        if (cf->fd >= 0) {
+            r = close(cf->fd);
+            if (r)
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_WARNING,
+                                 "failed to close fd=%d"
+                                 " (perhaps of another libxl ctx)", cf->fd);
+        }
+        free(cf);
+    }
+    LIBXL_LIST_INIT(&carefds);
+    atfork_unlock();
+}
+
+int libxl__carefd_close(libxl__carefd *cf)
+{
+    if (!cf) return 0;
+    int r = cf->fd < 0 ? 0 : close(cf->fd);
+    int esave = errno;
+    atfork_lock();
+    LIBXL_LIST_REMOVE(cf, entry);
+    atfork_unlock();
+    free(cf);
+    errno = esave;
+    return r;
+}
+
+int libxl__carefd_fd(const libxl__carefd *cf)
+{
+    if (!cf) return -1;
+    return cf->fd;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:18 2012 +0100
@@ -611,6 +611,9 @@ void libxl__poller_put(libxl_ctx *ctx, l
 void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p);
 
 
+int libxl__atfork_init(libxl_ctx *ctx);
+
+
 /* from xl_dom */
 _hidden libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid);
 _hidden int libxl__domain_shutdown_reason(libxl__gc *gc, uint32_t domid);
@@ -1307,6 +1310,66 @@ _hidden void libxl__ao_complete(libxl__e
 /* For use by ao machinery ONLY */
 _hidden void libxl__ao__destroy(libxl_ctx*, libxl__ao *ao);
 
+
+/*
+ * File descriptors and CLOEXEC
+ */
+
+/*
+ * For libxl functions which create file descriptors, at least one
+ * of the following must be true:
+ *  (a) libxl does not care if copies of this open-file are inherited
+ *      by random children and might remain open indefinitely
+ *  (b) libxl must take extra care for the fd (the actual descriptor,
+ *      not the open-file) as below.  We call this a "carefd".
+ *
+ * The rules for opening a carefd are:
+ *  (i)   Before bringing any carefds into existence,
+ *        libxl code must call libxl__carefd_begin.
+ *  (ii)  Then for each carefd brought into existence,
+ *        libxl code must call libxl__carefd_record
+ *        and remember the libxl__carefd_record*.
+ *  (iii) Then it must call libxl__carefd_unlock.
+ *  (iv)  When in a child process the fd is to be passed across
+ *        exec by libxl, the libxl code must unset FD_CLOEXEC
+ *        on the fd eg by using libxl_fd_set_cloexec.
+ *  (v)   Later, when the fd is to be closed in the same process,
+ *        libxl code must not call close.  Instead, it must call
+ *        libxl__carefd_close.
+ * Steps (ii) and (iii) can be combined by calling the convenience
+ * function libxl__carefd_opened.
+ */
+/* libxl__carefd_begin and _unlock (or _opened) must be called always
+ * in pairs.  They may be called with the CTX lock held.  In between
+ * _begin and _unlock, the following are prohibited:
+ *   - anything which might block
+ *   - any callbacks to the application
+ *   - nested calls to libxl__carefd_begin
+ *   - fork (libxl__fork)
+ * In general nothing should be done before _unlock that could be done
+ * afterwards.
+ */
+typedef struct libxl__carefd libxl__carefd;
+
+void libxl__carefd_begin(void);
+void libxl__carefd_unlock(void);
+
+/* fd may be -1, in which case this returns a dummy libxl__fd_record
+ * on which it _carefd_close is a no-op.  Cannot fail. */
+libxl__carefd *libxl__carefd_record(libxl_ctx *ctx, int fd);
+
+/* Combines _record and _unlock in a single call.  If fd==-1,
+ * still does the unlock, but returns 0.  Cannot fail. */
+libxl__carefd *libxl__carefd_opened(libxl_ctx *ctx, int fd);
+
+/* Works just like close(2).  You may pass NULL, in which case it's
+ * a successful no-op. */
+int libxl__carefd_close(libxl__carefd*);
+
+/* You may pass NULL in which case the answer is -1. */
+int libxl__carefd_fd(const libxl__carefd*);
+
+
 /*
  * Convenience macros.
  */
diff -r 4fef2701410b -r 8a88f6e209db tools/libxl/xl.c
--- a/tools/libxl/xl.c	Wed Apr 11 14:14:17 2012 +0100
+++ b/tools/libxl/xl.c	Wed Apr 11 14:14:18 2012 +0100
@@ -96,6 +96,9 @@ static void parse_global_config(const ch
 
 void postfork(void)
 {
+    libxl_postfork_child_noexec(ctx); /* in case we don't exit/exec */
+    ctx = 0;
+
     if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (xentoollog_logger*)logger)) {
         fprintf(stderr, "cannot reinit xl context after fork\n");
         exit(-1);

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR9-0000zo-4l; Fri, 13 Apr 2012 16:33: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 1SIjR7-0000mL-Ic
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:25 +0000
Received: from [85.158.139.83:49308] by server-9.bemta-5.messagelabs.com id
	1E/0B-09826-555588F4; Fri, 13 Apr 2012 16:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1334334801!19122601!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23338 invoked from network); 13 Apr 2012 16:33:23 -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;
	13 Apr 2012 16:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004Wp-EY
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004XZ-DH
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Message-Id: <E1SIjR2-0004XZ-DH@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: include <_libxl_paths.h> in
	libxl_internal.h
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150056 -3600
# Node ID 8a99e1944bd09c690272cbda9eac346fcbdefde8
# Parent  6fc016d74c40c972f82c4da38e80b448713e4665
libxl: include <_libxl_paths.h> in libxl_internal.h

Ie, we permit general code in libxl direct access to the manifest
constants such as XEN_RUN_DIR.  This simplifies their use in (eg)
format strings.

This might be controversial because it will make it difficult to make
any of these runtime-configurable later without changing lots of use
sites.  But I don't think it's likely we'll want to do that.

For the moment, leave existing call sites of all the functions in
libxl_paths.c unchanged.  The simplified use arrangements can be used
in new code and when we update call sites for other reasons.

Also correct the dependencies in the Makefile so that _libxl_paths.h
is generated before anything that uses libxl_internal.h.

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


diff -r 6fc016d74c40 -r 8a99e1944bd0 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 11 14:14:16 2012 +0100
@@ -102,11 +102,9 @@ _libxl_list.h: $(XEN_INCLUDE)/xen-extern
 	perl $^ --prefix=libxl >$@.new
 	$(call move-if-changed,$@.new,$@)
 
-libxl_paths.c: _libxl_paths.h
-
 libxl.h: _libxl_types.h
 libxl_json.h: _libxl_types_json.h
-libxl_internal.h: _libxl_types_internal.h
+libxl_internal.h: _libxl_types_internal.h _libxl_paths.h
 libxl_internal_json.h: _libxl_types_internal_json.h
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
diff -r 6fc016d74c40 -r 8a99e1944bd0 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:16 2012 +0100
@@ -51,6 +51,7 @@
 #include <xen/io/xenbus.h>
 
 #include "libxl.h"
+#include "_libxl_paths.h"
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
 #define _hidden __attribute__((visibility("hidden")))
diff -r 6fc016d74c40 -r 8a99e1944bd0 tools/libxl/libxl_paths.c
--- a/tools/libxl/libxl_paths.c	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl_paths.c	Wed Apr 11 14:14:16 2012 +0100
@@ -14,7 +14,6 @@
 
 #include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxl_internal.h"
-#include "_libxl_paths.h"
 
 const char *libxl_sbindir_path(void)
 {

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjR9-0000zo-4l; Fri, 13 Apr 2012 16:33: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 1SIjR7-0000mL-Ic
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:25 +0000
Received: from [85.158.139.83:49308] by server-9.bemta-5.messagelabs.com id
	1E/0B-09826-555588F4; Fri, 13 Apr 2012 16:33:25 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1334334801!19122601!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23338 invoked from network); 13 Apr 2012 16:33:23 -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;
	13 Apr 2012 16:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004Wp-EY
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004XZ-DH
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Message-Id: <E1SIjR2-0004XZ-DH@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: include <_libxl_paths.h> in
	libxl_internal.h
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150056 -3600
# Node ID 8a99e1944bd09c690272cbda9eac346fcbdefde8
# Parent  6fc016d74c40c972f82c4da38e80b448713e4665
libxl: include <_libxl_paths.h> in libxl_internal.h

Ie, we permit general code in libxl direct access to the manifest
constants such as XEN_RUN_DIR.  This simplifies their use in (eg)
format strings.

This might be controversial because it will make it difficult to make
any of these runtime-configurable later without changing lots of use
sites.  But I don't think it's likely we'll want to do that.

For the moment, leave existing call sites of all the functions in
libxl_paths.c unchanged.  The simplified use arrangements can be used
in new code and when we update call sites for other reasons.

Also correct the dependencies in the Makefile so that _libxl_paths.h
is generated before anything that uses libxl_internal.h.

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


diff -r 6fc016d74c40 -r 8a99e1944bd0 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/Makefile	Wed Apr 11 14:14:16 2012 +0100
@@ -102,11 +102,9 @@ _libxl_list.h: $(XEN_INCLUDE)/xen-extern
 	perl $^ --prefix=libxl >$@.new
 	$(call move-if-changed,$@.new,$@)
 
-libxl_paths.c: _libxl_paths.h
-
 libxl.h: _libxl_types.h
 libxl_json.h: _libxl_types_json.h
-libxl_internal.h: _libxl_types_internal.h
+libxl_internal.h: _libxl_types_internal.h _libxl_paths.h
 libxl_internal_json.h: _libxl_types_internal_json.h
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
diff -r 6fc016d74c40 -r 8a99e1944bd0 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:16 2012 +0100
@@ -51,6 +51,7 @@
 #include <xen/io/xenbus.h>
 
 #include "libxl.h"
+#include "_libxl_paths.h"
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
 #define _hidden __attribute__((visibility("hidden")))
diff -r 6fc016d74c40 -r 8a99e1944bd0 tools/libxl/libxl_paths.c
--- a/tools/libxl/libxl_paths.c	Wed Apr 11 14:14:15 2012 +0100
+++ b/tools/libxl/libxl_paths.c	Wed Apr 11 14:14:16 2012 +0100
@@ -14,7 +14,6 @@
 
 #include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxl_internal.h"
-#include "_libxl_paths.h"
 
 const char *libxl_sbindir_path(void)
 {

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-000128-Cu; Fri, 13 Apr 2012 16:33: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 1SIjR8-0000ko-Da
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:26 +0000
Received: from [85.158.143.99:33173] by server-2.bemta-4.messagelabs.com id
	C3/95-17550-655588F4; Fri, 13 Apr 2012 16:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334334803!23231545!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3003 invoked from network); 13 Apr 2012 16:33:24 -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;
	13 Apr 2012 16:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004XF-GL
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004Z1-FG
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Message-Id: <E1SIjR5-0004Z1-FG@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/blktap2: fix 'make clean'
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333621466 -3600
# Node ID 6efb9f934bfb4c46af375612fb01e65d15518380
# Parent  a95fc7decc831a01ed43c307c52287b32e7f4832
tools/blktap2: fix 'make clean'

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


diff -r a95fc7decc83 -r 6efb9f934bfb tools/blktap2/lvm/Makefile
--- a/tools/blktap2/lvm/Makefile	Wed Apr 11 16:49:45 2012 +0100
+++ b/tools/blktap2/lvm/Makefile	Thu Apr 05 11:24:26 2012 +0100
@@ -27,7 +27,7 @@ lvm-util: lvm-util.o
 	$(CC) -DLVM_UTIL $(LDFLAGS) -o lvm-util lvm-util.c
 
 clean:
-	rm -rf *.o *~ $(DEPS) $(IBIN)
+	rm -rf *.o *.opic *~ $(DEPS) $(IBIN)
 
 .PHONY: all build clean install lvm-util
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-000128-Cu; Fri, 13 Apr 2012 16:33: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 1SIjR8-0000ko-Da
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:26 +0000
Received: from [85.158.143.99:33173] by server-2.bemta-4.messagelabs.com id
	C3/95-17550-655588F4; Fri, 13 Apr 2012 16:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334334803!23231545!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3003 invoked from network); 13 Apr 2012 16:33:24 -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;
	13 Apr 2012 16:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004XF-GL
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004Z1-FG
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Message-Id: <E1SIjR5-0004Z1-FG@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/blktap2: fix 'make clean'
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1333621466 -3600
# Node ID 6efb9f934bfb4c46af375612fb01e65d15518380
# Parent  a95fc7decc831a01ed43c307c52287b32e7f4832
tools/blktap2: fix 'make clean'

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


diff -r a95fc7decc83 -r 6efb9f934bfb tools/blktap2/lvm/Makefile
--- a/tools/blktap2/lvm/Makefile	Wed Apr 11 16:49:45 2012 +0100
+++ b/tools/blktap2/lvm/Makefile	Thu Apr 05 11:24:26 2012 +0100
@@ -27,7 +27,7 @@ lvm-util: lvm-util.o
 	$(CC) -DLVM_UTIL $(LDFLAGS) -o lvm-util lvm-util.c
 
 clean:
-	rm -rf *.o *~ $(DEPS) $(IBIN)
+	rm -rf *.o *.opic *~ $(DEPS) $(IBIN)
 
 .PHONY: all build clean install lvm-util
 

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-00012P-Ft; Fri, 13 Apr 2012 16:33: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 1SIjR8-0000ko-Py
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:26 +0000
Received: from [85.158.143.35:42068] by server-2.bemta-4.messagelabs.com id
	35/95-17550-655588F4; Fri, 13 Apr 2012 16:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1334334803!16026767!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16072 invoked from network); 13 Apr 2012 16:33:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004XB-0K
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004Ym-VX
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Message-Id: <E1SIjR4-0004Ym-VX@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: fix delta calculation in TSC
	deadline timer emulation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1334159385 -3600
# Node ID a95fc7decc831a01ed43c307c52287b32e7f4832
# Parent  d196634484a9f86136704f973293925445961079
x86: fix delta calculation in TSC deadline timer emulation

In the virtual LAPIC, correct the delta calculation when emulating the
TSC deadline timer.

Without this fix, XenServer (which is based on Xen 4.1) does not work
when running as an HVM guest.  dom0 fails to boot because its timer
interrupts are very delayed (by several minutes in some cases).

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


diff -r d196634484a9 -r a95fc7decc83 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c	Wed Apr 11 14:14:18 2012 +0100
+++ b/xen/arch/x86/hvm/vlapic.c	Wed Apr 11 16:49:45 2012 +0100
@@ -898,7 +898,6 @@ uint64_t  vlapic_tdt_msr_get(struct vlap
 void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value)
 {
     uint64_t guest_tsc;
-    uint64_t guest_time;
     struct vcpu *v = vlapic_vcpu(vlapic);
 
     /* may need to exclude some other conditions like vlapic->hw.disabled */
@@ -910,12 +909,10 @@ void vlapic_tdt_msr_set(struct vlapic *v
     
     /* new_value = 0, >0 && <= now, > now */
     guest_tsc = hvm_get_guest_tsc(v);
-    guest_time = hvm_get_guest_time(v);
     if ( value > guest_tsc )
     {
-        uint64_t delta = value - v->arch.hvm_vcpu.cache_tsc_offset;
-        delta = gtsc_to_gtime(v->domain, delta);
-        delta = max_t(s64, delta - guest_time, 0);
+        uint64_t delta = gtsc_to_gtime(v->domain, value - guest_tsc);
+        delta = max_t(s64, delta, 0);
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "delta[0x%016"PRIx64"]", delta);
 
@@ -949,9 +946,8 @@ void vlapic_tdt_msr_set(struct vlapic *v
 
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
                 "tdt_msr[0x%016"PRIx64"],"
-                " gtsc[0x%016"PRIx64"],"
-                " gtime[0x%016"PRIx64"]",
-                vlapic->hw.tdt_msr, guest_tsc, guest_time);
+                " gtsc[0x%016"PRIx64"]",
+                vlapic->hw.tdt_msr, guest_tsc);
 }
 
 static int __vlapic_accept_pic_intr(struct vcpu *v)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-00012P-Ft; Fri, 13 Apr 2012 16:33: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 1SIjR8-0000ko-Py
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:26 +0000
Received: from [85.158.143.35:42068] by server-2.bemta-4.messagelabs.com id
	35/95-17550-655588F4; Fri, 13 Apr 2012 16:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1334334803!16026767!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16072 invoked from network); 13 Apr 2012 16:33:24 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Apr 2012 16:33:24 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004XB-0K
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004Ym-VX
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Message-Id: <E1SIjR4-0004Ym-VX@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: fix delta calculation in TSC
	deadline timer emulation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User David Vrabel <david.vrabel@citrix.com>
# Date 1334159385 -3600
# Node ID a95fc7decc831a01ed43c307c52287b32e7f4832
# Parent  d196634484a9f86136704f973293925445961079
x86: fix delta calculation in TSC deadline timer emulation

In the virtual LAPIC, correct the delta calculation when emulating the
TSC deadline timer.

Without this fix, XenServer (which is based on Xen 4.1) does not work
when running as an HVM guest.  dom0 fails to boot because its timer
interrupts are very delayed (by several minutes in some cases).

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


diff -r d196634484a9 -r a95fc7decc83 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c	Wed Apr 11 14:14:18 2012 +0100
+++ b/xen/arch/x86/hvm/vlapic.c	Wed Apr 11 16:49:45 2012 +0100
@@ -898,7 +898,6 @@ uint64_t  vlapic_tdt_msr_get(struct vlap
 void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value)
 {
     uint64_t guest_tsc;
-    uint64_t guest_time;
     struct vcpu *v = vlapic_vcpu(vlapic);
 
     /* may need to exclude some other conditions like vlapic->hw.disabled */
@@ -910,12 +909,10 @@ void vlapic_tdt_msr_set(struct vlapic *v
     
     /* new_value = 0, >0 && <= now, > now */
     guest_tsc = hvm_get_guest_tsc(v);
-    guest_time = hvm_get_guest_time(v);
     if ( value > guest_tsc )
     {
-        uint64_t delta = value - v->arch.hvm_vcpu.cache_tsc_offset;
-        delta = gtsc_to_gtime(v->domain, delta);
-        delta = max_t(s64, delta - guest_time, 0);
+        uint64_t delta = gtsc_to_gtime(v->domain, value - guest_tsc);
+        delta = max_t(s64, delta, 0);
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "delta[0x%016"PRIx64"]", delta);
 
@@ -949,9 +946,8 @@ void vlapic_tdt_msr_set(struct vlapic *v
 
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
                 "tdt_msr[0x%016"PRIx64"],"
-                " gtsc[0x%016"PRIx64"],"
-                " gtime[0x%016"PRIx64"]",
-                vlapic->hw.tdt_msr, guest_tsc, guest_time);
+                " gtsc[0x%016"PRIx64"]",
+                vlapic->hw.tdt_msr, guest_tsc);
 }
 
 static int __vlapic_accept_pic_intr(struct vcpu *v)

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-00012b-Ib; Fri, 13 Apr 2012 16:33:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR8-0000yR-PQ
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:26 +0000
Received: from [85.158.139.83:49349] by server-11.bemta-5.messagelabs.com id
	5C/22-12959-655588F4; Fri, 13 Apr 2012 16:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1334334802!16375891!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25342 invoked from network); 13 Apr 2012 16:33:23 -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;
	13 Apr 2012 16:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004Wu-Vs
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004Xo-Uk
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Message-Id: <E1SIjR2-0004Xo-Uk@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: abolish libxl_ctx_postfork
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150057 -3600
# Node ID 24bb3350102c130985c2f04849c64446c2c1144f
# Parent  8a99e1944bd09c690272cbda9eac346fcbdefde8
libxl: abolish libxl_ctx_postfork

libxl's task has become too complicated (particularly in the presence
of both forking and multithreading) to support reuse of the same
libxl_ctx after fork.

So abolish libxl_ctx_fork.  xl instead simply initialises a new
libxl_ctx.

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


diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 11 14:14:17 2012 +0100
@@ -461,7 +461,6 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
                     unsigned flags /* none currently defined */,
                     xentoollog_logger *lg);
 int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */);
-int libxl_ctx_postfork(libxl_ctx *ctx);
 
 /* domain related functions */
 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/libxl_utils.c	Wed Apr 11 14:14:17 2012 +0100
@@ -365,13 +365,6 @@ READ_WRITE_EXACTLY(read, 1, /* */)
 READ_WRITE_EXACTLY(write, 0, const)
 
 
-int libxl_ctx_postfork(libxl_ctx *ctx) {
-    if (ctx->xsh) xs_daemon_destroy_postfork(ctx->xsh);
-    ctx->xsh = xs_daemon_open();
-    if (!ctx->xsh) return ERROR_FAIL;
-    return 0;
-}
-
 pid_t libxl_fork(libxl_ctx *ctx)
 {
     pid_t pid;
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/xl.c
--- a/tools/libxl/xl.c	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/xl.c	Wed Apr 11 14:14:17 2012 +0100
@@ -94,6 +94,14 @@ static void parse_global_config(const ch
     xlu_cfg_destroy(config);
 }
 
+void postfork(void)
+{
+    if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (xentoollog_logger*)logger)) {
+        fprintf(stderr, "cannot reinit xl context after fork\n");
+        exit(-1);
+    }
+}
+
 int main(int argc, char **argv)
 {
     int opt = 0;
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/xl.h
--- a/tools/libxl/xl.h	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/xl.h	Wed Apr 11 14:14:17 2012 +0100
@@ -105,6 +105,7 @@ struct cmd_spec *cmdtable_lookup(const c
 
 extern libxl_ctx *ctx;
 extern xentoollog_logger_stdiostream *logger;
+void postfork(void);
 
 /* global options */
 extern int autoballoon;
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 11 14:14:17 2012 +0100
@@ -1441,7 +1441,7 @@ static int autoconnect_console(libxl_ctx
     } else if (*pid > 0)
         return 0;
 
-    libxl_ctx_postfork(ctx);
+    postfork();
 
     sleep(1);
     libxl_primary_console_exec(ctx, domid);
@@ -1728,11 +1728,7 @@ start:
             goto out;
         }
 
-        rc = libxl_ctx_postfork(ctx);
-        if (rc) {
-            LOG("failed to reinitialise context after fork");
-            exit(-1);
-        }
+        postfork();
 
         if (asprintf(&name, "xl-%s", d_config.c_info.name) < 0) {
             LOG("Failed to allocate memory in asprintf");

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-00012v-LS; Fri, 13 Apr 2012 16:33: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 1SIjRA-00010k-1I
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:28 +0000
Received: from [85.158.143.35:42126] by server-3.bemta-4.messagelabs.com id
	9A/57-05853-755588F4; Fri, 13 Apr 2012 16:33:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1334334804!12344058!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25957 invoked from network); 13 Apr 2012 16:33:25 -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 Apr 2012 16:33:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR6-0004XI-0E
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004ZG-VP
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Message-Id: <E1SIjR5-0004ZG-VP@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Fix failure paths for xentrace
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334235687 -3600
# Node ID c6bde42c8845439183336602a78bc07869f3651b
# Parent  6efb9f934bfb4c46af375612fb01e65d15518380
xen: Fix failure paths for xentrace

Problems this addresses:
* After the allocation of t_info fails, the path the code takes tries
to free t_info.  Jump past that part instead.
* The failure code assumes that unused data is zero; but the structure
is never initialized.  Zero the structure before using it.
* The t_info pages are shared with dom0 before we know that the whole
operation will succeed, and not un-shared afterwards.  Don't share the
pages until we know the whole thing will succeed.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 6efb9f934bfb -r c6bde42c8845 xen/common/trace.c
--- a/xen/common/trace.c	Thu Apr 05 11:24:26 2012 +0100
+++ b/xen/common/trace.c	Thu Apr 12 14:01:27 2012 +0100
@@ -187,14 +187,12 @@ static int alloc_trace_bufs(unsigned int
 
     t_info = alloc_xenheap_pages(get_order_from_pages(t_info_pages), 0);
     if ( t_info == NULL )
-        goto out_dealloc_t_info;
+        goto out_fail;
+
+    memset(t_info, 0, t_info_pages*PAGE_SIZE);
 
     t_info_mfn_list = (uint32_t *)t_info;
 
-    for(i = 0; i < t_info_pages; i++)
-        share_xen_page_with_privileged_guests(
-            virt_to_page(t_info) + i, XENSHARE_readonly);
-
     t_info->tbuf_size = pages;
 
     /*
@@ -247,6 +245,11 @@ static int alloc_trace_bufs(unsigned int
         }
     }
 
+    /* Finally, share the t_info page */
+    for(i = 0; i < t_info_pages; i++)
+        share_xen_page_with_privileged_guests(
+            virt_to_page(t_info) + i, XENSHARE_readonly);
+
     data_size  = (pages * PAGE_SIZE - sizeof(struct t_buf));
     t_buf_highwater = data_size >> 1; /* 50% high water */
     opt_tbuf_size = pages;
@@ -272,9 +275,9 @@ out_dealloc:
             free_xenheap_pages(mfn_to_virt(mfn), 0);
         }
     }
-out_dealloc_t_info:
     free_xenheap_pages(t_info, get_order_from_pages(t_info_pages));
     t_info = NULL;
+out_fail:
     printk(XENLOG_WARNING "xentrace: allocation failed! Tracing disabled.\n");
     return -ENOMEM;
 }

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-00012v-LS; Fri, 13 Apr 2012 16:33: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 1SIjRA-00010k-1I
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:28 +0000
Received: from [85.158.143.35:42126] by server-3.bemta-4.messagelabs.com id
	9A/57-05853-755588F4; Fri, 13 Apr 2012 16:33:27 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1334334804!12344058!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25957 invoked from network); 13 Apr 2012 16:33:25 -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 Apr 2012 16:33:25 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR6-0004XI-0E
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:24 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR5-0004ZG-VP
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:23 +0000
Message-Id: <E1SIjR5-0004ZG-VP@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Fix failure paths for xentrace
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334235687 -3600
# Node ID c6bde42c8845439183336602a78bc07869f3651b
# Parent  6efb9f934bfb4c46af375612fb01e65d15518380
xen: Fix failure paths for xentrace

Problems this addresses:
* After the allocation of t_info fails, the path the code takes tries
to free t_info.  Jump past that part instead.
* The failure code assumes that unused data is zero; but the structure
is never initialized.  Zero the structure before using it.
* The t_info pages are shared with dom0 before we know that the whole
operation will succeed, and not un-shared afterwards.  Don't share the
pages until we know the whole thing will succeed.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 6efb9f934bfb -r c6bde42c8845 xen/common/trace.c
--- a/xen/common/trace.c	Thu Apr 05 11:24:26 2012 +0100
+++ b/xen/common/trace.c	Thu Apr 12 14:01:27 2012 +0100
@@ -187,14 +187,12 @@ static int alloc_trace_bufs(unsigned int
 
     t_info = alloc_xenheap_pages(get_order_from_pages(t_info_pages), 0);
     if ( t_info == NULL )
-        goto out_dealloc_t_info;
+        goto out_fail;
+
+    memset(t_info, 0, t_info_pages*PAGE_SIZE);
 
     t_info_mfn_list = (uint32_t *)t_info;
 
-    for(i = 0; i < t_info_pages; i++)
-        share_xen_page_with_privileged_guests(
-            virt_to_page(t_info) + i, XENSHARE_readonly);
-
     t_info->tbuf_size = pages;
 
     /*
@@ -247,6 +245,11 @@ static int alloc_trace_bufs(unsigned int
         }
     }
 
+    /* Finally, share the t_info page */
+    for(i = 0; i < t_info_pages; i++)
+        share_xen_page_with_privileged_guests(
+            virt_to_page(t_info) + i, XENSHARE_readonly);
+
     data_size  = (pages * PAGE_SIZE - sizeof(struct t_buf));
     t_buf_highwater = data_size >> 1; /* 50% high water */
     opt_tbuf_size = pages;
@@ -272,9 +275,9 @@ out_dealloc:
             free_xenheap_pages(mfn_to_virt(mfn), 0);
         }
     }
-out_dealloc_t_info:
     free_xenheap_pages(t_info, get_order_from_pages(t_info_pages));
     t_info = NULL;
+out_fail:
     printk(XENLOG_WARNING "xentrace: allocation failed! Tracing disabled.\n");
     return -ENOMEM;
 }

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:28 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRA-00012b-Ib; Fri, 13 Apr 2012 16:33:28 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR8-0000yR-PQ
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:26 +0000
Received: from [85.158.139.83:49349] by server-11.bemta-5.messagelabs.com id
	5C/22-12959-655588F4; Fri, 13 Apr 2012 16:33:26 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1334334802!16375891!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25342 invoked from network); 13 Apr 2012 16:33:23 -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;
	13 Apr 2012 16:33:23 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004Wu-Vs
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR2-0004Xo-Uk
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:20 +0000
Message-Id: <E1SIjR2-0004Xo-Uk@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: abolish libxl_ctx_postfork
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150057 -3600
# Node ID 24bb3350102c130985c2f04849c64446c2c1144f
# Parent  8a99e1944bd09c690272cbda9eac346fcbdefde8
libxl: abolish libxl_ctx_postfork

libxl's task has become too complicated (particularly in the presence
of both forking and multithreading) to support reuse of the same
libxl_ctx after fork.

So abolish libxl_ctx_fork.  xl instead simply initialises a new
libxl_ctx.

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


diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/libxl.h	Wed Apr 11 14:14:17 2012 +0100
@@ -461,7 +461,6 @@ int libxl_ctx_alloc(libxl_ctx **pctx, in
                     unsigned flags /* none currently defined */,
                     xentoollog_logger *lg);
 int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */);
-int libxl_ctx_postfork(libxl_ctx *ctx);
 
 /* domain related functions */
 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/libxl_utils.c	Wed Apr 11 14:14:17 2012 +0100
@@ -365,13 +365,6 @@ READ_WRITE_EXACTLY(read, 1, /* */)
 READ_WRITE_EXACTLY(write, 0, const)
 
 
-int libxl_ctx_postfork(libxl_ctx *ctx) {
-    if (ctx->xsh) xs_daemon_destroy_postfork(ctx->xsh);
-    ctx->xsh = xs_daemon_open();
-    if (!ctx->xsh) return ERROR_FAIL;
-    return 0;
-}
-
 pid_t libxl_fork(libxl_ctx *ctx)
 {
     pid_t pid;
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/xl.c
--- a/tools/libxl/xl.c	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/xl.c	Wed Apr 11 14:14:17 2012 +0100
@@ -94,6 +94,14 @@ static void parse_global_config(const ch
     xlu_cfg_destroy(config);
 }
 
+void postfork(void)
+{
+    if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (xentoollog_logger*)logger)) {
+        fprintf(stderr, "cannot reinit xl context after fork\n");
+        exit(-1);
+    }
+}
+
 int main(int argc, char **argv)
 {
     int opt = 0;
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/xl.h
--- a/tools/libxl/xl.h	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/xl.h	Wed Apr 11 14:14:17 2012 +0100
@@ -105,6 +105,7 @@ struct cmd_spec *cmdtable_lookup(const c
 
 extern libxl_ctx *ctx;
 extern xentoollog_logger_stdiostream *logger;
+void postfork(void);
 
 /* global options */
 extern int autoballoon;
diff -r 8a99e1944bd0 -r 24bb3350102c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Apr 11 14:14:16 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Apr 11 14:14:17 2012 +0100
@@ -1441,7 +1441,7 @@ static int autoconnect_console(libxl_ctx
     } else if (*pid > 0)
         return 0;
 
-    libxl_ctx_postfork(ctx);
+    postfork();
 
     sleep(1);
     libxl_primary_console_exec(ctx, domid);
@@ -1728,11 +1728,7 @@ start:
             goto out;
         }
 
-        rc = libxl_ctx_postfork(ctx);
-        if (rc) {
-            LOG("failed to reinitialise context after fork");
-            exit(-1);
-        }
+        postfork();
 
         if (asprintf(&name, "xl-%s", d_config.c_info.name) < 0) {
             LOG("Failed to allocate memory in asprintf");

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:35 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRF-00019m-Sq; Fri, 13 Apr 2012 16:33:33 +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 1SIjRE-00017w-O5
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:32 +0000
Received: from [85.158.139.83:51689] by server-9.bemta-5.messagelabs.com id
	01/3B-09826-C55588F4; Fri, 13 Apr 2012 16:33:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334334803!23729823!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1394 invoked from network); 13 Apr 2012 16:33:30 -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 Apr 2012 16:33:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004X6-GO
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004YX-FH
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Message-Id: <E1SIjR4-0004YX-FH@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: provide STATE_AO_GC
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150058 -3600
# Node ID d196634484a9f86136704f973293925445961079
# Parent  8a88f6e209dbecfeb0426970540df22351f74fe4
libxl: provide STATE_AO_GC

Provide a convenience macro for use in ao callback functions, and
document that it should be used.

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


diff -r 8a88f6e209db -r d196634484a9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:18 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:18 2012 +0100
@@ -1266,9 +1266,10 @@ _hidden void libxl__egc_cleanup(libxl__e
  * - Note that during callback functions, two gcs are available:
  *    - The one in egc, whose lifetime is only this callback
  *    - The one in ao, whose lifetime is the asynchronous operation
- *   Usually callback function should use CONTAINER_OF
- *   to obtain its own structure, containing a pointer to the ao,
- *   and then use the gc from that ao.
+ *   Usually callback function should use CONTAINER_OF to obtain its
+ *   own state structure, containing a pointer to the ao.  It should
+ *   then obtain the ao and use the ao's gc; this is most easily done
+ *   using the convenience macro STATE_AO_GC.
  */
 
 #define AO_CREATE(ctx, domid, ao_how)                           \
@@ -1298,6 +1299,10 @@ _hidden void libxl__egc_cleanup(libxl__e
 #define AO_GC                                   \
     libxl__gc *const gc = &ao->gc
 
+#define STATE_AO_GC(op_ao)                      \
+    libxl__ao *const ao = (op_ao);              \
+    AO_GC
+
 
 /* All of these MUST be called with the ctx locked.
  * libxl__ao_inprogress MUST be called with the ctx locked exactly once. */

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

From xen-changelog-bounces@lists.xen.org Fri Apr 13 16:33:35 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 13 Apr 2012 16:33:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SIjRF-00019m-Sq; Fri, 13 Apr 2012 16:33:33 +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 1SIjRE-00017w-O5
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:32 +0000
Received: from [85.158.139.83:51689] by server-9.bemta-5.messagelabs.com id
	01/3B-09826-C55588F4; Fri, 13 Apr 2012 16:33:32 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334334803!23729823!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1394 invoked from network); 13 Apr 2012 16:33:30 -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 Apr 2012 16:33:30 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004X6-GO
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SIjR4-0004YX-FH
	for xen-changelog@lists.xensource.com; Fri, 13 Apr 2012 16:33:22 +0000
Message-Id: <E1SIjR4-0004YX-FH@xenbits.xen.org>
Date: Fri, 13 Apr 2012 16:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: provide STATE_AO_GC
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <ian.jackson@eu.citrix.com>
# Date 1334150058 -3600
# Node ID d196634484a9f86136704f973293925445961079
# Parent  8a88f6e209dbecfeb0426970540df22351f74fe4
libxl: provide STATE_AO_GC

Provide a convenience macro for use in ao callback functions, and
document that it should be used.

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


diff -r 8a88f6e209db -r d196634484a9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:18 2012 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Apr 11 14:14:18 2012 +0100
@@ -1266,9 +1266,10 @@ _hidden void libxl__egc_cleanup(libxl__e
  * - Note that during callback functions, two gcs are available:
  *    - The one in egc, whose lifetime is only this callback
  *    - The one in ao, whose lifetime is the asynchronous operation
- *   Usually callback function should use CONTAINER_OF
- *   to obtain its own structure, containing a pointer to the ao,
- *   and then use the gc from that ao.
+ *   Usually callback function should use CONTAINER_OF to obtain its
+ *   own state structure, containing a pointer to the ao.  It should
+ *   then obtain the ao and use the ao's gc; this is most easily done
+ *   using the convenience macro STATE_AO_GC.
  */
 
 #define AO_CREATE(ctx, domid, ao_how)                           \
@@ -1298,6 +1299,10 @@ _hidden void libxl__egc_cleanup(libxl__e
 #define AO_GC                                   \
     libxl__gc *const gc = &ao->gc
 
+#define STATE_AO_GC(op_ao)                      \
+    libxl__ao *const ao = (op_ao);              \
+    AO_GC
+
 
 /* All of these MUST be called with the ctx locked.
  * libxl__ao_inprogress MUST be called with the ctx locked exactly once. */

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

From xen-changelog-bounces@lists.xen.org Sat Apr 14 20:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Apr 2012 20:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SJ9pL-0006cM-NP; Sat, 14 Apr 2012 20:44:11 +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 1SJ9pL-0006cG-5K
	for xen-changelog@lists.xensource.com; Sat, 14 Apr 2012 20:44:11 +0000
Received: from [193.109.254.147:58973] by server-2.bemta-14.messagelabs.com id
	16/BD-19409-A91E98F4; Sat, 14 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1334436248!4622358!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32393 invoked from network); 14 Apr 2012 20:44:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SJ9pH-000832-Mf
	for xen-changelog@lists.xensource.com; Sat, 14 Apr 2012 20:44:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SJ9pH-0001R8-89
	for xen-changelog@lists.xensource.com; Sat, 14 Apr 2012 20:44:07 +0000
Message-Id: <E1SJ9pH-0001R8-89@xenbits.xen.org>
Date: Sat, 14 Apr 2012 20:44:06 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Revert c/s 25150:b490ef93bad7
	tools/libfsimage: include Rules.mk first
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334333581 -3600
# Node ID 6b72eb3b40cf2b3d5a6c75d68fa7093c57fc0d1f
# Parent  c6bde42c8845439183336602a78bc07869f3651b
tools: Revert c/s 25150:b490ef93bad7 tools/libfsimage: include Rules.mk first

tools/libfsimage/Rules.mk relies on having certain variables set already; if
they're not set, the definitions dont' work right.  The result was a bunch
of empty files and pygrub failing with an uninformative error message.

It's likely that this didn't cause anyone problems becasue changing the
Makefiles didn't cause a re-build; building from a fresh repo results in
completely empty filesystem plugin binaries.

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


diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = ext2fs-lib.c
 
@@ -12,3 +11,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/ext2fs/Makefile
--- a/tools/libfsimage/ext2fs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/ext2fs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ext2fs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/fat/Makefile
--- a/tools/libfsimage/fat/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/fat/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_fat.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/iso9660/Makefile
--- a/tools/libfsimage/iso9660/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/iso9660/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_iso9660.c
 
@@ -12,3 +11,5 @@ all: fs-all
 install: fs-install
 
 fsys_iso9660.c: iso9660.h
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/reiserfs/Makefile
--- a/tools/libfsimage/reiserfs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/reiserfs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_reiserfs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/ufs/Makefile
--- a/tools/libfsimage/ufs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/ufs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ufs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/xfs/Makefile
--- a/tools/libfsimage/xfs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/xfs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_xfs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/zfs/Makefile
--- a/tools/libfsimage/zfs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/zfs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -23,7 +23,6 @@
 #
 
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 CFLAGS += -DFSYS_ZFS -DFSIMAGE -I$(XEN_ROOT)/tools/libfsimage/zfs
 LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
@@ -35,3 +34,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk

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

From xen-changelog-bounces@lists.xen.org Sat Apr 14 20:44:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 14 Apr 2012 20:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SJ9pL-0006cM-NP; Sat, 14 Apr 2012 20:44:11 +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 1SJ9pL-0006cG-5K
	for xen-changelog@lists.xensource.com; Sat, 14 Apr 2012 20:44:11 +0000
Received: from [193.109.254.147:58973] by server-2.bemta-14.messagelabs.com id
	16/BD-19409-A91E98F4; Sat, 14 Apr 2012 20:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1334436248!4622358!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32393 invoked from network); 14 Apr 2012 20:44:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Apr 2012 20:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SJ9pH-000832-Mf
	for xen-changelog@lists.xensource.com; Sat, 14 Apr 2012 20:44:07 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SJ9pH-0001R8-89
	for xen-changelog@lists.xensource.com; Sat, 14 Apr 2012 20:44:07 +0000
Message-Id: <E1SJ9pH-0001R8-89@xenbits.xen.org>
Date: Sat, 14 Apr 2012 20:44:06 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Revert c/s 25150:b490ef93bad7
	tools/libfsimage: include Rules.mk first
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1334333581 -3600
# Node ID 6b72eb3b40cf2b3d5a6c75d68fa7093c57fc0d1f
# Parent  c6bde42c8845439183336602a78bc07869f3651b
tools: Revert c/s 25150:b490ef93bad7 tools/libfsimage: include Rules.mk first

tools/libfsimage/Rules.mk relies on having certain variables set already; if
they're not set, the definitions dont' work right.  The result was a bunch
of empty files and pygrub failing with an uninformative error message.

It's likely that this didn't cause anyone problems becasue changing the
Makefiles didn't cause a re-build; building from a fresh repo results in
completely empty filesystem plugin binaries.

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


diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = ext2fs-lib.c
 
@@ -12,3 +11,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/ext2fs/Makefile
--- a/tools/libfsimage/ext2fs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/ext2fs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ext2fs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/fat/Makefile
--- a/tools/libfsimage/fat/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/fat/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_fat.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/iso9660/Makefile
--- a/tools/libfsimage/iso9660/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/iso9660/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_iso9660.c
 
@@ -12,3 +11,5 @@ all: fs-all
 install: fs-install
 
 fsys_iso9660.c: iso9660.h
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/reiserfs/Makefile
--- a/tools/libfsimage/reiserfs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/reiserfs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_reiserfs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/ufs/Makefile
--- a/tools/libfsimage/ufs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/ufs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_ufs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/xfs/Makefile
--- a/tools/libfsimage/xfs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/xfs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -1,5 +1,4 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 LIB_SRCS-y = fsys_xfs.c
 
@@ -10,3 +9,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
diff -r c6bde42c8845 -r 6b72eb3b40cf tools/libfsimage/zfs/Makefile
--- a/tools/libfsimage/zfs/Makefile	Thu Apr 12 14:01:27 2012 +0100
+++ b/tools/libfsimage/zfs/Makefile	Fri Apr 13 17:13:01 2012 +0100
@@ -23,7 +23,6 @@
 #
 
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 CFLAGS += -DFSYS_ZFS -DFSIMAGE -I$(XEN_ROOT)/tools/libfsimage/zfs
 LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
@@ -35,3 +34,5 @@ all: fs-all
 
 .PHONY: install
 install: fs-install
+
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk

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

From xen-changelog-bounces@lists.xen.org Mon Apr 16 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Apr 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 1SJvaf-0000ao-MR; Mon, 16 Apr 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 1SJvae-0000aj-Oz
	for xen-changelog@lists.xensource.com; Mon, 16 Apr 2012 23:44:12 +0000
Received: from [85.158.138.51:41448] by server-7.bemta-3.messagelabs.com id
	87/3E-03078-BCEAC8F4; Mon, 16 Apr 2012 23:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1334619850!22230492!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5422 invoked from network); 16 Apr 2012 23:44: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;
	16 Apr 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 1SJvab-0003m7-CU
	for xen-changelog@lists.xensource.com; Mon, 16 Apr 2012 23:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SJvaa-0004aV-Uh
	for xen-changelog@lists.xensource.com; Mon, 16 Apr 2012 23:44:09 +0000
Message-Id: <E1SJvaa-0004aV-Uh@xenbits.xen.org>
Date: Mon, 16 Apr 2012 23:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/cpuidle: do not flush cache
	unless entering C3
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1334574328 -7200
# Node ID a06e6cdeafe34964721df3ddb32774d4634fd7ad
# Parent  6b72eb3b40cf2b3d5a6c75d68fa7093c57fc0d1f
x86/cpuidle: do not flush cache unless entering C3

Nor is there a need to disable bus master arbitration in that case.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Modified-by: Zhang, Yang Z <yang.z.zhang@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 6b72eb3b40cf -r a06e6cdeafe3 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Fri Apr 13 17:13:01 2012 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Mon Apr 16 13:05:28 2012 +0200
@@ -493,7 +493,9 @@ static void acpi_processor_idle(void)
          * not set. In that case we cannot do much, we enter C3
          * without doing anything.
          */
-        if ( power->flags.bm_check && power->flags.bm_control )
+        if ( cx->type != ACPI_STATE_C3 )
+            /* nothing to be done here */;
+        else if ( power->flags.bm_check && power->flags.bm_control )
         {
             spin_lock(&c3_cpu_status.lock);
             if ( ++c3_cpu_status.count == num_online_cpus() )
@@ -515,7 +517,8 @@ static void acpi_processor_idle(void)
         /* Invoke C3 */
         acpi_idle_do_entry(cx);
 
-        if ( power->flags.bm_check && power->flags.bm_control )
+        if ( (cx->type == ACPI_STATE_C3) &&
+             power->flags.bm_check && power->flags.bm_control )
         {
             /* Enable bus master arbitration */
             spin_lock(&c3_cpu_status.lock);

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

From xen-changelog-bounces@lists.xen.org Mon Apr 16 23:44:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Apr 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 1SJvaf-0000ao-MR; Mon, 16 Apr 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 1SJvae-0000aj-Oz
	for xen-changelog@lists.xensource.com; Mon, 16 Apr 2012 23:44:12 +0000
Received: from [85.158.138.51:41448] by server-7.bemta-3.messagelabs.com id
	87/3E-03078-BCEAC8F4; Mon, 16 Apr 2012 23:44:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1334619850!22230492!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5422 invoked from network); 16 Apr 2012 23:44: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;
	16 Apr 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 1SJvab-0003m7-CU
	for xen-changelog@lists.xensource.com; Mon, 16 Apr 2012 23:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SJvaa-0004aV-Uh
	for xen-changelog@lists.xensource.com; Mon, 16 Apr 2012 23:44:09 +0000
Message-Id: <E1SJvaa-0004aV-Uh@xenbits.xen.org>
Date: Mon, 16 Apr 2012 23:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/cpuidle: do not flush cache
	unless entering C3
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1334574328 -7200
# Node ID a06e6cdeafe34964721df3ddb32774d4634fd7ad
# Parent  6b72eb3b40cf2b3d5a6c75d68fa7093c57fc0d1f
x86/cpuidle: do not flush cache unless entering C3

Nor is there a need to disable bus master arbitration in that case.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Modified-by: Zhang, Yang Z <yang.z.zhang@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 6b72eb3b40cf -r a06e6cdeafe3 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Fri Apr 13 17:13:01 2012 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Mon Apr 16 13:05:28 2012 +0200
@@ -493,7 +493,9 @@ static void acpi_processor_idle(void)
          * not set. In that case we cannot do much, we enter C3
          * without doing anything.
          */
-        if ( power->flags.bm_check && power->flags.bm_control )
+        if ( cx->type != ACPI_STATE_C3 )
+            /* nothing to be done here */;
+        else if ( power->flags.bm_check && power->flags.bm_control )
         {
             spin_lock(&c3_cpu_status.lock);
             if ( ++c3_cpu_status.count == num_online_cpus() )
@@ -515,7 +517,8 @@ static void acpi_processor_idle(void)
         /* Invoke C3 */
         acpi_idle_do_entry(cx);
 
-        if ( power->flags.bm_check && power->flags.bm_control )
+        if ( (cx->type == ACPI_STATE_C3) &&
+             power->flags.bm_check && power->flags.bm_control )
         {
             /* Enable bus master arbitration */
             spin_lock(&c3_cpu_status.lock);

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKIey-0004cI-DT; Wed, 18 Apr 2012 00:22: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 1SKIew-0004c6-KQ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:10 +0000
Received: from [85.158.143.35:36451] by server-3.bemta-4.messagelabs.com id
	5D/E4-05853-1390E8F4; Wed, 18 Apr 2012 00:22:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1334708528!16582461!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3578 invoked from network); 18 Apr 2012 00:22:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 00:22:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIeu-0006AZ-48
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIet-0006el-SA
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:07 +0000
Message-Id: <E1SKIet-0006el-SA@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:22:07 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86_emulate: Do not push an error
	code onto a #UD exception stack
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1334648159 -3600
# Node ID ff02605dd3e0db0b97f22ec11d1fcc7a849c2c9e
# Parent  cbe8948799bfb81624c29675752aaaad390381f9
x86_emulate: Do not push an error code onto a #UD exception stack

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25099:4bd752a4cdf3
xen-unstable date:        Fri Mar 23 20:51:48 2012 +0000

x86_emulate: raise #UD rather than #GP on invalid use of LOCK prefix

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25098:2e45b26bc412
xen-unstable date:        Fri Mar 23 20:45:16 2012 +0000
---


diff -r cbe8948799bf -r ff02605dd3e0 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Fri Mar 23 13:58:58 2012 +0000
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:35:59 2012 +0100
@@ -1309,7 +1309,7 @@ x86_emulate(
     }
 
     /* Lock prefix is allowed only on RMW instructions. */
-    generate_exception_if((d & Mov) && lock_prefix, EXC_GP, 0);
+    generate_exception_if((d & Mov) && lock_prefix, EXC_UD, -1);
 
     /* ModRM and SIB bytes. */
     if ( d & ModRM )
@@ -1528,12 +1528,12 @@ x86_emulate(
             lock_prefix &&
             ((b < 0x20) || (b > 0x23)) && /* MOV CRn/DRn */
             (b != 0xc7),                  /* CMPXCHG{8,16}B */
-            EXC_GP, 0);
+            EXC_UD, -1);
         dst.type = OP_NONE;
         break;
 
     case DstReg:
-        generate_exception_if(lock_prefix, EXC_GP, 0);
+        generate_exception_if(lock_prefix, EXC_UD, -1);
         dst.type = OP_REG;
         if ( d & ByteOp )
         {
@@ -1589,7 +1589,7 @@ x86_emulate(
         dst = ea;
         if ( dst.type == OP_REG )
         {
-            generate_exception_if(lock_prefix, EXC_GP, 0);
+            generate_exception_if(lock_prefix, EXC_UD, -1);
             switch ( dst.bytes )
             {
             case 1: dst.val = *(uint8_t  *)dst.reg; break;
@@ -3598,14 +3598,14 @@ x86_emulate(
         struct segment_register cs = { 0 }, ss = { 0 };
         int rc;
 
-        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, 0);
-        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, 0);
+        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, -1);
+        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1);
 
         /* Inject #UD if syscall/sysret are disabled. */
         fail_if(ops->read_msr == NULL);
         if ( (rc = ops->read_msr(MSR_EFER, &msr_content, ctxt)) != 0 )
             goto done;
-        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, 0);
+        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, -1);
 
         if ( (rc = ops->read_msr(MSR_STAR, &msr_content, ctxt)) != 0 )
             goto done;

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKIey-0004cI-DT; Wed, 18 Apr 2012 00:22: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 1SKIew-0004c6-KQ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:10 +0000
Received: from [85.158.143.35:36451] by server-3.bemta-4.messagelabs.com id
	5D/E4-05853-1390E8F4; Wed, 18 Apr 2012 00:22:09 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1334708528!16582461!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3578 invoked from network); 18 Apr 2012 00:22:09 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 00:22:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIeu-0006AZ-48
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIet-0006el-SA
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:07 +0000
Message-Id: <E1SKIet-0006el-SA@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:22:07 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86_emulate: Do not push an error
	code onto a #UD exception stack
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1334648159 -3600
# Node ID ff02605dd3e0db0b97f22ec11d1fcc7a849c2c9e
# Parent  cbe8948799bfb81624c29675752aaaad390381f9
x86_emulate: Do not push an error code onto a #UD exception stack

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25099:4bd752a4cdf3
xen-unstable date:        Fri Mar 23 20:51:48 2012 +0000

x86_emulate: raise #UD rather than #GP on invalid use of LOCK prefix

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25098:2e45b26bc412
xen-unstable date:        Fri Mar 23 20:45:16 2012 +0000
---


diff -r cbe8948799bf -r ff02605dd3e0 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Fri Mar 23 13:58:58 2012 +0000
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:35:59 2012 +0100
@@ -1309,7 +1309,7 @@ x86_emulate(
     }
 
     /* Lock prefix is allowed only on RMW instructions. */
-    generate_exception_if((d & Mov) && lock_prefix, EXC_GP, 0);
+    generate_exception_if((d & Mov) && lock_prefix, EXC_UD, -1);
 
     /* ModRM and SIB bytes. */
     if ( d & ModRM )
@@ -1528,12 +1528,12 @@ x86_emulate(
             lock_prefix &&
             ((b < 0x20) || (b > 0x23)) && /* MOV CRn/DRn */
             (b != 0xc7),                  /* CMPXCHG{8,16}B */
-            EXC_GP, 0);
+            EXC_UD, -1);
         dst.type = OP_NONE;
         break;
 
     case DstReg:
-        generate_exception_if(lock_prefix, EXC_GP, 0);
+        generate_exception_if(lock_prefix, EXC_UD, -1);
         dst.type = OP_REG;
         if ( d & ByteOp )
         {
@@ -1589,7 +1589,7 @@ x86_emulate(
         dst = ea;
         if ( dst.type == OP_REG )
         {
-            generate_exception_if(lock_prefix, EXC_GP, 0);
+            generate_exception_if(lock_prefix, EXC_UD, -1);
             switch ( dst.bytes )
             {
             case 1: dst.val = *(uint8_t  *)dst.reg; break;
@@ -3598,14 +3598,14 @@ x86_emulate(
         struct segment_register cs = { 0 }, ss = { 0 };
         int rc;
 
-        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, 0);
-        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, 0);
+        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, -1);
+        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1);
 
         /* Inject #UD if syscall/sysret are disabled. */
         fail_if(ops->read_msr == NULL);
         if ( (rc = ops->read_msr(MSR_EFER, &msr_content, ctxt)) != 0 )
             goto done;
-        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, 0);
+        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, -1);
 
         if ( (rc = ops->read_msr(MSR_STAR, &msr_content, ctxt)) != 0 )
             goto done;

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKIey-0004cN-GG; Wed, 18 Apr 2012 00:22: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 1SKIex-0004c6-3f
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:11 +0000
Received: from [85.158.143.35:44039] by server-3.bemta-4.messagelabs.com id
	1E/E4-05853-2390E8F4; Wed, 18 Apr 2012 00:22:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1334708528!12898470!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24589 invoked from network); 18 Apr 2012 00:22:09 -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;
	18 Apr 2012 00:22:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIeu-0006Ac-GD
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIeu-0006f0-Ah
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:08 +0000
Message-Id: <E1SKIeu-0006f0-Ah@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:22:07 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86/hpet: disable before reboot
	or kexec
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334648267 -3600
# Node ID 4e446ac2c6de1df2586046b7d103b8867e8f591f
# Parent  ff02605dd3e0db0b97f22ec11d1fcc7a849c2c9e
x86/hpet: disable before reboot or kexec

Linux up to now is not smart enough to properly clear the HPET when it
boots, which is particularly a problem when a kdump attempt from
running under Xen is being made. Linux itself added code to work
around
this to its shutdown paths quite some time ago, so let's do something
similar in Xen: Save the configuration register settings during boot,
and restore them during shutdown. This should cover the majority of
cases where the secondary kernel might not come up because timer
interrupts don't work.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25101:f06ff3dfde08
xen-unstable date:        Tue Mar 27 15:20:23 2012 +0200
---


diff -r ff02605dd3e0 -r 4e446ac2c6de xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/arch/x86/crash.c	Tue Apr 17 08:37:47 2012 +0100
@@ -25,6 +25,7 @@
 #include <public/xen.h>
 #include <asm/shared.h>
 #include <asm/hvm/support.h>
+#include <asm/hpet.h>
 
 static atomic_t waiting_for_crash_ipi;
 static unsigned int crashing_cpu;
@@ -77,6 +78,7 @@ static void nmi_shootdown_cpus(void)
 
     __stop_this_cpu();
     disable_IO_APIC();
+    hpet_disable();
 
     local_irq_enable();
 }
diff -r ff02605dd3e0 -r 4e446ac2c6de xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/arch/x86/hpet.c	Tue Apr 17 08:37:47 2012 +0100
@@ -722,12 +722,14 @@ int hpet_legacy_irq_tick(void)
     return 1;
 }
 
+static u32 *hpet_boot_cfg;
+
 u64 hpet_setup(void)
 {
     static u64 hpet_rate;
     static u32 system_reset_latch;
     u32 hpet_id, hpet_period, cfg;
-    int i;
+    unsigned int i, last;
 
     if ( system_reset_latch == system_reset_counter )
         return hpet_rate;
@@ -753,13 +755,20 @@ u64 hpet_setup(void)
         return 0;
     }
 
+    last = (hpet_id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT;
+    hpet_boot_cfg = xmalloc_array(u32, 2 + last);
+
     cfg = hpet_read32(HPET_CFG);
+    if ( hpet_boot_cfg )
+        *hpet_boot_cfg = cfg;
     cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY);
     hpet_write32(cfg, HPET_CFG);
 
-    for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ )
+    for ( i = 0; i <= last; ++i )
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
+        if ( hpet_boot_cfg )
+            hpet_boot_cfg[i + 1] = cfg;
         cfg &= ~HPET_TN_ENABLE;
         hpet_write32(cfg, HPET_Tn_CFG(i));
     }
@@ -773,3 +782,21 @@ u64 hpet_setup(void)
 
     return hpet_rate;
 }
+
+void hpet_disable(void)
+{
+    unsigned int i;
+    u32 id;
+
+    if ( !hpet_boot_cfg )
+        return;
+
+    hpet_write32(*hpet_boot_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    id = hpet_read32(HPET_ID);
+    for ( i = 0; i <= ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT); ++i )
+        hpet_write32(hpet_boot_cfg[i + 1], HPET_Tn_CFG(i));
+
+    if ( *hpet_boot_cfg & HPET_CFG_ENABLE )
+        hpet_write32(*hpet_boot_cfg, HPET_CFG);
+}
diff -r ff02605dd3e0 -r 4e446ac2c6de xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/arch/x86/smp.c	Tue Apr 17 08:37:47 2012 +0100
@@ -19,6 +19,7 @@
 #include <asm/mc146818rtc.h>
 #include <asm/flushtlb.h>
 #include <asm/hardirq.h>
+#include <asm/hpet.h>
 #include <asm/hvm/support.h>
 #include <mach_apic.h>
 
@@ -362,6 +363,7 @@ void smp_send_stop(void)
     local_irq_disable();
     __stop_this_cpu();
     disable_IO_APIC();
+    hpet_disable();
     local_irq_enable();
 }
 
diff -r ff02605dd3e0 -r 4e446ac2c6de xen/include/asm-x86/hpet.h
--- a/xen/include/asm-x86/hpet.h	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/include/asm-x86/hpet.h	Tue Apr 17 08:37:47 2012 +0100
@@ -67,6 +67,11 @@ extern unsigned long hpet_address;
 u64 hpet_setup(void);
 
 /*
+ * Disable HPET hardware: restore it to boot time state.
+ */
+void hpet_disable(void);
+
+/*
  * Callback from legacy timer (PIT channel 0) IRQ handler.
  * Returns 1 if tick originated from HPET; else 0.
  */

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:22:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKIey-0004cN-GG; Wed, 18 Apr 2012 00:22: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 1SKIex-0004c6-3f
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:11 +0000
Received: from [85.158.143.35:44039] by server-3.bemta-4.messagelabs.com id
	1E/E4-05853-2390E8F4; Wed, 18 Apr 2012 00:22:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1334708528!12898470!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24589 invoked from network); 18 Apr 2012 00:22:09 -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;
	18 Apr 2012 00:22:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIeu-0006Ac-GD
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKIeu-0006f0-Ah
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:22:08 +0000
Message-Id: <E1SKIeu-0006f0-Ah@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:22:07 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86/hpet: disable before reboot
	or kexec
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334648267 -3600
# Node ID 4e446ac2c6de1df2586046b7d103b8867e8f591f
# Parent  ff02605dd3e0db0b97f22ec11d1fcc7a849c2c9e
x86/hpet: disable before reboot or kexec

Linux up to now is not smart enough to properly clear the HPET when it
boots, which is particularly a problem when a kdump attempt from
running under Xen is being made. Linux itself added code to work
around
this to its shutdown paths quite some time ago, so let's do something
similar in Xen: Save the configuration register settings during boot,
and restore them during shutdown. This should cover the majority of
cases where the secondary kernel might not come up because timer
interrupts don't work.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25101:f06ff3dfde08
xen-unstable date:        Tue Mar 27 15:20:23 2012 +0200
---


diff -r ff02605dd3e0 -r 4e446ac2c6de xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/arch/x86/crash.c	Tue Apr 17 08:37:47 2012 +0100
@@ -25,6 +25,7 @@
 #include <public/xen.h>
 #include <asm/shared.h>
 #include <asm/hvm/support.h>
+#include <asm/hpet.h>
 
 static atomic_t waiting_for_crash_ipi;
 static unsigned int crashing_cpu;
@@ -77,6 +78,7 @@ static void nmi_shootdown_cpus(void)
 
     __stop_this_cpu();
     disable_IO_APIC();
+    hpet_disable();
 
     local_irq_enable();
 }
diff -r ff02605dd3e0 -r 4e446ac2c6de xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/arch/x86/hpet.c	Tue Apr 17 08:37:47 2012 +0100
@@ -722,12 +722,14 @@ int hpet_legacy_irq_tick(void)
     return 1;
 }
 
+static u32 *hpet_boot_cfg;
+
 u64 hpet_setup(void)
 {
     static u64 hpet_rate;
     static u32 system_reset_latch;
     u32 hpet_id, hpet_period, cfg;
-    int i;
+    unsigned int i, last;
 
     if ( system_reset_latch == system_reset_counter )
         return hpet_rate;
@@ -753,13 +755,20 @@ u64 hpet_setup(void)
         return 0;
     }
 
+    last = (hpet_id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT;
+    hpet_boot_cfg = xmalloc_array(u32, 2 + last);
+
     cfg = hpet_read32(HPET_CFG);
+    if ( hpet_boot_cfg )
+        *hpet_boot_cfg = cfg;
     cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY);
     hpet_write32(cfg, HPET_CFG);
 
-    for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ )
+    for ( i = 0; i <= last; ++i )
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
+        if ( hpet_boot_cfg )
+            hpet_boot_cfg[i + 1] = cfg;
         cfg &= ~HPET_TN_ENABLE;
         hpet_write32(cfg, HPET_Tn_CFG(i));
     }
@@ -773,3 +782,21 @@ u64 hpet_setup(void)
 
     return hpet_rate;
 }
+
+void hpet_disable(void)
+{
+    unsigned int i;
+    u32 id;
+
+    if ( !hpet_boot_cfg )
+        return;
+
+    hpet_write32(*hpet_boot_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    id = hpet_read32(HPET_ID);
+    for ( i = 0; i <= ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT); ++i )
+        hpet_write32(hpet_boot_cfg[i + 1], HPET_Tn_CFG(i));
+
+    if ( *hpet_boot_cfg & HPET_CFG_ENABLE )
+        hpet_write32(*hpet_boot_cfg, HPET_CFG);
+}
diff -r ff02605dd3e0 -r 4e446ac2c6de xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/arch/x86/smp.c	Tue Apr 17 08:37:47 2012 +0100
@@ -19,6 +19,7 @@
 #include <asm/mc146818rtc.h>
 #include <asm/flushtlb.h>
 #include <asm/hardirq.h>
+#include <asm/hpet.h>
 #include <asm/hvm/support.h>
 #include <mach_apic.h>
 
@@ -362,6 +363,7 @@ void smp_send_stop(void)
     local_irq_disable();
     __stop_this_cpu();
     disable_IO_APIC();
+    hpet_disable();
     local_irq_enable();
 }
 
diff -r ff02605dd3e0 -r 4e446ac2c6de xen/include/asm-x86/hpet.h
--- a/xen/include/asm-x86/hpet.h	Tue Apr 17 08:35:59 2012 +0100
+++ b/xen/include/asm-x86/hpet.h	Tue Apr 17 08:37:47 2012 +0100
@@ -67,6 +67,11 @@ extern unsigned long hpet_address;
 u64 hpet_setup(void);
 
 /*
+ * Disable HPET hardware: restore it to boot time state.
+ */
+void hpet_disable(void);
+
+/*
  * Callback from legacy timer (PIT channel 0) IRQ handler.
  * Returns 1 if tick originated from HPET; else 0.
  */

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKJAw-0005By-7F; Wed, 18 Apr 2012 00:55: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 1SKJAu-0005Be-DZ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:12 +0000
Received: from [85.158.143.99:64540] by server-3.bemta-4.messagelabs.com id
	8B/91-05853-FE01E8F4; Wed, 18 Apr 2012 00:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1334710509!17718153!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10645 invoked from network); 18 Apr 2012 00:55:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 00: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 1SKJAq-0006VR-Pr
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKJAq-0007QC-Gc
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:08 +0000
Message-Id: <E1SKJAq-0007QC-Gc@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:55:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] XENPF_set_processor_pminfo
	XEN_PM_CX overflows states array
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334648013 -3600
# Node ID 00881b29bfe2b538775c082dfea6105a51f07d49
# Parent  4ad262a48a715a022582567fa7a996389cb37e6c
XENPF_set_processor_pminfo XEN_PM_CX overflows states array

Calling XENPF_set_processor_pminfo with XEN_PM_CX could cause states
array in "struct acpi_processor_power" to exceed its limit.

The array used to be reset (by function cpuidle_init_cpu()) for each
hypercall. The patch puts it back that way and adds an assertion to
make it clear in case that happens again.

Signed-off-by: Eric Chanudet <eric.chanudet@eu.citrix.com>

- convert assertion to printk() & bail
- eliminate struct acpi_processor_cx's valid member (not read anymore)
- further adjustments to one-time-only vs each-time operations in
  cpuidle_init_cpu()
- don't use ACPI_STATE_Cn as array index anymore

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24996:396801f25e92
xen-unstable date:        Thu Mar 08 17:04:32 2012 +0100
---


diff -r 4ad262a48a71 -r 00881b29bfe2 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Thu Apr 12 09:13:14 2012 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Apr 17 08:33:33 2012 +0100
@@ -69,10 +69,8 @@ static void lapic_timer_nop(void) { }
 static void (*lapic_timer_off)(void);
 static void (*lapic_timer_on)(void);
 
-static uint64_t (*get_tick)(void);
-static uint64_t (*ticks_elapsed)(uint64_t t1, uint64_t t2);
-static uint64_t (*tick_to_ns)(uint64_t ticks);
-static uint64_t (*ns_to_tick)(uint64_t ticks);
+static uint64_t (*__read_mostly tick_to_ns)(uint64_t) = acpi_pm_tick_to_ns;
+static uint64_t (*__read_mostly ns_to_tick)(uint64_t) = ns_to_acpi_pm_tick;
 
 extern void (*pm_idle) (void);
 extern void (*dead_idle) (void);
@@ -222,6 +220,10 @@ static uint64_t acpi_pm_ticks_elapsed(ui
         return ((0xFFFFFFFF - t1) + t2 +1);
 }
 
+static uint64_t (*__read_mostly get_tick)(void) = get_acpi_pm_tick;
+static uint64_t (*__read_mostly ticks_elapsed)(uint64_t, uint64_t)
+    = acpi_pm_ticks_elapsed;
+
 #define MWAIT_ECX_INTERRUPT_BREAK   (0x1)
 
 /*
@@ -607,7 +609,16 @@ static int cpuidle_init_cpu(int cpu)
     acpi_power = processor_powers[cpu];
     if ( !acpi_power )
     {
-        int i;
+        unsigned int i;
+
+        if ( cpu == 0 && boot_cpu_has(X86_FEATURE_NONSTOP_TSC) )
+        {
+            get_tick = get_stime_tick;
+            ticks_elapsed = stime_ticks_elapsed;
+            tick_to_ns = stime_tick_to_ns;
+            ns_to_tick = ns_to_stime_tick;
+        }
+
         acpi_power = xmalloc(struct acpi_processor_power);
         if ( !acpi_power )
             return -ENOMEM;
@@ -615,36 +626,15 @@ static int cpuidle_init_cpu(int cpu)
 
         for ( i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++ )
             acpi_power->states[i].idx = i;
-     
-        acpi_power->states[ACPI_STATE_C1].type = ACPI_STATE_C1;
-        acpi_power->states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_EM_HALT;
-     
-        acpi_power->states[ACPI_STATE_C0].valid = 1;
-        acpi_power->states[ACPI_STATE_C1].valid = 1;
-     
-        acpi_power->count = 2;
-        acpi_power->safe_state = &acpi_power->states[ACPI_STATE_C1];
+
         acpi_power->cpu = cpu;
         processor_powers[cpu] = acpi_power;
     }
 
-    if ( cpu == 0 )
-    {
-        if ( boot_cpu_has(X86_FEATURE_NONSTOP_TSC) )
-        {
-            get_tick = get_stime_tick;
-            ticks_elapsed = stime_ticks_elapsed;
-            tick_to_ns = stime_tick_to_ns;
-            ns_to_tick = ns_to_stime_tick;
-        }
-        else
-        {
-            get_tick = get_acpi_pm_tick;
-            ticks_elapsed = acpi_pm_ticks_elapsed;
-            tick_to_ns = acpi_pm_tick_to_ns;
-            ns_to_tick = ns_to_acpi_pm_tick;
-        }
-    }
+    acpi_power->count = 2;
+    acpi_power->states[1].type = ACPI_STATE_C1;
+    acpi_power->states[1].entry_method = ACPI_CSTATE_EM_HALT;
+    acpi_power->safe_state = &acpi_power->states[1];
 
     return 0;
 }
@@ -863,17 +853,25 @@ static void set_cx(
     if ( check_cx(acpi_power, xen_cx) != 0 )
         return;
 
-    if ( xen_cx->type == ACPI_STATE_C1 )
+    switch ( xen_cx->type )
+    {
+    case ACPI_STATE_C1:
         cx = &acpi_power->states[1];
-    else
-        cx = &acpi_power->states[acpi_power->count];
+        break;
+    default:
+        if ( acpi_power->count >= ACPI_PROCESSOR_MAX_POWER )
+        {
+    case ACPI_STATE_C0:
+            printk(XENLOG_WARNING "CPU%u: C%d data ignored\n",
+                   acpi_power->cpu, xen_cx->type);
+            return;
+        }
+        cx = &acpi_power->states[acpi_power->count++];
+        cx->type = xen_cx->type;
+        break;
+    }
 
-    if ( !cx->valid )
-        acpi_power->count++;
-
-    cx->valid    = 1;
-    cx->type     = xen_cx->type;
-    cx->address  = xen_cx->reg.address;
+    cx->address = xen_cx->reg.address;
 
     switch ( xen_cx->reg.space_id )
     {
diff -r 4ad262a48a71 -r 00881b29bfe2 xen/include/xen/cpuidle.h
--- a/xen/include/xen/cpuidle.h	Thu Apr 12 09:13:14 2012 +0100
+++ b/xen/include/xen/cpuidle.h	Tue Apr 17 08:33:33 2012 +0100
@@ -40,7 +40,6 @@
 struct acpi_processor_cx
 {
     u8 idx;
-    u8 valid;
     u8 type;
     u32 address;
     u8 entry_method; /* ACPI_CSTATE_EM_xxx */

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKJAw-0005By-7F; Wed, 18 Apr 2012 00:55: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 1SKJAu-0005Be-DZ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:12 +0000
Received: from [85.158.143.99:64540] by server-3.bemta-4.messagelabs.com id
	8B/91-05853-FE01E8F4; Wed, 18 Apr 2012 00:55:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1334710509!17718153!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10645 invoked from network); 18 Apr 2012 00:55:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 00: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 1SKJAq-0006VR-Pr
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKJAq-0007QC-Gc
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:08 +0000
Message-Id: <E1SKJAq-0007QC-Gc@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:55:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] XENPF_set_processor_pminfo
	XEN_PM_CX overflows states array
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334648013 -3600
# Node ID 00881b29bfe2b538775c082dfea6105a51f07d49
# Parent  4ad262a48a715a022582567fa7a996389cb37e6c
XENPF_set_processor_pminfo XEN_PM_CX overflows states array

Calling XENPF_set_processor_pminfo with XEN_PM_CX could cause states
array in "struct acpi_processor_power" to exceed its limit.

The array used to be reset (by function cpuidle_init_cpu()) for each
hypercall. The patch puts it back that way and adds an assertion to
make it clear in case that happens again.

Signed-off-by: Eric Chanudet <eric.chanudet@eu.citrix.com>

- convert assertion to printk() & bail
- eliminate struct acpi_processor_cx's valid member (not read anymore)
- further adjustments to one-time-only vs each-time operations in
  cpuidle_init_cpu()
- don't use ACPI_STATE_Cn as array index anymore

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24996:396801f25e92
xen-unstable date:        Thu Mar 08 17:04:32 2012 +0100
---


diff -r 4ad262a48a71 -r 00881b29bfe2 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Thu Apr 12 09:13:14 2012 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Apr 17 08:33:33 2012 +0100
@@ -69,10 +69,8 @@ static void lapic_timer_nop(void) { }
 static void (*lapic_timer_off)(void);
 static void (*lapic_timer_on)(void);
 
-static uint64_t (*get_tick)(void);
-static uint64_t (*ticks_elapsed)(uint64_t t1, uint64_t t2);
-static uint64_t (*tick_to_ns)(uint64_t ticks);
-static uint64_t (*ns_to_tick)(uint64_t ticks);
+static uint64_t (*__read_mostly tick_to_ns)(uint64_t) = acpi_pm_tick_to_ns;
+static uint64_t (*__read_mostly ns_to_tick)(uint64_t) = ns_to_acpi_pm_tick;
 
 extern void (*pm_idle) (void);
 extern void (*dead_idle) (void);
@@ -222,6 +220,10 @@ static uint64_t acpi_pm_ticks_elapsed(ui
         return ((0xFFFFFFFF - t1) + t2 +1);
 }
 
+static uint64_t (*__read_mostly get_tick)(void) = get_acpi_pm_tick;
+static uint64_t (*__read_mostly ticks_elapsed)(uint64_t, uint64_t)
+    = acpi_pm_ticks_elapsed;
+
 #define MWAIT_ECX_INTERRUPT_BREAK   (0x1)
 
 /*
@@ -607,7 +609,16 @@ static int cpuidle_init_cpu(int cpu)
     acpi_power = processor_powers[cpu];
     if ( !acpi_power )
     {
-        int i;
+        unsigned int i;
+
+        if ( cpu == 0 && boot_cpu_has(X86_FEATURE_NONSTOP_TSC) )
+        {
+            get_tick = get_stime_tick;
+            ticks_elapsed = stime_ticks_elapsed;
+            tick_to_ns = stime_tick_to_ns;
+            ns_to_tick = ns_to_stime_tick;
+        }
+
         acpi_power = xmalloc(struct acpi_processor_power);
         if ( !acpi_power )
             return -ENOMEM;
@@ -615,36 +626,15 @@ static int cpuidle_init_cpu(int cpu)
 
         for ( i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++ )
             acpi_power->states[i].idx = i;
-     
-        acpi_power->states[ACPI_STATE_C1].type = ACPI_STATE_C1;
-        acpi_power->states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_EM_HALT;
-     
-        acpi_power->states[ACPI_STATE_C0].valid = 1;
-        acpi_power->states[ACPI_STATE_C1].valid = 1;
-     
-        acpi_power->count = 2;
-        acpi_power->safe_state = &acpi_power->states[ACPI_STATE_C1];
+
         acpi_power->cpu = cpu;
         processor_powers[cpu] = acpi_power;
     }
 
-    if ( cpu == 0 )
-    {
-        if ( boot_cpu_has(X86_FEATURE_NONSTOP_TSC) )
-        {
-            get_tick = get_stime_tick;
-            ticks_elapsed = stime_ticks_elapsed;
-            tick_to_ns = stime_tick_to_ns;
-            ns_to_tick = ns_to_stime_tick;
-        }
-        else
-        {
-            get_tick = get_acpi_pm_tick;
-            ticks_elapsed = acpi_pm_ticks_elapsed;
-            tick_to_ns = acpi_pm_tick_to_ns;
-            ns_to_tick = ns_to_acpi_pm_tick;
-        }
-    }
+    acpi_power->count = 2;
+    acpi_power->states[1].type = ACPI_STATE_C1;
+    acpi_power->states[1].entry_method = ACPI_CSTATE_EM_HALT;
+    acpi_power->safe_state = &acpi_power->states[1];
 
     return 0;
 }
@@ -863,17 +853,25 @@ static void set_cx(
     if ( check_cx(acpi_power, xen_cx) != 0 )
         return;
 
-    if ( xen_cx->type == ACPI_STATE_C1 )
+    switch ( xen_cx->type )
+    {
+    case ACPI_STATE_C1:
         cx = &acpi_power->states[1];
-    else
-        cx = &acpi_power->states[acpi_power->count];
+        break;
+    default:
+        if ( acpi_power->count >= ACPI_PROCESSOR_MAX_POWER )
+        {
+    case ACPI_STATE_C0:
+            printk(XENLOG_WARNING "CPU%u: C%d data ignored\n",
+                   acpi_power->cpu, xen_cx->type);
+            return;
+        }
+        cx = &acpi_power->states[acpi_power->count++];
+        cx->type = xen_cx->type;
+        break;
+    }
 
-    if ( !cx->valid )
-        acpi_power->count++;
-
-    cx->valid    = 1;
-    cx->type     = xen_cx->type;
-    cx->address  = xen_cx->reg.address;
+    cx->address = xen_cx->reg.address;
 
     switch ( xen_cx->reg.space_id )
     {
diff -r 4ad262a48a71 -r 00881b29bfe2 xen/include/xen/cpuidle.h
--- a/xen/include/xen/cpuidle.h	Thu Apr 12 09:13:14 2012 +0100
+++ b/xen/include/xen/cpuidle.h	Tue Apr 17 08:33:33 2012 +0100
@@ -40,7 +40,6 @@
 struct acpi_processor_cx
 {
     u8 idx;
-    u8 valid;
     u8 type;
     u32 address;
     u8 entry_method; /* ACPI_CSTATE_EM_xxx */

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKJAw-0005C8-C8; Wed, 18 Apr 2012 00:55: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 1SKJAv-0005Bg-31
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:13 +0000
Received: from [85.158.138.51:46459] by server-5.bemta-3.messagelabs.com id
	F1/0B-17113-0F01E8F4; Wed, 18 Apr 2012 00:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1334710510!22413627!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6411 invoked from network); 18 Apr 2012 00:55: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;
	18 Apr 2012 00: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 1SKJAr-0006VU-Ap
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKJAr-0007QR-2j
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Message-Id: <E1SKJAr-0007QR-2j@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:55:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86_emulate: Do not push an error
	code onto a #UD exception stack
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1334648068 -3600
# Node ID 182633356cd4f285fb0e4b777f76a286eca9543a
# Parent  00881b29bfe2b538775c082dfea6105a51f07d49
x86_emulate: Do not push an error code onto a #UD exception stack

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25099:4bd752a4cdf3
xen-unstable date:        Fri Mar 23 20:51:48 2012 +0000

x86_emulate: raise #UD rather than #GP on invalid use of LOCK prefix

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25098:2e45b26bc412
xen-unstable date:        Fri Mar 23 20:45:16 2012 +0000
---


diff -r 00881b29bfe2 -r 182633356cd4 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:33:33 2012 +0100
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:34:28 2012 +0100
@@ -1309,7 +1309,7 @@ x86_emulate(
     }
 
     /* Lock prefix is allowed only on RMW instructions. */
-    generate_exception_if((d & Mov) && lock_prefix, EXC_GP, 0);
+    generate_exception_if((d & Mov) && lock_prefix, EXC_UD, -1);
 
     /* ModRM and SIB bytes. */
     if ( d & ModRM )
@@ -1528,12 +1528,12 @@ x86_emulate(
             lock_prefix &&
             ((b < 0x20) || (b > 0x23)) && /* MOV CRn/DRn */
             (b != 0xc7),                  /* CMPXCHG{8,16}B */
-            EXC_GP, 0);
+            EXC_UD, -1);
         dst.type = OP_NONE;
         break;
 
     case DstReg:
-        generate_exception_if(lock_prefix, EXC_GP, 0);
+        generate_exception_if(lock_prefix, EXC_UD, -1);
         dst.type = OP_REG;
         if ( d & ByteOp )
         {
@@ -1589,7 +1589,7 @@ x86_emulate(
         dst = ea;
         if ( dst.type == OP_REG )
         {
-            generate_exception_if(lock_prefix, EXC_GP, 0);
+            generate_exception_if(lock_prefix, EXC_UD, -1);
             switch ( dst.bytes )
             {
             case 1: dst.val = *(uint8_t  *)dst.reg; break;
@@ -3598,14 +3598,14 @@ x86_emulate(
         struct segment_register cs = { 0 }, ss = { 0 };
         int rc;
 
-        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, 0);
-        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, 0);
+        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, -1);
+        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1);
 
         /* Inject #UD if syscall/sysret are disabled. */
         fail_if(ops->read_msr == NULL);
         if ( (rc = ops->read_msr(MSR_EFER, &msr_content, ctxt)) != 0 )
             goto done;
-        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, 0);
+        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, -1);
 
         if ( (rc = ops->read_msr(MSR_STAR, &msr_content, ctxt)) != 0 )
             goto done;

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKJAw-0005C8-C8; Wed, 18 Apr 2012 00:55: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 1SKJAv-0005Bg-31
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:13 +0000
Received: from [85.158.138.51:46459] by server-5.bemta-3.messagelabs.com id
	F1/0B-17113-0F01E8F4; Wed, 18 Apr 2012 00:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1334710510!22413627!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6411 invoked from network); 18 Apr 2012 00:55: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;
	18 Apr 2012 00: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 1SKJAr-0006VU-Ap
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKJAr-0007QR-2j
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Message-Id: <E1SKJAr-0007QR-2j@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:55:08 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86_emulate: Do not push an error
	code onto a #UD exception stack
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1334648068 -3600
# Node ID 182633356cd4f285fb0e4b777f76a286eca9543a
# Parent  00881b29bfe2b538775c082dfea6105a51f07d49
x86_emulate: Do not push an error code onto a #UD exception stack

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25099:4bd752a4cdf3
xen-unstable date:        Fri Mar 23 20:51:48 2012 +0000

x86_emulate: raise #UD rather than #GP on invalid use of LOCK prefix

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25098:2e45b26bc412
xen-unstable date:        Fri Mar 23 20:45:16 2012 +0000
---


diff -r 00881b29bfe2 -r 182633356cd4 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:33:33 2012 +0100
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:34:28 2012 +0100
@@ -1309,7 +1309,7 @@ x86_emulate(
     }
 
     /* Lock prefix is allowed only on RMW instructions. */
-    generate_exception_if((d & Mov) && lock_prefix, EXC_GP, 0);
+    generate_exception_if((d & Mov) && lock_prefix, EXC_UD, -1);
 
     /* ModRM and SIB bytes. */
     if ( d & ModRM )
@@ -1528,12 +1528,12 @@ x86_emulate(
             lock_prefix &&
             ((b < 0x20) || (b > 0x23)) && /* MOV CRn/DRn */
             (b != 0xc7),                  /* CMPXCHG{8,16}B */
-            EXC_GP, 0);
+            EXC_UD, -1);
         dst.type = OP_NONE;
         break;
 
     case DstReg:
-        generate_exception_if(lock_prefix, EXC_GP, 0);
+        generate_exception_if(lock_prefix, EXC_UD, -1);
         dst.type = OP_REG;
         if ( d & ByteOp )
         {
@@ -1589,7 +1589,7 @@ x86_emulate(
         dst = ea;
         if ( dst.type == OP_REG )
         {
-            generate_exception_if(lock_prefix, EXC_GP, 0);
+            generate_exception_if(lock_prefix, EXC_UD, -1);
             switch ( dst.bytes )
             {
             case 1: dst.val = *(uint8_t  *)dst.reg; break;
@@ -3598,14 +3598,14 @@ x86_emulate(
         struct segment_register cs = { 0 }, ss = { 0 };
         int rc;
 
-        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, 0);
-        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, 0);
+        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, -1);
+        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1);
 
         /* Inject #UD if syscall/sysret are disabled. */
         fail_if(ops->read_msr == NULL);
         if ( (rc = ops->read_msr(MSR_EFER, &msr_content, ctxt)) != 0 )
             goto done;
-        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, 0);
+        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, -1);
 
         if ( (rc = ops->read_msr(MSR_STAR, &msr_content, ctxt)) != 0 )
             goto done;

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKJAw-0005C3-9r; Wed, 18 Apr 2012 00:55: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 1SKJAu-0005Bf-RL
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:13 +0000
Received: from [85.158.143.99:32012] by server-1.bemta-4.messagelabs.com id
	CC/0F-20925-0F01E8F4; Wed, 18 Apr 2012 00:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1334710510!25531386!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4578 invoked from network); 18 Apr 2012 00:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 00: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 1SKJAr-0006VX-OO
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKJAr-0007Qg-J6
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Message-Id: <E1SKJAr-0007Qg-J6@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:55:09 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/hpet: disable before reboot
	or kexec
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334648109 -3600
# Node ID 494aa5ecd2e19384b5ad6c2d30867b86b7f2b405
# Parent  182633356cd4f285fb0e4b777f76a286eca9543a
x86/hpet: disable before reboot or kexec

Linux up to now is not smart enough to properly clear the HPET when it
boots, which is particularly a problem when a kdump attempt from
running under Xen is being made. Linux itself added code to work
around
this to its shutdown paths quite some time ago, so let's do something
similar in Xen: Save the configuration register settings during boot,
and restore them during shutdown. This should cover the majority of
cases where the secondary kernel might not come up because timer
interrupts don't work.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25101:f06ff3dfde08
xen-unstable date:        Tue Mar 27 15:20:23 2012 +0200
---


diff -r 182633356cd4 -r 494aa5ecd2e1 xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/arch/x86/crash.c	Tue Apr 17 08:35:09 2012 +0100
@@ -94,6 +94,7 @@ static void nmi_shootdown_cpus(void)
     x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
     disable_IO_APIC();
+    hpet_disable();
 }
 
 void machine_crash_shutdown(void)
diff -r 182633356cd4 -r 494aa5ecd2e1 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/arch/x86/hpet.c	Tue Apr 17 08:35:09 2012 +0100
@@ -744,12 +744,14 @@ int hpet_legacy_irq_tick(void)
     return 1;
 }
 
+static u32 *hpet_boot_cfg;
+
 u64 hpet_setup(void)
 {
     static u64 hpet_rate;
     static u32 system_reset_latch;
     u32 hpet_id, hpet_period, cfg;
-    int i;
+    unsigned int i, last;
 
     if ( system_reset_latch == system_reset_counter )
         return hpet_rate;
@@ -775,13 +777,20 @@ u64 hpet_setup(void)
         return 0;
     }
 
+    last = (hpet_id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT;
+    hpet_boot_cfg = xmalloc_array(u32, 2 + last);
+
     cfg = hpet_read32(HPET_CFG);
+    if ( hpet_boot_cfg )
+        *hpet_boot_cfg = cfg;
     cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY);
     hpet_write32(cfg, HPET_CFG);
 
-    for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ )
+    for ( i = 0; i <= last; ++i )
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
+        if ( hpet_boot_cfg )
+            hpet_boot_cfg[i + 1] = cfg;
         cfg &= ~HPET_TN_ENABLE;
         hpet_write32(cfg, HPET_Tn_CFG(i));
     }
@@ -795,3 +804,21 @@ u64 hpet_setup(void)
 
     return hpet_rate;
 }
+
+void hpet_disable(void)
+{
+    unsigned int i;
+    u32 id;
+
+    if ( !hpet_boot_cfg )
+        return;
+
+    hpet_write32(*hpet_boot_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    id = hpet_read32(HPET_ID);
+    for ( i = 0; i <= ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT); ++i )
+        hpet_write32(hpet_boot_cfg[i + 1], HPET_Tn_CFG(i));
+
+    if ( *hpet_boot_cfg & HPET_CFG_ENABLE )
+        hpet_write32(*hpet_boot_cfg, HPET_CFG);
+}
diff -r 182633356cd4 -r 494aa5ecd2e1 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/arch/x86/smp.c	Tue Apr 17 08:35:09 2012 +0100
@@ -19,6 +19,7 @@
 #include <asm/mc146818rtc.h>
 #include <asm/flushtlb.h>
 #include <asm/hardirq.h>
+#include <asm/hpet.h>
 #include <asm/hvm/support.h>
 #include <mach_apic.h>
 
@@ -372,6 +373,7 @@ void smp_send_stop(void)
     local_irq_disable();
     __stop_this_cpu();
     disable_IO_APIC();
+    hpet_disable();
     local_irq_enable();
 }
 
diff -r 182633356cd4 -r 494aa5ecd2e1 xen/include/asm-x86/hpet.h
--- a/xen/include/asm-x86/hpet.h	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/include/asm-x86/hpet.h	Tue Apr 17 08:35:09 2012 +0100
@@ -67,6 +67,11 @@ extern unsigned long hpet_address;
 u64 hpet_setup(void);
 
 /*
+ * Disable HPET hardware: restore it to boot time state.
+ */
+void hpet_disable(void);
+
+/*
  * Callback from legacy timer (PIT channel 0) IRQ handler.
  * Returns 1 if tick originated from HPET; else 0.
  */

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 00:55:17 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 00: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 1SKJAw-0005C3-9r; Wed, 18 Apr 2012 00:55: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 1SKJAu-0005Bf-RL
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:13 +0000
Received: from [85.158.143.99:32012] by server-1.bemta-4.messagelabs.com id
	CC/0F-20925-0F01E8F4; Wed, 18 Apr 2012 00:55:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1334710510!25531386!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4578 invoked from network); 18 Apr 2012 00:55:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 00: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 1SKJAr-0006VX-OO
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKJAr-0007Qg-J6
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 00:55:09 +0000
Message-Id: <E1SKJAr-0007Qg-J6@xenbits.xen.org>
Date: Wed, 18 Apr 2012 00:55:09 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/hpet: disable before reboot
	or kexec
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334648109 -3600
# Node ID 494aa5ecd2e19384b5ad6c2d30867b86b7f2b405
# Parent  182633356cd4f285fb0e4b777f76a286eca9543a
x86/hpet: disable before reboot or kexec

Linux up to now is not smart enough to properly clear the HPET when it
boots, which is particularly a problem when a kdump attempt from
running under Xen is being made. Linux itself added code to work
around
this to its shutdown paths quite some time ago, so let's do something
similar in Xen: Save the configuration register settings during boot,
and restore them during shutdown. This should cover the majority of
cases where the secondary kernel might not come up because timer
interrupts don't work.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   25101:f06ff3dfde08
xen-unstable date:        Tue Mar 27 15:20:23 2012 +0200
---


diff -r 182633356cd4 -r 494aa5ecd2e1 xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/arch/x86/crash.c	Tue Apr 17 08:35:09 2012 +0100
@@ -94,6 +94,7 @@ static void nmi_shootdown_cpus(void)
     x2apic_enabled = (current_local_apic_mode() == APIC_MODE_X2APIC);
 
     disable_IO_APIC();
+    hpet_disable();
 }
 
 void machine_crash_shutdown(void)
diff -r 182633356cd4 -r 494aa5ecd2e1 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/arch/x86/hpet.c	Tue Apr 17 08:35:09 2012 +0100
@@ -744,12 +744,14 @@ int hpet_legacy_irq_tick(void)
     return 1;
 }
 
+static u32 *hpet_boot_cfg;
+
 u64 hpet_setup(void)
 {
     static u64 hpet_rate;
     static u32 system_reset_latch;
     u32 hpet_id, hpet_period, cfg;
-    int i;
+    unsigned int i, last;
 
     if ( system_reset_latch == system_reset_counter )
         return hpet_rate;
@@ -775,13 +777,20 @@ u64 hpet_setup(void)
         return 0;
     }
 
+    last = (hpet_id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT;
+    hpet_boot_cfg = xmalloc_array(u32, 2 + last);
+
     cfg = hpet_read32(HPET_CFG);
+    if ( hpet_boot_cfg )
+        *hpet_boot_cfg = cfg;
     cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY);
     hpet_write32(cfg, HPET_CFG);
 
-    for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ )
+    for ( i = 0; i <= last; ++i )
     {
         cfg = hpet_read32(HPET_Tn_CFG(i));
+        if ( hpet_boot_cfg )
+            hpet_boot_cfg[i + 1] = cfg;
         cfg &= ~HPET_TN_ENABLE;
         hpet_write32(cfg, HPET_Tn_CFG(i));
     }
@@ -795,3 +804,21 @@ u64 hpet_setup(void)
 
     return hpet_rate;
 }
+
+void hpet_disable(void)
+{
+    unsigned int i;
+    u32 id;
+
+    if ( !hpet_boot_cfg )
+        return;
+
+    hpet_write32(*hpet_boot_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    id = hpet_read32(HPET_ID);
+    for ( i = 0; i <= ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT); ++i )
+        hpet_write32(hpet_boot_cfg[i + 1], HPET_Tn_CFG(i));
+
+    if ( *hpet_boot_cfg & HPET_CFG_ENABLE )
+        hpet_write32(*hpet_boot_cfg, HPET_CFG);
+}
diff -r 182633356cd4 -r 494aa5ecd2e1 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/arch/x86/smp.c	Tue Apr 17 08:35:09 2012 +0100
@@ -19,6 +19,7 @@
 #include <asm/mc146818rtc.h>
 #include <asm/flushtlb.h>
 #include <asm/hardirq.h>
+#include <asm/hpet.h>
 #include <asm/hvm/support.h>
 #include <mach_apic.h>
 
@@ -372,6 +373,7 @@ void smp_send_stop(void)
     local_irq_disable();
     __stop_this_cpu();
     disable_IO_APIC();
+    hpet_disable();
     local_irq_enable();
 }
 
diff -r 182633356cd4 -r 494aa5ecd2e1 xen/include/asm-x86/hpet.h
--- a/xen/include/asm-x86/hpet.h	Tue Apr 17 08:34:28 2012 +0100
+++ b/xen/include/asm-x86/hpet.h	Tue Apr 17 08:35:09 2012 +0100
@@ -67,6 +67,11 @@ extern unsigned long hpet_address;
 u64 hpet_setup(void);
 
 /*
+ * Disable HPET hardware: restore it to boot time state.
+ */
+void hpet_disable(void);
+
+/*
  * Callback from legacy timer (PIT channel 0) IRQ handler.
  * Returns 1 if tick originated from HPET; else 0.
  */

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 03:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 03: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 1SKLoU-0002yt-AH; Wed, 18 Apr 2012 03: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 1SKLoT-0002yU-D3
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:13 +0000
Received: from [85.158.143.99:51446] by server-1.bemta-4.messagelabs.com id
	C4/F9-20925-C883E8F4; Wed, 18 Apr 2012 03:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1334720649!23189847!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5027 invoked from network); 18 Apr 2012 03:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 03: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 1SKLoP-0000KY-5h
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoO-0002rd-TT
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Message-Id: <E1SKLoO-0002rd-TT@xenbits.xen.org>
Date: Wed, 18 Apr 2012 03:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: clean up auditing output
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1334647867 -3600
# Node ID 6017afc7044265109d98098b3c3adf7f28081858
# Parent  3808ed41dfaaa1cb3f5e59d6d2b4b49e677b7817
xsm/flask: clean up auditing output

The audit data for normal MMU updates was incorrectly using the RANGE
type which presented the data badly in audit messages; add a MEMORY
type for this showing the correct names for the fields. This patch
also shows the target domain in event channel mapping checks to make
debugging those denials easier.

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


diff -r 3808ed41dfaa -r 6017afc70442 xen/xsm/flask/avc.c
--- a/xen/xsm/flask/avc.c	Tue Apr 17 08:30:27 2012 +0100
+++ b/xen/xsm/flask/avc.c	Tue Apr 17 08:31:07 2012 +0100
@@ -639,6 +639,9 @@ void avc_audit(u32 ssid, u32 tsid, u16 t
     case AVC_AUDIT_DATA_RANGE:
         avc_printk(&buf, "range=0x%lx-0x%lx ", a->range.start, a->range.end);
         break;
+    case AVC_AUDIT_DATA_MEMORY:
+        avc_printk(&buf, "pte=0x%lx mfn=0x%lx", a->memory.pte, a->memory.mfn);
+        break;
     }
 
     avc_dump_query(&buf, ssid, tsid, tclass);
diff -r 3808ed41dfaa -r 6017afc70442 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Tue Apr 17 08:30:27 2012 +0100
+++ b/xen/xsm/flask/hooks.c	Tue Apr 17 08:31:07 2012 +0100
@@ -186,6 +186,10 @@ static int flask_evtchn_interdomain(stru
     int rc;
     struct domain_security_struct *dsec, *dsec1, *dsec2;
     struct evtchn_security_struct *esec1, *esec2;
+    struct avc_audit_data ad;
+    AVC_AUDIT_DATA_INIT(&ad, NONE);
+    ad.sdom = d1;
+    ad.tdom = d2;
 
     dsec = current->domain->ssid;
     dsec1 = d1->ssid;
@@ -203,15 +207,15 @@ static int flask_evtchn_interdomain(stru
         return rc;
     }
 
-    rc = avc_has_perm(dsec->sid, newsid, SECCLASS_EVENT, EVENT__CREATE, NULL);
+    rc = avc_has_perm(dsec->sid, newsid, SECCLASS_EVENT, EVENT__CREATE, &ad);
     if ( rc )
         return rc;
 
-    rc = avc_has_perm(newsid, dsec2->sid, SECCLASS_EVENT, EVENT__BIND, NULL);
+    rc = avc_has_perm(newsid, dsec2->sid, SECCLASS_EVENT, EVENT__BIND, &ad);
     if ( rc )
         return rc;
 
-    rc = avc_has_perm(esec2->sid, dsec1->sid, SECCLASS_EVENT, EVENT__BIND, NULL);
+    rc = avc_has_perm(esec2->sid, dsec1->sid, SECCLASS_EVENT, EVENT__BIND, &ad);
     if ( rc )
         return rc;
 
@@ -1328,13 +1332,13 @@ static int flask_mmu_normal_update(struc
     if ( l1e_get_flags(l1e_from_intpte(fpte)) & _PAGE_RW )
         map_perms |= MMU__MAP_WRITE;
 
-    AVC_AUDIT_DATA_INIT(&ad, RANGE);
+    AVC_AUDIT_DATA_INIT(&ad, MEMORY);
     fmfn = get_gfn_untyped(f, l1e_get_pfn(l1e_from_intpte(fpte)));
 
     ad.sdom = d;
     ad.tdom = f;
-    ad.range.start = fpte;
-    ad.range.end = fmfn;
+    ad.memory.pte = fpte;
+    ad.memory.mfn = fmfn;
 
     rc = get_mfn_sid(fmfn, &fsid);
 
diff -r 3808ed41dfaa -r 6017afc70442 xen/xsm/flask/include/avc.h
--- a/xen/xsm/flask/include/avc.h	Tue Apr 17 08:30:27 2012 +0100
+++ b/xen/xsm/flask/include/avc.h	Tue Apr 17 08:31:07 2012 +0100
@@ -42,6 +42,7 @@ struct avc_audit_data {
 #define AVC_AUDIT_DATA_DEV   1
 #define AVC_AUDIT_DATA_IRQ   2
 #define AVC_AUDIT_DATA_RANGE 3
+#define AVC_AUDIT_DATA_MEMORY 4
     struct domain *sdom;
     struct domain *tdom;
     union {
@@ -51,12 +52,13 @@ struct avc_audit_data {
             unsigned long start;
             unsigned long end;
         } range;
+        struct {
+            unsigned long pte;
+            unsigned long mfn;
+        } memory;
     };
 };
 
-#define v4info fam.v4
-#define v6info fam.v6
-
 /* Initialize an AVC audit data structure. */
 #define AVC_AUDIT_DATA_INIT(_d,_t) \
         { memset((_d), 0, sizeof(struct avc_audit_data)); \

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 03:44:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 03: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 1SKLoU-0002yt-AH; Wed, 18 Apr 2012 03: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 1SKLoT-0002yU-D3
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:13 +0000
Received: from [85.158.143.99:51446] by server-1.bemta-4.messagelabs.com id
	C4/F9-20925-C883E8F4; Wed, 18 Apr 2012 03:44:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1334720649!23189847!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5027 invoked from network); 18 Apr 2012 03:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 03: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 1SKLoP-0000KY-5h
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoO-0002rd-TT
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Message-Id: <E1SKLoO-0002rd-TT@xenbits.xen.org>
Date: Wed, 18 Apr 2012 03:44:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm/flask: clean up auditing output
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1334647867 -3600
# Node ID 6017afc7044265109d98098b3c3adf7f28081858
# Parent  3808ed41dfaaa1cb3f5e59d6d2b4b49e677b7817
xsm/flask: clean up auditing output

The audit data for normal MMU updates was incorrectly using the RANGE
type which presented the data badly in audit messages; add a MEMORY
type for this showing the correct names for the fields. This patch
also shows the target domain in event channel mapping checks to make
debugging those denials easier.

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


diff -r 3808ed41dfaa -r 6017afc70442 xen/xsm/flask/avc.c
--- a/xen/xsm/flask/avc.c	Tue Apr 17 08:30:27 2012 +0100
+++ b/xen/xsm/flask/avc.c	Tue Apr 17 08:31:07 2012 +0100
@@ -639,6 +639,9 @@ void avc_audit(u32 ssid, u32 tsid, u16 t
     case AVC_AUDIT_DATA_RANGE:
         avc_printk(&buf, "range=0x%lx-0x%lx ", a->range.start, a->range.end);
         break;
+    case AVC_AUDIT_DATA_MEMORY:
+        avc_printk(&buf, "pte=0x%lx mfn=0x%lx", a->memory.pte, a->memory.mfn);
+        break;
     }
 
     avc_dump_query(&buf, ssid, tsid, tclass);
diff -r 3808ed41dfaa -r 6017afc70442 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Tue Apr 17 08:30:27 2012 +0100
+++ b/xen/xsm/flask/hooks.c	Tue Apr 17 08:31:07 2012 +0100
@@ -186,6 +186,10 @@ static int flask_evtchn_interdomain(stru
     int rc;
     struct domain_security_struct *dsec, *dsec1, *dsec2;
     struct evtchn_security_struct *esec1, *esec2;
+    struct avc_audit_data ad;
+    AVC_AUDIT_DATA_INIT(&ad, NONE);
+    ad.sdom = d1;
+    ad.tdom = d2;
 
     dsec = current->domain->ssid;
     dsec1 = d1->ssid;
@@ -203,15 +207,15 @@ static int flask_evtchn_interdomain(stru
         return rc;
     }
 
-    rc = avc_has_perm(dsec->sid, newsid, SECCLASS_EVENT, EVENT__CREATE, NULL);
+    rc = avc_has_perm(dsec->sid, newsid, SECCLASS_EVENT, EVENT__CREATE, &ad);
     if ( rc )
         return rc;
 
-    rc = avc_has_perm(newsid, dsec2->sid, SECCLASS_EVENT, EVENT__BIND, NULL);
+    rc = avc_has_perm(newsid, dsec2->sid, SECCLASS_EVENT, EVENT__BIND, &ad);
     if ( rc )
         return rc;
 
-    rc = avc_has_perm(esec2->sid, dsec1->sid, SECCLASS_EVENT, EVENT__BIND, NULL);
+    rc = avc_has_perm(esec2->sid, dsec1->sid, SECCLASS_EVENT, EVENT__BIND, &ad);
     if ( rc )
         return rc;
 
@@ -1328,13 +1332,13 @@ static int flask_mmu_normal_update(struc
     if ( l1e_get_flags(l1e_from_intpte(fpte)) & _PAGE_RW )
         map_perms |= MMU__MAP_WRITE;
 
-    AVC_AUDIT_DATA_INIT(&ad, RANGE);
+    AVC_AUDIT_DATA_INIT(&ad, MEMORY);
     fmfn = get_gfn_untyped(f, l1e_get_pfn(l1e_from_intpte(fpte)));
 
     ad.sdom = d;
     ad.tdom = f;
-    ad.range.start = fpte;
-    ad.range.end = fmfn;
+    ad.memory.pte = fpte;
+    ad.memory.mfn = fmfn;
 
     rc = get_mfn_sid(fmfn, &fsid);
 
diff -r 3808ed41dfaa -r 6017afc70442 xen/xsm/flask/include/avc.h
--- a/xen/xsm/flask/include/avc.h	Tue Apr 17 08:30:27 2012 +0100
+++ b/xen/xsm/flask/include/avc.h	Tue Apr 17 08:31:07 2012 +0100
@@ -42,6 +42,7 @@ struct avc_audit_data {
 #define AVC_AUDIT_DATA_DEV   1
 #define AVC_AUDIT_DATA_IRQ   2
 #define AVC_AUDIT_DATA_RANGE 3
+#define AVC_AUDIT_DATA_MEMORY 4
     struct domain *sdom;
     struct domain *tdom;
     union {
@@ -51,12 +52,13 @@ struct avc_audit_data {
             unsigned long start;
             unsigned long end;
         } range;
+        struct {
+            unsigned long pte;
+            unsigned long mfn;
+        } memory;
     };
 };
 
-#define v4info fam.v4
-#define v6info fam.v6
-
 /* Initialize an AVC audit data structure. */
 #define AVC_AUDIT_DATA_INIT(_d,_t) \
         { memset((_d), 0, sizeof(struct avc_audit_data)); \

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 03:44:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 03:44:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKLoT-0002yV-31; Wed, 18 Apr 2012 03: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 1SKLoR-0002yI-Kx
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:11 +0000
Received: from [85.158.143.99:30986] by server-3.bemta-4.messagelabs.com id
	BD/6D-05853-A883E8F4; Wed, 18 Apr 2012 03:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1334720649!20725648!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5539 invoked from network); 18 Apr 2012 03:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 03: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 1SKLoO-0000KU-NV
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoO-0002rO-Cf
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Message-Id: <E1SKLoO-0002rO-Cf@xenbits.xen.org>
Date: Wed, 18 Apr 2012 03:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] fix build error when enabling lock
	profile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Yang Zhang <yang.z.zhang@Intel.com>
# Date 1334647827 -3600
# Node ID 3808ed41dfaaa1cb3f5e59d6d2b4b49e677b7817
# Parent  375fa55c7a6c88273bdd1f7f1105e5154da4eeba
fix build error when enabling lock profile

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 375fa55c7a6c -r 3808ed41dfaa xen/common/sysctl.c
--- a/xen/common/sysctl.c	Tue Apr 17 08:29:26 2012 +0100
+++ b/xen/common/sysctl.c	Tue Apr 17 08:30:27 2012 +0100
@@ -156,7 +156,6 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
         if ( ret )
             break;
 
-        ret = perfc_control(&op->u.perfc_op);
         ret = spinlock_profile_control(&op->u.lockprof_op);
         if ( copy_to_guest(u_sysctl, op, 1) )
             ret = -EFAULT;

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 03:44:21 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 03:44:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKLoT-0002yV-31; Wed, 18 Apr 2012 03: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 1SKLoR-0002yI-Kx
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:11 +0000
Received: from [85.158.143.99:30986] by server-3.bemta-4.messagelabs.com id
	BD/6D-05853-A883E8F4; Wed, 18 Apr 2012 03:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1334720649!20725648!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5539 invoked from network); 18 Apr 2012 03:44:10 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 03: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 1SKLoO-0000KU-NV
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoO-0002rO-Cf
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Message-Id: <E1SKLoO-0002rO-Cf@xenbits.xen.org>
Date: Wed, 18 Apr 2012 03:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] fix build error when enabling lock
	profile
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Yang Zhang <yang.z.zhang@Intel.com>
# Date 1334647827 -3600
# Node ID 3808ed41dfaaa1cb3f5e59d6d2b4b49e677b7817
# Parent  375fa55c7a6c88273bdd1f7f1105e5154da4eeba
fix build error when enabling lock profile

Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 375fa55c7a6c -r 3808ed41dfaa xen/common/sysctl.c
--- a/xen/common/sysctl.c	Tue Apr 17 08:29:26 2012 +0100
+++ b/xen/common/sysctl.c	Tue Apr 17 08:30:27 2012 +0100
@@ -156,7 +156,6 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
         if ( ret )
             break;
 
-        ret = perfc_control(&op->u.perfc_op);
         ret = spinlock_profile_control(&op->u.lockprof_op);
         if ( copy_to_guest(u_sysctl, op, 1) )
             ret = -EFAULT;

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 03:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 03:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKLoT-0002ya-5i; Wed, 18 Apr 2012 03: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 1SKLoR-0002yH-Gx
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:11 +0000
Received: from [85.158.143.35:6711] by server-2.bemta-4.messagelabs.com id
	97/4C-17550-A883E8F4; Wed, 18 Apr 2012 03:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1334720648!13726916!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30333 invoked from network); 18 Apr 2012 03:44:09 -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;
	18 Apr 2012 03:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoO-0000KS-8t
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoN-0002r9-RJ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:07 +0000
Message-Id: <E1SKLoN-0002r9-RJ@xenbits.xen.org>
Date: Wed, 18 Apr 2012 03:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Fix save/restore of guest PAT table
	in HAP paging 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Gianluca Guida <gianluca.guida@citrix.com>
# Date 1334647766 -3600
# Node ID 375fa55c7a6c88273bdd1f7f1105e5154da4eeba
# Parent  a06e6cdeafe34964721df3ddb32774d4634fd7ad
Fix save/restore of guest PAT table in HAP paging mode.

HAP paging mode guests use direct MSR read/write into the VMCS/VMCB
for the guest PAT table, while the current save/restore code was
accessing only the pat_cr field in hvm_vcpu, used when intercepting
the MSR mostly in shadow mode (the Intel scenario is a bit more
complicated).  This patch fixes this issue creating a new couple of
hvm_funcs, get/set_guest_pat, that access the right PAT table based on
the paging mode and guest configuration.

Signed-off-by: Gianluca Guida <gianluca.guida@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/hvm.c	Tue Apr 17 08:29:26 2012 +0100
@@ -216,6 +216,31 @@ void hvm_set_rdtsc_exiting(struct domain
         hvm_funcs.set_rdtsc_exiting(v, enable);
 }
 
+void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat)
+{
+    if ( !hvm_funcs.get_guest_pat(v, guest_pat) )
+        *guest_pat = v->arch.hvm_vcpu.pat_cr;
+}
+
+int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)
+{
+    int i;
+    uint8_t *value = (uint8_t *)&guest_pat;
+
+    for ( i = 0; i < 8; i++ )
+        if ( unlikely(!(value[i] == 0 || value[i] == 1 ||
+                        value[i] == 4 || value[i] == 5 ||
+                        value[i] == 6 || value[i] == 7)) ) {
+            HVM_DBG_LOG(DBG_LEVEL_MSR, "invalid guest PAT: %"PRIx64"\n",
+                        guest_pat); 
+            return 0;
+        }
+
+    if ( !hvm_funcs.set_guest_pat(v, guest_pat) )
+        v->arch.hvm_vcpu.pat_cr = guest_pat;
+    return 1;
+}
+
 void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc)
 {
     uint64_t tsc;
@@ -2796,7 +2821,7 @@ int hvm_msr_read_intercept(unsigned int 
         break;
 
     case MSR_IA32_CR_PAT:
-        *msr_content = v->arch.hvm_vcpu.pat_cr;
+        hvm_get_guest_pat(v, msr_content);
         break;
 
     case MSR_MTRRcap:
@@ -2912,7 +2937,7 @@ int hvm_msr_write_intercept(unsigned int
         break;
 
     case MSR_IA32_CR_PAT:
-        if ( !pat_msr_set(&v->arch.hvm_vcpu.pat_cr, msr_content) )
+        if ( !hvm_set_guest_pat(v, msr_content) )
            goto gp_fault;
         break;
 
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/mtrr.c	Tue Apr 17 08:29:26 2012 +0100
@@ -403,26 +403,6 @@ uint32_t get_pat_flags(struct vcpu *v,
     return pat_type_2_pte_flags(pat_entry_value);
 }
 
-/* Helper funtions for seting mtrr/pat */
-bool_t pat_msr_set(uint64_t *pat, uint64_t msr_content)
-{
-    uint8_t *value = (uint8_t*)&msr_content;
-    int32_t i;
-
-    if ( *pat != msr_content )
-    {
-        for ( i = 0; i < 8; i++ )
-            if ( unlikely(!(value[i] == 0 || value[i] == 1 ||
-                            value[i] == 4 || value[i] == 5 ||
-                            value[i] == 6 || value[i] == 7)) )
-                return 0;
-
-        *pat = msr_content;
-    }
-
-    return 1;
-}
-
 bool_t mtrr_def_type_msr_set(struct mtrr_state *m, uint64_t msr_content)
 {
     uint8_t def_type = msr_content & 0xff;
@@ -631,7 +611,7 @@ static int hvm_save_mtrr_msr(struct doma
     {
         mtrr_state = &v->arch.hvm_vcpu.mtrr;
 
-        hw_mtrr.msr_pat_cr = v->arch.hvm_vcpu.pat_cr;
+        hvm_get_guest_pat(v, &hw_mtrr.msr_pat_cr);
 
         hw_mtrr.msr_mtrr_def_type = mtrr_state->def_type
                                 | (mtrr_state->enabled << 10);
@@ -677,7 +657,7 @@ static int hvm_load_mtrr_msr(struct doma
 
     mtrr_state = &v->arch.hvm_vcpu.mtrr;
 
-    pat_msr_set(&v->arch.hvm_vcpu.pat_cr, hw_mtrr.msr_pat_cr);
+    hvm_set_guest_pat(v, hw_mtrr.msr_pat_cr);
 
     mtrr_state->mtrr_cap = hw_mtrr.msr_mtrr_cap;
 
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/svm/svm.c	Tue Apr 17 08:29:26 2012 +0100
@@ -645,6 +645,28 @@ static void svm_set_segment_register(str
         svm_vmload(vmcb);
 }
 
+static int svm_set_guest_pat(struct vcpu *v, u64 gpat)
+{
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+    if ( !paging_mode_hap(v->domain) )
+        return 0;
+
+    vmcb_set_g_pat(vmcb, gpat);
+    return 1;
+}
+
+static int svm_get_guest_pat(struct vcpu *v, u64 *gpat)
+{
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+    if ( !paging_mode_hap(v->domain) )
+        return 0;
+
+    *gpat = vmcb_get_g_pat(vmcb);
+    return 1;
+}
+
 static uint64_t svm_get_tsc_offset(uint64_t host_tsc, uint64_t guest_tsc,
     uint64_t ratio)
 {
@@ -1964,6 +1986,8 @@ static struct hvm_function_table __read_
     .update_host_cr3      = svm_update_host_cr3,
     .update_guest_cr      = svm_update_guest_cr,
     .update_guest_efer    = svm_update_guest_efer,
+    .set_guest_pat        = svm_set_guest_pat,
+    .get_guest_pat        = svm_get_guest_pat,
     .set_tsc_offset       = svm_set_tsc_offset,
     .inject_exception     = svm_inject_exception,
     .init_hypercall_page  = svm_init_hypercall_page,
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Apr 17 08:29:26 2012 +0100
@@ -942,6 +942,34 @@ static void vmx_set_segment_register(str
     vmx_vmcs_exit(v);
 }
 
+static int vmx_set_guest_pat(struct vcpu *v, u64 gpat)
+{
+    if ( !cpu_has_vmx_pat || !paging_mode_hap(v->domain) )
+        return 0;
+
+    vmx_vmcs_enter(v);
+    __vmwrite(GUEST_PAT, gpat);
+#ifdef __i386__
+    __vmwrite(GUEST_PAT_HIGH, gpat >> 32);
+#endif
+    vmx_vmcs_exit(v);
+    return 1;
+}
+
+static int vmx_get_guest_pat(struct vcpu *v, u64 *gpat)
+{
+    if ( !cpu_has_vmx_pat || !paging_mode_hap(v->domain) )
+        return 0;
+
+    vmx_vmcs_enter(v);
+    *gpat = __vmread(GUEST_PAT);
+#ifdef __i386__
+    *gpat |= (u64)__vmread(GUEST_PAT_HIGH) << 32;
+#endif
+    vmx_vmcs_exit(v);
+    return 1;
+}
+
 static void vmx_set_tsc_offset(struct vcpu *v, u64 offset)
 {
     vmx_vmcs_enter(v);
@@ -1486,6 +1514,8 @@ static struct hvm_function_table __read_
     .update_host_cr3      = vmx_update_host_cr3,
     .update_guest_cr      = vmx_update_guest_cr,
     .update_guest_efer    = vmx_update_guest_efer,
+    .set_guest_pat        = vmx_set_guest_pat,
+    .get_guest_pat        = vmx_get_guest_pat,
     .set_tsc_offset       = vmx_set_tsc_offset,
     .inject_exception     = vmx_inject_exception,
     .init_hypercall_page  = vmx_init_hypercall_page,
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/include/asm-x86/hvm/hvm.h	Tue Apr 17 08:29:26 2012 +0100
@@ -118,6 +118,9 @@ struct hvm_function_table {
     void (*update_guest_cr)(struct vcpu *v, unsigned int cr);
     void (*update_guest_efer)(struct vcpu *v);
 
+    int  (*get_guest_pat)(struct vcpu *v, u64 *);
+    int  (*set_guest_pat)(struct vcpu *v, u64);
+
     void (*set_tsc_offset)(struct vcpu *v, u64 offset);
 
     void (*inject_exception)(unsigned int trapnr, int errcode,
@@ -200,6 +203,9 @@ void destroy_ring_for_helper(void **_va,
 
 bool_t hvm_send_assist_req(struct vcpu *v);
 
+void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat);
+int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat);
+
 void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc);
 u64 hvm_get_guest_tsc(struct vcpu *v);
 

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 03:44:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 03:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKLoT-0002ya-5i; Wed, 18 Apr 2012 03: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 1SKLoR-0002yH-Gx
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:11 +0000
Received: from [85.158.143.35:6711] by server-2.bemta-4.messagelabs.com id
	97/4C-17550-A883E8F4; Wed, 18 Apr 2012 03:44:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1334720648!13726916!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30333 invoked from network); 18 Apr 2012 03:44:09 -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;
	18 Apr 2012 03:44:09 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoO-0000KS-8t
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKLoN-0002r9-RJ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 03:44:07 +0000
Message-Id: <E1SKLoN-0002r9-RJ@xenbits.xen.org>
Date: Wed, 18 Apr 2012 03:44:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Fix save/restore of guest PAT table
	in HAP paging 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Gianluca Guida <gianluca.guida@citrix.com>
# Date 1334647766 -3600
# Node ID 375fa55c7a6c88273bdd1f7f1105e5154da4eeba
# Parent  a06e6cdeafe34964721df3ddb32774d4634fd7ad
Fix save/restore of guest PAT table in HAP paging mode.

HAP paging mode guests use direct MSR read/write into the VMCS/VMCB
for the guest PAT table, while the current save/restore code was
accessing only the pat_cr field in hvm_vcpu, used when intercepting
the MSR mostly in shadow mode (the Intel scenario is a bit more
complicated).  This patch fixes this issue creating a new couple of
hvm_funcs, get/set_guest_pat, that access the right PAT table based on
the paging mode and guest configuration.

Signed-off-by: Gianluca Guida <gianluca.guida@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/hvm.c	Tue Apr 17 08:29:26 2012 +0100
@@ -216,6 +216,31 @@ void hvm_set_rdtsc_exiting(struct domain
         hvm_funcs.set_rdtsc_exiting(v, enable);
 }
 
+void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat)
+{
+    if ( !hvm_funcs.get_guest_pat(v, guest_pat) )
+        *guest_pat = v->arch.hvm_vcpu.pat_cr;
+}
+
+int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat)
+{
+    int i;
+    uint8_t *value = (uint8_t *)&guest_pat;
+
+    for ( i = 0; i < 8; i++ )
+        if ( unlikely(!(value[i] == 0 || value[i] == 1 ||
+                        value[i] == 4 || value[i] == 5 ||
+                        value[i] == 6 || value[i] == 7)) ) {
+            HVM_DBG_LOG(DBG_LEVEL_MSR, "invalid guest PAT: %"PRIx64"\n",
+                        guest_pat); 
+            return 0;
+        }
+
+    if ( !hvm_funcs.set_guest_pat(v, guest_pat) )
+        v->arch.hvm_vcpu.pat_cr = guest_pat;
+    return 1;
+}
+
 void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc)
 {
     uint64_t tsc;
@@ -2796,7 +2821,7 @@ int hvm_msr_read_intercept(unsigned int 
         break;
 
     case MSR_IA32_CR_PAT:
-        *msr_content = v->arch.hvm_vcpu.pat_cr;
+        hvm_get_guest_pat(v, msr_content);
         break;
 
     case MSR_MTRRcap:
@@ -2912,7 +2937,7 @@ int hvm_msr_write_intercept(unsigned int
         break;
 
     case MSR_IA32_CR_PAT:
-        if ( !pat_msr_set(&v->arch.hvm_vcpu.pat_cr, msr_content) )
+        if ( !hvm_set_guest_pat(v, msr_content) )
            goto gp_fault;
         break;
 
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/mtrr.c	Tue Apr 17 08:29:26 2012 +0100
@@ -403,26 +403,6 @@ uint32_t get_pat_flags(struct vcpu *v,
     return pat_type_2_pte_flags(pat_entry_value);
 }
 
-/* Helper funtions for seting mtrr/pat */
-bool_t pat_msr_set(uint64_t *pat, uint64_t msr_content)
-{
-    uint8_t *value = (uint8_t*)&msr_content;
-    int32_t i;
-
-    if ( *pat != msr_content )
-    {
-        for ( i = 0; i < 8; i++ )
-            if ( unlikely(!(value[i] == 0 || value[i] == 1 ||
-                            value[i] == 4 || value[i] == 5 ||
-                            value[i] == 6 || value[i] == 7)) )
-                return 0;
-
-        *pat = msr_content;
-    }
-
-    return 1;
-}
-
 bool_t mtrr_def_type_msr_set(struct mtrr_state *m, uint64_t msr_content)
 {
     uint8_t def_type = msr_content & 0xff;
@@ -631,7 +611,7 @@ static int hvm_save_mtrr_msr(struct doma
     {
         mtrr_state = &v->arch.hvm_vcpu.mtrr;
 
-        hw_mtrr.msr_pat_cr = v->arch.hvm_vcpu.pat_cr;
+        hvm_get_guest_pat(v, &hw_mtrr.msr_pat_cr);
 
         hw_mtrr.msr_mtrr_def_type = mtrr_state->def_type
                                 | (mtrr_state->enabled << 10);
@@ -677,7 +657,7 @@ static int hvm_load_mtrr_msr(struct doma
 
     mtrr_state = &v->arch.hvm_vcpu.mtrr;
 
-    pat_msr_set(&v->arch.hvm_vcpu.pat_cr, hw_mtrr.msr_pat_cr);
+    hvm_set_guest_pat(v, hw_mtrr.msr_pat_cr);
 
     mtrr_state->mtrr_cap = hw_mtrr.msr_mtrr_cap;
 
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/svm/svm.c	Tue Apr 17 08:29:26 2012 +0100
@@ -645,6 +645,28 @@ static void svm_set_segment_register(str
         svm_vmload(vmcb);
 }
 
+static int svm_set_guest_pat(struct vcpu *v, u64 gpat)
+{
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+    if ( !paging_mode_hap(v->domain) )
+        return 0;
+
+    vmcb_set_g_pat(vmcb, gpat);
+    return 1;
+}
+
+static int svm_get_guest_pat(struct vcpu *v, u64 *gpat)
+{
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+    if ( !paging_mode_hap(v->domain) )
+        return 0;
+
+    *gpat = vmcb_get_g_pat(vmcb);
+    return 1;
+}
+
 static uint64_t svm_get_tsc_offset(uint64_t host_tsc, uint64_t guest_tsc,
     uint64_t ratio)
 {
@@ -1964,6 +1986,8 @@ static struct hvm_function_table __read_
     .update_host_cr3      = svm_update_host_cr3,
     .update_guest_cr      = svm_update_guest_cr,
     .update_guest_efer    = svm_update_guest_efer,
+    .set_guest_pat        = svm_set_guest_pat,
+    .get_guest_pat        = svm_get_guest_pat,
     .set_tsc_offset       = svm_set_tsc_offset,
     .inject_exception     = svm_inject_exception,
     .init_hypercall_page  = svm_init_hypercall_page,
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Tue Apr 17 08:29:26 2012 +0100
@@ -942,6 +942,34 @@ static void vmx_set_segment_register(str
     vmx_vmcs_exit(v);
 }
 
+static int vmx_set_guest_pat(struct vcpu *v, u64 gpat)
+{
+    if ( !cpu_has_vmx_pat || !paging_mode_hap(v->domain) )
+        return 0;
+
+    vmx_vmcs_enter(v);
+    __vmwrite(GUEST_PAT, gpat);
+#ifdef __i386__
+    __vmwrite(GUEST_PAT_HIGH, gpat >> 32);
+#endif
+    vmx_vmcs_exit(v);
+    return 1;
+}
+
+static int vmx_get_guest_pat(struct vcpu *v, u64 *gpat)
+{
+    if ( !cpu_has_vmx_pat || !paging_mode_hap(v->domain) )
+        return 0;
+
+    vmx_vmcs_enter(v);
+    *gpat = __vmread(GUEST_PAT);
+#ifdef __i386__
+    *gpat |= (u64)__vmread(GUEST_PAT_HIGH) << 32;
+#endif
+    vmx_vmcs_exit(v);
+    return 1;
+}
+
 static void vmx_set_tsc_offset(struct vcpu *v, u64 offset)
 {
     vmx_vmcs_enter(v);
@@ -1486,6 +1514,8 @@ static struct hvm_function_table __read_
     .update_host_cr3      = vmx_update_host_cr3,
     .update_guest_cr      = vmx_update_guest_cr,
     .update_guest_efer    = vmx_update_guest_efer,
+    .set_guest_pat        = vmx_set_guest_pat,
+    .get_guest_pat        = vmx_get_guest_pat,
     .set_tsc_offset       = vmx_set_tsc_offset,
     .inject_exception     = vmx_inject_exception,
     .init_hypercall_page  = vmx_init_hypercall_page,
diff -r a06e6cdeafe3 -r 375fa55c7a6c xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h	Mon Apr 16 13:05:28 2012 +0200
+++ b/xen/include/asm-x86/hvm/hvm.h	Tue Apr 17 08:29:26 2012 +0100
@@ -118,6 +118,9 @@ struct hvm_function_table {
     void (*update_guest_cr)(struct vcpu *v, unsigned int cr);
     void (*update_guest_efer)(struct vcpu *v);
 
+    int  (*get_guest_pat)(struct vcpu *v, u64 *);
+    int  (*set_guest_pat)(struct vcpu *v, u64);
+
     void (*set_tsc_offset)(struct vcpu *v, u64 offset);
 
     void (*inject_exception)(unsigned int trapnr, int errcode,
@@ -200,6 +203,9 @@ void destroy_ring_for_helper(void **_va,
 
 bool_t hvm_send_assist_req(struct vcpu *v);
 
+void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat);
+int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat);
+
 void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc);
 u64 hvm_get_guest_tsc(struct vcpu *v);
 

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:13 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33: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 1SKU4K-0004lO-NO; Wed, 18 Apr 2012 12:33:08 +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 1SKU4J-0004lB-Jq
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:07 +0000
Received: from [85.158.143.99:33375] by server-2.bemta-4.messagelabs.com id
	3B/99-17550-284BE8F4; Wed, 18 Apr 2012 12:33:06 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-216.messagelabs.com!1334752384!14547025!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7790 invoked from network); 18 Apr 2012 12:33:06 -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;
	18 Apr 2012 12:33:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4G-0006uH-HP
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4G-00076m-5J
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:04 +0000
Date: Wed, 18 Apr 2012 12:33:04 +0000
Message-Id: <E1SKU4G-00076m-5J@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: handle backend
	deletion from xenstore
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit f36648aef45b3bfb83ac081749e66918c1fa9c7a
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Mar 30 14:33:03 2012 +0000

    xen: handle backend deletion from xenstore
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_backend.c |   17 +++++++++--------
 hw/xen_disk.c    |    4 ++++
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index d876cab..555da41 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -589,7 +589,7 @@ static void xenstore_update_be(char *watch, char *type, int dom,
                                struct XenDevOps *ops)
 {
     struct XenDevice *xendev;
-    char path[XEN_BUFSIZE], *dom0;
+    char path[XEN_BUFSIZE], *dom0, *bepath;
     unsigned int len, dev;
 
     dom0 = xs_get_domain_path(xenstore, 0);
@@ -608,15 +608,16 @@ static void xenstore_update_be(char *watch, char *type, int dom,
         return;
     }
 
-    if (0) {
-        /* FIXME: detect devices being deleted from xenstore ... */
-        xen_be_del_xendev(dom, dev);
-    }
-
     xendev = xen_be_get_xendev(type, dom, dev, ops);
     if (xendev != NULL) {
-        xen_be_backend_changed(xendev, path);
-        xen_be_check_state(xendev);
+        bepath = xs_read(xenstore, 0, xendev->be, &len);
+        if (bepath == NULL) {
+            xen_be_del_xendev(dom, dev);
+        } else {
+            free(bepath);
+            xen_be_backend_changed(xendev, path);
+            xen_be_check_state(xendev);
+        }
     }
 }
 
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index e9bbbf7..8217109 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -824,6 +824,10 @@ static int blk_free(struct XenDevice *xendev)
     struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
     struct ioreq *ioreq;
 
+    if (blkdev->bs || blkdev->sring) {
+        blk_disconnect(xendev);
+    }
+
     while (!QLIST_EMPTY(&blkdev->freelist)) {
         ioreq = QLIST_FIRST(&blkdev->freelist);
         QLIST_REMOVE(ioreq, list);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:13 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33: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 1SKU4K-0004lO-NO; Wed, 18 Apr 2012 12:33:08 +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 1SKU4J-0004lB-Jq
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:07 +0000
Received: from [85.158.143.99:33375] by server-2.bemta-4.messagelabs.com id
	3B/99-17550-284BE8F4; Wed, 18 Apr 2012 12:33:06 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-14.tower-216.messagelabs.com!1334752384!14547025!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7790 invoked from network); 18 Apr 2012 12:33:06 -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;
	18 Apr 2012 12:33:06 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4G-0006uH-HP
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:04 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4G-00076m-5J
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:04 +0000
Date: Wed, 18 Apr 2012 12:33:04 +0000
Message-Id: <E1SKU4G-00076m-5J@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: handle backend
	deletion from xenstore
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit f36648aef45b3bfb83ac081749e66918c1fa9c7a
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Mar 30 14:33:03 2012 +0000

    xen: handle backend deletion from xenstore
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_backend.c |   17 +++++++++--------
 hw/xen_disk.c    |    4 ++++
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index d876cab..555da41 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -589,7 +589,7 @@ static void xenstore_update_be(char *watch, char *type, int dom,
                                struct XenDevOps *ops)
 {
     struct XenDevice *xendev;
-    char path[XEN_BUFSIZE], *dom0;
+    char path[XEN_BUFSIZE], *dom0, *bepath;
     unsigned int len, dev;
 
     dom0 = xs_get_domain_path(xenstore, 0);
@@ -608,15 +608,16 @@ static void xenstore_update_be(char *watch, char *type, int dom,
         return;
     }
 
-    if (0) {
-        /* FIXME: detect devices being deleted from xenstore ... */
-        xen_be_del_xendev(dom, dev);
-    }
-
     xendev = xen_be_get_xendev(type, dom, dev, ops);
     if (xendev != NULL) {
-        xen_be_backend_changed(xendev, path);
-        xen_be_check_state(xendev);
+        bepath = xs_read(xenstore, 0, xendev->be, &len);
+        if (bepath == NULL) {
+            xen_be_del_xendev(dom, dev);
+        } else {
+            free(bepath);
+            xen_be_backend_changed(xendev, path);
+            xen_be_check_state(xendev);
+        }
     }
 }
 
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index e9bbbf7..8217109 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -824,6 +824,10 @@ static int blk_free(struct XenDevice *xendev)
     struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
     struct ioreq *ioreq;
 
+    if (blkdev->bs || blkdev->sring) {
+        blk_disconnect(xendev);
+    }
+
     while (!QLIST_EMPTY(&blkdev->freelist)) {
         ioreq = QLIST_FIRST(&blkdev->freelist);
         QLIST_REMOVE(ioreq, list);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12: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 1SKU4U-0004n9-Q2; Wed, 18 Apr 2012 12:33:18 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4T-0004mo-Lv
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:17 +0000
Received: from [193.109.254.147:54899] by server-3.bemta-14.messagelabs.com id
	A2/D2-23274-C84BE8F4; Wed, 18 Apr 2012 12:33:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-27.messagelabs.com!1334752395!5171106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1503 invoked from network); 18 Apr 2012 12:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 12:33:16 -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 1SKU4R-0006uK-0j
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4Q-00077N-MH
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:14 +0000
Date: Wed, 18 Apr 2012 12:33:14 +0000
Message-Id: <E1SKU4Q-00077N-MH@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Xen,
	mapcache: Fix the compute of the size of bucket.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 0ec445db3137e501e758a50d64e9c2b39d23a6b6
Author: Anthony PERARD <anthony.perard@citrix.com>
Date:   Fri Apr 13 17:18:56 2012 +0000

    Xen, mapcache: Fix the compute of the size of bucket.
    
    Because the size of a mapping is wrong when there is an offset and a
    size >= bucket_size.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-mapcache.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen-mapcache.c b/xen-mapcache.c
index d5f52b2..eade816 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -214,12 +214,14 @@ tryagain:
     }
 
     /* size is always a multiple of MCACHE_BUCKET_SIZE */
-    if ((address_offset + (__size % MCACHE_BUCKET_SIZE)) > MCACHE_BUCKET_SIZE)
-        __size += MCACHE_BUCKET_SIZE;
-    if (__size % MCACHE_BUCKET_SIZE)
-        __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE);
-    if (!__size)
+    if (size) {
+        __size = size + address_offset;
+        if (__size % MCACHE_BUCKET_SIZE) {
+            __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE);
+        }
+    } else {
         __size = MCACHE_BUCKET_SIZE;
+    }
 
     entry = &mapcache->entry[address_index % mapcache->nr_buckets];
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12: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 1SKU4U-0004n9-Q2; Wed, 18 Apr 2012 12:33:18 +0000
Received: from mail6.bemta14.messagelabs.com ([193.109.254.103])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4T-0004mo-Lv
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:17 +0000
Received: from [193.109.254.147:54899] by server-3.bemta-14.messagelabs.com id
	A2/D2-23274-C84BE8F4; Wed, 18 Apr 2012 12:33:16 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-27.messagelabs.com!1334752395!5171106!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1503 invoked from network); 18 Apr 2012 12:33:16 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 12:33:16 -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 1SKU4R-0006uK-0j
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4Q-00077N-MH
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:14 +0000
Date: Wed, 18 Apr 2012 12:33:14 +0000
Message-Id: <E1SKU4Q-00077N-MH@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] Xen,
	mapcache: Fix the compute of the size of bucket.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit 0ec445db3137e501e758a50d64e9c2b39d23a6b6
Author: Anthony PERARD <anthony.perard@citrix.com>
Date:   Fri Apr 13 17:18:56 2012 +0000

    Xen, mapcache: Fix the compute of the size of bucket.
    
    Because the size of a mapping is wrong when there is an offset and a
    size >= bucket_size.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-mapcache.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/xen-mapcache.c b/xen-mapcache.c
index d5f52b2..eade816 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -214,12 +214,14 @@ tryagain:
     }
 
     /* size is always a multiple of MCACHE_BUCKET_SIZE */
-    if ((address_offset + (__size % MCACHE_BUCKET_SIZE)) > MCACHE_BUCKET_SIZE)
-        __size += MCACHE_BUCKET_SIZE;
-    if (__size % MCACHE_BUCKET_SIZE)
-        __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE);
-    if (!__size)
+    if (size) {
+        __size = size + address_offset;
+        if (__size % MCACHE_BUCKET_SIZE) {
+            __size += MCACHE_BUCKET_SIZE - (__size % MCACHE_BUCKET_SIZE);
+        }
+    } else {
         __size = MCACHE_BUCKET_SIZE;
+    }
 
     entry = &mapcache->entry[address_index % mapcache->nr_buckets];
 
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33: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 1SKU4f-0004oZ-TE; Wed, 18 Apr 2012 12:33:29 +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 1SKU4e-0004oE-3N
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:28 +0000
Received: from [85.158.143.35:55714] by server-3.bemta-4.messagelabs.com id
	D0/79-05853-794BE8F4; Wed, 18 Apr 2012 12:33:27 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-21.messagelabs.com!1334752405!5499085!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30088 invoked from network); 18 Apr 2012 12:33:26 -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;
	18 Apr 2012 12:33:26 -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 1SKU4b-0006uQ-Es
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4b-00077j-45
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:25 +0000
Date: Wed, 18 Apr 2012 12:33:25 +0000
Message-Id: <E1SKU4b-00077j-45@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen-mapcache: don't unmap
	locked entry during mapcache invalidation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit a74b7770924e3825e2d64b85fbf2f927419e513f
Author: Julien Grall <julien.grall@citrix.com>
Date:   Fri Apr 13 17:33:02 2012 +0000

    xen-mapcache: don't unmap locked entry during mapcache invalidation
    
    When an IOREQ_TYPE_INVALIDATE is sent to QEMU, it invalidates all entry
    of the map cache even if it's locked.
    
    QEMU is not able to know that entry was invalidated, so when an IO
    access is requested a segfault occured.
    
    Signed-off-by: Julien Grall <julien.grall@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-mapcache.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/xen-mapcache.c b/xen-mapcache.c
index eade816..16b7a86 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -385,6 +385,9 @@ void xen_invalidate_map_cache(void)
         if (entry->vaddr_base == NULL) {
             continue;
         }
+        if (entry->lock > 0) {
+            continue;
+        }
 
         if (munmap(entry->vaddr_base, entry->size) != 0) {
             perror("unmap fails");
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:33 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33: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 1SKU4f-0004oZ-TE; Wed, 18 Apr 2012 12:33:29 +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 1SKU4e-0004oE-3N
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:28 +0000
Received: from [85.158.143.35:55714] by server-3.bemta-4.messagelabs.com id
	D0/79-05853-794BE8F4; Wed, 18 Apr 2012 12:33:27 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-9.tower-21.messagelabs.com!1334752405!5499085!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30088 invoked from network); 18 Apr 2012 12:33:26 -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;
	18 Apr 2012 12:33:26 -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 1SKU4b-0006uQ-Es
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:25 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4b-00077j-45
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:25 +0000
Date: Wed, 18 Apr 2012 12:33:25 +0000
Message-Id: <E1SKU4b-00077j-45@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen-mapcache: don't unmap
	locked entry during mapcache invalidation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit a74b7770924e3825e2d64b85fbf2f927419e513f
Author: Julien Grall <julien.grall@citrix.com>
Date:   Fri Apr 13 17:33:02 2012 +0000

    xen-mapcache: don't unmap locked entry during mapcache invalidation
    
    When an IOREQ_TYPE_INVALIDATE is sent to QEMU, it invalidates all entry
    of the map cache even if it's locked.
    
    QEMU is not able to know that entry was invalidated, so when an IO
    access is requested a segfault occured.
    
    Signed-off-by: Julien Grall <julien.grall@citrix.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-mapcache.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/xen-mapcache.c b/xen-mapcache.c
index eade816..16b7a86 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -385,6 +385,9 @@ void xen_invalidate_map_cache(void)
         if (entry->vaddr_base == NULL) {
             continue;
         }
+        if (entry->lock > 0) {
+            continue;
+        }
 
         if (munmap(entry->vaddr_base, entry->size) != 0) {
             perror("unmap fails");
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:44 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKU4r-0004pp-0E; Wed, 18 Apr 2012 12:33:41 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4o-0004pW-Mf
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:38 +0000
Received: from [85.158.138.51:5984] by server-12.bemta-3.messagelabs.com id
	8D/CC-29760-1A4BE8F4; Wed, 18 Apr 2012 12:33:37 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-3.tower-174.messagelabs.com!1334752415!22661347!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11675 invoked from network); 18 Apr 2012 12:33:37 -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;
	18 Apr 2012 12:33:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4l-0006uZ-JJ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4l-000788-Hv
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:35 +0000
Date: Wed, 18 Apr 2012 12:33:35 +0000
Message-Id: <E1SKU4l-000788-Hv@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: introduce an event
	channel for buffered io event notifications
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit ddb2abf7754fa2f968d4a4a57ff07d345e3c1e37
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Apr 13 17:46:01 2012 +0000

    xen: introduce an event channel for buffered io event notifications
    
    Use the newly introduced HVM_PARAM_BUFIOREQ_EVTCHN to receive
    notifications for buffered io events.
    After the first notification is received leave the event channel masked
    and setup a timer to process the rest of the batch.
    Once we have completed processing the batch, unmask the event channel
    and delete the timer.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c |   45 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 8d12915..d63d379 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -53,6 +53,9 @@ static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu)
 }
 #  define FMT_ioreq_size "u"
 #endif
+#ifndef HVM_PARAM_BUFIOREQ_EVTCHN
+#define HVM_PARAM_BUFIOREQ_EVTCHN 26
+#endif
 
 #define BUFFER_IO_MAX_DELAY  100
 
@@ -71,6 +74,8 @@ typedef struct XenIOState {
     QEMUTimer *buffered_io_timer;
     /* the evtchn port for polling the notification, */
     evtchn_port_t *ioreq_local_port;
+    /* evtchn local port for buffered io */
+    evtchn_port_t bufioreq_local_port;
     /* the evtchn fd for polling */
     XenEvtchn xce_handle;
     /* which vcpu we are serving */
@@ -567,6 +572,12 @@ static ioreq_t *cpu_get_ioreq(XenIOState *state)
     evtchn_port_t port;
 
     port = xc_evtchn_pending(state->xce_handle);
+    if (port == state->bufioreq_local_port) {
+        qemu_mod_timer(state->buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock_ms(rt_clock));
+        return NULL;
+    }
+
     if (port != -1) {
         for (i = 0; i < smp_cpus; i++) {
             if (state->ioreq_local_port[i] == port) {
@@ -715,16 +726,18 @@ static void handle_ioreq(ioreq_t *req)
     }
 }
 
-static void handle_buffered_iopage(XenIOState *state)
+static int handle_buffered_iopage(XenIOState *state)
 {
     buf_ioreq_t *buf_req = NULL;
     ioreq_t req;
     int qw;
 
     if (!state->buffered_io_page) {
-        return;
+        return 0;
     }
 
+    memset(&req, 0x00, sizeof(req));
+
     while (state->buffered_io_page->read_pointer != state->buffered_io_page->write_pointer) {
         buf_req = &state->buffered_io_page->buf_ioreq[
             state->buffered_io_page->read_pointer % IOREQ_BUFFER_SLOT_NUM];
@@ -749,15 +762,21 @@ static void handle_buffered_iopage(XenIOState *state)
         xen_mb();
         state->buffered_io_page->read_pointer += qw ? 2 : 1;
     }
+
+    return req.count;
 }
 
 static void handle_buffered_io(void *opaque)
 {
     XenIOState *state = opaque;
 
-    handle_buffered_iopage(state);
-    qemu_mod_timer(state->buffered_io_timer,
-                   BUFFER_IO_MAX_DELAY + qemu_get_clock_ms(rt_clock));
+    if (handle_buffered_iopage(state)) {
+        qemu_mod_timer(state->buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock_ms(rt_clock));
+    } else {
+        qemu_del_timer(state->buffered_io_timer);
+        xc_evtchn_unmask(state->xce_handle, state->bufioreq_local_port);
+    }
 }
 
 static void cpu_handle_ioreq(void *opaque)
@@ -887,7 +906,6 @@ static void xen_main_loop_prepare(XenIOState *state)
 
     state->buffered_io_timer = qemu_new_timer_ms(rt_clock, handle_buffered_io,
                                                  state);
-    qemu_mod_timer(state->buffered_io_timer, qemu_get_clock_ms(rt_clock));
 
     if (evtchn_fd != -1) {
         qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state);
@@ -988,6 +1006,7 @@ int xen_hvm_init(void)
 {
     int i, rc;
     unsigned long ioreq_pfn;
+    unsigned long bufioreq_evtchn;
     XenIOState *state;
 
     state = g_malloc0(sizeof (XenIOState));
@@ -1037,6 +1056,20 @@ int xen_hvm_init(void)
         state->ioreq_local_port[i] = rc;
     }
 
+    rc = xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_BUFIOREQ_EVTCHN,
+            &bufioreq_evtchn);
+    if (rc < 0) {
+        fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n");
+        return -1;
+    }
+    rc = xc_evtchn_bind_interdomain(state->xce_handle, xen_domid,
+            (uint32_t)bufioreq_evtchn);
+    if (rc == -1) {
+        fprintf(stderr, "bind interdomain ioctl error %d\n", errno);
+        return -1;
+    }
+    state->bufioreq_local_port = rc;
+
     /* Init RAM management */
     xen_map_cache_init(xen_phys_offset_to_gaddr, state);
     xen_ram_init(ram_size);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:44 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKU4r-0004pp-0E; Wed, 18 Apr 2012 12:33:41 +0000
Received: from mail6.bemta3.messagelabs.com ([195.245.230.39])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4o-0004pW-Mf
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:38 +0000
Received: from [85.158.138.51:5984] by server-12.bemta-3.messagelabs.com id
	8D/CC-29760-1A4BE8F4; Wed, 18 Apr 2012 12:33:37 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-3.tower-174.messagelabs.com!1334752415!22661347!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11675 invoked from network); 18 Apr 2012 12:33:37 -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;
	18 Apr 2012 12:33:37 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4l-0006uZ-JJ
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:35 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4l-000788-Hv
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:35 +0000
Date: Wed, 18 Apr 2012 12:33:35 +0000
Message-Id: <E1SKU4l-000788-Hv@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: introduce an event
	channel for buffered io event notifications
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit ddb2abf7754fa2f968d4a4a57ff07d345e3c1e37
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Fri Apr 13 17:46:01 2012 +0000

    xen: introduce an event channel for buffered io event notifications
    
    Use the newly introduced HVM_PARAM_BUFIOREQ_EVTCHN to receive
    notifications for buffered io events.
    After the first notification is received leave the event channel masked
    and setup a timer to process the rest of the batch.
    Once we have completed processing the batch, unmask the event channel
    and delete the timer.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 xen-all.c |   45 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 8d12915..d63d379 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -53,6 +53,9 @@ static inline ioreq_t *xen_vcpu_ioreq(shared_iopage_t *shared_page, int vcpu)
 }
 #  define FMT_ioreq_size "u"
 #endif
+#ifndef HVM_PARAM_BUFIOREQ_EVTCHN
+#define HVM_PARAM_BUFIOREQ_EVTCHN 26
+#endif
 
 #define BUFFER_IO_MAX_DELAY  100
 
@@ -71,6 +74,8 @@ typedef struct XenIOState {
     QEMUTimer *buffered_io_timer;
     /* the evtchn port for polling the notification, */
     evtchn_port_t *ioreq_local_port;
+    /* evtchn local port for buffered io */
+    evtchn_port_t bufioreq_local_port;
     /* the evtchn fd for polling */
     XenEvtchn xce_handle;
     /* which vcpu we are serving */
@@ -567,6 +572,12 @@ static ioreq_t *cpu_get_ioreq(XenIOState *state)
     evtchn_port_t port;
 
     port = xc_evtchn_pending(state->xce_handle);
+    if (port == state->bufioreq_local_port) {
+        qemu_mod_timer(state->buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock_ms(rt_clock));
+        return NULL;
+    }
+
     if (port != -1) {
         for (i = 0; i < smp_cpus; i++) {
             if (state->ioreq_local_port[i] == port) {
@@ -715,16 +726,18 @@ static void handle_ioreq(ioreq_t *req)
     }
 }
 
-static void handle_buffered_iopage(XenIOState *state)
+static int handle_buffered_iopage(XenIOState *state)
 {
     buf_ioreq_t *buf_req = NULL;
     ioreq_t req;
     int qw;
 
     if (!state->buffered_io_page) {
-        return;
+        return 0;
     }
 
+    memset(&req, 0x00, sizeof(req));
+
     while (state->buffered_io_page->read_pointer != state->buffered_io_page->write_pointer) {
         buf_req = &state->buffered_io_page->buf_ioreq[
             state->buffered_io_page->read_pointer % IOREQ_BUFFER_SLOT_NUM];
@@ -749,15 +762,21 @@ static void handle_buffered_iopage(XenIOState *state)
         xen_mb();
         state->buffered_io_page->read_pointer += qw ? 2 : 1;
     }
+
+    return req.count;
 }
 
 static void handle_buffered_io(void *opaque)
 {
     XenIOState *state = opaque;
 
-    handle_buffered_iopage(state);
-    qemu_mod_timer(state->buffered_io_timer,
-                   BUFFER_IO_MAX_DELAY + qemu_get_clock_ms(rt_clock));
+    if (handle_buffered_iopage(state)) {
+        qemu_mod_timer(state->buffered_io_timer,
+                BUFFER_IO_MAX_DELAY + qemu_get_clock_ms(rt_clock));
+    } else {
+        qemu_del_timer(state->buffered_io_timer);
+        xc_evtchn_unmask(state->xce_handle, state->bufioreq_local_port);
+    }
 }
 
 static void cpu_handle_ioreq(void *opaque)
@@ -887,7 +906,6 @@ static void xen_main_loop_prepare(XenIOState *state)
 
     state->buffered_io_timer = qemu_new_timer_ms(rt_clock, handle_buffered_io,
                                                  state);
-    qemu_mod_timer(state->buffered_io_timer, qemu_get_clock_ms(rt_clock));
 
     if (evtchn_fd != -1) {
         qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state);
@@ -988,6 +1006,7 @@ int xen_hvm_init(void)
 {
     int i, rc;
     unsigned long ioreq_pfn;
+    unsigned long bufioreq_evtchn;
     XenIOState *state;
 
     state = g_malloc0(sizeof (XenIOState));
@@ -1037,6 +1056,20 @@ int xen_hvm_init(void)
         state->ioreq_local_port[i] = rc;
     }
 
+    rc = xc_get_hvm_param(xen_xc, xen_domid, HVM_PARAM_BUFIOREQ_EVTCHN,
+            &bufioreq_evtchn);
+    if (rc < 0) {
+        fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n");
+        return -1;
+    }
+    rc = xc_evtchn_bind_interdomain(state->xce_handle, xen_domid,
+            (uint32_t)bufioreq_evtchn);
+    if (rc == -1) {
+        fprintf(stderr, "bind interdomain ioctl error %d\n", errno);
+        return -1;
+    }
+    state->bufioreq_local_port = rc;
+
     /* Init RAM management */
     xen_map_cache_init(xen_phys_offset_to_gaddr, state);
     xen_ram_init(ram_size);
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:52 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKU50-0004rU-39; Wed, 18 Apr 2012 12:33:50 +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 1SKU4y-0004r0-Gf
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:48 +0000
Received: from [85.158.143.35:53460] by server-3.bemta-4.messagelabs.com id
	C3/1A-05853-BA4BE8F4; Wed, 18 Apr 2012 12:33:47 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-21.messagelabs.com!1334752426!15086577!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31191 invoked from network); 18 Apr 2012 12:33:47 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 12:33:47 -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 1SKU4v-0006uf-Ve
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4v-00078Y-Ma
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:45 +0000
Date: Wed, 18 Apr 2012 12:33:45 +0000
Message-Id: <E1SKU4v-00078Y-Ma@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: Support guest reboots
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit fcd11a4f9f279ee89686706fe1cedf36cf9a7ee7
Author: John V. Baboval <john.baboval@virtualcomputer.com>
Date:   Tue Apr 17 15:42:41 2012 +0000

    xen: Support guest reboots
    
    Call xc_domain_shutdown with the reboot flag when the guest requests a reboot.
    
    Signed-off-by: John V. Baboval <john.baboval@virtualcomputer.com>
    Signed-off-by: Tom Goetz <tom.goetz@virtualcomputer.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/xen_common.h |    2 +-
 xen-all.c       |   18 +++++++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/xen_common.h b/hw/xen_common.h
index 0409ac7..bb5a12f 100644
--- a/hw/xen_common.h
+++ b/hw/xen_common.h
@@ -133,6 +133,6 @@ static inline int xc_fd(xc_interface *xen_xc)
 }
 #endif
 
-void destroy_hvm_domain(void);
+void destroy_hvm_domain(bool reboot);
 
 #endif /* QEMU_HW_XEN_COMMON_H */
diff --git a/xen-all.c b/xen-all.c
index d63d379..6d6f400 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -794,7 +794,7 @@ static void cpu_handle_ioreq(void *opaque)
                     "data: %"PRIx64", count: %" FMT_ioreq_size ", size: %" FMT_ioreq_size "\n",
                     req->state, req->data_is_ptr, req->addr,
                     req->data, req->count, req->size);
-            destroy_hvm_domain();
+            destroy_hvm_domain(false);
             return;
         }
 
@@ -808,10 +808,11 @@ static void cpu_handle_ioreq(void *opaque)
          */
         if (runstate_is_running()) {
             if (qemu_shutdown_requested_get()) {
-                destroy_hvm_domain();
+                destroy_hvm_domain(false);
             }
             if (qemu_reset_requested_get()) {
                 qemu_system_reset(VMRESET_REPORT);
+                destroy_hvm_domain(true);
             }
         }
 
@@ -1094,7 +1095,7 @@ int xen_hvm_init(void)
     return 0;
 }
 
-void destroy_hvm_domain(void)
+void destroy_hvm_domain(bool reboot)
 {
     XenXC xc_handle;
     int sts;
@@ -1103,12 +1104,15 @@ void destroy_hvm_domain(void)
     if (xc_handle == XC_HANDLER_INITIAL_VALUE) {
         fprintf(stderr, "Cannot acquire xenctrl handle\n");
     } else {
-        sts = xc_domain_shutdown(xc_handle, xen_domid, SHUTDOWN_poweroff);
+        sts = xc_domain_shutdown(xc_handle, xen_domid,
+                                 reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff);
         if (sts != 0) {
-            fprintf(stderr, "? xc_domain_shutdown failed to issue poweroff, "
-                    "sts %d, %s\n", sts, strerror(errno));
+            fprintf(stderr, "xc_domain_shutdown failed to issue %s, "
+                    "sts %d, %s\n", reboot ? "reboot" : "poweroff",
+                    sts, strerror(errno));
         } else {
-            fprintf(stderr, "Issued domain %d poweroff\n", xen_domid);
+            fprintf(stderr, "Issued domain %d %s\n", xen_domid,
+                    reboot ? "reboot" : "poweroff");
         }
         xc_interface_close(xc_handle);
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Wed Apr 18 12:33:52 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Apr 2012 12:33:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xen.org)
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen-changelog-bounces@lists.xen.org>)
	id 1SKU50-0004rU-39; Wed, 18 Apr 2012 12:33:50 +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 1SKU4y-0004r0-Gf
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:48 +0000
Received: from [85.158.143.35:53460] by server-3.bemta-4.messagelabs.com id
	C3/1A-05853-BA4BE8F4; Wed, 18 Apr 2012 12:33:47 +0000
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-13.tower-21.messagelabs.com!1334752426!15086577!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31191 invoked from network); 18 Apr 2012 12:33:47 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	18 Apr 2012 12:33:47 -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 1SKU4v-0006uf-Ve
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:45 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1SKU4v-00078Y-Ma
	for xen-changelog@lists.xensource.com; Wed, 18 Apr 2012 12:33:45 +0000
Date: Wed, 18 Apr 2012 12:33:45 +0000
Message-Id: <E1SKU4v-00078Y-Ma@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-upstream-unstable] xen: Support guest reboots
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

commit fcd11a4f9f279ee89686706fe1cedf36cf9a7ee7
Author: John V. Baboval <john.baboval@virtualcomputer.com>
Date:   Tue Apr 17 15:42:41 2012 +0000

    xen: Support guest reboots
    
    Call xc_domain_shutdown with the reboot flag when the guest requests a reboot.
    
    Signed-off-by: John V. Baboval <john.baboval@virtualcomputer.com>
    Signed-off-by: Tom Goetz <tom.goetz@virtualcomputer.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/xen_common.h |    2 +-
 xen-all.c       |   18 +++++++++++-------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/xen_common.h b/hw/xen_common.h
index 0409ac7..bb5a12f 100644
--- a/hw/xen_common.h
+++ b/hw/xen_common.h
@@ -133,6 +133,6 @@ static inline int xc_fd(xc_interface *xen_xc)
 }
 #endif
 
-void destroy_hvm_domain(void);
+void destroy_hvm_domain(bool reboot);
 
 #endif /* QEMU_HW_XEN_COMMON_H */
diff --git a/xen-all.c b/xen-all.c
index d63d379..6d6f400 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -794,7 +794,7 @@ static void cpu_handle_ioreq(void *opaque)
                     "data: %"PRIx64", count: %" FMT_ioreq_size ", size: %" FMT_ioreq_size "\n",
                     req->state, req->data_is_ptr, req->addr,
                     req->data, req->count, req->size);
-            destroy_hvm_domain();
+            destroy_hvm_domain(false);
             return;
         }
 
@@ -808,10 +808,11 @@ static void cpu_handle_ioreq(void *opaque)
          */
         if (runstate_is_running()) {
             if (qemu_shutdown_requested_get()) {
-                destroy_hvm_domain();
+                destroy_hvm_domain(false);
             }
             if (qemu_reset_requested_get()) {
                 qemu_system_reset(VMRESET_REPORT);
+                destroy_hvm_domain(true);
             }
         }
 
@@ -1094,7 +1095,7 @@ int xen_hvm_init(void)
     return 0;
 }
 
-void destroy_hvm_domain(void)
+void destroy_hvm_domain(bool reboot)
 {
     XenXC xc_handle;
     int sts;
@@ -1103,12 +1104,15 @@ void destroy_hvm_domain(void)
     if (xc_handle == XC_HANDLER_INITIAL_VALUE) {
         fprintf(stderr, "Cannot acquire xenctrl handle\n");
     } else {
-        sts = xc_domain_shutdown(xc_handle, xen_domid, SHUTDOWN_poweroff);
+        sts = xc_domain_shutdown(xc_handle, xen_domid,
+                                 reboot ? SHUTDOWN_reboot : SHUTDOWN_poweroff);
         if (sts != 0) {
-            fprintf(stderr, "? xc_domain_shutdown failed to issue poweroff, "
-                    "sts %d, %s\n", sts, strerror(errno));
+            fprintf(stderr, "xc_domain_shutdown failed to issue %s, "
+                    "sts %d, %s\n", reboot ? "reboot" : "poweroff",
+                    sts, strerror(errno));
         } else {
-            fprintf(stderr, "Issued domain %d poweroff\n", xen_domid);
+            fprintf(stderr, "Issued domain %d %s\n", xen_domid,
+                    reboot ? "reboot" : "poweroff");
         }
         xc_interface_close(xc_handle);
     }
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00041A-V3; Thu, 19 Apr 2012 00: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 1SKexu-00040D-Ut
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:15 +0000
Received: from [85.158.143.35:37786] by server-3.bemta-4.messagelabs.com id
	65/9F-05853-2285F8F4; Thu, 19 Apr 2012 00:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1334794272!11630875!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13858 invoked from network); 19 Apr 2012 00:11:13 -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;
	19 Apr 2012 00: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 1SKexs-0007GB-6T
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexs-0006sL-1u
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Message-Id: <E1SKexs-0006sL-1u@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1334683152 -3600
# Node ID 214ca44b931682bc4b588b690e9b494dd956dc22
# Parent  1ff80750ce31a4f628b2e6830d273fa95f1364c4
# Parent  569d6f05e1ef3146c269bca6313e2777420d616d
Merge
---


diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/io_apic.c	Tue Apr 17 18:19:12 2012 +0100
@@ -185,7 +185,7 @@ struct IO_APIC_route_entry **alloc_ioapi
         ioapic_entries[apic] =
             xmalloc_array(struct IO_APIC_route_entry,
                           nr_ioapic_entries[apic]);
-        if (!ioapic_entries[apic])
+        if (!ioapic_entries[apic] && nr_ioapic_entries[apic])
             goto nomem;
     }
 
@@ -310,6 +310,9 @@ int save_IO_APIC_setup(struct IO_APIC_ro
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -331,6 +334,9 @@ void mask_IO_APIC_setup(struct IO_APIC_r
         return;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             break;
 
@@ -358,6 +364,9 @@ int restore_IO_APIC_setup(struct IO_APIC
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -610,6 +619,8 @@ static int __init find_isa_irq_apic(int 
     if (i < mp_irq_entries) {
         int apic;
         for(apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic)
                 return apic;
         }
@@ -1080,6 +1091,8 @@ static void /*__init*/ __print_IO_APIC(v
     printk(KERN_INFO "testing the IO APIC.......................\n");
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
 	spin_lock_irqsave(&ioapic_lock, flags);
 	reg_00.raw = io_apic_read(apic, 0);
@@ -1229,6 +1242,8 @@ static void __init enable_IO_APIC(void)
 
     if (directed_eoi_enabled) {
         for (apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             vector_map[apic] = xzalloc(vmask_t);
             BUG_ON(!vector_map[apic]);
         }
@@ -1354,6 +1369,8 @@ static void __init setup_ioapic_ids_from
      * Set the IOAPIC ID to the value stored in the MPC table.
      */
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
         /* Read the register 0 value */
         spin_lock_irqsave(&ioapic_lock, flags);
@@ -2038,6 +2055,8 @@ void ioapic_resume(void)
 
     spin_lock_irqsave(&ioapic_lock, flags);
     for (apic = 0; apic < nr_ioapics; apic++){
+        if (!nr_ioapic_entries[apic])
+            continue;
         reg_00.raw = __io_apic_read(apic, 0);
         if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) {
             reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
@@ -2164,8 +2183,8 @@ int io_apic_set_pci_routing (int ioapic,
     int vector;
 
     if (!IO_APIC_IRQ(irq)) {
-        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
-               ioapic);
+        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ %d\n",
+               ioapic, irq);
         return -EINVAL;
     }
 
@@ -2225,8 +2244,12 @@ static int ioapic_physbase_to_id(unsigne
 {
     int apic;
     for ( apic = 0; apic < nr_ioapics; apic++ )
+    {
+        if ( !nr_ioapic_entries[apic] )
+            continue;
         if ( mp_ioapics[apic].mpc_apicaddr == physbase )
             return apic;
+    }
     return -EINVAL;
 }
 
@@ -2444,6 +2467,22 @@ void dump_ioapic_irq_info(void)
 static unsigned int __initdata max_gsi_irqs;
 integer_param("max_gsi_irqs", max_gsi_irqs);
 
+static __init bool_t bad_ioapic_register(unsigned int idx)
+{
+    union IO_APIC_reg_00 reg_00 = { .raw = io_apic_read(idx, 0) };
+    union IO_APIC_reg_01 reg_01 = { .raw = io_apic_read(idx, 1) };
+    union IO_APIC_reg_02 reg_02 = { .raw = io_apic_read(idx, 2) };
+
+    if ( reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1 )
+    {
+        printk(KERN_WARNING "I/O APIC %#x registers return all ones, skipping!\n",
+               mp_ioapics[idx].mpc_apicaddr);
+        return 1;
+    }
+
+    return 0;
+}
+
 void __init init_ioapic_mappings(void)
 {
     unsigned long ioapic_phys;
@@ -2477,6 +2516,12 @@ void __init init_ioapic_mappings(void)
                     __fix_to_virt(idx), ioapic_phys);
         idx++;
 
+        if ( bad_ioapic_register(i) )
+        {
+            __set_fixmap(idx, 0, 0);
+            continue;
+        }
+
         if ( smp_found_config )
         {
             /* The number of IO-APIC IRQ registers (== #pins): */
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/mpparse.c	Tue Apr 17 18:19:12 2012 +0100
@@ -1034,6 +1034,21 @@ int mp_register_gsi (u32 gsi, int trigge
 		return gsi;
 #endif
 
+	if (!nr_ioapics) {
+		unsigned int port = 0x4d0 + (gsi >> 3);
+		u8 val;
+
+		if (!platform_legacy_irq(gsi))
+			return -EINVAL;
+		val = inb(port);
+		if (triggering)
+			val |= 1 << (gsi & 7);
+		else
+			val &= ~(1 << (gsi & 7));
+		outb(val, port);
+		return 0;
+	}
+
 	ioapic = mp_find_ioapic(gsi);
 	if (ioapic < 0) {
 		printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 18:19:12 2012 +0100
@@ -145,6 +145,7 @@ void __dummy__(void)
 
     OFFSET(TRAPINFO_eip, struct trap_info, address);
     OFFSET(TRAPINFO_cs, struct trap_info, cs);
+    OFFSET(TRAPINFO_flags, struct trap_info, flags);
     DEFINE(TRAPINFO_sizeof, sizeof(struct trap_info));
     BLANK();
 
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 18:19:12 2012 +0100
@@ -213,6 +213,7 @@ 1:      call  compat_create_bounce_frame
 ENTRY(compat_post_handle_exception)
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    compat_test_all_events
+.Lcompat_bounce_exception:
         call  compat_create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   compat_test_all_events
@@ -225,20 +226,21 @@ ENTRY(compat_syscall)
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testl $~3,%esi
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  %rax,TRAPBOUNCE_eip(%rdx)
+UNLIKELY_START(z, compat_syscall_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rdi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subl  $2,UREGS_rip(%rsp)
+        movl  $0,TRAPBOUNCE_error_code(%rdx)
+        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rdi),%eax
+        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rdi),%esi
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rdi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(compat_syscall_gpf)
+        movq  %rax,TRAPBOUNCE_eip(%rdx)
         movw  %si,TRAPBOUNCE_cs(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
-        call  compat_create_bounce_frame
-        jmp   compat_test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rsi
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        subl  $2,UREGS_rip(%rsp)
-        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%eax
-        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rsi),%esi
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $0,TRAPBOUNCE_error_code(%rdx)
-        jmp   1b
+        jmp   .Lcompat_bounce_exception
 
 ENTRY(compat_sysenter)
         movq  VCPU_trap_ctxt(%rbx),%rcx
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/entry.S	Tue Apr 17 18:19:12 2012 +0100
@@ -277,20 +277,22 @@ sysenter_eflags_saved:
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testq %rax,%rax
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  VCPU_domain(%rbx),%rdi
+UNLIKELY_START(z, sysenter_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rsi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subq  $2,UREGS_rip(%rsp)
+        movl  %eax,TRAPBOUNCE_error_code(%rdx)
+        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%rax
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rsi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(sysenter_gpf)
+        movq  VCPU_domain(%rbx),%rdi
         movq  %rax,TRAPBOUNCE_eip(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         testb $1,DOMAIN_is_32bit_pv(%rdi)
         jnz   compat_sysenter
-        call  create_bounce_frame
-        jmp   test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rcx
-        movl  %eax,TRAPBOUNCE_error_code(%rdx)
-        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rcx),%rax
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        jmp   1b
+        jmp   .Lbounce_exception
 
 ENTRY(int80_direct_trap)
         pushq $0
@@ -483,6 +485,7 @@ 1:      movq  %rsp,%rdi
         jnz   compat_post_handle_exception
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    test_all_events
+.Lbounce_exception:
         call  create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   test_all_events

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKext-0003zq-7Z; Thu, 19 Apr 2012 00: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 1SKexr-0003zY-G4
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Received: from [85.158.138.51:13668] by server-6.bemta-3.messagelabs.com id
	86/DD-05145-E185F8F4; Thu, 19 Apr 2012 00:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1334794269!18585582!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26503 invoked from network); 19 Apr 2012 00:11:10 -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;
	19 Apr 2012 00: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 1SKexo-0007Fq-PT
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexo-0006qa-Bq
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:08 +0000
Message-Id: <E1SKexo-0006qa-Bq@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] gnttab: remove pointless NULL check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334667905 -7200
# Node ID 6092641e364428e7be20c9e23497d7a1fc535112
# Parent  6017afc7044265109d98098b3c3adf7f28081858
gnttab: remove pointless NULL check

Domains in the domain hash (and hence locatable via the usual lookup
functions) can't have a NULL grant table pointer; no other function
performs such a check, so remove it from gnttab_prepare_for_transfer()
for consistency.

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


diff -r 6017afc70442 -r 6092641e3644 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Tue Apr 17 08:31:07 2012 +0100
+++ b/xen/common/grant_table.c	Tue Apr 17 15:05:05 2012 +0200
@@ -1390,17 +1390,11 @@ static int
 gnttab_prepare_for_transfer(
     struct domain *rd, struct domain *ld, grant_ref_t ref)
 {
-    struct grant_table *rgt;
+    struct grant_table *rgt = rd->grant_table;
     grant_entry_header_t *sha;
     union grant_combo   scombo, prev_scombo, new_scombo;
     int                 retries = 0;
 
-    if ( unlikely((rgt = rd->grant_table) == NULL) )
-    {
-        gdprintk(XENLOG_INFO, "Dom %d has no grant table.\n", rd->domain_id);
-        return 0;
-    }
-
     spin_lock(&rgt->lock);
 
     if ( rgt->gt_version == 0 )

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00041A-V3; Thu, 19 Apr 2012 00: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 1SKexu-00040D-Ut
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:15 +0000
Received: from [85.158.143.35:37786] by server-3.bemta-4.messagelabs.com id
	65/9F-05853-2285F8F4; Thu, 19 Apr 2012 00:11:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1334794272!11630875!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13858 invoked from network); 19 Apr 2012 00:11:13 -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;
	19 Apr 2012 00: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 1SKexs-0007GB-6T
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexs-0006sL-1u
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Message-Id: <E1SKexs-0006sL-1u@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1334683152 -3600
# Node ID 214ca44b931682bc4b588b690e9b494dd956dc22
# Parent  1ff80750ce31a4f628b2e6830d273fa95f1364c4
# Parent  569d6f05e1ef3146c269bca6313e2777420d616d
Merge
---


diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/io_apic.c	Tue Apr 17 18:19:12 2012 +0100
@@ -185,7 +185,7 @@ struct IO_APIC_route_entry **alloc_ioapi
         ioapic_entries[apic] =
             xmalloc_array(struct IO_APIC_route_entry,
                           nr_ioapic_entries[apic]);
-        if (!ioapic_entries[apic])
+        if (!ioapic_entries[apic] && nr_ioapic_entries[apic])
             goto nomem;
     }
 
@@ -310,6 +310,9 @@ int save_IO_APIC_setup(struct IO_APIC_ro
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -331,6 +334,9 @@ void mask_IO_APIC_setup(struct IO_APIC_r
         return;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             break;
 
@@ -358,6 +364,9 @@ int restore_IO_APIC_setup(struct IO_APIC
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -610,6 +619,8 @@ static int __init find_isa_irq_apic(int 
     if (i < mp_irq_entries) {
         int apic;
         for(apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic)
                 return apic;
         }
@@ -1080,6 +1091,8 @@ static void /*__init*/ __print_IO_APIC(v
     printk(KERN_INFO "testing the IO APIC.......................\n");
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
 	spin_lock_irqsave(&ioapic_lock, flags);
 	reg_00.raw = io_apic_read(apic, 0);
@@ -1229,6 +1242,8 @@ static void __init enable_IO_APIC(void)
 
     if (directed_eoi_enabled) {
         for (apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             vector_map[apic] = xzalloc(vmask_t);
             BUG_ON(!vector_map[apic]);
         }
@@ -1354,6 +1369,8 @@ static void __init setup_ioapic_ids_from
      * Set the IOAPIC ID to the value stored in the MPC table.
      */
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
         /* Read the register 0 value */
         spin_lock_irqsave(&ioapic_lock, flags);
@@ -2038,6 +2055,8 @@ void ioapic_resume(void)
 
     spin_lock_irqsave(&ioapic_lock, flags);
     for (apic = 0; apic < nr_ioapics; apic++){
+        if (!nr_ioapic_entries[apic])
+            continue;
         reg_00.raw = __io_apic_read(apic, 0);
         if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) {
             reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
@@ -2164,8 +2183,8 @@ int io_apic_set_pci_routing (int ioapic,
     int vector;
 
     if (!IO_APIC_IRQ(irq)) {
-        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
-               ioapic);
+        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ %d\n",
+               ioapic, irq);
         return -EINVAL;
     }
 
@@ -2225,8 +2244,12 @@ static int ioapic_physbase_to_id(unsigne
 {
     int apic;
     for ( apic = 0; apic < nr_ioapics; apic++ )
+    {
+        if ( !nr_ioapic_entries[apic] )
+            continue;
         if ( mp_ioapics[apic].mpc_apicaddr == physbase )
             return apic;
+    }
     return -EINVAL;
 }
 
@@ -2444,6 +2467,22 @@ void dump_ioapic_irq_info(void)
 static unsigned int __initdata max_gsi_irqs;
 integer_param("max_gsi_irqs", max_gsi_irqs);
 
+static __init bool_t bad_ioapic_register(unsigned int idx)
+{
+    union IO_APIC_reg_00 reg_00 = { .raw = io_apic_read(idx, 0) };
+    union IO_APIC_reg_01 reg_01 = { .raw = io_apic_read(idx, 1) };
+    union IO_APIC_reg_02 reg_02 = { .raw = io_apic_read(idx, 2) };
+
+    if ( reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1 )
+    {
+        printk(KERN_WARNING "I/O APIC %#x registers return all ones, skipping!\n",
+               mp_ioapics[idx].mpc_apicaddr);
+        return 1;
+    }
+
+    return 0;
+}
+
 void __init init_ioapic_mappings(void)
 {
     unsigned long ioapic_phys;
@@ -2477,6 +2516,12 @@ void __init init_ioapic_mappings(void)
                     __fix_to_virt(idx), ioapic_phys);
         idx++;
 
+        if ( bad_ioapic_register(i) )
+        {
+            __set_fixmap(idx, 0, 0);
+            continue;
+        }
+
         if ( smp_found_config )
         {
             /* The number of IO-APIC IRQ registers (== #pins): */
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/mpparse.c	Tue Apr 17 18:19:12 2012 +0100
@@ -1034,6 +1034,21 @@ int mp_register_gsi (u32 gsi, int trigge
 		return gsi;
 #endif
 
+	if (!nr_ioapics) {
+		unsigned int port = 0x4d0 + (gsi >> 3);
+		u8 val;
+
+		if (!platform_legacy_irq(gsi))
+			return -EINVAL;
+		val = inb(port);
+		if (triggering)
+			val |= 1 << (gsi & 7);
+		else
+			val &= ~(1 << (gsi & 7));
+		outb(val, port);
+		return 0;
+	}
+
 	ioapic = mp_find_ioapic(gsi);
 	if (ioapic < 0) {
 		printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 18:19:12 2012 +0100
@@ -145,6 +145,7 @@ void __dummy__(void)
 
     OFFSET(TRAPINFO_eip, struct trap_info, address);
     OFFSET(TRAPINFO_cs, struct trap_info, cs);
+    OFFSET(TRAPINFO_flags, struct trap_info, flags);
     DEFINE(TRAPINFO_sizeof, sizeof(struct trap_info));
     BLANK();
 
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 18:19:12 2012 +0100
@@ -213,6 +213,7 @@ 1:      call  compat_create_bounce_frame
 ENTRY(compat_post_handle_exception)
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    compat_test_all_events
+.Lcompat_bounce_exception:
         call  compat_create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   compat_test_all_events
@@ -225,20 +226,21 @@ ENTRY(compat_syscall)
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testl $~3,%esi
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  %rax,TRAPBOUNCE_eip(%rdx)
+UNLIKELY_START(z, compat_syscall_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rdi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subl  $2,UREGS_rip(%rsp)
+        movl  $0,TRAPBOUNCE_error_code(%rdx)
+        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rdi),%eax
+        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rdi),%esi
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rdi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(compat_syscall_gpf)
+        movq  %rax,TRAPBOUNCE_eip(%rdx)
         movw  %si,TRAPBOUNCE_cs(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
-        call  compat_create_bounce_frame
-        jmp   compat_test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rsi
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        subl  $2,UREGS_rip(%rsp)
-        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%eax
-        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rsi),%esi
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $0,TRAPBOUNCE_error_code(%rdx)
-        jmp   1b
+        jmp   .Lcompat_bounce_exception
 
 ENTRY(compat_sysenter)
         movq  VCPU_trap_ctxt(%rbx),%rcx
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S	Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/entry.S	Tue Apr 17 18:19:12 2012 +0100
@@ -277,20 +277,22 @@ sysenter_eflags_saved:
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testq %rax,%rax
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  VCPU_domain(%rbx),%rdi
+UNLIKELY_START(z, sysenter_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rsi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subq  $2,UREGS_rip(%rsp)
+        movl  %eax,TRAPBOUNCE_error_code(%rdx)
+        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%rax
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rsi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(sysenter_gpf)
+        movq  VCPU_domain(%rbx),%rdi
         movq  %rax,TRAPBOUNCE_eip(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         testb $1,DOMAIN_is_32bit_pv(%rdi)
         jnz   compat_sysenter
-        call  create_bounce_frame
-        jmp   test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rcx
-        movl  %eax,TRAPBOUNCE_error_code(%rdx)
-        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rcx),%rax
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        jmp   1b
+        jmp   .Lbounce_exception
 
 ENTRY(int80_direct_trap)
         pushq $0
@@ -483,6 +485,7 @@ 1:      movq  %rsp,%rdi
         jnz   compat_post_handle_exception
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    test_all_events
+.Lbounce_exception:
         call  create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   test_all_events

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKext-0003zq-7Z; Thu, 19 Apr 2012 00: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 1SKexr-0003zY-G4
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Received: from [85.158.138.51:13668] by server-6.bemta-3.messagelabs.com id
	86/DD-05145-E185F8F4; Thu, 19 Apr 2012 00:11:10 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1334794269!18585582!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26503 invoked from network); 19 Apr 2012 00:11:10 -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;
	19 Apr 2012 00: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 1SKexo-0007Fq-PT
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:08 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexo-0006qa-Bq
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:08 +0000
Message-Id: <E1SKexo-0006qa-Bq@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:07 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] gnttab: remove pointless NULL check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334667905 -7200
# Node ID 6092641e364428e7be20c9e23497d7a1fc535112
# Parent  6017afc7044265109d98098b3c3adf7f28081858
gnttab: remove pointless NULL check

Domains in the domain hash (and hence locatable via the usual lookup
functions) can't have a NULL grant table pointer; no other function
performs such a check, so remove it from gnttab_prepare_for_transfer()
for consistency.

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


diff -r 6017afc70442 -r 6092641e3644 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Tue Apr 17 08:31:07 2012 +0100
+++ b/xen/common/grant_table.c	Tue Apr 17 15:05:05 2012 +0200
@@ -1390,17 +1390,11 @@ static int
 gnttab_prepare_for_transfer(
     struct domain *rd, struct domain *ld, grant_ref_t ref)
 {
-    struct grant_table *rgt;
+    struct grant_table *rgt = rd->grant_table;
     grant_entry_header_t *sha;
     union grant_combo   scombo, prev_scombo, new_scombo;
     int                 retries = 0;
 
-    if ( unlikely((rgt = rd->grant_table) == NULL) )
-    {
-        gdprintk(XENLOG_INFO, "Dom %d has no grant table.\n", rd->domain_id);
-        return 0;
-    }
-
     spin_lock(&rgt->lock);
 
     if ( rgt->gt_version == 0 )

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-000410-Q2; Thu, 19 Apr 2012 00: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 1SKexu-00040D-F0
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:14 +0000
Received: from [85.158.143.99:9048] by server-3.bemta-4.messagelabs.com id
	E4/9F-05853-1285F8F4; Thu, 19 Apr 2012 00:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1334794271!23695436!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31472 invoked from network); 19 Apr 2012 00:11:12 -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;
	19 Apr 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 1SKexr-0007G8-ID
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexr-0006s6-Gz
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Message-Id: <E1SKexr-0006s6-Gz@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libvchan: Remove unwanted
	debugging 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1334683129 -3600
# Node ID 1ff80750ce31a4f628b2e6830d273fa95f1364c4
# Parent  6092641e364428e7be20c9e23497d7a1fc535112
tools/libvchan: Remove unwanted debugging code

-O2 -Wall -Werror triggers these warnings:

io.c: In function 'do_send':
io.c:196: warning: ignoring return value of 'writev', declared with attribute warn_unused_result
io.c: In function 'do_recv':
io.c:287: warning: ignoring return value of 'writev', declared with attribute warn_unused_result

writev to -1 will always fail, silence the warning by removing the offending
(disabled) debug code.

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


diff -r 6092641e3644 -r 1ff80750ce31 tools/libvchan/io.c
--- a/tools/libvchan/io.c	Tue Apr 17 15:05:05 2012 +0200
+++ b/tools/libvchan/io.c	Tue Apr 17 18:18:49 2012 +0100
@@ -49,11 +49,6 @@
 #define PAGE_SIZE 4096
 #endif
 
-// allow vchan data to be easily observed in strace by doing a
-// writev() to FD -1 with the data being read/written.
-#ifndef VCHAN_DEBUG
-#define VCHAN_DEBUG 0
-#endif
 
 static inline uint32_t rd_prod(struct libxenvchan *ctrl)
 {
@@ -186,15 +181,6 @@ static int do_send(struct libxenvchan *c
 {
 	int real_idx = wr_prod(ctrl) & (wr_ring_size(ctrl) - 1);
 	int avail_contig = wr_ring_size(ctrl) - real_idx;
-	if (VCHAN_DEBUG) {
-		char metainfo[32];
-		struct iovec iov[2];
-		iov[0].iov_base = metainfo;
-		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p wr", ctrl);
-		iov[1].iov_base = (void *)data;
-		iov[1].iov_len = size;
-		writev(-1, iov, 2);
-	}
 	if (avail_contig > size)
 		avail_contig = size;
 	xen_mb(); /* read indexes /then/ write data */
@@ -277,15 +263,6 @@ static int do_recv(struct libxenvchan *c
 	}
 	xen_mb(); /* consume /then/ notify */
 	rd_cons(ctrl) += size;
-	if (VCHAN_DEBUG) {
-		char metainfo[32];
-		struct iovec iov[2];
-		iov[0].iov_base = metainfo;
-		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p rd", ctrl);
-		iov[1].iov_base = data;
-		iov[1].iov_len = size;
-		writev(-1, iov, 2);
-	}
 	if (send_notify(ctrl, VCHAN_NOTIFY_READ))
 		return -1;
 	return size;

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-000410-Q2; Thu, 19 Apr 2012 00: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 1SKexu-00040D-F0
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:14 +0000
Received: from [85.158.143.99:9048] by server-3.bemta-4.messagelabs.com id
	E4/9F-05853-1285F8F4; Thu, 19 Apr 2012 00:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1334794271!23695436!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31472 invoked from network); 19 Apr 2012 00:11:12 -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;
	19 Apr 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 1SKexr-0007G8-ID
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexr-0006s6-Gz
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Message-Id: <E1SKexr-0006s6-Gz@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libvchan: Remove unwanted
	debugging 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1334683129 -3600
# Node ID 1ff80750ce31a4f628b2e6830d273fa95f1364c4
# Parent  6092641e364428e7be20c9e23497d7a1fc535112
tools/libvchan: Remove unwanted debugging code

-O2 -Wall -Werror triggers these warnings:

io.c: In function 'do_send':
io.c:196: warning: ignoring return value of 'writev', declared with attribute warn_unused_result
io.c: In function 'do_recv':
io.c:287: warning: ignoring return value of 'writev', declared with attribute warn_unused_result

writev to -1 will always fail, silence the warning by removing the offending
(disabled) debug code.

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


diff -r 6092641e3644 -r 1ff80750ce31 tools/libvchan/io.c
--- a/tools/libvchan/io.c	Tue Apr 17 15:05:05 2012 +0200
+++ b/tools/libvchan/io.c	Tue Apr 17 18:18:49 2012 +0100
@@ -49,11 +49,6 @@
 #define PAGE_SIZE 4096
 #endif
 
-// allow vchan data to be easily observed in strace by doing a
-// writev() to FD -1 with the data being read/written.
-#ifndef VCHAN_DEBUG
-#define VCHAN_DEBUG 0
-#endif
 
 static inline uint32_t rd_prod(struct libxenvchan *ctrl)
 {
@@ -186,15 +181,6 @@ static int do_send(struct libxenvchan *c
 {
 	int real_idx = wr_prod(ctrl) & (wr_ring_size(ctrl) - 1);
 	int avail_contig = wr_ring_size(ctrl) - real_idx;
-	if (VCHAN_DEBUG) {
-		char metainfo[32];
-		struct iovec iov[2];
-		iov[0].iov_base = metainfo;
-		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p wr", ctrl);
-		iov[1].iov_base = (void *)data;
-		iov[1].iov_len = size;
-		writev(-1, iov, 2);
-	}
 	if (avail_contig > size)
 		avail_contig = size;
 	xen_mb(); /* read indexes /then/ write data */
@@ -277,15 +263,6 @@ static int do_recv(struct libxenvchan *c
 	}
 	xen_mb(); /* consume /then/ notify */
 	rd_cons(ctrl) += size;
-	if (VCHAN_DEBUG) {
-		char metainfo[32];
-		struct iovec iov[2];
-		iov[0].iov_base = metainfo;
-		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p rd", ctrl);
-		iov[1].iov_base = data;
-		iov[1].iov_len = size;
-		writev(-1, iov, 2);
-	}
 	if (send_notify(ctrl, VCHAN_NOTIFY_READ))
 		return -1;
 	return size;

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040l-IW; Thu, 19 Apr 2012 00: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 1SKext-0003zn-6H
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [193.109.254.147:38090] by server-5.bemta-14.messagelabs.com id
	B7/61-30733-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1334794270!5245417!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23060 invoked from network); 19 Apr 2012 00: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;
	19 Apr 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 1SKexq-0007G2-NP
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexq-0006rZ-Fg
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:10 +0000
Message-Id: <E1SKexq-0006rZ-Fg@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: suppress warning messages on
	IO-APIC-less systems
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334669825 -7200
# Node ID cf129a80e47e3664eb14070600a3b5c8c2a60440
# Parent  03cb64abd7c27b5cde4d97bbb447c9d33f808ccb
x86: suppress warning messages on IO-APIC-less systems

Each call to mp_register_gsi() so far produced two warnings (about not
being able to find the corresponding IO-APIC pin).

However, we should use the provided information for setting the ELCR
correctly (we might want to even do this when there is an IO-APIC, if
was absolutely certain that all machines really have this register
[and specifically not some other device at the two I/O ports in
question]). It is in any case questionable that we allow Dom0 to set
this register - it could particularly be the interrupt of a plug-in
serial port card that might not work due to this. The problem is that
all Dom0 kernels to date do so, hence we can't simply #GP on such an
access (which would be the result if we disallowed access to the port
as we should have done from the beginning).

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


diff -r 03cb64abd7c2 -r cf129a80e47e xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Tue Apr 17 15:36:34 2012 +0200
+++ b/xen/arch/x86/mpparse.c	Tue Apr 17 15:37:05 2012 +0200
@@ -1034,6 +1034,21 @@ int mp_register_gsi (u32 gsi, int trigge
 		return gsi;
 #endif
 
+	if (!nr_ioapics) {
+		unsigned int port = 0x4d0 + (gsi >> 3);
+		u8 val;
+
+		if (!platform_legacy_irq(gsi))
+			return -EINVAL;
+		val = inb(port);
+		if (triggering)
+			val |= 1 << (gsi & 7);
+		else
+			val &= ~(1 << (gsi & 7));
+		outb(val, port);
+		return 0;
+	}
+
 	ioapic = mp_find_ioapic(gsi);
 	if (ioapic < 0) {
 		printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:18 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040l-IW; Thu, 19 Apr 2012 00: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 1SKext-0003zn-6H
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [193.109.254.147:38090] by server-5.bemta-14.messagelabs.com id
	B7/61-30733-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1334794270!5245417!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23060 invoked from network); 19 Apr 2012 00: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;
	19 Apr 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 1SKexq-0007G2-NP
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexq-0006rZ-Fg
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:10 +0000
Message-Id: <E1SKexq-0006rZ-Fg@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: suppress warning messages on
	IO-APIC-less systems
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334669825 -7200
# Node ID cf129a80e47e3664eb14070600a3b5c8c2a60440
# Parent  03cb64abd7c27b5cde4d97bbb447c9d33f808ccb
x86: suppress warning messages on IO-APIC-less systems

Each call to mp_register_gsi() so far produced two warnings (about not
being able to find the corresponding IO-APIC pin).

However, we should use the provided information for setting the ELCR
correctly (we might want to even do this when there is an IO-APIC, if
was absolutely certain that all machines really have this register
[and specifically not some other device at the two I/O ports in
question]). It is in any case questionable that we allow Dom0 to set
this register - it could particularly be the interrupt of a plug-in
serial port card that might not work due to this. The problem is that
all Dom0 kernels to date do so, hence we can't simply #GP on such an
access (which would be the result if we disallowed access to the port
as we should have done from the beginning).

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


diff -r 03cb64abd7c2 -r cf129a80e47e xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Tue Apr 17 15:36:34 2012 +0200
+++ b/xen/arch/x86/mpparse.c	Tue Apr 17 15:37:05 2012 +0200
@@ -1034,6 +1034,21 @@ int mp_register_gsi (u32 gsi, int trigge
 		return gsi;
 #endif
 
+	if (!nr_ioapics) {
+		unsigned int port = 0x4d0 + (gsi >> 3);
+		u8 val;
+
+		if (!platform_legacy_irq(gsi))
+			return -EINVAL;
+		val = inb(port);
+		if (triggering)
+			val |= 1 << (gsi & 7);
+		else
+			val &= ~(1 << (gsi & 7));
+		outb(val, port);
+		return 0;
+	}
+
 	ioapic = mp_find_ioapic(gsi);
 	if (ioapic < 0) {
 		printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040f-Fw; Thu, 19 Apr 2012 00: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 1SKext-0003zl-4P
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [85.158.139.83:16113] by server-11.bemta-5.messagelabs.com id
	BA/FD-12959-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1334794270!24449204!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 317 invoked from network); 19 Apr 2012 00:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 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 1SKexp-0007Fw-IW
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexp-0006r5-EA
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Message-Id: <E1SKexp-0006r5-EA@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/ioapic: Add register level
	checks to detect bogus io-apic entries
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Suresh Siddha <suresh.b.siddha@intel.com>
# Date 1334669739 -7200
# Node ID 7ed4a82e771fdb014ca837e4d3306583e1247c79
# Parent  80f4113be5007f5b8a61048272193ce134b4fc28
x86/ioapic: Add register level checks to detect bogus io-apic entries

With the recent changes to clear_IO_APIC_pin() which tries to
clear remoteIRR bit explicitly, some of the users started to see
"Unable to reset IRR for apic .." messages.

Close look shows that these are related to bogus IO-APIC entries
which returns all 1s for their io-apic registers. And the
above mentioned error messages are benign. But kernel should
have ignored such io-apic's in the first place.

Check if register 0, 1, 2 of the listed io-apic are all 1s and
ignore such io-apic.

[original Linux patch:]
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 80f4113be500 -r 7ed4a82e771f xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Apr 17 15:33:53 2012 +0200
+++ b/xen/arch/x86/io_apic.c	Tue Apr 17 15:35:39 2012 +0200
@@ -185,7 +185,7 @@ struct IO_APIC_route_entry **alloc_ioapi
         ioapic_entries[apic] =
             xmalloc_array(struct IO_APIC_route_entry,
                           nr_ioapic_entries[apic]);
-        if (!ioapic_entries[apic])
+        if (!ioapic_entries[apic] && nr_ioapic_entries[apic])
             goto nomem;
     }
 
@@ -310,6 +310,9 @@ int save_IO_APIC_setup(struct IO_APIC_ro
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -331,6 +334,9 @@ void mask_IO_APIC_setup(struct IO_APIC_r
         return;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             break;
 
@@ -358,6 +364,9 @@ int restore_IO_APIC_setup(struct IO_APIC
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -610,6 +619,8 @@ static int __init find_isa_irq_apic(int 
     if (i < mp_irq_entries) {
         int apic;
         for(apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic)
                 return apic;
         }
@@ -1080,6 +1091,8 @@ static void /*__init*/ __print_IO_APIC(v
     printk(KERN_INFO "testing the IO APIC.......................\n");
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
 	spin_lock_irqsave(&ioapic_lock, flags);
 	reg_00.raw = io_apic_read(apic, 0);
@@ -1229,6 +1242,8 @@ static void __init enable_IO_APIC(void)
 
     if (directed_eoi_enabled) {
         for (apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             vector_map[apic] = xzalloc(vmask_t);
             BUG_ON(!vector_map[apic]);
         }
@@ -1354,6 +1369,8 @@ static void __init setup_ioapic_ids_from
      * Set the IOAPIC ID to the value stored in the MPC table.
      */
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
         /* Read the register 0 value */
         spin_lock_irqsave(&ioapic_lock, flags);
@@ -2038,6 +2055,8 @@ void ioapic_resume(void)
 
     spin_lock_irqsave(&ioapic_lock, flags);
     for (apic = 0; apic < nr_ioapics; apic++){
+        if (!nr_ioapic_entries[apic])
+            continue;
         reg_00.raw = __io_apic_read(apic, 0);
         if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) {
             reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
@@ -2225,8 +2244,12 @@ static int ioapic_physbase_to_id(unsigne
 {
     int apic;
     for ( apic = 0; apic < nr_ioapics; apic++ )
+    {
+        if ( !nr_ioapic_entries[apic] )
+            continue;
         if ( mp_ioapics[apic].mpc_apicaddr == physbase )
             return apic;
+    }
     return -EINVAL;
 }
 
@@ -2444,6 +2467,22 @@ void dump_ioapic_irq_info(void)
 static unsigned int __initdata max_gsi_irqs;
 integer_param("max_gsi_irqs", max_gsi_irqs);
 
+static __init bool_t bad_ioapic_register(unsigned int idx)
+{
+    union IO_APIC_reg_00 reg_00 = { .raw = io_apic_read(idx, 0) };
+    union IO_APIC_reg_01 reg_01 = { .raw = io_apic_read(idx, 1) };
+    union IO_APIC_reg_02 reg_02 = { .raw = io_apic_read(idx, 2) };
+
+    if ( reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1 )
+    {
+        printk(KERN_WARNING "I/O APIC %#x registers return all ones, skipping!\n",
+               mp_ioapics[idx].mpc_apicaddr);
+        return 1;
+    }
+
+    return 0;
+}
+
 void __init init_ioapic_mappings(void)
 {
     unsigned long ioapic_phys;
@@ -2477,6 +2516,12 @@ void __init init_ioapic_mappings(void)
                     __fix_to_virt(idx), ioapic_phys);
         idx++;
 
+        if ( bad_ioapic_register(i) )
+        {
+            __set_fixmap(idx, 0, 0);
+            continue;
+        }
+
         if ( smp_found_config )
         {
             /* The number of IO-APIC IRQ registers (== #pins): */

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040f-Fw; Thu, 19 Apr 2012 00: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 1SKext-0003zl-4P
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [85.158.139.83:16113] by server-11.bemta-5.messagelabs.com id
	BA/FD-12959-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1334794270!24449204!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 317 invoked from network); 19 Apr 2012 00:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 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 1SKexp-0007Fw-IW
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexp-0006r5-EA
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Message-Id: <E1SKexp-0006r5-EA@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/ioapic: Add register level
	checks to detect bogus io-apic entries
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Suresh Siddha <suresh.b.siddha@intel.com>
# Date 1334669739 -7200
# Node ID 7ed4a82e771fdb014ca837e4d3306583e1247c79
# Parent  80f4113be5007f5b8a61048272193ce134b4fc28
x86/ioapic: Add register level checks to detect bogus io-apic entries

With the recent changes to clear_IO_APIC_pin() which tries to
clear remoteIRR bit explicitly, some of the users started to see
"Unable to reset IRR for apic .." messages.

Close look shows that these are related to bogus IO-APIC entries
which returns all 1s for their io-apic registers. And the
above mentioned error messages are benign. But kernel should
have ignored such io-apic's in the first place.

Check if register 0, 1, 2 of the listed io-apic are all 1s and
ignore such io-apic.

[original Linux patch:]
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 80f4113be500 -r 7ed4a82e771f xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Apr 17 15:33:53 2012 +0200
+++ b/xen/arch/x86/io_apic.c	Tue Apr 17 15:35:39 2012 +0200
@@ -185,7 +185,7 @@ struct IO_APIC_route_entry **alloc_ioapi
         ioapic_entries[apic] =
             xmalloc_array(struct IO_APIC_route_entry,
                           nr_ioapic_entries[apic]);
-        if (!ioapic_entries[apic])
+        if (!ioapic_entries[apic] && nr_ioapic_entries[apic])
             goto nomem;
     }
 
@@ -310,6 +310,9 @@ int save_IO_APIC_setup(struct IO_APIC_ro
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -331,6 +334,9 @@ void mask_IO_APIC_setup(struct IO_APIC_r
         return;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             break;
 
@@ -358,6 +364,9 @@ int restore_IO_APIC_setup(struct IO_APIC
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -610,6 +619,8 @@ static int __init find_isa_irq_apic(int 
     if (i < mp_irq_entries) {
         int apic;
         for(apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic)
                 return apic;
         }
@@ -1080,6 +1091,8 @@ static void /*__init*/ __print_IO_APIC(v
     printk(KERN_INFO "testing the IO APIC.......................\n");
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
 	spin_lock_irqsave(&ioapic_lock, flags);
 	reg_00.raw = io_apic_read(apic, 0);
@@ -1229,6 +1242,8 @@ static void __init enable_IO_APIC(void)
 
     if (directed_eoi_enabled) {
         for (apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             vector_map[apic] = xzalloc(vmask_t);
             BUG_ON(!vector_map[apic]);
         }
@@ -1354,6 +1369,8 @@ static void __init setup_ioapic_ids_from
      * Set the IOAPIC ID to the value stored in the MPC table.
      */
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
         /* Read the register 0 value */
         spin_lock_irqsave(&ioapic_lock, flags);
@@ -2038,6 +2055,8 @@ void ioapic_resume(void)
 
     spin_lock_irqsave(&ioapic_lock, flags);
     for (apic = 0; apic < nr_ioapics; apic++){
+        if (!nr_ioapic_entries[apic])
+            continue;
         reg_00.raw = __io_apic_read(apic, 0);
         if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) {
             reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
@@ -2225,8 +2244,12 @@ static int ioapic_physbase_to_id(unsigne
 {
     int apic;
     for ( apic = 0; apic < nr_ioapics; apic++ )
+    {
+        if ( !nr_ioapic_entries[apic] )
+            continue;
         if ( mp_ioapics[apic].mpc_apicaddr == physbase )
             return apic;
+    }
     return -EINVAL;
 }
 
@@ -2444,6 +2467,22 @@ void dump_ioapic_irq_info(void)
 static unsigned int __initdata max_gsi_irqs;
 integer_param("max_gsi_irqs", max_gsi_irqs);
 
+static __init bool_t bad_ioapic_register(unsigned int idx)
+{
+    union IO_APIC_reg_00 reg_00 = { .raw = io_apic_read(idx, 0) };
+    union IO_APIC_reg_01 reg_01 = { .raw = io_apic_read(idx, 1) };
+    union IO_APIC_reg_02 reg_02 = { .raw = io_apic_read(idx, 2) };
+
+    if ( reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1 )
+    {
+        printk(KERN_WARNING "I/O APIC %#x registers return all ones, skipping!\n",
+               mp_ioapics[idx].mpc_apicaddr);
+        return 1;
+    }
+
+    return 0;
+}
+
 void __init init_ioapic_mappings(void)
 {
     unsigned long ioapic_phys;
@@ -2477,6 +2516,12 @@ void __init init_ioapic_mappings(void)
                     __fix_to_virt(idx), ioapic_phys);
         idx++;
 
+        if ( bad_ioapic_register(i) )
+        {
+            __set_fixmap(idx, 0, 0);
+            continue;
+        }
+
         if ( smp_found_config )
         {
             /* The number of IO-APIC IRQ registers (== #pins): */

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040a-DN; Thu, 19 Apr 2012 00: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 1SKext-0003zm-5W
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [85.158.138.51:13731] by server-11.bemta-3.messagelabs.com id
	F1/2D-18894-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1334794270!22808776!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26117 invoked from network); 19 Apr 2012 00:11:11 -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;
	19 Apr 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 1SKexq-0007Fz-6r
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexp-0006rK-VS
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Message-Id: <E1SKexp-0006rK-VS@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/IO-APIC: adjust an otherwise
	pretty useless message
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334669794 -7200
# Node ID 03cb64abd7c27b5cde4d97bbb447c9d33f808ccb
# Parent  7ed4a82e771fdb014ca837e4d3306583e1247c79
x86/IO-APIC: adjust an otherwise pretty useless message

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


diff -r 7ed4a82e771f -r 03cb64abd7c2 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Apr 17 15:35:39 2012 +0200
+++ b/xen/arch/x86/io_apic.c	Tue Apr 17 15:36:34 2012 +0200
@@ -2183,8 +2183,8 @@ int io_apic_set_pci_routing (int ioapic,
     int vector;
 
     if (!IO_APIC_IRQ(irq)) {
-        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
-               ioapic);
+        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ %d\n",
+               ioapic, irq);
         return -EINVAL;
     }
 

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040a-DN; Thu, 19 Apr 2012 00: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 1SKext-0003zm-5W
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [85.158.138.51:13731] by server-11.bemta-3.messagelabs.com id
	F1/2D-18894-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1334794270!22808776!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26117 invoked from network); 19 Apr 2012 00:11:11 -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;
	19 Apr 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 1SKexq-0007Fz-6r
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:10 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexp-0006rK-VS
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Message-Id: <E1SKexp-0006rK-VS@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/IO-APIC: adjust an otherwise
	pretty useless message
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334669794 -7200
# Node ID 03cb64abd7c27b5cde4d97bbb447c9d33f808ccb
# Parent  7ed4a82e771fdb014ca837e4d3306583e1247c79
x86/IO-APIC: adjust an otherwise pretty useless message

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


diff -r 7ed4a82e771f -r 03cb64abd7c2 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Apr 17 15:35:39 2012 +0200
+++ b/xen/arch/x86/io_apic.c	Tue Apr 17 15:36:34 2012 +0200
@@ -2183,8 +2183,8 @@ int io_apic_set_pci_routing (int ioapic,
     int vector;
 
     if (!IO_APIC_IRQ(irq)) {
-        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
-               ioapic);
+        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ %d\n",
+               ioapic, irq);
         return -EINVAL;
     }
 

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040V-Ab; Thu, 19 Apr 2012 00: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 1SKexs-0003zk-TT
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [85.158.139.83:50015] by server-8.bemta-5.messagelabs.com id
	4A/C4-26964-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1334794269!24453235!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3558 invoked from network); 19 Apr 2012 00:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 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 1SKexp-0007Ft-84
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexo-0006qp-Tj
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:08 +0000
Message-Id: <E1SKexo-0006qp-Tj@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64: fix #GP generation in
	assembly 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334669633 -7200
# Node ID 80f4113be5007f5b8a61048272193ce134b4fc28
# Parent  6092641e364428e7be20c9e23497d7a1fc535112
x86-64: fix #GP generation in assembly code

When guest use of sysenter (64-bit PV guest) or syscall (32-bit PV
guest) gets converted into a GP fault (due to no callback having got
registered), we must
- honor the GP fault handler's request the keep enabled or mask event
  delivery
- not allow TBF_EXCEPTION to remain set past the generation of the
  (guest) exception in the vCPU's trap_bounce.flags, as that would
  otherwise allow for the next exception occurring in guest mode,
  should it happen to get handled in Xen itself, to nevertheless get
  bounced to the guest kernel.

Also, just like compat mode syscall handling already did, native mode
sysenter handling should, when converting to #GP, subtract 2 from the
RIP present in the frame so that the guest's GP fault handler would
see the fault pointing to the offending instruction instead of past it.

Finally, since those exception generating code blocks needed to be
modified anyway, convert them to make use of UNLIKELY_{START,END}().

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


diff -r 6092641e3644 -r 80f4113be500 xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 15:05:05 2012 +0200
+++ b/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 15:33:53 2012 +0200
@@ -145,6 +145,7 @@ void __dummy__(void)
 
     OFFSET(TRAPINFO_eip, struct trap_info, address);
     OFFSET(TRAPINFO_cs, struct trap_info, cs);
+    OFFSET(TRAPINFO_flags, struct trap_info, flags);
     DEFINE(TRAPINFO_sizeof, sizeof(struct trap_info));
     BLANK();
 
diff -r 6092641e3644 -r 80f4113be500 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 15:05:05 2012 +0200
+++ b/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 15:33:53 2012 +0200
@@ -213,6 +213,7 @@ 1:      call  compat_create_bounce_frame
 ENTRY(compat_post_handle_exception)
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    compat_test_all_events
+.Lcompat_bounce_exception:
         call  compat_create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   compat_test_all_events
@@ -225,20 +226,21 @@ ENTRY(compat_syscall)
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testl $~3,%esi
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  %rax,TRAPBOUNCE_eip(%rdx)
+UNLIKELY_START(z, compat_syscall_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rdi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subl  $2,UREGS_rip(%rsp)
+        movl  $0,TRAPBOUNCE_error_code(%rdx)
+        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rdi),%eax
+        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rdi),%esi
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rdi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(compat_syscall_gpf)
+        movq  %rax,TRAPBOUNCE_eip(%rdx)
         movw  %si,TRAPBOUNCE_cs(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
-        call  compat_create_bounce_frame
-        jmp   compat_test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rsi
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        subl  $2,UREGS_rip(%rsp)
-        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%eax
-        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rsi),%esi
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $0,TRAPBOUNCE_error_code(%rdx)
-        jmp   1b
+        jmp   .Lcompat_bounce_exception
 
 ENTRY(compat_sysenter)
         movq  VCPU_trap_ctxt(%rbx),%rcx
diff -r 6092641e3644 -r 80f4113be500 xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S	Tue Apr 17 15:05:05 2012 +0200
+++ b/xen/arch/x86/x86_64/entry.S	Tue Apr 17 15:33:53 2012 +0200
@@ -277,20 +277,22 @@ sysenter_eflags_saved:
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testq %rax,%rax
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  VCPU_domain(%rbx),%rdi
+UNLIKELY_START(z, sysenter_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rsi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subl  $2,UREGS_rip(%rsp)
+        movl  %eax,TRAPBOUNCE_error_code(%rdx)
+        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%rax
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rsi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(sysenter_gpf)
+        movq  VCPU_domain(%rbx),%rdi
         movq  %rax,TRAPBOUNCE_eip(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         testb $1,DOMAIN_is_32bit_pv(%rdi)
         jnz   compat_sysenter
-        call  create_bounce_frame
-        jmp   test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rcx
-        movl  %eax,TRAPBOUNCE_error_code(%rdx)
-        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rcx),%rax
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        jmp   1b
+        jmp   .Lbounce_exception
 
 ENTRY(int80_direct_trap)
         pushq $0
@@ -483,6 +485,7 @@ 1:      movq  %rsp,%rdi
         jnz   compat_post_handle_exception
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    test_all_events
+.Lbounce_exception:
         call  create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   test_all_events

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexv-00040V-Ab; Thu, 19 Apr 2012 00: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 1SKexs-0003zk-TT
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from [85.158.139.83:50015] by server-8.bemta-5.messagelabs.com id
	4A/C4-26964-0285F8F4; Thu, 19 Apr 2012 00:11:12 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1334794269!24453235!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3558 invoked from network); 19 Apr 2012 00:11:11 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 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 1SKexp-0007Ft-84
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexo-0006qp-Tj
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:08 +0000
Message-Id: <E1SKexo-0006qp-Tj@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64: fix #GP generation in
	assembly 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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334669633 -7200
# Node ID 80f4113be5007f5b8a61048272193ce134b4fc28
# Parent  6092641e364428e7be20c9e23497d7a1fc535112
x86-64: fix #GP generation in assembly code

When guest use of sysenter (64-bit PV guest) or syscall (32-bit PV
guest) gets converted into a GP fault (due to no callback having got
registered), we must
- honor the GP fault handler's request the keep enabled or mask event
  delivery
- not allow TBF_EXCEPTION to remain set past the generation of the
  (guest) exception in the vCPU's trap_bounce.flags, as that would
  otherwise allow for the next exception occurring in guest mode,
  should it happen to get handled in Xen itself, to nevertheless get
  bounced to the guest kernel.

Also, just like compat mode syscall handling already did, native mode
sysenter handling should, when converting to #GP, subtract 2 from the
RIP present in the frame so that the guest's GP fault handler would
see the fault pointing to the offending instruction instead of past it.

Finally, since those exception generating code blocks needed to be
modified anyway, convert them to make use of UNLIKELY_{START,END}().

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


diff -r 6092641e3644 -r 80f4113be500 xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 15:05:05 2012 +0200
+++ b/xen/arch/x86/x86_64/asm-offsets.c	Tue Apr 17 15:33:53 2012 +0200
@@ -145,6 +145,7 @@ void __dummy__(void)
 
     OFFSET(TRAPINFO_eip, struct trap_info, address);
     OFFSET(TRAPINFO_cs, struct trap_info, cs);
+    OFFSET(TRAPINFO_flags, struct trap_info, flags);
     DEFINE(TRAPINFO_sizeof, sizeof(struct trap_info));
     BLANK();
 
diff -r 6092641e3644 -r 80f4113be500 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 15:05:05 2012 +0200
+++ b/xen/arch/x86/x86_64/compat/entry.S	Tue Apr 17 15:33:53 2012 +0200
@@ -213,6 +213,7 @@ 1:      call  compat_create_bounce_frame
 ENTRY(compat_post_handle_exception)
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    compat_test_all_events
+.Lcompat_bounce_exception:
         call  compat_create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   compat_test_all_events
@@ -225,20 +226,21 @@ ENTRY(compat_syscall)
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testl $~3,%esi
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  %rax,TRAPBOUNCE_eip(%rdx)
+UNLIKELY_START(z, compat_syscall_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rdi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subl  $2,UREGS_rip(%rsp)
+        movl  $0,TRAPBOUNCE_error_code(%rdx)
+        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rdi),%eax
+        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rdi),%esi
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rdi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(compat_syscall_gpf)
+        movq  %rax,TRAPBOUNCE_eip(%rdx)
         movw  %si,TRAPBOUNCE_cs(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
-        call  compat_create_bounce_frame
-        jmp   compat_test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rsi
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        subl  $2,UREGS_rip(%rsp)
-        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%eax
-        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rsi),%esi
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $0,TRAPBOUNCE_error_code(%rdx)
-        jmp   1b
+        jmp   .Lcompat_bounce_exception
 
 ENTRY(compat_sysenter)
         movq  VCPU_trap_ctxt(%rbx),%rcx
diff -r 6092641e3644 -r 80f4113be500 xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S	Tue Apr 17 15:05:05 2012 +0200
+++ b/xen/arch/x86/x86_64/entry.S	Tue Apr 17 15:33:53 2012 +0200
@@ -277,20 +277,22 @@ sysenter_eflags_saved:
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testq %rax,%rax
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  VCPU_domain(%rbx),%rdi
+UNLIKELY_START(z, sysenter_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rsi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subl  $2,UREGS_rip(%rsp)
+        movl  %eax,TRAPBOUNCE_error_code(%rdx)
+        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%rax
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rsi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(sysenter_gpf)
+        movq  VCPU_domain(%rbx),%rdi
         movq  %rax,TRAPBOUNCE_eip(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         testb $1,DOMAIN_is_32bit_pv(%rdi)
         jnz   compat_sysenter
-        call  create_bounce_frame
-        jmp   test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rcx
-        movl  %eax,TRAPBOUNCE_error_code(%rdx)
-        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rcx),%rax
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        jmp   1b
+        jmp   .Lbounce_exception
 
 ENTRY(int80_direct_trap)
         pushq $0
@@ -483,6 +485,7 @@ 1:      movq  %rsp,%rdi
         jnz   compat_post_handle_exception
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    test_all_events
+.Lbounce_exception:
         call  create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   test_all_events

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexx-00041w-6n; Thu, 19 Apr 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 1SKexw-00040i-1h
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:16 +0000
Received: from [85.158.143.99:11643] by server-2.bemta-4.messagelabs.com id
	3E/68-17550-3285F8F4; Thu, 19 Apr 2012 00:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1334794273!19014525!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22879 invoked from network); 19 Apr 2012 00:11:14 -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;
	19 Apr 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 1SKext-0007GH-4T
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKext-0006sp-3A
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Message-Id: <E1SKext-0006sp-3A@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: cleanup indentation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Mathieu Gagne <mgagne@iweb.com>
# Date 1334686399 -3600
# Node ID 882f925234d8f581dc918bfd37741c9e70dad04a
# Parent  2a4db44e22284b9e03c46cf6a8ecfa295d818262
xl: cleanup indentation

Signed-off-by: Mathieu Gagne <mgagne@iweb.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 2a4db44e2228 -r 882f925234d8 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Apr 17 18:22:49 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Apr 17 19:13:19 2012 +0100
@@ -847,10 +847,10 @@ static void parse_config_data(const char
                 nic->script = strdup(default_vifscript);
             }
 
-	    if (default_bridge) {
-		free(nic->bridge);
-		nic->bridge = strdup(default_bridge);
-	    }
+            if (default_bridge) {
+                free(nic->bridge);
+                nic->bridge = strdup(default_bridge);
+            }
 
             p = strtok(buf2, ",");
             if (!p)

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:19 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 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 1SKexx-00041w-6n; Thu, 19 Apr 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 1SKexw-00040i-1h
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:16 +0000
Received: from [85.158.143.99:11643] by server-2.bemta-4.messagelabs.com id
	3E/68-17550-3285F8F4; Thu, 19 Apr 2012 00:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1334794273!19014525!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22879 invoked from network); 19 Apr 2012 00:11:14 -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;
	19 Apr 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 1SKext-0007GH-4T
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKext-0006sp-3A
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Message-Id: <E1SKext-0006sp-3A@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: cleanup indentation
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Mathieu Gagne <mgagne@iweb.com>
# Date 1334686399 -3600
# Node ID 882f925234d8f581dc918bfd37741c9e70dad04a
# Parent  2a4db44e22284b9e03c46cf6a8ecfa295d818262
xl: cleanup indentation

Signed-off-by: Mathieu Gagne <mgagne@iweb.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 2a4db44e2228 -r 882f925234d8 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Apr 17 18:22:49 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Apr 17 19:13:19 2012 +0100
@@ -847,10 +847,10 @@ static void parse_config_data(const char
                 nic->script = strdup(default_vifscript);
             }
 
-	    if (default_bridge) {
-		free(nic->bridge);
-		nic->bridge = strdup(default_bridge);
-	    }
+            if (default_bridge) {
+                free(nic->bridge);
+                nic->bridge = strdup(default_bridge);
+            }
 
             p = strtok(buf2, ",");
             if (!p)

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 00: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 1SKexy-00042M-98; Thu, 19 Apr 2012 00: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 1SKexw-00041Y-Pf
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:17 +0000
Received: from [85.158.139.83:50133] by server-12.bemta-5.messagelabs.com id
	22/BE-05587-4285F8F4; Thu, 19 Apr 2012 00:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334794273!24459464!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10470 invoked from network); 19 Apr 2012 00:11:15 -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;
	19 Apr 2012 00: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 1SKext-0007GK-Ku
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKext-0006t4-Jk
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Message-Id: <E1SKext-0006t4-Jk@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: xl network-attach -N (dry run)
	option
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Mathieu Gagne <mgagne@iweb.com>
# Date 1334686432 -3600
# Node ID e6b20ec1824c76a01382ee8b6fd67450c12a944b
# Parent  882f925234d8f581dc918bfd37741c9e70dad04a
xl: xl network-attach -N (dry run) option

Add dryrun for testing and debugging purposes.

Signed-off-by: Mathieu Gagne <mgagne@iweb.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 882f925234d8 -r e6b20ec1824c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Apr 17 19:13:19 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Apr 17 19:13:52 2012 +0100
@@ -4916,6 +4916,16 @@ int main_networkattach(int argc, char **
             return 1;
         }
     }
+
+    if (dryrun_only) {
+        char *json = libxl_device_nic_to_json(ctx, &nic);
+        printf("vif: %s\n", json);
+        free(json);
+        libxl_device_nic_dispose(&nic);
+        if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
+        return 0;
+    }
+
     if (libxl_device_nic_add(ctx, domid, &nic)) {
         fprintf(stderr, "libxl_device_nic_add failed.\n");
         return 1;
diff -r 882f925234d8 -r e6b20ec1824c tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Tue Apr 17 19:13:19 2012 +0100
+++ b/tools/libxl/xl_cmdtable.c	Tue Apr 17 19:13:52 2012 +0100
@@ -288,7 +288,7 @@ struct cmd_spec cmd_table[] = {
       "",
     },
     { "network-attach",
-      &main_networkattach, 0,
+      &main_networkattach, 1,
       "Create a new virtual network device",
       "<Domain> [type=<type>] [mac=<mac>] [bridge=<bridge>] "
       "[ip=<ip>] [script=<script>] [backend=<BackDomain>] [vifname=<name>] "

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 00: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 1SKexy-00042M-98; Thu, 19 Apr 2012 00: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 1SKexw-00041Y-Pf
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:17 +0000
Received: from [85.158.139.83:50133] by server-12.bemta-5.messagelabs.com id
	22/BE-05587-4285F8F4; Thu, 19 Apr 2012 00:11:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1334794273!24459464!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10470 invoked from network); 19 Apr 2012 00:11:15 -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;
	19 Apr 2012 00: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 1SKext-0007GK-Ku
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKext-0006t4-Jk
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:13 +0000
Message-Id: <E1SKext-0006t4-Jk@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: xl network-attach -N (dry run)
	option
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Mathieu Gagne <mgagne@iweb.com>
# Date 1334686432 -3600
# Node ID e6b20ec1824c76a01382ee8b6fd67450c12a944b
# Parent  882f925234d8f581dc918bfd37741c9e70dad04a
xl: xl network-attach -N (dry run) option

Add dryrun for testing and debugging purposes.

Signed-off-by: Mathieu Gagne <mgagne@iweb.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 882f925234d8 -r e6b20ec1824c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Apr 17 19:13:19 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Apr 17 19:13:52 2012 +0100
@@ -4916,6 +4916,16 @@ int main_networkattach(int argc, char **
             return 1;
         }
     }
+
+    if (dryrun_only) {
+        char *json = libxl_device_nic_to_json(ctx, &nic);
+        printf("vif: %s\n", json);
+        free(json);
+        libxl_device_nic_dispose(&nic);
+        if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
+        return 0;
+    }
+
     if (libxl_device_nic_add(ctx, domid, &nic)) {
         fprintf(stderr, "libxl_device_nic_add failed.\n");
         return 1;
diff -r 882f925234d8 -r e6b20ec1824c tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Tue Apr 17 19:13:19 2012 +0100
+++ b/tools/libxl/xl_cmdtable.c	Tue Apr 17 19:13:52 2012 +0100
@@ -288,7 +288,7 @@ struct cmd_spec cmd_table[] = {
       "",
     },
     { "network-attach",
-      &main_networkattach, 0,
+      &main_networkattach, 1,
       "Create a new virtual network device",
       "<Domain> [type=<type>] [mac=<mac>] [bridge=<bridge>] "
       "[ip=<ip>] [script=<script>] [backend=<BackDomain>] [vifname=<name>] "

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 00: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 1SKexx-00041q-3n; Thu, 19 Apr 2012 00:11:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexv-00040T-Rh
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:16 +0000
Received: from [85.158.139.83:16192] by server-9.bemta-5.messagelabs.com id
	F2/3C-09826-3285F8F4; Thu, 19 Apr 2012 00:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1334794272!20510693!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29747 invoked from network); 19 Apr 2012 00:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 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 1SKexs-0007GE-Jc
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexs-0006sa-IS
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Message-Id: <E1SKexs-0006sa-IS@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Query VNC listening port
	through QMP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1334683369 -3600
# Node ID 2a4db44e22284b9e03c46cf6a8ecfa295d818262
# Parent  214ca44b931682bc4b588b690e9b494dd956dc22
libxl: Query VNC listening port through QMP

Currently `xl vncviewer $dom` does not work because the VNC port is not
registered in xenstore when using qemu-upstream. This patch attempted to fix
this.

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


diff -r 214ca44b9316 -r 2a4db44e2228 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Tue Apr 17 18:19:12 2012 +0100
+++ b/tools/libxl/libxl_qmp.c	Tue Apr 17 18:22:49 2012 +0100
@@ -154,6 +154,55 @@ static int register_serials_chardev_call
     return ret;
 }
 
+static int qmp_write_domain_console_item(libxl__gc *gc, int domid,
+                                         const char *item, const char *value)
+{
+    char *path;
+
+    path = libxl__xs_get_dompath(gc, domid);
+    path = libxl__sprintf(gc, "%s/console/%s", path, item);
+
+    return libxl__xs_write(gc, XBT_NULL, path, "%s", value);
+}
+
+static int qmp_register_vnc_callback(libxl__qmp_handler *qmp,
+                                     const libxl__json_object *o,
+                                     void *unused)
+{
+    GC_INIT(qmp->ctx);
+    const libxl__json_object *obj;
+    const char *listen, *port;
+    int rc = -1;
+
+    if (!libxl__json_object_is_map(o)) {
+        goto out;
+    }
+
+    if (libxl__json_map_get("enabled", o, JSON_FALSE)) {
+        rc = 0;
+        goto out;
+    }
+
+    obj = libxl__json_map_get("host", o, JSON_STRING);
+    listen = libxl__json_object_get_string(obj);
+    obj = libxl__json_map_get("service", o, JSON_STRING);
+    port = libxl__json_object_get_string(obj);
+
+    if (!listen || !port) {
+        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
+                   "Failed to retreive VNC connect information.");
+        goto out;
+    }
+
+    rc = qmp_write_domain_console_item(gc, qmp->domid, "vnc-listen", listen);
+    if (!rc)
+        rc = qmp_write_domain_console_item(gc, qmp->domid, "vnc-port", port);
+
+out:
+    GC_FREE;
+    return rc;
+}
+
 static int qmp_capabilities_callback(libxl__qmp_handler *qmp,
                                      const libxl__json_object *o, void *unused)
 {
@@ -688,6 +737,13 @@ int libxl__qmp_query_serial(libxl__qmp_h
                                 NULL, qmp->timeout);
 }
 
+static int qmp_query_vnc(libxl__qmp_handler *qmp)
+{
+    return qmp_synchronous_send(qmp, "query-vnc", NULL,
+                                qmp_register_vnc_callback,
+                                NULL, qmp->timeout);
+}
+
 static int pci_add_callback(libxl__qmp_handler *qmp,
                             const libxl__json_object *response, void *opaque)
 {
@@ -917,6 +973,9 @@ int libxl__qmp_initializations(libxl__gc
     if (!ret && vnc && vnc->passwd) {
         ret = qmp_change(gc, qmp, "vnc", "password", vnc->passwd);
     }
+    if (!ret) {
+        ret = qmp_query_vnc(qmp);
+    }
     libxl__qmp_close(qmp);
     return ret;
 }

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 00: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 1SKexx-00041q-3n; Thu, 19 Apr 2012 00:11:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexv-00040T-Rh
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:16 +0000
Received: from [85.158.139.83:16192] by server-9.bemta-5.messagelabs.com id
	F2/3C-09826-3285F8F4; Thu, 19 Apr 2012 00:11:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1334794272!20510693!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29747 invoked from network); 19 Apr 2012 00:11:14 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 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 1SKexs-0007GE-Jc
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexs-0006sa-IS
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:12 +0000
Message-Id: <E1SKexs-0006sa-IS@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Query VNC listening port
	through QMP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1334683369 -3600
# Node ID 2a4db44e22284b9e03c46cf6a8ecfa295d818262
# Parent  214ca44b931682bc4b588b690e9b494dd956dc22
libxl: Query VNC listening port through QMP

Currently `xl vncviewer $dom` does not work because the VNC port is not
registered in xenstore when using qemu-upstream. This patch attempted to fix
this.

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


diff -r 214ca44b9316 -r 2a4db44e2228 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Tue Apr 17 18:19:12 2012 +0100
+++ b/tools/libxl/libxl_qmp.c	Tue Apr 17 18:22:49 2012 +0100
@@ -154,6 +154,55 @@ static int register_serials_chardev_call
     return ret;
 }
 
+static int qmp_write_domain_console_item(libxl__gc *gc, int domid,
+                                         const char *item, const char *value)
+{
+    char *path;
+
+    path = libxl__xs_get_dompath(gc, domid);
+    path = libxl__sprintf(gc, "%s/console/%s", path, item);
+
+    return libxl__xs_write(gc, XBT_NULL, path, "%s", value);
+}
+
+static int qmp_register_vnc_callback(libxl__qmp_handler *qmp,
+                                     const libxl__json_object *o,
+                                     void *unused)
+{
+    GC_INIT(qmp->ctx);
+    const libxl__json_object *obj;
+    const char *listen, *port;
+    int rc = -1;
+
+    if (!libxl__json_object_is_map(o)) {
+        goto out;
+    }
+
+    if (libxl__json_map_get("enabled", o, JSON_FALSE)) {
+        rc = 0;
+        goto out;
+    }
+
+    obj = libxl__json_map_get("host", o, JSON_STRING);
+    listen = libxl__json_object_get_string(obj);
+    obj = libxl__json_map_get("service", o, JSON_STRING);
+    port = libxl__json_object_get_string(obj);
+
+    if (!listen || !port) {
+        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
+                   "Failed to retreive VNC connect information.");
+        goto out;
+    }
+
+    rc = qmp_write_domain_console_item(gc, qmp->domid, "vnc-listen", listen);
+    if (!rc)
+        rc = qmp_write_domain_console_item(gc, qmp->domid, "vnc-port", port);
+
+out:
+    GC_FREE;
+    return rc;
+}
+
 static int qmp_capabilities_callback(libxl__qmp_handler *qmp,
                                      const libxl__json_object *o, void *unused)
 {
@@ -688,6 +737,13 @@ int libxl__qmp_query_serial(libxl__qmp_h
                                 NULL, qmp->timeout);
 }
 
+static int qmp_query_vnc(libxl__qmp_handler *qmp)
+{
+    return qmp_synchronous_send(qmp, "query-vnc", NULL,
+                                qmp_register_vnc_callback,
+                                NULL, qmp->timeout);
+}
+
 static int pci_add_callback(libxl__qmp_handler *qmp,
                             const libxl__json_object *response, void *opaque)
 {
@@ -917,6 +973,9 @@ int libxl__qmp_initializations(libxl__gc
     if (!ret && vnc && vnc->passwd) {
         ret = qmp_change(gc, qmp, "vnc", "password", vnc->passwd);
     }
+    if (!ret) {
+        ret = qmp_query_vnc(qmp);
+    }
     libxl__qmp_close(qmp);
     return ret;
 }

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 00: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 1SKexv-00040v-Nb; Thu, 19 Apr 2012 00: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 1SKexu-00040A-3q
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:14 +0000
Received: from [85.158.138.51:50975] by server-8.bemta-3.messagelabs.com id
	A1/2E-24428-1285F8F4; Thu, 19 Apr 2012 00:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1334794271!22631470!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13878 invoked from network); 19 Apr 2012 00:11: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;
	19 Apr 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 1SKexr-0007G5-7y
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexr-0006rr-0X
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Message-Id: <E1SKexr-0006rr-0X@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64: fix updating of UREGS_rip
	when converting sysenter to #GP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334675825 -7200
# Node ID 569d6f05e1ef3146c269bca6313e2777420d616d
# Parent  cf129a80e47e3664eb14070600a3b5c8c2a60440
x86-64: fix updating of UREGS_rip when converting sysenter to #GP

(I spotted this copy-and-paste mistake only when backporting c/s
25200:80f4113be500 to 4.1 and 4.0.)

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


diff -r cf129a80e47e -r 569d6f05e1ef xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S	Tue Apr 17 15:37:05 2012 +0200
+++ b/xen/arch/x86/x86_64/entry.S	Tue Apr 17 17:17:05 2012 +0200
@@ -280,7 +280,7 @@ sysenter_eflags_saved:
 UNLIKELY_START(z, sysenter_gpf)
         movq  VCPU_trap_ctxt(%rbx),%rsi
         movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        subl  $2,UREGS_rip(%rsp)
+        subq  $2,UREGS_rip(%rsp)
         movl  %eax,TRAPBOUNCE_error_code(%rdx)
         movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%rax
         testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rsi)

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 00:11:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 00: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 1SKexv-00040v-Nb; Thu, 19 Apr 2012 00: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 1SKexu-00040A-3q
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:14 +0000
Received: from [85.158.138.51:50975] by server-8.bemta-3.messagelabs.com id
	A1/2E-24428-1285F8F4; Thu, 19 Apr 2012 00:11:13 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1334794271!22631470!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13878 invoked from network); 19 Apr 2012 00:11: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;
	19 Apr 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 1SKexr-0007G5-7y
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKexr-0006rr-0X
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 00:11:11 +0000
Message-Id: <E1SKexr-0006rr-0X@xenbits.xen.org>
Date: Thu, 19 Apr 2012 00:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64: fix updating of UREGS_rip
	when converting sysenter to #GP
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1334675825 -7200
# Node ID 569d6f05e1ef3146c269bca6313e2777420d616d
# Parent  cf129a80e47e3664eb14070600a3b5c8c2a60440
x86-64: fix updating of UREGS_rip when converting sysenter to #GP

(I spotted this copy-and-paste mistake only when backporting c/s
25200:80f4113be500 to 4.1 and 4.0.)

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


diff -r cf129a80e47e -r 569d6f05e1ef xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S	Tue Apr 17 15:37:05 2012 +0200
+++ b/xen/arch/x86/x86_64/entry.S	Tue Apr 17 17:17:05 2012 +0200
@@ -280,7 +280,7 @@ sysenter_eflags_saved:
 UNLIKELY_START(z, sysenter_gpf)
         movq  VCPU_trap_ctxt(%rbx),%rsi
         movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        subl  $2,UREGS_rip(%rsp)
+        subq  $2,UREGS_rip(%rsp)
         movl  %eax,TRAPBOUNCE_error_code(%rdx)
         movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%rax
         testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rsi)

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11:00: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 1SKp5x-0000eL-Dl; Thu, 19 Apr 2012 11:00: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 1SKp5w-0000eE-LE
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:12 +0000
Received: from [85.158.143.35:25858] by server-2.bemta-4.messagelabs.com id
	DB/6E-17550-B30FF8F4; Thu, 19 Apr 2012 11:00:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-21.messagelabs.com!1334833210!13129439!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17836 invoked from network); 19 Apr 2012 11:00:11 -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;
	19 Apr 2012 11:00: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 1SKp5t-0007At-P9
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5s-0005Ei-UZ
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:09 +0000
Message-Id: <E1SKp5s-0005Ei-UZ@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mem_event: Fix foreign domain
	flag in grab_slot
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334752727 -3600
# Node ID f986e06e5f34e0d56f7d3a46120c71b029ff1e73
# Parent  e6b20ec1824c76a01382ee8b6fd67450c12a944b
x86/mem_event: Fix foreign domain flag in grab_slot

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


diff -r e6b20ec1824c -r f986e06e5f34 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Tue Apr 17 19:13:52 2012 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Wed Apr 18 13:38:47 2012 +0100
@@ -415,7 +415,7 @@ int __mem_event_claim_slot(struct domain
     if ( (current->domain == d) && allow_sleep )
         return mem_event_wait_slot(med);
     else
-        return mem_event_grab_slot(med, 1);
+        return mem_event_grab_slot(med, (current->domain != d));
 }
 
 /* Registered with Xen-bound event channel for incoming notifications. */

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:20 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11:00: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 1SKp5x-0000eL-Dl; Thu, 19 Apr 2012 11:00: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 1SKp5w-0000eE-LE
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:12 +0000
Received: from [85.158.143.35:25858] by server-2.bemta-4.messagelabs.com id
	DB/6E-17550-B30FF8F4; Thu, 19 Apr 2012 11:00:11 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-21.messagelabs.com!1334833210!13129439!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17836 invoked from network); 19 Apr 2012 11:00:11 -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;
	19 Apr 2012 11:00: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 1SKp5t-0007At-P9
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:09 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5s-0005Ei-UZ
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:09 +0000
Message-Id: <E1SKp5s-0005Ei-UZ@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mem_event: Fix foreign domain
	flag in grab_slot
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334752727 -3600
# Node ID f986e06e5f34e0d56f7d3a46120c71b029ff1e73
# Parent  e6b20ec1824c76a01382ee8b6fd67450c12a944b
x86/mem_event: Fix foreign domain flag in grab_slot

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


diff -r e6b20ec1824c -r f986e06e5f34 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Tue Apr 17 19:13:52 2012 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Wed Apr 18 13:38:47 2012 +0100
@@ -415,7 +415,7 @@ int __mem_event_claim_slot(struct domain
     if ( (current->domain == d) && allow_sleep )
         return mem_event_wait_slot(med);
     else
-        return mem_event_grab_slot(med, 1);
+        return mem_event_grab_slot(med, (current->domain != d));
 }
 
 /* Registered with Xen-bound event channel for incoming notifications. */

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11:00: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 1SKp63-0000fd-Ml; Thu, 19 Apr 2012 11:00: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 1SKp62-0000fF-7h
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:18 +0000
Received: from [85.158.139.83:41997] by server-3.bemta-5.messagelabs.com id
	54/D9-25237-140FF8F4; Thu, 19 Apr 2012 11:00:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1334833214!24536901!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11357 invoked from network); 19 Apr 2012 11:00:16 -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;
	19 Apr 2012 11: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 1SKp5y-0007B2-Gz
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5x-0005Fg-NH
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:14 +0000
Message-Id: <E1SKp5x-0005Fg-NH@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm/sharing: Clean ups for
	relinquishing shared pages on destroy
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334752727 -3600
# Node ID e1989df606e908f1ff34c2be5a1bb3b63047d6af
# Parent  b595d2f08d1bae7df7705b87cb95951877a4c3b8
x86/mm/sharing: Clean ups for relinquishing shared pages on destroy

When a domain is destroyed, its pages are freed in relinquish_resources in a
preemptible mode, in the context of a synchronous domctl.

P2m entries pointing to shared pages are, however, released during p2m cleanup
in an RCU callback, and in non-preemptible mode.

This is an O(n) operation for a very large n, which may include actually
freeing shared pages for which the domain is the last holder.

To improve responsiveness, move this operation to the preemtible portion of
domain destruction, during the synchronous domain_kill hypercall. And remove
the bulk of the work from the RCU callback.

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


diff -r b595d2f08d1b -r e1989df606e9 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/domain.c	Wed Apr 18 13:38:47 2012 +0100
@@ -2132,10 +2132,22 @@ int domain_relinquish_resources(struct d
             }
         }
 
-        d->arch.relmem = RELMEM_xen;
+        d->arch.relmem = RELMEM_shared;
         /* fallthrough */
 
-        /* Relinquish every page of memory. */
+    case RELMEM_shared:
+
+        if ( is_hvm_domain(d) )
+        {
+            /* If the domain has shared pages, relinquish them allowing
+             * for preemption. */
+            ret = relinquish_shared_pages(d);
+            if ( ret )
+                return ret;
+        }
+
+        d->arch.relmem = RELMEM_xen;
+        /* Fallthrough. Relinquish every page of memory. */
     case RELMEM_xen:
         ret = relinquish_memory(d, &d->xenpage_list, ~0UL);
         if ( ret )
diff -r b595d2f08d1b -r e1989df606e9 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Wed Apr 18 13:38:47 2012 +0100
@@ -33,6 +33,7 @@
 #include <asm/mem_event.h>
 #include <asm/atomic.h>
 #include <xen/rcupdate.h>
+#include <asm/event.h>
 
 #include "mm-locks.h"
 
@@ -1034,6 +1035,50 @@ private_page_found:
     return 0;
 }
 
+int relinquish_shared_pages(struct domain *d)
+{
+    int rc = 0;
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    unsigned long gfn, count = 0;
+
+    if ( p2m == NULL )
+        return 0;
+
+    p2m_lock(p2m);
+    for (gfn = p2m->next_shared_gfn_to_relinquish; 
+         gfn < p2m->max_mapped_pfn; gfn++ )
+    {
+        p2m_access_t a;
+        p2m_type_t t;
+        mfn_t mfn;
+        if ( atomic_read(&d->shr_pages) == 0 )
+            break;
+        mfn = p2m->get_entry(p2m, gfn, &t, &a, 0, NULL);
+        if ( mfn_valid(mfn) && (t == p2m_ram_shared) )
+        {
+            /* Does not fail with ENOMEM given the DESTROY flag */
+            BUG_ON(__mem_sharing_unshare_page(d, gfn, 
+                    MEM_SHARING_DESTROY_GFN));
+            /* Clear out the p2m entry so no one else may try to 
+             * unshare */
+            p2m->set_entry(p2m, gfn, _mfn(0), PAGE_ORDER_4K,
+                            p2m_invalid, p2m_access_rwx);
+            count++;
+        }
+
+        /* Preempt every 2MiB. Arbitrary */
+        if ( (count == 512) && hypercall_preempt_check() )
+        {
+            p2m->next_shared_gfn_to_relinquish = gfn + 1;
+            rc = -EAGAIN;
+            break;
+        }
+    }
+
+    p2m_unlock(p2m);
+    return rc;
+}
+
 int mem_sharing_memop(struct domain *d, xen_mem_sharing_op_t *mec)
 {
     int rc = 0;
diff -r b595d2f08d1b -r e1989df606e9 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Wed Apr 18 13:38:47 2012 +0100
@@ -371,9 +371,13 @@ void p2m_teardown(struct p2m_domain *p2m
     p2m_lock(p2m);
 
 #ifdef __x86_64__
+    /* Try to unshare any remaining shared p2m entries. Safeguard
+     * Since relinquish_shared_pages should have done the work. */ 
     for ( gfn=0; gfn < p2m->max_mapped_pfn; gfn++ )
     {
         p2m_access_t a;
+        if ( atomic_read(&d->shr_pages) == 0 )
+            break;
         mfn = p2m->get_entry(p2m, gfn, &t, &a, 0, NULL);
         if ( mfn_valid(mfn) && (t == p2m_ram_shared) )
         {
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-arm/mm.h	Wed Apr 18 13:38:47 2012 +0100
@@ -251,6 +251,10 @@ int  get_page(struct page_info *page, st
 
 static inline void put_gfn(struct domain *d, unsigned long gfn) {}
 static inline void mem_event_cleanup(struct domain *d) {}
+static inline int relinquish_shared_pages(struct domain *d)
+{
+    return 0;
+}
 
 #define INVALID_MFN             (~0UL)
 
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-x86/domain.h	Wed Apr 18 13:38:47 2012 +0100
@@ -296,6 +296,7 @@ struct arch_domain
     /* Continuable domain_relinquish_resources(). */
     enum {
         RELMEM_not_started,
+        RELMEM_shared,
         RELMEM_xen,
         RELMEM_l4,
         RELMEM_l3,
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-x86/mem_sharing.h
--- a/xen/include/asm-x86/mem_sharing.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-x86/mem_sharing.h	Wed Apr 18 13:38:47 2012 +0100
@@ -89,9 +89,19 @@ int mem_sharing_domctl(struct domain *d,
 int mem_sharing_audit(void);
 void mem_sharing_init(void);
 
+/* Scans the p2m and relinquishes any shared pages, destroying 
+ * those for which this domain holds the final reference.
+ * Preemptible.
+ */
+int relinquish_shared_pages(struct domain *d);
+
 #else 
 
 #define mem_sharing_init()  do { } while (0)
+static inline int relinquish_shared_pages(struct domain *d)
+{
+    return 0;
+}
 
 #endif /* __x86_64__ */
 
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-x86/p2m.h	Wed Apr 18 13:38:47 2012 +0100
@@ -260,6 +260,10 @@ struct p2m_domain {
     /* Highest guest frame that's ever been mapped in the p2m */
     unsigned long max_mapped_pfn;
 
+    /* When releasing shared gfn's in a preemptible manner, recall where
+     * to resume the search */
+    unsigned long next_shared_gfn_to_relinquish;
+
     /* Populate-on-demand variables
      * All variables are protected with the pod lock. We cannot rely on
      * the p2m lock if it's turned into a fine-grained lock.

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:22 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11:00: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 1SKp63-0000fd-Ml; Thu, 19 Apr 2012 11:00: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 1SKp62-0000fF-7h
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:18 +0000
Received: from [85.158.139.83:41997] by server-3.bemta-5.messagelabs.com id
	54/D9-25237-140FF8F4; Thu, 19 Apr 2012 11:00:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1334833214!24536901!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11357 invoked from network); 19 Apr 2012 11:00:16 -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;
	19 Apr 2012 11: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 1SKp5y-0007B2-Gz
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:14 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5x-0005Fg-NH
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:14 +0000
Message-Id: <E1SKp5x-0005Fg-NH@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm/sharing: Clean ups for
	relinquishing shared pages on destroy
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334752727 -3600
# Node ID e1989df606e908f1ff34c2be5a1bb3b63047d6af
# Parent  b595d2f08d1bae7df7705b87cb95951877a4c3b8
x86/mm/sharing: Clean ups for relinquishing shared pages on destroy

When a domain is destroyed, its pages are freed in relinquish_resources in a
preemptible mode, in the context of a synchronous domctl.

P2m entries pointing to shared pages are, however, released during p2m cleanup
in an RCU callback, and in non-preemptible mode.

This is an O(n) operation for a very large n, which may include actually
freeing shared pages for which the domain is the last holder.

To improve responsiveness, move this operation to the preemtible portion of
domain destruction, during the synchronous domain_kill hypercall. And remove
the bulk of the work from the RCU callback.

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


diff -r b595d2f08d1b -r e1989df606e9 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/domain.c	Wed Apr 18 13:38:47 2012 +0100
@@ -2132,10 +2132,22 @@ int domain_relinquish_resources(struct d
             }
         }
 
-        d->arch.relmem = RELMEM_xen;
+        d->arch.relmem = RELMEM_shared;
         /* fallthrough */
 
-        /* Relinquish every page of memory. */
+    case RELMEM_shared:
+
+        if ( is_hvm_domain(d) )
+        {
+            /* If the domain has shared pages, relinquish them allowing
+             * for preemption. */
+            ret = relinquish_shared_pages(d);
+            if ( ret )
+                return ret;
+        }
+
+        d->arch.relmem = RELMEM_xen;
+        /* Fallthrough. Relinquish every page of memory. */
     case RELMEM_xen:
         ret = relinquish_memory(d, &d->xenpage_list, ~0UL);
         if ( ret )
diff -r b595d2f08d1b -r e1989df606e9 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Wed Apr 18 13:38:47 2012 +0100
@@ -33,6 +33,7 @@
 #include <asm/mem_event.h>
 #include <asm/atomic.h>
 #include <xen/rcupdate.h>
+#include <asm/event.h>
 
 #include "mm-locks.h"
 
@@ -1034,6 +1035,50 @@ private_page_found:
     return 0;
 }
 
+int relinquish_shared_pages(struct domain *d)
+{
+    int rc = 0;
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    unsigned long gfn, count = 0;
+
+    if ( p2m == NULL )
+        return 0;
+
+    p2m_lock(p2m);
+    for (gfn = p2m->next_shared_gfn_to_relinquish; 
+         gfn < p2m->max_mapped_pfn; gfn++ )
+    {
+        p2m_access_t a;
+        p2m_type_t t;
+        mfn_t mfn;
+        if ( atomic_read(&d->shr_pages) == 0 )
+            break;
+        mfn = p2m->get_entry(p2m, gfn, &t, &a, 0, NULL);
+        if ( mfn_valid(mfn) && (t == p2m_ram_shared) )
+        {
+            /* Does not fail with ENOMEM given the DESTROY flag */
+            BUG_ON(__mem_sharing_unshare_page(d, gfn, 
+                    MEM_SHARING_DESTROY_GFN));
+            /* Clear out the p2m entry so no one else may try to 
+             * unshare */
+            p2m->set_entry(p2m, gfn, _mfn(0), PAGE_ORDER_4K,
+                            p2m_invalid, p2m_access_rwx);
+            count++;
+        }
+
+        /* Preempt every 2MiB. Arbitrary */
+        if ( (count == 512) && hypercall_preempt_check() )
+        {
+            p2m->next_shared_gfn_to_relinquish = gfn + 1;
+            rc = -EAGAIN;
+            break;
+        }
+    }
+
+    p2m_unlock(p2m);
+    return rc;
+}
+
 int mem_sharing_memop(struct domain *d, xen_mem_sharing_op_t *mec)
 {
     int rc = 0;
diff -r b595d2f08d1b -r e1989df606e9 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/p2m.c	Wed Apr 18 13:38:47 2012 +0100
@@ -371,9 +371,13 @@ void p2m_teardown(struct p2m_domain *p2m
     p2m_lock(p2m);
 
 #ifdef __x86_64__
+    /* Try to unshare any remaining shared p2m entries. Safeguard
+     * Since relinquish_shared_pages should have done the work. */ 
     for ( gfn=0; gfn < p2m->max_mapped_pfn; gfn++ )
     {
         p2m_access_t a;
+        if ( atomic_read(&d->shr_pages) == 0 )
+            break;
         mfn = p2m->get_entry(p2m, gfn, &t, &a, 0, NULL);
         if ( mfn_valid(mfn) && (t == p2m_ram_shared) )
         {
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-arm/mm.h	Wed Apr 18 13:38:47 2012 +0100
@@ -251,6 +251,10 @@ int  get_page(struct page_info *page, st
 
 static inline void put_gfn(struct domain *d, unsigned long gfn) {}
 static inline void mem_event_cleanup(struct domain *d) {}
+static inline int relinquish_shared_pages(struct domain *d)
+{
+    return 0;
+}
 
 #define INVALID_MFN             (~0UL)
 
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-x86/domain.h	Wed Apr 18 13:38:47 2012 +0100
@@ -296,6 +296,7 @@ struct arch_domain
     /* Continuable domain_relinquish_resources(). */
     enum {
         RELMEM_not_started,
+        RELMEM_shared,
         RELMEM_xen,
         RELMEM_l4,
         RELMEM_l3,
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-x86/mem_sharing.h
--- a/xen/include/asm-x86/mem_sharing.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-x86/mem_sharing.h	Wed Apr 18 13:38:47 2012 +0100
@@ -89,9 +89,19 @@ int mem_sharing_domctl(struct domain *d,
 int mem_sharing_audit(void);
 void mem_sharing_init(void);
 
+/* Scans the p2m and relinquishes any shared pages, destroying 
+ * those for which this domain holds the final reference.
+ * Preemptible.
+ */
+int relinquish_shared_pages(struct domain *d);
+
 #else 
 
 #define mem_sharing_init()  do { } while (0)
+static inline int relinquish_shared_pages(struct domain *d)
+{
+    return 0;
+}
 
 #endif /* __x86_64__ */
 
diff -r b595d2f08d1b -r e1989df606e9 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/include/asm-x86/p2m.h	Wed Apr 18 13:38:47 2012 +0100
@@ -260,6 +260,10 @@ struct p2m_domain {
     /* Highest guest frame that's ever been mapped in the p2m */
     unsigned long max_mapped_pfn;
 
+    /* When releasing shared gfn's in a preemptible manner, recall where
+     * to resume the search */
+    unsigned long next_shared_gfn_to_relinquish;
+
     /* Populate-on-demand variables
      * All variables are protected with the pod lock. We cannot rely on
      * the p2m lock if it's turned into a fine-grained lock.

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11:00: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 1SKp62-0000fP-Jr; Thu, 19 Apr 2012 11:00:18 +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 1SKp61-0000ex-82
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:17 +0000
Received: from [85.158.138.51:8117] by server-1.bemta-3.messagelabs.com id
	90/48-11491-040FF8F4; Thu, 19 Apr 2012 11:00:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1334833214!22821646!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12860 invoked from network); 19 Apr 2012 11:00:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 2012 11:00: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 1SKp5x-0007Az-8m
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5w-0005FO-TR
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:13 +0000
Message-Id: <E1SKp5w-0005FO-TR@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_access: fix setting default
	mem_access type
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Aravindh Puthiyaparambil <aravindh@virtuata.com>
# Date 1334752727 -3600
# Node ID b595d2f08d1bae7df7705b87cb95951877a4c3b8
# Parent  4bef0d26789c6d69c028515688f716003f6a9a85
mem_access: fix setting default mem_access type

When xc_hvm_set_mem_access(xch, domain_id, default_access, ~0ull, 0)
is called, first_pfn=~0ull is a hint to HVMOP_set_mem_access as to
what the default mem_access type is for the domain. This call was
failing because it was gated by the memory range check in the
HVMOP_set_mem_access case statement in do_hvm_op(). The following
patch fixes this issue.

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---



diff -r 4bef0d26789c -r b595d2f08d1b xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Wed Apr 18 13:38:47 2012 +0100
@@ -4195,9 +4195,10 @@ long do_hvm_op(unsigned long op, XEN_GUE
             goto param_fail5;
 
         rc = -EINVAL;
-        if ( (a.first_pfn > domain_get_maximum_gpfn(d)) ||
+        if ( (a.first_pfn != ~0ull) &&
+             ((a.first_pfn > domain_get_maximum_gpfn(d)) ||
              ((a.first_pfn + a.nr - 1) < a.first_pfn) ||
-             ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
+             ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d))) )
             goto param_fail5;
             
         rc = p2m_set_mem_access(d, a.first_pfn, a.nr, a.hvmmem_access);

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:23 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11:00: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 1SKp62-0000fP-Jr; Thu, 19 Apr 2012 11:00:18 +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 1SKp61-0000ex-82
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:17 +0000
Received: from [85.158.138.51:8117] by server-1.bemta-3.messagelabs.com id
	90/48-11491-040FF8F4; Thu, 19 Apr 2012 11:00:16 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1334833214!22821646!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12860 invoked from network); 19 Apr 2012 11:00:15 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Apr 2012 11:00: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 1SKp5x-0007Az-8m
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:13 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5w-0005FO-TR
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:13 +0000
Message-Id: <E1SKp5w-0005FO-TR@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_access: fix setting default
	mem_access type
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Aravindh Puthiyaparambil <aravindh@virtuata.com>
# Date 1334752727 -3600
# Node ID b595d2f08d1bae7df7705b87cb95951877a4c3b8
# Parent  4bef0d26789c6d69c028515688f716003f6a9a85
mem_access: fix setting default mem_access type

When xc_hvm_set_mem_access(xch, domain_id, default_access, ~0ull, 0)
is called, first_pfn=~0ull is a hint to HVMOP_set_mem_access as to
what the default mem_access type is for the domain. This call was
failing because it was gated by the memory range check in the
HVMOP_set_mem_access case statement in do_hvm_op(). The following
patch fixes this issue.

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---



diff -r 4bef0d26789c -r b595d2f08d1b xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Wed Apr 18 13:38:47 2012 +0100
@@ -4195,9 +4195,10 @@ long do_hvm_op(unsigned long op, XEN_GUE
             goto param_fail5;
 
         rc = -EINVAL;
-        if ( (a.first_pfn > domain_get_maximum_gpfn(d)) ||
+        if ( (a.first_pfn != ~0ull) &&
+             ((a.first_pfn > domain_get_maximum_gpfn(d)) ||
              ((a.first_pfn + a.nr - 1) < a.first_pfn) ||
-             ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
+             ((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d))) )
             goto param_fail5;
             
         rc = p2m_set_mem_access(d, a.first_pfn, a.nr, a.hvmmem_access);

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11: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 1SKp61-0000f5-Gc; Thu, 19 Apr 2012 11:00:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp60-0000ea-9K
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:16 +0000
Received: from [85.158.139.83:41728] by server-2.bemta-5.messagelabs.com id
	30/6B-17016-F30FF8F4; Thu, 19 Apr 2012 11:00:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1334833212!24536892!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11137 invoked from network); 19 Apr 2012 11:00:13 -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;
	19 Apr 2012 11:00: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 1SKp5w-0007Aw-G8
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5u-0005F0-5W
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:11 +0000
Message-Id: <E1SKp5u-0005F0-5W@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix locking on hap enable
	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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334752727 -3600
# Node ID 4bef0d26789c6d69c028515688f716003f6a9a85
# Parent  f986e06e5f34e0d56f7d3a46120c71b029ff1e73
x86/mm: Fix locking on hap enable failure

If enabling hap fails due to out of memory, the locking on the clean up path is
broken.

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


diff -r f986e06e5f34 -r 4bef0d26789c xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/hap/hap.c	Wed Apr 18 13:38:47 2012 +0100
@@ -585,13 +585,14 @@ int hap_enable(struct domain *d, u32 mod
         unsigned int r;
         paging_lock(d);
         r = hap_set_allocation(d, 256, NULL);
-        paging_unlock(d);
         if ( r != 0 )
         {
             hap_set_allocation(d, 0, NULL);
+            paging_unlock(d);
             rv = -ENOMEM;
             goto out;
         }
+        paging_unlock(d);
     }
 
     /* Allow p2m and log-dirty code to borrow our memory */

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11: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 1SKp61-0000f5-Gc; Thu, 19 Apr 2012 11:00:17 +0000
Received: from mail6.bemta5.messagelabs.com ([195.245.231.135])
	by lists.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp60-0000ea-9K
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:16 +0000
Received: from [85.158.139.83:41728] by server-2.bemta-5.messagelabs.com id
	30/6B-17016-F30FF8F4; Thu, 19 Apr 2012 11:00:15 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1334833212!24536892!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11137 invoked from network); 19 Apr 2012 11:00:13 -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;
	19 Apr 2012 11:00: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 1SKp5w-0007Aw-G8
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5u-0005F0-5W
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:11 +0000
Message-Id: <E1SKp5u-0005F0-5W@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Fix locking on hap enable
	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: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334752727 -3600
# Node ID 4bef0d26789c6d69c028515688f716003f6a9a85
# Parent  f986e06e5f34e0d56f7d3a46120c71b029ff1e73
x86/mm: Fix locking on hap enable failure

If enabling hap fails due to out of memory, the locking on the clean up path is
broken.

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


diff -r f986e06e5f34 -r 4bef0d26789c xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/hap/hap.c	Wed Apr 18 13:38:47 2012 +0100
@@ -585,13 +585,14 @@ int hap_enable(struct domain *d, u32 mod
         unsigned int r;
         paging_lock(d);
         r = hap_set_allocation(d, 256, NULL);
-        paging_unlock(d);
         if ( r != 0 )
         {
             hap_set_allocation(d, 0, NULL);
+            paging_unlock(d);
             rv = -ENOMEM;
             goto out;
         }
+        paging_unlock(d);
     }
 
     /* Allow p2m and log-dirty code to borrow our memory */

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11: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 1SKp64-0000gE-Tt; Thu, 19 Apr 2012 11:00: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 1SKp63-0000fZ-Jv
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:19 +0000
Received: from [85.158.138.51:7959] by server-10.bemta-3.messagelabs.com id
	98/01-29478-240FF8F4; Thu, 19 Apr 2012 11:00:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1334833216!22821657!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13029 invoked from network); 19 Apr 2012 11:00:17 -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;
	19 Apr 2012 11:00:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5z-0007B5-Rt
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5y-0005Fy-SL
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:15 +0000
Message-Id: <E1SKp5y-0005Fy-SL@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm/shadow: enclose an OOS
	function in the proper conditional ifdef
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334764195 -3600
# Node ID 7c777cb8f705411b77c551f34ba88bdc09e38ab8
# Parent  e1989df606e908f1ff34c2be5a1bb3b63047d6af
x86/mm/shadow: enclose an OOS function in the proper conditional ifdef

Otherwise compilation fails if the feature is disabled.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-By: Gianluca Guida <gianluca.guida@citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r e1989df606e9 -r 7c777cb8f705 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Apr 18 16:49:55 2012 +0100
@@ -248,6 +248,7 @@ shadow_check_gwalk(struct vcpu *v, unsig
     return !mismatch;
 }
 
+#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 static int
 shadow_check_gl1e(struct vcpu *v, walk_t *gw)
 {
@@ -263,7 +264,7 @@ shadow_check_gl1e(struct vcpu *v, walk_t
 
     return gw->l1e.l1 != nl1e.l1;
 }
-
+#endif
 
 /* Remove write access permissions from a gwalk_t in a batch, and
  * return OR-ed result for TLB flush hint and need to rewalk the guest

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

From xen-changelog-bounces@lists.xen.org Thu Apr 19 11:00:25 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Apr 2012 11: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 1SKp64-0000gE-Tt; Thu, 19 Apr 2012 11:00: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 1SKp63-0000fZ-Jv
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:19 +0000
Received: from [85.158.138.51:7959] by server-10.bemta-3.messagelabs.com id
	98/01-29478-240FF8F4; Thu, 19 Apr 2012 11:00:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1334833216!22821657!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13029 invoked from network); 19 Apr 2012 11:00:17 -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;
	19 Apr 2012 11:00:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5z-0007B5-Rt
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:15 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SKp5y-0005Fy-SL
	for xen-changelog@lists.xensource.com; Thu, 19 Apr 2012 11:00:15 +0000
Message-Id: <E1SKp5y-0005Fy-SL@xenbits.xen.org>
Date: Thu, 19 Apr 2012 11:00:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm/shadow: enclose an OOS
	function in the proper conditional ifdef
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1334764195 -3600
# Node ID 7c777cb8f705411b77c551f34ba88bdc09e38ab8
# Parent  e1989df606e908f1ff34c2be5a1bb3b63047d6af
x86/mm/shadow: enclose an OOS function in the proper conditional ifdef

Otherwise compilation fails if the feature is disabled.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-By: Gianluca Guida <gianluca.guida@citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r e1989df606e9 -r 7c777cb8f705 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Apr 18 13:38:47 2012 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Apr 18 16:49:55 2012 +0100
@@ -248,6 +248,7 @@ shadow_check_gwalk(struct vcpu *v, unsig
     return !mismatch;
 }
 
+#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 static int
 shadow_check_gl1e(struct vcpu *v, walk_t *gw)
 {
@@ -263,7 +264,7 @@ shadow_check_gl1e(struct vcpu *v, walk_t
 
     return gw->l1e.l1 != nl1e.l1;
 }
-
+#endif
 
 /* Remove write access permissions from a gwalk_t in a batch, and
  * return OR-ed result for TLB flush hint and need to rewalk the guest

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcX-0003nK-Ft; Sat, 21 Apr 2012 02:00: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 1SLPcV-0003nC-M6
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:15 +0000
Received: from [85.158.138.51:9955] by server-1.bemta-3.messagelabs.com id
	ED/40-11491-EA4129F4; Sat, 21 Apr 2012 02:00:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1334973612!23081292!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13897 invoked from network); 21 Apr 2012 02:00:13 -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;
	21 Apr 2012 02:00: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 1SLPcR-0002wG-AJ
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcP-0001Qu-J9
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:10 +0000
Message-Id: <E1SLPcP-0001Qu-J9@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: BUG() rather than panic() on
	mm lock order violations
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334763793 -3600
# Node ID 4b1d80d52ced6a86032d37f74cec1af62d63a4c1
# Parent  7c777cb8f705411b77c551f34ba88bdc09e38ab8
x86/mm: BUG() rather than panic() on mm lock order violations

That gives us a backtrace showing where the bad lock happens.

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


diff -r 7c777cb8f705 -r 4b1d80d52ced xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Wed Apr 18 16:49:55 2012 +0100
+++ b/xen/arch/x86/mm/mm-locks.h	Wed Apr 18 16:43:13 2012 +0100
@@ -50,8 +50,11 @@ static inline int mm_locked_by_me(mm_loc
 #define __check_lock_level(l)                           \
 do {                                                    \
     if ( unlikely(__get_lock_level()) > (l) )           \
-        panic("mm locking order violation: %i > %i\n",  \
-              __get_lock_level(), (l));                 \
+    {                                                   \
+        printk("mm locking order violation: %i > %i\n", \
+               __get_lock_level(), (l));                \
+        BUG();                                          \
+    }                                                   \
 } while(0)
 
 #define __set_lock_level(l)         \

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcX-0003nK-Ft; Sat, 21 Apr 2012 02:00: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 1SLPcV-0003nC-M6
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:15 +0000
Received: from [85.158.138.51:9955] by server-1.bemta-3.messagelabs.com id
	ED/40-11491-EA4129F4; Sat, 21 Apr 2012 02:00:14 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1334973612!23081292!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13897 invoked from network); 21 Apr 2012 02:00:13 -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;
	21 Apr 2012 02:00: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 1SLPcR-0002wG-AJ
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:11 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcP-0001Qu-J9
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:10 +0000
Message-Id: <E1SLPcP-0001Qu-J9@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: BUG() rather than panic() on
	mm lock order violations
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334763793 -3600
# Node ID 4b1d80d52ced6a86032d37f74cec1af62d63a4c1
# Parent  7c777cb8f705411b77c551f34ba88bdc09e38ab8
x86/mm: BUG() rather than panic() on mm lock order violations

That gives us a backtrace showing where the bad lock happens.

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


diff -r 7c777cb8f705 -r 4b1d80d52ced xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Wed Apr 18 16:49:55 2012 +0100
+++ b/xen/arch/x86/mm/mm-locks.h	Wed Apr 18 16:43:13 2012 +0100
@@ -50,8 +50,11 @@ static inline int mm_locked_by_me(mm_loc
 #define __check_lock_level(l)                           \
 do {                                                    \
     if ( unlikely(__get_lock_level()) > (l) )           \
-        panic("mm locking order violation: %i > %i\n",  \
-              __get_lock_level(), (l));                 \
+    {                                                   \
+        printk("mm locking order violation: %i > %i\n", \
+               __get_lock_level(), (l));                \
+        BUG();                                          \
+    }                                                   \
 } while(0)
 
 #define __set_lock_level(l)         \

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcZ-0003nd-KO; Sat, 21 Apr 2012 02: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 1SLPcY-0003nO-6Q
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:18 +0000
Received: from [85.158.143.99:56607] by server-2.bemta-4.messagelabs.com id
	3C/F5-17550-1B4129F4; Sat, 21 Apr 2012 02:00:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334973614!24276900!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18399 invoked from network); 21 Apr 2012 02:00:15 -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;
	21 Apr 2012 02:00: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 1SLPcS-0002wJ-5y
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcR-0001RJ-GO
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:11 +0000
Message-Id: <E1SLPcR-0001RJ-GO@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: fix parens in mm lock level
	check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334845844 -3600
# Node ID d1b0a8a84ccf3a7eed25996adf2e67916b8081da
# Parent  4b1d80d52ced6a86032d37f74cec1af62d63a4c1
x86/mm: fix parens in mm lock level check

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


diff -r 4b1d80d52ced -r d1b0a8a84ccf xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Wed Apr 18 16:43:13 2012 +0100
+++ b/xen/arch/x86/mm/mm-locks.h	Thu Apr 19 15:30:44 2012 +0100
@@ -49,7 +49,7 @@ static inline int mm_locked_by_me(mm_loc
  * where the offending locks are declared. */
 #define __check_lock_level(l)                           \
 do {                                                    \
-    if ( unlikely(__get_lock_level()) > (l) )           \
+    if ( unlikely(__get_lock_level() > (l)) )           \
     {                                                   \
         printk("mm locking order violation: %i > %i\n", \
                __get_lock_level(), (l));                \

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:24 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcZ-0003nd-KO; Sat, 21 Apr 2012 02: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 1SLPcY-0003nO-6Q
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:18 +0000
Received: from [85.158.143.99:56607] by server-2.bemta-4.messagelabs.com id
	3C/F5-17550-1B4129F4; Sat, 21 Apr 2012 02:00:17 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1334973614!24276900!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18399 invoked from network); 21 Apr 2012 02:00:15 -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;
	21 Apr 2012 02:00: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 1SLPcS-0002wJ-5y
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:12 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcR-0001RJ-GO
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:11 +0000
Message-Id: <E1SLPcR-0001RJ-GO@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: fix parens in mm lock level
	check
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334845844 -3600
# Node ID d1b0a8a84ccf3a7eed25996adf2e67916b8081da
# Parent  4b1d80d52ced6a86032d37f74cec1af62d63a4c1
x86/mm: fix parens in mm lock level check

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


diff -r 4b1d80d52ced -r d1b0a8a84ccf xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Wed Apr 18 16:43:13 2012 +0100
+++ b/xen/arch/x86/mm/mm-locks.h	Thu Apr 19 15:30:44 2012 +0100
@@ -49,7 +49,7 @@ static inline int mm_locked_by_me(mm_loc
  * where the offending locks are declared. */
 #define __check_lock_level(l)                           \
 do {                                                    \
-    if ( unlikely(__get_lock_level()) > (l) )           \
+    if ( unlikely(__get_lock_level() > (l)) )           \
     {                                                   \
         printk("mm locking order violation: %i > %i\n", \
                __get_lock_level(), (l));                \

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcb-0003oC-Tr; Sat, 21 Apr 2012 02:00: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 1SLPcb-0003nO-BM
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:21 +0000
Received: from [85.158.143.99:40604] by server-2.bemta-4.messagelabs.com id
	F0/06-17550-5B4129F4; Sat, 21 Apr 2012 02:00:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1334973618!13410413!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23165 invoked from network); 21 Apr 2012 02:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Apr 2012 02: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 1SLPcX-0002wS-AR
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcX-0001S8-3Z
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:17 +0000
Message-Id: <E1SLPcX-0001S8-3Z@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: restore
	vcpu_destroy_pagetables() call on HVM domain teardown.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334911746 -3600
# Node ID 274e5accd62db09a7f703400c8720f7fdd95551a
# Parent  cf2de273869f06e907fb28127682284e8670b1cc
x86: restore vcpu_destroy_pagetables() call on HVM domain teardown.

HVM vcpus that are using shadow pagetables have valid guest_table fields,
which need to be tidied up on domain teardown.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r cf2de273869f -r 274e5accd62d xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Apr 20 09:43:46 2012 +0100
+++ b/xen/arch/x86/domain.c	Fri Apr 20 09:49:06 2012 +0100
@@ -2105,13 +2105,14 @@ int domain_relinquish_resources(struct d
         /* Tear down paging-assistance stuff. */
         paging_teardown(d);
 
+        /* Drop the in-use references to page-table bases. */
+        for_each_vcpu ( d, v )
+            vcpu_destroy_pagetables(v);
+
         if ( !is_hvm_domain(d) )
         {
             for_each_vcpu ( d, v )
             {
-                /* Drop the in-use references to page-table bases. */
-                vcpu_destroy_pagetables(v);
-
                 /*
                  * Relinquish GDT mappings. No need for explicit unmapping of
                  * the LDT as it automatically gets squashed with the guest

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:26 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcb-0003oC-Tr; Sat, 21 Apr 2012 02:00: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 1SLPcb-0003nO-BM
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:21 +0000
Received: from [85.158.143.99:40604] by server-2.bemta-4.messagelabs.com id
	F0/06-17550-5B4129F4; Sat, 21 Apr 2012 02:00:21 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1334973618!13410413!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23165 invoked from network); 21 Apr 2012 02:00:19 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Apr 2012 02: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 1SLPcX-0002wS-AR
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:17 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcX-0001S8-3Z
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:17 +0000
Message-Id: <E1SLPcX-0001S8-3Z@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: restore
	vcpu_destroy_pagetables() call on HVM domain teardown.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1334911746 -3600
# Node ID 274e5accd62db09a7f703400c8720f7fdd95551a
# Parent  cf2de273869f06e907fb28127682284e8670b1cc
x86: restore vcpu_destroy_pagetables() call on HVM domain teardown.

HVM vcpus that are using shadow pagetables have valid guest_table fields,
which need to be tidied up on domain teardown.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r cf2de273869f -r 274e5accd62d xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Apr 20 09:43:46 2012 +0100
+++ b/xen/arch/x86/domain.c	Fri Apr 20 09:49:06 2012 +0100
@@ -2105,13 +2105,14 @@ int domain_relinquish_resources(struct d
         /* Tear down paging-assistance stuff. */
         paging_teardown(d);
 
+        /* Drop the in-use references to page-table bases. */
+        for_each_vcpu ( d, v )
+            vcpu_destroy_pagetables(v);
+
         if ( !is_hvm_domain(d) )
         {
             for_each_vcpu ( d, v )
             {
-                /* Drop the in-use references to page-table bases. */
-                vcpu_destroy_pagetables(v);
-
                 /*
                  * Relinquish GDT mappings. No need for explicit unmapping of
                  * the LDT as it automatically gets squashed with the guest

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcb-0003o0-NN; Sat, 21 Apr 2012 02:00:21 +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 1SLPcZ-0003nY-FD
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:19 +0000
Received: from [85.158.138.51:61584] by server-3.bemta-3.messagelabs.com id
	57/A7-04048-2B4129F4; Sat, 21 Apr 2012 02:00:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1334973616!23161832!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12063 invoked from network); 21 Apr 2012 02:00:17 -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;
	21 Apr 2012 02:00:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcW-0002wM-F1
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcS-0001Ra-Ib
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Message-Id: <E1SLPcS-0001Ra-Ib@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Clean up convoluted
	hvm_inject_exception() logic.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1334910815 -3600
# Node ID aae8c2372a56262267c37e9ba538091c1f8f753f
# Parent  d1b0a8a84ccf3a7eed25996adf2e67916b8081da
Clean up convoluted hvm_inject_exception() logic.

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


diff -r d1b0a8a84ccf -r aae8c2372a56 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Thu Apr 19 15:30:44 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Fri Apr 20 09:33:35 2012 +0100
@@ -1203,30 +1203,19 @@ void hvm_triple_fault(void)
 
 void hvm_inject_exception(unsigned int trapnr, int errcode, unsigned long cr2)
 {
-    struct vcpu *v = current;
-
-    if ( !nestedhvm_enabled(v->domain) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( nestedhvm_vmswitch_in_progress(v) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( !nestedhvm_vcpu_in_guestmode(v) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( nhvm_vmcx_guest_intercepts_trap(v, trapnr, errcode) )
+    struct vcpu *curr = current;
+
+    if ( nestedhvm_enabled(curr->domain) &&
+         !nestedhvm_vmswitch_in_progress(curr) &&
+         nestedhvm_vcpu_in_guestmode(curr) &&
+         nhvm_vmcx_guest_intercepts_trap(curr, trapnr, errcode) )
     {
         enum nestedhvm_vmexits nsret;
 
-        nsret = nhvm_vcpu_vmexit_trap(v, trapnr, errcode, cr2);
-
-        switch (nsret) {
+        nsret = nhvm_vcpu_vmexit_trap(curr, trapnr, errcode, cr2);
+
+        switch ( nsret )
+        {
         case NESTEDHVM_VMEXIT_DONE:
         case NESTEDHVM_VMEXIT_ERROR: /* L1 guest will crash L2 guest */
             return;

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcb-0003o0-NN; Sat, 21 Apr 2012 02:00:21 +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 1SLPcZ-0003nY-FD
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:19 +0000
Received: from [85.158.138.51:61584] by server-3.bemta-3.messagelabs.com id
	57/A7-04048-2B4129F4; Sat, 21 Apr 2012 02:00:18 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1334973616!23161832!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12063 invoked from network); 21 Apr 2012 02:00:17 -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;
	21 Apr 2012 02:00:17 -0000
Received: from xenbits.xen.org ([50.57.170.242])
	by mail.xen.org with esmtp (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcW-0002wM-F1
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcS-0001Ra-Ib
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Message-Id: <E1SLPcS-0001Ra-Ib@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Clean up convoluted
	hvm_inject_exception() logic.
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1334910815 -3600
# Node ID aae8c2372a56262267c37e9ba538091c1f8f753f
# Parent  d1b0a8a84ccf3a7eed25996adf2e67916b8081da
Clean up convoluted hvm_inject_exception() logic.

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


diff -r d1b0a8a84ccf -r aae8c2372a56 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Thu Apr 19 15:30:44 2012 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Fri Apr 20 09:33:35 2012 +0100
@@ -1203,30 +1203,19 @@ void hvm_triple_fault(void)
 
 void hvm_inject_exception(unsigned int trapnr, int errcode, unsigned long cr2)
 {
-    struct vcpu *v = current;
-
-    if ( !nestedhvm_enabled(v->domain) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( nestedhvm_vmswitch_in_progress(v) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( !nestedhvm_vcpu_in_guestmode(v) ) {
-        hvm_funcs.inject_exception(trapnr, errcode, cr2);
-        return;
-    }
-
-    if ( nhvm_vmcx_guest_intercepts_trap(v, trapnr, errcode) )
+    struct vcpu *curr = current;
+
+    if ( nestedhvm_enabled(curr->domain) &&
+         !nestedhvm_vmswitch_in_progress(curr) &&
+         nestedhvm_vcpu_in_guestmode(curr) &&
+         nhvm_vmcx_guest_intercepts_trap(curr, trapnr, errcode) )
     {
         enum nestedhvm_vmexits nsret;
 
-        nsret = nhvm_vcpu_vmexit_trap(v, trapnr, errcode, cr2);
-
-        switch (nsret) {
+        nsret = nhvm_vcpu_vmexit_trap(curr, trapnr, errcode, cr2);
+
+        switch ( nsret )
+        {
         case NESTEDHVM_VMEXIT_DONE:
         case NESTEDHVM_VMEXIT_ERROR: /* L1 guest will crash L2 guest */
             return;

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcb-0003o6-R9; Sat, 21 Apr 2012 02:00:21 +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 1SLPcZ-0003na-Tg
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:20 +0000
Received: from [85.158.138.51:10125] by server-10.bemta-3.messagelabs.com id
	84/8E-29478-3B4129F4; Sat, 21 Apr 2012 02:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1334973617!12111794!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15462 invoked from network); 21 Apr 2012 02:00:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Apr 2012 02: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 1SLPcW-0002wP-Q5
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcW-0001Rr-Hb
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Message-Id: <E1SLPcW-0001Rr-Hb@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vmx: Allow software (user defined)
	interrupts to be injected in to the guest
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Aravindh Puthiyaparambil <aravindh@virtuata.com>
# Date 1334911426 -3600
# Node ID cf2de273869f06e907fb28127682284e8670b1cc
# Parent  aae8c2372a56262267c37e9ba538091c1f8f753f
vmx: Allow software (user defined) interrupts to be injected in to the guest

If xc_hvm_inject_trap() is called on a software (user defined)
interrupt, it causes the guest to crash with a vmentry failure. The
following patch fixes this issue.

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r aae8c2372a56 -r cf2de273869f xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Apr 20 09:33:35 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Apr 20 09:43:46 2012 +0100
@@ -1364,6 +1364,8 @@ void vmx_inject_hw_exception(int trap, i
         }
         if ( cpu_has_monitor_trap_flag )
             break;
+        /* fall through */
+
     case TRAP_int3:
         if ( curr->domain->debugger_attached )
         {
@@ -1374,6 +1376,15 @@ void vmx_inject_hw_exception(int trap, i
 
         type = X86_EVENTTYPE_SW_EXCEPTION;
         __vmwrite(VM_ENTRY_INSTRUCTION_LEN, 1); /* int3 */
+        break;
+
+    default:
+        if ( trap > TRAP_last_reserved )
+        {
+            type = X86_EVENTTYPE_SW_EXCEPTION;
+            __vmwrite(VM_ENTRY_INSTRUCTION_LEN, 2); /* int imm8 */
+        }
+        break;
     }
 
     if ( unlikely(intr_info & INTR_INFO_VALID_MASK) &&
diff -r aae8c2372a56 -r cf2de273869f xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Fri Apr 20 09:33:35 2012 +0100
+++ b/xen/include/asm-x86/processor.h	Fri Apr 20 09:43:46 2012 +0100
@@ -111,6 +111,7 @@
 #define TRAP_alignment_check  17
 #define TRAP_machine_check    18
 #define TRAP_simd_error       19
+#define TRAP_last_reserved    31
 
 /* Set for entry via SYSCALL. Informs return code to use SYSRETQ not IRETQ. */
 /* NB. Same as VGCF_in_syscall. No bits in common with any other TRAP_ defn. */

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

From xen-changelog-bounces@lists.xen.org Sat Apr 21 02:00:27 2012
Return-path: <xen-changelog-bounces@lists.xen.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Apr 2012 02: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 1SLPcb-0003o6-R9; Sat, 21 Apr 2012 02:00:21 +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 1SLPcZ-0003na-Tg
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:20 +0000
Received: from [85.158.138.51:10125] by server-10.bemta-3.messagelabs.com id
	84/8E-29478-3B4129F4; Sat, 21 Apr 2012 02:00:19 +0000
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1334973617!12111794!1
X-Originating-IP: [50.57.168.107]
X-SpamReason: No, hits=0.0 required=7.0 tests=
X-StarScan-Version: 6.5.7; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15462 invoked from network); 21 Apr 2012 02:00:18 -0000
Received: from mail.xen.org (HELO mail.xen.org) (50.57.168.107)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Apr 2012 02: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 1SLPcW-0002wP-Q5
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1SLPcW-0001Rr-Hb
	for xen-changelog@lists.xensource.com; Sat, 21 Apr 2012 02:00:16 +0000
Message-Id: <E1SLPcW-0001Rr-Hb@xenbits.xen.org>
Date: Sat, 21 Apr 2012 02:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vmx: Allow software (user defined)
	interrupts to be injected in to the guest
X-BeenThere: xen-changelog@lists.xen.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xen.org>
List-Unsubscribe: <http://lists.xen.org/cgi-bin/mailman/options/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xen.org>
List-Help: <mailto:xen-changelog-request@lists.xen.org?subject=help>
List-Subscribe: <http://lists.xen.org/cgi-bin/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xen.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: xen-changelog-bounces@lists.xen.org
Errors-To: xen-changelog-bounces@lists.xen.org

# HG changeset patch
# User Aravindh Puthiyaparambil <aravindh@virtuata.com>
# Date 1334911426 -3600
# Node ID cf2de273869f06e907fb28127682284e8670b1cc
# Parent  aae8c2372a56262267c37e9ba538091c1f8f753f
vmx: Allow software (user defined) interrupts to be injected in to the guest

If xc_hvm_inject_trap() is called on a software (user defined)
interrupt, it causes the guest to crash with a vmentry failure. The
following patch fixes this issue.

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r aae8c2372a56 -r cf2de273869f xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Apr 20 09:33:35 2012 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Apr 20 09:43:46 2012 +0100
@@ -1364,6 +1364,8 @@ void vmx_inject_hw_exception(int trap, i
         }
         if ( cpu_has_monitor_trap_flag )
             break;
+        /* fall through */
+
     case TRAP_int3:
         if ( curr->domain->debugger_attached )
         {
@@ -1374,6 +1376,15 @@ void vmx_inject_hw_exception(int trap, i
 
         type = X86_EVENTTYPE_SW_EXCEPTION;
         __vmwrite(VM_ENTRY_INSTRUCTION_LEN, 1); /* int3 */
+        break;
+
+    default:
+        if ( trap > TRAP_last_reserved )
+        {
+            type = X86_EVENTTYPE_SW_EXCEPTION;
+            __vmwrite(VM_ENTRY_INSTRUCTION_LEN, 2); /* int imm8 */
+        }
+        break;
     }
 
     if ( unlikely(intr_info & INTR_INFO_VALID_MASK) &&
diff -r aae8c2372a56 -r cf2de273869f xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Fri Apr 20 09:33:35 2012 +0100
+++ b/xen/include/asm-x86/processor.h	Fri Apr 20 09:43:46 2012 +0100
@@ -111,6 +111,7 @@
 #define TRAP_alignment_check  17
 #define TRAP_machine_check    18
 #define TRAP_simd_error       19
+#define TRAP_last_reserved    31
 
 /* Set for entry via SYSCALL. Informs return code to use SYSRETQ not IRETQ. */
 /* NB. Same as VGCF_in_syscall. No bits in common with any other TRAP_ defn. */

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

