rpms/kernel/devel cifs-fix-malicious-redirect-problem-in-the-dns-lookup-code.patch, NONE, 1.1.2.1 crypto-add-async-hash-testing.patch, NONE, 1.2.2.2 crypto-testmgr-add-null-test-for-aesni.patch, NONE, 1.1.2.1 drm-i915-add-reclaimable-to-page-allocations.patch, NONE, 1.1.2.1 drm-i915-fix-hibernate-memory-corruption.patch, NONE, 1.1.4.2 drm-intel-945gm-stability-fixes.patch, NONE, 1.1.2.1 ext4-make-sure-the-move_ext-ioctl-can-t-overwrite-append-only-files.patch, NONE, 1.1.2.1 inotify-fix-inotify-oneshot-support.patch, NONE, 1.1.2.1 inotify-send-IN_UNMOUNT-events.patch, NONE, 1.1.2.1 linux-2.6-ext4-quota-metadata-reservation.patch, NONE, 1.1.2.1 pci-acpi-disable-aspm-if-no-osc.patch, NONE, 1.3.2.2 pci-aspm-dont-enable-too-early.patch, NONE, 1.2.2.2 usb-obey-the-sysfs-power-wakeup-setting.patch, NONE, 1.1.2.1 config-generic, 1.238.6.55, 1.238.6.56 config-i686-PAE, 1.1.18.3, 1.1.18.4 config-x86-generic, 1.68.6.24, 1.68.6.25 kernel.spec, 1.1294.2.108, 1.1294.2.109 xen.pvops.patch, 1.1.2.71, 1.1.2.72

myoung myoung at fedoraproject.org
Tue Jul 27 19:27:51 UTC 2010


Author: myoung

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv25131

Modified Files:
      Tag: private-myoung-dom0-branch
	config-generic config-i686-PAE config-x86-generic kernel.spec 
	xen.pvops.patch 
Added Files:
      Tag: private-myoung-dom0-branch
	cifs-fix-malicious-redirect-problem-in-the-dns-lookup-code.patch 
	crypto-add-async-hash-testing.patch 
	crypto-testmgr-add-null-test-for-aesni.patch 
	drm-i915-add-reclaimable-to-page-allocations.patch 
	drm-i915-fix-hibernate-memory-corruption.patch 
	drm-intel-945gm-stability-fixes.patch 
	ext4-make-sure-the-move_ext-ioctl-can-t-overwrite-append-only-files.patch 
	inotify-fix-inotify-oneshot-support.patch 
	inotify-send-IN_UNMOUNT-events.patch 
	linux-2.6-ext4-quota-metadata-reservation.patch 
	pci-acpi-disable-aspm-if-no-osc.patch 
	pci-aspm-dont-enable-too-early.patch 
	usb-obey-the-sysfs-power-wakeup-setting.patch 
Log Message:
update pvops, clean out some config-generic additions and try building
more as modules


cifs-fix-malicious-redirect-problem-in-the-dns-lookup-code.patch:
 cifsfs.c      |    6 ++--
 dns_resolve.c |   70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 dns_resolve.h |    4 +--
 3 files changed, 75 insertions(+), 5 deletions(-)

--- NEW FILE cifs-fix-malicious-redirect-problem-in-the-dns-lookup-code.patch ---
From: David Howells <dhowells at redhat.com>
Date: Thu, 22 Jul 2010 11:53:18 +0000 (+0100)
Subject: CIFS: Fix a malicious redirect problem in the DNS lookup code
X-Git-Tag: v2.6.35-rc6~6
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=4c0c03ca54f72fdd5912516ad0a23ec5cf01bda7

CIFS: Fix a malicious redirect problem in the DNS lookup code

[ trivial backport to 2.6.32 : cebbert at redhat.com ]

Fix the security problem in the CIFS filesystem DNS lookup code in which a
malicious redirect could be installed by a random user by simply adding a
result record into one of their keyrings with add_key() and then invoking a
CIFS CFS lookup [CVE-2010-2524].

This is done by creating an internal keyring specifically for the caching of
DNS lookups.  To enforce the use of this keyring, the module init routine
creates a set of override credentials with the keyring installed as the thread
keyring and instructs request_key() to only install lookup result keys in that
keyring.

The override is then applied around the call to request_key().

This has some additional benefits when a kernel service uses this module to
request a key:

 (1) The result keys are owned by root, not the user that caused the lookup.

 (2) The result keys don't pop up in the user's keyrings.

 (3) The result keys don't come out of the quota of the user that caused the
     lookup.

The keyring can be viewed as root by doing cat /proc/keys:

2a0ca6c3 I-----     1 perm 1f030000     0     0 keyring   .dns_resolver: 1/4

It can then be listed with 'keyctl list' by root.

	# keyctl list 0x2a0ca6c3
	1 key in keyring:
	726766307: --alswrv     0     0 dns_resolver: foo.bar.com

Signed-off-by: David Howells <dhowells at redhat.com>
Reviewed-and-Tested-by: Jeff Layton <jlayton at redhat.com>
Acked-by: Steve French <smfrench at gmail.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 484e52b..2cb1a70 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -923,7 +923,7 @@ init_cifs(void)
 		goto out_unregister_filesystem;
 #endif
 #ifdef CONFIG_CIFS_DFS_UPCALL
-	rc = register_key_type(&key_type_dns_resolver);
+	rc = cifs_init_dns_resolver();
 	if (rc)
 		goto out_unregister_key_type;
 #endif
@@ -935,7 +935,7 @@ init_cifs(void)
 
  out_unregister_resolver_key:
 #ifdef CONFIG_CIFS_DFS_UPCALL
-	unregister_key_type(&key_type_dns_resolver);
+	cifs_exit_dns_resolver();
  out_unregister_key_type:
 #endif
 #ifdef CONFIG_CIFS_UPCALL
@@ -961,7 +961,7 @@ exit_cifs(void)
 	cifs_proc_clean();
 #ifdef CONFIG_CIFS_DFS_UPCALL
 	cifs_dfs_release_automount_timer();
-	unregister_key_type(&key_type_dns_resolver);
+	cifs_exit_dns_resolver();
 #endif
 #ifdef CONFIG_CIFS_UPCALL
 	unregister_key_type(&cifs_spnego_key_type);
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c
index 4db2c5e..49315cb 100644
--- a/fs/cifs/dns_resolve.c
+++ b/fs/cifs/dns_resolve.c
@@ -24,12 +24,17 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include <linux/slab.h>
+#include <linux/keyctl.h>
+#include <linux/key-type.h>
 #include <keys/user-type.h>
 #include "dns_resolve.h"
 #include "cifsglob.h"
 #include "cifsproto.h"
 #include "cifs_debug.h"
 
+static const struct cred *dns_resolver_cache;
+
 /* Checks if supplied name is IP address
  * returns:
  * 		1 - name is IP
@@ -94,6 +99,7 @@ struct key_type key_type_dns_resolver = {
 int
 dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
 {
+	const struct cred *saved_cred;
 	int rc = -EAGAIN;
 	struct key *rkey = ERR_PTR(-EAGAIN);
 	char *name;
@@ -133,8 +139,15 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
 		goto skip_upcall;
 	}
 
+	saved_cred = override_creds(dns_resolver_cache);
 	rkey = request_key(&key_type_dns_resolver, name, "");
+	revert_creds(saved_cred);
 	if (!IS_ERR(rkey)) {
+		if (!(rkey->perm & KEY_USR_VIEW)) {
+			down_read(&rkey->sem);
+			rkey->perm |= KEY_USR_VIEW;
+			up_read(&rkey->sem);
+		}
 		len = rkey->type_data.x[0];
 		data = rkey->payload.data;
 	} else {
@@ -165,4 +178,61 @@ out:
 	return rc;
 }
 
+int __init cifs_init_dns_resolver(void)
+{
+	struct cred *cred;
+	struct key *keyring;
+	int ret;
+
+	printk(KERN_NOTICE "Registering the %s key type\n",
+	       key_type_dns_resolver.name);
+
+	/* create an override credential set with a special thread keyring in
+	 * which DNS requests are cached
+	 *
+	 * this is used to prevent malicious redirections from being installed
+	 * with add_key().
+	 */
+	cred = prepare_kernel_cred(NULL);
+	if (!cred)
+		return -ENOMEM;
+
+	keyring = key_alloc(&key_type_keyring, ".dns_resolver", 0, 0, cred,
+			    (KEY_POS_ALL & ~KEY_POS_SETATTR) |
+			    KEY_USR_VIEW | KEY_USR_READ,
+			    KEY_ALLOC_NOT_IN_QUOTA);
+	if (IS_ERR(keyring)) {
+		ret = PTR_ERR(keyring);
+		goto failed_put_cred;
+	}
+
+	ret = key_instantiate_and_link(keyring, NULL, 0, NULL, NULL);
+	if (ret < 0)
+		goto failed_put_key;
+
+	ret = register_key_type(&key_type_dns_resolver);
+	if (ret < 0)
+		goto failed_put_key;
+
+	/* instruct request_key() to use this special keyring as a cache for
+	 * the results it looks up */
+	cred->thread_keyring = keyring;
+	cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
+	dns_resolver_cache = cred;
+	return 0;
+
+failed_put_key:
+	key_put(keyring);
+failed_put_cred:
+	put_cred(cred);
+	return ret;
+}
 
+void __exit cifs_exit_dns_resolver(void)
+{
+	key_revoke(dns_resolver_cache->thread_keyring);
+	unregister_key_type(&key_type_dns_resolver);
+	put_cred(dns_resolver_cache);
+	printk(KERN_NOTICE "Unregistered %s key type\n",
+	       key_type_dns_resolver.name);
+}
diff --git a/fs/cifs/dns_resolve.h b/fs/cifs/dns_resolve.h
index 966e928..26b9eaa 100644
--- a/fs/cifs/dns_resolve.h
+++ b/fs/cifs/dns_resolve.h
@@ -24,8 +24,8 @@
 #define _DNS_RESOLVE_H
 
 #ifdef __KERNEL__
-#include <linux/key-type.h>
-extern struct key_type key_type_dns_resolver;
+extern int __init cifs_init_dns_resolver(void);
+extern void __exit cifs_exit_dns_resolver(void);
 extern int dns_resolve_server_name_to_ip(const char *unc, char **ip_addr);
 #endif /* KERNEL */
 

crypto-add-async-hash-testing.patch:
 testmgr.c |   67 ++++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 48 insertions(+), 19 deletions(-)

--- NEW FILE crypto-add-async-hash-testing.patch ---
>From e45009229be6a7fae49bdfa3459905668c0b0fb1 Mon Sep 17 00:00:00 2001
From: David S. Miller <davem at davemloft.net>
Date: Wed, 19 May 2010 14:12:03 +1000
Subject: crypto: testmgr - Add testing for async hashing and update/final

Extend testmgr such that it tests async hash algorithms,
and that for both sync and async hashes it tests both
->digest() and ->update()/->final() sequences.

Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
---
 crypto/testmgr.c |   66 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index c494d76..5c8aaa0 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -153,8 +153,21 @@ static void testmgr_free_buf(char *buf[XBUFSIZE])
 		free_page((unsigned long)buf[i]);
 }
 
+static int do_one_async_hash_op(struct ahash_request *req,
+				struct tcrypt_result *tr,
+				int ret)
+{
+	if (ret == -EINPROGRESS || ret == -EBUSY) {
+		ret = wait_for_completion_interruptible(&tr->completion);
+		if (!ret)
+			ret = tr->err;
+		INIT_COMPLETION(tr->completion);
+	}
+	return ret;
+}
+
 static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
-		     unsigned int tcount)
+		     unsigned int tcount, bool use_digest)
 {
 	const char *algo = crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm));
 	unsigned int i, j, k, temp;
@@ -206,23 +219,36 @@ static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,
 		}
 
 		ahash_request_set_crypt(req, sg, result, template[i].psize);
-		ret = crypto_ahash_digest(req);
-		switch (ret) {
-		case 0:
-			break;
-		case -EINPROGRESS:
-		case -EBUSY:
-			ret = wait_for_completion_interruptible(
-				&tresult.completion);
-			if (!ret && !(ret = tresult.err)) {
-				INIT_COMPLETION(tresult.completion);
-				break;
+		if (use_digest) {
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_digest(req));
+			if (ret) {
+				pr_err("alg: hash: digest failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
+			}
+		} else {
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_init(req));
+			if (ret) {
+				pr_err("alt: hash: init failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
+			}
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_update(req));
+			if (ret) {
+				pr_err("alt: hash: update failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
+			}
+			ret = do_one_async_hash_op(req, &tresult,
+						   crypto_ahash_final(req));
+			if (ret) {
+				pr_err("alt: hash: final failed on test %d "
+				       "for %s: ret=%d\n", j, algo, -ret);
+				goto out;
 			}
-			/* fall through */
-		default:
-			printk(KERN_ERR "alg: hash: digest failed on test %d "
-			       "for %s: ret=%d\n", j, algo, -ret);
-			goto out;
 		}
 
 		if (memcmp(result, template[i].digest,
@@ -1402,7 +1428,11 @@ static int alg_test_hash(const struct alg_test_desc *desc, const char *driver,
 		return PTR_ERR(tfm);
 	}
 
-	err = test_hash(tfm, desc->suite.hash.vecs, desc->suite.hash.count);
+	err = test_hash(tfm, desc->suite.hash.vecs,
+			desc->suite.hash.count, true);
+	if (!err)
+		err = test_hash(tfm, desc->suite.hash.vecs,
+				desc->suite.hash.count, false);
 
 	crypto_free_ahash(tfm);
 	return err;
-- 
1.7.0.1


crypto-testmgr-add-null-test-for-aesni.patch:
 testmgr.c |   84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

--- NEW FILE crypto-testmgr-add-null-test-for-aesni.patch ---
From: Youquan, Song <youquan.song at intel.com>
Date: Wed, 23 Dec 2009 11:45:20 +0000 (+0800)
Subject: crypto: testmgr - Fix complain about lack test for internal used algorithm
X-Git-Tag: v2.6.34-rc1~286^2~28
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=863b557a88f8c033f7419fabafef4712a5055f85

crypto: testmgr - Fix complain about lack test for internal used algorithm

When load aesni-intel and ghash_clmulni-intel driver,kernel will complain no
 test for some internal used algorithm.
The strange information as following:

alg: No test for __aes-aesni (__driver-aes-aesni)
alg: No test for __ecb-aes-aesni (__driver-ecb-aes-aesni)
alg: No test for __cbc-aes-aesni (__driver-cbc-aes-aesni)
alg: No test for __ecb-aes-aesni (cryptd(__driver-ecb-aes-aesni)
alg: No test for __ghash (__ghash-pclmulqdqni)
alg: No test for __ghash (cryptd(__ghash-pclmulqdqni))

This patch add NULL test entries for these algorithm and driver.

Signed-off-by: Youquan, Song <youquan.song at intel.com>
Signed-off-by: Ying, Huang <ying.huang at intel.com>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
---

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 7620bfc..c494d76 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1477,9 +1477,54 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver,
 	return err;
 }
 
+static int alg_test_null(const struct alg_test_desc *desc,
+			     const char *driver, u32 type, u32 mask)
+{
+	return 0;
+}
+
 /* Please keep this list sorted by algorithm name. */
 static const struct alg_test_desc alg_test_descs[] = {
 	{
+		.alg = "__driver-cbc-aes-aesni",
+		.test = alg_test_null,
+		.suite = {
+			.cipher = {
+				.enc = {
+					.vecs = NULL,
+					.count = 0
+				},
+				.dec = {
+					.vecs = NULL,
+					.count = 0
+				}
+			}
+		}
+	}, {
+		.alg = "__driver-ecb-aes-aesni",
+		.test = alg_test_null,
+		.suite = {
+			.cipher = {
+				.enc = {
+					.vecs = NULL,
+					.count = 0
+				},
+				.dec = {
+					.vecs = NULL,
+					.count = 0
+				}
+			}
+		}
+	}, {
+		.alg = "__ghash-pclmulqdqni",
+		.test = alg_test_null,
+		.suite = {
+			.hash = {
+				.vecs = NULL,
+				.count = 0
+			}
+		}
+	}, {
 		.alg = "ansi_cprng",
 		.test = alg_test_cprng,
 		.fips_allowed = 1,
@@ -1623,6 +1668,30 @@ static const struct alg_test_desc alg_test_descs[] = {
 			}
 		}
 	}, {
+		.alg = "cryptd(__driver-ecb-aes-aesni)",
+		.test = alg_test_null,
+		.suite = {
+			.cipher = {
+				.enc = {
+					.vecs = NULL,
+					.count = 0
+				},
+				.dec = {
+					.vecs = NULL,
+					.count = 0
+				}
+			}
+		}
+	}, {
+		.alg = "cryptd(__ghash-pclmulqdqni)",
+		.test = alg_test_null,
+		.suite = {
+			.hash = {
+				.vecs = NULL,
+				.count = 0
+			}
+		}
+	}, {
 		.alg = "ctr(aes)",
 		.test = alg_test_skcipher,
 		.fips_allowed = 1,
@@ -1669,6 +1738,21 @@ static const struct alg_test_desc alg_test_descs[] = {
 			}
 		}
 	}, {
+		.alg = "ecb(__aes-aesni)",
+		.test = alg_test_null,
+		.suite = {
+			.cipher = {
+				.enc = {
+					.vecs = NULL,
+					.count = 0
+				},
+				.dec = {
+					.vecs = NULL,
+					.count = 0
+				}
+			}
+		}
+	}, {
 		.alg = "ecb(aes)",
 		.test = alg_test_skcipher,
 		.fips_allowed = 1,

drm-i915-add-reclaimable-to-page-allocations.patch:
 i915_gem.c |    1 +
 1 file changed, 1 insertion(+)

--- NEW FILE drm-i915-add-reclaimable-to-page-allocations.patch ---
From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sun, 18 Jul 2010 16:44:37 +0000 (-0700)
Subject: drm/i915: add 'reclaimable' to i915 self-reclaimable page allocations
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=cd9f040df6ce46573760a507cb88192d05d27d86

drm/i915: add 'reclaimable' to i915 self-reclaimable page allocations

The hibernate issues that got fixed in commit 985b823b9192 ("drm/i915:
fix hibernation since i915 self-reclaim fixes") turn out to have been
incomplete.  Vefa Bicakci tested lots of hibernate cycles, and without
the __GFP_RECLAIMABLE flag the system eventually fails to resume.

With the flag added, Vefa can apparently hibernate forever (or until he
gets bored running his automated scripts, whichever comes first).

The reclaimable flag was there originally, and was one of the flags that
were dropped (unintentionally) by commit 4bdadb978569 ("drm/i915:
Selectively enable self-reclaim") that introduced all these problems,
but I didn't want to just blindly add back all the flags in commit
985b823b9192, and it looked like __GFP_RECLAIM wasn't necessary.  It
clearly was.

I still suspect that there is some subtle reason we're missing that
causes the problems, but __GFP_RECLAIMABLE is certainly not wrong to use
in this context, and is what the code historically used.  And we have no
idea what the causes the corruption without it.

Reported-and-tested-by: M. Vefa Bicakci <bicave at superonline.com>
Cc: Dave Airlie <airlied at gmail.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro at jp.fujitsu.com>
Cc: Hugh Dickins <hugh.dickins at tiscali.co.uk>
Cc: stable at kernel.org
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0743858..8757ecf 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2241,6 +2241,7 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
 		page = read_cache_page_gfp(mapping, i,
 					   GFP_HIGHUSER |
 					   __GFP_COLD |
+					   __GFP_RECLAIMABLE |
 					   gfpmask);
 		if (IS_ERR(page))
 			goto err_pages;

drm-i915-fix-hibernate-memory-corruption.patch:
 i915_gem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE drm-i915-fix-hibernate-memory-corruption.patch ---
From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Fri, 2 Jul 2010 00:04:42 +0000 (+1000)
Subject: drm/i915: fix hibernation since i915 self-reclaim fixes
X-Git-Tag: v2.6.35-rc4~13
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=985b823b919273fe1327d56d2196b4f92e5d0fae

drm/i915: fix hibernation since i915 self-reclaim fixes

Since commit 4bdadb9785696439c6e2b3efe34aa76df1149c83 ("drm/i915:
Selectively enable self-reclaim"), we've been passing GFP_MOVABLE to the
i915 page allocator where we weren't before due to some over-eager
removal of the page mapping gfp_flags games the code used to play.

This caused hibernate on Intel hardware to result in a lot of memory
corruptions on resume.  See for example

  http://bugzilla.kernel.org/show_bug.cgi?id=13811

Reported-by: Evengi Golov (in bugzilla)
Signed-off-by: Dave Airlie <airlied at redhat.com>
Tested-by: M. Vefa Bicakci <bicave at superonline.com>
Cc: stable at kernel.org
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro at jp.fujitsu.com>
Cc: Hugh Dickins <hugh.dickins at tiscali.co.uk>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9ded3da..0743858 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2239,7 +2239,7 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
 	mapping = inode->i_mapping;
 	for (i = 0; i < page_count; i++) {
 		page = read_cache_page_gfp(mapping, i,
-					   mapping_gfp_mask (mapping) |
+					   GFP_HIGHUSER |
 					   __GFP_COLD |
 					   gfpmask);
 		if (IS_ERR(page))

drm-intel-945gm-stability-fixes.patch:
 b/drivers/gpu/drm/i915/i915_gem.c |   10 +++++
 b/drivers/gpu/drm/i915/i915_reg.h |   64 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h   |    8 ++++
 3 files changed, 81 insertions(+), 1 deletion(-)

--- NEW FILE drm-intel-945gm-stability-fixes.patch ---
upstream commit 944001201ca0196bcdb088129e5866a9f379d08c
(plus some defines)
[2.6.32 backport]

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0d05c6f..b87f65d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4967,6 +4967,16 @@ i915_gem_load(struct drm_device *dev)
 	list_add(&dev_priv->mm.shrink_list, &shrink_list);
 	spin_unlock(&shrink_list_lock);
 
+	/* On GEN3 we really need to make sure the ARB C3 LP bit is set */
+	if (IS_GEN3(dev)) {
+		u32 tmp = I915_READ(MI_ARB_STATE);
+		if (!(tmp & MI_ARB_C3_LP_WRITE_ENABLE)) {
+			/* arb state is a masked write, so set bit + bit in mask */
+			tmp = MI_ARB_C3_LP_WRITE_ENABLE | (MI_ARB_C3_LP_WRITE_ENABLE << MI_ARB_MASK_SHIFT);
+			I915_WRITE(MI_ARB_STATE, tmp);
+		}
+	}
+
 	/* Old X drivers will take 0-2 for front, back, depth buffers */
 	dev_priv->fence_reg_start = 3;
 
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 4cbc521..4543975 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -357,6 +357,70 @@
 #define LM_BURST_LENGTH     0x00000700
 #define LM_FIFO_WATERMARK   0x0000001F
 #define MI_ARB_STATE	0x020e4 /* 915+ only */
+#define   MI_ARB_MASK_SHIFT	  16	/* shift for enable bits */
+
+/* Make render/texture TLB fetches lower priorty than associated data
+ *   fetches. This is not turned on by default
+ */
+#define   MI_ARB_RENDER_TLB_LOW_PRIORITY	(1 << 15)
+
+/* Isoch request wait on GTT enable (Display A/B/C streams).
+ * Make isoch requests stall on the TLB update. May cause
+ * display underruns (test mode only)
+ */
+#define   MI_ARB_ISOCH_WAIT_GTT			(1 << 14)
+
+/* Block grant count for isoch requests when block count is
+ * set to a finite value.
+ */
+#define   MI_ARB_BLOCK_GRANT_MASK		(3 << 12)
+#define   MI_ARB_BLOCK_GRANT_8			(0 << 12)	/* for 3 display planes */
+#define   MI_ARB_BLOCK_GRANT_4			(1 << 12)	/* for 2 display planes */
+#define   MI_ARB_BLOCK_GRANT_2			(2 << 12)	/* for 1 display plane */
+#define   MI_ARB_BLOCK_GRANT_0			(3 << 12)	/* don't use */
+
+/* Enable render writes to complete in C2/C3/C4 power states.
+ * If this isn't enabled, render writes are prevented in low
+ * power states. That seems bad to me.
+ */
+#define   MI_ARB_C3_LP_WRITE_ENABLE		(1 << 11)
+
+/* This acknowledges an async flip immediately instead
+ * of waiting for 2TLB fetches.
+ */
+#define   MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE	(1 << 10)
+
+/* Enables non-sequential data reads through arbiter
+ */
+#define   MI_ARB_DUAL_DATA_PHASE_DISABLE       	(1 << 9)
+
+/* Disable FSB snooping of cacheable write cycles from binner/render
+ * command stream
+ */
+#define   MI_ARB_CACHE_SNOOP_DISABLE		(1 << 8)
+
+/* Arbiter time slice for non-isoch streams */
+#define   MI_ARB_TIME_SLICE_MASK		(7 << 5)
+#define   MI_ARB_TIME_SLICE_1			(0 << 5)
+#define   MI_ARB_TIME_SLICE_2			(1 << 5)
+#define   MI_ARB_TIME_SLICE_4			(2 << 5)
+#define   MI_ARB_TIME_SLICE_6			(3 << 5)
+#define   MI_ARB_TIME_SLICE_8			(4 << 5)
+#define   MI_ARB_TIME_SLICE_10			(5 << 5)
+#define   MI_ARB_TIME_SLICE_14			(6 << 5)
+#define   MI_ARB_TIME_SLICE_16			(7 << 5)
+
+/* Low priority grace period page size */
+#define   MI_ARB_LOW_PRIORITY_GRACE_4KB		(0 << 4)	/* default */
+#define   MI_ARB_LOW_PRIORITY_GRACE_8KB		(1 << 4)
+
+/* Disable display A/B trickle feed */
+#define   MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE	(1 << 2)
+
+/* Set display plane priority */
+#define   MI_ARB_DISPLAY_PRIORITY_A_B		(0 << 0)	/* display A > display B */
+#define   MI_ARB_DISPLAY_PRIORITY_B_A		(1 << 0)	/* display B > display A */
+
 #define CACHE_MODE_0	0x02120 /* 915+ only */
 #define   CM0_MASK_SHIFT          16
 #define   CM0_IZ_OPT_DISABLE      (1<<6)
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1045,6 +1045,13 @@ extern int i915_wait_ring(struct drm_dev
 #define IS_I9XX(dev)		(INTEL_INFO(dev)->is_i9xx)
 #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
 
+#define IS_GEN3(dev)	(IS_I915G(dev) ||			\
+			 IS_I915GM(dev) ||			\
+			 IS_I945G(dev) ||			\
+			 IS_I945GM(dev) ||			\
+			 IS_G33(dev) || \
+			 IS_PINEVIEW(dev))
+
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
 
 /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
-- 

ext4-make-sure-the-move_ext-ioctl-can-t-overwrite-append-only-files.patch:
 move_extent.c |    3 +++
 1 file changed, 3 insertions(+)

--- NEW FILE ext4-make-sure-the-move_ext-ioctl-can-t-overwrite-append-only-files.patch ---
>From 1f5a81e41f8b1a782c68d3843e9ec1bfaadf7d72 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso at mit.edu>
Date: Wed, 2 Jun 2010 22:04:39 -0400
Subject: ext4: Make sure the MOVE_EXT ioctl can't overwrite append-only files

From: Theodore Ts'o <tytso at mit.edu>

commit 1f5a81e41f8b1a782c68d3843e9ec1bfaadf7d72 upstream.

Dan Roseberg has reported a problem with the MOVE_EXT ioctl.  If the
donor file is an append-only file, we should not allow the operation
to proceed, lest we end up overwriting the contents of an append-only
file.

Signed-off-by: "Theodore Ts'o" <tytso at mit.edu>
Cc: Dan Rosenberg <dan.j.rosenberg at gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

---
 fs/ext4/move_extent.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -959,6 +959,9 @@ mext_check_arguments(struct inode *orig_
 		return -EINVAL;
 	}
 
+	if (IS_IMMUTABLE(donor_inode) || IS_APPEND(donor_inode))
+		return -EPERM;
+
 	/* Ext4 move extent does not support swapfile */
 	if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) {
 		ext4_debug("ext4 move extent: The argument files should "

inotify-fix-inotify-oneshot-support.patch:
 inotify_fsnotify.c |    3 +++
 1 file changed, 3 insertions(+)

--- NEW FILE inotify-fix-inotify-oneshot-support.patch ---
#607327

During the large inotify rewrite to fsnotify I completely dropped support
for IN_ONESHOT.  Reimplement that support.

Signed-off-by: Eric Paris <eparis at redhat.com>
---

 fs/notify/inotify/inotify_fsnotify.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index daa666a..388a150 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -126,6 +126,9 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_ev
 			ret = 0;
 	}
 
+	if (entry->mask & IN_ONESHOT)
+		fsnotify_destroy_mark_by_entry(entry);
+
 	/*
 	 * If we hold the entry until after the event is on the queue
 	 * IN_IGNORED won't be able to pass this event in the queue

inotify-send-IN_UNMOUNT-events.patch:
 inotify_user.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- NEW FILE inotify-send-IN_UNMOUNT-events.patch ---
#607327 ?

Since the .31 or so notify rewrite inotify has not sent events about
inodes which are unmounted.  This patch restores those events.

Signed-off-by: Eric Paris <eparis at redhat.com>
---

 fs/notify/inotify/inotify_user.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 44aeb0f..f381daf 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -90,8 +90,11 @@ static inline __u32 inotify_arg_to_mask(u32 arg)
 {
 	__u32 mask;
 
-	/* everything should accept their own ignored and cares about children */
-	mask = (FS_IN_IGNORED | FS_EVENT_ON_CHILD);
+	/*
+	 * everything should accept their own ignored, cares about children,
+	 * and should receive events when the inode is unmounted
+	 */
+	mask = (FS_IN_IGNORED | FS_EVENT_ON_CHILD | FS_UNMOUNT);
 
 	/* mask off the flags used to open the fd */
 	mask |= (arg & (IN_ALL_EVENTS | IN_ONESHOT));

linux-2.6-ext4-quota-metadata-reservation.patch:
 fs/ext4/balloc.c         |    5 
 fs/ext4/ext4.h           |    4 
 fs/ext4/ext4_extents.h   |    3 
 fs/ext4/extents.c        |   90 ++++++++++++++---
 fs/ext4/inode.c          |  239 ++++++++++++++++++++++++++---------------------
 fs/ext4/mballoc.c        |    6 -
 fs/ext4/super.c          |    1 
 fs/quota/dquot.c         |   23 ++--
 include/linux/quotaops.h |   27 +++++
 9 files changed, 257 insertions(+), 141 deletions(-)

--- NEW FILE linux-2.6-ext4-quota-metadata-reservation.patch ---
For bug #608770

Do not speculatively allocate metadata for quota; it's too complex, and we
usually get it wrong.

Backport of these upstream patches, some of which just play a supporting role.

 -Eric

515f41c33a9d44a964264c9511ad2c869af1fac3 ext4: Ensure zeroout blocks have no dirty metadata
d21cd8f163ac44b15c465aab7306db931c606908 ext4: Fix potential quota deadlock
0637c6f4135f592f094207c7c21e7c0fc5557834 ext4: Patch up how we claim metadata blocks for quota purposes
9d0be50230b333005635967f7ecd4897dbfd181b ext4: Calculate metadata requirements more accurately
1db913823c0f8360fccbd24ca67eb073966a5ffd ext4: Handle -EDQUOT error on write
5f634d064c709ea02c3cdaa850a08323a4a4bf28 ext4: Fix quota accounting error with fallocate
56246f9ae4cfa95b460f9dfbcfb1b772d85db046 quota: use flags interface for dquot alloc/free space
0e05842bc117ea70ceb979cca798fd026879951b quota: add the option to not fail with EDQUOT in block
72b8ab9dde211ea518ff27e631b2046ef90c29a2 ext4: don't use quota reservation for speculative metadata


Index: linux-2.6.32.noarch/fs/ext4/extents.c
===================================================================
--- linux-2.6.32.noarch.orig/fs/ext4/extents.c
+++ linux-2.6.32.noarch/fs/ext4/extents.c
@@ -296,29 +296,44 @@ static inline int ext4_ext_space_root_id
  * to allocate @blocks
  * Worse case is one block per extent
  */
-int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks)
+int ext4_ext_calc_metadata_amount(struct inode *inode, sector_t lblock)
 {
-	int lcap, icap, rcap, leafs, idxs, num;
-	int newextents = blocks;
+	struct ext4_inode_info *ei = EXT4_I(inode);
+	int idxs, num = 0;
 
-	rcap = ext4_ext_space_root_idx(inode, 0);
-	lcap = ext4_ext_space_block(inode, 0);
-	icap = ext4_ext_space_block_idx(inode, 0);
+	idxs = ((inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
+		/ sizeof(struct ext4_extent_idx));
 
-	/* number of new leaf blocks needed */
-	num = leafs = (newextents + lcap - 1) / lcap;
+	/*
+	 * If the new delayed allocation block is contiguous with the
+	 * previous da block, it can share index blocks with the
+	 * previous block, so we only need to allocate a new index
+	 * block every idxs leaf blocks.  At ldxs**2 blocks, we need
+	 * an additional index block, and at ldxs**3 blocks, yet
+	 * another index blocks.
+	 */
+	if (ei->i_da_metadata_calc_len &&
+	    ei->i_da_metadata_calc_last_lblock+1 == lblock) {
+		if ((ei->i_da_metadata_calc_len % idxs) == 0)
+			num++;
+		if ((ei->i_da_metadata_calc_len % (idxs*idxs)) == 0)
+			num++;
+		if ((ei->i_da_metadata_calc_len % (idxs*idxs*idxs)) == 0) {
+			num++;
+			ei->i_da_metadata_calc_len = 0;
+		} else
+			ei->i_da_metadata_calc_len++;
+		ei->i_da_metadata_calc_last_lblock++;
+		return num;
+	}
 
 	/*
-	 * Worse case, we need separate index block(s)
-	 * to link all new leaf blocks
+	 * In the worst case we need a new set of index blocks at
+	 * every level of the inode's extent tree.
 	 */
-	idxs = (leafs + icap - 1) / icap;
-	do {
-		num += idxs;
-		idxs = (idxs + icap - 1) / icap;
-	} while (idxs > rcap);
-
-	return num;
+	ei->i_da_metadata_calc_len = 1;
+	ei->i_da_metadata_calc_last_lblock = lblock;
+	return ext_depth(inode) + 1;
 }
 
 static int
@@ -3029,6 +3044,14 @@ out:
 	return err;
 }
 
+static void unmap_underlying_metadata_blocks(struct block_device *bdev,
+			sector_t block, int count)
+{
+	int i;
+	for (i = 0; i < count; i++)
+                unmap_underlying_metadata(bdev, block + i);
+}
+
 static int
 ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
 			ext4_lblk_t iblock, unsigned int max_blocks,
@@ -3104,6 +3127,30 @@ out:
 	} else
 		allocated = ret;
 	set_buffer_new(bh_result);
+	/*
+	 * if we allocated more blocks than requested
+	 * we need to make sure we unmap the extra block
+	 * allocated. The actual needed block will get
+	 * unmapped later when we find the buffer_head marked
+	 * new.
+	 */
+	if (allocated > max_blocks) {
+		unmap_underlying_metadata_blocks(inode->i_sb->s_bdev,
+					newblock + max_blocks,
+					allocated - max_blocks);
+		allocated = max_blocks;
+	}
+
+	/*
+	 * If we have done fallocate with the offset that is already
+	 * delayed allocated, we would have block reservation
+	 * and quota reservation done in the delayed write path.
+	 * But fallocate would have already updated quota and block
+	 * count for this offset. So cancel these reservation
+	 */
+	if (flags & EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE)
+		ext4_da_update_reserve_space(inode, allocated, 0);
+
 map_out:
 	set_buffer_mapped(bh_result);
 out1:
@@ -3333,9 +3380,18 @@ int ext4_ext_get_blocks(handle_t *handle
 	/* previous routine could use block we allocated */
 	newblock = ext_pblock(&newex);
 	allocated = ext4_ext_get_actual_len(&newex);
+	if (allocated > max_blocks)
+		allocated = max_blocks;
 	set_buffer_new(bh_result);
 
 	/*
+	 * Update reserved blocks/metadata blocks after successful
+	 * block allocation which had been deferred till now.
+	 */
+	if (flags & EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE)
+		ext4_da_update_reserve_space(inode, allocated, 1);
+
+	/*
 	 * Cache the extent and update transaction to commit on fdatasync only
 	 * when it is _not_ an uninitialized extent.
 	 */
Index: linux-2.6.32.noarch/fs/ext4/inode.c
===================================================================
--- linux-2.6.32.noarch.orig/fs/ext4/inode.c
+++ linux-2.6.32.noarch/fs/ext4/inode.c
@@ -1051,81 +1051,105 @@ qsize_t *ext4_get_reserved_space(struct 
 	return &EXT4_I(inode)->i_reserved_quota;
 }
 #endif
+
 /*
  * Calculate the number of metadata blocks need to reserve
- * to allocate @blocks for non extent file based file
+ * to allocate a new block at @lblocks for non extent file based file
  */
-static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks)
+static int ext4_indirect_calc_metadata_amount(struct inode *inode,
+					      sector_t lblock)
 {
-	int icap = EXT4_ADDR_PER_BLOCK(inode->i_sb);
-	int ind_blks, dind_blks, tind_blks;
-
-	/* number of new indirect blocks needed */
-	ind_blks = (blocks + icap - 1) / icap;
+	struct ext4_inode_info *ei = EXT4_I(inode);
+	int dind_mask = EXT4_ADDR_PER_BLOCK(inode->i_sb) - 1;
+	int blk_bits;
 
-	dind_blks = (ind_blks + icap - 1) / icap;
+	if (lblock < EXT4_NDIR_BLOCKS)
+		return 0;
 
-	tind_blks = 1;
+	lblock -= EXT4_NDIR_BLOCKS;
 
-	return ind_blks + dind_blks + tind_blks;
+	if (ei->i_da_metadata_calc_len &&
+	    (lblock & dind_mask) == ei->i_da_metadata_calc_last_lblock) {
+		ei->i_da_metadata_calc_len++;
+		return 0;
+	}
+	ei->i_da_metadata_calc_last_lblock = lblock & dind_mask;
+	ei->i_da_metadata_calc_len = 1;
+	blk_bits = roundup_pow_of_two(lblock + 1);
+	return (blk_bits / EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb)) + 1;
 }
 
 /*
  * Calculate the number of metadata blocks need to reserve
- * to allocate given number of blocks
+ * to allocate a block located at @lblock
  */
-static int ext4_calc_metadata_amount(struct inode *inode, int blocks)
+static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock)
 {
-	if (!blocks)
-		return 0;
-
 	if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
-		return ext4_ext_calc_metadata_amount(inode, blocks);
+		return ext4_ext_calc_metadata_amount(inode, lblock);
 
-	return ext4_indirect_calc_metadata_amount(inode, blocks);
+	return ext4_indirect_calc_metadata_amount(inode, lblock);
 }
 
-static void ext4_da_update_reserve_space(struct inode *inode, int used)
+/*
+ * Called with i_data_sem down, which is important since we can call
+ * ext4_discard_preallocations() from here.
+ */
+void ext4_da_update_reserve_space(struct inode *inode,
+					int used, int quota_claim)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
-	int total, mdb, mdb_free;
+	struct ext4_inode_info *ei = EXT4_I(inode);
 
-	spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
-	/* recalculate the number of metablocks still need to be reserved */
-	total = EXT4_I(inode)->i_reserved_data_blocks - used;
-	mdb = ext4_calc_metadata_amount(inode, total);
-
-	/* figure out how many metablocks to release */
-	BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
-	mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb;
-
-	if (mdb_free) {
-		/* Account for allocated meta_blocks */
-		mdb_free -= EXT4_I(inode)->i_allocated_meta_blocks;
-
-		/* update fs dirty blocks counter */
-		percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free);
-		EXT4_I(inode)->i_allocated_meta_blocks = 0;
-		EXT4_I(inode)->i_reserved_meta_blocks = mdb;
-	}
-
-	/* update per-inode reservations */
-	BUG_ON(used  > EXT4_I(inode)->i_reserved_data_blocks);
-	EXT4_I(inode)->i_reserved_data_blocks -= used;
+	spin_lock(&ei->i_block_reservation_lock);
+	if (unlikely(used > ei->i_reserved_data_blocks)) {
+		ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d "
+			 "with only %d reserved data blocks\n",
+			 __func__, inode->i_ino, used,
+			 ei->i_reserved_data_blocks);
+		WARN_ON(1);
+		used = ei->i_reserved_data_blocks;
+	}
+
+	/* Update per-inode reservations */
+	ei->i_reserved_data_blocks -= used;
+	ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
+	percpu_counter_sub(&sbi->s_dirtyblocks_counter,
+			   used + ei->i_allocated_meta_blocks);
+	ei->i_allocated_meta_blocks = 0;
+
+	if (ei->i_reserved_data_blocks == 0) {
+		/*
+		 * We can release all of the reserved metadata blocks
+		 * only when we have written all of the delayed
+		 * allocation blocks.
+		 */
+		percpu_counter_sub(&sbi->s_dirtyblocks_counter,
+				   ei->i_reserved_meta_blocks);
+		ei->i_reserved_meta_blocks = 0;
+		ei->i_da_metadata_calc_len = 0;
+	}
 	spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
 
-	/*
-	 * free those over-booking quota for metadata blocks
-	 */
-	if (mdb_free)
-		vfs_dq_release_reservation_block(inode, mdb_free);
+	/* Update quota subsystem for data blocks */
+	if (quota_claim) {
+		vfs_dq_claim_block(inode, used);
+	} else {
+		/*
+		 * We did fallocate with an offset that is already delayed
+		 * allocated. So on delayed allocated writeback we should
+		 * not re-claim the quota for fallocated blocks.
+		 */
+		vfs_dq_release_reservation_block(inode, used);
+	}
 
 	/*
 	 * If we have done all the pending block allocations and if
 	 * there aren't any writers on the inode, we can discard the
 	 * inode's preallocations.
 	 */
-	if (!total && (atomic_read(&inode->i_writecount) == 0))
+	if ((ei->i_reserved_data_blocks == 0) &&
+	    (atomic_read(&inode->i_writecount) == 0))
 		ext4_discard_preallocations(inode);
 }
 
@@ -1317,18 +1341,20 @@ int ext4_get_blocks(handle_t *handle, st
 			 */
 			EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE;
 		}
-	}
 
+		/*
+		 * Update reserved blocks/metadata blocks after successful
+		 * block allocation which had been deferred till now. We don't
+		 * support fallocate for non extent files. So we can update
+		 * reserve space here.
+		 */
+		if ((retval > 0) &&
+			(flags & EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE))
+			ext4_da_update_reserve_space(inode, retval, 1);
+	}
 	if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
 		EXT4_I(inode)->i_delalloc_reserved_flag = 0;
 
-	/*
-	 * Update reserved blocks/metadata blocks after successful
-	 * block allocation which had been deferred till now.
-	 */
-	if ((retval > 0) && (flags & EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE))
-		ext4_da_update_reserve_space(inode, retval);
-
 	up_write((&EXT4_I(inode)->i_data_sem));
 	if (retval > 0 && buffer_mapped(bh)) {
 		int ret = check_block_validity(inode, "file system "
@@ -1834,11 +1860,15 @@ static int ext4_journalled_write_end(str
 	return ret ? ret : copied;
 }
 
-static int ext4_da_reserve_space(struct inode *inode, int nrblocks)
+/*
+ * Reserve a single block located at lblock
+ */
+static int ext4_da_reserve_space(struct inode *inode, sector_t lblock)
 {
 	int retries = 0;
 	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
-	unsigned long md_needed, mdblocks, total = 0;
+	struct ext4_inode_info *ei = EXT4_I(inode);
+	unsigned long md_needed;
 
 	/*
 	 * recalculate the amount of metadata blocks to reserve
@@ -1846,35 +1876,34 @@ static int ext4_da_reserve_space(struct 
 	 * worse case is one extent per block
 	 */
 repeat:
-	spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
-	total = EXT4_I(inode)->i_reserved_data_blocks + nrblocks;
-	mdblocks = ext4_calc_metadata_amount(inode, total);
-	BUG_ON(mdblocks < EXT4_I(inode)->i_reserved_meta_blocks);
-
-	md_needed = mdblocks - EXT4_I(inode)->i_reserved_meta_blocks;
-	total = md_needed + nrblocks;
-	spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
+	spin_lock(&ei->i_block_reservation_lock);
+	md_needed = ext4_calc_metadata_amount(inode, lblock);
+	spin_unlock(&ei->i_block_reservation_lock);
 
 	/*
-	 * Make quota reservation here to prevent quota overflow
-	 * later. Real quota accounting is done at pages writeout
-	 * time.
+	 * We will charge metadata quota at writeout time; this saves
+	 * us from metadata over-estimation, though we may go over by
+	 * a small amount in the end.  Here we just reserve for data.
 	 */
-	if (vfs_dq_reserve_block(inode, total))
+	if (vfs_dq_reserve_block(inode, 1))
 		return -EDQUOT;
 
-	if (ext4_claim_free_blocks(sbi, total)) {
-		vfs_dq_release_reservation_block(inode, total);
+	/*
+	 * We do still charge estimated metadata to the sb though;
+	 * we cannot afford to run out of free blocks.
+	 */
+	if (ext4_claim_free_blocks(sbi, md_needed + 1)) {
+		vfs_dq_release_reservation_block(inode, 1);
 		if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
 			yield();
 			goto repeat;
 		}
 		return -ENOSPC;
 	}
-	spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
-	EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
-	EXT4_I(inode)->i_reserved_meta_blocks += md_needed;
-	spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
+	spin_lock(&ei->i_block_reservation_lock);
+	ei->i_reserved_data_blocks++;
+	ei->i_reserved_meta_blocks += md_needed;
+	spin_unlock(&ei->i_block_reservation_lock);
 
 	return 0;       /* success */
 }
@@ -1882,49 +1911,47 @@ repeat:
 static void ext4_da_release_space(struct inode *inode, int to_free)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
-	int total, mdb, mdb_free, release;
+	struct ext4_inode_info *ei = EXT4_I(inode);
 
 	if (!to_free)
 		return;		/* Nothing to release, exit */
 
 	spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
 
-	if (!EXT4_I(inode)->i_reserved_data_blocks) {
+	if (unlikely(to_free > ei->i_reserved_data_blocks)) {
 		/*
-		 * if there is no reserved blocks, but we try to free some
-		 * then the counter is messed up somewhere.
-		 * but since this function is called from invalidate
-		 * page, it's harmless to return without any action
-		 */
-		printk(KERN_INFO "ext4 delalloc try to release %d reserved "
-			    "blocks for inode %lu, but there is no reserved "
-			    "data blocks\n", to_free, inode->i_ino);
-		spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
-		return;
+		 * if there aren't enough reserved blocks, then the
+		 * counter is messed up somewhere.  Since this
+		 * function is called from invalidate page, it's
+		 * harmless to return without any action.
+		 */
+		ext4_msg(inode->i_sb, KERN_NOTICE, "ext4_da_release_space: "
+			 "ino %lu, to_free %d with only %d reserved "
+			 "data blocks\n", inode->i_ino, to_free,
+			 ei->i_reserved_data_blocks);
+		WARN_ON(1);
+		to_free = ei->i_reserved_data_blocks;
 	}
+	ei->i_reserved_data_blocks -= to_free;
 
-	/* recalculate the number of metablocks still need to be reserved */
-	total = EXT4_I(inode)->i_reserved_data_blocks - to_free;
-	mdb = ext4_calc_metadata_amount(inode, total);
-
-	/* figure out how many metablocks to release */
-	BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
-	mdb_free = EXT4_I(inode)->i_reserved_meta_blocks - mdb;
-
-	release = to_free + mdb_free;
-
-	/* update fs dirty blocks counter for truncate case */
-	percpu_counter_sub(&sbi->s_dirtyblocks_counter, release);
+	if (ei->i_reserved_data_blocks == 0) {
+		/*
+		 * We can release all of the reserved metadata blocks
+		 * only when we have written all of the delayed
+		 * allocation blocks.
+		 */
+		percpu_counter_sub(&sbi->s_dirtyblocks_counter,
+				   ei->i_reserved_meta_blocks);
+		ei->i_reserved_meta_blocks = 0;
+		ei->i_da_metadata_calc_len = 0;
+	}
 
-	/* update per-inode reservations */
-	BUG_ON(to_free > EXT4_I(inode)->i_reserved_data_blocks);
-	EXT4_I(inode)->i_reserved_data_blocks -= to_free;
+	/* update fs dirty data blocks counter */
+	percpu_counter_sub(&sbi->s_dirtyblocks_counter, to_free);
 
-	BUG_ON(mdb > EXT4_I(inode)->i_reserved_meta_blocks);
-	EXT4_I(inode)->i_reserved_meta_blocks = mdb;
 	spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
 
-	vfs_dq_release_reservation_block(inode, release);
+	vfs_dq_release_reservation_block(inode, to_free);
 }
 
 static void ext4_da_page_release_reservation(struct page *page,
@@ -2530,7 +2557,7 @@ static int ext4_da_get_block_prep(struct
 		 * XXX: __block_prepare_write() unmaps passed block,
 		 * is it OK?
 		 */
-		ret = ext4_da_reserve_space(inode, 1);
+		ret = ext4_da_reserve_space(inode, iblock);
 		if (ret)
 			/* not enough space to reserve */
 			return ret;
Index: linux-2.6.32.noarch/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.32.noarch.orig/fs/ext4/mballoc.c
+++ linux-2.6.32.noarch/fs/ext4/mballoc.c
@@ -2756,12 +2756,6 @@ ext4_mb_mark_diskspace_used(struct ext4_
 	if (!(ac->ac_flags & EXT4_MB_DELALLOC_RESERVED))
 		/* release all the reserved blocks if non delalloc */
 		percpu_counter_sub(&sbi->s_dirtyblocks_counter, reserv_blks);
-	else {
-		percpu_counter_sub(&sbi->s_dirtyblocks_counter,
-						ac->ac_b_ex.fe_len);
-		/* convert reserved quota blocks to real quota blocks */
-		vfs_dq_claim_block(ac->ac_inode, ac->ac_b_ex.fe_len);
-	}
 
 	if (sbi->s_log_groups_per_flex) {
 		ext4_group_t flex_group = ext4_flex_group(sbi,
Index: linux-2.6.32.noarch/fs/ext4/ext4.h
===================================================================
--- linux-2.6.32.noarch.orig/fs/ext4/ext4.h
+++ linux-2.6.32.noarch/fs/ext4/ext4.h
@@ -693,6 +693,8 @@ struct ext4_inode_info {
 	unsigned int i_reserved_meta_blocks;
 	unsigned int i_allocated_meta_blocks;
 	unsigned short i_delalloc_reserved_flag;
+	sector_t i_da_metadata_calc_last_lblock;
+	int i_da_metadata_calc_len;
 
 	/* on-disk additional length */
 	__u16 i_extra_isize;
@@ -1438,6 +1440,8 @@ extern int ext4_block_truncate_page(hand
 extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
 extern qsize_t *ext4_get_reserved_space(struct inode *inode);
 extern int flush_aio_dio_completed_IO(struct inode *inode);
+extern void ext4_da_update_reserve_space(struct inode *inode,
+					int used, int quota_claim);
 /* ioctl.c */
 extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
 extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
Index: linux-2.6.32.noarch/fs/ext4/ext4_extents.h
===================================================================
--- linux-2.6.32.noarch.orig/fs/ext4/ext4_extents.h
+++ linux-2.6.32.noarch/fs/ext4/ext4_extents.h
@@ -225,7 +225,8 @@ static inline void ext4_ext_mark_initial
 	ext->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ext));
 }
 
-extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks);
+extern int ext4_ext_calc_metadata_amount(struct inode *inode,
+					 sector_t lblocks);
 extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex);
 extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
 extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
Index: linux-2.6.32.noarch/fs/ext4/super.c
===================================================================
--- linux-2.6.32.noarch.orig/fs/ext4/super.c
+++ linux-2.6.32.noarch/fs/ext4/super.c
@@ -702,6 +702,7 @@ static struct inode *ext4_alloc_inode(st
 	ei->i_reserved_data_blocks = 0;
 	ei->i_reserved_meta_blocks = 0;
 	ei->i_allocated_meta_blocks = 0;
+	ei->i_da_metadata_calc_len = 0;
 	ei->i_delalloc_reserved_flag = 0;
 	spin_lock_init(&(ei->i_block_reservation_lock));
 #ifdef CONFIG_QUOTA
Index: linux-2.6.32.noarch/fs/quota/dquot.c
===================================================================
--- linux-2.6.32.noarch.orig/fs/quota/dquot.c
+++ linux-2.6.32.noarch/fs/quota/dquot.c
@@ -1492,11 +1492,13 @@ static void inode_decr_space(struct inod
 /*
  * This operation can block, but only after everything is updated
  */
-int __dquot_alloc_space(struct inode *inode, qsize_t number,
-			int warn, int reserve)
+int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 {
 	int cnt, ret = QUOTA_OK;
 	char warntype[MAXQUOTAS];
+	int warn = flags & DQUOT_SPACE_WARN;
+	int reserve = flags & DQUOT_SPACE_RESERVE;
+	int nofail = flags & DQUOT_SPACE_NOFAIL;
 
 	/*
 	 * First test before acquiring mutex - solves deadlocks when we
@@ -1521,7 +1523,7 @@ int __dquot_alloc_space(struct inode *in
 		if (!inode->i_dquot[cnt])
 			continue;
 		if (check_bdq(inode->i_dquot[cnt], number, warn, warntype+cnt)
-		    == NO_QUOTA) {
+		    == NO_QUOTA && !nofail) {
 			ret = NO_QUOTA;
 			spin_unlock(&dq_data_lock);
 			goto out_flush_warn;
@@ -1552,15 +1554,19 @@ out:
 	return ret;
 }
 
-int dquot_alloc_space(struct inode *inode, qsize_t number, int warn)
+int dquot_alloc_space(struct inode *inode, qsize_t number, int flags)
 {
-	return __dquot_alloc_space(inode, number, warn, 0);
+	return __dquot_alloc_space(inode, number, flags);
 }
 EXPORT_SYMBOL(dquot_alloc_space);
 
 int dquot_reserve_space(struct inode *inode, qsize_t number, int warn)
 {
-	return __dquot_alloc_space(inode, number, warn, 1);
+	int flags = DQUOT_SPACE_RESERVE;
+
+	if (warn)
+		flags |= DQUOT_SPACE_WARN;
+	return __dquot_alloc_space(inode, number, flags);
 }
 EXPORT_SYMBOL(dquot_reserve_space);
 
@@ -1651,10 +1657,11 @@ EXPORT_SYMBOL(dquot_claim_space);
 /*
  * This operation can block, but only after everything is updated
  */
-int __dquot_free_space(struct inode *inode, qsize_t number, int reserve)
+int __dquot_free_space(struct inode *inode, qsize_t number, int flags)
 {
 	unsigned int cnt;
 	char warntype[MAXQUOTAS];
+	int reserve = flags & DQUOT_SPACE_RESERVE;
 
 	/* First test before acquiring mutex - solves deadlocks when we
          * re-enter the quota code and are already holding the mutex */
@@ -1706,7 +1713,7 @@ EXPORT_SYMBOL(dquot_free_space);
  */
 void dquot_release_reserved_space(struct inode *inode, qsize_t number)
 {
-	__dquot_free_space(inode, number, 1);
+	__dquot_free_space(inode, number, DQUOT_SPACE_RESERVE);
 
 }
 EXPORT_SYMBOL(dquot_release_reserved_space);
Index: linux-2.6.32.noarch/include/linux/quotaops.h
===================================================================
--- linux-2.6.32.noarch.orig/include/linux/quotaops.h
+++ linux-2.6.32.noarch/include/linux/quotaops.h
@@ -14,6 +14,10 @@ static inline struct quota_info *sb_dqop
 	return &sb->s_dquot;
 }
 
+#define DQUOT_SPACE_WARN	0x1
+#define DQUOT_SPACE_RESERVE	0x2
+#define DQUOT_SPACE_NOFAIL	0x4
+
 #if defined(CONFIG_QUOTA)
 
 /*
@@ -159,7 +163,7 @@ static inline int vfs_dq_prealloc_space_
 {
 	if (sb_any_quota_active(inode->i_sb)) {
 		/* Used space is updated in alloc_space() */
-		if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
+		if (inode->i_sb->dq_op->alloc_space(inode, nr, DQUOT_SPACE_WARN) == NO_QUOTA)
 			return 1;
 	}
 	else
@@ -187,6 +191,16 @@ static inline int vfs_dq_alloc_space_nod
 	return 0;
 }
 
+static inline void vfs_dq_alloc_space_nofail(struct inode *inode, qsize_t nr)
+{
+	if (sb_any_quota_active(inode->i_sb)) {
+		/* Used space is updated in alloc_space() */
+		inode->i_sb->dq_op->alloc_space(inode, nr, DQUOT_SPACE_NOFAIL);
+	} else
+		inode_add_bytes(inode, nr);
+	mark_inode_dirty(inode);
+}
+
 static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
 {
 	int ret;
@@ -382,6 +396,12 @@ static inline int vfs_dq_alloc_space_nod
 	return 0;
 }
 
+static inline void vfs_dq_alloc_space_nofail(struct inode *inode, qsize_t nr)
+{
+	inode_add_bytes(inode, nr);
+	mark_inode_dirty(inode);
+}
+
 static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
 {
 	vfs_dq_alloc_space_nodirty(inode, nr);
@@ -433,6 +453,11 @@ static inline int vfs_dq_alloc_block_nod
 	return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
 }
 
+static inline void vfs_dq_alloc_block_nofail(struct inode *inode, qsize_t nr)
+{
+	vfs_dq_alloc_space_nofail(inode, nr << inode->i_blkbits);
+}
+
 static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
 {
 	return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
Index: linux-2.6.32.noarch/fs/ext4/balloc.c
===================================================================
--- linux-2.6.32.noarch.orig/fs/ext4/balloc.c
+++ linux-2.6.32.noarch/fs/ext4/balloc.c
@@ -642,14 +642,15 @@ ext4_fsblk_t ext4_new_meta_blocks(handle
 	ret = ext4_mb_new_blocks(handle, &ar, errp);
 	if (count)
 		*count = ar.len;
-
 	/*
-	 * Account for the allocated meta blocks
+	 * Account for the allocated meta blocks.  We will never
+	 * fail EDQUOT for metdata, but we do account for it.
 	 */
 	if (!(*errp) && EXT4_I(inode)->i_delalloc_reserved_flag) {
 		spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
 		EXT4_I(inode)->i_allocated_meta_blocks += ar.len;
 		spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
+		vfs_dq_alloc_block_nofail(inode, ar.len);
 	}
 	return ret;
 }


pci-acpi-disable-aspm-if-no-osc.patch:
 pci_root.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- NEW FILE pci-acpi-disable-aspm-if-no-osc.patch ---
From: Matthew Garrett <mjg at redhat.com>
Subject: ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe

ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe

[ backport to 2.6.32 ]

The PCI SIG documentation for the _OSC OS/firmware handshaking interface
states:

"If the _OSC control method is absent from the scope of a host bridge
device, then the operating system must not enable or attempt to use any
features defined in this section for the hierarchy originated by the host
bridge."

The obvious interpretation of this is that the OS should not attempt to use
PCIe hotplug, PME or AER - however, the specification also notes that an
_OSC method is *required* for PCIe hierarchies, and experimental validation
with An Alternative OS indicates that it doesn't use any PCIe functionality
if the _OSC method is missing. That arguably means we shouldn't be using
MSI or extended config space, but right now our problems seem to be limited
to vendors being surprised when ASPM gets enabled on machines when other
OSs refuse to do so. So, for now, let's just disable ASPM if the _OSC
method doesn't exist or refuses to hand over PCIe capability control.

Signed-off-by: Matthew Garrett <mjg at redhat.com>
---

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 4eac593..1f67057 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -33,6 +33,7 @@
 #include <linux/pm.h>
 #include <linux/pci.h>
 #include <linux/pci-acpi.h>
+#include <linux/pci-aspm.h>
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
@@ -543,6 +544,14 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 	if (flags != base_flags)
 		acpi_pci_osc_support(root, flags);
 
+	status = acpi_pci_osc_control_set(root->device->handle,
+					  0);
+
+	if (status == AE_NOT_EXIST) {
+		printk(KERN_INFO "Unable to assume PCIe control: Disabling ASPM\n");
+		pcie_no_aspm();
+	}
+
 	return 0;
 
 end:
pci-aspm-dont-enable-too-early.patch:
 aspm.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

--- NEW FILE pci-aspm-dont-enable-too-early.patch ---
From: Matthew Garrett <mjg at redhat.com>
Date: Wed, 9 Jun 2010 20:05:07 +0000 (-0400)
Subject: PCI: Don't enable aspm before drivers have had a chance to veto it
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjbarnes%2Fpci-2.6.git;a=commitdiff_plain;h=8f0b08c29f1df91315e48adce04462eb23671099

PCI: Don't enable aspm before drivers have had a chance to veto it

The aspm code will currently set the configured aspm policy before drivers
have had an opportunity to indicate that their hardware doesn't support it.
Unfortunately, putting some hardware in L0 or L1 can result in the hardware
no longer responding to any requests, even after aspm is disabled. It makes
more sense to leave aspm policy at the BIOS defaults at initial setup time,
reconfiguring it after pci_enable_device() is called. This allows the
driver to blacklist individual devices beforehand.

Reviewed-by: Kenji Kaneshige <kaneshige.kenji at jp.fujitsu.com>
Signed-off-by: Matthew Garrett <mjg at redhat.com>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index be53d98..7122281 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -588,11 +588,23 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
 	 * update through pcie_aspm_cap_init().
 	 */
 	pcie_aspm_cap_init(link, blacklist);
-	pcie_config_aspm_path(link);
 
 	/* Setup initial Clock PM state */
 	pcie_clkpm_cap_init(link, blacklist);
-	pcie_set_clkpm(link, policy_to_clkpm_state(link));
+
+	/*
+	 * At this stage drivers haven't had an opportunity to change the
+	 * link policy setting. Enabling ASPM on broken hardware can cripple
+	 * it even before the driver has had a chance to disable ASPM, so
+	 * default to a safe level right now. If we're enabling ASPM beyond
+	 * the BIOS's expectation, we'll do so once pci_enable_device() is
+	 * called.
+	 */
+	if (aspm_policy != POLICY_POWERSAVE) {
+		pcie_config_aspm_path(link);
+		pcie_set_clkpm(link, policy_to_clkpm_state(link));
+	}
+
 unlock:
 	mutex_unlock(&aspm_lock);
 out:

usb-obey-the-sysfs-power-wakeup-setting.patch:
 driver.c |   15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

--- NEW FILE usb-obey-the-sysfs-power-wakeup-setting.patch ---
This patch (as1403b) is a backport of commit
48826626263d4a61d06fd8c5805da31f925aefa0 (USB: obey the sysfs
power/wakeup setting) to 2.6.{32,33}.stable.  It turns out that the
bug it fixes does affect quite a few people using USB infrared
remotes.  The symptom is that the remote can no longer wake up the
system from suspend.

This fixes Bugzilla #16043.

Red Hat Bugzilla #617559

Signed-off-by: Alan Stern <stern at xxxxxxxxxxxxxxxxxxx>

---

Index: 2.6.33.5/drivers/usb/core/driver.c
===================================================================
--- 2.6.33.5.orig/drivers/usb/core/driver.c
+++ 2.6.33.5/drivers/usb/core/driver.c
@@ -1790,9 +1790,6 @@ int usb_external_resume_device(struct us
 
 static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
 {
-	int			w, i;
-	struct usb_interface	*intf;
-
 	/* Remote wakeup is needed only when we actually go to sleep.
 	 * For things like FREEZE and QUIESCE, if the device is already
 	 * autosuspended then its current wakeup setting is okay.
@@ -1802,18 +1799,10 @@ static void choose_wakeup(struct usb_dev
 		return;
 	}
 
-	/* If remote wakeup is permitted, see whether any interface drivers
+	/* Allow remote wakeup if it is enabled, even if no interface drivers
 	 * actually want it.
 	 */
-	w = 0;
-	if (device_may_wakeup(&udev->dev) && udev->actconfig) {
-		for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
-			intf = udev->actconfig->interface[i];
-			w |= intf->needs_remote_wakeup;
-		}
-	}
-
-	udev->do_remote_wakeup = w;
+	udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
 }
 
 int usb_suspend(struct device *dev, pm_message_t msg)



Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-generic,v
retrieving revision 1.238.6.55
retrieving revision 1.238.6.56
diff -u -p -r1.238.6.55 -r1.238.6.56
--- config-generic	18 May 2010 21:58:02 -0000	1.238.6.55
+++ config-generic	27 Jul 2010 19:27:34 -0000	1.238.6.56
@@ -2211,7 +2211,6 @@ CONFIG_DRM_I830=m
 CONFIG_DRM_MGA=m
 CONFIG_DRM_SIS=m
 CONFIG_DRM_SAVAGE=m
-CONFIG_DRM_MRST=n
 CONFIG_DRM_I915=m
 CONFIG_DRM_I915_KMS=y
 CONFIG_DRM_VIA=m
@@ -4064,29 +4063,13 @@ CONFIG_HWPOISON_INJECT=m
 # added for xen pvops patch
 #
 CONFIG_XEN_DOM0=y
-CONFIG_ALLOW_WARNINGS=y
 CONFIG_XEN_BACKEND=y
-CONFIG_XEN_BLKDEV_BACKEND=y
-CONFIG_XEN_NETDEV_BACKEND=y
-CONFIG_RD_GZIP=y
-# CONFIG_RD_BZIP2 is not set
-# CONFIG_RD_LZMA is not set
-CONFIG_XEN_GNTDEV=y
-# CONFIG_ENABLE_EVENT_TRACING is not set
+CONFIG_XEN_BLKDEV_BACKEND=m
+CONFIG_XEN_NETDEV_BACKEND=m
+CONFIG_XEN_GNTDEV=m
 CONFIG_XEN_PCI_PASSTHROUGH=y
-# CONFIG_XEN_PCI_PASSTHROUGH_DEBUG is not set
-# CONFIG_X86_DS_SELFTEST is not set
 CONFIG_XEN_PCIDEV_BACKEND=m
 # CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_PCIDEV_FRONTEND is not set
-CONFIG_XEN_NETCHANNEL2=m
-CONFIG_XEN_NETDEV2_BACKEND=y
-CONFIG_XEN_NETDEV2_FRONTEND=y
-CONFIG_XEN_NETDEV2_BYPASSABLE=y
-CONFIG_XEN_NETDEV2_BYPASS_ENDPOINT=y
-CONFIG_XEN_NETDEV2_AUTOMATIC_BYPASS=y
-CONFIG_NETFILTER_XT_TARGET_IMQ=m
-CONFIG_IMQ=m
+CONFIG_XEN_PCIDEV_FRONTEND=m
 CONFIG_XEN_BLKDEV_TAP=m
-CONFIG_IMQ_NUM_DEVS=16
-# CONFIG_XEN_PLATFORM_PCI is not set
+CONFIG_XEN_PLATFORM_PCI=m


Index: config-i686-PAE
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-i686-PAE,v
retrieving revision 1.1.18.3
retrieving revision 1.1.18.4
diff -u -p -r1.1.18.3 -r1.1.18.4
--- config-i686-PAE	18 May 2010 21:58:02 -0000	1.1.18.3
+++ config-i686-PAE	27 Jul 2010 19:27:34 -0000	1.1.18.4
@@ -5,7 +5,6 @@ CONFIG_XEN_DEV_EVTCHN=m
 CONFIG_XEN_SYS_HYPERVISOR=y
 
 CONFIG_LANGWELL_IPC=y
-CONFIG_DRM_MRST=m
 # CONFIG_IMG_DOES_NOT_SUPPORT_MENLOW is not set
 CONFIG_PVR_RELEASE="release"
 CONFIG_PVR_SERVICES4=y


Index: config-x86-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-x86-generic,v
retrieving revision 1.68.6.24
retrieving revision 1.68.6.25
diff -u -p -r1.68.6.24 -r1.68.6.25
--- config-x86-generic	28 Mar 2010 15:50:11 -0000	1.68.6.24
+++ config-x86-generic	27 Jul 2010 19:27:34 -0000	1.68.6.25
@@ -460,7 +460,7 @@ CONFIG_X86_MCE_AMD=y
 # CONFIG_X86_ANCIENT_MCE is not set
 # CONFIG_X86_MCE_INJECT is not set
 
-CONFIG_X86_MRST=y
+# CONFIG_X86_MRST is not set
 CONFIG_SFI=y
 
 CONFIG_INPUT_WINBOND_CIR=m


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1294.2.108
retrieving revision 1.1294.2.109
diff -u -p -r1.1294.2.108 -r1.1294.2.109
--- kernel.spec	12 Jul 2010 21:28:22 -0000	1.1294.2.108
+++ kernel.spec	27 Jul 2010 19:27:35 -0000	1.1294.2.109
@@ -669,6 +669,9 @@ Patch380: linux-2.6-defaults-pci_no_msi.
 Patch381: linux-2.6-pciehp-update.patch
 Patch382: linux-2.6-defaults-pciehp.patch
 Patch383: linux-2.6-defaults-aspm.patch
+Patch384: pci-acpi-disable-aspm-if-no-osc.patch
+Patch385: pci-aspm-dont-enable-too-early.patch
+
 Patch390: linux-2.6-defaults-acpi-video.patch
 Patch391: linux-2.6-acpi-video-dos.patch
 Patch450: linux-2.6-input-kill-stupid-messages.patch
@@ -721,7 +724,9 @@ Patch1813: drm-radeon-pm.patch
 Patch1818: drm-i915-resume-force-mode.patch
 Patch1819: drm-intel-big-hammer.patch
 Patch1820: drm-intel-no-tv-hotplug.patch
-#Patch1821: drm-page-flip.patch
+Patch1821: drm-i915-fix-hibernate-memory-corruption.patch
+Patch1822: drm-i915-add-reclaimable-to-page-allocations.patch
+Patch1823: drm-intel-945gm-stability-fixes.patch
 # intel drm is all merged upstream
 Patch1824: drm-intel-next.patch
 Patch1825: drm-intel-acpi-populate-didl.patch
@@ -759,6 +764,7 @@ Patch2096: linux-2.6-v4l-dvb-add-kworld-
 # fs fixes
 
 # ext4/quota
+Patch3000: linux-2.6-ext4-quota-metadata-reservation.patch
 
 # NFSv4
 Patch3050: linux-2.6-nfsd4-proots.patch
@@ -840,6 +846,17 @@ Patch13030: l2tp-fix-oops-in-pppol2tp_xm
 Patch14000: sched-fix-over-scheduling-bug.patch
 Patch14010: ethtool-fix-buffer-overflow.patch
 
+Patch14020: inotify-fix-inotify-oneshot-support.patch
+Patch14030: inotify-send-IN_UNMOUNT-events.patch
+
+Patch14040: crypto-testmgr-add-null-test-for-aesni.patch
+Patch14050: crypto-add-async-hash-testing.patch
+
+Patch14100: cifs-fix-malicious-redirect-problem-in-the-dns-lookup-code.patch
+Patch14110: ext4-make-sure-the-move_ext-ioctl-can-t-overwrite-append-only-files.patch
+
+Patch14120: usb-obey-the-sysfs-power-wakeup-setting.patch
+
 Patch19997: xen.pvops.pre.patch
 Patch19998: xen.pvops.patch
 Patch19999: xen.pvops.post.patch
@@ -1308,6 +1325,7 @@ ApplyPatch linux-2.6-execshield.patch
 #
 
 # ext4
+ApplyPatch linux-2.6-ext4-quota-metadata-reservation.patch
 
 # xfs
 
@@ -1357,6 +1375,10 @@ ApplyPatch linux-2.6-defaults-pci_no_msi
 #ApplyPatch linux-2.6-defaults-pciehp.patch
 # enable ASPM by default on hardware we expect to work
 ApplyPatch linux-2.6-defaults-aspm.patch
+# disable aspm if acpi doesn't provide an _OSC method
+ApplyPatch pci-acpi-disable-aspm-if-no-osc.patch
+# allow drivers to disable aspm at load time
+ApplyPatch pci-aspm-dont-enable-too-early.patch
 
 #
 # SCSI Bits.
@@ -1448,6 +1470,12 @@ ApplyPatch drm-upgrayedd.patch
 ApplyOptionalPatch drm-intel-next.patch
 ApplyPatch drm-intel-acpi-populate-didl.patch
 ApplyPatch drm-intel-make-lvds-work.patch
+# gm45 stability fixes
+ApplyPatch drm-intel-945gm-stability-fixes.patch
+# hibernation memory corruption fixes
+ApplyPatch drm-i915-fix-hibernate-memory-corruption.patch
+ApplyPatch drm-i915-add-reclaimable-to-page-allocations.patch
+
 ApplyPatch drm-nouveau-g80-ctxprog.patch
 ApplyPatch drm-nouveau-tvout-disable.patch
 ApplyPatch drm-nouveau-safetile-getparam.patch
@@ -1536,6 +1564,23 @@ ApplyPatch sched-fix-over-scheduling-bug
 # CVE-2010-2478
 ApplyPatch ethtool-fix-buffer-overflow.patch
 
+# fix broken oneshot support and missing umount events (F13#607327)
+ApplyPatch inotify-fix-inotify-oneshot-support.patch
+ApplyPatch inotify-send-IN_UNMOUNT-events.patch
+
+# add tests for aesni module (#571577)
+ApplyPatch crypto-testmgr-add-null-test-for-aesni.patch
+# add tests for crypto async hashing (#571577)
+ApplyPatch crypto-add-async-hash-testing.patch
+
+# CVE-2010-2524
+ApplyPatch cifs-fix-malicious-redirect-problem-in-the-dns-lookup-code.patch
+# CVE-2010-2066
+ApplyPatch ext4-make-sure-the-move_ext-ioctl-can-t-overwrite-append-only-files.patch
+
+# fix broken USB device wakeups (#617559)
+ApplyPatch usb-obey-the-sysfs-power-wakeup-setting.patch
+
 ApplyPatch xen.pvops.pre.patch
 ApplyPatch xen.pvops.patch
 ApplyPatch xen.pvops.post.patch
@@ -1863,7 +1908,8 @@ BuildKernel vmlinux vmlinux kdump vmlinu
 
 %if %{with_doc}
 # Make the HTML and man pages.
-make %{?_smp_mflags} htmldocs mandocs || %{doc_build_fail}
+#make %{?_smp_mflags} htmldocs mandocs || %{doc_build_fail}
+make -j1 htmldocs mandocs || %{doc_build_fail}
 
 # sometimes non-world-readable files sneak into the kernel source tree
 chmod -R a=rX Documentation
@@ -2189,6 +2235,56 @@ fi
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Tue Jul 27 2010 Michael Young <m.a.young at durham.ac.uk>
+- remove some obsolete or unnecessary additions to config-generic
+- try building XEN_BLKDEV_BACKEND XEN_NETDEV_BACKEND XEN_GNTDEV
+  as modules and adding XEN_PCIDEV_FRONTEND XEN_PLATFORM_PCI as modules
+
+* Mon Jul 26 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-152
+- usb-obey-the-sysfs-power-wakeup-setting.patch:
+  Restore ability of USB devices to wake the machine (F13#617559)
+
+* Mon Jul 26 2010 Eric Sandeen <sandeen at redhat.com> 2.6.32.16-151
+- Fix ext4 metadata vs. quota reservation bug (#608770)
+
+* Fri Jul 23 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-150
+- drm-intel-945gm-stability-fixes.patch
+- Make doc build single-threaded to prevent build failures.
+
+* Fri Jul 23 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-149
+- drm-i915-fix-hibernate-memory-corruption.patch,
+  drm-i915-add-reclaimable-to-page-allocations.patch:
+  Fixes for hibernation memory corruption bugs introduced in 2.6.32.8
+
+* Fri Jul 23 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-148
+- ext4-make-sure-the-move_ext-ioctl-can-t-overwrite-append-only-files.patch
+  (CVE-2010-2066)
+
+* Thu Jul 22 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-147
+- cifs-fix-malicious-redirect-problem-in-the-dns-lookup-code.patch:
+  Fix a malicious redirect problem in the DNS lookup code (CVE-2010-2524)
+
+* Wed Jul 21 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-146
+- pci-acpi-disable-aspm-if-no-osc.patch, pci-aspm-dont-enable-too-early.patch
+  PCI layer fixes for problems with hardware that doesn't support ASPM.
+
+* Wed Jul 21 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-145
+- crypto-add-async-hash-testing.patch: fix the rest of the errors
+  reported during crypto testing (#571577)
+
+* Wed Jul 21 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-144
+- Fix inotify-oneshot-support patch so it builds.
+- crypto-testmgr-add-null-test-for-aesni.patch:
+  Add tests for aesni crypto module (#571577)
+
+* Fri Jul 16 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.16-143
+- inotify-fix-inotify-oneshot-support.patch,
+  inotify-send-IN_UNMOUNT-events.patch:
+  Fix broken oneshot support and missing umount events. (F13#607327)
+
+* Wed Jul 14 2010 Chuck Ebbert <cebbert at redhat.com> 2.6.32.16-142
+- Drop Intel Moorestown support.
+
 * Wed Jul 12 2010 Michael Young <m.a.young at durham.ac.uk>
 - update pvops
 
@@ -2330,7 +2426,7 @@ fi
 - Fix possible data corruption with ext4 mounted with -o discard
 
 * Tue Apr 27 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.12-112
-- hugetlb-fix-infinite-loop-in-get-futex-key.patch (#552557)
+- hugetlb-fix-infinite-loop-in-get-futex-key.patch (#552257)
 - reiserfs-fix-permissions-on-reiserfs-priv.patch (CVE-2010-1146)
 
 * Mon Apr 26 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.12-111
@@ -2454,7 +2550,7 @@ fi
 - A few more imon driver button additions
 - Fix minor init issue w/topseed 0x0008 mceusb transceivers
 
-* Mon Mar 22 2010 Neil Horman <nhorman at redhat.com> 
+* Mon Mar 22 2010 Neil Horman <nhorman at redhat.com>
 - Fix tg3 poll controller to not oops (bz 574969)
 
 * Fri Mar 19 2010 John W. Linville <linville at redhat.com> 2.6.32.10-88
@@ -2594,10 +2690,10 @@ fi
 
 * Wed Feb 17 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.8-58
 - fix-race-in-tty_fasync-properly.patch: fix for deadlock caused
-  by original patch in 2.6.32.6 
+  by original patch in 2.6.32.6
 
 * Wed Feb 17 2010 Chuck Ebbert <cebbert at redhat.com>  2.6.32.8-57
-- CVE-2010-0623 kernel: local DoS via futex_lock_pi 
+- CVE-2010-0623 kernel: local DoS via futex_lock_pi
 
 * Wed Feb 17 2010 Chuck Ebbert <cebbert at redhat.com>
 - CVE-2009-4537 kernel: r8169 issue reported at 26c3
@@ -2611,7 +2707,7 @@ fi
 - drm-nouveau-shared-fb.patch: drop
 - drm-nouveau-update.patch: drop, included in previous drm update
 
-* Wed Feb 17 2010 Dave Airlie <airlied at redhat.com> 
+* Wed Feb 17 2010 Dave Airlie <airlied at redhat.com>
 - drm-upgrayedd.patch - update - needs nouveau patch rebase
 - drop reverted upstream commits since rc8 - also drop other merged patches
 

xen.pvops.patch:
 Documentation/kernel-parameters.txt             |   11 
 Documentation/x86/x86_64/boot-options.txt       |    6 
 arch/ia64/include/asm/dma-mapping.h             |    2 
 arch/ia64/include/asm/swiotlb.h                 |    2 
 arch/ia64/include/asm/xen/events.h              |    4 
 arch/ia64/kernel/pci-swiotlb.c                  |    4 
 arch/powerpc/include/asm/dma-mapping.h          |    2 
 arch/powerpc/kernel/setup_32.c                  |    2 
 arch/powerpc/kernel/setup_64.c                  |    2 
 arch/x86/Kconfig                                |    4 
 arch/x86/include/asm/amd_iommu.h                |    4 
 arch/x86/include/asm/calgary.h                  |    2 
 arch/x86/include/asm/dma-mapping.h              |    7 
 arch/x86/include/asm/gart.h                     |    9 
 arch/x86/include/asm/hpet.h                     |    2 
 arch/x86/include/asm/hugetlb.h                  |   30 
 arch/x86/include/asm/io.h                       |   15 
 arch/x86/include/asm/io_apic.h                  |    3 
 arch/x86/include/asm/iommu.h                    |    2 
 arch/x86/include/asm/irq_vectors.h              |   20 
 arch/x86/include/asm/microcode.h                |    9 
 arch/x86/include/asm/mmu.h                      |    3 
 arch/x86/include/asm/paravirt.h                 |   41 
 arch/x86/include/asm/paravirt_types.h           |    2 
 arch/x86/include/asm/pci.h                      |    8 
 arch/x86/include/asm/pci_x86.h                  |    2 
 arch/x86/include/asm/pgtable.h                  |    6 
 arch/x86/include/asm/pgtable_64.h               |    2 
 arch/x86/include/asm/processor.h                |    4 
 arch/x86/include/asm/swiotlb.h                  |   11 
 arch/x86/include/asm/syscalls.h                 |    8 
 arch/x86/include/asm/tlbflush.h                 |    6 
 arch/x86/include/asm/x86_init.h                 |   10 
 arch/x86/include/asm/xen/hypercall.h            |   50 
 arch/x86/include/asm/xen/hypervisor.h           |   27 
 arch/x86/include/asm/xen/interface.h            |    8 
 arch/x86/include/asm/xen/interface_32.h         |    5 
 arch/x86/include/asm/xen/interface_64.h         |   13 
 arch/x86/include/asm/xen/iommu.h                |   12 
 arch/x86/include/asm/xen/page.h                 |   16 
 arch/x86/include/asm/xen/pci.h                  |  104 +
 arch/x86/include/asm/xen/swiotlb-xen.h          |   14 
 arch/x86/kernel/Makefile                        |    1 
 arch/x86/kernel/acpi/boot.c                     |   21 
 arch/x86/kernel/acpi/processor.c                |   17 
 arch/x86/kernel/acpi/sleep.c                    |    2 
 arch/x86/kernel/amd_iommu.c                     |   23 
 arch/x86/kernel/amd_iommu_init.c                |   25 
 arch/x86/kernel/aperture_64.c                   |    4 
 arch/x86/kernel/apic/io_apic.c                  |   53 
 arch/x86/kernel/cpu/mtrr/Makefile               |    1 
 arch/x86/kernel/cpu/mtrr/amd.c                  |    6 
 arch/x86/kernel/cpu/mtrr/centaur.c              |    6 
 arch/x86/kernel/cpu/mtrr/cyrix.c                |    6 
 arch/x86/kernel/cpu/mtrr/generic.c              |   13 
 arch/x86/kernel/cpu/mtrr/main.c                 |   20 
 arch/x86/kernel/cpu/mtrr/mtrr.h                 |   11 
 arch/x86/kernel/cpu/mtrr/xen.c                  |  109 +
 arch/x86/kernel/crash.c                         |    1 
 arch/x86/kernel/entry_32.S                      |    2 
 arch/x86/kernel/entry_64.S                      |    3 
 arch/x86/kernel/hpet.c                          |   20 
 arch/x86/kernel/ioport.c                        |   40 
 arch/x86/kernel/ldt.c                           |    3 
 arch/x86/kernel/microcode_core.c                |    6 
 arch/x86/kernel/microcode_xen.c                 |  201 ++
 arch/x86/kernel/paravirt.c                      |    1 
 arch/x86/kernel/pci-calgary_64.c                |   73 
 arch/x86/kernel/pci-dma.c                       |   38 
 arch/x86/kernel/pci-gart_64.c                   |   40 
 arch/x86/kernel/pci-nommu.c                     |   11 
 arch/x86/kernel/pci-swiotlb.c                   |   21 
 arch/x86/kernel/process.c                       |   27 
 arch/x86/kernel/reboot.c                        |    4 
 arch/x86/kernel/setup.c                         |    6 
 arch/x86/kernel/x86_init.c                      |    8 
 arch/x86/mm/Makefile                            |    5 
 arch/x86/mm/gup.c                               |    5 
 arch/x86/mm/pat.c                               |    2 
 arch/x86/mm/pgtable.c                           |   19 
 arch/x86/mm/tlb.c                               |   37 
 arch/x86/pci/Makefile                           |    1 
 arch/x86/pci/common.c                           |   18 
 arch/x86/pci/i386.c                             |    2 
 arch/x86/pci/init.c                             |    6 
 arch/x86/pci/xen.c                              |  154 +
 arch/x86/xen/Kconfig                            |   41 
 arch/x86/xen/Makefile                           |    7 
 arch/x86/xen/apic.c                             |   33 
 arch/x86/xen/enlighten.c                        |  242 ++-
 arch/x86/xen/mmu.c                              |  560 +++++++
 arch/x86/xen/mmu.h                              |    1 
 arch/x86/xen/pci-swiotlb-xen.c                  |   52 
 arch/x86/xen/pci.c                              |  296 +++
 arch/x86/xen/platform-pci-unplug.c              |  135 +
 arch/x86/xen/setup.c                            |  125 +
 arch/x86/xen/smp.c                              |    9 
 arch/x86/xen/suspend.c                          |   12 
 arch/x86/xen/time.c                             |   82 -
 arch/x86/xen/vga.c                              |   67 
 arch/x86/xen/xen-ops.h                          |   31 
 block/blk-core.c                                |    2 
 drivers/acpi/Makefile                           |    1 
 drivers/acpi/acpi_memhotplug.c                  |   19 
 drivers/acpi/acpica/hwsleep.c                   |   16 
 drivers/acpi/processor_core.c                   |   35 
 drivers/acpi/processor_idle.c                   |   20 
 drivers/acpi/processor_perflib.c                |    4 
 drivers/acpi/processor_xen.c                    |  616 +++++++
 drivers/acpi/sleep.c                            |   19 
 drivers/block/Kconfig                           |    1 
 drivers/block/xen-blkfront.c                    |  363 +++-
 drivers/char/agp/intel-agp.c                    |   23 
 drivers/char/hvc_xen.c                          |  101 -
 drivers/gpu/drm/drm_drv.c                       |    2 
 drivers/gpu/drm/drm_gem.c                       |    2 
 drivers/gpu/drm/drm_scatter.c                   |   67 
 drivers/gpu/drm/ttm/ttm_bo_vm.c                 |    2 
 drivers/input/xen-kbdfront.c                    |    7 
 drivers/net/Kconfig                             |    1 
 drivers/net/xen-netfront.c                      |  125 +
 drivers/pci/Kconfig                             |   10 
 drivers/pci/Makefile                            |    4 
 drivers/pci/bus.c                               |    1 
 drivers/pci/dmar.c                              |    7 
 drivers/pci/intel-iommu.c                       |    6 
 drivers/pci/msi.c                               |   17 
 drivers/pci/xen-iommu.c                         |  271 +++
 drivers/pci/xen-pcifront.c                      | 1175 +++++++++++++++
 drivers/video/Kconfig                           |    1 
 drivers/video/broadsheetfb.c                    |    2 
 drivers/video/fb_defio.c                        |    4 
 drivers/video/hecubafb.c                        |    2 
 drivers/video/metronomefb.c                     |    2 
 drivers/video/xen-fbfront.c                     |    9 
 drivers/xen/Kconfig                             |  139 +
 drivers/xen/Makefile                            |   29 
 drivers/xen/acpi.c                              |   23 
 drivers/xen/acpi_processor.c                    |  417 +++++
 drivers/xen/balloon.c                           |  268 ++-
 drivers/xen/biomerge.c                          |   14 
 drivers/xen/blkback/Makefile                    |    4 
 drivers/xen/blkback/blkback-pagemap.c           |  109 +
 drivers/xen/blkback/blkback-pagemap.h           |   36 
 drivers/xen/blkback/blkback.c                   |  675 ++++++++
 drivers/xen/blkback/common.h                    |  143 +
 drivers/xen/blkback/interface.c                 |  186 ++
 drivers/xen/blkback/vbd.c                       |  161 ++
 drivers/xen/blkback/xenbus.c                    |  546 +++++++
 drivers/xen/blktap/Makefile                     |    3 
 drivers/xen/blktap/blktap.h                     |  231 ++
 drivers/xen/blktap/control.c                    |  266 +++
 drivers/xen/blktap/device.c                     |  931 ++++++++++++
 drivers/xen/blktap/request.c                    |  295 +++
 drivers/xen/blktap/ring.c                       |  477 ++++++
 drivers/xen/blktap/sysfs.c                      |  312 ++++
 drivers/xen/cpu_hotplug.c                       |    1 
 drivers/xen/events.c                            |  592 +++++++
 drivers/xen/evtchn.c                            |   96 -
 drivers/xen/features.c                          |    2 
 drivers/xen/gntdev.c                            |  645 ++++++++
 drivers/xen/grant-table.c                       |  183 ++
 drivers/xen/manage.c                            |   45 
 drivers/xen/mce.c                               |  216 ++
 drivers/xen/netback/Makefile                    |    3 
 drivers/xen/netback/common.h                    |  329 ++++
 drivers/xen/netback/interface.c                 |  475 ++++++
 drivers/xen/netback/netback.c                   | 1856 ++++++++++++++++++++++++
 drivers/xen/netback/xenbus.c                    |  524 ++++++
 drivers/xen/pci.c                               |  124 +
 drivers/xen/pciback/Makefile                    |   17 
 drivers/xen/pciback/conf_space.c                |  435 +++++
 drivers/xen/pciback/conf_space.h                |  126 +
 drivers/xen/pciback/conf_space_capability.c     |   66 
 drivers/xen/pciback/conf_space_capability.h     |   26 
 drivers/xen/pciback/conf_space_capability_msi.c |  110 +
 drivers/xen/pciback/conf_space_capability_pm.c  |  113 +
 drivers/xen/pciback/conf_space_capability_vpd.c |   40 
 drivers/xen/pciback/conf_space_header.c         |  385 ++++
 drivers/xen/pciback/conf_space_quirks.c         |  140 +
 drivers/xen/pciback/conf_space_quirks.h         |   35 
 drivers/xen/pciback/controller.c                |  442 +++++
 drivers/xen/pciback/passthrough.c               |  178 ++
 drivers/xen/pciback/pci_stub.c                  | 1370 +++++++++++++++++
 drivers/xen/pciback/pciback.h                   |  142 +
 drivers/xen/pciback/pciback_ops.c               |  242 +++
 drivers/xen/pciback/slot.c                      |  191 ++
 drivers/xen/pciback/vpci.c                      |  244 +++
 drivers/xen/pciback/xenbus.c                    |  722 +++++++++
 drivers/xen/pcpu.c                              |  420 +++++
 drivers/xen/platform-pci.c                      |  207 ++
 drivers/xen/sys-hypervisor.c                    |    1 
 drivers/xen/xen_acpi_memhotplug.c               |  209 ++
 drivers/xen/xenbus/Makefile                     |    5 
 drivers/xen/xenbus/xenbus_client.c              |   92 -
 drivers/xen/xenbus/xenbus_probe.c               |  427 +----
 drivers/xen/xenbus/xenbus_probe.h               |   29 
 drivers/xen/xenbus/xenbus_probe_backend.c       |  293 +++
 drivers/xen/xenbus/xenbus_probe_frontend.c      |  292 +++
 drivers/xen/xenbus/xenbus_xs.c                  |   57 
 drivers/xen/xenfs/Makefile                      |    3 
 drivers/xen/xenfs/privcmd.c                     |  404 +++++
 drivers/xen/xenfs/super.c                       |  100 +
 drivers/xen/xenfs/xenfs.h                       |    3 
 drivers/xen/xenfs/xenstored.c                   |   67 
 include/acpi/acpi_drivers.h                     |   21 
 include/acpi/processor.h                        |   22 
 include/asm-generic/pci.h                       |    2 
 include/drm/drmP.h                              |    2 
 include/linux/bootmem.h                         |    1 
 include/linux/dmar.h                            |   15 
 include/linux/fb.h                              |    1 
 include/linux/interrupt.h                       |    1 
 include/linux/mm.h                              |   11 
 include/linux/page-flags.h                      |   20 
 include/linux/pci_ids.h                         |    3 
 include/linux/swiotlb.h                         |  115 +
 include/linux/vmalloc.h                         |    2 
 include/xen/Kbuild                              |    1 
 include/xen/acpi.h                              |  106 +
 include/xen/balloon.h                           |    8 
 include/xen/blkif.h                             |  123 +
 include/xen/events.h                            |   43 
 include/xen/gntdev.h                            |  119 +
 include/xen/grant_table.h                       |   47 
 include/xen/hvm.h                               |   30 
 include/xen/interface/features.h                |    6 
 include/xen/interface/grant_table.h             |   23 
 include/xen/interface/hvm/hvm_op.h              |   46 
 include/xen/interface/hvm/params.h              |   95 +
 include/xen/interface/io/netif.h                |    4 
 include/xen/interface/io/pciif.h                |  124 +
 include/xen/interface/io/ring.h                 |    3 
 include/xen/interface/io/xenbus.h               |    8 
 include/xen/interface/memory.h                  |   92 +
 include/xen/interface/physdev.h                 |   68 
 include/xen/interface/platform.h                |  381 ++++
 include/xen/interface/xen-mca.h                 |  429 +++++
 include/xen/interface/xen.h                     |   45 
 include/xen/pcpu.h                              |   30 
 include/xen/platform_pci.h                      |   49 
 include/xen/privcmd.h                           |   80 +
 include/xen/xen-ops.h                           |   13 
 include/xen/xen.h                               |   34 
 include/xen/xenbus.h                            |    2 
 kernel/irq/manage.c                             |    3 
 lib/Makefile                                    |    3 
 lib/swiotlb-core.c                              |  572 +++++++
 lib/swiotlb-xen.c                               |  504 ++++++
 lib/swiotlb.c                                   |  551 -------
 mm/bootmem.c                                    |   24 
 mm/memory.c                                     |   46 
 mm/page_alloc.c                                 |   14 
 mm/vmalloc.c                                    |    7 
 254 files changed, 26510 insertions(+), 1624 deletions(-)

View full diff with command:
/usr/bin/cvs -n -f diff -kk -u -p -N -r 1.1.2.71 -r 1.1.2.72 xen.pvops.patchIndex: xen.pvops.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/Attic/xen.pvops.patch,v
retrieving revision 1.1.2.71
retrieving revision 1.1.2.72
diff -u -p -r1.1.2.71 -r1.1.2.72
--- xen.pvops.patch	12 Jul 2010 21:28:24 -0000	1.1.2.71
+++ xen.pvops.patch	27 Jul 2010 19:27:35 -0000	1.1.2.72
@@ -1,3 +1,32 @@
+diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
+index 5f6aa11..3e30e60 100644
+--- a/Documentation/kernel-parameters.txt
++++ b/Documentation/kernel-parameters.txt
+@@ -113,6 +113,7 @@ parameter is applicable:
+ 			More X86-64 boot options can be found in
+ 			Documentation/x86/x86_64/boot-options.txt .
+ 	X86	Either 32bit or 64bit x86 (same as X86-32+X86-64)
++	XEN	Xen support is enabled
+ 
+ In addition, the following text indicates that the option:
+ 
+@@ -2760,6 +2761,16 @@ and is between 256 and 4096 characters. It is defined in the file
+ 	xd=		[HW,XT] Original XT pre-IDE (RLL encoded) disks.
+ 	xd_geo=		See header of drivers/block/xd.c.
+ 
++	xen_emul_unplug=		[HW,X86,XEN]
++			Unplug Xen emulated devices
++			Format: [unplug0,][unplug1]
++			ide-disks -- unplug primary master IDE devices
++			aux-ide-disks -- unplug non-primary-master IDE devices
++			nics -- unplug network devices
++			all -- unplug all emulated devices (NICs and IDE disks)
++			ignore -- continue loading the Xen platform PCI driver even
++				if the version check failed
++
+ 	xirc2ps_cs=	[NET,PCMCIA]
+ 			Format:
+ 			<irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
 diff --git a/Documentation/x86/x86_64/boot-options.txt b/Documentation/x86/x86_64/boot-options.txt
 index 29a6ff8..81f9b94 100644
 --- a/Documentation/x86/x86_64/boot-options.txt
@@ -383,10 +412,23 @@ index fd6d21b..345c99c 100644
  extern int force_iommu, no_iommu;
  extern int iommu_detected;
 diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
-index 6e90a04..451a45b 100644
+index 6e90a04..ba4dc7b 100644
 --- a/arch/x86/include/asm/irq_vectors.h
 +++ b/arch/x86/include/asm/irq_vectors.h
-@@ -157,6 +157,14 @@ static inline int invalid_vm86_irq(int irq)
+@@ -120,6 +120,12 @@
+  */
+ #define MCE_SELF_VECTOR			0xeb
+ 
++#ifdef CONFIG_XEN
++/* Xen vector callback to receive events in a HVM domain */
++#define XEN_HVM_EVTCHN_CALLBACK		0xe9
++#endif
++
++
+ /*
+  * First APIC vector available to drivers: (vectors 0x30-0xee) we
+  * start at 0x31(0x41) to spread out vectors evenly between priority
+@@ -157,6 +163,14 @@ static inline int invalid_vm86_irq(int irq)
  #define CPU_VECTOR_LIMIT		(  8 * NR_CPUS      )
  #define IO_APIC_VECTOR_LIMIT		( 32 * MAX_IO_APICS )
  
@@ -401,7 +443,7 @@ index 6e90a04..451a45b 100644
  #ifdef CONFIG_X86_IO_APIC
  # ifdef CONFIG_SPARSE_IRQ
  #  define NR_IRQS					\
-@@ -165,13 +173,13 @@ static inline int invalid_vm86_irq(int irq)
+@@ -165,13 +179,13 @@ static inline int invalid_vm86_irq(int irq)
  		(NR_VECTORS + IO_APIC_VECTOR_LIMIT))
  # else
  #  if NR_CPUS < MAX_IO_APICS
@@ -451,7 +493,7 @@ index 80a1dee..67eaa91 100644
  
  #ifdef CONFIG_SMP
 diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
-index efb3899..63a55bc 100644
+index efb3899..e571db4 100644
 --- a/arch/x86/include/asm/paravirt.h
 +++ b/arch/x86/include/asm/paravirt.h
 @@ -330,11 +330,18 @@ static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
@@ -473,6 +515,67 @@ index efb3899..63a55bc 100644
  /* The paravirtualized I/O functions */
  static inline void slow_down_io(void)
  {
+@@ -770,15 +777,28 @@ static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
+ #define PV_RESTORE_REGS "popl %edx; popl %ecx;"
+ 
+ /* save and restore all caller-save registers, except return value */
+-#define PV_SAVE_ALL_CALLER_REGS		"pushl %ecx;"
+-#define PV_RESTORE_ALL_CALLER_REGS	"popl  %ecx;"
++#define __PV_SAVE_ALL_CALLER_REGS	"pushl %ecx;"
++#define __PV_RESTORE_ALL_CALLER_REGS	"popl  %ecx;"
++
++#ifdef CONFIG_FRAME_POINTER
++#define PV_SAVE_ALL_CALLER_REGS			\
++	"push %ebp;"				\
++	"mov %esp, %ebp;"			\
++	__PV_SAVE_ALL_CALLER_REGS
++#define PV_RESTORE_ALL_CALLER_REGS		\
++	__PV_RESTORE_ALL_CALLER_REGS		\
++	"leave;"
++#else
++#define PV_SAVE_ALL_CALLER_REGS		__PV_SAVE_ALL_CALLER_REGS
++#define PV_RESTORE_ALL_CALLER_REGS	__PV_RESTORE_ALL_CALLER_REGS
++#endif
+ 
+ #define PV_FLAGS_ARG "0"
+ #define PV_EXTRA_CLOBBERS
+ #define PV_VEXTRA_CLOBBERS
+ #else
+ /* save and restore all caller-save registers, except return value */
+-#define PV_SAVE_ALL_CALLER_REGS						\
++#define __PV_SAVE_ALL_CALLER_REGS					\
+ 	"push %rcx;"							\
+ 	"push %rdx;"							\
+ 	"push %rsi;"							\
+@@ -787,7 +807,7 @@ static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
+ 	"push %r9;"							\
+ 	"push %r10;"							\
+ 	"push %r11;"
+-#define PV_RESTORE_ALL_CALLER_REGS					\
++#define __PV_RESTORE_ALL_CALLER_REGS					\
+ 	"pop %r11;"							\
+ 	"pop %r10;"							\
+ 	"pop %r9;"							\
+@@ -797,6 +817,19 @@ static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
+ 	"pop %rdx;"							\
+ 	"pop %rcx;"
+ 
++#ifdef CONFIG_FRAME_POINTER
++#define PV_SAVE_ALL_CALLER_REGS			\
++	"push %rbp;"				\
++	"mov %rsp, %rbp;"			\
++	__PV_SAVE_ALL_CALLER_REGS
++#define PV_RESTORE_ALL_CALLER_REGS		\
++	__PV_RESTORE_ALL_CALLER_REGS		\
++	"leaveq;"
++#else
++#define PV_SAVE_ALL_CALLER_REGS		__PV_SAVE_ALL_CALLER_REGS
++#define PV_RESTORE_ALL_CALLER_REGS	__PV_RESTORE_ALL_CALLER_REGS
++#endif
++
+ /* We save some registers, but all of them, that's too much. We clobber all
+  * caller saved registers but the argument parameter */
+ #define PV_SAVE_REGS "pushq %%rdi;"
 diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
 index 9357473..3202dcc 100644
 --- a/arch/x86/include/asm/paravirt_types.h
@@ -819,10 +922,10 @@ index 9c371e4..41c4be0 100644
  
  static inline void
 diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
-index d5b7e90..8d5e15a 100644
+index d5b7e90..396ff4c 100644
 --- a/arch/x86/include/asm/xen/hypervisor.h
 +++ b/arch/x86/include/asm/xen/hypervisor.h
-@@ -37,31 +37,10 @@
+@@ -37,31 +37,4 @@
  extern struct shared_info *HYPERVISOR_shared_info;
  extern struct start_info *xen_start_info;
  
@@ -832,14 +935,12 @@ index d5b7e90..8d5e15a 100644
 -	XEN_HVM_DOMAIN,		/* running in a Xen hvm domain */
 -};
 -
- #ifdef CONFIG_XEN
+-#ifdef CONFIG_XEN
 -extern enum xen_domain_type xen_domain_type;
-+extern void xen_guest_init(void);
- #else
+-#else
 -#define xen_domain_type		XEN_NATIVE
-+#define xen_guest_init() do { } while (0)
- #endif
- 
+-#endif
+-
 -#define xen_domain()		(xen_domain_type != XEN_NATIVE)
 -#define xen_pv_domain()		(xen_domain() &&			\
 -				 xen_domain_type == XEN_PV_DOMAIN)
@@ -1459,7 +1560,7 @@ index 082089e..8d34362 100644
  	} else if ((!no_iommu && max_pfn > MAX_DMA32_PFN) ||
  		   force_iommu ||
 diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
-index dc4f486..dfb14f9 100644
+index dc4f486..7c954ff 100644
 --- a/arch/x86/kernel/apic/io_apic.c
 +++ b/arch/x86/kernel/apic/io_apic.c
 @@ -63,7 +63,12 @@
@@ -1511,7 +1612,7 @@ index dc4f486..dfb14f9 100644
  	if (type == PCI_CAP_ID_MSI && nvec > 1)
  		return 1;
  
-+	if (xen_domain())
++	if (xen_pv_domain())
[...4015 lines suppressed...]
-+
-+#ifndef __XEN_PUBLIC_PLATFORM_PCI_H__
-+#define __XEN_PUBLIC_PLATFORM_PCI_H__
-+
-+#define XEN_IOPORT_BASE 0x10
-+
-+#define XEN_IOPORT_PLATFLAGS	(XEN_IOPORT_BASE + 0) /* 1 byte access (R/W) */
-+#define XEN_IOPORT_MAGIC	(XEN_IOPORT_BASE + 0) /* 2 byte access (R) */
-+#define XEN_IOPORT_UNPLUG	(XEN_IOPORT_BASE + 0) /* 2 byte access (W) */
-+#define XEN_IOPORT_DRVVER	(XEN_IOPORT_BASE + 0) /* 4 byte access (W) */
-+
-+#define XEN_IOPORT_SYSLOG	(XEN_IOPORT_BASE + 2) /* 1 byte access (W) */
-+#define XEN_IOPORT_PROTOVER	(XEN_IOPORT_BASE + 2) /* 1 byte access (R) */
-+#define XEN_IOPORT_PRODNUM	(XEN_IOPORT_BASE + 2) /* 2 byte access (W) */
-+
-+#define UNPLUG_ALL_IDE_DISKS 1
-+#define UNPLUG_ALL_NICS 2
-+#define UNPLUG_AUX_IDE_DISKS 4
-+#define UNPLUG_ALL 7
-+
-+#endif /* __XEN_PUBLIC_PLATFORM_PCI_H__ */
 diff --git a/include/xen/interface/xen-mca.h b/include/xen/interface/xen-mca.h
 new file mode 100644
 index 0000000..f31fdab
@@ -30917,55 +31644,57 @@ index 0000000..fb2bf6b
 +#endif
 diff --git a/include/xen/platform_pci.h b/include/xen/platform_pci.h
 new file mode 100644
-index 0000000..ced434d
+index 0000000..ce9d671
 --- /dev/null
 +++ b/include/xen/platform_pci.h
-@@ -0,0 +1,47 @@
-+/******************************************************************************
-+ * platform-pci.h
-+ *
-+ * Xen platform PCI device driver
-+ * Copyright (c) 2004, Intel Corporation. <xiaofeng.ling at intel.com>
-+ * Copyright (c) 2007, XenSource Inc.
-+ * Copyright (c) 2010, Citrix
-+ *
-+ * 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.
-+ */
-+
+@@ -0,0 +1,49 @@
 +#ifndef _XEN_PLATFORM_PCI_H
 +#define _XEN_PLATFORM_PCI_H
 +
-+#include <linux/version.h>
-+
 +#define XEN_IOPORT_MAGIC_VAL 0x49d2
-+#define XEN_IOPORT_LINUX_PRODNUM 0xffff
-+#define XEN_IOPORT_LINUX_DRVVER  ((LINUX_VERSION_CODE << 8) + 0x0)
++#define XEN_IOPORT_LINUX_PRODNUM 0x0003
++#define XEN_IOPORT_LINUX_DRVVER  0x0001
++
++#define XEN_IOPORT_BASE 0x10
++
++#define XEN_IOPORT_PLATFLAGS	(XEN_IOPORT_BASE + 0) /* 1 byte access (R/W) */
++#define XEN_IOPORT_MAGIC	(XEN_IOPORT_BASE + 0) /* 2 byte access (R) */
++#define XEN_IOPORT_UNPLUG	(XEN_IOPORT_BASE + 0) /* 2 byte access (W) */
++#define XEN_IOPORT_DRVVER	(XEN_IOPORT_BASE + 0) /* 4 byte access (W) */
++
++#define XEN_IOPORT_SYSLOG	(XEN_IOPORT_BASE + 2) /* 1 byte access (W) */
++#define XEN_IOPORT_PROTOVER	(XEN_IOPORT_BASE + 2) /* 1 byte access (R) */
++#define XEN_IOPORT_PRODNUM	(XEN_IOPORT_BASE + 2) /* 2 byte access (W) */
 +
-+#ifdef CONFIG_XEN_PLATFORM_PCI
-+unsigned long alloc_xen_mmio(unsigned long len);
-+void platform_pci_resume(void);
-+void platform_pci_disable_irq(void);
-+void platform_pci_enable_irq(void);
++#define XEN_UNPLUG_ALL_IDE_DISKS 1
++#define XEN_UNPLUG_ALL_NICS 2
++#define XEN_UNPLUG_AUX_IDE_DISKS 4
++#define XEN_UNPLUG_ALL 7
++#define XEN_UNPLUG_IGNORE 8
++
++static inline int xen_must_unplug_nics(void) {
++#if (defined(CONFIG_XEN_NETDEV_FRONTEND) || \
++		defined(CONFIG_XEN_NETDEV_FRONTEND_MODULE)) && \
++		(defined(CONFIG_XEN_PLATFORM_PCI) || \
++		 defined(CONFIG_XEN_PLATFORM_PCI_MODULE))
++        return 1;
 +#else
-+static inline unsigned long alloc_xen_mmio(unsigned long len)
-+{
-+	return ~0UL;
++        return 0;
++#endif
 +}
-+static inline void platform_pci_resume(void) {}
-+static inline void platform_pci_disable_irq(void) {}
-+static inline void platform_pci_enable_irq(void) {}
++
++static inline int xen_must_unplug_disks(void) {
++#if (defined(CONFIG_XEN_BLKDEV_FRONTEND) || \
++		defined(CONFIG_XEN_BLKDEV_FRONTEND_MODULE)) && \
++		(defined(CONFIG_XEN_PLATFORM_PCI) || \
++		 defined(CONFIG_XEN_PLATFORM_PCI_MODULE))
++        return 1;
++#else
++        return 0;
 +#endif
++}
++
++extern int xen_platform_pci_unplug;
 +
 +#endif /* _XEN_PLATFORM_PCI_H */
 diff --git a/include/xen/privcmd.h b/include/xen/privcmd.h
@@ -31055,15 +31784,21 @@ index 0000000..b42cdfd
 +
 +#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
 diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
-index 883a21b..323121a 100644
+index 883a21b..7058f8a 100644
 --- a/include/xen/xen-ops.h
 +++ b/include/xen/xen-ops.h
-@@ -14,4 +14,17 @@ void xen_mm_unpin_all(void);
+@@ -7,6 +7,7 @@ DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
+ 
+ void xen_pre_suspend(void);
+ void xen_post_suspend(int suspend_cancelled);
++void xen_hvm_post_suspend(int suspend_cancelled);
+ 
+ void xen_mm_pin_all(void);
+ void xen_mm_unpin_all(void);
+@@ -14,4 +15,16 @@ void xen_mm_unpin_all(void);
  void xen_timer_resume(void);
  void xen_arch_resume(void);
  
-+int xen_setup_shutdown_event(void);
-+
 +int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
 +			       unsigned long addr,
 +			       unsigned long mfn, int nr,
@@ -31074,14 +31809,15 @@ index 883a21b..323121a 100644
 +				unsigned int address_bits);
 +
 +void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
++int xen_setup_shutdown_event(void);
 +
  #endif /* INCLUDE_XEN_OPS_H */
 diff --git a/include/xen/xen.h b/include/xen/xen.h
 new file mode 100644
-index 0000000..a164024
+index 0000000..77604ed
 --- /dev/null
 +++ b/include/xen/xen.h
-@@ -0,0 +1,32 @@
+@@ -0,0 +1,34 @@
 +#ifndef _XEN_XEN_H
 +#define _XEN_XEN_H
 +
@@ -31093,8 +31829,10 @@ index 0000000..a164024
 +
 +#ifdef CONFIG_XEN
 +extern enum xen_domain_type xen_domain_type;
++extern void xen_hvm_guest_init(void);
 +#else
 +#define xen_domain_type		XEN_NATIVE
++#define xen_hvm_guest_init() do { } while (0)
 +#endif
 +
 +#define xen_domain()		(xen_domain_type != XEN_NATIVE)
@@ -31115,7 +31853,7 @@ index 0000000..a164024
 +
 +#endif	/* _XEN_XEN_H */
 diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
-index b9763ba..a7d13ff 100644
+index b9763ba..542ca7c 100644
 --- a/include/xen/xenbus.h
 +++ b/include/xen/xenbus.h
 @@ -93,7 +93,7 @@ struct xenbus_driver {
@@ -31127,14 +31865,6 @@ index b9763ba..a7d13ff 100644
  	struct device_driver driver;
  	int (*read_otherend_details)(struct xenbus_device *dev);
  	int (*is_ready)(struct xenbus_device *dev);
-@@ -173,6 +173,7 @@ void unregister_xenbus_watch(struct xenbus_watch *watch);
- void xs_suspend(void);
- void xs_resume(void);
- void xs_suspend_cancel(void);
-+int xenbus_probe_init(void);
- 
- /* Used by xenbus_dev to borrow kernel's store connection. */
- void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg);
 diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
 index 986519e..cae345b 100644
 --- a/kernel/irq/manage.c



More information about the scm-commits mailing list