summaryrefslogtreecommitdiff |
diff options
author | Jan Beulich <jbeulich@novell.com> | 2012-05-23 15:59:25 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@novell.com> | 2012-05-23 15:59:25 +0200 |
commit | a3c5f2c9fcea9aad9e12201c2700304d33469ace (patch) | |
tree | 30f3267fd7729ecb26ae6884ebc1fac11cb54307 | |
parent | caf270e04273aee3752f0e9cefc308172d893240 (diff) |
- Update Xen patches to 3.4-final and c/s 1177.rpm-3.4.0-2--openSUSE-12.2-Beta1rpm-3.4.0-2
51 files changed, 6426 insertions, 6854 deletions
diff --git a/patches.xen/frontswap-config b/patches.xen/frontswap-config index 48483c7af4..68b250993f 100644 --- a/patches.xen/frontswap-config +++ b/patches.xen/frontswap-config @@ -1,10 +1,10 @@ From: Dan Magenheimer <dan.magenheimer@oracle.com> -Subject: [PATCH V10 4/6] mm: frontswap: config and doc files +Subject: [PATCH V16 4/4] mm: frontswap: config and doc files Patch-mainline: n/a -This fourth patch of six in the frontswap series adds configuration -and documentation files. +This patch 4of4 adds configuration and documentation files including a FAQ. +[v14: updated docs/FAQ to use zcache and RAMster as examples] [v10: no change] [v9: akpm@linux-foundation.org: sysfs->debugfs; no longer need Doc/ABI file] [v8: rebase to 3.0-rc4] @@ -13,7 +13,6 @@ and documentation files. [v5: change config default to n] [v4: rebase to 2.6.39] Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> -Reviewed-by: Konrad Wilk <konrad.wilk@oracle.com> Acked-by: Jan Beulich <JBeulich@novell.com> Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> @@ -24,47 +23,22 @@ Cc: Matthew Wilcox <matthew@wil.cx> Cc: Chris Mason <chris.mason@oracle.com> Cc: Rik Riel <riel@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> +Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> ---- head.orig/mm/Makefile 2012-01-05 00:55:44.000000000 +0100 -+++ head/mm/Makefile 2011-11-16 16:48:21.000000000 +0100 -@@ -26,6 +26,7 @@ obj-$(CONFIG_HAVE_MEMBLOCK) += memblock. - - obj-$(CONFIG_BOUNCE) += bounce.o - obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o -+obj-$(CONFIG_FRONTSWAP) += frontswap.o - obj-$(CONFIG_HAS_DMA) += dmapool.o - obj-$(CONFIG_HUGETLBFS) += hugetlb.o - obj-$(CONFIG_NUMA) += mempolicy.o ---- head.orig/mm/Kconfig 2012-02-08 09:32:42.000000000 +0100 -+++ head/mm/Kconfig 2012-02-08 10:12:47.000000000 +0100 -@@ -379,3 +379,20 @@ config CLEANCACHE - in a negligible performance hit. - - If unsure, say Y to enable cleancache -+ -+config FRONTSWAP -+ bool "Enable frontswap to cache swap pages if tmem is present" -+ depends on SWAP -+ default n -+ help -+ Frontswap is so named because it can be thought of as the opposite -+ of a "backing" store for a swap device. The data is stored into -+ "transcendent memory", memory that is not directly accessible or -+ addressable by the kernel and is of unknown and possibly -+ time-varying size. When space in transcendent memory is available, -+ a significant swap I/O reduction may be achieved. When none is -+ available, all frontswap calls are reduced to a single pointer- -+ compare-against-NULL resulting in a negligible performance hit -+ and swap data is stored as normal on the matching swap device. -+ -+ If unsure, say Y to enable frontswap. --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/Documentation/vm/frontswap.txt 2011-09-15 19:40:54.000000000 +0200 -@@ -0,0 +1,210 @@ ++++ head/Documentation/vm/frontswap.txt 2012-05-23 12:48:43.000000000 +0200 +@@ -0,0 +1,278 @@ +Frontswap provides a "transcendent memory" interface for swap pages. +In some environments, dramatic performance savings may be obtained because +swapped pages are saved in RAM (or a RAM-like device) instead of a swap disk. + ++(Note, frontswap -- and cleancache (merged at 3.0) -- are the "frontends" ++and the only necessary changes to the core kernel for transcendent memory; ++all other supporting code -- the "backends" -- is implemented as drivers. ++See the LWN.net article "Transcendent memory in a nutshell" for a detailed ++overview of frontswap and related kernel parts: ++https://lwn.net/Articles/454795/ ) ++ +Frontswap is so named because it can be thought of as the opposite of +a "backing" store for a swap device. The storage is assumed to be +a synchronous concurrency-safe page-oriented "pseudo-RAM device" conforming @@ -94,6 +68,12 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +If a put returns failure, transcendent memory has rejected the data, and the +page can be written to swap as usual. + ++If a backend chooses, frontswap can be configured as a "writethrough ++cache" by calling frontswap_writethrough(). In this mode, the reduction ++in swap device writes is lost (and also a non-trivial performance advantage) ++in order to allow the backend to arbitrarily "reclaim" space used to ++store frontswap pages to more completely manage its memory usage. ++ +Note that if a page is put and the page already exists in transcendent memory +(a "duplicate" put), either the put succeeds and the data is overwritten, +or the put fails AND the page is invalidated. This ensures stale data may @@ -126,21 +106,46 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +cleancache) interface to transcendent memory provides a nice way to read +and write -- and indirectly "name" -- the pages. + ++Frontswap -- and cleancache -- with a fairly small impact on the kernel, ++provides a huge amount of flexibility for more dynamic, flexible RAM ++utilization in various system configurations: ++ ++In the single kernel case, aka "zcache", pages are compressed and ++stored in local memory, thus increasing the total anonymous pages ++that can be safely kept in RAM. Zcache essentially trades off CPU ++cycles used in compression/decompression for better memory utilization. ++Benchmarks have shown little or no impact when memory pressure is ++low while providing a significant performance improvement (25%+) ++on some workloads under high memory pressure. ++ ++"RAMster" builds on zcache by adding "peer-to-peer" transcendent memory ++support for clustered systems. Frontswap pages are locally compressed ++as in zcache, but then "remotified" to another system's RAM. This ++allows RAM to be dynamically load-balanced back-and-forth as needed, ++i.e. when system A is overcommitted, it can swap to system B, and ++vice versa. RAMster can also be configured as a memory server so ++many servers in a cluster can swap, dynamically as needed, to a single ++server configured with a large amount of RAM... without pre-configuring ++how much of the RAM is available for each of the clients! ++ +In the virtual case, the whole point of virtualization is to statistically +multiplex physical resources acrosst the varying demands of multiple +virtual machines. This is really hard to do with RAM and efforts to do +it well with no kernel changes have essentially failed (except in some -+well-publicized special-case workloads). Frontswap -- and cleancache -- -+with a fairly small impact on the kernel, provides a huge amount -+of flexibility for more dynamic, flexible RAM multiplexing. ++well-publicized special-case workloads). +Specifically, the Xen Transcendent Memory backend allows otherwise +"fallow" hypervisor-owned RAM to not only be "time-shared" between multiple +virtual machines, but the pages can be compressed and deduplicated to +optimize RAM utilization. And when guest OS's are induced to surrender -+underutilized RAM (e.g. with "self-ballooning"), sudden unexpected ++underutilized RAM (e.g. with "selfballooning"), sudden unexpected +memory pressure may result in swapping; frontswap allows those pages -+to be swapped to and from hypervisor RAM if overall host system memory -+conditions allow. ++to be swapped to and from hypervisor RAM (if overall host system memory ++conditions allow), thus mitigating the potentially awful performance impact ++of unplanned swapping. ++ ++A KVM implementation is underway and has been RFC'ed to lkml. And, ++using frontswap, investigation is also underway on the use of NVM as ++a memory extension technology. + +2) Sure there may be performance advantages in some situations, but + what's the space/time overhead of frontswap? @@ -167,6 +172,12 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +later.) For very large swap disks (which are rare) on a standard +4K pagesize, this is 1MB per 32GB swap. + ++When swap pages are stored in transcendent memory instead of written ++out to disk, there is a side effect that this may create more memory ++pressure that can potentially outweigh the other advantages. A ++backend, such as zcache, must implement policies to carefully (but ++dynamically) manage memory limits to ensure this doesn't happen. ++ +3) OK, how about a quick overview of what this frontswap patch does + in terms that a kernel hacker can grok? + @@ -208,19 +219,24 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +faster. + +4) Can't frontswap be configured as a "special" swap device that is -+ just higher priority than any real swap device (e.g. like zswap)? -+ -+No. Recall that acceptance of any swap page by the frontswap -+backend is entirely unpredictable. This is critical to the definition -+of frontswap because it grants completely dynamic discretion to the -+backend. But since any "put" might fail, there must always be a real -+slot on a real swap device to swap the page. Thus frontswap must be -+implemented as a "shadow" to every swapon'd device with the potential -+capability of holding every page that the swap device might have held -+and the possibility that it might hold no pages at all. -+On the downside, this also means that frontswap cannot contain more -+pages than the total of swapon'd swap devices. For example, if NO -+swap device is configured on some installation, frontswap is useless. ++ just higher priority than any real swap device (e.g. like zswap, ++ or maybe swap-over-nbd/NFS)? ++ ++No. First, the existing swap subsystem doesn't allow for any kind of ++swap hierarchy. Perhaps it could be rewritten to accomodate a hierarchy, ++but this would require fairly drastic changes. Even if it were ++rewritten, the existing swap subsystem uses the block I/O layer which ++assumes a swap device is fixed size and any page in it is linearly ++addressable. Frontswap barely touches the existing swap subsystem, ++and works around the constraints of the block I/O subsystem to provide ++a great deal of flexibility and dynamicity. ++ ++For example, the acceptance of any swap page by the frontswap backend is ++entirely unpredictable. This is critical to the definition of frontswap ++backends because it grants completely dynamic discretion to the ++backend. In zcache, one cannot know a priori how compressible a page is. ++"Poorly" compressible pages can be rejected, and "poorly" can itself be ++defined dynamically depending on current memory constraints. + +Further, frontswap is entirely synchronous whereas a real swap +device is, by definition, asynchronous and uses block I/O. The @@ -229,14 +245,30 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +the write of some pages for a significant amount of time. Synchrony is +required to ensure the dynamicity of the backend and to avoid thorny race +conditions that would unnecessarily and greatly complicate frontswap -+and/or the block I/O subsystem. ++and/or the block I/O subsystem. That said, only the initial "put" ++and "get" operations need be synchronous. A separate asynchronous thread ++is free to manipulate the pages stored by frontswap. For example, ++the "remotification" thread in RAMster uses standard asynchronous ++kernel sockets to move compressed frontswap pages to a remote machine. ++Similarly, a KVM guest-side implementation could do in-guest compression ++and use "batched" hypercalls. + +In a virtualized environment, the dynamicity allows the hypervisor +(or host OS) to do "intelligent overcommit". For example, it can +choose to accept pages only until host-swapping might be imminent, -+then force guests to do their own swapping. In zcache, "poorly" -+compressible pages can be rejected, where "poorly" can itself be defined -+dynamically depending on current memory constraints. ++then force guests to do their own swapping. ++ ++There is a downside to the transcendent memory specifications for ++frontswap: Since any "put" might fail, there must always be a real ++slot on a real swap device to swap the page. Thus frontswap must be ++implemented as a "shadow" to every swapon'd device with the potential ++capability of holding every page that the swap device might have held ++and the possibility that it might hold no pages at all. This means ++that frontswap cannot contain more pages than the total of swapon'd ++swap devices. For example, if NO swap device is configured on some ++installation, frontswap is useless. Swapless portable devices ++can still use frontswap but a backend for such devices must configure ++some kind of "ghost" swap device and ensure that it is never used. + +5) Why this weird definition about "duplicate puts"? If a page + has been previously successfully put, can't it always be @@ -258,9 +290,12 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +swap device, that page is only taking up low-value pre-allocated disk +space. But if frontswap has placed a page in transcendent memory, that +page may be taking up valuable real estate. The frontswap_shrink -+routine allows code outside of the swap subsystem (such as Xen tmem -+or zcache or some future tmem backend) to force pages out of the memory -+managed by frontswap and back into kernel-addressable memory. ++routine allows code outside of the swap subsystem to force pages out ++of the memory managed by frontswap and back into kernel-addressable memory. ++For example, in RAMster, a "suction driver" thread will attempt ++to "repatriate" pages sent to a remote machine back to the local machine; ++this is driven using the frontswap_shrink mechanism when memory pressure ++subsides. + +7) Why does the frontswap patch create the new include file swapfile.h? + @@ -270,4 +305,37 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +them as global but declare them in a new include file that isn't +included by the large number of source files that include swap.h. + -+Dan Magenheimer, last updated September 12, 2011 ++Dan Magenheimer, last updated April 9, 2012 +--- head.orig/mm/Kconfig 2012-05-23 12:40:44.000000000 +0200 ++++ head/mm/Kconfig 2012-05-23 12:48:43.000000000 +0200 +@@ -379,3 +379,20 @@ config CLEANCACHE + in a negligible performance hit. + + If unsure, say Y to enable cleancache ++ ++config FRONTSWAP ++ bool "Enable frontswap to cache swap pages if tmem is present" ++ depends on SWAP ++ default n ++ help ++ Frontswap is so named because it can be thought of as the opposite ++ of a "backing" store for a swap device. The data is stored into ++ "transcendent memory", memory that is not directly accessible or ++ addressable by the kernel and is of unknown and possibly ++ time-varying size. When space in transcendent memory is available, ++ a significant swap I/O reduction may be achieved. When none is ++ available, all frontswap calls are reduced to a single pointer- ++ compare-against-NULL resulting in a negligible performance hit ++ and swap data is stored as normal on the matching swap device. ++ ++ If unsure, say Y to enable frontswap. +--- head.orig/mm/Makefile 2012-05-23 12:40:44.000000000 +0200 ++++ head/mm/Makefile 2012-05-23 12:48:43.000000000 +0200 +@@ -26,6 +26,7 @@ obj-$(CONFIG_HAVE_MEMBLOCK) += memblock. + + obj-$(CONFIG_BOUNCE) += bounce.o + obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o ++obj-$(CONFIG_FRONTSWAP) += frontswap.o + obj-$(CONFIG_HAS_DMA) += dmapool.o + obj-$(CONFIG_HUGETLBFS) += hugetlb.o + obj-$(CONFIG_NUMA) += mempolicy.o diff --git a/patches.xen/frontswap-core b/patches.xen/frontswap-core index 7908eadc12..98c637a04e 100644 --- a/patches.xen/frontswap-core +++ b/patches.xen/frontswap-core @@ -1,15 +1,12 @@ From: Dan Magenheimer <dan.magenheimer@oracle.com> -Subject: [PATCH V10 3/6] mm: frontswap: core frontswap functionality +Subject: [PATCH V16 3/4] mm: frontswap: core frontswap functionality Patch-mainline: n/a -(Note to earlier reviewers: This patchset has been reorganized due to -feedback from Kame Hiroyuki and Andrew Morton. This patch contains part -of patch 3of4 from the previous series.) - -This third patch of six in the frontswap series provides the core -frontswap code that interfaces between the hooks in the swap subsystem -and a frontswap backend via frontswap_ops. +This patch, 3of4, provides the core frontswap code that interfaces between +the hooks in the swap subsystem and a frontswap backend via frontswap_ops. +[v14: add support for writethrough, per suggestion by aarcange@redhat.com] +[v11: sjenning@linux.vnet.ibm.com: s/puts/failed_puts/] [v10: sjenning@linux.vnet.ibm.com: fix debugfs calls on 32-bit] [v9: akpm@linux-foundation.org: change "flush" to "invalidate", part 1] [v9: akpm@linux-foundation.org: mark some statics __read_mostly] @@ -26,8 +23,6 @@ and a frontswap backend via frontswap_ops. [v6: konrad.wilk@oracl.com: various checks and code clarifications/comments] [v4: rebase to 2.6.39] Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> -Reviewed-by: Konrad Wilk <konrad.wilk@oracle.com> -[jb: merged in flush->invalidate change in 3.4] Acked-by: Jan Beulich <JBeulich@novell.com> Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> @@ -38,10 +33,13 @@ Cc: Matthew Wilcox <matthew@wil.cx> Cc: Chris Mason <chris.mason@oracle.com> Cc: Rik Riel <riel@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> +[v12: Squashed s/flush/invalidate/ in] +[v15: A bit of cleanup and seperate DEBUGFS] +Signed-off-by: Konrad Wilk <konrad.wilk@oracle.com> --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/mm/frontswap.c 2012-04-10 15:09:35.000000000 +0200 -@@ -0,0 +1,272 @@ ++++ head/mm/frontswap.c 2012-05-23 12:47:48.000000000 +0200 +@@ -0,0 +1,314 @@ +/* + * Frontswap frontend + * @@ -49,7 +47,7 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + * "backend" driver implementation of frontswap. See + * Documentation/vm/frontswap.txt for more information. + * -+ * Copyright (C) 2009-2010 Oracle Corp. All rights reserved. ++ * Copyright (C) 2009-2012 Oracle Corp. All rights reserved. + * Author: Dan Magenheimer + * + * This work is licensed under the terms of the GNU GPL, version 2. @@ -79,12 +77,23 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + * has not been registered, so is preferred to the slower alternative: a + * function call that checks a non-global. + */ -+int frontswap_enabled __read_mostly; ++bool frontswap_enabled __read_mostly; +EXPORT_SYMBOL(frontswap_enabled); + +/* ++ * If enabled, frontswap_put will return failure even on success. As ++ * a result, the swap subsystem will always write the page to swap, in ++ * effect converting frontswap into a writethrough cache. In this mode, ++ * there is no direct reduction in swap writes, but a frontswap backend ++ * can unilaterally "reclaim" any pages in use with no data loss, thus ++ * providing increases control over maximum memory usage due to frontswap. ++ */ ++static bool frontswap_writethrough_enabled __read_mostly; ++ ++#ifdef CONFIG_DEBUG_FS ++/* + * Counters available via /sys/kernel/debug/frontswap (if debugfs is -+ * properly configured. These are for information only so are not protected ++ * properly configured). These are for information only so are not protected + * against increment races. + */ +static u64 frontswap_gets; @@ -92,21 +101,50 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +static u64 frontswap_failed_puts; +static u64 frontswap_invalidates; + ++static inline void inc_frontswap_gets(void) { ++ frontswap_gets++; ++} ++static inline void inc_frontswap_succ_puts(void) { ++ frontswap_succ_puts++; ++} ++static inline void inc_frontswap_failed_puts(void) { ++ frontswap_failed_puts++; ++} ++static inline void inc_frontswap_invalidates(void) { ++ frontswap_invalidates++; ++} ++#else ++static inline void inc_frontswap_gets(void) { } ++static inline void inc_frontswap_succ_puts(void) { } ++static inline void inc_frontswap_failed_puts(void) { } ++static inline void inc_frontswap_invalidates(void) { } ++#endif +/* + * Register operations for frontswap, returning previous thus allowing -+ * detection of multiple backends and possible nesting ++ * detection of multiple backends and possible nesting. + */ +struct frontswap_ops frontswap_register_ops(struct frontswap_ops *ops) +{ + struct frontswap_ops old = frontswap_ops; + + frontswap_ops = *ops; -+ frontswap_enabled = 1; ++ frontswap_enabled = true; + return old; +} +EXPORT_SYMBOL(frontswap_register_ops); + -+/* Called when a swap device is swapon'd */ ++/* ++ * Enable/disable frontswap writethrough (see above). ++ */ ++void frontswap_writethrough(bool enable) ++{ ++ frontswap_writethrough_enabled = enable; ++} ++EXPORT_SYMBOL(frontswap_writethrough); ++ ++/* ++ * Called when a swap device is swapon'd. ++ */ +void __frontswap_init(unsigned type) +{ + struct swap_info_struct *sis = swap_info[type]; @@ -124,7 +162,7 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + * swaptype and offset. Page must be locked and in the swap cache. + * If frontswap already contains a page with matching swaptype and + * offset, the frontswap implmentation may either overwrite the data and -+ * return success or invalidate the page from frontswap and return failure ++ * return success or invalidate the page from frontswap and return failure. + */ +int __frontswap_put_page(struct page *page) +{ @@ -141,7 +179,7 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + ret = (*frontswap_ops.put_page)(type, offset, page); + if (ret == 0) { + frontswap_set(sis, offset); -+ frontswap_succ_puts++; ++ inc_frontswap_succ_puts(); + if (!dup) + atomic_inc(&sis->frontswap_pages); + } else if (dup) { @@ -151,9 +189,12 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + */ + frontswap_clear(sis, offset); + atomic_dec(&sis->frontswap_pages); -+ frontswap_failed_puts++; ++ inc_frontswap_failed_puts(); + } else -+ frontswap_failed_puts++; ++ inc_frontswap_failed_puts(); ++ if (frontswap_writethrough_enabled) ++ /* report failure so swap also writes to swap device */ ++ ret = -1; + return ret; +} +EXPORT_SYMBOL(__frontswap_put_page); @@ -161,7 +202,7 @@ Cc: Andrew Morton <akpm@linux-foundation.org> +/* + * "Get" data from frontswap associated with swaptype and offset that were + * specified when the data was put to frontswap and use it to fill the -+ * specified page with data. Page must be locked and in the swap cache ++ * specified page with data. Page must be locked and in the swap cache. + */ +int __frontswap_get_page(struct page *page) +{ @@ -176,7 +217,7 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + if (frontswap_test(sis, offset)) + ret = (*frontswap_ops.get_page)(type, offset, page); + if (ret == 0) -+ frontswap_gets++; ++ inc_frontswap_gets(); + return ret; +} +EXPORT_SYMBOL(__frontswap_get_page); @@ -194,7 +235,7 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + (*frontswap_ops.invalidate_page)(type, offset); + atomic_dec(&sis->frontswap_pages); + frontswap_clear(sis, offset); -+ frontswap_invalidates++; ++ inc_frontswap_invalidates(); + } +} +EXPORT_SYMBOL(__frontswap_invalidate_page); @@ -298,19 +339,18 @@ Cc: Andrew Morton <akpm@linux-foundation.org> + +static int __init init_frontswap(void) +{ -+ int err = 0; -+ +#ifdef CONFIG_DEBUG_FS + struct dentry *root = debugfs_create_dir("frontswap", NULL); + if (root == NULL) + return -ENXIO; + debugfs_create_u64("gets", S_IRUGO, root, &frontswap_gets); + debugfs_create_u64("succ_puts", S_IRUGO, root, &frontswap_succ_puts); -+ debugfs_create_u64("puts", S_IRUGO, root, &frontswap_failed_puts); ++ debugfs_create_u64("failed_puts", S_IRUGO, root, ++ &frontswap_failed_puts); + debugfs_create_u64("invalidates", S_IRUGO, + root, &frontswap_invalidates); +#endif -+ return err; ++ return 0; +} + +module_init(init_frontswap); diff --git a/patches.xen/frontswap-header b/patches.xen/frontswap-header index eb3e741ee6..3cafeb0230 100644 --- a/patches.xen/frontswap-header +++ b/patches.xen/frontswap-header @@ -1,9 +1,7 @@ From: Dan Magenheimer <dan.magenheimer@oracle.com> -Subject: [PATCH V10 1/6] mm: frontswap: add frontswap header file +Subject: [PATCH V16 1/4] mm: frontswap: add frontswap header file Patch-mainline: n/a -(Note: Following three paragraphs repeated for git commit log.) - Frontswap is the alter ego of cleancache, the "yang" to cleancache's "yin"... and more precisely frontswap is the provider of anonymous pages to transcendent memory to nicely complement cleancache's providing @@ -12,35 +10,37 @@ of transcendent memory, both are necessary... because a kernel under memory pressure first reclaims clean pagecache pages and, when under more memory pressure, starts swapping anonymous pages. -Frontswap and cleancache (which was merged at 3.0) are the only -necessary changes to the core kernel for transcendent memory; all -other supporting code is implemented as drivers. See "Transcendent -memory in a nutshell" for a current (Aug 2011) and detailed overview of -frontswap and related kernel parts: https://lwn.net/Articles/454795/ +Frontswap and cleancache (which was merged at 3.0) are the "frontends" +and the only necessary changes to the core kernel for transcendent memory; +all other supporting code -- the "backends" -- is implemented as drivers. +See the LWN.net article "Transcendent memory in a nutshell" for a detailed +overview of frontswap and related kernel parts: +https://lwn.net/Articles/454795/ -Frontswap code was first posted publicly in January 2009 and on LKML -in May 2009, and has remained very stable for over two years now. -It is barely invasive, touching only the swap subsystem and adds only -about 100 lines of code to existing swap subsystem code files. +Frontswap code was first posted publicly in January 2009 and on LKML in +May 2009, and has remained functionally stable for nearly three years now. +It is barely invasive, touching only the swap subsystem and adds less +than 100 lines of code to existing swap subsystem code files. It has improved syntactically substantially between V1 and this posting -of V10, thanks to the review of a few kernel developers, and has adapted -easily to at least one major swap subsystem change. As of 3.1, there are -two in-tree users of frontswap patiently waiting for this patchset and for -CONFIG_FRONTSWAP to be enabled: zcache (staging driver merged at -2.6.39) and Xen tmem (merged at 3.0 and 3.1). V5 of the frontswap -patchset has been in linux-next since next-110603 (and this V10 -will be there shortly). Earlier versions of frontswap already appear -in some leading-edge distros. - -This first patch of six in this frontswap series provides the header -file for the core code for frontswap that interfaces between the hooks -in the swap subsystem and a frontswap backend via frontswap_ops. -(Note to earlier reviewers: This patchset has been reorganized due to -feedback from Kame Hiroyuki and Andrew Morton. This patch contains part -of patch 3of4 from the previous series.) +of V14, thanks to the review of a few kernel developers, and has adapted +easily to at least one major swap subsystem change. As of 3.4, there are +three in-tree users of frontswap patiently waiting for this patchset and +for CONFIG_FRONTSWAP to be enabled: zcache (staging driver merged at +2.6.39), Xen tmem (merged at 3.0 and 3.1) and RAMster (staging driver +merged at 3.4). In addition, a RFC has been posted for a KVM backend. +The frontswap patchset has been in linux-next since next-110603. Earlier +versions of frontswap already ship in the Oracle Unbreakable Enterprise Kernel +and SuSE SLES. +This patch, 1of4, provides the header file for the core code for frontswap +that interfaces between the hooks in the swap subsystem and a frontswap +backend via frontswap_ops. +--- New file added: include/linux/frontswap.h +[v14: add support for writethrough, per suggestion by aarcange@redhat.com] +[v14: rebase to 3.4-rc2] +[v11: konrad.wilk@oracle.com: squashed s/flush/invalidate/ in] [v10: no change] [v9: akpm@linux-foundation.org: change "flush" to "invalidate", part 1] [v8: rebase to 3.0-rc4] @@ -51,9 +51,7 @@ New file added: include/linux/frontswap.h [v5: no change from v4] [v4: rebase to 2.6.39] Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> -Reviewed-by: Konrad Wilk <konrad.wilk@oracle.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> -[jb: merged in flush->invalidate change in 3.4] Acked-by: Jan Beulich <JBeulich@novell.com> Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> @@ -63,10 +61,12 @@ Cc: Nitin Gupta <ngupta@vflare.org> Cc: Matthew Wilcox <matthew@wil.cx> Cc: Chris Mason <chris.mason@oracle.com> Cc: Rik Riel <riel@redhat.com> +[v15: int/bool on some functions] +Signed-off-by: Konrad Wilk <konrad.wilk@oracle.com> --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/include/linux/frontswap.h 2012-04-10 15:08:55.000000000 +0200 -@@ -0,0 +1,126 @@ ++++ head/include/linux/frontswap.h 2012-05-23 12:45:00.000000000 +0200 +@@ -0,0 +1,127 @@ +#ifndef _LINUX_FRONTSWAP_H +#define _LINUX_FRONTSWAP_H + @@ -82,11 +82,12 @@ Cc: Rik Riel <riel@redhat.com> + void (*invalidate_area)(unsigned); +}; + -+extern int frontswap_enabled; ++extern bool frontswap_enabled; +extern struct frontswap_ops + frontswap_register_ops(struct frontswap_ops *ops); +extern void frontswap_shrink(unsigned long); +extern unsigned long frontswap_curr_pages(void); ++extern void frontswap_writethrough(bool); + +extern void __frontswap_init(unsigned type); +extern int __frontswap_put_page(struct page *page); @@ -96,9 +97,9 @@ Cc: Rik Riel <riel@redhat.com> + +#ifdef CONFIG_FRONTSWAP + -+static inline int frontswap_test(struct swap_info_struct *sis, pgoff_t offset) ++static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) +{ -+ int ret = 0; ++ bool ret = false; + + if (frontswap_enabled && sis->frontswap_map) + ret = test_bit(offset, sis->frontswap_map); @@ -132,9 +133,9 @@ Cc: Rik Riel <riel@redhat.com> + +#define frontswap_enabled (0) + -+static inline int frontswap_test(struct swap_info_struct *sis, pgoff_t offset) ++static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset) +{ -+ return 0; ++ return false; +} + +static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset) diff --git a/patches.xen/frontswap-hooks b/patches.xen/frontswap-hooks index 446037777f..174c1eaabd 100644 --- a/patches.xen/frontswap-hooks +++ b/patches.xen/frontswap-hooks @@ -1,13 +1,9 @@ From: Dan Magenheimer <dan.magenheimer@oracle.com> -Subject: [PATCH V10 2/6] mm: frontswap: core swap subsystem hooks and headers +Subject: [PATCH V12 2/4] mm: frontswap: core swap subsystem hooks and headers Patch-mainline: n/a -(Note to earlier reviewers: This patchset has been reorganized due to -feedback from Kame Hiroyuki and Andrew Morton. This patch combines patch -1of4 and patch 3of4 from the previous series.) - -This second patch of six in the frontswap series contains the changes -to the core swap subsystem. This includes: +This patch, 2of4, contains the changes to the core swap subsystem. +This includes: (1) makes available core swap data structures (swap_lock, swap_list and swap_info) that are needed by frontswap.c but we don't need to expose them @@ -25,6 +21,7 @@ frontswap_shrink can do a "partial swapoff". Note that a failed frontswap_map allocation is safe... failure is noted by lack of "FS" in the subsequent printk. +[v14: rebase to 3.4-rc2] [v10: no change] [v9: akpm@linux-foundation.org: mark some statics __read_mostly] [v9: akpm@linux-foundation.org: add clarifying comments] @@ -41,7 +38,6 @@ by lack of "FS" in the subsequent printk. [v5: no change from v4] [v4: rebase to 2.6.39] Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> -Reviewed-by: Konrad Wilk <konrad.wilk@oracle.com> Reviewed-by: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Jan Beulich <JBeulich@novell.com> Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com> @@ -53,18 +49,24 @@ Cc: Matthew Wilcox <matthew@wil.cx> Cc: Chris Mason <chris.mason@oracle.com> Cc: Rik Riel <riel@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> +[v11: Rebased, fixed mm/swapfile.c context change] +Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> ---- - -Diffstat: - include/linux/swap.h | 4 + - include/linux/swapfile.h | 13 ++++ - mm/page_io.c | 12 +++ - mm/swapfile.c | 64 ++++++++++++++++----- - 4 files changed, 80 insertions(+), 13 deletions(-) - +--- head.orig/include/linux/swap.h 2012-05-23 12:41:52.000000000 +0200 ++++ head/include/linux/swap.h 2012-05-23 12:46:19.000000000 +0200 +@@ -197,6 +197,10 @@ struct swap_info_struct { + struct block_device *bdev; /* swap device or bdev of swap file */ + struct file *swap_file; /* seldom referenced */ + unsigned int old_block_size; /* seldom referenced */ ++#ifdef CONFIG_FRONTSWAP ++ unsigned long *frontswap_map; /* frontswap in-use, one bit per page */ ++ atomic_t frontswap_pages; /* frontswap pages in-use counter */ ++#endif + }; + + struct swap_list_t { --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/include/linux/swapfile.h 2011-09-15 19:40:54.000000000 +0200 ++++ head/include/linux/swapfile.h 2012-05-23 12:46:19.000000000 +0200 @@ -0,0 +1,13 @@ +#ifndef _LINUX_SWAPFILE_H +#define _LINUX_SWAPFILE_H @@ -79,21 +81,43 @@ Diffstat: +extern int try_to_unuse(unsigned int, bool, unsigned long); + +#endif /* _LINUX_SWAPFILE_H */ ---- head.orig/include/linux/swap.h 2012-04-10 14:24:30.000000000 +0200 -+++ head/include/linux/swap.h 2012-04-10 14:54:04.000000000 +0200 -@@ -197,6 +197,10 @@ struct swap_info_struct { - struct block_device *bdev; /* swap device or bdev of swap file */ - struct file *swap_file; /* seldom referenced */ - unsigned int old_block_size; /* seldom referenced */ -+#ifdef CONFIG_FRONTSWAP -+ unsigned long *frontswap_map; /* frontswap in-use, one bit per page */ -+ atomic_t frontswap_pages; /* frontswap pages in-use counter */ -+#endif - }; +--- head.orig/mm/page_io.c 2012-05-23 12:41:52.000000000 +0200 ++++ head/mm/page_io.c 2012-05-23 12:46:19.000000000 +0200 +@@ -18,6 +18,7 @@ + #include <linux/bio.h> + #include <linux/swapops.h> + #include <linux/writeback.h> ++#include <linux/frontswap.h> + #include <asm/pgtable.h> - struct swap_list_t { ---- head.orig/mm/swapfile.c 2012-04-10 14:24:30.000000000 +0200 -+++ head/mm/swapfile.c 2012-04-10 14:53:52.000000000 +0200 + static struct bio *get_swap_bio(gfp_t gfp_flags, +@@ -98,6 +99,12 @@ int swap_writepage(struct page *page, st + unlock_page(page); + goto out; + } ++ if (frontswap_put_page(page) == 0) { ++ set_page_writeback(page); ++ unlock_page(page); ++ end_page_writeback(page); ++ goto out; ++ } + bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write); + if (bio == NULL) { + set_page_dirty(page); +@@ -122,6 +129,11 @@ int swap_readpage(struct page *page) + + VM_BUG_ON(!PageLocked(page)); + VM_BUG_ON(PageUptodate(page)); ++ if (frontswap_get_page(page) == 0) { ++ SetPageUptodate(page); ++ unlock_page(page); ++ goto out; ++ } + bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read); + if (bio == NULL) { + unlock_page(page); +--- head.orig/mm/swapfile.c 2012-05-23 12:41:52.000000000 +0200 ++++ head/mm/swapfile.c 2012-05-23 12:46:19.000000000 +0200 @@ -31,6 +31,8 @@ #include <linux/memcontrol.h> #include <linux/poll.h> @@ -287,38 +311,3 @@ Diffstat: mutex_unlock(&swapon_mutex); atomic_inc(&proc_poll_event); ---- head.orig/mm/page_io.c 2011-05-19 06:06:34.000000000 +0200 -+++ head/mm/page_io.c 2011-09-15 19:40:54.000000000 +0200 -@@ -18,6 +18,7 @@ - #include <linux/bio.h> - #include <linux/swapops.h> - #include <linux/writeback.h> -+#include <linux/frontswap.h> - #include <asm/pgtable.h> - - static struct bio *get_swap_bio(gfp_t gfp_flags, -@@ -98,6 +99,12 @@ int swap_writepage(struct page *page, st - unlock_page(page); - goto out; - } -+ if (frontswap_put_page(page) == 0) { -+ set_page_writeback(page); -+ unlock_page(page); -+ end_page_writeback(page); -+ goto out; -+ } - bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write); - if (bio == NULL) { - set_page_dirty(page); -@@ -122,6 +129,11 @@ int swap_readpage(struct page *page) - - VM_BUG_ON(!PageLocked(page)); - VM_BUG_ON(PageUptodate(page)); -+ if (frontswap_get_page(page) == 0) { -+ SetPageUptodate(page); -+ unlock_page(page); -+ goto out; -+ } - bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read); - if (bio == NULL) { - unlock_page(page); diff --git a/patches.xen/pci-guestdev b/patches.xen/pci-guestdev index d51fd05d7b..80ec931877 100644 --- a/patches.xen/pci-guestdev +++ b/patches.xen/pci-guestdev @@ -8,7 +8,7 @@ jb: Added support for guestiomuldev=all. jb: split /dev/xen/pci_iomul driver to be separate (so it can be a module) Acked-by: jbeulich@novell.com ---- head.orig/Documentation/kernel-parameters.txt 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/Documentation/kernel-parameters.txt 2012-05-23 12:40:44.000000000 +0200 +++ head/Documentation/kernel-parameters.txt 2012-04-10 15:12:34.000000000 +0200 @@ -889,6 +889,24 @@ bytes respectively. Such letter suffixes gpt [EFI] Forces disk with valid GPT signature but @@ -46,7 +46,7 @@ Acked-by: jbeulich@novell.com reboot= [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode Format: <reboot_mode>[,<reboot_mode2>[,...]] See arch/*/kernel/reboot.c or arch/*/kernel/process.c ---- head.orig/drivers/acpi/pci_root.c 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/drivers/acpi/pci_root.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/acpi/pci_root.c 2012-02-08 10:19:15.000000000 +0100 @@ -449,6 +449,41 @@ out: } @@ -136,8 +136,8 @@ Acked-by: jbeulich@novell.com + return FALSE; +} +#endif ---- head.orig/drivers/acpi/scan.c 2012-05-08 10:46:14.000000000 +0200 -+++ head/drivers/acpi/scan.c 2012-05-08 10:47:26.000000000 +0200 +--- head.orig/drivers/acpi/scan.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/acpi/scan.c 2012-05-23 12:49:43.000000000 +0200 @@ -175,6 +175,16 @@ acpi_device_hid_show(struct device *dev, } static DEVICE_ATTR(hid, 0444, acpi_device_hid_show, NULL); @@ -179,7 +179,7 @@ Acked-by: jbeulich@novell.com } static void acpi_device_release(struct device *dev) -@@ -1134,6 +1154,11 @@ static void acpi_device_set_id(struct ac +@@ -1138,6 +1158,11 @@ static void acpi_device_set_id(struct ac for (i = 0; i < cid_list->count; i++) acpi_add_id(device, cid_list->ids[i].string); } @@ -191,7 +191,7 @@ Acked-by: jbeulich@novell.com if (info->valid & ACPI_VALID_ADR) { device->pnp.bus_address = info->address; device->flags.bus_address = 1; ---- head.orig/drivers/pci/Kconfig 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/drivers/pci/Kconfig 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/pci/Kconfig 2012-04-10 15:12:12.000000000 +0200 @@ -44,6 +44,20 @@ config PCI_REALLOC_ENABLE_AUTO @@ -214,7 +214,7 @@ Acked-by: jbeulich@novell.com config PCI_STUB tristate "PCI Stub driver" depends on PCI ---- head.orig/drivers/pci/Makefile 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/drivers/pci/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/pci/Makefile 2011-01-31 14:31:28.000000000 +0100 @@ -7,6 +7,10 @@ obj-y += access.o bus.o probe.o remove. irq.o vpd.o @@ -2143,7 +2143,7 @@ Acked-by: jbeulich@novell.com +int pci_iomul_switch_io_allocated(const struct pci_iomul_switch *); +void pci_iomul_get_lock_switch(struct pci_dev *, struct pci_iomul_switch **, + struct pci_iomul_slot **); ---- head.orig/drivers/pci/pci.c 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/drivers/pci/pci.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/pci/pci.c 2012-05-08 10:47:31.000000000 +0200 @@ -3721,6 +3721,13 @@ resource_size_t pci_specified_resource_a */ @@ -2159,7 +2159,7 @@ Acked-by: jbeulich@novell.com return (pci_specified_resource_alignment(dev) != 0); } ---- head.orig/drivers/pci/pci.h 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/drivers/pci/pci.h 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/pci/pci.h 2012-02-08 10:19:27.000000000 +0100 @@ -326,4 +326,11 @@ static inline int pci_dev_specific_reset } @@ -2616,7 +2616,7 @@ Acked-by: jbeulich@novell.com +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Isaku Yamahata <yamahata@valinux.co.jp>"); +MODULE_DESCRIPTION("PCI IO space multiplexing driver"); ---- head.orig/include/linux/acpi.h 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/include/linux/acpi.h 2012-05-23 12:40:44.000000000 +0200 +++ head/include/linux/acpi.h 2012-04-10 15:11:55.000000000 +0200 @@ -247,6 +247,8 @@ int acpi_check_region(resource_size_t st @@ -2627,7 +2627,7 @@ Acked-by: jbeulich@novell.com #ifdef CONFIG_PM_SLEEP void __init acpi_no_s4_hw_signature(void); void __init acpi_old_suspend_ordering(void); ---- head.orig/include/linux/pci.h 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/include/linux/pci.h 2012-05-23 12:40:44.000000000 +0200 +++ head/include/linux/pci.h 2012-04-10 15:11:52.000000000 +0200 @@ -1720,5 +1720,11 @@ static inline struct eeh_dev *pci_dev_to */ @@ -2641,7 +2641,7 @@ Acked-by: jbeulich@novell.com + #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ ---- head.orig/include/xen/Kbuild 2012-05-08 10:46:14.000000000 +0200 +--- head.orig/include/xen/Kbuild 2012-05-23 12:40:44.000000000 +0200 +++ head/include/xen/Kbuild 2011-01-31 14:31:28.000000000 +0100 @@ -1,2 +1,3 @@ header-y += evtchn.h diff --git a/patches.xen/xen-blkif-op-packet b/patches.xen/xen-blkif-op-packet index 2c65bbc356..a8e1a52811 100644 --- a/patches.xen/xen-blkif-op-packet +++ b/patches.xen/xen-blkif-op-packet @@ -82,8 +82,8 @@ References: fate#300964 DPRINTK("Bad return from blkdev data " "request: %x\n", bret->status); --- head.orig/drivers/xen/blktap/blktap.c 2012-02-17 11:29:03.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 11:10:05.000000000 +0100 -@@ -1134,13 +1134,14 @@ static void fast_flush_area(pending_req_ ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:47:55.000000000 +0200 +@@ -1142,13 +1142,14 @@ static void fast_flush_area(pending_req_ static void print_stats(blkif_t *blkif) { @@ -100,7 +100,7 @@ References: fate#300964 } int tap_blkif_schedule(void *arg) -@@ -1383,6 +1384,11 @@ static int do_block_io_op(blkif_t *blkif +@@ -1391,6 +1392,11 @@ static int do_block_io_op(blkif_t *blkif dispatch_rw_block_io(blkif, &req, pending_req); break; diff --git a/patches.xen/xen-blktap-write-barriers b/patches.xen/xen-blktap-write-barriers index d89edfc92f..74987c48bb 100644 --- a/patches.xen/xen-blktap-write-barriers +++ b/patches.xen/xen-blktap-write-barriers @@ -2,9 +2,9 @@ From: kwolf@suse.de Subject: blktap: Write Barriers Patch-mainline: obsolete ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 11:10:05.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 11:09:54.000000000 +0100 -@@ -1379,6 +1379,9 @@ static int do_block_io_op(blkif_t *blkif +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:47:55.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:48:03.000000000 +0200 +@@ -1387,6 +1387,9 @@ static int do_block_io_op(blkif_t *blkif dispatch_rw_block_io(blkif, &req, pending_req); break; @@ -14,7 +14,7 @@ Patch-mainline: obsolete case BLKIF_OP_WRITE: blkif->st_wr_req++; dispatch_rw_block_io(blkif, &req, pending_req); -@@ -1444,7 +1447,7 @@ static void dispatch_rw_block_io(blkif_t +@@ -1452,7 +1455,7 @@ static void dispatch_rw_block_io(blkif_t /* Check that number of segments is sane. */ nseg = req->nr_segments; @@ -23,7 +23,7 @@ Patch-mainline: obsolete unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST) ) { WPRINTK("Bad number of segments in request (%d)\n", nseg); goto fail_response; -@@ -1470,8 +1473,13 @@ static void dispatch_rw_block_io(blkif_t +@@ -1478,8 +1481,13 @@ static void dispatch_rw_block_io(blkif_t pending_req->nr_pages = nseg; flags = GNTMAP_host_map; @@ -38,7 +38,7 @@ Patch-mainline: obsolete op = 0; mm = info->mm; if (!xen_feature(XENFEAT_auto_translated_physmap)) -@@ -1631,6 +1639,7 @@ static void dispatch_rw_block_io(blkif_t +@@ -1639,6 +1647,7 @@ static void dispatch_rw_block_io(blkif_t blkif->st_rd_sect += nr_sects; break; case BLKIF_OP_WRITE: diff --git a/patches.xen/xen-clockevents b/patches.xen/xen-clockevents index e5271a3a74..a12e5f7a46 100644 --- a/patches.xen/xen-clockevents +++ b/patches.xen/xen-clockevents @@ -4,7 +4,7 @@ Patch-mainline: n/a Once validated this could be merged into the 2.6.?? patch. ---- head.orig/arch/x86/Kconfig 2012-04-10 17:22:07.000000000 +0200 +--- head.orig/arch/x86/Kconfig 2012-05-08 10:54:33.000000000 +0200 +++ head/arch/x86/Kconfig 2012-02-10 11:43:34.000000000 +0100 @@ -105,7 +105,6 @@ config CLOCKSOURCE_WATCHDOG @@ -14,9 +14,9 @@ Once validated this could be merged into the 2.6.?? patch. config ARCH_CLOCKSOURCE_DATA def_bool y ---- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2011-08-23 13:35:01.000000000 +0200 -+++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:33:17.000000000 +0100 -@@ -68,7 +68,6 @@ extern start_info_t *xen_start_info; +--- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:45:57.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:22:53.000000000 +0200 +@@ -71,7 +71,6 @@ extern start_info_t *xen_start_info; #define init_hypervisor_platform() init_hypervisor(&boot_cpu_data) DECLARE_PER_CPU(struct vcpu_runstate_info, runstate); diff --git a/patches.xen/xen-pcpu-hotplug b/patches.xen/xen-pcpu-hotplug index 3c347618c1..12050a4b34 100644 --- a/patches.xen/xen-pcpu-hotplug +++ b/patches.xen/xen-pcpu-hotplug @@ -109,9 +109,9 @@ Acked-by: jbeulich@novell.com if (pmbits & XEN_PROCESSOR_PM_CX) xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier; if (pmbits & XEN_PROCESSOR_PM_PX) ---- head.orig/drivers/acpi/processor_driver.c 2012-04-11 15:08:13.000000000 +0200 -+++ head/drivers/acpi/processor_driver.c 2012-04-11 17:03:10.000000000 +0200 -@@ -910,10 +910,21 @@ static acpi_status acpi_processor_hotadd +--- head.orig/drivers/acpi/processor_driver.c 2012-05-23 13:40:53.000000000 +0200 ++++ head/drivers/acpi/processor_driver.c 2012-05-23 13:47:06.000000000 +0200 +@@ -907,10 +907,21 @@ static acpi_status acpi_processor_hotadd { acpi_handle handle = pr->handle; @@ -133,7 +133,7 @@ Acked-by: jbeulich@novell.com if (acpi_map_lsapic(handle, &pr->id)) return AE_ERROR; -@@ -938,10 +949,11 @@ static acpi_status acpi_processor_hotadd +@@ -935,10 +946,11 @@ static acpi_status acpi_processor_hotadd static int acpi_processor_handle_eject(struct acpi_processor *pr) { @@ -579,8 +579,8 @@ Acked-by: jbeulich@novell.com +} +subsys_initcall(xen_pcpu_init); --- head.orig/include/acpi/processor.h 2011-12-21 11:18:27.000000000 +0100 -+++ head/include/acpi/processor.h 2012-02-16 14:40:42.000000000 +0100 -@@ -499,6 +499,8 @@ static inline void xen_convert_psd_pack( ++++ head/include/acpi/processor.h 2012-05-23 13:47:11.000000000 +0200 +@@ -498,6 +498,8 @@ static inline void xen_convert_psd_pack( xpsd->num_processors = apsd->num_processors; } diff --git a/patches.xen/xen-sections b/patches.xen/xen-sections index d56a93dfa6..54f12b44f8 100644 --- a/patches.xen/xen-sections +++ b/patches.xen/xen-sections @@ -65,8 +65,8 @@ Patch-mainline: obsolete { unsigned int cpu; ---- head.orig/drivers/xen/core/gnttab.c 2012-03-12 14:01:03.000000000 +0100 -+++ head/drivers/xen/core/gnttab.c 2012-03-12 14:01:27.000000000 +0100 +--- head.orig/drivers/xen/core/gnttab.c 2012-05-23 13:46:56.000000000 +0200 ++++ head/drivers/xen/core/gnttab.c 2012-05-23 13:47:43.000000000 +0200 @@ -894,7 +894,12 @@ static int gnttab_expand(unsigned int re return rc; } @@ -79,9 +79,9 @@ Patch-mainline: obsolete +#endif +gnttab_init(void) { - int i; + int i, ret; unsigned int max_nr_glist_frames, nr_glist_frames; ---- head.orig/drivers/xen/pcifront/pci_op.c 2012-04-04 10:24:26.000000000 +0200 +--- head.orig/drivers/xen/pcifront/pci_op.c 2012-04-13 16:45:40.000000000 +0200 +++ head/drivers/xen/pcifront/pci_op.c 2012-04-04 13:33:29.000000000 +0200 @@ -407,7 +407,7 @@ void pci_frontend_disable_msi(struct pci #endif /* CONFIG_PCI_MSI */ diff --git a/patches.xen/xen-sys-suspend b/patches.xen/xen-sys-suspend index 90b37fade7..d6e3b938fd 100644 --- a/patches.xen/xen-sys-suspend +++ b/patches.xen/xen-sys-suspend @@ -135,7 +135,7 @@ Patch-mainline: n/a #ifdef CONFIG_SMP static char timer_name[NR_CPUS][15]; ---- head.orig/drivers/xen/core/evtchn.c 2012-04-03 17:08:41.000000000 +0200 +--- head.orig/drivers/xen/core/evtchn.c 2012-04-12 09:56:01.000000000 +0200 +++ head/drivers/xen/core/evtchn.c 2012-04-03 17:09:04.000000000 +0200 @@ -1090,6 +1090,8 @@ int xen_test_irq_pending(int irq) } @@ -189,7 +189,7 @@ Patch-mainline: n/a int __init arch_early_irq_init(void) --- head.orig/drivers/xen/core/gnttab.c 2012-03-12 16:18:44.000000000 +0100 -+++ head/drivers/xen/core/gnttab.c 2012-03-12 14:01:03.000000000 +0100 ++++ head/drivers/xen/core/gnttab.c 2012-05-23 13:46:56.000000000 +0200 @@ -795,20 +795,35 @@ EXPORT_SYMBOL(gnttab_post_map_adjust); int gnttab_resume(void) { @@ -230,7 +230,7 @@ Patch-mainline: n/a #endif #else /* !CONFIG_XEN */ -@@ -932,6 +947,11 @@ int __devinit gnttab_init(void) +@@ -936,6 +951,11 @@ int __devinit gnttab_init(void) } #endif diff --git a/patches.xen/xen-x86-EFI b/patches.xen/xen-x86-EFI index cf597aaabc..f827f9db65 100644 --- a/patches.xen/xen-x86-EFI +++ b/patches.xen/xen-x86-EFI @@ -38,9 +38,9 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 #endif #include_next <asm/setup.h> ---- head.orig/arch/x86/kernel/setup-xen.c 2012-04-11 17:13:16.000000000 +0200 -+++ head/arch/x86/kernel/setup-xen.c 2012-04-11 17:14:37.000000000 +0200 -@@ -916,6 +916,8 @@ void __init setup_arch(char **cmdline_p) +--- head.orig/arch/x86/kernel/setup-xen.c 2012-05-08 11:20:04.000000000 +0200 ++++ head/arch/x86/kernel/setup-xen.c 2012-05-23 13:48:26.000000000 +0200 +@@ -922,6 +922,8 @@ void __init setup_arch(char **cmdline_p) xen_start_info->console.dom0.info_size); xen_start_info->console.domU.mfn = 0; xen_start_info->console.domU.evtchn = 0; @@ -49,7 +49,7 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 } else screen_info.orig_video_isVGA = 0; copy_edid(); ---- head.orig/arch/x86/platform/efi/Makefile 2011-01-05 01:50:19.000000000 +0100 +--- head.orig/arch/x86/platform/efi/Makefile 2012-05-23 12:40:40.000000000 +0200 +++ head/arch/x86/platform/efi/Makefile 2011-06-09 17:06:13.000000000 +0200 @@ -1 +1,2 @@ obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o @@ -578,7 +578,7 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 + info->mem.size = 0; + return HYPERVISOR_platform_op(&op) ? 0 : info->mem.attr; +} ---- head.orig/drivers/rtc/Kconfig 2012-04-10 14:24:24.000000000 +0200 +--- head.orig/drivers/rtc/Kconfig 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/rtc/Kconfig 2012-04-11 17:14:50.000000000 +0200 @@ -563,7 +563,7 @@ config RTC_DRV_DA9052 @@ -610,7 +610,7 @@ References: fate#311376, fate#311529, bnc#578927, bnc#628554 if (size >= offsetof(struct dom0_vga_console_info, u.vesa_lfb.gbl_caps) + sizeof(info->u.vesa_lfb.gbl_caps)) ---- head.orig/include/linux/efi.h 2012-04-10 14:24:30.000000000 +0200 +--- head.orig/include/linux/efi.h 2012-05-23 12:40:41.000000000 +0200 +++ head/include/linux/efi.h 2012-04-11 17:14:58.000000000 +0200 @@ -451,7 +451,9 @@ typedef struct { * All runtime access to EFI goes through this structure: diff --git a/patches.xen/xen-x86-bigmem b/patches.xen/xen-x86-bigmem index 88301806f1..393b17e86b 100644 --- a/patches.xen/xen-x86-bigmem +++ b/patches.xen/xen-x86-bigmem @@ -3,9 +3,9 @@ Subject: fix issues with the assignment of huge amounts of memory Patch-mainline: obsolete References: bnc#482614, bnc#537435, bnc#700856 ---- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:49:34.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:49:46.000000000 +0100 -@@ -100,6 +100,10 @@ void xen_pgd_pin(unsigned long ptr); +--- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:46:47.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:46:55.000000000 +0200 +@@ -103,6 +103,10 @@ void xen_pgd_pin(unsigned long ptr); void xen_pgd_unpin(unsigned long ptr); void xen_init_pgd_pin(void); @@ -99,7 +99,7 @@ References: bnc#482614, bnc#537435, bnc#700856 /* Raw start-of-day parameters from the hypervisor. */ start_info_t *xen_start_info; -@@ -178,6 +173,56 @@ struct boot_params __initdata boot_param +@@ -178,6 +173,62 @@ struct boot_params __initdata boot_param #else struct boot_params boot_params; #endif @@ -117,19 +117,25 @@ References: bnc#482614, bnc#537435, bnc#700856 +setup_pfn_to_mfn_frame_list(typeof(__alloc_bootmem) *__alloc_bootmem) +{ + unsigned long i, j, size; -+ unsigned int k, fpp = PAGE_SIZE / sizeof(unsigned long); ++ unsigned int k, order, fpp = PAGE_SIZE / sizeof(unsigned long); + + size = (max_pfn + fpp - 1) / fpp; + size = (size + fpp - 1) / fpp; + ++size; /* include a zero terminator for crash tools */ + size *= sizeof(unsigned long); ++ order = get_order(size); + if (__alloc_bootmem) -+ pfn_to_mfn_frame_list_list = alloc_bootmem_pages(size); -+ if (size > PAGE_SIZE -+ && xen_create_contiguous_region((unsigned long) -+ pfn_to_mfn_frame_list_list, -+ get_order(size), 0)) -+ BUG(); ++ pfn_to_mfn_frame_list_list = ++ alloc_bootmem_pages(PAGE_SIZE << order); ++ if (order) { ++ if (xen_create_contiguous_region((unsigned long) ++ pfn_to_mfn_frame_list_list, ++ order, 0)) ++ pr_err("List of P2M frame lists is not contiguous, %s will not work", ++ is_initial_xendomain() ++ ? "kdump" : "save/restore"); ++ memset(pfn_to_mfn_frame_list_list, 0, size); ++ } + size -= sizeof(unsigned long); + if (__alloc_bootmem) + pfn_to_mfn_frame_list = alloc_bootmem(size); @@ -156,7 +162,7 @@ References: bnc#482614, bnc#537435, bnc#700856 #endif /* -@@ -1139,6 +1184,9 @@ void __init setup_arch(char **cmdline_p) +@@ -1139,6 +1190,9 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_XEN #ifdef CONFIG_KEXEC xen_machine_kexec_setup_resources(); @@ -166,7 +172,7 @@ References: bnc#482614, bnc#537435, bnc#700856 #endif p2m_pages = max_pfn; if (xen_start_info->nr_pages > max_pfn) { -@@ -1166,45 +1214,20 @@ void __init setup_arch(char **cmdline_p) +@@ -1166,45 +1220,20 @@ void __init setup_arch(char **cmdline_p) p2m_pages = xen_start_info->nr_pages; if (!xen_feature(XENFEAT_auto_translated_physmap)) { diff --git a/patches.xen/xen-x86-per-cpu-vcpu-info b/patches.xen/xen-x86-per-cpu-vcpu-info index c5ba06cb93..2070b7e9c0 100644 --- a/patches.xen/xen-x86-per-cpu-vcpu-info +++ b/patches.xen/xen-x86-per-cpu-vcpu-info @@ -5,35 +5,36 @@ Patch-mainline: obsolete ... reducing access code size and latency, as well as being the prerequisite for removing the limitation on 32 vCPU-s per guest. ---- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:49:46.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-04-13 15:59:11.000000000 +0200 -@@ -45,12 +45,26 @@ +--- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:46:55.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:49:26.000000000 +0200 +@@ -45,7 +45,16 @@ extern shared_info_t *HYPERVISOR_shared_info; -+#ifdef CONFIG_XEN_VCPU_INFO_PLACEMENT +-#ifdef CONFIG_XEN ++#if defined(CONFIG_XEN_VCPU_INFO_PLACEMENT) +DECLARE_PER_CPU(struct vcpu_info, vcpu_info); -+#define vcpu_info(cpu) (&per_cpu(vcpu_info, cpu)) -+#define current_vcpu_info() (&__get_cpu_var(vcpu_info)) -+#define vcpu_info_read(fld) percpu_read(vcpu_info.fld) -+#define vcpu_info_write(fld, val) percpu_write(vcpu_info.fld, val) -+#define vcpu_info_xchg(fld, val) percpu_xchg(vcpu_info.fld, val) ++# define vcpu_info(cpu) (&per_cpu(vcpu_info, cpu)) ++# define current_vcpu_info() (&__get_cpu_var(vcpu_info)) ++# define vcpu_info_read(fld) percpu_read(vcpu_info.fld) ++# define vcpu_info_write(fld, val) percpu_write(vcpu_info.fld, val) ++# define vcpu_info_xchg(fld, val) percpu_xchg(vcpu_info.fld, val) +void setup_vcpu_info(unsigned int cpu); +void adjust_boot_vcpu_info(void); -+#else - #define vcpu_info(cpu) (HYPERVISOR_shared_info->vcpu_info + (cpu)) - #ifdef CONFIG_SMP - #define current_vcpu_info() vcpu_info(smp_processor_id()) - #else - #define current_vcpu_info() vcpu_info(0) - #endif -+#define vcpu_info_read(fld) (current_vcpu_info()->fld) -+#define vcpu_info_write(fld, val) (current_vcpu_info()->fld = (val)) ++#elif defined(CONFIG_XEN) + # define vcpu_info(cpu) (HYPERVISOR_shared_info->vcpu_info + (cpu)) + # ifdef CONFIG_SMP + # include <asm/smp-processor-id.h> +@@ -53,6 +62,9 @@ extern shared_info_t *HYPERVISOR_shared_ + # else + # define current_vcpu_info() vcpu_info(0) + # endif ++# define vcpu_info_read(fld) (current_vcpu_info()->fld) ++# define vcpu_info_write(fld, val) (current_vcpu_info()->fld = (val)) +static inline void setup_vcpu_info(unsigned int cpu) {} -+#endif + #endif #ifdef CONFIG_X86_32 - extern unsigned long hypervisor_virt_start; --- head.orig/arch/x86/include/mach-xen/asm/irqflags.h 2011-09-09 15:53:54.000000000 +0200 +++ head/arch/x86/include/mach-xen/asm/irqflags.h 2011-02-03 14:42:15.000000000 +0100 @@ -14,7 +14,7 @@ @@ -179,7 +180,7 @@ prerequisite for removing the limitation on 32 vCPU-s per guest. static inline unsigned long xen_read_cr3(void) { ---- head.orig/arch/x86/kernel/cpu/common-xen.c 2012-04-11 13:26:23.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/common-xen.c 2012-05-08 11:16:29.000000000 +0200 +++ head/arch/x86/kernel/cpu/common-xen.c 2012-04-11 17:13:36.000000000 +0200 @@ -368,8 +368,16 @@ static const char *__cpuinit table_looku __u32 cpu_caps_cleared[NCAPINTS] __cpuinitdata; diff --git a/patches.xen/xen-x86-pmd-handling b/patches.xen/xen-x86-pmd-handling index cc656c16cc..32fdd9d01e 100644 --- a/patches.xen/xen-x86-pmd-handling +++ b/patches.xen/xen-x86-pmd-handling @@ -2,9 +2,9 @@ From: jbeulich@novell.com Subject: consolidate pmd/pud/pgd entry handling Patch-mainline: obsolete ---- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:33:17.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:49:34.000000000 +0100 -@@ -95,10 +95,12 @@ void xen_invlpg(unsigned long ptr); +--- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:22:53.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:46:47.000000000 +0200 +@@ -98,10 +98,12 @@ void xen_invlpg(unsigned long ptr); void xen_l1_entry_update(pte_t *ptr, pte_t val); void xen_l2_entry_update(pmd_t *ptr, pmd_t val); void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ @@ -18,7 +18,7 @@ Patch-mainline: obsolete void xen_set_ldt(const void *ptr, unsigned int ents); #ifdef CONFIG_SMP -@@ -333,6 +335,18 @@ MULTI_update_va_mapping( +@@ -336,6 +338,18 @@ MULTI_update_va_mapping( } static inline void diff --git a/patches.xen/xen-x86_64-note-init-p2m b/patches.xen/xen-x86_64-note-init-p2m index 15fa85115b..f0d6ba447e 100644 --- a/patches.xen/xen-x86_64-note-init-p2m +++ b/patches.xen/xen-x86_64-note-init-p2m @@ -51,9 +51,9 @@ when the functions are used before the page fault handler gets set up. ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "writable_page_tables"; .ascii "|writable_descriptor_tables"; .ascii "|auto_translated_physmap"; ---- head.orig/arch/x86/kernel/setup-xen.c 2012-04-11 17:14:37.000000000 +0200 -+++ head/arch/x86/kernel/setup-xen.c 2012-05-08 11:20:56.000000000 +0200 -@@ -1106,6 +1106,54 @@ void __init setup_arch(char **cmdline_p) +--- head.orig/arch/x86/kernel/setup-xen.c 2012-05-23 13:48:26.000000000 +0200 ++++ head/arch/x86/kernel/setup-xen.c 2012-05-23 13:48:34.000000000 +0200 +@@ -1112,6 +1112,54 @@ void __init setup_arch(char **cmdline_p) init_gbpages(); /* max_pfn_mapped is updated here */ @@ -108,7 +108,7 @@ when the functions are used before the page fault handler gets set up. max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT); max_pfn_mapped = max_low_pfn_mapped; -@@ -1113,6 +1161,7 @@ void __init setup_arch(char **cmdline_p) +@@ -1119,6 +1167,7 @@ void __init setup_arch(char **cmdline_p) if (max_pfn > max_low_pfn) { max_pfn_mapped = init_memory_mapping(1UL<<32, max_pfn<<PAGE_SHIFT); @@ -116,7 +116,7 @@ when the functions are used before the page fault handler gets set up. /* can we preseve max_low_pfn ?*/ max_low_pfn = max_pfn; } -@@ -1207,7 +1256,7 @@ void __init setup_arch(char **cmdline_p) +@@ -1213,7 +1262,7 @@ void __init setup_arch(char **cmdline_p) difference = xen_start_info->nr_pages - max_pfn; set_xen_guest_handle(reservation.extent_start, @@ -125,7 +125,7 @@ when the functions are used before the page fault handler gets set up. reservation.nr_extents = difference; ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); -@@ -1220,13 +1269,83 @@ void __init setup_arch(char **cmdline_p) +@@ -1226,13 +1275,83 @@ void __init setup_arch(char **cmdline_p) phys_to_machine_mapping = alloc_bootmem_pages( max_pfn * sizeof(unsigned long)); memcpy(phys_to_machine_mapping, diff --git a/patches.xen/xen-x86_64-pgd-alloc-order b/patches.xen/xen-x86_64-pgd-alloc-order index b7e9c6a337..cc561f2d4c 100644 --- a/patches.xen/xen-x86_64-pgd-alloc-order +++ b/patches.xen/xen-x86_64-pgd-alloc-order @@ -4,9 +4,9 @@ Patch-mainline: n/a At the same time remove the useless user mode pair of init_level4_pgt. ---- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:51:55.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:52:05.000000000 +0100 -@@ -100,8 +100,8 @@ void do_hypervisor_callback(struct pt_re +--- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:24:16.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:50:57.000000000 +0200 +@@ -101,8 +101,8 @@ void do_hypervisor_callback(struct pt_re * be MACHINE addresses. */ @@ -17,7 +17,7 @@ At the same time remove the useless user mode pair of init_level4_pgt. void xen_load_gs(unsigned int selector); /* x86_64 only */ void xen_tlb_flush(void); void xen_invlpg(unsigned long ptr); -@@ -109,7 +109,7 @@ void xen_invlpg(unsigned long ptr); +@@ -110,7 +110,7 @@ void xen_invlpg(unsigned long ptr); void xen_l1_entry_update(pte_t *ptr, pte_t val); void xen_l2_entry_update(pmd_t *ptr, pmd_t val); void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ diff --git a/patches.xen/xen-x86_64-pgd-pin b/patches.xen/xen-x86_64-pgd-pin index f7d5d6122c..58e3543b29 100644 --- a/patches.xen/xen-x86_64-pgd-pin +++ b/patches.xen/xen-x86_64-pgd-pin @@ -2,9 +2,9 @@ From: jbeulich@novell.com Subject: make pinning of pgd pairs transparent to callers Patch-mainline: obsolete ---- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:50:58.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2011-12-23 11:51:55.000000000 +0100 -@@ -110,8 +110,8 @@ void xen_l1_entry_update(pte_t *ptr, pte +--- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:23:52.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2012-05-11 16:24:16.000000000 +0200 +@@ -111,8 +111,8 @@ void xen_l1_entry_update(pte_t *ptr, pte void xen_l2_entry_update(pmd_t *ptr, pmd_t val); void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */ void xen_l4_entry_update(pgd_t *ptr, int user, pgd_t val); /* x86_64 only */ diff --git a/patches.xen/xen-x86_64-unmapped-initrd b/patches.xen/xen-x86_64-unmapped-initrd index d8954a5aaf..de27dafde7 100644 --- a/patches.xen/xen-x86_64-unmapped-initrd +++ b/patches.xen/xen-x86_64-unmapped-initrd @@ -84,9 +84,9 @@ Xen to avoid the mapping and hence the restriction. ELFNOTE(Xen, XEN_ELFNOTE_INIT_P2M, .quad VMEMMAP_START) ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "writable_page_tables"; .ascii "|writable_descriptor_tables"; ---- head.orig/arch/x86/kernel/setup-xen.c 2012-04-11 18:04:09.000000000 +0200 -+++ head/arch/x86/kernel/setup-xen.c 2012-04-11 18:05:24.000000000 +0200 -@@ -460,7 +460,7 @@ static void __init relocate_initrd(void) +--- head.orig/arch/x86/kernel/setup-xen.c 2012-05-23 13:48:34.000000000 +0200 ++++ head/arch/x86/kernel/setup-xen.c 2012-05-23 13:48:38.000000000 +0200 +@@ -466,7 +466,7 @@ static void __init relocate_initrd(void) #else printk(KERN_ERR "initrd extends beyond end of memory " "(0x%08lx > 0x%08lx)\ndisabling initrd\n", @@ -95,7 +95,7 @@ Xen to avoid the mapping and hence the restriction. max_low_pfn_mapped << PAGE_SHIFT); initrd_start = 0; #endif -@@ -479,7 +479,7 @@ static void __init reserve_initrd(void) +@@ -485,7 +485,7 @@ static void __init reserve_initrd(void) !ramdisk_image || !ramdisk_size) return; /* No initrd provided by bootloader */ #else diff --git a/patches.xen/xen3-auto-arch-i386.diff b/patches.xen/xen3-auto-arch-i386.diff index aabc8ffdc0..a83455cf3e 100644 --- a/patches.xen/xen3-auto-arch-i386.diff +++ b/patches.xen/xen3-auto-arch-i386.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 arch-i386 From: xen-devel@lists.xen.org Patch-mainline: n/a diff --git a/patches.xen/xen3-auto-arch-x86.diff b/patches.xen/xen3-auto-arch-x86.diff index 345a682996..15c1e24f99 100644 --- a/patches.xen/xen3-auto-arch-x86.diff +++ b/patches.xen/xen3-auto-arch-x86.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 arch-x86 From: xen-devel@lists.xen.org Patch-mainline: n/a @@ -10,8 +10,8 @@ take the forward porting patches: 2.6.26/arch/x86/kernel/crash.c 2.6.30/arch/x86/kernel/acpi/boot.c ---- head.orig/arch/x86/Makefile 2012-04-10 14:24:56.000000000 +0200 -+++ head/arch/x86/Makefile 2012-04-10 15:44:36.000000000 +0200 +--- head.orig/arch/x86/Makefile 2012-05-23 12:40:44.000000000 +0200 ++++ head/arch/x86/Makefile 2012-05-23 12:53:17.000000000 +0200 @@ -133,6 +133,10 @@ endif KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) KBUILD_CFLAGS += $(call cc-option,-mno-avx,) @@ -23,7 +23,7 @@ take the forward porting patches: KBUILD_CFLAGS += $(mflags-y) KBUILD_AFLAGS += $(mflags-y) -@@ -174,9 +178,26 @@ boot := arch/x86/boot +@@ -177,9 +181,26 @@ boot := arch/x86/boot BOOT_TARGETS = bzlilo bzdisk fdimage fdimage144 fdimage288 isoimage @@ -51,7 +51,7 @@ take the forward porting patches: all: bzImage # KBUILD_IMAGE specify target image being built -@@ -192,6 +213,7 @@ endif +@@ -195,6 +216,7 @@ endif $(BOOT_TARGETS): vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ @@ -59,7 +59,7 @@ take the forward porting patches: PHONY += install install: ---- head.orig/arch/x86/boot/Makefile 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/boot/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/boot/Makefile 2012-04-10 15:44:43.000000000 +0200 @@ -17,6 +17,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA @@ -84,7 +84,7 @@ take the forward porting patches: install: sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(obj)/bzImage \ System.map "$(INSTALL_PATH)" ---- head.orig/arch/x86/kernel/Makefile 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/kernel/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/Makefile 2012-04-10 15:44:48.000000000 +0200 @@ -102,9 +102,12 @@ obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o @@ -110,7 +110,7 @@ take the forward porting patches: + +disabled-obj-$(CONFIG_XEN) := i8237.o i8259_$(BITS).o reboot.o smpboot_$(BITS).o +%/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := ---- head.orig/arch/x86/kernel/acpi/Makefile 2010-02-24 19:52:17.000000000 +0100 +--- head.orig/arch/x86/kernel/acpi/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/acpi/Makefile 2011-04-13 11:31:41.000000000 +0200 @@ -5,6 +5,9 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wake @@ -127,7 +127,7 @@ take the forward porting patches: $(Q)$(MAKE) $(build)=$(obj)/realmode +disabled-obj-$(CONFIG_XEN) := cstate.o wakeup_$(BITS).o ---- head.orig/arch/x86/kernel/cpu/mcheck/Makefile 2010-08-02 00:11:14.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/mcheck/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/mcheck/Makefile 2011-04-13 11:31:41.000000000 +0200 @@ -3,6 +3,7 @@ obj-y = mce.o mce-severity.o obj-$(CONFIG_X86_ANCIENT_MCE) += winchip.o p5.o @@ -137,9 +137,9 @@ take the forward porting patches: obj-$(CONFIG_X86_MCE_THRESHOLD) += threshold.o obj-$(CONFIG_X86_MCE_INJECT) += mce-inject.o ---- head.orig/arch/x86/kernel/cpu/mcheck/mce.c 2012-04-10 14:24:22.000000000 +0200 -+++ head/arch/x86/kernel/cpu/mcheck/mce.c 2012-04-10 15:45:12.000000000 +0200 -@@ -1228,8 +1228,15 @@ void mce_log_therm_throt_event(__u64 sta +--- head.orig/arch/x86/kernel/cpu/mcheck/mce.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/arch/x86/kernel/cpu/mcheck/mce.c 2012-05-23 12:53:26.000000000 +0200 +@@ -1236,8 +1236,15 @@ void mce_log_therm_throt_event(__u64 sta * Periodic polling timer for "silent" machine check errors. If the * poller finds an MCE, poll 2x faster. When the poller finds no more * errors, poll 2x slower (up to check_interval seconds). @@ -155,7 +155,7 @@ take the forward porting patches: static DEFINE_PER_CPU(int, mce_next_interval); /* in jiffies */ static DEFINE_PER_CPU(struct timer_list, mce_timer); -@@ -1402,6 +1409,7 @@ static int __cpuinit __mcheck_cpu_apply_ +@@ -1410,6 +1417,7 @@ static int __cpuinit __mcheck_cpu_apply_ /* This should be disabled by the BIOS, but isn't always */ if (c->x86_vendor == X86_VENDOR_AMD) { @@ -163,7 +163,7 @@ take the forward porting patches: if (c->x86 == 15 && banks > 4) { /* * disable GART TBL walk error reporting, which -@@ -1410,6 +1418,7 @@ static int __cpuinit __mcheck_cpu_apply_ +@@ -1418,6 +1426,7 @@ static int __cpuinit __mcheck_cpu_apply_ */ clear_bit(10, (unsigned long *)&mce_banks[4].ctl); } @@ -171,7 +171,7 @@ take the forward porting patches: if (c->x86 <= 17 && mce_bootlog < 0) { /* * Lots of broken BIOS around that don't clear them -@@ -1482,6 +1491,7 @@ static int __cpuinit __mcheck_cpu_ancien +@@ -1490,6 +1499,7 @@ static int __cpuinit __mcheck_cpu_ancien static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) { @@ -179,7 +179,7 @@ take the forward porting patches: switch (c->x86_vendor) { case X86_VENDOR_INTEL: mce_intel_feature_init(c); -@@ -1492,6 +1502,7 @@ static void __mcheck_cpu_init_vendor(str +@@ -1500,6 +1510,7 @@ static void __mcheck_cpu_init_vendor(str default: break; } @@ -187,7 +187,7 @@ take the forward porting patches: } static void __mcheck_cpu_init_timer(void) -@@ -2280,6 +2291,16 @@ static __init int mcheck_init_device(voi +@@ -2288,6 +2299,16 @@ static __init int mcheck_init_device(voi /* register character device /dev/mcelog */ misc_register(&mce_chrdev_device); @@ -204,14 +204,14 @@ take the forward porting patches: return err; } device_initcall(mcheck_init_device); ---- head.orig/arch/x86/kernel/cpu/mtrr/Makefile 2010-05-16 23:17:36.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/mtrr/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/mtrr/Makefile 2011-04-13 11:31:41.000000000 +0200 @@ -1,3 +1,4 @@ obj-y := main.o if.o generic.o cleanup.o obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o +obj-$(CONFIG_XEN) := main.o if.o ---- head.orig/arch/x86/lib/Makefile 2011-10-24 09:10:05.000000000 +0200 +--- head.orig/arch/x86/lib/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/lib/Makefile 2011-09-07 14:42:45.000000000 +0200 @@ -45,3 +45,5 @@ else lib-y += copy_user_64.o copy_user_nocache_64.o @@ -219,7 +219,7 @@ take the forward porting patches: endif + +lib-$(CONFIG_XEN_SCRUB_PAGES) += scrub.o ---- head.orig/arch/x86/mm/Makefile 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/arch/x86/mm/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/mm/Makefile 2012-02-08 10:55:41.000000000 +0100 @@ -27,4 +27,6 @@ obj-$(CONFIG_AMD_NUMA) += amdtopology.o obj-$(CONFIG_ACPI_NUMA) += srat.o @@ -228,7 +228,7 @@ take the forward porting patches: +obj-$(CONFIG_XEN) += hypervisor.o + obj-$(CONFIG_MEMTEST) += memtest.o ---- head.orig/arch/x86/oprofile/Makefile 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/arch/x86/oprofile/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/oprofile/Makefile 2012-02-08 10:55:35.000000000 +0100 @@ -6,6 +6,13 @@ DRIVER_OBJS = $(addprefix ../../../drive oprofilefs.o oprofile_stats.o \ @@ -244,7 +244,7 @@ take the forward porting patches: oprofile-$(CONFIG_X86_LOCAL_APIC) += nmi_int.o op_model_amd.o \ op_model_ppro.o op_model_p4.o +endif ---- head.orig/arch/x86/pci/Makefile 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/arch/x86/pci/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/pci/Makefile 2011-04-13 11:31:41.000000000 +0200 @@ -5,6 +5,9 @@ obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$ obj-$(CONFIG_PCI_DIRECT) += direct.o @@ -256,7 +256,7 @@ take the forward porting patches: obj-y += fixup.o obj-$(CONFIG_X86_INTEL_CE) += ce4100.o ---- head.orig/arch/x86/power/cpu.c 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/power/cpu.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/power/cpu.c 2012-04-10 15:45:23.000000000 +0200 @@ -131,6 +131,7 @@ static void do_fpu_end(void) @@ -277,7 +277,7 @@ take the forward porting patches: syscall_init(); /* This sets MSR_*STAR and related */ #endif load_TR_desc(); /* This does ltr */ ---- head.orig/arch/x86/include/asm/acpi.h 2011-07-22 04:17:23.000000000 +0200 +--- head.orig/arch/x86/include/asm/acpi.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/acpi.h 2011-06-30 15:41:07.000000000 +0200 @@ -31,6 +31,10 @@ #include <asm/mpspec.h> @@ -328,7 +328,7 @@ take the forward porting patches: #ifdef CONFIG_ACPI_NUMA extern int acpi_numa; ---- head.orig/arch/x86/include/asm/apic.h 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/include/asm/apic.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/apic.h 2012-04-10 15:45:45.000000000 +0200 @@ -13,7 +13,9 @@ #include <asm/mpspec.h> @@ -340,7 +340,7 @@ take the forward porting patches: /* * Debugging macros ---- head.orig/arch/x86/include/asm/kexec.h 2009-06-10 05:05:27.000000000 +0200 +--- head.orig/arch/x86/include/asm/kexec.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/kexec.h 2011-04-13 11:31:41.000000000 +0200 @@ -163,6 +163,19 @@ struct kimage_arch { }; @@ -362,7 +362,7 @@ take the forward porting patches: #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_KEXEC_H */ ---- head.orig/arch/x86/include/asm/topology.h 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/arch/x86/include/asm/topology.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/topology.h 2011-04-13 11:31:41.000000000 +0200 @@ -30,7 +30,7 @@ # define ENABLE_TOPO_DEFINES @@ -373,7 +373,7 @@ take the forward porting patches: # define ENABLE_TOPO_DEFINES # endif #endif ---- head.orig/arch/x86/vdso/Makefile 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/vdso/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/vdso/Makefile 2012-04-10 15:45:54.000000000 +0200 @@ -123,6 +123,8 @@ obj-$(VDSO32-y) += vdso32-syms.lds vdso32.so-$(VDSO32-y) += int80 @@ -384,7 +384,7 @@ take the forward porting patches: vdso32-images = $(vdso32.so-y:%=vdso32-%.so) ---- head.orig/arch/x86/vdso/vdso32-setup.c 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/vdso/vdso32-setup.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/vdso/vdso32-setup.c 2011-04-13 11:31:41.000000000 +0200 @@ -26,6 +26,10 @@ #include <asm/vdso.h> diff --git a/patches.xen/xen3-auto-arch-x86_64.diff b/patches.xen/xen3-auto-arch-x86_64.diff index 0bef9ea24b..2034fc57c9 100644 --- a/patches.xen/xen3-auto-arch-x86_64.diff +++ b/patches.xen/xen3-auto-arch-x86_64.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 arch-x86_64 From: xen-devel@lists.xen.org Patch-mainline: n/a diff --git a/patches.xen/xen3-auto-common.diff b/patches.xen/xen3-auto-common.diff index a720927dcd..48c61a6b4c 100644 --- a/patches.xen/xen3-auto-common.diff +++ b/patches.xen/xen3-auto-common.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 common From: xen-devel@lists.xen.org Patch-mainline: n/a @@ -21,60 +21,8 @@ take the forward porting patches: 2.6.35/kernel/time.c 3.4/drivers/acpi/acpica/hwsleep.c ---- - drivers/Makefile | 1 - drivers/acpi/Makefile | 3 - drivers/acpi/processor_driver.c | 116 +++++- - drivers/acpi/processor_extcntl.c | 241 ++++++++++++ - drivers/acpi/processor_idle.c | 16 - drivers/acpi/processor_perflib.c | 21 + - drivers/acpi/sleep.c | 2 - drivers/block/floppy.c | 2 - drivers/char/agp/intel-gtt.c | 14 - drivers/char/mem.c | 16 - drivers/char/tpm/Makefile | 2 - drivers/char/tpm/tpm.h | 15 - drivers/char/tpm/tpm_vtpm.c | 542 ++++++++++++++++++++++++++++ - drivers/char/tpm/tpm_vtpm.h | 55 ++ - drivers/char/tpm/tpm_xen.c | 718 ++++++++++++++++++++++++++++++++++++++ - drivers/edac/edac_mc.c | 4 - drivers/firmware/dell_rbu.c | 46 ++ - drivers/ide/ide-lib.c | 8 - drivers/oprofile/buffer_sync.c | 88 ++++ - drivers/oprofile/cpu_buffer.c | 58 ++- - drivers/oprofile/cpu_buffer.h | 12 - drivers/oprofile/event_buffer.h | 3 - drivers/oprofile/oprof.c | 32 + - drivers/oprofile/oprof.h | 3 - drivers/oprofile/oprofile_files.c | 142 +++++++ - fs/aio.c | 117 +++++- - fs/compat_ioctl.c | 20 + - include/acpi/processor.h | 137 +++++++ - include/asm-generic/pgtable.h | 4 - include/linux/aio.h | 6 - include/linux/highmem.h | 6 - include/linux/interrupt.h | 5 - include/linux/kexec.h | 13 - include/linux/mm.h | 20 + - include/linux/oprofile.h | 18 - include/linux/page-flags.h | 36 + - include/linux/pci.h | 4 - include/linux/vermagic.h | 7 - kernel/irq/spurious.c | 2 - kernel/kexec.c | 68 ++- - kernel/sysctl.c | 2 - mm/memory.c | 40 ++ - mm/mmap.c | 10 - mm/mprotect.c | 2 - mm/page_alloc.c | 7 - scripts/Makefile.build | 15 - scripts/Makefile.lib | 6 - 47 files changed, 2627 insertions(+), 78 deletions(-) - -Index: linux-3.4-rc6-master/drivers/Makefile -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/Makefile -+++ linux-3.4-rc6-master/drivers/Makefile +--- head.orig/drivers/Makefile 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/Makefile 2011-11-16 17:01:23.000000000 +0100 @@ -47,6 +47,7 @@ obj-$(CONFIG_PARPORT) += parport/ obj-y += base/ block/ misc/ mfd/ nfc/ obj-$(CONFIG_NUBUS) += nubus/ @@ -83,10 +31,8 @@ Index: linux-3.4-rc6-master/drivers/Makefile obj-$(CONFIG_IDE) += ide/ obj-$(CONFIG_SCSI) += scsi/ obj-$(CONFIG_ATA) += ata/ -Index: linux-3.4-rc6-master/drivers/acpi/Makefile -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/acpi/Makefile -+++ linux-3.4-rc6-master/drivers/acpi/Makefile +--- head.orig/drivers/acpi/Makefile 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/acpi/Makefile 2012-04-10 15:41:46.000000000 +0200 @@ -68,6 +68,9 @@ obj-$(CONFIG_ACPI_BGRT) += bgrt.o processor-y := processor_driver.o processor_throttling.o processor-y += processor_idle.o processor_thermal.o @@ -97,10 +43,8 @@ Index: linux-3.4-rc6-master/drivers/acpi/Makefile obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o obj-$(CONFIG_ACPI_IPMI) += acpi_ipmi.o -Index: linux-3.4-rc6-master/drivers/acpi/processor_driver.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/acpi/processor_driver.c -+++ linux-3.4-rc6-master/drivers/acpi/processor_driver.c +--- head.orig/drivers/acpi/processor_driver.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/acpi/processor_driver.c 2012-05-23 12:52:45.000000000 +0200 @@ -324,7 +324,8 @@ static int acpi_processor_get_info(struc * they are physically not present. */ @@ -231,7 +175,7 @@ Index: linux-3.4-rc6-master/drivers/acpi/processor_driver.c free_cpumask_var(pr->throttling.shared_cpu_map); err_free_pr: kfree(pr); -@@ -616,7 +668,7 @@ static int acpi_processor_remove(struct +@@ -616,7 +668,7 @@ static int acpi_processor_remove(struct pr = acpi_driver_data(device); @@ -240,7 +184,7 @@ Index: linux-3.4-rc6-master/drivers/acpi/processor_driver.c goto free; if (type == ACPI_BUS_REMOVAL_EJECT) { -@@ -635,8 +687,16 @@ static int acpi_processor_remove(struct +@@ -635,8 +687,16 @@ static int acpi_processor_remove(struct pr->cdev = NULL; } @@ -332,10 +276,8 @@ Index: linux-3.4-rc6-master/drivers/acpi/processor_driver.c return; } -Index: linux-3.4-rc6-master/drivers/acpi/processor_extcntl.c -=================================================================== ---- /dev/null -+++ linux-3.4-rc6-master/drivers/acpi/processor_extcntl.c +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ head/drivers/acpi/processor_extcntl.c 2011-01-31 14:53:38.000000000 +0100 @@ -0,0 +1,241 @@ +/* + * processor_extcntl.c - channel to external control logic @@ -578,10 +520,8 @@ Index: linux-3.4-rc6-master/drivers/acpi/processor_extcntl.c + kfree(perf); + return ret; +} -Index: linux-3.4-rc6-master/drivers/acpi/processor_idle.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/acpi/processor_idle.c -+++ linux-3.4-rc6-master/drivers/acpi/processor_idle.c +--- head.orig/drivers/acpi/processor_idle.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/acpi/processor_idle.c 2011-11-16 17:01:10.000000000 +0100 @@ -449,7 +449,8 @@ static int acpi_processor_get_power_info */ cx.entry_method = ACPI_CSTATE_HALT; @@ -626,10 +566,8 @@ Index: linux-3.4-rc6-master/drivers/acpi/processor_idle.c return 0; } -Index: linux-3.4-rc6-master/drivers/acpi/processor_perflib.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/acpi/processor_perflib.c -+++ linux-3.4-rc6-master/drivers/acpi/processor_perflib.c +--- head.orig/drivers/acpi/processor_perflib.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/acpi/processor_perflib.c 2012-02-16 11:43:50.000000000 +0100 @@ -75,6 +75,7 @@ MODULE_PARM_DESC(ignore_ppc, "If the fre static int acpi_processor_ppc_status; @@ -709,10 +647,8 @@ Index: linux-3.4-rc6-master/drivers/acpi/processor_perflib.c { int result = 0; acpi_status status = AE_OK; -Index: linux-3.4-rc6-master/drivers/acpi/sleep.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/acpi/sleep.c -+++ linux-3.4-rc6-master/drivers/acpi/sleep.c +--- head.orig/drivers/acpi/sleep.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/acpi/sleep.c 2012-05-08 10:47:59.000000000 +0200 @@ -91,6 +91,7 @@ static struct notifier_block tts_notifie static int acpi_sleep_prepare(u32 acpi_state) { @@ -729,10 +665,8 @@ Index: linux-3.4-rc6-master/drivers/acpi/sleep.c ACPI_FLUSH_CPU_CACHE(); #endif printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n", -Index: linux-3.4-rc6-master/drivers/block/floppy.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/block/floppy.c -+++ linux-3.4-rc6-master/drivers/block/floppy.c +--- head.orig/drivers/block/floppy.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/block/floppy.c 2012-04-10 15:43:06.000000000 +0200 @@ -146,7 +146,9 @@ #undef FLOPPY_SILENT_DCL_CLEAR @@ -743,10 +677,8 @@ Index: linux-3.4-rc6-master/drivers/block/floppy.c #define DEBUGT 2 -Index: linux-3.4-rc6-master/drivers/char/agp/intel-gtt.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/char/agp/intel-gtt.c -+++ linux-3.4-rc6-master/drivers/char/agp/intel-gtt.c +--- head.orig/drivers/char/agp/intel-gtt.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/char/agp/intel-gtt.c 2012-04-10 15:43:16.000000000 +0200 @@ -146,8 +146,19 @@ static struct page *i8xx_alloc_pages(voi if (page == NULL) return NULL; @@ -777,10 +709,8 @@ Index: linux-3.4-rc6-master/drivers/char/agp/intel-gtt.c put_page(page); __free_pages(page, 2); atomic_dec(&agp_bridge->current_memory_agp); -Index: linux-3.4-rc6-master/drivers/char/mem.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/char/mem.c -+++ linux-3.4-rc6-master/drivers/char/mem.c +--- head.orig/drivers/char/mem.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/char/mem.c 2011-11-16 17:01:34.000000000 +0100 @@ -87,6 +87,7 @@ void __weak unxlate_dev_mem_ptr(unsigned { } @@ -807,7 +737,7 @@ Index: linux-3.4-rc6-master/drivers/char/mem.c /* Turn a kernel-virtual address into a physical page frame */ pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT; -@@ -349,6 +354,13 @@ static int mmap_kmem(struct file *file, +@@ -349,6 +354,13 @@ static int mmap_kmem(struct file *file, if (!pfn_valid(pfn)) return -EIO; @@ -839,20 +769,16 @@ Index: linux-3.4-rc6-master/drivers/char/mem.c #ifdef CONFIG_DEVKMEM static const struct file_operations kmem_fops = { -Index: linux-3.4-rc6-master/drivers/char/tpm/Makefile -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/char/tpm/Makefile -+++ linux-3.4-rc6-master/drivers/char/tpm/Makefile +--- head.orig/drivers/char/tpm/Makefile 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/char/tpm/Makefile 2011-04-13 11:25:29.000000000 +0200 @@ -9,3 +9,5 @@ obj-$(CONFIG_TCG_TIS) += tpm_tis.o obj-$(CONFIG_TCG_NSC) += tpm_nsc.o obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o +obj-$(CONFIG_TCG_XEN) += tpm_xenu.o +tpm_xenu-y = tpm_xen.o tpm_vtpm.o -Index: linux-3.4-rc6-master/drivers/char/tpm/tpm.h -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/char/tpm/tpm.h -+++ linux-3.4-rc6-master/drivers/char/tpm/tpm.h +--- head.orig/drivers/char/tpm/tpm.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/char/tpm/tpm.h 2012-04-10 15:43:23.000000000 +0200 @@ -122,6 +122,9 @@ struct tpm_chip { struct dentry **bios_dir; @@ -882,10 +808,8 @@ Index: linux-3.4-rc6-master/drivers/char/tpm/tpm.h extern int tpm_get_timeouts(struct tpm_chip *); extern void tpm_gen_interrupt(struct tpm_chip *); extern int tpm_do_selftest(struct tpm_chip *); -Index: linux-3.4-rc6-master/drivers/char/tpm/tpm_vtpm.c -=================================================================== ---- /dev/null -+++ linux-3.4-rc6-master/drivers/char/tpm/tpm_vtpm.c +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ head/drivers/char/tpm/tpm_vtpm.c 2011-01-31 14:53:38.000000000 +0100 @@ -0,0 +1,542 @@ +/* + * Copyright (C) 2006 IBM Corporation @@ -1429,10 +1353,8 @@ Index: linux-3.4-rc6-master/drivers/char/tpm/tpm_vtpm.c + tpm_remove_hardware(dev); + kfree(vtpms); +} -Index: linux-3.4-rc6-master/drivers/char/tpm/tpm_vtpm.h -=================================================================== ---- /dev/null -+++ linux-3.4-rc6-master/drivers/char/tpm/tpm_vtpm.h +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ head/drivers/char/tpm/tpm_vtpm.h 2011-01-31 14:53:38.000000000 +0100 @@ -0,0 +1,55 @@ +#ifndef TPM_VTPM_H +#define TPM_VTPM_H @@ -1489,10 +1411,8 @@ Index: linux-3.4-rc6-master/drivers/char/tpm/tpm_vtpm.h +} + +#endif -Index: linux-3.4-rc6-master/drivers/char/tpm/tpm_xen.c -=================================================================== ---- /dev/null -+++ linux-3.4-rc6-master/drivers/char/tpm/tpm_xen.c +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ head/drivers/char/tpm/tpm_xen.c 2012-03-12 12:51:05.000000000 +0100 @@ -0,0 +1,718 @@ +/* + * Copyright (c) 2005, IBM Corporation @@ -2212,10 +2132,8 @@ Index: linux-3.4-rc6-master/drivers/char/tpm/tpm_xen.c +module_init(tpmif_init); + +MODULE_LICENSE("Dual BSD/GPL"); -Index: linux-3.4-rc6-master/drivers/edac/edac_mc.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/edac/edac_mc.c -+++ linux-3.4-rc6-master/drivers/edac/edac_mc.c +--- head.orig/drivers/edac/edac_mc.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/edac/edac_mc.c 2012-02-08 10:51:42.000000000 +0100 @@ -610,6 +610,10 @@ static void edac_mc_scrub_block(unsigned debugf3("%s()\n", __func__); @@ -2227,10 +2145,8 @@ Index: linux-3.4-rc6-master/drivers/edac/edac_mc.c /* ECC error page was not in our memory. Ignore it. */ if (!pfn_valid(page)) return; -Index: linux-3.4-rc6-master/drivers/firmware/dell_rbu.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/firmware/dell_rbu.c -+++ linux-3.4-rc6-master/drivers/firmware/dell_rbu.c +--- head.orig/drivers/firmware/dell_rbu.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/firmware/dell_rbu.c 2011-04-13 11:25:29.000000000 +0200 @@ -170,9 +170,28 @@ static int create_packet(void *data, siz spin_lock(&rbu_data.lock); goto out_alloc_packet_array; @@ -2337,10 +2253,8 @@ Index: linux-3.4-rc6-master/drivers/firmware/dell_rbu.c spin_lock_init(&rbu_data.lock); init_packet_head(); -Index: linux-3.4-rc6-master/drivers/ide/ide-lib.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/ide/ide-lib.c -+++ linux-3.4-rc6-master/drivers/ide/ide-lib.c +--- head.orig/drivers/ide/ide-lib.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/ide/ide-lib.c 2011-11-16 17:01:48.000000000 +0100 @@ -19,12 +19,12 @@ void ide_toggle_bounce(ide_drive_t *driv { u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ @@ -2358,10 +2272,8 @@ Index: linux-3.4-rc6-master/drivers/ide/ide-lib.c addr = *dev->dma_mask; } -Index: linux-3.4-rc6-master/drivers/oprofile/buffer_sync.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/oprofile/buffer_sync.c -+++ linux-3.4-rc6-master/drivers/oprofile/buffer_sync.c +--- head.orig/drivers/oprofile/buffer_sync.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/oprofile/buffer_sync.c 2012-02-16 11:09:01.000000000 +0100 @@ -8,6 +8,10 @@ * @author Barry Kasindorf * @author Robert Richter <robert.richter@amd.com> @@ -2555,10 +2467,8 @@ Index: linux-3.4-rc6-master/drivers/oprofile/buffer_sync.c mark_done(cpu); mutex_unlock(&buffer_mutex); -Index: linux-3.4-rc6-master/drivers/oprofile/cpu_buffer.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/oprofile/cpu_buffer.c -+++ linux-3.4-rc6-master/drivers/oprofile/cpu_buffer.c +--- head.orig/drivers/oprofile/cpu_buffer.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/oprofile/cpu_buffer.c 2011-04-13 12:22:07.000000000 +0200 @@ -8,6 +8,10 @@ * @author Barry Kasindorf <barry.kasindorf@amd.com> * @author Robert Richter <robert.richter@amd.com> @@ -2592,7 +2502,7 @@ Index: linux-3.4-rc6-master/drivers/oprofile/cpu_buffer.c b->tracing = 0; b->buffer_size = buffer_size; b->sample_received = 0; -@@ -180,7 +190,7 @@ unsigned long op_cpu_buffer_entries(int +@@ -180,7 +190,7 @@ unsigned long op_cpu_buffer_entries(int static int op_add_code(struct oprofile_cpu_buffer *cpu_buf, unsigned long backtrace, @@ -2680,10 +2590,8 @@ Index: linux-3.4-rc6-master/drivers/oprofile/cpu_buffer.c /* * This serves to avoid cpu buffer overflow, and makes sure * the task mortuary progresses -Index: linux-3.4-rc6-master/drivers/oprofile/cpu_buffer.h -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/oprofile/cpu_buffer.h -+++ linux-3.4-rc6-master/drivers/oprofile/cpu_buffer.h +--- head.orig/drivers/oprofile/cpu_buffer.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/oprofile/cpu_buffer.h 2011-04-13 11:25:29.000000000 +0200 @@ -41,7 +41,7 @@ struct op_entry; struct oprofile_cpu_buffer { unsigned long buffer_size; @@ -2718,10 +2626,8 @@ Index: linux-3.4-rc6-master/drivers/oprofile/cpu_buffer.h +#define DOMAIN_SWITCH (1UL << 5) #endif /* OPROFILE_CPU_BUFFER_H */ -Index: linux-3.4-rc6-master/drivers/oprofile/event_buffer.h -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/oprofile/event_buffer.h -+++ linux-3.4-rc6-master/drivers/oprofile/event_buffer.h +--- head.orig/drivers/oprofile/event_buffer.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/oprofile/event_buffer.h 2011-04-13 11:25:29.000000000 +0200 @@ -30,6 +30,9 @@ void wake_up_buffer_waiter(void); #define INVALID_COOKIE ~0UL #define NO_COOKIE 0UL @@ -2732,10 +2638,8 @@ Index: linux-3.4-rc6-master/drivers/oprofile/event_buffer.h extern const struct file_operations event_buffer_fops; /* mutex between sync_cpu_buffers() and the -Index: linux-3.4-rc6-master/drivers/oprofile/oprof.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/oprofile/oprof.c -+++ linux-3.4-rc6-master/drivers/oprofile/oprof.c +--- head.orig/drivers/oprofile/oprof.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/oprofile/oprof.c 2011-01-31 17:01:49.000000000 +0100 @@ -5,6 +5,10 @@ * @remark Read the file COPYING * @@ -2782,10 +2686,8 @@ Index: linux-3.4-rc6-master/drivers/oprofile/oprof.c int oprofile_setup(void) { int err; -Index: linux-3.4-rc6-master/drivers/oprofile/oprof.h -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/oprofile/oprof.h -+++ linux-3.4-rc6-master/drivers/oprofile/oprof.h +--- head.orig/drivers/oprofile/oprof.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/oprofile/oprof.h 2012-02-08 10:51:51.000000000 +0100 @@ -48,4 +48,7 @@ static inline int op_nmi_timer_init(stru int oprofile_set_ulong(unsigned long *addr, unsigned long val); int oprofile_set_timeout(unsigned long time); @@ -2794,10 +2696,8 @@ Index: linux-3.4-rc6-master/drivers/oprofile/oprof.h +int oprofile_set_passive(int passive_domains[], unsigned int pdomains); + #endif /* OPROF_H */ -Index: linux-3.4-rc6-master/drivers/oprofile/oprofile_files.c -=================================================================== ---- linux-3.4-rc6-master.orig/drivers/oprofile/oprofile_files.c -+++ linux-3.4-rc6-master/drivers/oprofile/oprofile_files.c +--- head.orig/drivers/oprofile/oprofile_files.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/drivers/oprofile/oprofile_files.c 2012-02-16 11:09:01.000000000 +0100 @@ -5,11 +5,17 @@ * @remark Read the file COPYING * @@ -2966,10 +2866,8 @@ Index: linux-3.4-rc6-master/drivers/oprofile/oprofile_files.c oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops); oprofilefs_create_ulong(sb, root, "buffer_size", &oprofile_buffer_size); oprofilefs_create_ulong(sb, root, "buffer_watershed", &oprofile_buffer_watershed); -Index: linux-3.4-rc6-master/fs/aio.c -=================================================================== ---- linux-3.4-rc6-master.orig/fs/aio.c -+++ linux-3.4-rc6-master/fs/aio.c +--- head.orig/fs/aio.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/fs/aio.c 2012-05-08 10:48:08.000000000 +0200 @@ -39,6 +39,11 @@ #include <asm/kmap_types.h> #include <asm/uaccess.h> @@ -3155,10 +3053,8 @@ Index: linux-3.4-rc6-master/fs/aio.c io_destroy(ioctx); put_ioctx(ioctx); } -Index: linux-3.4-rc6-master/fs/compat_ioctl.c -=================================================================== ---- linux-3.4-rc6-master.orig/fs/compat_ioctl.c -+++ linux-3.4-rc6-master/fs/compat_ioctl.c +--- head.orig/fs/compat_ioctl.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/fs/compat_ioctl.c 2012-04-10 15:41:34.000000000 +0200 @@ -116,6 +116,13 @@ #include <asm/fbio.h> #endif @@ -3193,10 +3089,8 @@ Index: linux-3.4-rc6-master/fs/compat_ioctl.c }; /* -Index: linux-3.4-rc6-master/include/acpi/processor.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/acpi/processor.h -+++ linux-3.4-rc6-master/include/acpi/processor.h +--- head.orig/include/acpi/processor.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/acpi/processor.h 2012-05-23 12:53:00.000000000 +0200 @@ -42,6 +42,17 @@ struct acpi_processor_cx; @@ -3367,10 +3261,8 @@ Index: linux-3.4-rc6-master/include/acpi/processor.h +#endif /* CONFIG_XEN */ + #endif -Index: linux-3.4-rc6-master/include/asm-generic/pgtable.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/asm-generic/pgtable.h -+++ linux-3.4-rc6-master/include/asm-generic/pgtable.h +--- head.orig/include/asm-generic/pgtable.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/asm-generic/pgtable.h 2012-04-10 15:40:47.000000000 +0200 @@ -157,6 +157,10 @@ static inline void pmdp_set_wrprotect(st #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif @@ -3382,10 +3274,8 @@ Index: linux-3.4-rc6-master/include/asm-generic/pgtable.h #ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH extern pmd_t pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address, -Index: linux-3.4-rc6-master/include/linux/aio.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/aio.h -+++ linux-3.4-rc6-master/include/linux/aio.h +--- head.orig/include/linux/aio.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/aio.h 2011-11-16 17:02:20.000000000 +0100 @@ -200,6 +200,12 @@ struct kioctx { struct delayed_work wq; @@ -3399,10 +3289,8 @@ Index: linux-3.4-rc6-master/include/linux/aio.h struct rcu_head rcu_head; }; -Index: linux-3.4-rc6-master/include/linux/highmem.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/highmem.h -+++ linux-3.4-rc6-master/include/linux/highmem.h +--- head.orig/include/linux/highmem.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/highmem.h 2012-04-10 15:40:55.000000000 +0200 @@ -214,12 +214,14 @@ alloc_zeroed_user_highpage_movable(struc return __alloc_zeroed_user_highpage(__GFP_MOVABLE, vma, vaddr); } @@ -3427,17 +3315,15 @@ Index: linux-3.4-rc6-master/include/linux/highmem.h static inline void copy_highpage(struct page *to, struct page *from) { char *vfrom, *vto; -@@ -284,4 +288,6 @@ static inline void copy_highpage(struct +@@ -284,4 +288,6 @@ static inline void copy_highpage(struct kunmap_atomic(vfrom); } +#endif + #endif /* _LINUX_HIGHMEM_H */ -Index: linux-3.4-rc6-master/include/linux/interrupt.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/interrupt.h -+++ linux-3.4-rc6-master/include/linux/interrupt.h +--- head.orig/include/linux/interrupt.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/interrupt.h 2012-04-10 15:41:02.000000000 +0200 @@ -392,6 +392,11 @@ static inline int disable_irq_wake(unsig } #endif /* CONFIG_GENERIC_HARDIRQS */ @@ -3450,10 +3336,8 @@ Index: linux-3.4-rc6-master/include/linux/interrupt.h #ifdef CONFIG_IRQ_FORCED_THREADING extern bool force_irqthreads; -Index: linux-3.4-rc6-master/include/linux/kexec.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/kexec.h -+++ linux-3.4-rc6-master/include/linux/kexec.h +--- head.orig/include/linux/kexec.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/kexec.h 2012-02-08 10:52:29.000000000 +0100 @@ -56,6 +56,13 @@ KEXEC_CORE_NOTE_DESC_BYTES ) #endif @@ -3481,11 +3365,9 @@ Index: linux-3.4-rc6-master/include/linux/kexec.h extern asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, struct kexec_segment __user *segments, -Index: linux-3.4-rc6-master/include/linux/mm.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/mm.h -+++ linux-3.4-rc6-master/include/linux/mm.h -@@ -116,7 +116,12 @@ extern unsigned int kobjsize(const void +--- head.orig/include/linux/mm.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/mm.h 2012-04-10 15:41:09.000000000 +0200 +@@ -116,7 +116,12 @@ extern unsigned int kobjsize(const void #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ @@ -3498,7 +3380,7 @@ Index: linux-3.4-rc6-master/include/linux/mm.h #define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ #define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ -@@ -145,6 +150,12 @@ extern unsigned int kobjsize(const void +@@ -145,6 +150,12 @@ extern unsigned int kobjsize(const void */ #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) @@ -3527,10 +3409,8 @@ Index: linux-3.4-rc6-master/include/linux/mm.h #ifdef CONFIG_NUMA /* * set_policy() op must add a reference to any non-NULL @new mempolicy -Index: linux-3.4-rc6-master/include/linux/oprofile.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/oprofile.h -+++ linux-3.4-rc6-master/include/linux/oprofile.h +--- head.orig/include/linux/oprofile.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/oprofile.h 2011-09-07 15:19:35.000000000 +0200 @@ -19,6 +19,9 @@ #include <linux/errno.h> #include <linux/printk.h> @@ -3584,10 +3464,8 @@ Index: linux-3.4-rc6-master/include/linux/oprofile.h /** * Create a file of the given name as a child of the given root, with -Index: linux-3.4-rc6-master/include/linux/page-flags.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/page-flags.h -+++ linux-3.4-rc6-master/include/linux/page-flags.h +--- head.orig/include/linux/page-flags.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/page-flags.h 2012-04-10 15:41:11.000000000 +0200 @@ -108,6 +108,11 @@ enum pageflags { #ifdef CONFIG_TRANSPARENT_HUGEPAGE PG_compound_lock, @@ -3652,10 +3530,8 @@ Index: linux-3.4-rc6-master/include/linux/page-flags.h /* * Flags checked when a page is prepped for return by the page allocator. -Index: linux-3.4-rc6-master/include/linux/pci.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/pci.h -+++ linux-3.4-rc6-master/include/linux/pci.h +--- head.orig/include/linux/pci.h 2012-04-10 15:11:52.000000000 +0200 ++++ head/include/linux/pci.h 2012-04-10 15:41:17.000000000 +0200 @@ -1058,6 +1058,10 @@ extern void pci_disable_msix(struct pci_ extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); extern void pci_restore_msi_state(struct pci_dev *dev); @@ -3667,10 +3543,8 @@ Index: linux-3.4-rc6-master/include/linux/pci.h #endif #ifdef CONFIG_PCIEPORTBUS -Index: linux-3.4-rc6-master/include/linux/vermagic.h -=================================================================== ---- linux-3.4-rc6-master.orig/include/linux/vermagic.h -+++ linux-3.4-rc6-master/include/linux/vermagic.h +--- head.orig/include/linux/vermagic.h 2012-05-23 12:40:44.000000000 +0200 ++++ head/include/linux/vermagic.h 2011-11-16 17:02:46.000000000 +0100 @@ -21,6 +21,11 @@ #else #define MODULE_VERMAGIC_MODVERSIONS "" @@ -3690,10 +3564,8 @@ Index: linux-3.4-rc6-master/include/linux/vermagic.h - MODULE_ARCH_VERMAGIC + MODULE_VERMAGIC_XEN MODULE_ARCH_VERMAGIC -Index: linux-3.4-rc6-master/kernel/irq/spurious.c -=================================================================== ---- linux-3.4-rc6-master.orig/kernel/irq/spurious.c -+++ linux-3.4-rc6-master/kernel/irq/spurious.c +--- head.orig/kernel/irq/spurious.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/kernel/irq/spurious.c 2011-12-21 10:08:43.000000000 +0100 @@ -290,7 +290,7 @@ void note_interrupt(unsigned int irq, st */ if (time_after(jiffies, desc->last_unhandled + HZ/10)) @@ -3703,10 +3575,8 @@ Index: linux-3.4-rc6-master/kernel/irq/spurious.c desc->irqs_unhandled++; desc->last_unhandled = jiffies; } -Index: linux-3.4-rc6-master/kernel/kexec.c -=================================================================== ---- linux-3.4-rc6-master.orig/kernel/kexec.c -+++ linux-3.4-rc6-master/kernel/kexec.c +--- head.orig/kernel/kexec.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/kernel/kexec.c 2012-04-10 15:40:13.000000000 +0200 @@ -355,13 +355,26 @@ static int kimage_is_destination_range(s return 0; } @@ -3907,10 +3777,8 @@ Index: linux-3.4-rc6-master/kernel/kexec.c /* Install the new kernel, and Uninstall the old */ image = xchg(dest_image, image); -Index: linux-3.4-rc6-master/kernel/sysctl.c -=================================================================== ---- linux-3.4-rc6-master.orig/kernel/sysctl.c -+++ linux-3.4-rc6-master/kernel/sysctl.c +--- head.orig/kernel/sysctl.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/kernel/sysctl.c 2012-04-10 15:40:18.000000000 +0200 @@ -865,7 +865,7 @@ static struct ctl_table kern_table[] = { .proc_handler = proc_dointvec, }, @@ -3920,10 +3788,8 @@ Index: linux-3.4-rc6-master/kernel/sysctl.c { .procname = "acpi_video_flags", .data = &acpi_realmode_flags, -Index: linux-3.4-rc6-master/mm/memory.c -=================================================================== ---- linux-3.4-rc6-master.orig/mm/memory.c -+++ linux-3.4-rc6-master/mm/memory.c +--- head.orig/mm/memory.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/mm/memory.c 2012-04-10 15:39:45.000000000 +0200 @@ -779,6 +779,12 @@ struct page *vm_normal_page(struct vm_ar { unsigned long pfn = pte_pfn(pte); @@ -3970,7 +3836,7 @@ Index: linux-3.4-rc6-master/mm/memory.c /** * zap_page_range_single - remove user pages in a given range -@@ -1726,6 +1740,28 @@ int __get_user_pages(struct task_struct +@@ -1726,6 +1740,28 @@ int __get_user_pages(struct task_struct goto next_page; } @@ -3999,10 +3865,8 @@ Index: linux-3.4-rc6-master/mm/memory.c if (!vma || (vma->vm_flags & (VM_IO | VM_PFNMAP)) || !(vm_flags & vma->vm_flags)) -Index: linux-3.4-rc6-master/mm/mmap.c -=================================================================== ---- linux-3.4-rc6-master.orig/mm/mmap.c -+++ linux-3.4-rc6-master/mm/mmap.c +--- head.orig/mm/mmap.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/mm/mmap.c 2012-05-08 10:48:15.000000000 +0200 @@ -1924,6 +1924,12 @@ static void unmap_region(struct mm_struc tlb_finish_mmu(&tlb, start, end); } @@ -4034,10 +3898,8 @@ Index: linux-3.4-rc6-master/mm/mmap.c vma = mm->mmap; if (!vma) /* Can happen if dup_mmap() received an OOM */ return; -Index: linux-3.4-rc6-master/mm/mprotect.c -=================================================================== ---- linux-3.4-rc6-master.orig/mm/mprotect.c -+++ linux-3.4-rc6-master/mm/mprotect.c +--- head.orig/mm/mprotect.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/mm/mprotect.c 2011-06-30 15:38:52.000000000 +0200 @@ -97,6 +97,8 @@ static inline void change_pmd_range(stru } if (pmd_none_or_clear_bad(pmd)) @@ -4047,10 +3909,8 @@ Index: linux-3.4-rc6-master/mm/mprotect.c change_pte_range(vma->vm_mm, pmd, addr, next, newprot, dirty_accountable); } while (pmd++, addr = next, addr != end); -Index: linux-3.4-rc6-master/mm/page_alloc.c -=================================================================== ---- linux-3.4-rc6-master.orig/mm/page_alloc.c -+++ linux-3.4-rc6-master/mm/page_alloc.c +--- head.orig/mm/page_alloc.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/mm/page_alloc.c 2012-02-08 10:53:13.000000000 +0100 @@ -692,6 +692,13 @@ static bool free_pages_prepare(struct pa int i; int bad = 0; @@ -4065,10 +3925,8 @@ Index: linux-3.4-rc6-master/mm/page_alloc.c trace_mm_page_free(page, order); kmemcheck_free_shadow(page, order); -Index: linux-3.4-rc6-master/scripts/Makefile.build -=================================================================== ---- linux-3.4-rc6-master.orig/scripts/Makefile.build -+++ linux-3.4-rc6-master/scripts/Makefile.build +--- head.orig/scripts/Makefile.build 2012-05-23 12:40:44.000000000 +0200 ++++ head/scripts/Makefile.build 2011-06-30 15:39:08.000000000 +0200 @@ -128,6 +128,21 @@ ifndef obj $(warning kbuild: Makefile.build is included improperly) endif @@ -4091,10 +3949,8 @@ Index: linux-3.4-rc6-master/scripts/Makefile.build # =========================================================================== ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),) -Index: linux-3.4-rc6-master/scripts/Makefile.lib -=================================================================== ---- linux-3.4-rc6-master.orig/scripts/Makefile.lib -+++ linux-3.4-rc6-master/scripts/Makefile.lib +--- head.orig/scripts/Makefile.lib 2012-05-23 12:40:44.000000000 +0200 ++++ head/scripts/Makefile.lib 2012-04-10 15:40:06.000000000 +0200 @@ -22,6 +22,12 @@ obj-m := $(filter-out $(obj-y),$(obj-m)) lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) diff --git a/patches.xen/xen3-auto-include-xen-interface.diff b/patches.xen/xen3-auto-include-xen-interface.diff index 8ba5cacbeb..47f8e373d5 100644 --- a/patches.xen/xen3-auto-include-xen-interface.diff +++ b/patches.xen/xen3-auto-include-xen-interface.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 include-xen-interface From: xen-devel@lists.xen.org Patch-mainline: n/a diff --git a/patches.xen/xen3-auto-xen-arch.diff b/patches.xen/xen3-auto-xen-arch.diff index 7ca9885866..5b52d9ce7d 100644 --- a/patches.xen/xen3-auto-xen-arch.diff +++ b/patches.xen/xen3-auto-xen-arch.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 xen-arch From: xen-devel@lists.xen.org Patch-mainline: n/a diff --git a/patches.xen/xen3-auto-xen-drivers.diff b/patches.xen/xen3-auto-xen-drivers.diff index ff7cf47733..4fbb1d7011 100644 --- a/patches.xen/xen3-auto-xen-drivers.diff +++ b/patches.xen/xen3-auto-xen-drivers.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 xen-drivers From: xen-devel@lists.xen.org Patch-mainline: n/a @@ -4603,8 +4603,8 @@ and in case upstream wants to take the forward porting patches: + +xenblktap-y := xenbus.o interface.o blktap.o --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:19:49.000000000 +0100 -@@ -0,0 +1,1753 @@ ++++ head/drivers/xen/blktap/blktap.c 2012-05-14 08:37:24.000000000 +0200 +@@ -0,0 +1,1761 @@ +/****************************************************************************** + * drivers/xen/blktap/blktap.c + * @@ -4727,7 +4727,7 @@ and in case upstream wants to take the forward porting patches: + [req id, idx] tuple */ + blkif_t *blkif; /*Associate blkif with tapdev */ + struct domid_translate_ext trans; /*Translation from domid to bus. */ -+ struct vm_foreign_map foreign_map; /*Mapping page */ ++ struct vm_foreign_map *foreign_maps; /*Mapping pages */ +} tap_blkif_t; + +static struct tap_blkif *tapfds[MAX_TAP_DEV]; @@ -4936,7 +4936,7 @@ and in case upstream wants to take the forward porting patches: + + pg = idx_to_page(mmap_idx, pending_idx, seg); + ClearPageReserved(pg); -+ info->foreign_map.map[offset + RING_PAGES] = NULL; ++ info->foreign_maps->map[offset + RING_PAGES] = NULL; + + khandle = &pending_handle(mmap_idx, pending_idx, seg); + @@ -4984,12 +4984,17 @@ and in case upstream wants to take the forward porting patches: +static void blktap_vma_open(struct vm_area_struct *vma) +{ + tap_blkif_t *info; ++ unsigned long idx; ++ struct vm_foreign_map *foreign_map; ++ + if (vma->vm_file == NULL) + return; + + info = vma->vm_file->private_data; -+ vma->vm_private_data = -+ &info->foreign_map.map[(vma->vm_start - info->rings_vstart) >> PAGE_SHIFT]; ++ idx = (vma->vm_start - info->rings_vstart) >> PAGE_SHIFT; ++ foreign_map = &info->foreign_maps[idx]; ++ foreign_map->map = &info->foreign_maps->map[idx]; ++ vma->vm_private_data = foreign_map; +} + +/* tricky part @@ -4999,7 +5004,6 @@ and in case upstream wants to take the forward porting patches: + */ +static void blktap_vma_close(struct vm_area_struct *vma) +{ -+ tap_blkif_t *info; + struct vm_area_struct *next = vma->vm_next; + + if (next == NULL || @@ -5009,9 +5013,7 @@ and in case upstream wants to take the forward porting patches: + vma->vm_file != next->vm_file) + return; + -+ info = vma->vm_file->private_data; -+ next->vm_private_data = -+ &info->foreign_map.map[(next->vm_start - info->rings_vstart) >> PAGE_SHIFT]; ++ blktap_vma_open(next); +} + +static struct vm_operations_struct blktap_vm_ops = { @@ -5247,8 +5249,9 @@ and in case upstream wants to take the forward porting patches: + mm = xchg(&info->mm, NULL); + if (mm) + mmput(mm); -+ kfree(info->foreign_map.map); -+ info->foreign_map.map = NULL; ++ kfree(info->foreign_maps->map); ++ kfree(info->foreign_maps); ++ info->foreign_maps = NULL; + + /* Free the ring page. */ + ClearPageReserved(virt_to_page(info->ufe_ring.sring)); @@ -5337,14 +5340,19 @@ and in case upstream wants to take the forward porting patches: + } + + /* Mark this VM as containing foreign pages, and set up mappings. */ -+ info->foreign_map.map = kzalloc(((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) * -+ sizeof(*info->foreign_map.map), GFP_KERNEL); -+ if (info->foreign_map.map == NULL) { ++ info->foreign_maps = kcalloc(size, sizeof(*info->foreign_maps), ++ GFP_KERNEL); ++ if (info->foreign_maps) ++ info->foreign_maps->map = ++ kcalloc(size, sizeof(*info->foreign_maps->map), ++ GFP_KERNEL); ++ if (!info->foreign_maps || !info->foreign_maps->map) { ++ kfree(info->foreign_maps); + WPRINTK("Couldn't alloc VM_FOREIGN map.\n"); + goto fail; + } + -+ vma->vm_private_data = &info->foreign_map; ++ vma->vm_private_data = info->foreign_maps; + vma->vm_flags |= VM_FOREIGN; + vma->vm_flags |= VM_DONTCOPY; + @@ -5849,7 +5857,7 @@ and in case upstream wants to take the forward porting patches: + pg = idx_to_page(mmap_idx, pending_idx, j); + ClearPageReserved(pg); + offset = (uvaddr - info->rings_vstart) >> PAGE_SHIFT; -+ info->foreign_map.map[offset] = NULL; ++ info->foreign_maps->map[offset] = NULL; + } + fast_flush_area(pending_req, pending_idx, usr_idx, info); + make_response(blkif, pending_req->id, res.operation, @@ -6137,7 +6145,7 @@ and in case upstream wants to take the forward porting patches: + FOREIGN_FRAME(map[i].dev_bus_addr + >> PAGE_SHIFT)); + offset = (uvaddr - info->rings_vstart) >> PAGE_SHIFT; -+ info->foreign_map.map[offset] = pg; ++ info->foreign_maps->map[offset] = pg; + } + } else { + for (i = 0; i < nseg; i++) { @@ -6163,7 +6171,7 @@ and in case upstream wants to take the forward porting patches: + + offset = (uvaddr - info->rings_vstart) >> PAGE_SHIFT; + pg = idx_to_page(mmap_idx, pending_idx, i); -+ info->foreign_map.map[offset] = pg; ++ info->foreign_maps->map[offset] = pg; + } + } + @@ -12789,8 +12797,8 @@ and in case upstream wants to take the forward porting patches: +#endif +} --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/drivers/xen/core/gnttab.c 2012-03-12 12:51:05.000000000 +0100 -@@ -0,0 +1,858 @@ ++++ head/drivers/xen/core/gnttab.c 2012-05-14 08:37:24.000000000 +0200 +@@ -0,0 +1,862 @@ +/****************************************************************************** + * gnttab.c + * @@ -13598,7 +13606,7 @@ and in case upstream wants to take the forward porting patches: + +int __devinit gnttab_init(void) +{ -+ int i; ++ int i, ret; + unsigned int max_nr_glist_frames, nr_glist_frames; + unsigned int nr_init_grefs; + @@ -13621,12 +13629,16 @@ and in case upstream wants to take the forward porting patches: + nr_glist_frames = nr_freelist_frames(nr_grant_frames); + for (i = 0; i < nr_glist_frames; i++) { + gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); -+ if (gnttab_list[i] == NULL) ++ if (gnttab_list[i] == NULL) { ++ ret = -ENOMEM; + goto ini_nomem; ++ } + } + -+ if (gnttab_resume() < 0) -+ return -ENODEV; ++ if (gnttab_resume() < 0) { ++ ret = -ENODEV; ++ goto ini_nomem; ++ } + + nr_init_grefs = nr_grant_frames * ENTRIES_PER_GRANT_FRAME; + @@ -13643,7 +13655,7 @@ and in case upstream wants to take the forward porting patches: + for (i--; i >= 0; i--) + free_page((unsigned long)gnttab_list[i]); + kfree(gnttab_list); -+ return -ENOMEM; ++ return ret; +} + +#ifdef CONFIG_XEN @@ -16243,8 +16255,8 @@ and in case upstream wants to take the forward porting patches: @@ -0,0 +1 @@ +obj-$(CONFIG_XEN_GRANT_DEV) := gntdev.o --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 14:18:49.000000000 +0100 -@@ -0,0 +1,1008 @@ ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-14 08:37:24.000000000 +0200 +@@ -0,0 +1,978 @@ +/****************************************************************************** + * gntdev.c + * @@ -16323,7 +16335,6 @@ and in case upstream wants to take the forward porting patches: + grant_ref_t ref; + grant_handle_t kernel_handle; + grant_handle_t user_handle; -+ uint64_t dev_bus_addr; + } valid; + } u; +} gntdev_grant_info_t; @@ -16532,35 +16543,27 @@ and in case upstream wants to take the forward porting patches: +static int find_contiguous_free_range(gntdev_file_private_data_t *private_data, + uint32_t num_slots) +{ -+ uint32_t i, start_index = private_data->next_fit_index; -+ uint32_t range_start = 0, range_length; ++ /* First search from next_fit_index to the end of the array. */ ++ uint32_t start_index = private_data->next_fit_index; ++ uint32_t end_index = private_data->grants_size; + -+ /* First search from the start_index to the end of the array. */ -+ range_length = 0; -+ for (i = start_index; i < private_data->grants_size; ++i) { -+ if (private_data->grants[i].state == GNTDEV_SLOT_INVALID) { -+ if (range_length == 0) { -+ range_start = i; -+ } -+ ++range_length; -+ if (range_length == num_slots) { -+ return range_start; -+ } -+ } -+ } -+ -+ /* Now search from the start of the array to the start_index. */ -+ range_length = 0; -+ for (i = 0; i < start_index; ++i) { -+ if (private_data->grants[i].state == GNTDEV_SLOT_INVALID) { -+ if (range_length == 0) { -+ range_start = i; -+ } -+ ++range_length; -+ if (range_length == num_slots) { -+ return range_start; -+ } ++ for (;;) { ++ uint32_t i, range_start = 0, range_length = 0; ++ ++ for (i = start_index; i < end_index; ++i) { ++ if (private_data->grants[i].state == GNTDEV_SLOT_INVALID) { ++ if (range_length == 0) ++ range_start = i; ++ if (++range_length == num_slots) ++ return range_start; ++ } else ++ range_length = 0; + } ++ /* Now search from the start of the array to next_fit_index. */ ++ if (!start_index) ++ break; ++ end_index = start_index; ++ start_index = 0; + } + + return -ENOMEM; @@ -16698,14 +16701,15 @@ and in case upstream wants to take the forward porting patches: +{ + struct gnttab_map_grant_ref op; + unsigned long slot_index = vma->vm_pgoff; -+ unsigned long kernel_vaddr, user_vaddr; -+ uint32_t size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; ++ unsigned long kernel_vaddr, user_vaddr, mfn; ++ unsigned long size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + uint64_t ptep; + int ret, exit_ret; -+ int flags; -+ int i; ++ unsigned int i, flags; + struct page *page; + gntdev_file_private_data_t *private_data = flip->private_data; ++ gntdev_grant_info_t *grants; ++ struct vm_foreign_map *foreign_map; + + if (unlikely(!private_data)) { + printk(KERN_ERR "File's private data is NULL.\n"); @@ -16714,17 +16718,19 @@ and in case upstream wants to take the forward porting patches: + + /* Test to make sure that the grants array has been initialised. */ + down_read(&private_data->grants_sem); -+ if (unlikely(!private_data->grants)) { -+ up_read(&private_data->grants_sem); ++ grants = private_data->grants; ++ up_read(&private_data->grants_sem); ++ ++ if (unlikely(!grants)) { + printk(KERN_ERR "Attempted to mmap before ioctl.\n"); + return -EINVAL; + } -+ up_read(&private_data->grants_sem); ++ grants += slot_index; + -+ if (unlikely((size <= 0) || -+ (size + slot_index) > private_data->grants_size)) { ++ if (unlikely(size + slot_index <= slot_index || ++ size + slot_index > private_data->grants_size)) { + printk(KERN_ERR "Invalid number of pages or offset" -+ "(num_pages = %d, first_slot = %ld).\n", ++ "(num_pages = %lu, first_slot = %lu)\n", + size, slot_index); + return -ENXIO; + } @@ -16734,15 +16740,23 @@ and in case upstream wants to take the forward porting patches: + return -EINVAL; + } + ++ foreign_map = kmalloc(sizeof(*foreign_map), GFP_KERNEL); ++ if (!foreign_map) { ++ printk(KERN_ERR "Couldn't allocate mapping structure for VM " ++ "area.\n"); ++ return -ENOMEM; ++ } ++ foreign_map->map = &private_data->foreign_pages[slot_index]; ++ + /* Slots must be in the NOT_YET_MAPPED state. */ + down_write(&private_data->grants_sem); + for (i = 0; i < size; ++i) { -+ if (private_data->grants[slot_index + i].state != -+ GNTDEV_SLOT_NOT_YET_MAPPED) { -+ printk(KERN_ERR "Slot (index = %ld) is in the wrong " ++ if (grants[i].state != GNTDEV_SLOT_NOT_YET_MAPPED) { ++ printk(KERN_ERR "Slot (index = %lu) is in the wrong " + "state (%d).\n", slot_index + i, -+ private_data->grants[slot_index + i].state); ++ grants[i].state); + up_write(&private_data->grants_sem); ++ kfree(foreign_map); + return -EINVAL; + } + } @@ -16751,14 +16765,8 @@ and in case upstream wants to take the forward porting patches: + vma->vm_ops = &gntdev_vmops; + + /* The VM area contains pages from another VM. */ ++ vma->vm_private_data = foreign_map; + vma->vm_flags |= VM_FOREIGN; -+ vma->vm_private_data = kzalloc(size * sizeof(struct page *), -+ GFP_KERNEL); -+ if (vma->vm_private_data == NULL) { -+ printk(KERN_ERR "Couldn't allocate mapping structure for VM " -+ "area.\n"); -+ return -ENOMEM; -+ } + + /* This flag prevents Bad PTE errors when the memory is unmapped. */ + vma->vm_flags |= VM_RESERVED; @@ -16786,14 +16794,11 @@ and in case upstream wants to take the forward porting patches: + flags |= GNTMAP_readonly; + + kernel_vaddr = get_kernel_vaddr(private_data, slot_index + i); -+ user_vaddr = get_user_vaddr(vma, i); + page = private_data->foreign_pages[slot_index + i]; + + gnttab_set_map_op(&op, kernel_vaddr, flags, -+ private_data->grants[slot_index+i] -+ .u.valid.ref, -+ private_data->grants[slot_index+i] -+ .u.valid.domid); ++ grants[i].u.valid.ref, ++ grants[i].u.valid.domid); + + /* Carry out the mapping of the grant reference. */ + ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, @@ -16804,114 +16809,91 @@ and in case upstream wants to take the forward porting patches: + printk(KERN_ERR "Error mapping the grant reference " + "into the kernel (%d). domid = %d; ref = %d\n", + op.status, -+ private_data->grants[slot_index+i] -+ .u.valid.domid, -+ private_data->grants[slot_index+i] -+ .u.valid.ref); ++ grants[i].u.valid.domid, ++ grants[i].u.valid.ref); + else + /* Propagate eagain instead of trying to fix it up */ + exit_ret = -EAGAIN; + goto undo_map_out; + } + -+ /* Store a reference to the page that will be mapped into user -+ * space. -+ */ -+ ((struct page **) vma->vm_private_data)[i] = page; -+ + /* Mark mapped page as reserved. */ + SetPageReserved(page); + + /* Record the grant handle, for use in the unmap operation. */ -+ private_data->grants[slot_index+i].u.valid.kernel_handle = -+ op.handle; -+ private_data->grants[slot_index+i].u.valid.dev_bus_addr = -+ op.dev_bus_addr; ++ grants[i].u.valid.kernel_handle = op.handle; + -+ private_data->grants[slot_index+i].state = GNTDEV_SLOT_MAPPED; -+ private_data->grants[slot_index+i].u.valid.user_handle = -+ GNTDEV_INVALID_HANDLE; ++ grants[i].state = GNTDEV_SLOT_MAPPED; ++ grants[i].u.valid.user_handle = GNTDEV_INVALID_HANDLE; + + /* Now perform the mapping to user space. */ -+ if (!xen_feature(XENFEAT_auto_translated_physmap)) { -+ -+ /* NOT USING SHADOW PAGE TABLES. */ -+ /* In this case, we map the grant(s) straight into user -+ * space. -+ */ -+ -+ /* Get the machine address of the PTE for the user -+ * page. -+ */ -+ if ((ret = create_lookup_pte_addr(vma->vm_mm, -+ vma->vm_start -+ + (i << PAGE_SHIFT), -+ &ptep))) -+ { -+ printk(KERN_ERR "Error obtaining PTE pointer " -+ "(%d).\n", ret); -+ goto undo_map_out; -+ } -+ -+ /* Configure the map operation. */ -+ -+ /* The reference is to be used by host CPUs. */ -+ flags = GNTMAP_host_map; -+ -+ /* Specifies a user space mapping. */ -+ flags |= GNTMAP_application_map; -+ -+ /* The map request contains the machine address of the -+ * PTE to update. -+ */ -+ flags |= GNTMAP_contains_pte; -+ -+ if (!(vma->vm_flags & VM_WRITE)) -+ flags |= GNTMAP_readonly; -+ -+ gnttab_set_map_op(&op, ptep, flags, -+ private_data->grants[slot_index+i] -+ .u.valid.ref, -+ private_data->grants[slot_index+i] -+ .u.valid.domid); ++ user_vaddr = get_user_vaddr(vma, i); + -+ /* Carry out the mapping of the grant reference. */ -+ ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, -+ &op, 1); -+ BUG_ON(ret); -+ if (op.status != GNTST_okay) { -+ printk(KERN_ERR "Error mapping the grant " -+ "reference into user space (%d). domid " -+ "= %d; ref = %d\n", op.status, -+ private_data->grants[slot_index+i].u -+ .valid.domid, -+ private_data->grants[slot_index+i].u -+ .valid.ref); -+ /* This should never happen after we've mapped into -+ * the kernel space. */ -+ BUG_ON(op.status == GNTST_eagain); -+ goto undo_map_out; -+ } -+ -+ /* Record the grant handle, for use in the unmap -+ * operation. -+ */ -+ private_data->grants[slot_index+i].u. -+ valid.user_handle = op.handle; -+ -+ /* Update p2m structure with the new mapping. */ -+ set_phys_to_machine(__pa(kernel_vaddr) >> PAGE_SHIFT, -+ FOREIGN_FRAME(private_data-> -+ grants[slot_index+i] -+ .u.valid.dev_bus_addr -+ >> PAGE_SHIFT)); -+ } else { ++ if (xen_feature(XENFEAT_auto_translated_physmap)) { + /* USING SHADOW PAGE TABLES. */ + /* In this case, we simply insert the page into the VM + * area. */ + ret = vm_insert_page(vma, user_vaddr, page); ++ if (!ret) ++ continue; ++ exit_ret = ret; ++ goto undo_map_out; ++ } ++ ++ /* NOT USING SHADOW PAGE TABLES. */ ++ /* In this case, we map the grant(s) straight into user ++ * space. ++ */ ++ mfn = op.dev_bus_addr >> PAGE_SHIFT; ++ ++ /* Get the machine address of the PTE for the user page. */ ++ if ((ret = create_lookup_pte_addr(vma->vm_mm, ++ user_vaddr, ++ &ptep))) ++ { ++ printk(KERN_ERR "Error obtaining PTE pointer (%d)\n", ++ ret); ++ goto undo_map_out; + } + ++ /* Configure the map operation. */ ++ ++ /* Specifies a user space mapping. */ ++ flags |= GNTMAP_application_map; ++ ++ /* The map request contains the machine address of the ++ * PTE to update. ++ */ ++ flags |= GNTMAP_contains_pte; ++ ++ gnttab_set_map_op(&op, ptep, flags, ++ grants[i].u.valid.ref, ++ grants[i].u.valid.domid); ++ ++ /* Carry out the mapping of the grant reference. */ ++ ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, ++ &op, 1); ++ BUG_ON(ret); ++ if (op.status != GNTST_okay) { ++ printk(KERN_ERR "Error mapping the grant reference " ++ "into user space (%d). domid = %d; ref = %d\n", ++ op.status, ++ grants[i].u.valid.domid, ++ grants[i].u.valid.ref); ++ /* This should never happen after we've mapped into ++ * the kernel space. */ ++ BUG_ON(op.status == GNTST_eagain); ++ goto undo_map_out; ++ } ++ ++ /* Record the grant handle, for use in the unmap ++ * operation. ++ */ ++ grants[i].u.valid.user_handle = op.handle; ++ ++ /* Update p2m structure with the new mapping. */ ++ set_phys_to_machine(__pa(kernel_vaddr) >> PAGE_SHIFT, ++ FOREIGN_FRAME(mfn)); + } + exit_ret = 0; + @@ -16923,7 +16905,8 @@ and in case upstream wants to take the forward porting patches: + * by do_mmap_pgoff(), which will eventually call gntdev_clear_pte(). + * All we need to do here is free the vma_private_data. + */ -+ kfree(vma->vm_private_data); ++ vma->vm_flags &= ~VM_FOREIGN; ++ kfree(foreign_map); + + /* THIS IS VERY UNPLEASANT: do_mmap_pgoff() will set the vma->vm_file + * to NULL on failure. However, we need this in gntdev_clear_pte() to @@ -16940,9 +16923,11 @@ and in case upstream wants to take the forward porting patches: +static pte_t gntdev_clear_pte(struct vm_area_struct *vma, unsigned long addr, + pte_t *ptep, int is_fullmm) +{ -+ int slot_index, ret; ++ int ret; ++ unsigned int nr; ++ unsigned long slot_index; + pte_t copy; -+ struct gnttab_unmap_grant_ref op; ++ struct gnttab_unmap_grant_ref op[2]; + gntdev_file_private_data_t *private_data; + + /* THIS IS VERY UNPLEASANT: do_mmap_pgoff() will set the vma->vm_file @@ -16970,55 +16955,51 @@ and in case upstream wants to take the forward porting patches: + /* Only unmap grants if the slot has been mapped. This could be being + * called from a failing mmap(). + */ -+ if (private_data->grants[slot_index].state == GNTDEV_SLOT_MAPPED) { -+ -+ /* First, we clear the user space mapping, if it has been made. -+ */ -+ if (private_data->grants[slot_index].u.valid.user_handle != -+ GNTDEV_INVALID_HANDLE && -+ !xen_feature(XENFEAT_auto_translated_physmap)) { -+ /* NOT USING SHADOW PAGE TABLES. */ -+ gnttab_set_unmap_op(&op, ptep_to_machine(ptep), -+ GNTMAP_contains_pte, -+ private_data->grants[slot_index] -+ .u.valid.user_handle); -+ ret = HYPERVISOR_grant_table_op( -+ GNTTABOP_unmap_grant_ref, &op, 1); -+ BUG_ON(ret); -+ if (op.status != GNTST_okay) -+ printk("User unmap grant status = %d\n", -+ op.status); -+ } else { -+ /* USING SHADOW PAGE TABLES. */ -+ pte_clear_full(vma->vm_mm, addr, ptep, is_fullmm); -+ } ++ if (private_data->grants[slot_index].state != GNTDEV_SLOT_MAPPED) { ++ pte_clear_full(vma->vm_mm, addr, ptep, is_fullmm); ++ return copy; ++ } + -+ /* Finally, we unmap the grant from kernel space. */ -+ gnttab_set_unmap_op(&op, -+ get_kernel_vaddr(private_data, slot_index), -+ GNTMAP_host_map, ++ /* Clear the user space mapping, if it has been made. */ ++ if (private_data->grants[slot_index].u.valid.user_handle != ++ GNTDEV_INVALID_HANDLE) { ++ /* NOT USING SHADOW PAGE TABLES (and user handle valid). */ ++ gnttab_set_unmap_op(&op[0], ptep_to_machine(ptep), ++ GNTMAP_contains_pte, + private_data->grants[slot_index].u.valid -+ .kernel_handle); -+ ret = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, -+ &op, 1); -+ BUG_ON(ret); -+ if (op.status != GNTST_okay) -+ printk("Kernel unmap grant status = %d\n", op.status); ++ .user_handle); ++ nr = 1; ++ } else { ++ /* USING SHADOW PAGE TABLES (or user handle invalid). */ ++ pte_clear_full(vma->vm_mm, addr, ptep, is_fullmm); ++ nr = 0; ++ } + ++ /* We always unmap the grant from kernel space. */ ++ gnttab_set_unmap_op(&op[nr], ++ get_kernel_vaddr(private_data, slot_index), ++ GNTMAP_host_map, ++ private_data->grants[slot_index].u.valid ++ .kernel_handle); + -+ /* Return slot to the not-yet-mapped state, so that it may be -+ * mapped again, or removed by a subsequent ioctl. -+ */ -+ private_data->grants[slot_index].state = -+ GNTDEV_SLOT_NOT_YET_MAPPED; ++ ret = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, op, nr + 1); ++ BUG_ON(ret); + ++ if (nr && op[0].status != GNTST_okay) ++ printk("User unmap grant status = %d\n", op[0].status); ++ if (op[nr].status != GNTST_okay) ++ printk("Kernel unmap grant status = %d\n", op[nr].status); ++ ++ /* Return slot to the not-yet-mapped state, so that it may be ++ * mapped again, or removed by a subsequent ioctl. ++ */ ++ private_data->grants[slot_index].state = GNTDEV_SLOT_NOT_YET_MAPPED; ++ ++ if (!xen_feature(XENFEAT_auto_translated_physmap)) { + /* Invalidate the physical to machine mapping for this page. */ + set_phys_to_machine( + page_to_pfn(private_data->foreign_pages[slot_index]), + INVALID_P2M_ENTRY); -+ -+ } else { -+ pte_clear_full(vma->vm_mm, addr, ptep, is_fullmm); + } + + return copy; @@ -17027,9 +17008,8 @@ and in case upstream wants to take the forward porting patches: +/* "Destructor" for a VM area. + */ +static void gntdev_vma_close(struct vm_area_struct *vma) { -+ if (vma->vm_private_data) { ++ if (vma->vm_flags & VM_FOREIGN) + kfree(vma->vm_private_data); -+ } +} + +/* Called when an ioctl is made on the device. @@ -17144,7 +17124,8 @@ and in case upstream wants to take the forward porting patches: + return -EFAULT; + + start_index = op.index >> PAGE_SHIFT; -+ if (start_index + op.count > private_data->grants_size) ++ if (start_index + op.count < start_index || ++ start_index + op.count > private_data->grants_size) + return -EINVAL; + + down_write(&private_data->grants_sem); @@ -17153,28 +17134,29 @@ and in case upstream wants to take the forward porting patches: + * state. + */ + for (i = 0; i < op.count; ++i) { -+ if (unlikely -+ (private_data->grants[start_index + i].state -+ != GNTDEV_SLOT_NOT_YET_MAPPED)) { -+ if (private_data->grants[start_index + i].state -+ == GNTDEV_SLOT_INVALID) { -+ printk(KERN_ERR -+ "Tried to remove an invalid " -+ "grant at offset 0x%x.", -+ (start_index + i) -+ << PAGE_SHIFT); -+ rc = -EINVAL; -+ } else { -+ printk(KERN_ERR -+ "Tried to remove a grant which " -+ "is currently mmap()-ed at " -+ "offset 0x%x.", -+ (start_index + i) -+ << PAGE_SHIFT); -+ rc = -EBUSY; -+ } -+ goto unmap_out; ++ const char *what; ++ ++ switch (private_data->grants[start_index + i].state) { ++ case GNTDEV_SLOT_NOT_YET_MAPPED: ++ continue; ++ case GNTDEV_SLOT_INVALID: ++ what = "invalid"; ++ rc = -EINVAL; ++ break; ++ case GNTDEV_SLOT_MAPPED: ++ what = "currently mmap()-ed"; ++ rc = -EBUSY; ++ break; ++ default: ++ what = "in an invalid state"; ++ rc = -ENXIO; ++ break; + } ++ printk(KERN_ERR "%s[%d] tried to remove a grant" ++ " which is %s at %#x+%#x\n", ++ current->comm, current->pid, ++ what, start_index, i); ++ goto unmap_out; + } + + down_write(&private_data->free_list_sem); diff --git a/patches.xen/xen3-auto-xen-kconfig.diff b/patches.xen/xen3-auto-xen-kconfig.diff index e850936f53..88b4f09fc0 100644 --- a/patches.xen/xen3-auto-xen-kconfig.diff +++ b/patches.xen/xen3-auto-xen-kconfig.diff @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: xen3 xen-kconfig From: xen-devel@lists.xen.org Patch-mainline: n/a diff --git a/patches.xen/xen3-fixup-xen b/patches.xen/xen3-fixup-xen index 48ec5bb8d3..84202db4a0 100644 --- a/patches.xen/xen3-fixup-xen +++ b/patches.xen/xen3-fixup-xen @@ -1,4 +1,4 @@ -From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1172:f523a98343a9) +From http://xenbits.xen.org/linux-2.6.18-xen.hg (tip 1177:90a9c811f4c0) Subject: Fix Xen build wrt. Xen files coming from mainline. From: xen-devel@lists.xen.org Patch-mainline: n/a diff --git a/patches.xen/xen3-ia32-emulation-fix-build-problem-for-modular-ia32-a-out-support b/patches.xen/xen3-ia32-emulation-fix-build-problem-for-modular-ia32-a-out-support deleted file mode 100644 index 20c67addbe..0000000000 --- a/patches.xen/xen3-ia32-emulation-fix-build-problem-for-modular-ia32-a-out-support +++ /dev/null @@ -1,30 +0,0 @@ -From febb72a6e4cc6c8cffcc1ea649a3fb364f1ea432 Mon Sep 17 00:00:00 2001 -From: Larry Finger <Larry.Finger@lwfinger.net> -Date: Sun, 6 May 2012 19:40:03 -0500 -Subject: IA32 emulation: Fix build problem for modular ia32 a.out support -Patch-mainline: v3.5 or v3.4-rc7 (next release) - -Commit ce7e5d2d19bc ("x86: fix broken TASK_SIZE for ia32_aout") breaks -kernel builds when "CONFIG_IA32_AOUT=m" with - - ERROR: "set_personality_ia32" [arch/x86/ia32/ia32_aout.ko] undefined! - make[1]: *** [__modpost] Error 1 - -The entry point needs to be exported. - -Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> -Acked-by: Al Viro <viro@zeniv.linux.org> -Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> -Acked-by: Jeff Mahoney <jeffm@suse.com> -Automatically created from "patches.rpmify/ia32-emulation-fix-build-problem-for-modular-ia32-a-out-support" by xen-port-patches.py - ---- head.orig/arch/x86/kernel/process_64-xen.c 2012-04-13 17:29:01.000000000 +0200 -+++ head/arch/x86/kernel/process_64-xen.c 2012-05-08 11:19:08.000000000 +0200 -@@ -472,6 +472,7 @@ void set_personality_ia32(bool x32) - current_thread_info()->status |= TS_COMPAT; - } - } -+EXPORT_SYMBOL_GPL(set_personality_ia32); - - unsigned long get_wchan(struct task_struct *p) - { diff --git a/patches.xen/xen3-patch-2.6.19 b/patches.xen/xen3-patch-2.6.19 index 229aa7e3e7..dfa1cbfa79 100644 --- a/patches.xen/xen3-patch-2.6.19 +++ b/patches.xen/xen3-patch-2.6.19 @@ -8,125 +8,8 @@ Acked-by: jbeulich@novell.com 3.1/arch/x86/kernel/step.c (now using user_64bit_mode()) ---- - arch/x86/Kconfig | 1 - arch/x86/ia32/ia32entry-xen.S | 9 - arch/x86/include/mach-xen/asm/desc_32.h | 127 +- - arch/x86/include/mach-xen/asm/fixmap_32.h | 5 - arch/x86/include/mach-xen/asm/fixmap_64.h | 2 - arch/x86/include/mach-xen/asm/hypercall_32.h | 28 - arch/x86/include/mach-xen/asm/hypercall_64.h | 27 - arch/x86/include/mach-xen/asm/hypervisor.h | 44 - arch/x86/include/mach-xen/asm/pgtable-3level.h | 14 - arch/x86/include/mach-xen/asm/pgtable_32.h | 143 +- - arch/x86/include/mach-xen/asm/pgtable_64.h | 86 - - arch/x86/include/mach-xen/asm/processor_32.h | 62 - - arch/x86/include/mach-xen/asm/processor_64.h | 2 - arch/x86/include/mach-xen/asm/smp_32.h | 25 - arch/x86/include/mach-xen/asm/smp_64.h | 27 - arch/x86/include/mach-xen/asm/tlbflush_32.h | 2 - arch/x86/include/mach-xen/asm/tlbflush_64.h | 3 - arch/x86/kernel/Makefile | 6 - arch/x86/kernel/acpi/boot.c | 12 - arch/x86/kernel/apic/apic-xen.c | 9 - arch/x86/kernel/cpu/common-xen.c | 20 - arch/x86/kernel/cpu/mcheck/mce_dom0.c | 5 - arch/x86/kernel/e820_64-xen.c | 333 +++--- - arch/x86/kernel/early_printk-xen.c | 20 - arch/x86/kernel/entry_32-xen.S | 145 +- - arch/x86/kernel/entry_64-xen.S | 106 -- - arch/x86/kernel/head64-xen.c | 47 - arch/x86/kernel/head_32-xen.S | 2 - arch/x86/kernel/head_64-xen.S | 5 - arch/x86/kernel/io_apic_32-xen.c | 750 +++++++++----- - arch/x86/kernel/io_apic_64-xen.c | 1254 +++++++++++-------------- - arch/x86/kernel/ioport_64-xen.c | 1 - arch/x86/kernel/ldt_32-xen.c | 2 - arch/x86/kernel/microcode_core-xen.c | 85 + - arch/x86/kernel/mpparse_32-xen.c | 70 - - arch/x86/kernel/mpparse_64-xen.c | 313 +----- - arch/x86/kernel/pci-dma-xen.c | 16 - arch/x86/kernel/process_32-xen.c | 29 - arch/x86/kernel/process_64-xen.c | 90 + - arch/x86/kernel/setup64-xen.c | 41 - arch/x86/kernel/setup_32-xen.c | 435 +++----- - arch/x86/kernel/setup_64-xen.c | 275 +---- - arch/x86/kernel/smp_32-xen.c | 75 + - arch/x86/kernel/smp_64-xen.c | 35 - arch/x86/kernel/time-xen.c | 87 - - arch/x86/kernel/traps_32-xen.c | 238 ++-- - arch/x86/kernel/traps_64-xen.c | 222 ++-- - arch/x86/kernel/vsyscall_64-xen.c | 117 ++ - arch/x86/mach-xen/setup.c | 6 - arch/x86/mm/fault_32-xen.c | 29 - arch/x86/mm/fault_64-xen.c | 34 - arch/x86/mm/highmem_32-xen.c | 31 - arch/x86/mm/hypervisor.c | 304 ++++++ - arch/x86/mm/init_32-xen.c | 105 +- - arch/x86/mm/init_64-xen.c | 185 +-- - arch/x86/mm/ioremap-xen.c | 10 - arch/x86/mm/pageattr_64-xen.c | 24 - arch/x86/mm/pgtable_32-xen.c | 31 - drivers/char/tpm/tpm_xen.c | 5 - drivers/pci/Kconfig | 2 - drivers/pci/msi-xen.c | 101 +- - drivers/xen/Kconfig | 4 - drivers/xen/balloon/balloon.c | 72 + - drivers/xen/blkback/blkback.c | 2 - drivers/xen/blkback/common.h | 2 - drivers/xen/blkfront/blkfront.c | 18 - drivers/xen/blktap/blktap.c | 2 - drivers/xen/blktap/common.h | 2 - drivers/xen/blktap2/sysfs.c | 46 - drivers/xen/console/console.c | 12 - drivers/xen/console/xencons.h | 2 - drivers/xen/console/xencons_ring.c | 4 - drivers/xen/core/evtchn.c | 124 +- - drivers/xen/core/gnttab.c | 3 - drivers/xen/core/reboot.c | 6 - drivers/xen/core/smpboot.c | 6 - drivers/xen/fbfront/xenfb.c | 3 - drivers/xen/fbfront/xenkbd.c | 2 - drivers/xen/gntdev/gntdev.c | 11 - drivers/xen/netback/accel.c | 2 - drivers/xen/netback/common.h | 3 - drivers/xen/netback/interface.c | 1 - drivers/xen/netback/loopback.c | 10 - drivers/xen/netback/netback.c | 34 - drivers/xen/netfront/netfront.c | 73 + - drivers/xen/netfront/netfront.h | 1 - drivers/xen/pcifront/pci_op.c | 2 - drivers/xen/pcifront/pcifront.h | 2 - drivers/xen/privcmd/compat_privcmd.c | 1 - drivers/xen/privcmd/privcmd.c | 43 - drivers/xen/scsiback/common.h | 2 - drivers/xen/scsiback/scsiback.c | 4 - drivers/xen/scsifront/common.h | 2 - drivers/xen/scsifront/scsifront.c | 2 - drivers/xen/sfc_netback/accel_xenbus.c | 6 - drivers/xen/sfc_netfront/accel.h | 6 - drivers/xen/sfc_netfront/accel_msg.c | 6 - drivers/xen/sfc_netfront/accel_tso.c | 2 - drivers/xen/sfc_netfront/accel_vi.c | 4 - drivers/xen/tpmback/common.h | 2 - drivers/xen/tpmback/tpmback.c | 4 - drivers/xen/usbback/usbback.c | 4 - drivers/xen/usbback/usbback.h | 2 - drivers/xen/usbback/usbstub.c | 6 - drivers/xen/usbfront/usbfront-dbg.c | 4 - drivers/xen/usbfront/usbfront-q.c | 4 - drivers/xen/usbfront/usbfront.h | 2 - drivers/xen/xenbus/xenbus_comms.c | 2 - drivers/xen/xenoprof/xenoprofile.c | 3 - include/asm-generic/pgtable.h | 2 - include/xen/evtchn.h | 10 - include/xen/net-util.h | 74 + - mm/mprotect.c | 2 - mm/page_alloc.c | 17 - 114 files changed, 3790 insertions(+), 3194 deletions(-) - ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig +--- head.orig/arch/x86/Kconfig 2012-04-10 16:11:09.000000000 +0200 ++++ head/arch/x86/Kconfig 2012-04-10 16:14:17.000000000 +0200 @@ -571,6 +571,7 @@ config SCHED_OMIT_FRAME_POINTER menuconfig PARAVIRT_GUEST @@ -135,1240 +18,8 @@ Acked-by: jbeulich@novell.com ---help--- Say Y here to get to see options related to running Linux under various hypervisors. This option alone does not add any kernel code. ---- a/arch/x86/ia32/ia32entry-xen.S -+++ b/arch/x86/ia32/ia32entry-xen.S -@@ -83,6 +83,7 @@ - */ - ENTRY(ia32_sysenter_target) - CFI_STARTPROC32 simple -+ CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8-RIP+16 - /*CFI_REL_OFFSET ss,SS-RIP+16*/ - CFI_REL_OFFSET rsp,RSP-RIP+16 -@@ -164,6 +165,7 @@ ENDPROC(ia32_sysenter_target) - */ - ENTRY(ia32_cstar_target) - CFI_STARTPROC32 simple -+ CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8-RIP+16 - /*CFI_REL_OFFSET ss,SS-RIP+16*/ - CFI_REL_OFFSET rsp,RSP-RIP+16 -@@ -243,6 +245,7 @@ ia32_badarg: - - ENTRY(ia32_syscall) - CFI_STARTPROC simple -+ CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8-RIP+16 - /*CFI_REL_OFFSET ss,SS-RIP+16*/ - CFI_REL_OFFSET rsp,RSP-RIP+16 -@@ -320,6 +323,7 @@ ENTRY(ia32_ptregs_common) - popq %r11 - CFI_ENDPROC - CFI_STARTPROC32 simple -+ CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8-ARGOFFSET - CFI_REL_OFFSET rax,RAX-ARGOFFSET - CFI_REL_OFFSET rcx,RCX-ARGOFFSET -@@ -653,8 +657,8 @@ ia32_sys_call_table: - .quad sys_readlinkat /* 305 */ - .quad sys_fchmodat - .quad sys_faccessat -- .quad quiet_ni_syscall /* pselect6 for now */ -- .quad quiet_ni_syscall /* ppoll for now */ -+ .quad compat_sys_pselect6 -+ .quad compat_sys_ppoll - .quad sys_unshare /* 310 */ - .quad compat_sys_set_robust_list - .quad compat_sys_get_robust_list -@@ -663,4 +667,5 @@ ia32_sys_call_table: - .quad sys_tee - .quad compat_sys_vmsplice - .quad compat_sys_move_pages -+ .quad sys_getcpu - ia32_syscall_end: ---- a/arch/x86/include/mach-xen/asm/desc_32.h -+++ b/arch/x86/include/mach-xen/asm/desc_32.h -@@ -32,52 +32,110 @@ static inline struct desc_struct *get_cp - return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; - } - -+/* -+ * This is the ldt that every process will get unless we need -+ * something other than this. -+ */ -+extern struct desc_struct default_ldt[]; -+extern struct desc_struct idt_table[]; -+extern void set_intr_gate(unsigned int irq, void * addr); -+ -+static inline void pack_descriptor(__u32 *a, __u32 *b, -+ unsigned long base, unsigned long limit, unsigned char type, unsigned char flags) -+{ -+ *a = ((base & 0xffff) << 16) | (limit & 0xffff); -+ *b = (base & 0xff000000) | ((base & 0xff0000) >> 16) | -+ (limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20); -+} -+ -+static inline void pack_gate(__u32 *a, __u32 *b, -+ unsigned long base, unsigned short seg, unsigned char type, unsigned char flags) -+{ -+ *a = (seg << 16) | (base & 0xffff); -+ *b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff); -+} -+ -+#define DESCTYPE_LDT 0x82 /* present, system, DPL-0, LDT */ -+#define DESCTYPE_TSS 0x89 /* present, system, DPL-0, 32-bit TSS */ -+#define DESCTYPE_TASK 0x85 /* present, system, DPL-0, task gate */ -+#define DESCTYPE_INT 0x8e /* present, system, DPL-0, interrupt gate */ -+#define DESCTYPE_TRAP 0x8f /* present, system, DPL-0, trap gate */ -+#define DESCTYPE_DPL3 0x60 /* DPL-3 */ -+#define DESCTYPE_S 0x10 /* !system */ -+ - #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) - #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) - - #define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) - #define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) --#define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr)) --#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt)) -+#define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr)) -+#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt)) - - #define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) - #define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) --#define store_tr(tr) __asm__ ("str %0":"=mr" (tr)) --#define store_ldt(ldt) __asm__ ("sldt %0":"=mr" (ldt)) -+#define store_tr(tr) __asm__ ("str %0":"=m" (tr)) -+#define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt)) - --/* -- * This is the ldt that every process will get unless we need -- * something other than this. -- */ --extern struct desc_struct default_ldt[]; --extern void set_intr_gate(unsigned int irq, void * addr); -+#if TLS_SIZE != 24 -+# error update this code. -+#endif -+ -+static inline void load_TLS(struct thread_struct *t, unsigned int cpu) -+{ -+#define C(i) if (HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i]), \ -+ *(u64 *)&t->tls_array[i]) \ -+ BUG() -+ C(0); C(1); C(2); -+#undef C -+} - --#define _set_tssldt_desc(n,addr,limit,type) \ --__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \ -- "movw %w1,2(%2)\n\t" \ -- "rorl $16,%1\n\t" \ -- "movb %b1,4(%2)\n\t" \ -- "movb %4,5(%2)\n\t" \ -- "movb $0,6(%2)\n\t" \ -- "movb %h1,7(%2)\n\t" \ -- "rorl $16,%1" \ -- : "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type)) -+#ifndef CONFIG_XEN -+static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) -+{ -+ __u32 *lp = (__u32 *)((char *)dt + entry*8); -+ *lp = entry_a; -+ *(lp+1) = entry_b; -+} - --#ifndef CONFIG_X86_NO_TSS --static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) -+#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) -+#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) -+#else -+extern int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b); -+extern int write_gdt_entry(void *gdt, int entry, __u32 entry_a, __u32 entry_b); -+#endif -+#ifndef CONFIG_X86_NO_IDT -+#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) -+ -+static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) - { -- _set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr, -- offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89); -+ __u32 a, b; -+ pack_gate(&a, &b, (unsigned long)addr, seg, type, 0); -+ write_idt_entry(idt_table, gate, a, b); - } -+#endif - --#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) -+#ifndef CONFIG_X86_NO_TSS -+static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) -+{ -+ __u32 a, b; -+ pack_descriptor(&a, &b, (unsigned long)addr, -+ offsetof(struct tss_struct, __cacheline_filler) - 1, -+ DESCTYPE_TSS, 0); -+ write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b); -+} - #endif - --static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) -+static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int entries) - { -- _set_tssldt_desc(&get_cpu_gdt_table(cpu)[GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82); -+ __u32 a, b; -+ pack_descriptor(&a, &b, (unsigned long)addr, -+ entries * sizeof(struct desc_struct) - 1, -+ DESCTYPE_LDT, 0); -+ write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b); - } - -+#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) -+ - #define LDT_entry_a(info) \ - ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) - -@@ -103,21 +161,6 @@ static inline void set_ldt_desc(unsigned - (info)->seg_not_present == 1 && \ - (info)->useable == 0 ) - --extern int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b); -- --#if TLS_SIZE != 24 --# error update this code. --#endif -- --static inline void load_TLS(struct thread_struct *t, unsigned int cpu) --{ --#define C(i) if (HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i]), \ -- *(u64 *)&t->tls_array[i])) \ -- BUG(); -- C(0); C(1); C(2); --#undef C --} -- - static inline void clear_LDT(void) - { - int cpu = get_cpu(); ---- a/arch/x86/include/mach-xen/asm/fixmap_32.h -+++ b/arch/x86/include/mach-xen/asm/fixmap_32.h -@@ -55,7 +55,7 @@ enum fixed_addresses { - #ifdef CONFIG_X86_LOCAL_APIC - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ - #endif --#ifdef CONFIG_X86_IO_APIC -+#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_XEN) - FIX_IO_APIC_BASE_0, - FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, - #endif -@@ -95,10 +95,9 @@ enum fixed_addresses { - __end_of_fixed_addresses - }; - --extern void set_fixaddr_top(unsigned long top); -- - extern void __set_fixmap(enum fixed_addresses idx, - maddr_t phys, pgprot_t flags); -+extern void reserve_top_address(unsigned long reserve); - - #define set_fixmap(idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL) ---- a/arch/x86/include/mach-xen/asm/fixmap_64.h -+++ b/arch/x86/include/mach-xen/asm/fixmap_64.h -@@ -41,7 +41,7 @@ enum fixed_addresses { - #ifdef CONFIG_X86_LOCAL_APIC - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ - #endif --#ifdef CONFIG_X86_IO_APIC -+#ifndef CONFIG_XEN - FIX_IO_APIC_BASE_0, - FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, - #endif ---- a/arch/x86/include/mach-xen/asm/hypercall_32.h -+++ b/arch/x86/include/mach-xen/asm/hypercall_32.h -@@ -128,6 +128,23 @@ - __res; \ - }) - -+#define _hypercall(type, op, a1, a2, a3, a4, a5) \ -+({ \ -+ type __res; \ -+ register typeof((a1)+0) __arg1 asm("ebx") = (a1); \ -+ register typeof((a2)+0) __arg2 asm("ecx") = (a2); \ -+ register typeof((a3)+0) __arg3 asm("edx") = (a3); \ -+ register typeof((a4)+0) __arg4 asm("esi") = (a4); \ -+ register typeof((a5)+0) __arg5 asm("edi") = (a5); \ -+ asm volatile ( \ -+ "call *%6" \ -+ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ -+ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ -+ : "0" (hypercall_page + (op) * 32) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ - static inline int __must_check - HYPERVISOR_set_trap_table( - const trap_info_t *table) -@@ -140,6 +157,8 @@ HYPERVISOR_mmu_update( - mmu_update_t *req, unsigned int count, unsigned int *success_count, - domid_t domid) - { -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_mmu_update(req, count, success_count, domid); - return _hypercall4(int, mmu_update, req, count, success_count, domid); - } - -@@ -148,6 +167,8 @@ HYPERVISOR_mmuext_op( - struct mmuext_op *op, unsigned int count, unsigned int *success_count, - domid_t domid) - { -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_mmuext_op(op, count, success_count, domid); - return _hypercall4(int, mmuext_op, op, count, success_count, domid); - } - -@@ -238,6 +259,8 @@ static inline int __must_check - HYPERVISOR_memory_op( - unsigned int cmd, void *arg) - { -+ if (arch_use_lazy_mmu_mode()) -+ xen_multicall_flush(false); - return _hypercall2(int, memory_op, cmd, arg); - } - -@@ -253,6 +276,9 @@ HYPERVISOR_update_va_mapping( - unsigned long va, pte_t new_val, unsigned long flags) - { - unsigned long pte_hi = 0; -+ -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_update_va_mapping(va, new_val, flags); - #ifdef CONFIG_X86_PAE - pte_hi = new_val.pte_high; - #endif -@@ -316,6 +342,8 @@ static inline int __must_check - HYPERVISOR_grant_table_op( - unsigned int cmd, void *uop, unsigned int count) - { -+ if (arch_use_lazy_mmu_mode()) -+ xen_multicall_flush(false); - return _hypercall3(int, grant_table_op, cmd, uop, count); - } - ---- a/arch/x86/include/mach-xen/asm/hypercall_64.h -+++ b/arch/x86/include/mach-xen/asm/hypercall_64.h -@@ -135,6 +135,23 @@ - __res; \ - }) - -+#define _hypercall(type, op, a1, a2, a3, a4, a5) \ -+({ \ -+ type __res; \ -+ register typeof((a1)+0) __arg1 asm("rdi") = (a1); \ -+ register typeof((a2)+0) __arg2 asm("rsi") = (a2); \ -+ register typeof((a3)+0) __arg3 asm("rdx") = (a3); \ -+ register typeof((a4)+0) __arg4 asm("r10") = (a4); \ -+ register typeof((a5)+0) __arg5 asm("r8") = (a5); \ -+ asm volatile ( \ -+ "call *%6" \ -+ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ -+ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ -+ : "0" (hypercall_page + (op) * 32) \ -+ : "memory" ); \ -+ __res; \ -+}) -+ - static inline int __must_check - HYPERVISOR_set_trap_table( - const trap_info_t *table) -@@ -147,6 +164,8 @@ HYPERVISOR_mmu_update( - mmu_update_t *req, unsigned int count, unsigned int *success_count, - domid_t domid) - { -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_mmu_update(req, count, success_count, domid); - return _hypercall4(int, mmu_update, req, count, success_count, domid); - } - -@@ -155,6 +174,8 @@ HYPERVISOR_mmuext_op( - struct mmuext_op *op, unsigned int count, unsigned int *success_count, - domid_t domid) - { -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_mmuext_op(op, count, success_count, domid); - return _hypercall4(int, mmuext_op, op, count, success_count, domid); - } - -@@ -248,6 +269,8 @@ static inline int __must_check - HYPERVISOR_memory_op( - unsigned int cmd, void *arg) - { -+ if (arch_use_lazy_mmu_mode()) -+ xen_multicall_flush(false); - return _hypercall2(int, memory_op, cmd, arg); - } - -@@ -262,6 +285,8 @@ static inline int __must_check - HYPERVISOR_update_va_mapping( - unsigned long va, pte_t new_val, unsigned long flags) - { -+ if (arch_use_lazy_mmu_mode()) -+ return xen_multi_update_va_mapping(va, new_val, flags); - return _hypercall3(int, update_va_mapping, va, new_val.pte, flags); - } - -@@ -321,6 +346,8 @@ static inline int __must_check - HYPERVISOR_grant_table_op( - unsigned int cmd, void *uop, unsigned int count) - { -+ if (arch_use_lazy_mmu_mode()) -+ xen_multicall_flush(false); - return _hypercall3(int, grant_table_op, cmd, uop, count); - } - ---- a/arch/x86/include/mach-xen/asm/hypervisor.h -+++ b/arch/x86/include/mach-xen/asm/hypervisor.h -@@ -44,6 +44,7 @@ - #include <xen/interface/sched.h> - #include <xen/interface/nmi.h> - #include <xen/interface/tmem.h> -+#include <asm/percpu.h> - #include <asm/ptrace.h> - #include <asm/page.h> - #if defined(__i386__) -@@ -139,7 +140,44 @@ void scrub_pages(void *, unsigned int); - #define scrub_pages(_p,_n) ((void)0) - #endif - --#include <xen/hypercall.h> -+#if defined(CONFIG_XEN) && !defined(MODULE) -+ -+DECLARE_PER_CPU(bool, xen_lazy_mmu); -+ -+int xen_multicall_flush(bool); -+ -+int __must_check xen_multi_update_va_mapping(unsigned long va, pte_t, -+ unsigned long flags); -+int __must_check xen_multi_mmu_update(mmu_update_t *, unsigned int count, -+ unsigned int *success_count, domid_t); -+int __must_check xen_multi_mmuext_op(struct mmuext_op *, unsigned int count, -+ unsigned int *success_count, domid_t); -+ -+#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE -+static inline void arch_enter_lazy_mmu_mode(void) -+{ -+ __get_cpu_var(xen_lazy_mmu) = true; -+} -+ -+static inline void arch_leave_lazy_mmu_mode(void) -+{ -+ __get_cpu_var(xen_lazy_mmu) = false; -+ xen_multicall_flush(false); -+} -+ -+#ifndef arch_use_lazy_mmu_mode -+#define arch_use_lazy_mmu_mode() unlikely(__get_cpu_var(xen_lazy_mmu)) -+#endif -+ -+#else /* !CONFIG_XEN || MODULE */ -+ -+static inline void xen_multicall_flush(bool ignore) {} -+#define arch_use_lazy_mmu_mode() false -+#define xen_multi_update_va_mapping(...) ({ BUG(); -ENOSYS; }) -+#define xen_multi_mmu_update(...) ({ BUG(); -ENOSYS; }) -+#define xen_multi_mmuext_op(...) ({ BUG(); -ENOSYS; }) -+ -+#endif /* CONFIG_XEN && !MODULE */ - - #if defined(CONFIG_X86_64) - #define MULTI_UVMFLAGS_INDEX 2 -@@ -151,11 +189,15 @@ void scrub_pages(void *, unsigned int); - - #ifdef CONFIG_XEN - #define is_running_on_xen() 1 -+extern char hypercall_page[PAGE_SIZE]; - #else - extern char *hypercall_stubs; -+#define hypercall_page hypercall_stubs - #define is_running_on_xen() (!!hypercall_stubs) - #endif - -+#include <xen/hypercall.h> -+ - static inline int - HYPERVISOR_yield( - void) ---- a/arch/x86/include/mach-xen/asm/pgtable-3level.h -+++ b/arch/x86/include/mach-xen/asm/pgtable-3level.h -@@ -53,7 +53,6 @@ static inline int pte_exec_kernel(pte_t - * not possible, use pte_get_and_clear to obtain the old pte - * value and then use set_pte to update it. -ben - */ --#define __HAVE_ARCH_SET_PTE_ATOMIC - - static inline void set_pte(pte_t *ptep, pte_t pte) - { -@@ -70,14 +69,6 @@ static inline void set_pte(pte_t *ptep, - set_pte((ptep), (pteval)); \ - } while (0) - --#define set_pte_at_sync(_mm,addr,ptep,pteval) do { \ -- if (((_mm) != current->mm && (_mm) != &init_mm) || \ -- HYPERVISOR_update_va_mapping((addr), (pteval), UVMF_INVLPG)) { \ -- set_pte((ptep), (pteval)); \ -- xen_invlpg((addr)); \ -- } \ --} while (0) -- - #define set_pmd(pmdptr,pmdval) \ - xen_l2_entry_update((pmdptr), (pmdval)) - #define set_pud(pudptr,pudval) \ -@@ -94,7 +85,7 @@ static inline void pud_clear (pud_t * pu - #define pud_page(pud) \ - ((struct page *) __va(pud_val(pud) & PAGE_MASK)) - --#define pud_page_kernel(pud) \ -+#define pud_page_vaddr(pud) \ - ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) - - -@@ -124,6 +115,7 @@ static inline void pte_clear(struct mm_s - - #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) - -+#define __HAVE_ARCH_PTEP_GET_AND_CLEAR - static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) - { - pte_t pte = *ptep; -@@ -142,6 +134,7 @@ static inline pte_t ptep_get_and_clear(s - return pte; - } - -+#define __HAVE_ARCH_PTEP_CLEAR_FLUSH - #define ptep_clear_flush(vma, addr, ptep) \ - ({ \ - pte_t *__ptep = (ptep); \ -@@ -159,6 +152,7 @@ static inline pte_t ptep_get_and_clear(s - __res; \ - }) - -+#define __HAVE_ARCH_PTE_SAME - static inline int pte_same(pte_t a, pte_t b) - { - return a.pte_low == b.pte_low && a.pte_high == b.pte_high; ---- a/arch/x86/include/mach-xen/asm/pgtable_32.h -+++ b/arch/x86/include/mach-xen/asm/pgtable_32.h -@@ -260,31 +260,89 @@ static inline pte_t pte_mkhuge(pte_t pte - # include <asm/pgtable-2level.h> - #endif - --#define ptep_test_and_clear_dirty(vma, addr, ptep) \ -+/* -+ * Rules for using pte_update - it must be called after any PTE update which -+ * has not been done using the set_pte / clear_pte interfaces. It is used by -+ * shadow mode hypervisors to resynchronize the shadow page tables. Kernel PTE -+ * updates should either be sets, clears, or set_pte_atomic for P->P -+ * transitions, which means this hook should only be called for user PTEs. -+ * This hook implies a P->P protection or access change has taken place, which -+ * requires a subsequent TLB flush. The notification can optionally be delayed -+ * until the TLB flush event by using the pte_update_defer form of the -+ * interface, but care must be taken to assure that the flush happens while -+ * still holding the same page table lock so that the shadow and primary pages -+ * do not become out of sync on SMP. -+ */ -+#define pte_update(mm, addr, ptep) do { } while (0) -+#define pte_update_defer(mm, addr, ptep) do { } while (0) -+ -+ -+/* -+ * We only update the dirty/accessed state if we set -+ * the dirty bit by hand in the kernel, since the hardware -+ * will do the accessed bit for us, and we don't want to -+ * race with other CPU's that might be updating the dirty -+ * bit at the same time. -+ */ -+#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS -+#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ -+do { \ -+ if (dirty) \ -+ ptep_establish(vma, address, ptep, entry); \ -+} while (0) -+ -+/* -+ * We don't actually have these, but we want to advertise them so that -+ * we can encompass the flush here. -+ */ -+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY -+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -+ -+/* -+ * Rules for using ptep_establish: the pte MUST be a user pte, and -+ * must be a present->present transition. -+ */ -+#define __HAVE_ARCH_PTEP_ESTABLISH -+#define ptep_establish(vma, address, ptep, pteval) \ -+do { \ -+ if ( likely((vma)->vm_mm == current->mm) ) { \ -+ BUG_ON(HYPERVISOR_update_va_mapping(address, \ -+ pteval, \ -+ (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ -+ UVMF_INVLPG|UVMF_MULTI)); \ -+ } else { \ -+ xen_l1_entry_update(ptep, pteval); \ -+ flush_tlb_page(vma, address); \ -+ } \ -+} while (0) -+ -+#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH -+#define ptep_clear_flush_dirty(vma, address, ptep) \ - ({ \ - pte_t __pte = *(ptep); \ -- int __ret = pte_dirty(__pte); \ -- if (__ret) { \ -- __pte = pte_mkclean(__pte); \ -- if ((vma)->vm_mm != current->mm || \ -- HYPERVISOR_update_va_mapping(addr, __pte, 0)) \ -- (ptep)->pte_low = __pte.pte_low; \ -- } \ -- __ret; \ -+ int __dirty = pte_dirty(__pte); \ -+ __pte = pte_mkclean(__pte); \ -+ if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ -+ ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ -+ else if (__dirty) \ -+ (ptep)->pte_low = __pte.pte_low; \ -+ __dirty; \ - }) - --#define ptep_test_and_clear_young(vma, addr, ptep) \ -+#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH -+#define ptep_clear_flush_young(vma, address, ptep) \ - ({ \ - pte_t __pte = *(ptep); \ -- int __ret = pte_young(__pte); \ -- if (__ret) \ -- __pte = pte_mkold(__pte); \ -- if ((vma)->vm_mm != current->mm || \ -- HYPERVISOR_update_va_mapping(addr, __pte, 0)) \ -- (ptep)->pte_low = __pte.pte_low; \ -- __ret; \ -+ int __young = pte_young(__pte); \ -+ __pte = pte_mkold(__pte); \ -+ if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ -+ ptep_set_access_flags(vma, address, ptep, __pte, __young); \ -+ else if (__young) \ -+ (ptep)->pte_low = __pte.pte_low; \ -+ __young; \ - }) - -+#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL - #define ptep_get_and_clear_full(mm, addr, ptep, full) \ - ((full) ? ({ \ - pte_t __res = *(ptep); \ -@@ -296,6 +354,7 @@ static inline pte_t pte_mkhuge(pte_t pte - }) : \ - ptep_get_and_clear(mm, addr, ptep)) - -+#define __HAVE_ARCH_PTEP_SET_WRPROTECT - static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) - { - pte_t pte = *ptep; -@@ -391,11 +450,11 @@ static inline pte_t pte_modify(pte_t pte - #define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) - #define pte_offset_kernel(dir, address) \ -- ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) -+ ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) - - #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) - --#define pmd_page_kernel(pmd) \ -+#define pmd_page_vaddr(pmd) \ - ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) - - /* -@@ -418,8 +477,6 @@ extern pte_t *lookup_address(unsigned lo - static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} - #endif - --extern void noexec_setup(const char *str); -- - #if defined(CONFIG_HIGHPTE) - #define pte_offset_map(dir, address) \ - ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + \ -@@ -437,37 +494,17 @@ extern void noexec_setup(const char *str - #define pte_unmap_nested(pte) do { } while (0) - #endif - --#define __HAVE_ARCH_PTEP_ESTABLISH --#define ptep_establish(vma, address, ptep, pteval) \ -- do { \ -- if ( likely((vma)->vm_mm == current->mm) ) { \ -- BUG_ON(HYPERVISOR_update_va_mapping(address, \ -- pteval, \ -- (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ -- UVMF_INVLPG|UVMF_MULTI)); \ -- } else { \ -- xen_l1_entry_update(ptep, pteval); \ -- flush_tlb_page(vma, address); \ -- } \ -- } while (0) -+/* Clear a kernel PTE and flush it from the TLB */ -+#define kpte_clear_flush(ptep, vaddr) do { \ -+ if (HYPERVISOR_update_va_mapping(vaddr, __pte(0), UVMF_INVLPG)) \ -+ BUG(); \ -+} while (0) - - /* - * The i386 doesn't have any external MMU info: the kernel page - * tables contain all the necessary information. -- * -- * Also, we only update the dirty/accessed state if we set -- * the dirty bit by hand in the kernel, since the hardware -- * will do the accessed bit for us, and we don't want to -- * race with other CPU's that might be updating the dirty -- * bit at the same time. - */ - #define update_mmu_cache(vma,address,pte) do { } while (0) --#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS --#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ -- do { \ -- if (dirty) \ -- ptep_establish(vma, address, ptep, entry); \ -- } while (0) - - #include <xen/features.h> - void make_lowmem_page_readonly(void *va, unsigned int feature); -@@ -523,10 +560,11 @@ int create_lookup_pte_addr(struct mm_str - uint64_t *ptep); - - int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd, -- unsigned long addr, unsigned long end, pgprot_t newprot); -+ unsigned long addr, unsigned long end, pgprot_t newprot, -+ int dirty_accountable); - --#define arch_change_pte_range(mm, pmd, addr, end, newprot) \ -- xen_change_pte_range(mm, pmd, addr, end, newprot) -+#define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \ -+ xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) - - #define io_remap_pfn_range(vma,from,pfn,size,prot) \ - direct_remap_pfn_range(vma,from,pfn,size,prot,DOMID_IO) -@@ -535,13 +573,6 @@ direct_remap_pfn_range(vma,from,pfn,size - #define GET_IOSPACE(pfn) 0 - #define GET_PFN(pfn) (pfn) - --#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG --#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY --#define __HAVE_ARCH_PTEP_GET_AND_CLEAR --#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL --#define __HAVE_ARCH_PTEP_CLEAR_FLUSH --#define __HAVE_ARCH_PTEP_SET_WRPROTECT --#define __HAVE_ARCH_PTE_SAME - #include <asm-generic/pgtable.h> - - #endif /* _I386_PGTABLE_H */ ---- a/arch/x86/include/mach-xen/asm/pgtable_64.h -+++ b/arch/x86/include/mach-xen/asm/pgtable_64.h -@@ -44,12 +44,9 @@ extern unsigned long __supported_pte_mas - - #define swapper_pg_dir init_level4_pgt - --extern int nonx_setup(char *str); - extern void paging_init(void); - extern void clear_kernel_mapping(unsigned long addr, unsigned long size); - --extern unsigned long pgkern_mask; -- - /* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. -@@ -119,9 +116,6 @@ static inline void pgd_clear (pgd_t * pg - set_pgd(__user_pgd(pgd), __pgd(0)); - } - --#define pud_page(pud) \ -- ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) -- - #define pte_same(a, b) ((a).pte == (b).pte) - - #define pte_pgprot(a) (__pgprot((a).pte & ~PHYSICAL_PAGE_MASK)) -@@ -333,7 +327,7 @@ static inline pte_t ptep_get_and_clear_f - #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) - static inline int pte_user(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } - static inline int pte_read(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } --static inline int pte_exec(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } -+static inline int pte_exec(pte_t pte) { return !(__pte_val(pte) & _PAGE_NX); } - static inline int pte_dirty(pte_t pte) { return __pte_val(pte) & _PAGE_DIRTY; } - static inline int pte_young(pte_t pte) { return __pte_val(pte) & _PAGE_ACCESSED; } - static inline int pte_write(pte_t pte) { return __pte_val(pte) & _PAGE_RW; } -@@ -346,29 +340,12 @@ static inline pte_t pte_mkclean(pte_t pt - static inline pte_t pte_mkold(pte_t pte) { __pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } - static inline pte_t pte_wrprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_RW; return pte; } - static inline pte_t pte_mkread(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; } --static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; } -+static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) &= ~_PAGE_NX; return pte; } - static inline pte_t pte_mkdirty(pte_t pte) { __pte_val(pte) |= _PAGE_DIRTY; return pte; } - static inline pte_t pte_mkyoung(pte_t pte) { __pte_val(pte) |= _PAGE_ACCESSED; return pte; } - static inline pte_t pte_mkwrite(pte_t pte) { __pte_val(pte) |= _PAGE_RW; return pte; } - static inline pte_t pte_mkhuge(pte_t pte) { __pte_val(pte) |= _PAGE_PSE; return pte; } -- --#define ptep_test_and_clear_dirty(vma, addr, ptep) \ --({ \ -- pte_t __pte = *(ptep); \ -- int __ret = pte_dirty(__pte); \ -- if (__ret) \ -- set_pte_at((vma)->vm_mm, addr, ptep, pte_mkclean(__pte)); \ -- __ret; \ --}) -- --#define ptep_test_and_clear_young(vma, addr, ptep) \ --({ \ -- pte_t __pte = *(ptep); \ -- int __ret = pte_young(__pte); \ -- if (__ret) \ -- set_pte_at((vma)->vm_mm, addr, ptep, pte_mkold(__pte)); \ -- __ret; \ --}) -+static inline pte_t pte_clrhuge(pte_t pte) { __pte_val(pte) &= ~_PAGE_PSE; return pte; } - - static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) - { -@@ -395,7 +372,8 @@ static inline int pmd_large(pmd_t pte) { - /* - * Level 4 access. - */ --#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK)) -+#define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK)) -+#define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)) - #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) - #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) - #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) -@@ -404,16 +382,18 @@ static inline int pmd_large(pmd_t pte) { - - /* PUD - Level3 access */ - /* to find an entry in a page-table-directory. */ -+#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) -+#define pud_page(pud) (pfn_to_page(pud_val(pud) >> PAGE_SHIFT)) - #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) --#define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address)) -+#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) - #define pud_present(pud) (__pud_val(pud) & _PAGE_PRESENT) - - /* PMD - Level 2 access */ --#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) -+#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) - #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) - - #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) --#define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \ -+#define pmd_offset(dir, address) ((pmd_t *) pud_page_vaddr(*(dir)) + \ - pmd_index(address)) - #define pmd_none(x) (!__pmd_val(x)) - #if CONFIG_XEN_COMPAT <= 0x030002 -@@ -444,6 +424,7 @@ static inline pte_t mk_pte_phys(unsigned - { - unsigned long pteval; - pteval = physpage | pgprot_val(pgprot); -+ pteval &= __supported_pte_mask; - return __pte(pteval); - } - -@@ -465,7 +446,7 @@ static inline pte_t pte_modify(pte_t pte - - #define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) --#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ -+#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \ - pte_index(address)) - - /* x86-64 always has all page tables mapped. */ -@@ -506,6 +487,40 @@ static inline pte_t pte_modify(pte_t pte - ptep_establish(vma, address, ptep, entry); \ - } while (0) - -+ -+/* -+ * i386 says: We don't actually have these, but we want to advertise -+ * them so that we can encompass the flush here. -+ */ -+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY -+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -+ -+#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH -+#define ptep_clear_flush_dirty(vma, address, ptep) \ -+({ \ -+ pte_t __pte = *(ptep); \ -+ int __dirty = pte_dirty(__pte); \ -+ __pte = pte_mkclean(__pte); \ -+ if ((vma)->vm_mm->context.pinned) \ -+ ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ -+ else if (__dirty) \ -+ set_pte(ptep, __pte); \ -+ __dirty; \ -+}) -+ -+#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH -+#define ptep_clear_flush_young(vma, address, ptep) \ -+({ \ -+ pte_t __pte = *(ptep); \ -+ int __young = pte_young(__pte); \ -+ __pte = pte_mkold(__pte); \ -+ if ((vma)->vm_mm->context.pinned) \ -+ ptep_set_access_flags(vma, address, ptep, __pte, __young); \ -+ else if (__young) \ -+ set_pte(ptep, __pte); \ -+ __young; \ -+}) -+ - /* Encode and de-code a swap entry */ - #define __swp_type(x) (((x).val >> 1) & 0x3f) - #define __swp_offset(x) ((x).val >> 8) -@@ -543,10 +558,11 @@ int create_lookup_pte_addr(struct mm_str - uint64_t *ptep); - - int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd, -- unsigned long addr, unsigned long end, pgprot_t newprot); -+ unsigned long addr, unsigned long end, pgprot_t newprot, -+ int dirty_accountable); - --#define arch_change_pte_range(mm, pmd, addr, end, newprot) \ -- xen_change_pte_range(mm, pmd, addr, end, newprot) -+#define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \ -+ xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) - - #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ - direct_remap_pfn_range(vma,vaddr,pfn,size,prot,DOMID_IO) -@@ -568,8 +584,6 @@ int xen_change_pte_range(struct mm_struc - #define kc_offset_to_vaddr(o) \ - (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o)) - --#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG --#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY - #define __HAVE_ARCH_PTEP_GET_AND_CLEAR - #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL - #define __HAVE_ARCH_PTEP_CLEAR_FLUSH ---- a/arch/x86/include/mach-xen/asm/processor_32.h -+++ b/arch/x86/include/mach-xen/asm/processor_32.h -@@ -146,6 +146,18 @@ static inline void detect_ht(struct cpui - #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ - #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ - -+static inline void __cpuid(unsigned int *eax, unsigned int *ebx, -+ unsigned int *ecx, unsigned int *edx) -+{ -+ /* ecx is often an input as well as an output. */ -+ __asm__(XEN_CPUID -+ : "=a" (*eax), -+ "=b" (*ebx), -+ "=c" (*ecx), -+ "=d" (*edx) -+ : "0" (*eax), "2" (*ecx)); -+} -+ - /* - * Generic CPUID function - * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx -@@ -153,24 +165,18 @@ static inline void detect_ht(struct cpui - */ - static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) - { -- __asm__(XEN_CPUID -- : "=a" (*eax), -- "=b" (*ebx), -- "=c" (*ecx), -- "=d" (*edx) -- : "0" (op), "c"(0)); -+ *eax = op; -+ *ecx = 0; -+ __cpuid(eax, ebx, ecx, edx); - } - - /* Some CPUID calls want 'count' to be placed in ecx */ - static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, -- int *edx) -+ int *edx) - { -- __asm__(XEN_CPUID -- : "=a" (*eax), -- "=b" (*ebx), -- "=c" (*ecx), -- "=d" (*edx) -- : "0" (op), "c" (count)); -+ *eax = op; -+ *ecx = count; -+ __cpuid(eax, ebx, ecx, edx); - } - - /* -@@ -178,42 +184,30 @@ static inline void cpuid_count(int op, i - */ - static inline unsigned int cpuid_eax(unsigned int op) - { -- unsigned int eax; -+ unsigned int eax, ebx, ecx, edx; - -- __asm__(XEN_CPUID -- : "=a" (eax) -- : "0" (op) -- : "bx", "cx", "dx"); -+ cpuid(op, &eax, &ebx, &ecx, &edx); - return eax; - } - static inline unsigned int cpuid_ebx(unsigned int op) - { -- unsigned int eax, ebx; -+ unsigned int eax, ebx, ecx, edx; - -- __asm__(XEN_CPUID -- : "=a" (eax), "=b" (ebx) -- : "0" (op) -- : "cx", "dx" ); -+ cpuid(op, &eax, &ebx, &ecx, &edx); - return ebx; - } - static inline unsigned int cpuid_ecx(unsigned int op) - { -- unsigned int eax, ecx; -+ unsigned int eax, ebx, ecx, edx; - -- __asm__(XEN_CPUID -- : "=a" (eax), "=c" (ecx) -- : "0" (op) -- : "bx", "dx" ); -+ cpuid(op, &eax, &ebx, &ecx, &edx); - return ecx; - } - static inline unsigned int cpuid_edx(unsigned int op) - { -- unsigned int eax, edx; -+ unsigned int eax, ebx, ecx, edx; - -- __asm__(XEN_CPUID -- : "=a" (eax), "=d" (edx) -- : "0" (op) -- : "bx", "cx"); -+ cpuid(op, &eax, &ebx, &ecx, &edx); - return edx; - } - -@@ -315,6 +309,8 @@ static inline void __mwait(unsigned long - : :"a" (eax), "c" (ecx)); - } - -+extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); -+ - /* from system description table in BIOS. Mostly for MCA use, but - others may find it useful. */ - extern unsigned int machine_id; ---- a/arch/x86/include/mach-xen/asm/processor_64.h -+++ b/arch/x86/include/mach-xen/asm/processor_64.h -@@ -484,6 +484,8 @@ static inline void __mwait(unsigned long - : :"a" (eax), "c" (ecx)); - } - -+extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); -+ - #define stack_current() \ - ({ \ - struct thread_info *ti; \ ---- a/arch/x86/include/mach-xen/asm/smp_32.h -+++ b/arch/x86/include/mach-xen/asm/smp_32.h -@@ -79,25 +79,36 @@ static inline int hard_smp_processor_id( - return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); - } - #endif -- --static __inline int logical_smp_processor_id(void) --{ -- /* we don't want to mark this access volatile - bad code generation */ -- return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); --} -- - #endif - -+#define safe_smp_processor_id() smp_processor_id() - extern int __cpu_disable(void); - extern void __cpu_die(unsigned int cpu); - extern void prefill_possible_map(void); -+extern unsigned int num_processors; -+ - #endif /* !__ASSEMBLY__ */ - - #else /* CONFIG_SMP */ - -+#define safe_smp_processor_id() 0 - #define cpu_physical_id(cpu) boot_cpu_physical_apicid - - #define NO_PROC_ID 0xFF /* No processor magic marker */ - - #endif -+ -+#ifndef __ASSEMBLY__ -+ -+extern u8 apicid_2_node[]; -+ -+#ifdef CONFIG_X86_LOCAL_APIC -+static __inline int logical_smp_processor_id(void) -+{ -+ /* we don't want to mark this access volatile - bad code generation */ -+ return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); -+} -+#endif -+#endif -+ - #endif ---- a/arch/x86/include/mach-xen/asm/smp_64.h -+++ b/arch/x86/include/mach-xen/asm/smp_64.h -@@ -4,15 +4,12 @@ - /* - * We need the APIC definitions automatically as part of 'smp.h' - */ --#ifndef __ASSEMBLY__ - #include <linux/threads.h> - #include <linux/cpumask.h> - #include <linux/bitops.h> - extern int disable_apic; --#endif - - #ifdef CONFIG_X86_LOCAL_APIC --#ifndef __ASSEMBLY__ - #include <asm/fixmap.h> - #include <asm/mpspec.h> - #ifdef CONFIG_X86_IO_APIC -@@ -21,10 +18,8 @@ extern int disable_apic; - #include <asm/apic.h> - #include <asm/thread_info.h> - #endif --#endif - - #ifdef CONFIG_SMP --#ifndef ASSEMBLY - - #include <asm/pda.h> - -@@ -41,14 +36,11 @@ extern cpumask_t cpu_initialized; - - extern void smp_alloc_memory(void); - extern volatile unsigned long smp_invalidate_needed; --extern int pic_mode; - extern void lock_ipi_call_lock(void); - extern void unlock_ipi_call_lock(void); - extern int smp_num_siblings; - extern void smp_send_reschedule(int cpu); - void smp_stop_cpu(void); --extern int smp_call_function_single(int cpuid, void (*func) (void *info), -- void *info, int retry, int wait); - - extern cpumask_t cpu_sibling_map[NR_CPUS]; - extern cpumask_t cpu_core_map[NR_CPUS]; -@@ -77,20 +69,16 @@ static inline int hard_smp_processor_id( - } - #endif - --extern int safe_smp_processor_id(void); - extern int __cpu_disable(void); - extern void __cpu_die(unsigned int cpu); - extern void prefill_possible_map(void); - extern unsigned num_processors; - extern unsigned disabled_cpus; - --#endif /* !ASSEMBLY */ -- - #define NO_PROC_ID 0xFF /* No processor magic marker */ - - #endif - --#ifndef ASSEMBLY - /* - * Some lowlevel functions might want to know about - * the real APIC ID <-> CPU # mapping. -@@ -114,11 +102,8 @@ static inline int cpu_present_to_apicid( - } - #endif - --#endif /* !ASSEMBLY */ -- - #ifndef CONFIG_SMP - #define stack_smp_processor_id() 0 --#define safe_smp_processor_id() 0 - #define cpu_logical_map(x) (x) - #else - #include <asm/thread_info.h> -@@ -130,7 +115,6 @@ static inline int cpu_present_to_apicid( - }) - #endif - --#ifndef __ASSEMBLY__ - #ifdef CONFIG_X86_LOCAL_APIC - static __inline int logical_smp_processor_id(void) - { -@@ -138,13 +122,18 @@ static __inline int logical_smp_processo - return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); - } - #endif --#endif - - #ifdef CONFIG_SMP - #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] - #else - #define cpu_physical_id(cpu) boot_cpu_id --#endif -- -+static inline int smp_call_function_single(int cpuid, void (*func) (void *info), -+ void *info, int retry, int wait) -+{ -+ /* Disable interrupts here? */ -+ func(info); -+ return 0; -+} -+#endif /* !CONFIG_SMP */ - #endif - ---- a/arch/x86/include/mach-xen/asm/tlbflush_32.h -+++ b/arch/x86/include/mach-xen/asm/tlbflush_32.h -@@ -8,8 +8,6 @@ - #define __flush_tlb_global() xen_tlb_flush() - #define __flush_tlb_all() xen_tlb_flush() - --extern unsigned long pgkern_mask; -- - #define cpu_has_invlpg (boot_cpu_data.x86 > 3) - - #define __flush_tlb_single(addr) xen_invlpg(addr) ---- a/arch/x86/include/mach-xen/asm/tlbflush_64.h -+++ b/arch/x86/include/mach-xen/asm/tlbflush_64.h -@@ -12,9 +12,6 @@ - */ - #define __flush_tlb_global() xen_tlb_flush() - -- --extern unsigned long pgkern_mask; -- - #define __flush_tlb_all() __flush_tlb_global() - - #define __flush_tlb_one(addr) xen_invlpg((unsigned long)addr) ---- a/arch/x86/kernel/Makefile -+++ b/arch/x86/kernel/Makefile -@@ -107,7 +107,7 @@ obj-$(CONFIG_X86_XEN) += fixup.o - ### - # 64 bit specific files - ifeq ($(CONFIG_X86_64),y) -- obj-$(CONFIG_X86_XEN_GENAPIC) += genapic_xen_64.o -+ obj-$(CONFIG_X86_XEN_GENAPIC) += genapic_64.o genapic_xen_64.o - obj-$(CONFIG_AUDIT) += audit_64.o - - obj-$(CONFIG_GART_IOMMU) += amd_gart_64.o aperture_64.o -@@ -120,5 +120,7 @@ ifeq ($(CONFIG_X86_64),y) - pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o - endif - --disabled-obj-$(CONFIG_XEN) := i8237.o i8253.o i8259_$(BITS).o reboot.o smpboot_$(BITS).o tsc_$(BITS).o -+disabled-obj-$(CONFIG_XEN) := early-quirks.o i8237.o i8253.o i8259_$(BITS).o \ -+ reboot.o smpboot_$(BITS).o tsc_$(BITS).o -+disabled-obj-$(CONFIG_XEN_UNPRIVILEGED_GUEST) += mpparse_64.o - %/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := ---- a/arch/x86/kernel/acpi/boot.c -+++ b/arch/x86/kernel/acpi/boot.c +--- head.orig/arch/x86/kernel/acpi/boot.c 2012-05-23 12:40:44.000000000 +0200 ++++ head/arch/x86/kernel/acpi/boot.c 2012-05-23 13:04:45.000000000 +0200 @@ -70,8 +70,12 @@ int acpi_strict; u8 acpi_sci_flags __initdata; @@ -1421,8 +72,8 @@ Acked-by: jbeulich@novell.com static int __init parse_acpi_skip_timer_override(char *arg) { acpi_skip_timer_override = 1; ---- a/arch/x86/kernel/apic/apic-xen.c -+++ b/arch/x86/kernel/apic/apic-xen.c +--- head.orig/arch/x86/kernel/apic/apic-xen.c 2007-06-12 13:12:48.000000000 +0200 ++++ head/arch/x86/kernel/apic/apic-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -54,7 +54,6 @@ static cpumask_t timer_bcast_ipi; /* * Knob to control our willingness to enable the local APIC. @@ -1463,8 +114,8 @@ Acked-by: jbeulich@novell.com #endif } } ---- a/arch/x86/kernel/cpu/common-xen.c -+++ b/arch/x86/kernel/cpu/common-xen.c +--- head.orig/arch/x86/kernel/cpu/common-xen.c 2009-05-19 09:16:41.000000000 +0200 ++++ head/arch/x86/kernel/cpu/common-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -43,7 +43,7 @@ struct cpu_dev * cpu_devs[X86_VENDOR_NUM extern int disable_pse; @@ -1528,8 +179,8 @@ Acked-by: jbeulich@novell.com /* Clear all 6 debug registers: */ set_debugreg(0, 0); ---- a/arch/x86/kernel/cpu/mcheck/mce_dom0.c -+++ b/arch/x86/kernel/cpu/mcheck/mce_dom0.c +--- head.orig/arch/x86/kernel/cpu/mcheck/mce_dom0.c 2011-10-17 10:45:09.000000000 +0200 ++++ head/arch/x86/kernel/cpu/mcheck/mce_dom0.c 2011-08-15 10:44:20.000000000 +0200 @@ -53,8 +53,7 @@ static struct mc_info *g_mi; /*dom0 mce virq handler, logging physical mce error info*/ @@ -1548,549 +199,8 @@ Acked-by: jbeulich@novell.com + mce_dom0_interrupt(VIRQ_MCA, NULL); } ---- a/arch/x86/kernel/e820_64-xen.c -+++ b/arch/x86/kernel/e820_64-xen.c -@@ -16,6 +16,7 @@ - #include <linux/string.h> - #include <linux/kexec.h> - #include <linux/module.h> -+#include <linux/mm.h> - - #include <asm/pgtable.h> - #include <asm/page.h> -@@ -25,6 +26,11 @@ - #include <asm/sections.h> - #include <xen/interface/memory.h> - -+struct e820map e820 __initdata; -+#ifdef CONFIG_XEN -+struct e820map machine_e820 __initdata; -+#endif -+ - /* - * PFN of last memory page. - */ -@@ -43,14 +49,10 @@ unsigned long end_pfn_map; - /* - * Last pfn which the user wants to use. - */ --unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT; -+static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; - - extern struct resource code_resource, data_resource; - --#ifdef CONFIG_XEN --extern struct e820map machine_e820; --#endif -- - /* Check for some hardcoded bad areas that early boot is not allowed to touch */ - static inline int bad_addr(unsigned long *addrp, unsigned long size) - { -@@ -59,13 +61,13 @@ static inline int bad_addr(unsigned long - #ifndef CONFIG_XEN - /* various gunk below that needed for SMP startup */ - if (addr < 0x8000) { -- *addrp = 0x8000; -+ *addrp = PAGE_ALIGN(0x8000); - return 1; - } - - /* direct mapping tables of the kernel */ - if (last >= table_start<<PAGE_SHIFT && addr < table_end<<PAGE_SHIFT) { -- *addrp = table_end << PAGE_SHIFT; -+ *addrp = PAGE_ALIGN(table_end << PAGE_SHIFT); - return 1; - } - -@@ -73,23 +75,18 @@ static inline int bad_addr(unsigned long - #ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START && last >= INITRD_START && - addr < INITRD_START+INITRD_SIZE) { -- *addrp = INITRD_START + INITRD_SIZE; -+ *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); - return 1; - } - #endif -- /* kernel code + 640k memory hole (later should not be needed, but -- be paranoid for now) */ -- if (last >= 640*1024 && addr < 1024*1024) { -- *addrp = 1024*1024; -- return 1; -- } -- if (last >= __pa_symbol(&_text) && last < __pa_symbol(&_end)) { -- *addrp = __pa_symbol(&_end); -+ /* kernel code */ -+ if (last >= __pa_symbol(&_text) && addr < __pa_symbol(&_end)) { -+ *addrp = PAGE_ALIGN(__pa_symbol(&_end)); - return 1; - } - - if (last >= ebda_addr && addr < ebda_addr + ebda_size) { -- *addrp = ebda_addr + ebda_size; -+ *addrp = PAGE_ALIGN(ebda_addr + ebda_size); - return 1; - } - -@@ -186,7 +183,7 @@ unsigned long __init find_e820_area(unsi - continue; - while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size) - ; -- last = addr + size; -+ last = PAGE_ALIGN(addr) + size; - if (last > ei->addr + ei->size) - continue; - if (last > end) -@@ -196,59 +193,14 @@ unsigned long __init find_e820_area(unsi - return -1UL; - } - --/* -- * Free bootmem based on the e820 table for a node. -- */ --void __init e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end) --{ -- int i; -- for (i = 0; i < e820.nr_map; i++) { -- struct e820entry *ei = &e820.map[i]; -- unsigned long last, addr; -- -- if (ei->type != E820_RAM || -- ei->addr+ei->size <= start || -- ei->addr >= end) -- continue; -- -- addr = round_up(ei->addr, PAGE_SIZE); -- if (addr < start) -- addr = start; -- -- last = round_down(ei->addr + ei->size, PAGE_SIZE); -- if (last >= end) -- last = end; -- -- if (last > addr && last-addr >= PAGE_SIZE) -- free_bootmem_node(pgdat, addr, last-addr); -- } --} -- - /* - * Find the highest page frame number we have available - */ - unsigned long __init e820_end_of_ram(void) - { -- int i; - unsigned long end_pfn = 0; -+ end_pfn = find_max_pfn_with_active_regions(); - -- for (i = 0; i < e820.nr_map; i++) { -- struct e820entry *ei = &e820.map[i]; -- unsigned long start, end; -- -- start = round_up(ei->addr, PAGE_SIZE); -- end = round_down(ei->addr + ei->size, PAGE_SIZE); -- if (start >= end) -- continue; -- if (ei->type == E820_RAM) { -- if (end > end_pfn<<PAGE_SHIFT) -- end_pfn = end>>PAGE_SHIFT; -- } else { -- if (end > end_pfn_map<<PAGE_SHIFT) -- end_pfn_map = end>>PAGE_SHIFT; -- } -- } -- - if (end_pfn > end_pfn_map) - end_pfn_map = end_pfn; - if (end_pfn_map > MAXMEM>>PAGE_SHIFT) -@@ -258,43 +210,10 @@ unsigned long __init e820_end_of_ram(voi - if (end_pfn > end_pfn_map) - end_pfn = end_pfn_map; - -+ printk("end_pfn_map = %lu\n", end_pfn_map); - return end_pfn; - } - --/* -- * Compute how much memory is missing in a range. -- * Unlike the other functions in this file the arguments are in page numbers. -- */ --unsigned long __init --e820_hole_size(unsigned long start_pfn, unsigned long end_pfn) --{ -- unsigned long ram = 0; -- unsigned long start = start_pfn << PAGE_SHIFT; -- unsigned long end = end_pfn << PAGE_SHIFT; -- int i; -- for (i = 0; i < e820.nr_map; i++) { -- struct e820entry *ei = &e820.map[i]; -- unsigned long last, addr; -- -- if (ei->type != E820_RAM || -- ei->addr+ei->size <= start || -- ei->addr >= end) -- continue; -- -- addr = round_up(ei->addr, PAGE_SIZE); -- if (addr < start) -- addr = start; -- -- last = round_down(ei->addr + ei->size, PAGE_SIZE); -- if (last >= end) -- last = end; -- -- if (last > addr) -- ram += last - addr; -- } -- return ((end - start) - ram) >> PAGE_SHIFT; --} -- - /* - * Mark e820 reserved areas as busy for the resource manager. - */ -@@ -335,6 +254,109 @@ void __init e820_reserve_resources(struc - } - } - -+#ifndef CONFIG_XEN -+/* Mark pages corresponding to given address range as nosave */ -+static void __init -+e820_mark_nosave_range(unsigned long start, unsigned long end) -+{ -+ unsigned long pfn, max_pfn; -+ -+ if (start >= end) -+ return; -+ -+ printk("Nosave address range: %016lx - %016lx\n", start, end); -+ max_pfn = end >> PAGE_SHIFT; -+ for (pfn = start >> PAGE_SHIFT; pfn < max_pfn; pfn++) -+ if (pfn_valid(pfn)) -+ SetPageNosave(pfn_to_page(pfn)); -+} -+ -+/* -+ * Find the ranges of physical addresses that do not correspond to -+ * e820 RAM areas and mark the corresponding pages as nosave for software -+ * suspend and suspend to RAM. -+ * -+ * This function requires the e820 map to be sorted and without any -+ * overlapping entries and assumes the first e820 area to be RAM. -+ */ -+void __init e820_mark_nosave_regions(void) -+{ -+ int i; -+ unsigned long paddr; -+ -+ paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE); -+ for (i = 1; i < e820.nr_map; i++) { -+ struct e820entry *ei = &e820.map[i]; -+ -+ if (paddr < ei->addr) -+ e820_mark_nosave_range(paddr, -+ round_up(ei->addr, PAGE_SIZE)); -+ -+ paddr = round_down(ei->addr + ei->size, PAGE_SIZE); -+ if (ei->type != E820_RAM) -+ e820_mark_nosave_range(round_up(ei->addr, PAGE_SIZE), -+ paddr); -+ -+ if (paddr >= (end_pfn << PAGE_SHIFT)) -+ break; -+ } -+} -+#endif -+ -+/* Walk the e820 map and register active regions within a node */ -+void __init -+e820_register_active_regions(int nid, unsigned long start_pfn, -+ unsigned long end_pfn) -+{ -+ int i; -+ unsigned long ei_startpfn, ei_endpfn; -+ for (i = 0; i < e820.nr_map; i++) { -+ struct e820entry *ei = &e820.map[i]; -+ ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT; -+ ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) -+ >> PAGE_SHIFT; -+ -+ /* Skip map entries smaller than a page */ -+ if (ei_startpfn >= ei_endpfn) -+ continue; -+ -+ /* Check if end_pfn_map should be updated */ -+ if (ei->type != E820_RAM && ei_endpfn > end_pfn_map) -+ end_pfn_map = ei_endpfn; -+ -+ /* Skip if map is outside the node */ -+ if (ei->type != E820_RAM || -+ ei_endpfn <= start_pfn || -+ ei_startpfn >= end_pfn) -+ continue; -+ -+ /* Check for overlaps */ -+ if (ei_startpfn < start_pfn) -+ ei_startpfn = start_pfn; -+ if (ei_endpfn > end_pfn) -+ ei_endpfn = end_pfn; -+ -+ /* Obey end_user_pfn to save on memmap */ -+ if (ei_startpfn >= end_user_pfn) -+ continue; -+ if (ei_endpfn > end_user_pfn) -+ ei_endpfn = end_user_pfn; -+ -+#ifdef CONFIG_XEN -+ if (ei_startpfn >= xen_start_info->nr_pages) -+ continue; -+ if (ei_endpfn > xen_start_info->nr_pages) -+ ei_endpfn = xen_start_info->nr_pages; -+#endif -+ -+ add_active_range(nid, ei_startpfn, ei_endpfn); -+ } -+#ifdef CONFIG_XEN -+ BUG_ON(nid); -+ add_active_range(nid, end_pfn, end_pfn); -+#endif -+} -+ - /* - * Add a memory region to the kernel e820 map. - */ -@@ -555,13 +577,6 @@ static int __init sanitize_e820_map(stru - * If we're lucky and live on a modern system, the setup code - * will have given us a memory map that we can use to properly - * set up memory. If we aren't, we'll fake a memory map. -- * -- * We check to see that the memory map contains at least 2 elements -- * before we'll use it, because the detection code in setup.S may -- * not be perfect and most every PC known to man has two memory -- * regions: one from 0 to 640k, and one from 1mb up. (The IBM -- * thinkpad 560x, for example, does not cooperate with the memory -- * detection code.) - */ - static int __init copy_e820_map(struct e820entry * biosmap, int nr_map) - { -@@ -583,27 +598,6 @@ static int __init copy_e820_map(struct e - if (start > end) - return -1; - --#ifndef CONFIG_XEN -- /* -- * Some BIOSes claim RAM in the 640k - 1M region. -- * Not right. Fix it up. -- * -- * This should be removed on Hammer which is supposed to not -- * have non e820 covered ISA mappings there, but I had some strange -- * problems so it stays for now. -AK -- */ -- if (type == E820_RAM) { -- if (start < 0x100000ULL && end > 0xA0000ULL) { -- if (start < 0xA0000ULL) -- add_memory_region(start, 0xA0000ULL-start, type); -- if (end <= 0x100000ULL) -- continue; -- start = 0x100000ULL; -- size = end - start; -- } -- } --#endif -- - add_memory_region(start, size, type); - } while (biosmap++,--nr_map); - -@@ -624,11 +618,15 @@ static int __init copy_e820_map(struct e - return 0; - } - -+void early_panic(char *msg) -+{ -+ early_printk(msg); -+ panic(msg); -+} -+ - #ifndef CONFIG_XEN - void __init setup_memory_region(void) - { -- char *who = "BIOS-e820"; -- - /* - * Try to copy the BIOS-supplied E820-map. - * -@@ -636,24 +634,10 @@ void __init setup_memory_region(void) - * the next section from 1mb->appropriate_mem_k - */ - sanitize_e820_map(E820_MAP, &E820_MAP_NR); -- if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { -- unsigned long mem_size; -- -- /* compare results from other methods and take the greater */ -- if (ALT_MEM_K < EXT_MEM_K) { -- mem_size = EXT_MEM_K; -- who = "BIOS-88"; -- } else { -- mem_size = ALT_MEM_K; -- who = "BIOS-e801"; -- } -- -- e820.nr_map = 0; -- add_memory_region(0, LOWMEMSIZE(), E820_RAM); -- add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); -- } -+ if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) -+ early_panic("Cannot find a valid memory map"); - printk(KERN_INFO "BIOS-provided physical RAM map:\n"); -- e820_print_map(who); -+ e820_print_map("BIOS-e820"); - } - - #else /* CONFIG_XEN */ -@@ -685,20 +669,23 @@ void __init setup_memory_region(void) - - sanitize_e820_map(map, (char *)&memmap.nr_entries); - -- BUG_ON(copy_e820_map(map, (char)memmap.nr_entries) < 0); -+ if (copy_e820_map(map, (char)memmap.nr_entries) < 0) -+ early_panic("Cannot find a valid memory map"); - - printk(KERN_INFO "BIOS-provided physical RAM map:\n"); - e820_print_map("Xen"); - } - #endif - --void __init parse_memopt(char *p, char **from) --{ -+static int __init parse_memopt(char *p) -+{ - int i; - unsigned long current_end; - unsigned long end; - -- end_user_pfn = memparse(p, from); -+ if (!p) -+ return -EINVAL; -+ end_user_pfn = memparse(p, &p); - end_user_pfn >>= PAGE_SHIFT; - - end = end_user_pfn<<PAGE_SHIFT; -@@ -715,27 +702,61 @@ void __init parse_memopt(char *p, char * - else - add_memory_region(current_end, end - current_end, E820_RAM); - } -+ -+ return 0; - } -+early_param("mem", parse_memopt); - --void __init parse_memmapopt(char *p, char **from) -+static int userdef __initdata; -+ -+static int __init parse_memmap_opt(char *p) - { -+ char *oldp; - unsigned long long start_at, mem_size; - -- mem_size = memparse(p, from); -- p = *from; -+ if (!strcmp(p, "exactmap")) { -+#ifdef CONFIG_CRASH_DUMP -+ /* If we are doing a crash dump, we -+ * still need to know the real mem -+ * size before original memory map is -+ * reset. -+ */ -+ e820_register_active_regions(0, 0, -1UL); -+ saved_max_pfn = e820_end_of_ram(); -+ remove_all_active_ranges(); -+#endif -+ end_pfn_map = 0; -+ e820.nr_map = 0; -+ userdef = 1; -+ return 0; -+ } -+ -+ oldp = p; -+ mem_size = memparse(p, &p); -+ if (p == oldp) -+ return -EINVAL; - if (*p == '@') { -- start_at = memparse(p+1, from); -+ start_at = memparse(p+1, &p); - add_memory_region(start_at, mem_size, E820_RAM); - } else if (*p == '#') { -- start_at = memparse(p+1, from); -+ start_at = memparse(p+1, &p); - add_memory_region(start_at, mem_size, E820_ACPI); - } else if (*p == '$') { -- start_at = memparse(p+1, from); -+ start_at = memparse(p+1, &p); - add_memory_region(start_at, mem_size, E820_RESERVED); - } else { - end_user_pfn = (mem_size >> PAGE_SHIFT); - } -- p = *from; -+ return *p == '\0' ? 0 : -EINVAL; -+} -+early_param("memmap", parse_memmap_opt); -+ -+void finish_e820_parsing(void) -+{ -+ if (userdef) { -+ printk(KERN_INFO "user-defined physical RAM map:\n"); -+ e820_print_map("user"); -+ } - } - - unsigned long pci_mem_start = 0xaeedbabe; ---- a/arch/x86/kernel/early_printk-xen.c -+++ b/arch/x86/kernel/early_printk-xen.c -@@ -244,20 +244,16 @@ void early_printk(const char *fmt, ...) - - static int __initdata keep_early; - --int __init setup_early_printk(char *opt) -+static int __init setup_early_printk(char *buf) - { -- char *space; -- char buf[256]; -+ if (!buf) -+ return 0; - - if (early_console_initialized) -- return 1; -- -- strlcpy(buf,opt,sizeof(buf)); -- space = strchr(buf, ' '); -- if (space) -- *space = 0; -+ return 0; -+ early_console_initialized = 1; - -- if (strstr(buf,"keep")) -+ if (strstr(buf, "keep")) - keep_early = 1; - - if (!strncmp(buf, "serial", 6)) { -@@ -281,11 +277,12 @@ int __init setup_early_printk(char *opt) - early_console = &simnow_console; - keep_early = 1; - } -- early_console_initialized = 1; - register_console(early_console); - return 0; - } - -+early_param("earlyprintk", setup_early_printk); -+ - void __init disable_early_printk(void) - { - if (!early_console_initialized || !early_console) -@@ -299,4 +296,3 @@ void __init disable_early_printk(void) - } - } - --__setup("earlyprintk=", setup_early_printk); ---- a/arch/x86/kernel/entry_32-xen.S -+++ b/arch/x86/kernel/entry_32-xen.S +--- head.orig/arch/x86/kernel/entry_32-xen.S 2009-05-19 09:16:41.000000000 +0200 ++++ head/arch/x86/kernel/entry_32-xen.S 2011-01-31 17:29:16.000000000 +0100 @@ -80,8 +80,12 @@ VM_MASK = 0x00020000 NMI_MASK = 0x80000000 @@ -2477,345 +587,8 @@ Acked-by: jbeulich@novell.com .section .rodata,"a" #include "syscall_table.S" ---- a/arch/x86/kernel/entry_64-xen.S -+++ b/arch/x86/kernel/entry_64-xen.S -@@ -4,9 +4,6 @@ - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs - * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> -- * -- * $Id$ -- * - * Jun Nakajima <jun.nakajima@intel.com> - * Asit Mallick <asit.k.mallick@intel.com> - * Modified for Xen -@@ -26,15 +23,25 @@ - * at the top of the kernel process stack. - * - partial stack frame: partially saved registers upto R11. - * - full stack frame: Like partial stack frame, but all register saved. -- * -- * TODO: -- * - schedule it carefully for the final hardware. -+ * -+ * Some macro usage: -+ * - CFI macros are used to generate dwarf2 unwind information for better -+ * backtraces. They don't change any code. -+ * - SAVE_ALL/RESTORE_ALL - Save/restore all registers -+ * - SAVE_ARGS/RESTORE_ARGS - Save/restore registers that C functions modify. -+ * There are unfortunately lots of special cases where some registers -+ * not touched. The macro is a big mess that should be cleaned up. -+ * - SAVE_REST/RESTORE_REST - Handle the registers not saved by SAVE_ARGS. -+ * Gives a full stack frame. -+ * - ENTRY/END Define functions in the symbol table. -+ * - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack -+ * frame that is otherwise undefined after a SYSCALL -+ * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging. -+ * - errorentry/paranoidentry/zeroentry - Define exception entry points. - */ - --#define ASSEMBLY 1 - #include <linux/linkage.h> - #include <asm/segment.h> --#include <asm/smp.h> - #include <asm/cache.h> - #include <asm/errno.h> - #include <asm/dwarf2.h> -@@ -117,6 +124,7 @@ NMI_MASK = 0x80000000 - .macro CFI_DEFAULT_STACK start=1,adj=0 - .if \start - CFI_STARTPROC simple -+ CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8 - \adj*ARGOFFSET - .else - CFI_DEF_CFA_OFFSET SS+8 - \adj*ARGOFFSET -@@ -209,6 +217,7 @@ END(ret_from_fork) - */ - .macro _frame ref - CFI_STARTPROC simple -+ CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8-\ref - /*CFI_REL_OFFSET ss,SS-\ref*/ - CFI_REL_OFFSET rsp,RSP-\ref -@@ -337,6 +346,8 @@ tracesys: - LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ - RESTORE_REST - cmpq $__NR_syscall_max,%rax -+ movq $-ENOSYS,%rcx -+ cmova %rcx,%rax - ja 1f - movq %r10,%rcx /* fixup for C */ - call *sys_call_table(,%rax,8) -@@ -352,6 +363,7 @@ END(system_call) - */ - ENTRY(int_ret_from_sys_call) - CFI_STARTPROC simple -+ CFI_SIGNAL_FRAME - CFI_DEF_CFA rsp,SS+8-ARGOFFSET - /*CFI_REL_OFFSET ss,SS-ARGOFFSET*/ - CFI_REL_OFFSET rsp,RSP-ARGOFFSET -@@ -586,8 +598,7 @@ retint_signal: - #ifdef CONFIG_PREEMPT - /* Returning to kernel space. Check if we need preemption */ - /* rcx: threadinfo. interrupts off. */ -- .p2align --retint_kernel: -+ENTRY(retint_kernel) - cmpl $0,threadinfo_preempt_count(%rcx) - jnz retint_restore_args - bt $TIF_NEED_RESCHED,threadinfo_flags(%rcx) -@@ -647,7 +658,6 @@ ENTRY(call_function_interrupt) - END(call_function_interrupt) - #endif - --#ifdef CONFIG_X86_LOCAL_APIC - ENTRY(apic_timer_interrupt) - apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt - END(apic_timer_interrupt) -@@ -659,7 +669,6 @@ END(error_interrupt) - ENTRY(spurious_interrupt) - apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt - END(spurious_interrupt) --#endif - #endif /* !CONFIG_XEN */ - - /* -@@ -758,7 +767,9 @@ paranoid_exit\trace: - testl $3,CS(%rsp) - jnz paranoid_userspace\trace - paranoid_swapgs\trace: -+ .if \trace - TRACE_IRQS_IRETQ 0 -+ .endif - swapgs - paranoid_restore\trace: - RESTORE_ALL 8 -@@ -805,7 +816,7 @@ paranoid_schedule\trace: - * Exception entry point. This expects an error code/orig_rax on the stack - * and the exception handler in %rax. - */ --ENTRY(error_entry) -+KPROBE_ENTRY(error_entry) - _frame RDI - CFI_REL_OFFSET rax,0 - /* rdi slot contains rax, oldrax contains error code */ -@@ -899,7 +910,7 @@ error_kernelspace: - jmp error_sti - #endif - CFI_ENDPROC --END(error_entry) -+KPROBE_END(error_entry) - - ENTRY(hypervisor_callback) - zeroentry do_hypervisor_callback -@@ -939,26 +950,6 @@ ENTRY(do_hypervisor_callback) # do_hyp - CFI_ENDPROC - END(do_hypervisor_callback) - --#ifdef CONFIG_X86_LOCAL_APIC --KPROBE_ENTRY(nmi) -- zeroentry do_nmi_callback --ENTRY(do_nmi_callback) -- CFI_STARTPROC -- addq $8, %rsp -- CFI_ENDPROC -- CFI_DEFAULT_STACK -- call do_nmi -- orl $NMI_MASK,EFLAGS(%rsp) -- RESTORE_REST -- XEN_BLOCK_EVENTS(%rsi) -- TRACE_IRQS_OFF -- GET_THREAD_INFO(%rcx) -- jmp retint_restore_args -- CFI_ENDPROC -- .previous .text --END(nmi) --#endif -- - ALIGN - restore_all_enable_events: - CFI_DEFAULT_STACK adj=1 -@@ -1124,7 +1115,7 @@ ENDPROC(child_rip) - * do_sys_execve asm fallback arguments: - * rdi: name, rsi: argv, rdx: envp, fake frame on the stack - */ --ENTRY(execve) -+ENTRY(kernel_execve) - CFI_STARTPROC - FAKE_STACK_FRAME $0 - SAVE_ALL -@@ -1138,12 +1129,11 @@ ENTRY(execve) - UNFAKE_STACK_FRAME - ret - CFI_ENDPROC --ENDPROC(execve) -+ENDPROC(kernel_execve) - - KPROBE_ENTRY(page_fault) - errorentry do_page_fault --END(page_fault) -- .previous .text -+KPROBE_END(page_fault) - - ENTRY(coprocessor_error) - zeroentry do_coprocessor_error -@@ -1165,25 +1155,25 @@ KPROBE_ENTRY(debug) - zeroentry do_debug - /* paranoidexit - CFI_ENDPROC */ --END(debug) -- .previous .text -+KPROBE_END(debug) - --#if 0 -- /* runs on exception stack */ - KPROBE_ENTRY(nmi) -- INTR_FRAME -- pushq $-1 -- CFI_ADJUST_CFA_OFFSET 8 -- paranoidentry do_nmi, 0, 0 --#ifdef CONFIG_TRACE_IRQFLAGS -- paranoidexit 0 --#else -- jmp paranoid_exit1 -- CFI_ENDPROC --#endif --END(nmi) -- .previous .text --#endif -+ zeroentry do_nmi_callback -+KPROBE_END(nmi) -+do_nmi_callback: -+ CFI_STARTPROC -+ addq $8, %rsp -+ CFI_ENDPROC -+ CFI_DEFAULT_STACK -+ call do_nmi -+ orl $NMI_MASK,EFLAGS(%rsp) -+ RESTORE_REST -+ XEN_BLOCK_EVENTS(%rsi) -+ TRACE_IRQS_OFF -+ GET_THREAD_INFO(%rcx) -+ jmp retint_restore_args -+ CFI_ENDPROC -+END(do_nmi_callback) - - KPROBE_ENTRY(int3) - /* INTR_FRAME -@@ -1192,8 +1182,7 @@ KPROBE_ENTRY(int3) - zeroentry do_int3 - /* jmp paranoid_exit1 - CFI_ENDPROC */ --END(int3) -- .previous .text -+KPROBE_END(int3) - - ENTRY(overflow) - zeroentry do_overflow -@@ -1244,8 +1233,7 @@ END(stack_segment) - - KPROBE_ENTRY(general_protection) - errorentry do_general_protection --END(general_protection) -- .previous .text -+KPROBE_END(general_protection) - - ENTRY(alignment_check) - errorentry do_alignment_check ---- a/arch/x86/kernel/head64-xen.c -+++ b/arch/x86/kernel/head64-xen.c -@@ -7,6 +7,9 @@ - * Modified for Xen. - */ - -+/* PDA is not ready to be used until the end of x86_64_start_kernel(). */ -+#define arch_use_lazy_mmu_mode() false -+ - #include <linux/init.h> - #include <linux/linkage.h> - #include <linux/types.h> -@@ -54,11 +57,9 @@ static void __init copy_bootdata(char *r - new_data = *(int *) (x86_boot_params + NEW_CL_POINTER); - if (!new_data) { - if (OLD_CL_MAGIC != * (u16 *) OLD_CL_MAGIC_ADDR) { -- printk("so old bootloader that it does not support commandline?!\n"); - return; - } - new_data = OLD_CL_BASE_ADDR + * (u16 *) OLD_CL_OFFSET; -- printk("old bootloader convention, maybe loadlin?\n"); - } - command_line = (char *) ((u64)(new_data)); - memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); -@@ -70,25 +71,6 @@ static void __init copy_bootdata(char *r - memcpy(saved_command_line, xen_start_info->cmd_line, max_cmdline); - saved_command_line[max_cmdline-1] = '\0'; - #endif -- printk("Bootdata ok (command line is %s)\n", saved_command_line); --} -- --static void __init setup_boot_cpu_data(void) --{ -- unsigned int dummy, eax; -- -- /* get vendor info */ -- cpuid(0, (unsigned int *)&boot_cpu_data.cpuid_level, -- (unsigned int *)&boot_cpu_data.x86_vendor_id[0], -- (unsigned int *)&boot_cpu_data.x86_vendor_id[8], -- (unsigned int *)&boot_cpu_data.x86_vendor_id[4]); -- -- /* get cpu type */ -- cpuid(1, &eax, &dummy, &dummy, -- (unsigned int *) &boot_cpu_data.x86_capability); -- boot_cpu_data.x86 = (eax >> 8) & 0xf; -- boot_cpu_data.x86_model = (eax >> 4) & 0xf; -- boot_cpu_data.x86_mask = eax & 0xf; - } - - #include <xen/interface/memory.h> -@@ -100,7 +82,6 @@ EXPORT_SYMBOL(machine_to_phys_nr); - void __init x86_64_start_kernel(char * real_mode_data) - { - struct xen_machphys_mapping mapping; -- char *s; - int i; - - setup_xen_features(); -@@ -125,10 +106,7 @@ void __init x86_64_start_kernel(char * r - asm volatile("lidt %0" :: "m" (idt_descr)); - #endif - -- /* -- * This must be called really, really early: -- */ -- lockdep_init(); -+ early_printk("Kernel alive\n"); - - for (i = 0; i < NR_CPUS; i++) - cpu_pda(i) = &boot_cpu_pda[i]; -@@ -138,22 +116,5 @@ void __init x86_64_start_kernel(char * r - #ifdef CONFIG_SMP - cpu_set(0, cpu_online_map); - #endif -- s = strstr(saved_command_line, "earlyprintk="); -- if (s != NULL) -- setup_early_printk(strchr(s, '=') + 1); --#ifdef CONFIG_NUMA -- s = strstr(saved_command_line, "numa="); -- if (s != NULL) -- numa_setup(s+5); --#endif --#ifdef CONFIG_X86_IO_APIC -- if (strstr(saved_command_line, "disableapic")) -- disable_apic = 1; --#endif -- /* You need early console to see that */ -- if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE) -- panic("Kernel too big for kernel mapping\n"); -- -- setup_boot_cpu_data(); - start_kernel(); - } ---- a/arch/x86/kernel/head_32-xen.S -+++ b/arch/x86/kernel/head_32-xen.S +--- head.orig/arch/x86/kernel/head_32-xen.S 2011-08-08 12:54:10.000000000 +0200 ++++ head/arch/x86/kernel/head_32-xen.S 2011-08-09 10:35:35.000000000 +0200 @@ -63,7 +63,7 @@ ENTRY(startup_32) movl %eax,%gs cld # gcc2 wants the direction flag cleared at all times @@ -2825,29 +598,8 @@ Acked-by: jbeulich@novell.com jmp start_kernel #define HYPERCALL_PAGE_OFFSET 0x1000 ---- a/arch/x86/kernel/head_64-xen.S -+++ b/arch/x86/kernel/head_64-xen.S -@@ -5,9 +5,6 @@ - * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> - * Copyright (C) 2000 Karsten Keil <kkeil@suse.de> - * Copyright (C) 2001,2002 Andi Kleen <ak@suse.de> -- * -- * $Id: head.S,v 1.49 2002/03/19 17:39:25 ak Exp $ -- * - * Jun Nakajima <jun.nakajima@intel.com> - * Modified for Xen - */ -@@ -147,7 +144,7 @@ ENTRY(cpu_gdt_table) - .quad 0,0 /* TSS */ - .quad 0,0 /* LDT */ - .quad 0,0,0 /* three TLS descriptors */ -- .quad 0 /* unused */ -+ .quad 0x0000f40000000000 /* node/CPU stored in limit */ - gdt_end: - /* asm/segment.h:GDT_ENTRIES must match this */ - /* This should be a multiple of the cache line size */ ---- a/arch/x86/kernel/io_apic_32-xen.c -+++ b/arch/x86/kernel/io_apic_32-xen.c +--- head.orig/arch/x86/kernel/io_apic_32-xen.c 2009-03-18 10:39:31.000000000 +0100 ++++ head/arch/x86/kernel/io_apic_32-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -31,6 +31,9 @@ #include <linux/acpi.h> #include <linux/module.h> @@ -3048,7 +800,7 @@ Acked-by: jbeulich@novell.com #endif /* -@@ -159,9 +251,7 @@ static void add_pin_to_irq(unsigned int +@@ -159,9 +251,7 @@ static void add_pin_to_irq(unsigned int entry->pin = pin; } @@ -3529,7 +1281,7 @@ Acked-by: jbeulich@novell.com { unsigned long v; -@@ -2228,21 +2179,19 @@ static void disable_lapic_irq (unsigned +@@ -2228,21 +2179,19 @@ static void disable_lapic_irq (unsigned apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); } @@ -3927,8 +1679,3547 @@ Acked-by: jbeulich@novell.com + return 0; +} +early_param("noapic", parse_noapic); ---- a/arch/x86/kernel/io_apic_64-xen.c -+++ b/arch/x86/kernel/io_apic_64-xen.c +--- head.orig/arch/x86/kernel/ldt_32-xen.c 2007-06-12 13:12:48.000000000 +0200 ++++ head/arch/x86/kernel/ldt_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -1,5 +1,5 @@ + /* +- * linux/kernel/ldt.c ++ * linux/arch/i386/kernel/ldt.c + * + * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds + * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> +--- head.orig/arch/x86/kernel/microcode_core-xen.c 2011-12-21 10:11:41.000000000 +0100 ++++ head/arch/x86/kernel/microcode_core-xen.c 2011-12-01 14:59:39.000000000 +0100 +@@ -2,6 +2,7 @@ + * Intel CPU Microcode Update Driver for Linux + * + * Copyright (C) 2000-2004 Tigran Aivazian ++ * 2006 Shaohua Li <shaohua.li@intel.com> + * + * This driver allows to upgrade microcode on Intel processors + * belonging to IA-32 family - PentiumPro, Pentium II, +@@ -33,7 +34,9 @@ + #include <linux/spinlock.h> + #include <linux/mm.h> + #include <linux/mutex.h> +-#include <linux/syscalls.h> ++#include <linux/cpu.h> ++#include <linux/firmware.h> ++#include <linux/platform_device.h> + + #include <asm/msr.h> + #include <asm/uaccess.h> +@@ -55,12 +58,7 @@ module_param(verbose, int, 0644); + /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ + static DEFINE_MUTEX(microcode_mutex); + +-static int microcode_open (struct inode *unused1, struct file *unused2) +-{ +- return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; +-} +- +- ++#ifdef CONFIG_MICROCODE_OLD_INTERFACE + static int do_microcode_update (const void __user *ubuf, size_t len) + { + int err; +@@ -85,6 +83,11 @@ static int do_microcode_update (const vo + return err; + } + ++static int microcode_open (struct inode *unused1, struct file *unused2) ++{ ++ return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; ++} ++ + static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos) + { + ssize_t ret; +@@ -117,7 +120,7 @@ static struct miscdevice microcode_dev = + .fops = µcode_fops, + }; + +-static int __init microcode_init (void) ++static int __init microcode_dev_init (void) + { + int error; + +@@ -132,6 +135,68 @@ static int __init microcode_init (void) + return error; + } + ++ return 0; ++} ++ ++static void __exit microcode_dev_exit (void) ++{ ++ misc_deregister(µcode_dev); ++} ++ ++MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); ++#else ++#define microcode_dev_init() 0 ++#define microcode_dev_exit() do { } while(0) ++#endif ++ ++/* fake device for request_firmware */ ++static struct platform_device *microcode_pdev; ++ ++static int request_microcode(void) ++{ ++ char name[30]; ++ const struct cpuinfo_x86 *c = &boot_cpu_data; ++ const struct firmware *firmware; ++ int error; ++ struct xen_platform_op op; ++ ++ sprintf(name,"intel-ucode/%02x-%02x-%02x", ++ c->x86, c->x86_model, c->x86_mask); ++ error = request_firmware(&firmware, name, µcode_pdev->dev); ++ if (error) { ++ pr_debug("ucode data file %s load failed\n", name); ++ return error; ++ } ++ ++ op.cmd = XENPF_microcode_update; ++ set_xen_guest_handle(op.u.microcode.data, (void *)firmware->data); ++ op.u.microcode.length = firmware->size; ++ error = HYPERVISOR_platform_op(&op); ++ ++ release_firmware(firmware); ++ ++ if (error) ++ pr_debug("ucode load failed\n"); ++ ++ return error; ++} ++ ++static int __init microcode_init (void) ++{ ++ int error; ++ ++ error = microcode_dev_init(); ++ if (error) ++ return error; ++ microcode_pdev = platform_device_register_simple("microcode", -1, ++ NULL, 0); ++ if (IS_ERR(microcode_pdev)) { ++ microcode_dev_exit(); ++ return PTR_ERR(microcode_pdev); ++ } ++ ++ request_microcode(); ++ + printk(KERN_INFO + "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " <tigran@veritas.com>\n"); + return 0; +@@ -139,9 +204,9 @@ static int __init microcode_init (void) + + static void __exit microcode_exit (void) + { +- misc_deregister(µcode_dev); ++ microcode_dev_exit(); ++ platform_device_unregister(microcode_pdev); + } + + module_init(microcode_init) + module_exit(microcode_exit) +-MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); +--- head.orig/arch/x86/kernel/mpparse_32-xen.c 2007-06-12 13:12:48.000000000 +0200 ++++ head/arch/x86/kernel/mpparse_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -30,6 +30,7 @@ + #include <asm/io_apic.h> + + #include <mach_apic.h> ++#include <mach_apicdef.h> + #include <mach_mpparse.h> + #include <bios_ebda.h> + +@@ -68,7 +69,7 @@ unsigned int def_to_bigsmp = 0; + /* Processor that is doing the boot up */ + unsigned int boot_cpu_physical_apicid = -1U; + /* Internal processor count */ +-static unsigned int __devinitdata num_processors; ++unsigned int __cpuinitdata num_processors; + + /* Bitmask of physically existing CPUs */ + physid_mask_t phys_cpu_present_map; +@@ -235,12 +236,14 @@ static void __init MP_bus_info (struct m + + mpc_oem_bus_info(m, str, translation_table[mpc_record]); + ++#if MAX_MP_BUSSES < 256 + if (m->mpc_busid >= MAX_MP_BUSSES) { + printk(KERN_WARNING "MP table busid value (%d) for bustype %s " + " is too large, max. supported is %d\n", + m->mpc_busid, str, MAX_MP_BUSSES - 1); + return; + } ++#endif + + if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) { + mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; +@@ -300,19 +303,6 @@ static void __init MP_lintsrc_info (stru + m->mpc_irqtype, m->mpc_irqflag & 3, + (m->mpc_irqflag >> 2) &3, m->mpc_srcbusid, + m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); +- /* +- * Well it seems all SMP boards in existence +- * use ExtINT/LVT1 == LINT0 and +- * NMI/LVT2 == LINT1 - the following check +- * will show us if this assumptions is false. +- * Until then we do not have to add baggage. +- */ +- if ((m->mpc_irqtype == mp_ExtINT) && +- (m->mpc_destapiclint != 0)) +- BUG(); +- if ((m->mpc_irqtype == mp_NMI) && +- (m->mpc_destapiclint != 1)) +- BUG(); + } + + #ifdef CONFIG_X86_NUMAQ +@@ -838,8 +828,7 @@ int es7000_plat; + + #ifdef CONFIG_ACPI + +-void __init mp_register_lapic_address ( +- u64 address) ++void __init mp_register_lapic_address(u64 address) + { + #ifndef CONFIG_XEN + mp_lapic_addr = (unsigned long) address; +@@ -853,13 +842,10 @@ void __init mp_register_lapic_address ( + #endif + } + +- +-void __devinit mp_register_lapic ( +- u8 id, +- u8 enabled) ++void __devinit mp_register_lapic (u8 id, u8 enabled) + { + struct mpc_config_processor processor; +- int boot_cpu = 0; ++ int boot_cpu = 0; + + if (MAX_APICS - id <= 0) { + printk(KERN_WARNING "Processor #%d invalid (max %d)\n", +@@ -898,11 +884,9 @@ static struct mp_ioapic_routing { + u32 pin_programmed[4]; + } mp_ioapic_routing[MAX_IO_APICS]; + +- +-static int mp_find_ioapic ( +- int gsi) ++static int mp_find_ioapic (int gsi) + { +- int i = 0; ++ int i = 0; + + /* Find the IOAPIC that manages this GSI. */ + for (i = 0; i < nr_ioapics; i++) { +@@ -915,15 +899,11 @@ static int mp_find_ioapic ( + + return -1; + } +- + +-void __init mp_register_ioapic ( +- u8 id, +- u32 address, +- u32 gsi_base) ++void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base) + { +- int idx = 0; +- int tmpid; ++ int idx = 0; ++ int tmpid; + + if (nr_ioapics >= MAX_IO_APICS) { + printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " +@@ -971,16 +951,10 @@ void __init mp_register_ioapic ( + mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, + mp_ioapic_routing[idx].gsi_base, + mp_ioapic_routing[idx].gsi_end); +- +- return; + } + +- +-void __init mp_override_legacy_irq ( +- u8 bus_irq, +- u8 polarity, +- u8 trigger, +- u32 gsi) ++void __init ++mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) + { + struct mpc_config_intsrc intsrc; + int ioapic = -1; +@@ -1018,15 +992,13 @@ void __init mp_override_legacy_irq ( + mp_irqs[mp_irq_entries] = intsrc; + if (++mp_irq_entries == MAX_IRQ_SOURCES) + panic("Max # of irq sources exceeded!\n"); +- +- return; + } + + void __init mp_config_acpi_legacy_irqs (void) + { + struct mpc_config_intsrc intsrc; +- int i = 0; +- int ioapic = -1; ++ int i = 0; ++ int ioapic = -1; + + /* + * Fabricate the legacy ISA bus (bus #31). +@@ -1095,12 +1067,12 @@ void __init mp_config_acpi_legacy_irqs ( + + #define MAX_GSI_NUM 4096 + +-int mp_register_gsi (u32 gsi, int triggering, int polarity) ++int mp_register_gsi(u32 gsi, int triggering, int polarity) + { +- int ioapic = -1; +- int ioapic_pin = 0; +- int idx, bit = 0; +- static int pci_irq = 16; ++ int ioapic = -1; ++ int ioapic_pin = 0; ++ int idx, bit = 0; ++ static int pci_irq = 16; + /* + * Mapping between Global System Interrups, which + * represent all possible interrupts, and IRQs +--- head.orig/arch/x86/kernel/pci-dma-xen.c 2009-11-06 10:23:23.000000000 +0100 ++++ head/arch/x86/kernel/pci-dma-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -110,8 +110,7 @@ dma_map_sg(struct device *hwdev, struct + { + int i, rc; + +- if (direction == DMA_NONE) +- BUG(); ++ BUG_ON(!valid_dma_direction(direction)); + WARN_ON(nents == 0 || sg[0].length == 0); + + if (swiotlb) { +@@ -142,7 +141,7 @@ dma_unmap_sg(struct device *hwdev, struc + { + int i; + +- BUG_ON(direction == DMA_NONE); ++ BUG_ON(!valid_dma_direction(direction)); + if (swiotlb) + swiotlb_unmap_sg(hwdev, sg, nents, direction); + else { +@@ -159,8 +158,7 @@ dma_map_page(struct device *dev, struct + { + dma_addr_t dma_addr; + +- BUG_ON(direction == DMA_NONE); +- ++ BUG_ON(!valid_dma_direction(direction)); + if (swiotlb) { + dma_addr = swiotlb_map_page( + dev, page, offset, size, direction); +@@ -177,7 +175,7 @@ void + dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, + enum dma_data_direction direction) + { +- BUG_ON(direction == DMA_NONE); ++ BUG_ON(!valid_dma_direction(direction)); + if (swiotlb) + swiotlb_unmap_page(dev, dma_address, size, direction); + else +@@ -356,8 +354,7 @@ dma_map_single(struct device *dev, void + { + dma_addr_t dma; + +- if (direction == DMA_NONE) +- BUG(); ++ BUG_ON(!valid_dma_direction(direction)); + WARN_ON(size == 0); + + if (swiotlb) { +@@ -378,8 +375,7 @@ void + dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, + enum dma_data_direction direction) + { +- if (direction == DMA_NONE) +- BUG(); ++ BUG_ON(!valid_dma_direction(direction)); + if (swiotlb) + swiotlb_unmap_single(dev, dma_addr, size, direction); + else +--- head.orig/arch/x86/kernel/process_32-xen.c 2008-07-21 11:00:32.000000000 +0200 ++++ head/arch/x86/kernel/process_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -37,6 +37,7 @@ + #include <linux/kallsyms.h> + #include <linux/ptrace.h> + #include <linux/random.h> ++#include <linux/personality.h> + + #include <asm/uaccess.h> + #include <asm/pgtable.h> +@@ -186,7 +187,7 @@ void cpu_idle(void) + void cpu_idle_wait(void) + { + unsigned int cpu, this_cpu = get_cpu(); +- cpumask_t map; ++ cpumask_t map, tmp = current->cpus_allowed; + + set_cpus_allowed(current, cpumask_of_cpu(this_cpu)); + put_cpu(); +@@ -208,6 +209,8 @@ void cpu_idle_wait(void) + } + cpus_and(map, map, cpu_online_map); + } while (!cpus_empty(map)); ++ ++ set_cpus_allowed(current, tmp); + } + EXPORT_SYMBOL_GPL(cpu_idle_wait); + +@@ -240,9 +243,9 @@ void show_regs(struct pt_regs * regs) + if (user_mode_vm(regs)) + printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); + printk(" EFLAGS: %08lx %s (%s %.*s)\n", +- regs->eflags, print_tainted(), system_utsname.release, +- (int)strcspn(system_utsname.version, " "), +- system_utsname.version); ++ regs->eflags, print_tainted(), init_utsname()->release, ++ (int)strcspn(init_utsname()->version, " "), ++ init_utsname()->version); + printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", + regs->eax,regs->ebx,regs->ecx,regs->edx); + printk("ESI: %08lx EDI: %08lx EBP: %08lx", +@@ -264,15 +267,6 @@ void show_regs(struct pt_regs * regs) + * the "args". + */ + extern void kernel_thread_helper(void); +-__asm__(".section .text\n" +- ".align 4\n" +- "kernel_thread_helper:\n\t" +- "movl %edx,%eax\n\t" +- "pushl %edx\n\t" +- "call *%ebx\n\t" +- "pushl %eax\n\t" +- "call do_exit\n" +- ".previous"); + + /* + * Create a kernel thread +@@ -290,7 +284,7 @@ int kernel_thread(int (*fn)(void *), voi + regs.xes = __USER_DS; + regs.orig_eax = -1; + regs.eip = (unsigned long) kernel_thread_helper; +- regs.xcs = GET_KERNEL_CS(); ++ regs.xcs = __KERNEL_CS | get_kernel_rpl(); + regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; + + /* Ok, create the new process.. */ +@@ -369,13 +363,12 @@ int copy_thread(int nr, unsigned long cl + + tsk = current; + if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { +- p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); ++ p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr, ++ IO_BITMAP_BYTES, GFP_KERNEL); + if (!p->thread.io_bitmap_ptr) { + p->thread.io_bitmap_max = 0; + return -ENOMEM; + } +- memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr, +- IO_BITMAP_BYTES); + set_tsk_thread_flag(p, TIF_IO_BITMAP); + } + +@@ -871,7 +864,7 @@ asmlinkage int sys_get_thread_area(struc + + unsigned long arch_align_stack(unsigned long sp) + { +- if (randomize_va_space) ++ if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) + sp -= get_random_int() % 8192; + return sp & ~0xf; + } +--- head.orig/arch/x86/kernel/setup_32-xen.c 2008-04-22 15:41:51.000000000 +0200 ++++ head/arch/x86/kernel/setup_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -56,6 +56,7 @@ + #include <asm/apic.h> + #include <asm/e820.h> + #include <asm/mpspec.h> ++#include <asm/mmzone.h> + #include <asm/setup.h> + #include <asm/arch_hooks.h> + #include <asm/sections.h> +@@ -83,9 +84,6 @@ static struct notifier_block xen_panic_b + xen_panic_event, NULL, 0 /* try to go last */ + }; + +-extern char hypercall_page[PAGE_SIZE]; +-EXPORT_SYMBOL(hypercall_page); +- + int disable_pse __devinitdata = 0; + + /* +@@ -105,18 +103,6 @@ EXPORT_SYMBOL(boot_cpu_data); + + unsigned long mmu_cr4_features; + +-#ifdef CONFIG_ACPI +- int acpi_disabled = 0; +-#else +- int acpi_disabled = 1; +-#endif +-EXPORT_SYMBOL(acpi_disabled); +- +-#ifdef CONFIG_ACPI +-int __initdata acpi_force = 0; +-extern acpi_interrupt_flags acpi_sci_flags; +-#endif +- + /* for MCA, but anyone else can use it if they want */ + unsigned int machine_id; + #ifdef CONFIG_MCA +@@ -170,7 +156,6 @@ struct e820map machine_e820; + #endif + + extern void early_cpu_init(void); +-extern void generic_apic_probe(char *); + extern int root_mountflags; + + unsigned long saved_videomode; +@@ -243,9 +228,6 @@ static struct resource adapter_rom_resou + .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM + } }; + +-#define ADAPTER_ROM_RESOURCES \ +- (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0]) +- + static struct resource video_rom_resource = { + .name = "Video ROM", + .start = 0xc0000, +@@ -307,9 +289,6 @@ static struct resource standard_io_resou + .flags = IORESOURCE_BUSY | IORESOURCE_IO + } }; + +-#define STANDARD_IO_RESOURCES \ +- (sizeof standard_io_resources / sizeof standard_io_resources[0]) +- + #define romsignature(x) (*(unsigned short *)(x) == 0xaa55) + + static int __init romchecksum(unsigned char *rom, unsigned long length) +@@ -372,7 +351,7 @@ static void __init probe_roms(void) + } + + /* check for adapter roms on 2k boundaries */ +- for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) { ++ for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) { + rom = isa_bus_to_virt(start); + if (!romsignature(rom)) + continue; +@@ -779,246 +758,152 @@ static inline void copy_edd(void) + } + #endif + +-static void __init parse_cmdline_early (char ** cmdline_p) ++static int __initdata user_defined_memmap = 0; ++ ++/* ++ * "mem=nopentium" disables the 4MB page tables. ++ * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM ++ * to <mem>, overriding the bios size. ++ * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from ++ * <start> to <start>+<mem>, overriding the bios size. ++ * ++ * HPA tells me bootloaders need to parse mem=, so no new ++ * option should be mem= [also see Documentation/i386/boot.txt] ++ */ ++static int __init parse_mem(char *arg) + { +- char c = ' ', *to = command_line, *from = saved_command_line; +- int len = 0, max_cmdline; +- int userdef = 0; +- +- if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) +- max_cmdline = COMMAND_LINE_SIZE; +- memcpy(saved_command_line, xen_start_info->cmd_line, max_cmdline); +- /* Save unparsed command line copy for /proc/cmdline */ +- saved_command_line[max_cmdline-1] = '\0'; +- +- for (;;) { +- if (c != ' ') +- goto next_char; +- /* +- * "mem=nopentium" disables the 4MB page tables. +- * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM +- * to <mem>, overriding the bios size. +- * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from +- * <start> to <start>+<mem>, overriding the bios size. +- * +- * HPA tells me bootloaders need to parse mem=, so no new +- * option should be mem= [also see Documentation/i386/boot.txt] +- */ +- if (!memcmp(from, "mem=", 4)) { +- if (to != command_line) +- to--; +- if (!memcmp(from+4, "nopentium", 9)) { +- from += 9+4; +- clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability); +- disable_pse = 1; +- } else { +- /* If the user specifies memory size, we +- * limit the BIOS-provided memory map to +- * that size. exactmap can be used to specify +- * the exact map. mem=number can be used to +- * trim the existing memory map. +- */ +- unsigned long long mem_size; +- +- mem_size = memparse(from+4, &from); +- limit_regions(mem_size); +- userdef=1; +- } +- } ++ if (!arg) ++ return -EINVAL; + +- else if (!memcmp(from, "memmap=", 7)) { +- if (to != command_line) +- to--; +- if (!memcmp(from+7, "exactmap", 8)) { +-#ifdef CONFIG_CRASH_DUMP +- /* If we are doing a crash dump, we +- * still need to know the real mem +- * size before original memory map is +- * reset. +- */ +- find_max_pfn(); +- saved_max_pfn = max_pfn; +-#endif +- from += 8+7; +- e820.nr_map = 0; +- userdef = 1; +- } else { +- /* If the user specifies memory size, we +- * limit the BIOS-provided memory map to +- * that size. exactmap can be used to specify +- * the exact map. mem=number can be used to +- * trim the existing memory map. +- */ +- unsigned long long start_at, mem_size; ++ if (strcmp(arg, "nopentium") == 0) { ++ clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability); ++ disable_pse = 1; ++ } else { ++ /* If the user specifies memory size, we ++ * limit the BIOS-provided memory map to ++ * that size. exactmap can be used to specify ++ * the exact map. mem=number can be used to ++ * trim the existing memory map. ++ */ ++ unsigned long long mem_size; + +- mem_size = memparse(from+7, &from); +- if (*from == '@') { +- start_at = memparse(from+1, &from); +- add_memory_region(start_at, mem_size, E820_RAM); +- } else if (*from == '#') { +- start_at = memparse(from+1, &from); +- add_memory_region(start_at, mem_size, E820_ACPI); +- } else if (*from == '$') { +- start_at = memparse(from+1, &from); +- add_memory_region(start_at, mem_size, E820_RESERVED); +- } else { +- limit_regions(mem_size); +- userdef=1; +- } +- } +- } +- +- else if (!memcmp(from, "noexec=", 7)) +- noexec_setup(from + 7); ++ mem_size = memparse(arg, &arg); ++ limit_regions(mem_size); ++ user_defined_memmap = 1; ++ } ++ return 0; ++} ++early_param("mem", parse_mem); + ++static int __init parse_memmap(char *arg) ++{ ++ if (!arg) ++ return -EINVAL; + +-#ifdef CONFIG_X86_MPPARSE +- /* +- * If the BIOS enumerates physical processors before logical, +- * maxcpus=N at enumeration-time can be used to disable HT. ++ if (strcmp(arg, "exactmap") == 0) { ++#ifdef CONFIG_CRASH_DUMP ++ /* If we are doing a crash dump, we ++ * still need to know the real mem ++ * size before original memory map is ++ * reset. + */ +- else if (!memcmp(from, "maxcpus=", 8)) { +- extern unsigned int maxcpus; +- +- maxcpus = simple_strtoul(from + 8, NULL, 0); +- } ++ find_max_pfn(); ++ saved_max_pfn = max_pfn; + #endif ++ e820.nr_map = 0; ++ user_defined_memmap = 1; ++ } else { ++ /* If the user specifies memory size, we ++ * limit the BIOS-provided memory map to ++ * that size. exactmap can be used to specify ++ * the exact map. mem=number can be used to ++ * trim the existing memory map. ++ */ ++ unsigned long long start_at, mem_size; + +-#ifdef CONFIG_ACPI +- /* "acpi=off" disables both ACPI table parsing and interpreter */ +- else if (!memcmp(from, "acpi=off", 8)) { +- disable_acpi(); +- } +- +- /* acpi=force to over-ride black-list */ +- else if (!memcmp(from, "acpi=force", 10)) { +- acpi_force = 1; +- acpi_ht = 1; +- acpi_disabled = 0; +- } +- +- /* acpi=strict disables out-of-spec workarounds */ +- else if (!memcmp(from, "acpi=strict", 11)) { +- acpi_strict = 1; +- } +- +- /* Limit ACPI just to boot-time to enable HT */ +- else if (!memcmp(from, "acpi=ht", 7)) { +- if (!acpi_force) +- disable_acpi(); +- acpi_ht = 1; +- } +- +- /* "pci=noacpi" disable ACPI IRQ routing and PCI scan */ +- else if (!memcmp(from, "pci=noacpi", 10)) { +- acpi_disable_pci(); +- } +- /* "acpi=noirq" disables ACPI interrupt routing */ +- else if (!memcmp(from, "acpi=noirq", 10)) { +- acpi_noirq_set(); ++ mem_size = memparse(arg, &arg); ++ if (*arg == '@') { ++ start_at = memparse(arg+1, &arg); ++ add_memory_region(start_at, mem_size, E820_RAM); ++ } else if (*arg == '#') { ++ start_at = memparse(arg+1, &arg); ++ add_memory_region(start_at, mem_size, E820_ACPI); ++ } else if (*arg == '$') { ++ start_at = memparse(arg+1, &arg); ++ add_memory_region(start_at, mem_size, E820_RESERVED); ++ } else { ++ limit_regions(mem_size); ++ user_defined_memmap = 1; + } ++ } ++ return 0; ++} ++early_param("memmap", parse_memmap); + +- else if (!memcmp(from, "acpi_sci=edge", 13)) +- acpi_sci_flags.trigger = 1; +- +- else if (!memcmp(from, "acpi_sci=level", 14)) +- acpi_sci_flags.trigger = 3; ++#ifdef CONFIG_PROC_VMCORE ++/* elfcorehdr= specifies the location of elf core header ++ * stored by the crashed kernel. ++ */ ++static int __init parse_elfcorehdr(char *arg) ++{ ++ if (!arg) ++ return -EINVAL; + +- else if (!memcmp(from, "acpi_sci=high", 13)) +- acpi_sci_flags.polarity = 1; ++ elfcorehdr_addr = memparse(arg, &arg); ++ return 0; ++} ++early_param("elfcorehdr", parse_elfcorehdr); ++#endif /* CONFIG_PROC_VMCORE */ + +- else if (!memcmp(from, "acpi_sci=low", 12)) +- acpi_sci_flags.polarity = 3; ++/* ++ * highmem=size forces highmem to be exactly 'size' bytes. ++ * This works even on boxes that have no highmem otherwise. ++ * This also works to reduce highmem size on bigger boxes. ++ */ ++static int __init parse_highmem(char *arg) ++{ ++ if (!arg) ++ return -EINVAL; + +-#ifdef CONFIG_X86_IO_APIC +- else if (!memcmp(from, "acpi_skip_timer_override", 24)) +- acpi_skip_timer_override = 1; ++ highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT; ++ return 0; ++} ++early_param("highmem", parse_highmem); + +- if (!memcmp(from, "disable_timer_pin_1", 19)) +- disable_timer_pin_1 = 1; +- if (!memcmp(from, "enable_timer_pin_1", 18)) +- disable_timer_pin_1 = -1; +- +- /* disable IO-APIC */ +- else if (!memcmp(from, "noapic", 6)) +- disable_ioapic_setup(); +-#endif /* CONFIG_X86_IO_APIC */ +-#endif /* CONFIG_ACPI */ ++/* ++ * vmalloc=size forces the vmalloc area to be exactly 'size' ++ * bytes. This can be used to increase (or decrease) the ++ * vmalloc area - the default is 128m. ++ */ ++static int __init parse_vmalloc(char *arg) ++{ ++ if (!arg) ++ return -EINVAL; + +-#ifdef CONFIG_X86_LOCAL_APIC +- /* enable local APIC */ +- else if (!memcmp(from, "lapic", 5)) +- lapic_enable(); +- +- /* disable local APIC */ +- else if (!memcmp(from, "nolapic", 6)) +- lapic_disable(); +-#endif /* CONFIG_X86_LOCAL_APIC */ ++ __VMALLOC_RESERVE = memparse(arg, &arg); ++ return 0; ++} ++early_param("vmalloc", parse_vmalloc); + +-#ifdef CONFIG_KEXEC +- /* crashkernel=size@addr specifies the location to reserve for +- * a crash kernel. By reserving this memory we guarantee +- * that linux never set's it up as a DMA target. +- * Useful for holding code to do something appropriate +- * after a kernel panic. +- */ +- else if (!memcmp(from, "crashkernel=", 12)) { + #ifndef CONFIG_XEN +- unsigned long size, base; +- size = memparse(from+12, &from); +- if (*from == '@') { +- base = memparse(from+1, &from); +- /* FIXME: Do I want a sanity check +- * to validate the memory range? +- */ +- crashk_res.start = base; +- crashk_res.end = base + size - 1; +- } +-#else +- printk("Ignoring crashkernel command line, " +- "parameter will be supplied by xen\n"); +-#endif +- } +-#endif +-#ifdef CONFIG_PROC_VMCORE +- /* elfcorehdr= specifies the location of elf core header +- * stored by the crashed kernel. +- */ +- else if (!memcmp(from, "elfcorehdr=", 11)) +- elfcorehdr_addr = memparse(from+11, &from); +-#endif ++/* ++ * reservetop=size reserves a hole at the top of the kernel address space which ++ * a hypervisor can load into later. Needed for dynamically loaded hypervisors, ++ * so relocating the fixmap can be done before paging initialization. ++ */ ++static int __init parse_reservetop(char *arg) ++{ ++ unsigned long address; + +- /* +- * highmem=size forces highmem to be exactly 'size' bytes. +- * This works even on boxes that have no highmem otherwise. +- * This also works to reduce highmem size on bigger boxes. +- */ +- else if (!memcmp(from, "highmem=", 8)) +- highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT; +- +- /* +- * vmalloc=size forces the vmalloc area to be exactly 'size' +- * bytes. This can be used to increase (or decrease) the +- * vmalloc area - the default is 128m. +- */ +- else if (!memcmp(from, "vmalloc=", 8)) +- __VMALLOC_RESERVE = memparse(from+8, &from); ++ if (!arg) ++ return -EINVAL; + +- next_char: +- c = *(from++); +- if (!c) +- break; +- if (COMMAND_LINE_SIZE <= ++len) +- break; +- *(to++) = c; +- } +- *to = '\0'; +- *cmdline_p = command_line; +- if (userdef) { +- printk(KERN_INFO "user-defined physical RAM map:\n"); +- print_memory_map("user"); +- } ++ address = memparse(arg, &arg); ++ reserve_top_address(address); ++ return 0; + } ++early_param("reservetop", parse_reservetop); ++#endif + + /* + * Callback for efi_memory_walk. +@@ -1039,7 +924,7 @@ efi_find_max_pfn(unsigned long start, un + static int __init + efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg) + { +- memory_present(0, start, end); ++ memory_present(0, PFN_UP(start), PFN_DOWN(end)); + return 0; + } + +@@ -1306,6 +1191,14 @@ static unsigned long __init setup_memory + } + printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", + pages_to_mb(highend_pfn - highstart_pfn)); ++ num_physpages = highend_pfn; ++ high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; ++#else ++ num_physpages = max_low_pfn; ++ high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; ++#endif ++#ifdef CONFIG_FLATMEM ++ max_mapnr = num_physpages; + #endif + printk(KERN_NOTICE "%ldMB LOWMEM available.\n", + pages_to_mb(max_low_pfn)); +@@ -1317,22 +1210,21 @@ static unsigned long __init setup_memory + + void __init zone_sizes_init(void) + { +- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; +- unsigned int max_dma, low; +- +- max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; +- low = max_low_pfn; +- +- if (low < max_dma) +- zones_size[ZONE_DMA] = low; +- else { +- zones_size[ZONE_DMA] = max_dma; +- zones_size[ZONE_NORMAL] = low - max_dma; ++ unsigned long max_zone_pfns[MAX_NR_ZONES]; ++ memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); ++ max_zone_pfns[ZONE_DMA] = ++ virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; ++ max_zone_pfns[ZONE_NORMAL] = max_low_pfn; + #ifdef CONFIG_HIGHMEM +- zones_size[ZONE_HIGHMEM] = highend_pfn - low; ++ max_zone_pfns[ZONE_HIGHMEM] = highend_pfn; ++ add_active_range(0, 0, min(xen_start_info->nr_pages, highend_pfn)); ++ add_active_range(0, highend_pfn, highend_pfn); ++#else ++ add_active_range(0, 0, min(xen_start_info->nr_pages, max_low_pfn)); ++ add_active_range(0, max_low_pfn, max_low_pfn); + #endif +- } +- free_area_init(zones_size); ++ ++ free_area_init_nodes(max_zone_pfns); + } + #else + extern unsigned long __init setup_memory(void); +@@ -1389,6 +1281,7 @@ void __init setup_bootmem_allocator(void + */ + acpi_reserve_bootmem(); + #endif ++ numa_kva_reserve(); + #endif /* !CONFIG_XEN */ + + #ifdef CONFIG_BLK_DEV_INITRD +@@ -1574,7 +1467,7 @@ static int __init request_standard_resou + request_resource(&iomem_resource, &video_ram_resource); + + /* request I/O space for devices used on all i[345]86 PCs */ +- for (i = 0; i < STANDARD_IO_RESOURCES; i++) ++ for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++) + request_resource(&ioport_resource, &standard_io_resources[i]); + return 0; + } +@@ -1705,17 +1598,19 @@ void __init setup_arch(char **cmdline_p) + data_resource.start = virt_to_phys(_etext); + data_resource.end = virt_to_phys(_edata)-1; + +- parse_cmdline_early(cmdline_p); ++ if ((i = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) ++ i = COMMAND_LINE_SIZE; ++ memcpy(saved_command_line, xen_start_info->cmd_line, i); ++ saved_command_line[i - 1] = '\0'; ++ parse_early_param(); + +-#ifdef CONFIG_EARLY_PRINTK +- { +- char *s = strstr(*cmdline_p, "earlyprintk="); +- if (s) { +- setup_early_printk(strchr(s, '=') + 1); +- printk("early console enabled\n"); +- } ++ if (user_defined_memmap) { ++ printk(KERN_INFO "user-defined physical RAM map:\n"); ++ print_memory_map("user"); + } +-#endif ++ ++ strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE); ++ *cmdline_p = command_line; + + max_low_pfn = setup_memory(); + +@@ -1822,7 +1717,7 @@ void __init setup_arch(char **cmdline_p) + dmi_scan_machine(); + + #ifdef CONFIG_X86_GENERICARCH +- generic_apic_probe(*cmdline_p); ++ generic_apic_probe(); + #endif + if (efi_enabled) + efi_map_memmap(); +@@ -1843,9 +1738,11 @@ void __init setup_arch(char **cmdline_p) + acpi_boot_table_init(); + #endif + ++#ifdef CONFIG_PCI + #ifdef CONFIG_X86_IO_APIC + check_acpi_pci(); /* Checks more than just ACPI actually */ + #endif ++#endif + + #ifdef CONFIG_ACPI + acpi_boot_init(); +--- head.orig/arch/x86/kernel/smp_32-xen.c 2007-12-10 08:47:31.000000000 +0100 ++++ head/arch/x86/kernel/smp_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -279,8 +279,7 @@ static inline void leave_mm (unsigned lo + * 2) Leave the mm if we are in the lazy tlb mode. + */ + +-irqreturn_t smp_invalidate_interrupt(int irq, void *dev_id, +- struct pt_regs *regs) ++irqreturn_t smp_invalidate_interrupt(int irq, void *dev_id) + { + unsigned long cpu; + +@@ -567,16 +566,14 @@ void smp_send_stop(void) + * all the work is done automatically when + * we return from the interrupt. + */ +-irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id, +- struct pt_regs *regs) ++irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id) + { + + return IRQ_HANDLED; + } + + #include <linux/kallsyms.h> +-irqreturn_t smp_call_function_interrupt(int irq, void *dev_id, +- struct pt_regs *regs) ++irqreturn_t smp_call_function_interrupt(int irq, void *dev_id) + { + void (*func) (void *info) = call_data->func; + void *info = call_data->info; +@@ -603,3 +600,69 @@ irqreturn_t smp_call_function_interrupt( + return IRQ_HANDLED; + } + ++/* ++ * this function sends a 'generic call function' IPI to one other CPU ++ * in the system. ++ * ++ * cpu is a standard Linux logical CPU number. ++ */ ++static void ++__smp_call_function_single(int cpu, void (*func) (void *info), void *info, ++ int nonatomic, int wait) ++{ ++ struct call_data_struct data; ++ int cpus = 1; ++ ++ data.func = func; ++ data.info = info; ++ atomic_set(&data.started, 0); ++ data.wait = wait; ++ if (wait) ++ atomic_set(&data.finished, 0); ++ ++ call_data = &data; ++ wmb(); ++ /* Send a message to all other CPUs and wait for them to respond */ ++ send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); ++ ++ /* Wait for response */ ++ while (atomic_read(&data.started) != cpus) ++ cpu_relax(); ++ ++ if (!wait) ++ return; ++ ++ while (atomic_read(&data.finished) != cpus) ++ cpu_relax(); ++} ++ ++/* ++ * smp_call_function_single - Run a function on another CPU ++ * @func: The function to run. This must be fast and non-blocking. ++ * @info: An arbitrary pointer to pass to the function. ++ * @nonatomic: Currently unused. ++ * @wait: If true, wait until function has completed on other CPUs. ++ * ++ * Retrurns 0 on success, else a negative status code. ++ * ++ * Does not return until the remote CPU is nearly ready to execute <func> ++ * or is or has executed. ++ */ ++ ++int smp_call_function_single(int cpu, void (*func) (void *info), void *info, ++ int nonatomic, int wait) ++{ ++ /* prevent preemption and reschedule on another processor */ ++ int me = get_cpu(); ++ if (cpu == me) { ++ WARN_ON(1); ++ put_cpu(); ++ return -EBUSY; ++ } ++ spin_lock_bh(&call_lock); ++ __smp_call_function_single(cpu, func, info, nonatomic, wait); ++ spin_unlock_bh(&call_lock); ++ put_cpu(); ++ return 0; ++} ++EXPORT_SYMBOL(smp_call_function_single); +--- head.orig/arch/x86/kernel/time-xen.c 2011-07-12 11:09:48.000000000 +0200 ++++ head/arch/x86/kernel/time-xen.c 2011-07-12 11:10:26.000000000 +0200 +@@ -88,7 +88,6 @@ int pit_latch_buggy; /* ext + unsigned long vxtime_hz = PIT_TICK_RATE; + struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ + volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; +-unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES; + struct timespec __xtime __section_xtime; + struct timezone __sys_tz __section_sys_tz; + #endif +@@ -96,8 +95,6 @@ struct timezone __sys_tz __section_sys_t + unsigned int cpu_khz; /* Detected as we calibrate the TSC */ + EXPORT_SYMBOL(cpu_khz); + +-extern unsigned long wall_jiffies; +- + DEFINE_SPINLOCK(rtc_lock); + EXPORT_SYMBOL(rtc_lock); + +@@ -243,11 +240,10 @@ static void __update_wallclock(time_t se + time_t wtm_sec, xtime_sec; + u64 tmp, wc_nsec; + +- /* Adjust wall-clock time base based on wall_jiffies ticks. */ ++ /* Adjust wall-clock time base. */ + wc_nsec = processed_system_time; + wc_nsec += sec * (u64)NSEC_PER_SEC; + wc_nsec += nsec; +- wc_nsec -= (jiffies - wall_jiffies) * (u64)NS_PER_TICK; + + /* Split wallclock base into seconds and nanoseconds. */ + tmp = wc_nsec; +@@ -376,16 +372,10 @@ void do_gettimeofday(struct timeval *tv) + shadow = &per_cpu(shadow_time, cpu); + + do { +- unsigned long lost; +- + local_time_version = shadow->version; + seq = read_seqbegin(&xtime_lock); + + usec = get_usec_offset(shadow); +- lost = jiffies - wall_jiffies; +- +- if (unlikely(lost)) +- usec += lost * (USEC_PER_SEC / HZ); + + sec = xtime.tv_sec; + usec += (xtime.tv_nsec / NSEC_PER_USEC); +@@ -551,7 +541,7 @@ static void sync_xen_wallclock(unsigned + write_seqlock_irq(&xtime_lock); + + sec = xtime.tv_sec; +- nsec = xtime.tv_nsec + ((jiffies - wall_jiffies) * (u64)NS_PER_TICK); ++ nsec = xtime.tv_nsec; + __normalize_time(&sec, &nsec); + + op.cmd = XENPF_settime; +@@ -625,42 +615,49 @@ unsigned long long sched_clock(void) + } + #endif + +-#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) + unsigned long profile_pc(struct pt_regs *regs) + { + unsigned long pc = instruction_pointer(regs); + +-#ifdef __x86_64__ +- /* Assume the lock function has either no stack frame or only a single word. +- This checks if the address on the stack looks like a kernel text address. +- There is a small window for false hits, but in that case the tick +- is just accounted to the spinlock function. +- Better would be to write these functions in assembler again +- and check exactly. */ ++#if defined(CONFIG_SMP) || defined(__x86_64__) + if (!user_mode_vm(regs) && in_lock_functions(pc)) { +- char *v = *(char **)regs->rsp; +- if ((v >= _stext && v <= _etext) || +- (v >= _sinittext && v <= _einittext) || +- (v >= (char *)MODULES_VADDR && v <= (char *)MODULES_END)) +- return (unsigned long)v; +- return ((unsigned long *)regs->rsp)[1]; ++# ifdef CONFIG_FRAME_POINTER ++# ifdef __i386__ ++ return ((unsigned long *)regs->ebp)[1]; ++# else ++ return ((unsigned long *)regs->rbp)[1]; ++# endif ++# else ++# ifdef __i386__ ++ unsigned long *sp; ++ if ((regs->xcs & 2) == 0) ++ sp = (unsigned long *)®s->esp; ++ else ++ sp = (unsigned long *)regs->esp; ++# else ++ unsigned long *sp = (unsigned long *)regs->rsp; ++# endif ++ /* Return address is either directly at stack pointer ++ or above a saved eflags. Eflags has bits 22-31 zero, ++ kernel addresses don't. */ ++ if (sp[0] >> 22) ++ return sp[0]; ++ if (sp[1] >> 22) ++ return sp[1]; ++# endif + } +-#else +- if (!user_mode_vm(regs) && in_lock_functions(pc)) +- return *(unsigned long *)(regs->ebp + 4); + #endif + + return pc; + } + EXPORT_SYMBOL(profile_pc); +-#endif + + /* + * This is the same as the above, except we _also_ save the current + * Time Stamp Counter value at the time of the timer interrupt, so that + * we later on can estimate the time of day more exactly. + */ +-irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ++irqreturn_t timer_interrupt(int irq, void *dev_id) + { + s64 delta, delta_cpu, stolen, blocked; + u64 sched_time; +@@ -719,10 +716,15 @@ irqreturn_t timer_interrupt(int irq, voi + } + + /* System-wide jiffy work. */ +- while (delta >= NS_PER_TICK) { +- delta -= NS_PER_TICK; +- processed_system_time += NS_PER_TICK; +- do_timer(regs); ++ if (delta >= NS_PER_TICK) { ++ do_div(delta, NS_PER_TICK); ++ processed_system_time += delta * NS_PER_TICK; ++ while (delta > HZ) { ++ clobber_induction_variable(delta); ++ do_timer(HZ); ++ delta -= HZ; ++ } ++ do_timer(delta); + } + + if (shadow_tv_version != HYPERVISOR_shared_info->wc_version) { +@@ -769,7 +771,7 @@ irqreturn_t timer_interrupt(int irq, voi + if (delta_cpu > 0) { + do_div(delta_cpu, NS_PER_TICK); + per_cpu(processed_system_time, cpu) += delta_cpu * NS_PER_TICK; +- if (user_mode_vm(regs)) ++ if (user_mode_vm(get_irq_regs())) + account_user_time(current, (cputime_t)delta_cpu); + else + account_system_time(current, HARDIRQ_OFFSET, +@@ -783,10 +785,10 @@ irqreturn_t timer_interrupt(int irq, voi + /* Local timer processing (see update_process_times()). */ + run_local_timers(); + if (rcu_pending(cpu)) +- rcu_check_callbacks(cpu, user_mode_vm(regs)); ++ rcu_check_callbacks(cpu, user_mode_vm(get_irq_regs())); + scheduler_tick(); + run_posix_cpu_timers(current); +- profile_tick(CPU_PROFILING, regs); ++ profile_tick(CPU_PROFILING); + + return IRQ_HANDLED; + } +@@ -996,10 +998,11 @@ extern void (*late_time_init)(void); + /* Duplicate of time_init() below, with hpet_enable part added */ + static void __init hpet_time_init(void) + { +- xtime.tv_sec = get_cmos_time(); +- xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); +- set_normalized_timespec(&wall_to_monotonic, +- -xtime.tv_sec, -xtime.tv_nsec); ++ struct timespec ts; ++ ts.tv_sec = get_cmos_time(); ++ ts.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); ++ ++ do_settimeofday(&ts); + + if ((hpet_enable() >= 0) && hpet_use_timer) { + printk("Using HPET for base-timer\n"); +--- head.orig/arch/x86/kernel/traps_32-xen.c 2008-04-02 12:34:02.000000000 +0200 ++++ head/arch/x86/kernel/traps_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -28,6 +28,7 @@ + #include <linux/kprobes.h> + #include <linux/kexec.h> + #include <linux/unwind.h> ++#include <linux/uaccess.h> + + #ifdef CONFIG_EISA + #include <linux/ioport.h> +@@ -40,7 +41,6 @@ + + #include <asm/processor.h> + #include <asm/system.h> +-#include <asm/uaccess.h> + #include <asm/io.h> + #include <asm/atomic.h> + #include <asm/debugreg.h> +@@ -51,11 +51,14 @@ + #include <asm/smp.h> + #include <asm/arch_hooks.h> + #include <asm/kdebug.h> ++#include <asm/stacktrace.h> + + #include <linux/module.h> + + #include "mach_traps.h" + ++int panic_on_unrecovered_nmi; ++ + asmlinkage int system_call(void); + + struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, +@@ -124,62 +127,63 @@ static inline int valid_stack_ptr(struct + p < (void *)tinfo + THREAD_SIZE - 3; + } + +-/* +- * Print one address/symbol entries per line. +- */ +-static inline void print_addr_and_symbol(unsigned long addr, char *log_lvl) +-{ +- printk(" [<%08lx>] ", addr); +- +- print_symbol("%s\n", addr); +-} +- + static inline unsigned long print_context_stack(struct thread_info *tinfo, + unsigned long *stack, unsigned long ebp, +- char *log_lvl) ++ struct stacktrace_ops *ops, void *data) + { + unsigned long addr; + + #ifdef CONFIG_FRAME_POINTER + while (valid_stack_ptr(tinfo, (void *)ebp)) { ++ unsigned long new_ebp; + addr = *(unsigned long *)(ebp + 4); +- print_addr_and_symbol(addr, log_lvl); ++ ops->address(data, addr); + /* + * break out of recursive entries (such as +- * end_of_stack_stop_unwind_function): ++ * end_of_stack_stop_unwind_function). Also, ++ * we can never allow a frame pointer to ++ * move downwards! + */ +- if (ebp == *(unsigned long *)ebp) ++ new_ebp = *(unsigned long *)ebp; ++ if (new_ebp <= ebp) + break; +- ebp = *(unsigned long *)ebp; ++ ebp = new_ebp; + } + #else + while (valid_stack_ptr(tinfo, stack)) { + addr = *stack++; + if (__kernel_text_address(addr)) +- print_addr_and_symbol(addr, log_lvl); ++ ops->address(data, addr); + } + #endif + return ebp; + } + ++struct ops_and_data { ++ struct stacktrace_ops *ops; ++ void *data; ++}; ++ + static asmlinkage int +-show_trace_unwind(struct unwind_frame_info *info, void *log_lvl) ++dump_trace_unwind(struct unwind_frame_info *info, void *data) + { ++ struct ops_and_data *oad = (struct ops_and_data *)data; + int n = 0; + + while (unwind(info) == 0 && UNW_PC(info)) { + n++; +- print_addr_and_symbol(UNW_PC(info), log_lvl); ++ oad->ops->address(oad->data, UNW_PC(info)); + if (arch_unw_user_mode(info)) + break; + } + return n; + } + +-static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, +- unsigned long *stack, char *log_lvl) ++void dump_trace(struct task_struct *task, struct pt_regs *regs, ++ unsigned long *stack, ++ struct stacktrace_ops *ops, void *data) + { +- unsigned long ebp; ++ unsigned long ebp = 0; + + if (!task) + task = current; +@@ -187,54 +191,116 @@ static void show_trace_log_lvl(struct ta + if (call_trace >= 0) { + int unw_ret = 0; + struct unwind_frame_info info; ++ struct ops_and_data oad = { .ops = ops, .data = data }; + + if (regs) { + if (unwind_init_frame_info(&info, task, regs) == 0) +- unw_ret = show_trace_unwind(&info, log_lvl); ++ unw_ret = dump_trace_unwind(&info, &oad); + } else if (task == current) +- unw_ret = unwind_init_running(&info, show_trace_unwind, log_lvl); ++ unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad); + else { + if (unwind_init_blocked(&info, task) == 0) +- unw_ret = show_trace_unwind(&info, log_lvl); ++ unw_ret = dump_trace_unwind(&info, &oad); + } + if (unw_ret > 0) { + if (call_trace == 1 && !arch_unw_user_mode(&info)) { +- print_symbol("DWARF2 unwinder stuck at %s\n", ++ ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n", + UNW_PC(&info)); + if (UNW_SP(&info) >= PAGE_OFFSET) { +- printk("Leftover inexact backtrace:\n"); ++ ops->warning(data, "Leftover inexact backtrace:\n"); + stack = (void *)UNW_SP(&info); ++ if (!stack) ++ return; ++ ebp = UNW_FP(&info); + } else +- printk("Full inexact backtrace again:\n"); ++ ops->warning(data, "Full inexact backtrace again:\n"); + } else if (call_trace >= 1) + return; + else +- printk("Full inexact backtrace again:\n"); ++ ops->warning(data, "Full inexact backtrace again:\n"); + } else +- printk("Inexact backtrace:\n"); ++ ops->warning(data, "Inexact backtrace:\n"); + } +- +- if (task == current) { +- /* Grab ebp right from our regs */ +- asm ("movl %%ebp, %0" : "=r" (ebp) : ); +- } else { +- /* ebp is the last reg pushed by switch_to */ +- ebp = *(unsigned long *) task->thread.esp; ++ if (!stack) { ++ unsigned long dummy; ++ stack = &dummy; ++ if (task && task != current) ++ stack = (unsigned long *)task->thread.esp; ++ } ++ ++#ifdef CONFIG_FRAME_POINTER ++ if (!ebp) { ++ if (task == current) { ++ /* Grab ebp right from our regs */ ++ asm ("movl %%ebp, %0" : "=r" (ebp) : ); ++ } else { ++ /* ebp is the last reg pushed by switch_to */ ++ ebp = *(unsigned long *) task->thread.esp; ++ } + } ++#endif + + while (1) { + struct thread_info *context; + context = (struct thread_info *) + ((unsigned long)stack & (~(THREAD_SIZE - 1))); +- ebp = print_context_stack(context, stack, ebp, log_lvl); ++ ebp = print_context_stack(context, stack, ebp, ops, data); ++ /* Should be after the line below, but somewhere ++ in early boot context comes out corrupted and we ++ can't reference it -AK */ ++ if (ops->stack(data, "IRQ") < 0) ++ break; + stack = (unsigned long*)context->previous_esp; + if (!stack) + break; +- printk("%s =======================\n", log_lvl); + } + } ++EXPORT_SYMBOL(dump_trace); ++ ++static void ++print_trace_warning_symbol(void *data, char *msg, unsigned long symbol) ++{ ++ printk(data); ++ print_symbol(msg, symbol); ++ printk("\n"); ++} ++ ++static void print_trace_warning(void *data, char *msg) ++{ ++ printk("%s%s\n", (char *)data, msg); ++} + +-void show_trace(struct task_struct *task, struct pt_regs *regs, unsigned long * stack) ++static int print_trace_stack(void *data, char *name) ++{ ++ return 0; ++} ++ ++/* ++ * Print one address/symbol entries per line. ++ */ ++static void print_trace_address(void *data, unsigned long addr) ++{ ++ printk("%s [<%08lx>] ", (char *)data, addr); ++ print_symbol("%s\n", addr); ++} ++ ++static struct stacktrace_ops print_trace_ops = { ++ .warning = print_trace_warning, ++ .warning_symbol = print_trace_warning_symbol, ++ .stack = print_trace_stack, ++ .address = print_trace_address, ++}; ++ ++static void ++show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, ++ unsigned long * stack, char *log_lvl) ++{ ++ dump_trace(task, regs, stack, &print_trace_ops, log_lvl); ++ printk("%s =======================\n", log_lvl); ++} ++ ++void show_trace(struct task_struct *task, struct pt_regs *regs, ++ unsigned long * stack) + { + show_trace_log_lvl(task, regs, stack, ""); + } +@@ -297,12 +363,13 @@ void show_registers(struct pt_regs *regs + ss = regs->xss & 0xffff; + } + print_modules(); +- printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n" +- "EFLAGS: %08lx (%s %.*s) \n", ++ printk(KERN_EMERG "CPU: %d\n" ++ KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" ++ KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", + smp_processor_id(), 0xffff & regs->xcs, regs->eip, +- print_tainted(), regs->eflags, system_utsname.release, +- (int)strcspn(system_utsname.version, " "), +- system_utsname.version); ++ print_tainted(), regs->eflags, init_utsname()->release, ++ (int)strcspn(init_utsname()->version, " "), ++ init_utsname()->version); + print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); + printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", + regs->eax, regs->ebx, regs->ecx, regs->edx); +@@ -319,6 +386,8 @@ void show_registers(struct pt_regs *regs + */ + if (in_kernel) { + u8 __user *eip; ++ int code_bytes = 64; ++ unsigned char c; + + printk("\n" KERN_EMERG "Stack: "); + show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); +@@ -326,9 +395,12 @@ void show_registers(struct pt_regs *regs + printk(KERN_EMERG "Code: "); + + eip = (u8 __user *)regs->eip - 43; +- for (i = 0; i < 64; i++, eip++) { +- unsigned char c; +- ++ if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) { ++ /* try starting at EIP */ ++ eip = (u8 __user *)regs->eip; ++ code_bytes = 32; ++ } ++ for (i = 0; i < code_bytes; i++, eip++) { + if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) { + printk(" Bad EIP value."); + break; +@@ -349,7 +421,7 @@ static void handle_BUG(struct pt_regs *r + + if (eip < PAGE_OFFSET) + return; +- if (__get_user(ud2, (unsigned short __user *)eip)) ++ if (probe_kernel_address((unsigned short __user *)eip, ud2)) + return; + if (ud2 != 0x0b0f) + return; +@@ -362,7 +434,8 @@ static void handle_BUG(struct pt_regs *r + char *file; + char c; + +- if (__get_user(line, (unsigned short __user *)(eip + 2))) ++ if (probe_kernel_address((unsigned short __user *)(eip + 2), ++ line)) + break; + if (__get_user(file, (char * __user *)(eip + 4)) || + (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) +@@ -604,18 +677,24 @@ gp_in_kernel: + } + } + +-static void mem_parity_error(unsigned char reason, struct pt_regs * regs) ++static __kprobes void ++mem_parity_error(unsigned char reason, struct pt_regs * regs) + { +- printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying " +- "to continue\n"); ++ printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " ++ "CPU %d.\n", reason, smp_processor_id()); + printk(KERN_EMERG "You probably have a hardware problem with your RAM " + "chips\n"); ++ if (panic_on_unrecovered_nmi) ++ panic("NMI: Not continuing"); ++ ++ printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); + + /* Clear and disable the memory parity error line. */ + clear_mem_error(reason); + } + +-static void io_check_error(unsigned char reason, struct pt_regs * regs) ++static __kprobes void ++io_check_error(unsigned char reason, struct pt_regs * regs) + { + printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n"); + show_registers(regs); +@@ -624,7 +703,8 @@ static void io_check_error(unsigned char + clear_io_check_error(reason); + } + +-static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs) ++static __kprobes void ++unknown_nmi_error(unsigned char reason, struct pt_regs * regs) + { + #ifdef CONFIG_MCA + /* Might actually be able to figure out what the guilty party +@@ -634,15 +714,18 @@ static void unknown_nmi_error(unsigned c + return; + } + #endif +- printk("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n", +- reason, smp_processor_id()); +- printk("Dazed and confused, but trying to continue\n"); +- printk("Do you have a strange power saving mode enabled?\n"); ++ printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " ++ "CPU %d.\n", reason, smp_processor_id()); ++ printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n"); ++ if (panic_on_unrecovered_nmi) ++ panic("NMI: Not continuing"); ++ ++ printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); + } + + static DEFINE_SPINLOCK(nmi_print_lock); + +-void die_nmi (struct pt_regs *regs, const char *msg) ++void __kprobes die_nmi(struct pt_regs *regs, const char *msg) + { + if (notify_die(DIE_NMIWATCHDOG, msg, regs, 0, 2, SIGINT) == + NOTIFY_STOP) +@@ -674,7 +757,7 @@ void die_nmi (struct pt_regs *regs, cons + do_exit(SIGSEGV); + } + +-static void default_do_nmi(struct pt_regs * regs) ++static __kprobes void default_do_nmi(struct pt_regs * regs) + { + unsigned char reason = 0; + +@@ -691,12 +774,12 @@ static void default_do_nmi(struct pt_reg + * Ok, so this is none of the documented NMI sources, + * so it must be the NMI watchdog. + */ +- if (nmi_watchdog) { +- nmi_watchdog_tick(regs); ++ if (nmi_watchdog_tick(regs, reason)) + return; +- } ++ if (!do_nmi_callback(regs, smp_processor_id())) + #endif +- unknown_nmi_error(reason, regs); ++ unknown_nmi_error(reason, regs); ++ + return; + } + if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) +@@ -712,14 +795,7 @@ static void default_do_nmi(struct pt_reg + reassert_nmi(); + } + +-static int dummy_nmi_callback(struct pt_regs * regs, int cpu) +-{ +- return 0; +-} +- +-static nmi_callback_t nmi_callback = dummy_nmi_callback; +- +-fastcall void do_nmi(struct pt_regs * regs, long error_code) ++fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) + { + int cpu; + +@@ -729,25 +805,11 @@ fastcall void do_nmi(struct pt_regs * re + + ++nmi_count(cpu); + +- if (!rcu_dereference(nmi_callback)(regs, cpu)) +- default_do_nmi(regs); ++ default_do_nmi(regs); + + nmi_exit(); + } + +-void set_nmi_callback(nmi_callback_t callback) +-{ +- vmalloc_sync_all(); +- rcu_assign_pointer(nmi_callback, callback); +-} +-EXPORT_SYMBOL_GPL(set_nmi_callback); +- +-void unset_nmi_callback(void) +-{ +- nmi_callback = dummy_nmi_callback; +-} +-EXPORT_SYMBOL_GPL(unset_nmi_callback); +- + #ifdef CONFIG_KPROBES + fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) + { +--- head.orig/arch/x86/mach-xen/setup.c 2011-09-07 14:16:54.000000000 +0200 ++++ head/arch/x86/mach-xen/setup.c 2011-08-09 10:35:06.000000000 +0200 +@@ -102,8 +102,10 @@ void __init pre_setup_arch_hook(void) + + setup_xen_features(); + +- if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) +- set_fixaddr_top(pp.virt_start); ++ if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) { ++ hypervisor_virt_start = pp.virt_start; ++ reserve_top_address(0UL - pp.virt_start); ++ } + + if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) { + machine_to_phys_mapping = (unsigned long *)mapping.v_start; +--- head.orig/arch/x86/mm/fault_32-xen.c 2010-09-23 15:39:04.000000000 +0200 ++++ head/arch/x86/mm/fault_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -27,21 +27,24 @@ + #include <asm/uaccess.h> + #include <asm/desc.h> + #include <asm/kdebug.h> ++#include <asm/segment.h> + + extern void die(const char *,struct pt_regs *,long); + +-#ifdef CONFIG_KPROBES +-ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); ++static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); ++ + int register_page_fault_notifier(struct notifier_block *nb) + { + vmalloc_sync_all(); + return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); + } ++EXPORT_SYMBOL_GPL(register_page_fault_notifier); + + int unregister_page_fault_notifier(struct notifier_block *nb) + { + return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); + } ++EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); + + static inline int notify_page_fault(enum die_val val, const char *str, + struct pt_regs *regs, long err, int trap, int sig) +@@ -55,14 +58,6 @@ static inline int notify_page_fault(enum + }; + return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args); + } +-#else +-static inline int notify_page_fault(enum die_val val, const char *str, +- struct pt_regs *regs, long err, int trap, int sig) +-{ +- return NOTIFY_DONE; +-} +-#endif +- + + /* + * Unlock any spinlocks which will prevent us from getting the +@@ -119,10 +114,10 @@ static inline unsigned long get_segment_ + } + + /* The standard kernel/user address space limit. */ +- *eip_limit = (seg & 2) ? USER_DS.seg : KERNEL_DS.seg; ++ *eip_limit = user_mode(regs) ? USER_DS.seg : KERNEL_DS.seg; + + /* By far the most common cases. */ +- if (likely(seg == __USER_CS || seg == GET_KERNEL_CS())) ++ if (likely(SEGMENT_IS_FLAT_CODE(seg))) + return eip; + + /* Check the segment exists, is within the current LDT/GDT size, +@@ -559,11 +554,7 @@ good_area: + write = 0; + switch (error_code & 3) { + default: /* 3: write, present */ +-#ifdef TEST_VERIFY_AREA +- if (regs->cs == GET_KERNEL_CS()) +- printk("WP fault at %08lx\n", regs->eip); +-#endif +- /* fall through */ ++ /* fall through */ + case 2: /* write, not present */ + if (!(vma->vm_flags & VM_WRITE)) + goto bad_area; +@@ -572,7 +563,7 @@ good_area: + case 1: /* read, present */ + goto bad_area; + case 0: /* read, not present */ +- if (!(vma->vm_flags & (VM_READ | VM_EXEC))) ++ if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) + goto bad_area; + } + +@@ -704,7 +695,7 @@ no_context: + */ + out_of_memory: + up_read(&mm->mmap_sem); +- if (tsk->pid == 1) { ++ if (is_init(tsk)) { + yield(); + down_read(&mm->mmap_sem); + goto survive; +--- head.orig/arch/x86/mm/highmem_32-xen.c 2008-10-29 09:55:56.000000000 +0100 ++++ head/arch/x86/mm/highmem_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -38,11 +38,9 @@ static void *__kmap_atomic(struct page * + + idx = type + KM_TYPE_NR*smp_processor_id(); + vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); +-#ifdef CONFIG_DEBUG_HIGHMEM + if (!pte_none(*(kmap_pte-idx))) + BUG(); +-#endif +- set_pte_at_sync(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); ++ set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); + + return (void*) vaddr; + } +@@ -62,36 +60,26 @@ void *kmap_atomic_pte(struct page *page, + + void kunmap_atomic(void *kvaddr, enum km_type type) + { +-#if defined(CONFIG_DEBUG_HIGHMEM) || defined(CONFIG_XEN) + unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; + enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); + +- if (vaddr < FIXADDR_START) { // FIXME ++#ifdef CONFIG_DEBUG_HIGHMEM ++ if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) { + dec_preempt_count(); + preempt_check_resched(); + return; + } +-#endif + +-#if defined(CONFIG_DEBUG_HIGHMEM) + if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx)) + BUG(); +- +- /* +- * force other mappings to Oops if they'll try to access +- * this pte without first remap it +- */ +- pte_clear(&init_mm, vaddr, kmap_pte-idx); +- __flush_tlb_one(vaddr); +-#elif defined(CONFIG_XEN) ++#endif + /* +- * We must ensure there are no dangling pagetable references when +- * returning memory to Xen (decrease_reservation). +- * XXX TODO: We could make this faster by only zapping when +- * kmap_flush_unused is called but that is trickier and more invasive. ++ * Force other mappings to Oops if they'll try to access this pte ++ * without first remap it. Keeping stale mappings around is a bad idea ++ * also, in case the page changes cacheability attributes or becomes ++ * a protected page in a hypervisor. + */ +- pte_clear(&init_mm, vaddr, kmap_pte-idx); +-#endif ++ kpte_clear_flush(kmap_pte-idx, vaddr); + + dec_preempt_count(); + preempt_check_resched(); +@@ -110,7 +98,6 @@ void *kmap_atomic_pfn(unsigned long pfn, + idx = type + KM_TYPE_NR*smp_processor_id(); + vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); + set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); +- __flush_tlb_one(vaddr); + + return (void*) vaddr; + } +--- head.orig/arch/x86/mm/hypervisor.c 2011-11-14 12:02:07.000000000 +0100 ++++ head/arch/x86/mm/hypervisor.c 2011-11-17 10:49:42.000000000 +0100 +@@ -31,6 +31,7 @@ + */ + + #include <linux/sched.h> ++#include <linux/hardirq.h> + #include <linux/mm.h> + #include <linux/vmalloc.h> + #include <asm/page.h> +@@ -44,6 +45,300 @@ + #include <asm/tlbflush.h> + #include <linux/highmem.h> + ++EXPORT_SYMBOL(hypercall_page); ++ ++#define NR_MC BITS_PER_LONG ++#define NR_MMU BITS_PER_LONG ++#define NR_MMUEXT (BITS_PER_LONG / 4) ++ ++DEFINE_PER_CPU(bool, xen_lazy_mmu); ++struct lazy_mmu { ++ unsigned int nr_mc, nr_mmu, nr_mmuext; ++ multicall_entry_t mc[NR_MC]; ++ mmu_update_t mmu[NR_MMU]; ++ struct mmuext_op mmuext[NR_MMUEXT]; ++}; ++static DEFINE_PER_CPU(struct lazy_mmu, lazy_mmu); ++ ++static inline bool use_lazy_mmu_mode(void) ++{ ++#ifdef CONFIG_PREEMPT ++ if (!preempt_count()) ++ return false; ++#endif ++ return !irq_count(); ++} ++ ++static void multicall_failed(const multicall_entry_t *mc, int rc) ++{ ++ printk(KERN_EMERG "hypercall#%lu(%lx, %lx, %lx, %lx)" ++ " failed: %d (caller %lx)\n", ++ mc->op, mc->args[0], mc->args[1], mc->args[2], mc->args[3], ++ rc, mc->args[5]); ++ BUG(); ++} ++ ++int xen_multicall_flush(bool ret_last) { ++ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); ++ multicall_entry_t *mc = lazy->mc; ++ unsigned int count = lazy->nr_mc; ++ ++ if (!count || !use_lazy_mmu_mode()) ++ return 0; ++ ++ lazy->nr_mc = 0; ++ lazy->nr_mmu = 0; ++ lazy->nr_mmuext = 0; ++ ++ if (count == 1) { ++ int rc = _hypercall(int, mc->op, mc->args[0], mc->args[1], ++ mc->args[2], mc->args[3], mc->args[4]); ++ ++ if (unlikely(rc)) { ++ if (ret_last) ++ return rc; ++ multicall_failed(mc, rc); ++ } ++ } else { ++ if (HYPERVISOR_multicall(mc, count)) ++ BUG(); ++ while (count-- > ret_last) ++ if (unlikely(mc++->result)) ++ multicall_failed(mc - 1, mc[-1].result); ++ if (ret_last) ++ return mc->result; ++ } ++ ++ return 0; ++} ++ ++int xen_multi_update_va_mapping(unsigned long va, pte_t pte, ++ unsigned long uvmf) ++{ ++ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); ++ multicall_entry_t *mc; ++ ++ if (unlikely(!use_lazy_mmu_mode())) ++#ifdef CONFIG_X86_PAE ++ return _hypercall4(int, update_va_mapping, va, ++ pte.pte_low, pte.pte_high, uvmf); ++#else ++ return _hypercall3(int, update_va_mapping, va, ++ pte.pte, uvmf); ++#endif ++ ++ if (unlikely(lazy->nr_mc == NR_MC)) ++ xen_multicall_flush(false); ++ ++ mc = lazy->mc + lazy->nr_mc++; ++ mc->op = __HYPERVISOR_update_va_mapping; ++ mc->args[0] = va; ++#ifndef CONFIG_X86_PAE ++ mc->args[1] = pte.pte; ++#else ++ mc->args[1] = pte.pte_low; ++ mc->args[2] = pte.pte_high; ++#endif ++ mc->args[MULTI_UVMFLAGS_INDEX] = uvmf; ++ mc->args[5] = (long)__builtin_return_address(0); ++ ++ return 0; ++} ++ ++static inline bool mmu_may_merge(const multicall_entry_t *mc, ++ unsigned int op, domid_t domid) ++{ ++ return mc->op == op && !mc->args[2] && mc->args[3] == domid; ++} ++ ++int xen_multi_mmu_update(mmu_update_t *src, unsigned int count, ++ unsigned int *success_count, domid_t domid) ++{ ++ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); ++ multicall_entry_t *mc = lazy->mc + lazy->nr_mc; ++ mmu_update_t *dst; ++ bool commit, merge; ++ ++ if (unlikely(!use_lazy_mmu_mode())) ++ return _hypercall4(int, mmu_update, src, count, ++ success_count, domid); ++ ++ commit = (lazy->nr_mmu + count) > NR_MMU || success_count; ++ merge = lazy->nr_mc && !commit ++ && mmu_may_merge(mc - 1, __HYPERVISOR_mmu_update, domid); ++ if (unlikely(lazy->nr_mc == NR_MC) && !merge) { ++ xen_multicall_flush(false); ++ mc = lazy->mc; ++ commit = count > NR_MMU || success_count; ++ } ++ ++ if (!lazy->nr_mc && unlikely(commit)) ++ return _hypercall4(int, mmu_update, src, count, ++ success_count, domid); ++ ++ dst = lazy->mmu + lazy->nr_mmu; ++ lazy->nr_mmu += count; ++ if (merge) { ++ mc[-1].args[1] += count; ++ memcpy(dst, src, count * sizeof(*src)); ++ } else { ++ ++lazy->nr_mc; ++ mc->op = __HYPERVISOR_mmu_update; ++ if (!commit) { ++ mc->args[0] = (unsigned long)dst; ++ memcpy(dst, src, count * sizeof(*src)); ++ } else ++ mc->args[0] = (unsigned long)src; ++ mc->args[1] = count; ++ mc->args[2] = (unsigned long)success_count; ++ mc->args[3] = domid; ++ mc->args[5] = (long)__builtin_return_address(0); ++ } ++ ++ while (!commit && count--) ++ switch (src++->ptr & (sizeof(pteval_t) - 1)) { ++ case MMU_NORMAL_PT_UPDATE: ++ case MMU_PT_UPDATE_PRESERVE_AD: ++ break; ++ default: ++ commit = true; ++ break; ++ } ++ ++ return commit ? xen_multicall_flush(true) : 0; ++} ++ ++int xen_multi_mmuext_op(struct mmuext_op *src, unsigned int count, ++ unsigned int *success_count, domid_t domid) ++{ ++ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); ++ multicall_entry_t *mc; ++ struct mmuext_op *dst; ++ bool commit, merge; ++ ++ if (unlikely(!use_lazy_mmu_mode())) ++ return _hypercall4(int, mmuext_op, src, count, ++ success_count, domid); ++ ++ /* ++ * While it could be useful in theory, I've never seen the body of ++ * this conditional to be reached, hence it seems more reasonable ++ * to disable it for the time being. ++ */ ++ if (0 && likely(count) ++ && likely(!success_count) ++ && likely(domid == DOMID_SELF) ++ && likely(lazy->nr_mc) ++ && lazy->mc[lazy->nr_mc - 1].op == __HYPERVISOR_update_va_mapping) { ++ unsigned long oldf, newf = UVMF_NONE; ++ ++ switch (src->cmd) { ++ case MMUEXT_TLB_FLUSH_ALL: ++ newf = UVMF_TLB_FLUSH | UVMF_ALL; ++ break; ++ case MMUEXT_INVLPG_ALL: ++ newf = UVMF_INVLPG | UVMF_ALL; ++ break; ++ case MMUEXT_TLB_FLUSH_MULTI: ++ newf = UVMF_TLB_FLUSH | UVMF_MULTI ++ | (unsigned long)src->arg2.vcpumask.p; ++ break; ++ case MMUEXT_INVLPG_MULTI: ++ newf = UVMF_INVLPG | UVMF_MULTI ++ | (unsigned long)src->arg2.vcpumask.p; ++ break; ++ case MMUEXT_TLB_FLUSH_LOCAL: ++ newf = UVMF_TLB_FLUSH | UVMF_LOCAL; ++ break; ++ case MMUEXT_INVLPG_LOCAL: ++ newf = UVMF_INVLPG | UVMF_LOCAL; ++ break; ++ } ++ mc = lazy->mc + lazy->nr_mc - 1; ++ oldf = mc->args[MULTI_UVMFLAGS_INDEX]; ++ if (newf == UVMF_NONE || oldf == UVMF_NONE ++ || newf == (UVMF_TLB_FLUSH | UVMF_ALL)) ++ ; ++ else if (oldf == (UVMF_TLB_FLUSH | UVMF_ALL)) ++ newf = UVMF_TLB_FLUSH | UVMF_ALL; ++ else if ((newf & UVMF_FLUSHTYPE_MASK) == UVMF_INVLPG ++ && (oldf & UVMF_FLUSHTYPE_MASK) == UVMF_INVLPG ++ && ((src->arg1.linear_addr ^ mc->args[0]) ++ >> PAGE_SHIFT)) ++ newf = UVMF_NONE; ++ else if (((oldf | newf) & UVMF_ALL) ++ && !((oldf ^ newf) & UVMF_FLUSHTYPE_MASK)) ++ newf |= UVMF_ALL; ++ else if ((oldf ^ newf) & ~UVMF_FLUSHTYPE_MASK) ++ newf = UVMF_NONE; ++ else if ((oldf & UVMF_FLUSHTYPE_MASK) == UVMF_TLB_FLUSH) ++ newf = (newf & ~UVMF_FLUSHTYPE_MASK) | UVMF_TLB_FLUSH; ++ else if ((newf & UVMF_FLUSHTYPE_MASK) != UVMF_TLB_FLUSH ++ && ((newf ^ oldf) & UVMF_FLUSHTYPE_MASK)) ++ newf = UVMF_NONE; ++ if (newf != UVMF_NONE) { ++ mc->args[MULTI_UVMFLAGS_INDEX] = newf; ++ ++src; ++ if (!--count) ++ return 0; ++ } ++ } ++ ++ mc = lazy->mc + lazy->nr_mc; ++ commit = (lazy->nr_mmuext + count) > NR_MMUEXT || success_count; ++ merge = lazy->nr_mc && !commit ++ && mmu_may_merge(mc - 1, __HYPERVISOR_mmuext_op, domid); ++ if (unlikely(lazy->nr_mc == NR_MC) && !merge) { ++ xen_multicall_flush(false); ++ mc = lazy->mc; ++ commit = count > NR_MMUEXT || success_count; ++ } ++ ++ if (!lazy->nr_mc && unlikely(commit)) ++ return _hypercall4(int, mmuext_op, src, count, ++ success_count, domid); ++ ++ dst = lazy->mmuext + lazy->nr_mmuext; ++ lazy->nr_mmuext += count; ++ if (merge) { ++ mc[-1].args[1] += count; ++ memcpy(dst, src, count * sizeof(*src)); ++ } else { ++ ++lazy->nr_mc; ++ mc->op = __HYPERVISOR_mmuext_op; ++ if (!commit) { ++ mc->args[0] = (unsigned long)dst; ++ memcpy(dst, src, count * sizeof(*src)); ++ } else ++ mc->args[0] = (unsigned long)src; ++ mc->args[1] = count; ++ mc->args[2] = (unsigned long)success_count; ++ mc->args[3] = domid; ++ mc->args[5] = (long)__builtin_return_address(0); ++ } ++ ++ while (!commit && count--) ++ switch (src++->cmd) { ++ case MMUEXT_PIN_L1_TABLE: ++ case MMUEXT_PIN_L2_TABLE: ++ case MMUEXT_PIN_L3_TABLE: ++ case MMUEXT_PIN_L4_TABLE: ++ case MMUEXT_UNPIN_TABLE: ++ case MMUEXT_TLB_FLUSH_LOCAL: ++ case MMUEXT_INVLPG_LOCAL: ++ case MMUEXT_TLB_FLUSH_MULTI: ++ case MMUEXT_INVLPG_MULTI: ++ case MMUEXT_TLB_FLUSH_ALL: ++ case MMUEXT_INVLPG_ALL: ++ break; ++ default: ++ commit = true; ++ break; ++ } ++ ++ return commit ? xen_multicall_flush(true) : 0; ++} ++ + void xen_l1_entry_update(pte_t *ptr, pte_t val) + { + mmu_update_t u; +@@ -619,7 +914,8 @@ int write_ldt_entry(void *ldt, int entry + #define MAX_BATCHED_FULL_PTES 32 + + int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd, +- unsigned long addr, unsigned long end, pgprot_t newprot) ++ unsigned long addr, unsigned long end, pgprot_t newprot, ++ int dirty_accountable) + { + int rc = 0, i = 0; + mmu_update_t u[MAX_BATCHED_FULL_PTES]; +@@ -632,10 +928,14 @@ int xen_change_pte_range(struct mm_struc + pte = pte_offset_map_lock(mm, pmd, addr, &ptl); + do { + if (pte_present(*pte)) { ++ pte_t ptent = pte_modify(*pte, newprot); ++ ++ if (dirty_accountable && pte_dirty(ptent)) ++ ptent = pte_mkwrite(ptent); + u[i].ptr = (__pmd_val(*pmd) & PHYSICAL_PAGE_MASK) + | ((unsigned long)pte & ~PAGE_MASK) + | MMU_PT_UPDATE_PRESERVE_AD; +- u[i].val = __pte_val(pte_modify(*pte, newprot)); ++ u[i].val = __pte_val(ptent); + if (++i == MAX_BATCHED_FULL_PTES) { + if ((rc = HYPERVISOR_mmu_update( + &u[0], i, NULL, DOMID_SELF)) != 0) +--- head.orig/arch/x86/mm/init_32-xen.c 2011-10-17 10:45:09.000000000 +0200 ++++ head/arch/x86/mm/init_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -313,8 +313,7 @@ static void __init permanent_kmaps_init( + static void __meminit free_new_highpage(struct page *page, int pfn) + { + init_page_count(page); +- if (pfn < xen_start_info->nr_pages) +- __free_page(page); ++ __free_page(page); + totalhigh_pages++; + } + +@@ -357,8 +356,16 @@ extern void set_highmem_pages_init(int); + static void __init set_highmem_pages_init(int bad_ppro) + { + int pfn; +- for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) ++ for (pfn = highstart_pfn; pfn < highend_pfn ++ && pfn < xen_start_info->nr_pages; pfn++) + add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); ++ ++ /* XEN: init high-mem pages outside initial allocation. */ ++ for (; pfn < highend_pfn; pfn++) { ++ ClearPageReserved(pfn_to_page(pfn)); ++ init_page_count(pfn_to_page(pfn)); ++ } ++ + totalram_pages += totalhigh_pages; + } + #endif /* CONFIG_FLATMEM */ +@@ -462,16 +469,22 @@ EXPORT_SYMBOL(__supported_pte_mask); + * on Enable + * off Disable + */ +-void __init noexec_setup(const char *str) ++static int __init noexec_setup(char *str) + { +- if (!strncmp(str, "on",2) && cpu_has_nx) { +- __supported_pte_mask |= _PAGE_NX; +- disable_nx = 0; +- } else if (!strncmp(str,"off",3)) { ++ if (!str || !strcmp(str, "on")) { ++ if (cpu_has_nx) { ++ __supported_pte_mask |= _PAGE_NX; ++ disable_nx = 0; ++ } ++ } else if (!strcmp(str,"off")) { + disable_nx = 1; + __supported_pte_mask &= ~_PAGE_NX; +- } ++ } else ++ return -EINVAL; ++ ++ return 0; + } ++early_param("noexec", noexec_setup); + + int nx_enabled = 0; + #ifdef CONFIG_X86_PAE +@@ -514,6 +527,7 @@ int __init set_kernel_exec(unsigned long + pte->pte_high &= ~(1 << (_PAGE_BIT_NX - 32)); + else + pte->pte_high |= 1 << (_PAGE_BIT_NX - 32); ++ pte_update_defer(&init_mm, vaddr, pte); + __flush_tlb_all(); + out: + return ret; +@@ -596,18 +610,6 @@ static void __init test_wp_bit(void) + } + } + +-static void __init set_max_mapnr_init(void) +-{ +-#ifdef CONFIG_HIGHMEM +- num_physpages = highend_pfn; +-#else +- num_physpages = max_low_pfn; +-#endif +-#ifdef CONFIG_FLATMEM +- max_mapnr = num_physpages; +-#endif +-} +- + static struct kcore_list kcore_mem, kcore_vmalloc; + + void __init mem_init(void) +@@ -623,8 +625,7 @@ void __init mem_init(void) + #endif + + #ifdef CONFIG_FLATMEM +- if (!mem_map) +- BUG(); ++ BUG_ON(!mem_map); + #endif + + bad_ppro = ppro_with_ram_bug(); +@@ -639,24 +640,12 @@ void __init mem_init(void) + } + #endif + +- set_max_mapnr_init(); +- +-#ifdef CONFIG_HIGHMEM +- high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; +-#else +- high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; +-#endif +- printk("vmalloc area: %lx-%lx, maxmem %lx\n", +- VMALLOC_START,VMALLOC_END,MAXMEM); +- BUG_ON(VMALLOC_START > VMALLOC_END); +- + /* this will put all low memory onto the freelists */ + totalram_pages += free_all_bootmem(); +- /* XEN: init and count low-mem pages outside initial allocation. */ ++ /* XEN: init low-mem pages outside initial allocation. */ + for (pfn = xen_start_info->nr_pages; pfn < max_low_pfn; pfn++) { + ClearPageReserved(pfn_to_page(pfn)); + init_page_count(pfn_to_page(pfn)); +- totalram_pages++; + } + + reservedpages = 0; +@@ -687,6 +676,48 @@ void __init mem_init(void) + (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) + ); + ++#if 1 /* double-sanity-check paranoia */ ++ printk("virtual kernel memory layout:\n" ++ " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" ++#ifdef CONFIG_HIGHMEM ++ " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n" ++#endif ++ " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" ++ " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" ++ " .init : 0x%08lx - 0x%08lx (%4ld kB)\n" ++ " .data : 0x%08lx - 0x%08lx (%4ld kB)\n" ++ " .text : 0x%08lx - 0x%08lx (%4ld kB)\n", ++ FIXADDR_START, FIXADDR_TOP, ++ (FIXADDR_TOP - FIXADDR_START) >> 10, ++ ++#ifdef CONFIG_HIGHMEM ++ PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE, ++ (LAST_PKMAP*PAGE_SIZE) >> 10, ++#endif ++ ++ VMALLOC_START, VMALLOC_END, ++ (VMALLOC_END - VMALLOC_START) >> 20, ++ ++ (unsigned long)__va(0), (unsigned long)high_memory, ++ ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, ++ ++ (unsigned long)&__init_begin, (unsigned long)&__init_end, ++ ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10, ++ ++ (unsigned long)&_etext, (unsigned long)&_edata, ++ ((unsigned long)&_edata - (unsigned long)&_etext) >> 10, ++ ++ (unsigned long)&_text, (unsigned long)&_etext, ++ ((unsigned long)&_etext - (unsigned long)&_text) >> 10); ++ ++#ifdef CONFIG_HIGHMEM ++ BUG_ON(PKMAP_BASE+LAST_PKMAP*PAGE_SIZE > FIXADDR_START); ++ BUG_ON(VMALLOC_END > PKMAP_BASE); ++#endif ++ BUG_ON(VMALLOC_START > VMALLOC_END); ++ BUG_ON((unsigned long)high_memory > VMALLOC_START); ++#endif /* double-sanity-check paranoia */ ++ + #ifdef CONFIG_X86_PAE + if (!cpu_has_pae) + panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!"); +@@ -717,7 +748,7 @@ void __init mem_init(void) + int arch_add_memory(int nid, u64 start, u64 size) + { + struct pglist_data *pgdata = &contig_page_data; +- struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1; ++ struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM; + unsigned long start_pfn = start >> PAGE_SHIFT; + unsigned long nr_pages = size >> PAGE_SHIFT; + +--- head.orig/arch/x86/mm/ioremap-xen.c 2011-04-11 13:43:15.000000000 +0200 ++++ head/arch/x86/mm/ioremap-xen.c 2011-02-07 15:37:37.000000000 +0100 +@@ -12,7 +12,7 @@ + #include <linux/init.h> + #include <linux/slab.h> + #include <linux/module.h> +-#include <asm/io.h> ++#include <linux/io.h> + #include <asm/fixmap.h> + #include <asm/cacheflush.h> + #include <asm/tlbflush.h> +@@ -114,7 +114,7 @@ int direct_remap_pfn_range(struct vm_are + if (domid == DOMID_SELF) + return -EINVAL; + +- vma->vm_flags |= VM_IO | VM_RESERVED; ++ vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; + + vma->vm_mm->context.has_foreign_mappings = 1; + +@@ -184,6 +184,7 @@ void __iomem * __ioremap(unsigned long p + void __iomem * addr; + struct vm_struct * area; + unsigned long offset, last_addr; ++ pgprot_t prot; + domid_t domid = DOMID_IO; + + /* Don't allow wraparound or zero size */ +@@ -215,6 +216,8 @@ void __iomem * __ioremap(unsigned long p + domid = DOMID_SELF; + } + ++ prot = __pgprot(_KERNPG_TABLE | flags); ++ + /* + * Mappings have to be page-aligned + */ +@@ -230,10 +233,9 @@ void __iomem * __ioremap(unsigned long p + return NULL; + area->phys_addr = phys_addr; + addr = (void __iomem *) area->addr; +- flags |= _KERNPG_TABLE; + if (__direct_remap_pfn_range(&init_mm, (unsigned long)addr, + phys_addr>>PAGE_SHIFT, +- size, __pgprot(flags), domid)) { ++ size, prot, domid)) { + vunmap((void __force *) addr); + return NULL; + } +--- head.orig/arch/x86/mm/pgtable_32-xen.c 2010-09-23 15:39:04.000000000 +0200 ++++ head/arch/x86/mm/pgtable_32-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -68,7 +68,9 @@ void show_mem(void) + printk(KERN_INFO "%lu pages writeback\n", + global_page_state(NR_WRITEBACK)); + printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED)); +- printk(KERN_INFO "%lu pages slab\n", global_page_state(NR_SLAB)); ++ printk(KERN_INFO "%lu pages slab\n", ++ global_page_state(NR_SLAB_RECLAIMABLE) + ++ global_page_state(NR_SLAB_UNRECLAIMABLE)); + printk(KERN_INFO "%lu pages pagetables\n", + global_page_state(NR_PAGETABLE)); + } +@@ -108,18 +110,11 @@ void set_pmd_pfn(unsigned long vaddr, un + __flush_tlb_one(vaddr); + } + +-static int nr_fixmaps = 0; ++static int fixmaps; + unsigned long hypervisor_virt_start = HYPERVISOR_VIRT_START; +-unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - 2 * PAGE_SIZE); ++unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - PAGE_SIZE); + EXPORT_SYMBOL(__FIXADDR_TOP); + +-void __init set_fixaddr_top(unsigned long top) +-{ +- BUG_ON(nr_fixmaps > 0); +- hypervisor_virt_start = top; +- __FIXADDR_TOP = hypervisor_virt_start - 2 * PAGE_SIZE; +-} +- + void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags) + { + unsigned long address = __fix_to_virt(idx); +@@ -141,7 +136,21 @@ void __set_fixmap (enum fixed_addresses + if (HYPERVISOR_update_va_mapping(address, pte, + UVMF_INVLPG|UVMF_ALL)) + BUG(); +- nr_fixmaps++; ++ fixmaps++; ++} ++ ++/** ++ * reserve_top_address - reserves a hole in the top of kernel address space ++ * @reserve - size of hole to reserve ++ * ++ * Can be used to relocate the fixmap area and poke a hole in the top ++ * of kernel address space to make room for a hypervisor. ++ */ ++void __init reserve_top_address(unsigned long reserve) ++{ ++ BUG_ON(fixmaps > 0); ++ __FIXADDR_TOP = -reserve - PAGE_SIZE; ++ __VMALLOC_RESERVE += reserve; + } + + pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) +--- head.orig/arch/x86/ia32/ia32entry-xen.S 2008-04-02 12:34:02.000000000 +0200 ++++ head/arch/x86/ia32/ia32entry-xen.S 2011-01-31 17:29:16.000000000 +0100 +@@ -83,6 +83,7 @@ + */ + ENTRY(ia32_sysenter_target) + CFI_STARTPROC32 simple ++ CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8-RIP+16 + /*CFI_REL_OFFSET ss,SS-RIP+16*/ + CFI_REL_OFFSET rsp,RSP-RIP+16 +@@ -164,6 +165,7 @@ ENDPROC(ia32_sysenter_target) + */ + ENTRY(ia32_cstar_target) + CFI_STARTPROC32 simple ++ CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8-RIP+16 + /*CFI_REL_OFFSET ss,SS-RIP+16*/ + CFI_REL_OFFSET rsp,RSP-RIP+16 +@@ -243,6 +245,7 @@ ia32_badarg: + + ENTRY(ia32_syscall) + CFI_STARTPROC simple ++ CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8-RIP+16 + /*CFI_REL_OFFSET ss,SS-RIP+16*/ + CFI_REL_OFFSET rsp,RSP-RIP+16 +@@ -320,6 +323,7 @@ ENTRY(ia32_ptregs_common) + popq %r11 + CFI_ENDPROC + CFI_STARTPROC32 simple ++ CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8-ARGOFFSET + CFI_REL_OFFSET rax,RAX-ARGOFFSET + CFI_REL_OFFSET rcx,RCX-ARGOFFSET +@@ -653,8 +657,8 @@ ia32_sys_call_table: + .quad sys_readlinkat /* 305 */ + .quad sys_fchmodat + .quad sys_faccessat +- .quad quiet_ni_syscall /* pselect6 for now */ +- .quad quiet_ni_syscall /* ppoll for now */ ++ .quad compat_sys_pselect6 ++ .quad compat_sys_ppoll + .quad sys_unshare /* 310 */ + .quad compat_sys_set_robust_list + .quad compat_sys_get_robust_list +@@ -663,4 +667,5 @@ ia32_sys_call_table: + .quad sys_tee + .quad compat_sys_vmsplice + .quad compat_sys_move_pages ++ .quad sys_getcpu + ia32_syscall_end: +--- head.orig/arch/x86/kernel/Makefile 2012-04-10 16:11:14.000000000 +0200 ++++ head/arch/x86/kernel/Makefile 2012-04-10 16:13:59.000000000 +0200 +@@ -107,7 +107,7 @@ obj-$(CONFIG_X86_XEN) += fixup.o + ### + # 64 bit specific files + ifeq ($(CONFIG_X86_64),y) +- obj-$(CONFIG_X86_XEN_GENAPIC) += genapic_xen_64.o ++ obj-$(CONFIG_X86_XEN_GENAPIC) += genapic_64.o genapic_xen_64.o + obj-$(CONFIG_AUDIT) += audit_64.o + + obj-$(CONFIG_GART_IOMMU) += amd_gart_64.o aperture_64.o +@@ -120,5 +120,7 @@ ifeq ($(CONFIG_X86_64),y) + pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o + endif + +-disabled-obj-$(CONFIG_XEN) := i8237.o i8253.o i8259_$(BITS).o reboot.o smpboot_$(BITS).o tsc_$(BITS).o ++disabled-obj-$(CONFIG_XEN) := early-quirks.o i8237.o i8253.o i8259_$(BITS).o \ ++ reboot.o smpboot_$(BITS).o tsc_$(BITS).o ++disabled-obj-$(CONFIG_XEN_UNPRIVILEGED_GUEST) += mpparse_64.o + %/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := +--- head.orig/arch/x86/kernel/e820_64-xen.c 2009-12-04 08:45:56.000000000 +0100 ++++ head/arch/x86/kernel/e820_64-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -16,6 +16,7 @@ + #include <linux/string.h> + #include <linux/kexec.h> + #include <linux/module.h> ++#include <linux/mm.h> + + #include <asm/pgtable.h> + #include <asm/page.h> +@@ -25,6 +26,11 @@ + #include <asm/sections.h> + #include <xen/interface/memory.h> + ++struct e820map e820 __initdata; ++#ifdef CONFIG_XEN ++struct e820map machine_e820 __initdata; ++#endif ++ + /* + * PFN of last memory page. + */ +@@ -43,14 +49,10 @@ unsigned long end_pfn_map; + /* + * Last pfn which the user wants to use. + */ +-unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT; ++static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; + + extern struct resource code_resource, data_resource; + +-#ifdef CONFIG_XEN +-extern struct e820map machine_e820; +-#endif +- + /* Check for some hardcoded bad areas that early boot is not allowed to touch */ + static inline int bad_addr(unsigned long *addrp, unsigned long size) + { +@@ -59,13 +61,13 @@ static inline int bad_addr(unsigned long + #ifndef CONFIG_XEN + /* various gunk below that needed for SMP startup */ + if (addr < 0x8000) { +- *addrp = 0x8000; ++ *addrp = PAGE_ALIGN(0x8000); + return 1; + } + + /* direct mapping tables of the kernel */ + if (last >= table_start<<PAGE_SHIFT && addr < table_end<<PAGE_SHIFT) { +- *addrp = table_end << PAGE_SHIFT; ++ *addrp = PAGE_ALIGN(table_end << PAGE_SHIFT); + return 1; + } + +@@ -73,23 +75,18 @@ static inline int bad_addr(unsigned long + #ifdef CONFIG_BLK_DEV_INITRD + if (LOADER_TYPE && INITRD_START && last >= INITRD_START && + addr < INITRD_START+INITRD_SIZE) { +- *addrp = INITRD_START + INITRD_SIZE; ++ *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); + return 1; + } + #endif +- /* kernel code + 640k memory hole (later should not be needed, but +- be paranoid for now) */ +- if (last >= 640*1024 && addr < 1024*1024) { +- *addrp = 1024*1024; +- return 1; +- } +- if (last >= __pa_symbol(&_text) && last < __pa_symbol(&_end)) { +- *addrp = __pa_symbol(&_end); ++ /* kernel code */ ++ if (last >= __pa_symbol(&_text) && addr < __pa_symbol(&_end)) { ++ *addrp = PAGE_ALIGN(__pa_symbol(&_end)); + return 1; + } + + if (last >= ebda_addr && addr < ebda_addr + ebda_size) { +- *addrp = ebda_addr + ebda_size; ++ *addrp = PAGE_ALIGN(ebda_addr + ebda_size); + return 1; + } + +@@ -186,7 +183,7 @@ unsigned long __init find_e820_area(unsi + continue; + while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size) + ; +- last = addr + size; ++ last = PAGE_ALIGN(addr) + size; + if (last > ei->addr + ei->size) + continue; + if (last > end) +@@ -196,59 +193,14 @@ unsigned long __init find_e820_area(unsi + return -1UL; + } + +-/* +- * Free bootmem based on the e820 table for a node. +- */ +-void __init e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end) +-{ +- int i; +- for (i = 0; i < e820.nr_map; i++) { +- struct e820entry *ei = &e820.map[i]; +- unsigned long last, addr; +- +- if (ei->type != E820_RAM || +- ei->addr+ei->size <= start || +- ei->addr >= end) +- continue; +- +- addr = round_up(ei->addr, PAGE_SIZE); +- if (addr < start) +- addr = start; +- +- last = round_down(ei->addr + ei->size, PAGE_SIZE); +- if (last >= end) +- last = end; +- +- if (last > addr && last-addr >= PAGE_SIZE) +- free_bootmem_node(pgdat, addr, last-addr); +- } +-} +- + /* + * Find the highest page frame number we have available + */ + unsigned long __init e820_end_of_ram(void) + { +- int i; + unsigned long end_pfn = 0; ++ end_pfn = find_max_pfn_with_active_regions(); + +- for (i = 0; i < e820.nr_map; i++) { +- struct e820entry *ei = &e820.map[i]; +- unsigned long start, end; +- +- start = round_up(ei->addr, PAGE_SIZE); +- end = round_down(ei->addr + ei->size, PAGE_SIZE); +- if (start >= end) +- continue; +- if (ei->type == E820_RAM) { +- if (end > end_pfn<<PAGE_SHIFT) +- end_pfn = end>>PAGE_SHIFT; +- } else { +- if (end > end_pfn_map<<PAGE_SHIFT) +- end_pfn_map = end>>PAGE_SHIFT; +- } +- } +- + if (end_pfn > end_pfn_map) + end_pfn_map = end_pfn; + if (end_pfn_map > MAXMEM>>PAGE_SHIFT) +@@ -258,43 +210,10 @@ unsigned long __init e820_end_of_ram(voi + if (end_pfn > end_pfn_map) + end_pfn = end_pfn_map; + ++ printk("end_pfn_map = %lu\n", end_pfn_map); + return end_pfn; + } + +-/* +- * Compute how much memory is missing in a range. +- * Unlike the other functions in this file the arguments are in page numbers. +- */ +-unsigned long __init +-e820_hole_size(unsigned long start_pfn, unsigned long end_pfn) +-{ +- unsigned long ram = 0; +- unsigned long start = start_pfn << PAGE_SHIFT; +- unsigned long end = end_pfn << PAGE_SHIFT; +- int i; +- for (i = 0; i < e820.nr_map; i++) { +- struct e820entry *ei = &e820.map[i]; +- unsigned long last, addr; +- +- if (ei->type != E820_RAM || +- ei->addr+ei->size <= start || +- ei->addr >= end) +- continue; +- +- addr = round_up(ei->addr, PAGE_SIZE); +- if (addr < start) +- addr = start; +- +- last = round_down(ei->addr + ei->size, PAGE_SIZE); +- if (last >= end) +- last = end; +- +- if (last > addr) +- ram += last - addr; +- } +- return ((end - start) - ram) >> PAGE_SHIFT; +-} +- + /* + * Mark e820 reserved areas as busy for the resource manager. + */ +@@ -335,6 +254,109 @@ void __init e820_reserve_resources(struc + } + } + ++#ifndef CONFIG_XEN ++/* Mark pages corresponding to given address range as nosave */ ++static void __init ++e820_mark_nosave_range(unsigned long start, unsigned long end) ++{ ++ unsigned long pfn, max_pfn; ++ ++ if (start >= end) ++ return; ++ ++ printk("Nosave address range: %016lx - %016lx\n", start, end); ++ max_pfn = end >> PAGE_SHIFT; ++ for (pfn = start >> PAGE_SHIFT; pfn < max_pfn; pfn++) ++ if (pfn_valid(pfn)) ++ SetPageNosave(pfn_to_page(pfn)); ++} ++ ++/* ++ * Find the ranges of physical addresses that do not correspond to ++ * e820 RAM areas and mark the corresponding pages as nosave for software ++ * suspend and suspend to RAM. ++ * ++ * This function requires the e820 map to be sorted and without any ++ * overlapping entries and assumes the first e820 area to be RAM. ++ */ ++void __init e820_mark_nosave_regions(void) ++{ ++ int i; ++ unsigned long paddr; ++ ++ paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE); ++ for (i = 1; i < e820.nr_map; i++) { ++ struct e820entry *ei = &e820.map[i]; ++ ++ if (paddr < ei->addr) ++ e820_mark_nosave_range(paddr, ++ round_up(ei->addr, PAGE_SIZE)); ++ ++ paddr = round_down(ei->addr + ei->size, PAGE_SIZE); ++ if (ei->type != E820_RAM) ++ e820_mark_nosave_range(round_up(ei->addr, PAGE_SIZE), ++ paddr); ++ ++ if (paddr >= (end_pfn << PAGE_SHIFT)) ++ break; ++ } ++} ++#endif ++ ++/* Walk the e820 map and register active regions within a node */ ++void __init ++e820_register_active_regions(int nid, unsigned long start_pfn, ++ unsigned long end_pfn) ++{ ++ int i; ++ unsigned long ei_startpfn, ei_endpfn; ++ for (i = 0; i < e820.nr_map; i++) { ++ struct e820entry *ei = &e820.map[i]; ++ ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT; ++ ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) ++ >> PAGE_SHIFT; ++ ++ /* Skip map entries smaller than a page */ ++ if (ei_startpfn >= ei_endpfn) ++ continue; ++ ++ /* Check if end_pfn_map should be updated */ ++ if (ei->type != E820_RAM && ei_endpfn > end_pfn_map) ++ end_pfn_map = ei_endpfn; ++ ++ /* Skip if map is outside the node */ ++ if (ei->type != E820_RAM || ++ ei_endpfn <= start_pfn || ++ ei_startpfn >= end_pfn) ++ continue; ++ ++ /* Check for overlaps */ ++ if (ei_startpfn < start_pfn) ++ ei_startpfn = start_pfn; ++ if (ei_endpfn > end_pfn) ++ ei_endpfn = end_pfn; ++ ++ /* Obey end_user_pfn to save on memmap */ ++ if (ei_startpfn >= end_user_pfn) ++ continue; ++ if (ei_endpfn > end_user_pfn) ++ ei_endpfn = end_user_pfn; ++ ++#ifdef CONFIG_XEN ++ if (ei_startpfn >= xen_start_info->nr_pages) ++ continue; ++ if (ei_endpfn > xen_start_info->nr_pages) ++ ei_endpfn = xen_start_info->nr_pages; ++#endif ++ ++ add_active_range(nid, ei_startpfn, ei_endpfn); ++ } ++#ifdef CONFIG_XEN ++ BUG_ON(nid); ++ add_active_range(nid, end_pfn, end_pfn); ++#endif ++} ++ + /* + * Add a memory region to the kernel e820 map. + */ +@@ -555,13 +577,6 @@ static int __init sanitize_e820_map(stru + * If we're lucky and live on a modern system, the setup code + * will have given us a memory map that we can use to properly + * set up memory. If we aren't, we'll fake a memory map. +- * +- * We check to see that the memory map contains at least 2 elements +- * before we'll use it, because the detection code in setup.S may +- * not be perfect and most every PC known to man has two memory +- * regions: one from 0 to 640k, and one from 1mb up. (The IBM +- * thinkpad 560x, for example, does not cooperate with the memory +- * detection code.) + */ + static int __init copy_e820_map(struct e820entry * biosmap, int nr_map) + { +@@ -583,27 +598,6 @@ static int __init copy_e820_map(struct e + if (start > end) + return -1; + +-#ifndef CONFIG_XEN +- /* +- * Some BIOSes claim RAM in the 640k - 1M region. +- * Not right. Fix it up. +- * +- * This should be removed on Hammer which is supposed to not +- * have non e820 covered ISA mappings there, but I had some strange +- * problems so it stays for now. -AK +- */ +- if (type == E820_RAM) { +- if (start < 0x100000ULL && end > 0xA0000ULL) { +- if (start < 0xA0000ULL) +- add_memory_region(start, 0xA0000ULL-start, type); +- if (end <= 0x100000ULL) +- continue; +- start = 0x100000ULL; +- size = end - start; +- } +- } +-#endif +- + add_memory_region(start, size, type); + } while (biosmap++,--nr_map); + +@@ -624,11 +618,15 @@ static int __init copy_e820_map(struct e + return 0; + } + ++void early_panic(char *msg) ++{ ++ early_printk(msg); ++ panic(msg); ++} ++ + #ifndef CONFIG_XEN + void __init setup_memory_region(void) + { +- char *who = "BIOS-e820"; +- + /* + * Try to copy the BIOS-supplied E820-map. + * +@@ -636,24 +634,10 @@ void __init setup_memory_region(void) + * the next section from 1mb->appropriate_mem_k + */ + sanitize_e820_map(E820_MAP, &E820_MAP_NR); +- if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { +- unsigned long mem_size; +- +- /* compare results from other methods and take the greater */ +- if (ALT_MEM_K < EXT_MEM_K) { +- mem_size = EXT_MEM_K; +- who = "BIOS-88"; +- } else { +- mem_size = ALT_MEM_K; +- who = "BIOS-e801"; +- } +- +- e820.nr_map = 0; +- add_memory_region(0, LOWMEMSIZE(), E820_RAM); +- add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); +- } ++ if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) ++ early_panic("Cannot find a valid memory map"); + printk(KERN_INFO "BIOS-provided physical RAM map:\n"); +- e820_print_map(who); ++ e820_print_map("BIOS-e820"); + } + + #else /* CONFIG_XEN */ +@@ -685,20 +669,23 @@ void __init setup_memory_region(void) + + sanitize_e820_map(map, (char *)&memmap.nr_entries); + +- BUG_ON(copy_e820_map(map, (char)memmap.nr_entries) < 0); ++ if (copy_e820_map(map, (char)memmap.nr_entries) < 0) ++ early_panic("Cannot find a valid memory map"); + + printk(KERN_INFO "BIOS-provided physical RAM map:\n"); + e820_print_map("Xen"); + } + #endif + +-void __init parse_memopt(char *p, char **from) +-{ ++static int __init parse_memopt(char *p) ++{ + int i; + unsigned long current_end; + unsigned long end; + +- end_user_pfn = memparse(p, from); ++ if (!p) ++ return -EINVAL; ++ end_user_pfn = memparse(p, &p); + end_user_pfn >>= PAGE_SHIFT; + + end = end_user_pfn<<PAGE_SHIFT; +@@ -715,27 +702,61 @@ void __init parse_memopt(char *p, char * + else + add_memory_region(current_end, end - current_end, E820_RAM); + } ++ ++ return 0; + } ++early_param("mem", parse_memopt); + +-void __init parse_memmapopt(char *p, char **from) ++static int userdef __initdata; ++ ++static int __init parse_memmap_opt(char *p) + { ++ char *oldp; + unsigned long long start_at, mem_size; + +- mem_size = memparse(p, from); +- p = *from; ++ if (!strcmp(p, "exactmap")) { ++#ifdef CONFIG_CRASH_DUMP ++ /* If we are doing a crash dump, we ++ * still need to know the real mem ++ * size before original memory map is ++ * reset. ++ */ ++ e820_register_active_regions(0, 0, -1UL); ++ saved_max_pfn = e820_end_of_ram(); ++ remove_all_active_ranges(); ++#endif ++ end_pfn_map = 0; ++ e820.nr_map = 0; ++ userdef = 1; ++ return 0; ++ } ++ ++ oldp = p; ++ mem_size = memparse(p, &p); ++ if (p == oldp) ++ return -EINVAL; + if (*p == '@') { +- start_at = memparse(p+1, from); ++ start_at = memparse(p+1, &p); + add_memory_region(start_at, mem_size, E820_RAM); + } else if (*p == '#') { +- start_at = memparse(p+1, from); ++ start_at = memparse(p+1, &p); + add_memory_region(start_at, mem_size, E820_ACPI); + } else if (*p == '$') { +- start_at = memparse(p+1, from); ++ start_at = memparse(p+1, &p); + add_memory_region(start_at, mem_size, E820_RESERVED); + } else { + end_user_pfn = (mem_size >> PAGE_SHIFT); + } +- p = *from; ++ return *p == '\0' ? 0 : -EINVAL; ++} ++early_param("memmap", parse_memmap_opt); ++ ++void finish_e820_parsing(void) ++{ ++ if (userdef) { ++ printk(KERN_INFO "user-defined physical RAM map:\n"); ++ e820_print_map("user"); ++ } + } + + unsigned long pci_mem_start = 0xaeedbabe; +--- head.orig/arch/x86/kernel/early_printk-xen.c 2007-06-12 13:13:01.000000000 +0200 ++++ head/arch/x86/kernel/early_printk-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -244,20 +244,16 @@ void early_printk(const char *fmt, ...) + + static int __initdata keep_early; + +-int __init setup_early_printk(char *opt) ++static int __init setup_early_printk(char *buf) + { +- char *space; +- char buf[256]; ++ if (!buf) ++ return 0; + + if (early_console_initialized) +- return 1; +- +- strlcpy(buf,opt,sizeof(buf)); +- space = strchr(buf, ' '); +- if (space) +- *space = 0; ++ return 0; ++ early_console_initialized = 1; + +- if (strstr(buf,"keep")) ++ if (strstr(buf, "keep")) + keep_early = 1; + + if (!strncmp(buf, "serial", 6)) { +@@ -281,11 +277,12 @@ int __init setup_early_printk(char *opt) + early_console = &simnow_console; + keep_early = 1; + } +- early_console_initialized = 1; + register_console(early_console); + return 0; + } + ++early_param("earlyprintk", setup_early_printk); ++ + void __init disable_early_printk(void) + { + if (!early_console_initialized || !early_console) +@@ -299,4 +296,3 @@ void __init disable_early_printk(void) + } + } + +-__setup("earlyprintk=", setup_early_printk); +--- head.orig/arch/x86/kernel/entry_64-xen.S 2011-10-07 10:44:29.000000000 +0200 ++++ head/arch/x86/kernel/entry_64-xen.S 2011-10-07 11:17:17.000000000 +0200 +@@ -4,9 +4,6 @@ + * Copyright (C) 1991, 1992 Linus Torvalds + * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs + * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> +- * +- * $Id$ +- * + * Jun Nakajima <jun.nakajima@intel.com> + * Asit Mallick <asit.k.mallick@intel.com> + * Modified for Xen +@@ -26,15 +23,25 @@ + * at the top of the kernel process stack. + * - partial stack frame: partially saved registers upto R11. + * - full stack frame: Like partial stack frame, but all register saved. +- * +- * TODO: +- * - schedule it carefully for the final hardware. ++ * ++ * Some macro usage: ++ * - CFI macros are used to generate dwarf2 unwind information for better ++ * backtraces. They don't change any code. ++ * - SAVE_ALL/RESTORE_ALL - Save/restore all registers ++ * - SAVE_ARGS/RESTORE_ARGS - Save/restore registers that C functions modify. ++ * There are unfortunately lots of special cases where some registers ++ * not touched. The macro is a big mess that should be cleaned up. ++ * - SAVE_REST/RESTORE_REST - Handle the registers not saved by SAVE_ARGS. ++ * Gives a full stack frame. ++ * - ENTRY/END Define functions in the symbol table. ++ * - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack ++ * frame that is otherwise undefined after a SYSCALL ++ * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging. ++ * - errorentry/paranoidentry/zeroentry - Define exception entry points. + */ + +-#define ASSEMBLY 1 + #include <linux/linkage.h> + #include <asm/segment.h> +-#include <asm/smp.h> + #include <asm/cache.h> + #include <asm/errno.h> + #include <asm/dwarf2.h> +@@ -117,6 +124,7 @@ NMI_MASK = 0x80000000 + .macro CFI_DEFAULT_STACK start=1,adj=0 + .if \start + CFI_STARTPROC simple ++ CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8 - \adj*ARGOFFSET + .else + CFI_DEF_CFA_OFFSET SS+8 - \adj*ARGOFFSET +@@ -209,6 +217,7 @@ END(ret_from_fork) + */ + .macro _frame ref + CFI_STARTPROC simple ++ CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8-\ref + /*CFI_REL_OFFSET ss,SS-\ref*/ + CFI_REL_OFFSET rsp,RSP-\ref +@@ -337,6 +346,8 @@ tracesys: + LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ + RESTORE_REST + cmpq $__NR_syscall_max,%rax ++ movq $-ENOSYS,%rcx ++ cmova %rcx,%rax + ja 1f + movq %r10,%rcx /* fixup for C */ + call *sys_call_table(,%rax,8) +@@ -352,6 +363,7 @@ END(system_call) + */ + ENTRY(int_ret_from_sys_call) + CFI_STARTPROC simple ++ CFI_SIGNAL_FRAME + CFI_DEF_CFA rsp,SS+8-ARGOFFSET + /*CFI_REL_OFFSET ss,SS-ARGOFFSET*/ + CFI_REL_OFFSET rsp,RSP-ARGOFFSET +@@ -586,8 +598,7 @@ retint_signal: + #ifdef CONFIG_PREEMPT + /* Returning to kernel space. Check if we need preemption */ + /* rcx: threadinfo. interrupts off. */ +- .p2align +-retint_kernel: ++ENTRY(retint_kernel) + cmpl $0,threadinfo_preempt_count(%rcx) + jnz retint_restore_args + bt $TIF_NEED_RESCHED,threadinfo_flags(%rcx) +@@ -647,7 +658,6 @@ ENTRY(call_function_interrupt) + END(call_function_interrupt) + #endif + +-#ifdef CONFIG_X86_LOCAL_APIC + ENTRY(apic_timer_interrupt) + apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt + END(apic_timer_interrupt) +@@ -659,7 +669,6 @@ END(error_interrupt) + ENTRY(spurious_interrupt) + apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt + END(spurious_interrupt) +-#endif + #endif /* !CONFIG_XEN */ + + /* +@@ -758,7 +767,9 @@ paranoid_exit\trace: + testl $3,CS(%rsp) + jnz paranoid_userspace\trace + paranoid_swapgs\trace: ++ .if \trace + TRACE_IRQS_IRETQ 0 ++ .endif + swapgs + paranoid_restore\trace: + RESTORE_ALL 8 +@@ -805,7 +816,7 @@ paranoid_schedule\trace: + * Exception entry point. This expects an error code/orig_rax on the stack + * and the exception handler in %rax. + */ +-ENTRY(error_entry) ++KPROBE_ENTRY(error_entry) + _frame RDI + CFI_REL_OFFSET rax,0 + /* rdi slot contains rax, oldrax contains error code */ +@@ -899,7 +910,7 @@ error_kernelspace: + jmp error_sti + #endif + CFI_ENDPROC +-END(error_entry) ++KPROBE_END(error_entry) + + ENTRY(hypervisor_callback) + zeroentry do_hypervisor_callback +@@ -939,26 +950,6 @@ ENTRY(do_hypervisor_callback) # do_hyp + CFI_ENDPROC + END(do_hypervisor_callback) + +-#ifdef CONFIG_X86_LOCAL_APIC +-KPROBE_ENTRY(nmi) +- zeroentry do_nmi_callback +-ENTRY(do_nmi_callback) +- CFI_STARTPROC +- addq $8, %rsp +- CFI_ENDPROC +- CFI_DEFAULT_STACK +- call do_nmi +- orl $NMI_MASK,EFLAGS(%rsp) +- RESTORE_REST +- XEN_BLOCK_EVENTS(%rsi) +- TRACE_IRQS_OFF +- GET_THREAD_INFO(%rcx) +- jmp retint_restore_args +- CFI_ENDPROC +- .previous .text +-END(nmi) +-#endif +- + ALIGN + restore_all_enable_events: + CFI_DEFAULT_STACK adj=1 +@@ -1124,7 +1115,7 @@ ENDPROC(child_rip) + * do_sys_execve asm fallback arguments: + * rdi: name, rsi: argv, rdx: envp, fake frame on the stack + */ +-ENTRY(execve) ++ENTRY(kernel_execve) + CFI_STARTPROC + FAKE_STACK_FRAME $0 + SAVE_ALL +@@ -1138,12 +1129,11 @@ ENTRY(execve) + UNFAKE_STACK_FRAME + ret + CFI_ENDPROC +-ENDPROC(execve) ++ENDPROC(kernel_execve) + + KPROBE_ENTRY(page_fault) + errorentry do_page_fault +-END(page_fault) +- .previous .text ++KPROBE_END(page_fault) + + ENTRY(coprocessor_error) + zeroentry do_coprocessor_error +@@ -1165,25 +1155,25 @@ KPROBE_ENTRY(debug) + zeroentry do_debug + /* paranoidexit + CFI_ENDPROC */ +-END(debug) +- .previous .text ++KPROBE_END(debug) + +-#if 0 +- /* runs on exception stack */ + KPROBE_ENTRY(nmi) +- INTR_FRAME +- pushq $-1 +- CFI_ADJUST_CFA_OFFSET 8 +- paranoidentry do_nmi, 0, 0 +-#ifdef CONFIG_TRACE_IRQFLAGS +- paranoidexit 0 +-#else +- jmp paranoid_exit1 +- CFI_ENDPROC +-#endif +-END(nmi) +- .previous .text +-#endif ++ zeroentry do_nmi_callback ++KPROBE_END(nmi) ++do_nmi_callback: ++ CFI_STARTPROC ++ addq $8, %rsp ++ CFI_ENDPROC ++ CFI_DEFAULT_STACK ++ call do_nmi ++ orl $NMI_MASK,EFLAGS(%rsp) ++ RESTORE_REST ++ XEN_BLOCK_EVENTS(%rsi) ++ TRACE_IRQS_OFF ++ GET_THREAD_INFO(%rcx) ++ jmp retint_restore_args ++ CFI_ENDPROC ++END(do_nmi_callback) + + KPROBE_ENTRY(int3) + /* INTR_FRAME +@@ -1192,8 +1182,7 @@ KPROBE_ENTRY(int3) + zeroentry do_int3 + /* jmp paranoid_exit1 + CFI_ENDPROC */ +-END(int3) +- .previous .text ++KPROBE_END(int3) + + ENTRY(overflow) + zeroentry do_overflow +@@ -1244,8 +1233,7 @@ END(stack_segment) + + KPROBE_ENTRY(general_protection) + errorentry do_general_protection +-END(general_protection) +- .previous .text ++KPROBE_END(general_protection) + + ENTRY(alignment_check) + errorentry do_alignment_check +--- head.orig/arch/x86/kernel/head_64-xen.S 2011-08-08 12:54:10.000000000 +0200 ++++ head/arch/x86/kernel/head_64-xen.S 2011-08-09 10:35:37.000000000 +0200 +@@ -5,9 +5,6 @@ + * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> + * Copyright (C) 2000 Karsten Keil <kkeil@suse.de> + * Copyright (C) 2001,2002 Andi Kleen <ak@suse.de> +- * +- * $Id: head.S,v 1.49 2002/03/19 17:39:25 ak Exp $ +- * + * Jun Nakajima <jun.nakajima@intel.com> + * Modified for Xen + */ +@@ -147,7 +144,7 @@ ENTRY(cpu_gdt_table) + .quad 0,0 /* TSS */ + .quad 0,0 /* LDT */ + .quad 0,0,0 /* three TLS descriptors */ +- .quad 0 /* unused */ ++ .quad 0x0000f40000000000 /* node/CPU stored in limit */ + gdt_end: + /* asm/segment.h:GDT_ENTRIES must match this */ + /* This should be a multiple of the cache line size */ +--- head.orig/arch/x86/kernel/head64-xen.c 2011-08-08 12:54:10.000000000 +0200 ++++ head/arch/x86/kernel/head64-xen.c 2011-08-09 10:35:40.000000000 +0200 +@@ -7,6 +7,9 @@ + * Modified for Xen. + */ + ++/* PDA is not ready to be used until the end of x86_64_start_kernel(). */ ++#define arch_use_lazy_mmu_mode() false ++ + #include <linux/init.h> + #include <linux/linkage.h> + #include <linux/types.h> +@@ -54,11 +57,9 @@ static void __init copy_bootdata(char *r + new_data = *(int *) (x86_boot_params + NEW_CL_POINTER); + if (!new_data) { + if (OLD_CL_MAGIC != * (u16 *) OLD_CL_MAGIC_ADDR) { +- printk("so old bootloader that it does not support commandline?!\n"); + return; + } + new_data = OLD_CL_BASE_ADDR + * (u16 *) OLD_CL_OFFSET; +- printk("old bootloader convention, maybe loadlin?\n"); + } + command_line = (char *) ((u64)(new_data)); + memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); +@@ -70,25 +71,6 @@ static void __init copy_bootdata(char *r + memcpy(saved_command_line, xen_start_info->cmd_line, max_cmdline); + saved_command_line[max_cmdline-1] = '\0'; + #endif +- printk("Bootdata ok (command line is %s)\n", saved_command_line); +-} +- +-static void __init setup_boot_cpu_data(void) +-{ +- unsigned int dummy, eax; +- +- /* get vendor info */ +- cpuid(0, (unsigned int *)&boot_cpu_data.cpuid_level, +- (unsigned int *)&boot_cpu_data.x86_vendor_id[0], +- (unsigned int *)&boot_cpu_data.x86_vendor_id[8], +- (unsigned int *)&boot_cpu_data.x86_vendor_id[4]); +- +- /* get cpu type */ +- cpuid(1, &eax, &dummy, &dummy, +- (unsigned int *) &boot_cpu_data.x86_capability); +- boot_cpu_data.x86 = (eax >> 8) & 0xf; +- boot_cpu_data.x86_model = (eax >> 4) & 0xf; +- boot_cpu_data.x86_mask = eax & 0xf; + } + + #include <xen/interface/memory.h> +@@ -100,7 +82,6 @@ EXPORT_SYMBOL(machine_to_phys_nr); + void __init x86_64_start_kernel(char * real_mode_data) + { + struct xen_machphys_mapping mapping; +- char *s; + int i; + + setup_xen_features(); +@@ -125,10 +106,7 @@ void __init x86_64_start_kernel(char * r + asm volatile("lidt %0" :: "m" (idt_descr)); + #endif + +- /* +- * This must be called really, really early: +- */ +- lockdep_init(); ++ early_printk("Kernel alive\n"); + + for (i = 0; i < NR_CPUS; i++) + cpu_pda(i) = &boot_cpu_pda[i]; +@@ -138,22 +116,5 @@ void __init x86_64_start_kernel(char * r + #ifdef CONFIG_SMP + cpu_set(0, cpu_online_map); + #endif +- s = strstr(saved_command_line, "earlyprintk="); +- if (s != NULL) +- setup_early_printk(strchr(s, '=') + 1); +-#ifdef CONFIG_NUMA +- s = strstr(saved_command_line, "numa="); +- if (s != NULL) +- numa_setup(s+5); +-#endif +-#ifdef CONFIG_X86_IO_APIC +- if (strstr(saved_command_line, "disableapic")) +- disable_apic = 1; +-#endif +- /* You need early console to see that */ +- if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE) +- panic("Kernel too big for kernel mapping\n"); +- +- setup_boot_cpu_data(); + start_kernel(); + } +--- head.orig/arch/x86/kernel/io_apic_64-xen.c 2009-03-18 10:39:31.000000000 +0100 ++++ head/arch/x86/kernel/io_apic_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -26,9 +26,12 @@ #include <linux/delay.h> #include <linux/sched.h> @@ -4058,10 +5349,8 @@ Acked-by: jbeulich@novell.com apic_op.value = value; WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op)); +#endif - } - --#define io_apic_read(a,r) xen_io_apic_read(a,r) --#define io_apic_write(a,r,v) xen_io_apic_write(a,r,v) ++} ++ +#ifndef CONFIG_XEN +/* + * Re-write a value: to be used for read-modify-write @@ -4071,12 +5360,13 @@ Acked-by: jbeulich@novell.com +{ + struct io_apic __iomem *io_apic = io_apic_base(apic); + writel(value, &io_apic->data); -+} + } +#else +#define io_apic_modify io_apic_write +#endif --#define clear_IO_APIC() ((void)0) +-#define io_apic_read(a,r) xen_io_apic_read(a,r) +-#define io_apic_write(a,r,v) xen_io_apic_write(a,r,v) +/* + * Synchronize the IO-APIC and the CPU by doing + * a dummy read from the IO-APIC @@ -4089,12 +5379,13 @@ Acked-by: jbeulich@novell.com +#endif +} --#else +-#define clear_IO_APIC() ((void)0) +union entry_union { + struct { u32 w1, w2; }; + struct IO_APIC_route_entry entry; +}; -+ + +-#else +#ifndef CONFIG_XEN +static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin) +{ @@ -4423,7 +5714,7 @@ Acked-by: jbeulich@novell.com (mp_irqs[i].mpc_irqtype == type) && (mp_irqs[i].mpc_srcbusirq == irq)) -@@ -497,9 +467,7 @@ static int __init find_isa_irq_apic(int +@@ -497,9 +467,7 @@ static int __init find_isa_irq_apic(int for (i = 0; i < mp_irq_entries; i++) { int lbus = mp_irqs[i].mpc_srcbus; @@ -4434,7 +5725,7 @@ Acked-by: jbeulich@novell.com (mp_irqs[i].mpc_irqtype == type) && (mp_irqs[i].mpc_srcbusirq == irq)) break; -@@ -540,7 +508,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, +@@ -540,7 +508,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, mp_irqs[i].mpc_dstapic == MP_APIC_ALL) break; @@ -4443,7 +5734,7 @@ Acked-by: jbeulich@novell.com !mp_irqs[i].mpc_irqtype && (bus == lbus) && (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) { -@@ -563,27 +531,6 @@ int IO_APIC_get_PCI_irq_vector(int bus, +@@ -563,27 +531,6 @@ int IO_APIC_get_PCI_irq_vector(int bus, return best_guess; } @@ -4635,7 +5926,7 @@ Acked-by: jbeulich@novell.com static int pin_2_irq(int idx, int apic, int pin) { int irq, i; -@@ -819,49 +648,16 @@ static int pin_2_irq(int idx, int apic, +@@ -819,49 +648,16 @@ static int pin_2_irq(int idx, int apic, if (mp_irqs[idx].mpc_dstirq != pin) printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); @@ -4741,12 +6032,12 @@ Acked-by: jbeulich@novell.com - spin_unlock_irqrestore(&vector_lock, flags); + return vector; +} - ++ +static int assign_irq_vector(int irq, cpumask_t mask, cpumask_t *result) +{ + int vector; + unsigned long flags; -+ + + spin_lock_irqsave(&vector_lock, flags); + vector = __assign_irq_vector(irq, mask, result); + spin_unlock_irqrestore(&vector_lock, flags); @@ -5083,15 +6374,15 @@ Acked-by: jbeulich@novell.com -} - -static void mask_IO_APIC_vector (unsigned int vector) -+static int ioapic_retrigger_irq(unsigned int irq) - { +-{ - int irq = vector_to_irq(vector); - - mask_IO_APIC_irq(irq); -} - -static void unmask_IO_APIC_vector (unsigned int vector) --{ ++static int ioapic_retrigger_irq(unsigned int irq) + { - int irq = vector_to_irq(vector); - - unmask_IO_APIC_irq(irq); @@ -5407,15 +6698,15 @@ Acked-by: jbeulich@novell.com + return; + + dest = cpu_mask_to_apicid(tmp); - --int __init io_apic_get_version (int ioapic) ++ + read_msi_msg(irq, &msg); + + msg.data &= ~MSI_DATA_VECTOR_MASK; + msg.data |= MSI_DATA_VECTOR(vector); + msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; + msg.address_lo |= MSI_ADDR_DEST_ID(dest); -+ + +-int __init io_apic_get_version (int ioapic) + write_msi_msg(irq, &msg); + set_native_irq_info(irq, mask); +} @@ -5450,7 +6741,8 @@ Acked-by: jbeulich@novell.com - reg_01.raw = io_apic_read(ioapic, 1); - spin_unlock_irqrestore(&ioapic_lock, flags); + write_msi_msg(irq, &msg); -+ + +- return reg_01.bits.version; + set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); + + return 0; @@ -5459,8 +6751,8 @@ Acked-by: jbeulich@novell.com +void arch_teardown_msi_irq(unsigned int irq) +{ + return; -+} -+ + } + +#endif /* CONFIG_PCI_MSI */ + +/* @@ -5477,14 +6769,13 @@ Acked-by: jbeulich@novell.com + + msg.address_lo &= ~(HT_IRQ_LOW_VECTOR_MASK | HT_IRQ_LOW_DEST_ID_MASK); + msg.address_hi &= ~(HT_IRQ_HIGH_DEST_ID_MASK); - -- return reg_01.bits.version; ++ + msg.address_lo |= HT_IRQ_LOW_VECTOR(vector) | HT_IRQ_LOW_DEST_ID(dest); + msg.address_hi |= HT_IRQ_HIGH_DEST_ID(dest); + + write_ht_irq_msg(irq, &msg); - } - ++} ++ +static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask) +{ + unsigned int dest; @@ -5628,8 +6919,8 @@ Acked-by: jbeulich@novell.com spin_unlock_irqrestore(&ioapic_lock, flags); return 0; ---- a/arch/x86/kernel/ioport_64-xen.c -+++ b/arch/x86/kernel/ioport_64-xen.c +--- head.orig/arch/x86/kernel/ioport_64-xen.c 2008-01-28 12:24:19.000000000 +0100 ++++ head/arch/x86/kernel/ioport_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -58,6 +58,7 @@ asmlinkage long sys_ioperm(unsigned long memset(bitmap, 0xff, IO_BITMAP_BYTES); @@ -5638,322 +6929,8 @@ Acked-by: jbeulich@novell.com set_xen_guest_handle(set_iobitmap.bitmap, (char *)bitmap); set_iobitmap.nr_ports = IO_BITMAP_BITS; ---- a/arch/x86/kernel/ldt_32-xen.c -+++ b/arch/x86/kernel/ldt_32-xen.c -@@ -1,5 +1,5 @@ - /* -- * linux/kernel/ldt.c -+ * linux/arch/i386/kernel/ldt.c - * - * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds - * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> ---- a/arch/x86/kernel/microcode_core-xen.c -+++ b/arch/x86/kernel/microcode_core-xen.c -@@ -2,6 +2,7 @@ - * Intel CPU Microcode Update Driver for Linux - * - * Copyright (C) 2000-2004 Tigran Aivazian -+ * 2006 Shaohua Li <shaohua.li@intel.com> - * - * This driver allows to upgrade microcode on Intel processors - * belonging to IA-32 family - PentiumPro, Pentium II, -@@ -33,7 +34,9 @@ - #include <linux/spinlock.h> - #include <linux/mm.h> - #include <linux/mutex.h> --#include <linux/syscalls.h> -+#include <linux/cpu.h> -+#include <linux/firmware.h> -+#include <linux/platform_device.h> - - #include <asm/msr.h> - #include <asm/uaccess.h> -@@ -55,12 +58,7 @@ module_param(verbose, int, 0644); - /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ - static DEFINE_MUTEX(microcode_mutex); - --static int microcode_open (struct inode *unused1, struct file *unused2) --{ -- return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; --} -- -- -+#ifdef CONFIG_MICROCODE_OLD_INTERFACE - static int do_microcode_update (const void __user *ubuf, size_t len) - { - int err; -@@ -85,6 +83,11 @@ static int do_microcode_update (const vo - return err; - } - -+static int microcode_open (struct inode *unused1, struct file *unused2) -+{ -+ return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; -+} -+ - static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos) - { - ssize_t ret; -@@ -117,7 +120,7 @@ static struct miscdevice microcode_dev = - .fops = µcode_fops, - }; - --static int __init microcode_init (void) -+static int __init microcode_dev_init (void) - { - int error; - -@@ -132,6 +135,68 @@ static int __init microcode_init (void) - return error; - } - -+ return 0; -+} -+ -+static void __exit microcode_dev_exit (void) -+{ -+ misc_deregister(µcode_dev); -+} -+ -+MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); -+#else -+#define microcode_dev_init() 0 -+#define microcode_dev_exit() do { } while(0) -+#endif -+ -+/* fake device for request_firmware */ -+static struct platform_device *microcode_pdev; -+ -+static int request_microcode(void) -+{ -+ char name[30]; -+ const struct cpuinfo_x86 *c = &boot_cpu_data; -+ const struct firmware *firmware; -+ int error; -+ struct xen_platform_op op; -+ -+ sprintf(name,"intel-ucode/%02x-%02x-%02x", -+ c->x86, c->x86_model, c->x86_mask); -+ error = request_firmware(&firmware, name, µcode_pdev->dev); -+ if (error) { -+ pr_debug("ucode data file %s load failed\n", name); -+ return error; -+ } -+ -+ op.cmd = XENPF_microcode_update; -+ set_xen_guest_handle(op.u.microcode.data, (void *)firmware->data); -+ op.u.microcode.length = firmware->size; -+ error = HYPERVISOR_platform_op(&op); -+ -+ release_firmware(firmware); -+ -+ if (error) -+ pr_debug("ucode load failed\n"); -+ -+ return error; -+} -+ -+static int __init microcode_init (void) -+{ -+ int error; -+ -+ error = microcode_dev_init(); -+ if (error) -+ return error; -+ microcode_pdev = platform_device_register_simple("microcode", -1, -+ NULL, 0); -+ if (IS_ERR(microcode_pdev)) { -+ microcode_dev_exit(); -+ return PTR_ERR(microcode_pdev); -+ } -+ -+ request_microcode(); -+ - printk(KERN_INFO - "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " <tigran@veritas.com>\n"); - return 0; -@@ -139,9 +204,9 @@ static int __init microcode_init (void) - - static void __exit microcode_exit (void) - { -- misc_deregister(µcode_dev); -+ microcode_dev_exit(); -+ platform_device_unregister(microcode_pdev); - } - - module_init(microcode_init) - module_exit(microcode_exit) --MODULE_ALIAS_MISCDEV(MICROCODE_MINOR); ---- a/arch/x86/kernel/mpparse_32-xen.c -+++ b/arch/x86/kernel/mpparse_32-xen.c -@@ -30,6 +30,7 @@ - #include <asm/io_apic.h> - - #include <mach_apic.h> -+#include <mach_apicdef.h> - #include <mach_mpparse.h> - #include <bios_ebda.h> - -@@ -68,7 +69,7 @@ unsigned int def_to_bigsmp = 0; - /* Processor that is doing the boot up */ - unsigned int boot_cpu_physical_apicid = -1U; - /* Internal processor count */ --static unsigned int __devinitdata num_processors; -+unsigned int __cpuinitdata num_processors; - - /* Bitmask of physically existing CPUs */ - physid_mask_t phys_cpu_present_map; -@@ -235,12 +236,14 @@ static void __init MP_bus_info (struct m - - mpc_oem_bus_info(m, str, translation_table[mpc_record]); - -+#if MAX_MP_BUSSES < 256 - if (m->mpc_busid >= MAX_MP_BUSSES) { - printk(KERN_WARNING "MP table busid value (%d) for bustype %s " - " is too large, max. supported is %d\n", - m->mpc_busid, str, MAX_MP_BUSSES - 1); - return; - } -+#endif - - if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) { - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; -@@ -300,19 +303,6 @@ static void __init MP_lintsrc_info (stru - m->mpc_irqtype, m->mpc_irqflag & 3, - (m->mpc_irqflag >> 2) &3, m->mpc_srcbusid, - m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); -- /* -- * Well it seems all SMP boards in existence -- * use ExtINT/LVT1 == LINT0 and -- * NMI/LVT2 == LINT1 - the following check -- * will show us if this assumptions is false. -- * Until then we do not have to add baggage. -- */ -- if ((m->mpc_irqtype == mp_ExtINT) && -- (m->mpc_destapiclint != 0)) -- BUG(); -- if ((m->mpc_irqtype == mp_NMI) && -- (m->mpc_destapiclint != 1)) -- BUG(); - } - - #ifdef CONFIG_X86_NUMAQ -@@ -838,8 +828,7 @@ int es7000_plat; - - #ifdef CONFIG_ACPI - --void __init mp_register_lapic_address ( -- u64 address) -+void __init mp_register_lapic_address(u64 address) - { - #ifndef CONFIG_XEN - mp_lapic_addr = (unsigned long) address; -@@ -853,13 +842,10 @@ void __init mp_register_lapic_address ( - #endif - } - -- --void __devinit mp_register_lapic ( -- u8 id, -- u8 enabled) -+void __devinit mp_register_lapic (u8 id, u8 enabled) - { - struct mpc_config_processor processor; -- int boot_cpu = 0; -+ int boot_cpu = 0; - - if (MAX_APICS - id <= 0) { - printk(KERN_WARNING "Processor #%d invalid (max %d)\n", -@@ -898,11 +884,9 @@ static struct mp_ioapic_routing { - u32 pin_programmed[4]; - } mp_ioapic_routing[MAX_IO_APICS]; - -- --static int mp_find_ioapic ( -- int gsi) -+static int mp_find_ioapic (int gsi) - { -- int i = 0; -+ int i = 0; - - /* Find the IOAPIC that manages this GSI. */ - for (i = 0; i < nr_ioapics; i++) { -@@ -915,15 +899,11 @@ static int mp_find_ioapic ( - - return -1; - } -- - --void __init mp_register_ioapic ( -- u8 id, -- u32 address, -- u32 gsi_base) -+void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base) - { -- int idx = 0; -- int tmpid; -+ int idx = 0; -+ int tmpid; - - if (nr_ioapics >= MAX_IO_APICS) { - printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " -@@ -971,16 +951,10 @@ void __init mp_register_ioapic ( - mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, - mp_ioapic_routing[idx].gsi_base, - mp_ioapic_routing[idx].gsi_end); -- -- return; - } - -- --void __init mp_override_legacy_irq ( -- u8 bus_irq, -- u8 polarity, -- u8 trigger, -- u32 gsi) -+void __init -+mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) - { - struct mpc_config_intsrc intsrc; - int ioapic = -1; -@@ -1018,15 +992,13 @@ void __init mp_override_legacy_irq ( - mp_irqs[mp_irq_entries] = intsrc; - if (++mp_irq_entries == MAX_IRQ_SOURCES) - panic("Max # of irq sources exceeded!\n"); -- -- return; - } - - void __init mp_config_acpi_legacy_irqs (void) - { - struct mpc_config_intsrc intsrc; -- int i = 0; -- int ioapic = -1; -+ int i = 0; -+ int ioapic = -1; - - /* - * Fabricate the legacy ISA bus (bus #31). -@@ -1095,12 +1067,12 @@ void __init mp_config_acpi_legacy_irqs ( - - #define MAX_GSI_NUM 4096 - --int mp_register_gsi (u32 gsi, int triggering, int polarity) -+int mp_register_gsi(u32 gsi, int triggering, int polarity) - { -- int ioapic = -1; -- int ioapic_pin = 0; -- int idx, bit = 0; -- static int pci_irq = 16; -+ int ioapic = -1; -+ int ioapic_pin = 0; -+ int idx, bit = 0; -+ static int pci_irq = 16; - /* - * Mapping between Global System Interrups, which - * represent all possible interrupts, and IRQs ---- a/arch/x86/kernel/mpparse_64-xen.c -+++ b/arch/x86/kernel/mpparse_64-xen.c +--- head.orig/arch/x86/kernel/mpparse_64-xen.c 2007-06-12 13:13:01.000000000 +0200 ++++ head/arch/x86/kernel/mpparse_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -41,8 +41,7 @@ int acpi_found_madt; * Various Linux-internal data structures created from the * MP-table. @@ -5992,7 +6969,7 @@ Acked-by: jbeulich@novell.com u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; -@@ -109,24 +94,20 @@ static int __init mpf_checksum(unsigned +@@ -109,24 +94,20 @@ static int __init mpf_checksum(unsigned static void __cpuinit MP_processor_info (struct mpc_config_processor *m) { int cpu; @@ -6022,7 +6999,7 @@ Acked-by: jbeulich@novell.com if (num_processors >= NR_CPUS) { printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." " Processor ignored.\n", NR_CPUS); -@@ -137,24 +118,7 @@ static void __cpuinit MP_processor_info +@@ -137,24 +118,7 @@ static void __cpuinit MP_processor_info cpus_complement(tmp_map, cpu_present_map); cpu = first_cpu(tmp_map); @@ -6567,159 +7544,8 @@ Acked-by: jbeulich@novell.com - -#endif /*CONFIG_X86_IO_APIC*/ #endif /*CONFIG_ACPI*/ ---- a/arch/x86/kernel/pci-dma-xen.c -+++ b/arch/x86/kernel/pci-dma-xen.c -@@ -110,8 +110,7 @@ dma_map_sg(struct device *hwdev, struct - { - int i, rc; - -- if (direction == DMA_NONE) -- BUG(); -+ BUG_ON(!valid_dma_direction(direction)); - WARN_ON(nents == 0 || sg[0].length == 0); - - if (swiotlb) { -@@ -142,7 +141,7 @@ dma_unmap_sg(struct device *hwdev, struc - { - int i; - -- BUG_ON(direction == DMA_NONE); -+ BUG_ON(!valid_dma_direction(direction)); - if (swiotlb) - swiotlb_unmap_sg(hwdev, sg, nents, direction); - else { -@@ -159,8 +158,7 @@ dma_map_page(struct device *dev, struct - { - dma_addr_t dma_addr; - -- BUG_ON(direction == DMA_NONE); -- -+ BUG_ON(!valid_dma_direction(direction)); - if (swiotlb) { - dma_addr = swiotlb_map_page( - dev, page, offset, size, direction); -@@ -177,7 +175,7 @@ void - dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, - enum dma_data_direction direction) - { -- BUG_ON(direction == DMA_NONE); -+ BUG_ON(!valid_dma_direction(direction)); - if (swiotlb) - swiotlb_unmap_page(dev, dma_address, size, direction); - else -@@ -356,8 +354,7 @@ dma_map_single(struct device *dev, void - { - dma_addr_t dma; - -- if (direction == DMA_NONE) -- BUG(); -+ BUG_ON(!valid_dma_direction(direction)); - WARN_ON(size == 0); - - if (swiotlb) { -@@ -378,8 +375,7 @@ void - dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, - enum dma_data_direction direction) - { -- if (direction == DMA_NONE) -- BUG(); -+ BUG_ON(!valid_dma_direction(direction)); - if (swiotlb) - swiotlb_unmap_single(dev, dma_addr, size, direction); - else ---- a/arch/x86/kernel/process_32-xen.c -+++ b/arch/x86/kernel/process_32-xen.c -@@ -37,6 +37,7 @@ - #include <linux/kallsyms.h> - #include <linux/ptrace.h> - #include <linux/random.h> -+#include <linux/personality.h> - - #include <asm/uaccess.h> - #include <asm/pgtable.h> -@@ -186,7 +187,7 @@ void cpu_idle(void) - void cpu_idle_wait(void) - { - unsigned int cpu, this_cpu = get_cpu(); -- cpumask_t map; -+ cpumask_t map, tmp = current->cpus_allowed; - - set_cpus_allowed(current, cpumask_of_cpu(this_cpu)); - put_cpu(); -@@ -208,6 +209,8 @@ void cpu_idle_wait(void) - } - cpus_and(map, map, cpu_online_map); - } while (!cpus_empty(map)); -+ -+ set_cpus_allowed(current, tmp); - } - EXPORT_SYMBOL_GPL(cpu_idle_wait); - -@@ -240,9 +243,9 @@ void show_regs(struct pt_regs * regs) - if (user_mode_vm(regs)) - printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); - printk(" EFLAGS: %08lx %s (%s %.*s)\n", -- regs->eflags, print_tainted(), system_utsname.release, -- (int)strcspn(system_utsname.version, " "), -- system_utsname.version); -+ regs->eflags, print_tainted(), init_utsname()->release, -+ (int)strcspn(init_utsname()->version, " "), -+ init_utsname()->version); - printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", - regs->eax,regs->ebx,regs->ecx,regs->edx); - printk("ESI: %08lx EDI: %08lx EBP: %08lx", -@@ -264,15 +267,6 @@ void show_regs(struct pt_regs * regs) - * the "args". - */ - extern void kernel_thread_helper(void); --__asm__(".section .text\n" -- ".align 4\n" -- "kernel_thread_helper:\n\t" -- "movl %edx,%eax\n\t" -- "pushl %edx\n\t" -- "call *%ebx\n\t" -- "pushl %eax\n\t" -- "call do_exit\n" -- ".previous"); - - /* - * Create a kernel thread -@@ -290,7 +284,7 @@ int kernel_thread(int (*fn)(void *), voi - regs.xes = __USER_DS; - regs.orig_eax = -1; - regs.eip = (unsigned long) kernel_thread_helper; -- regs.xcs = GET_KERNEL_CS(); -+ regs.xcs = __KERNEL_CS | get_kernel_rpl(); - regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; - - /* Ok, create the new process.. */ -@@ -369,13 +363,12 @@ int copy_thread(int nr, unsigned long cl - - tsk = current; - if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { -- p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); -+ p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr, -+ IO_BITMAP_BYTES, GFP_KERNEL); - if (!p->thread.io_bitmap_ptr) { - p->thread.io_bitmap_max = 0; - return -ENOMEM; - } -- memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr, -- IO_BITMAP_BYTES); - set_tsk_thread_flag(p, TIF_IO_BITMAP); - } - -@@ -871,7 +864,7 @@ asmlinkage int sys_get_thread_area(struc - - unsigned long arch_align_stack(unsigned long sp) - { -- if (randomize_va_space) -+ if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) - sp -= get_random_int() % 8192; - return sp & ~0xf; - } ---- a/arch/x86/kernel/process_64-xen.c -+++ b/arch/x86/kernel/process_64-xen.c +--- head.orig/arch/x86/kernel/process_64-xen.c 2011-04-11 13:43:15.000000000 +0200 ++++ head/arch/x86/kernel/process_64-xen.c 2011-02-02 08:30:50.000000000 +0100 @@ -88,25 +88,24 @@ void idle_notifier_unregister(struct not } EXPORT_SYMBOL(idle_notifier_unregister); @@ -6856,7 +7682,7 @@ Acked-by: jbeulich@novell.com * switch_to(x,y) should switch tasks from x to y. * * This could still be optimized: -@@ -500,6 +531,10 @@ __switch_to(struct task_struct *prev_p, +@@ -500,6 +531,10 @@ __switch_to(struct task_struct *prev_p, #endif multicall_entry_t _mcl[8], *mcl = _mcl; @@ -6867,7 +7693,7 @@ Acked-by: jbeulich@novell.com /* * This is basically '__unlazy_fpu', except that we queue a * multicall to indicate FPU task switch, rather than -@@ -512,7 +547,8 @@ __switch_to(struct task_struct *prev_p, +@@ -512,7 +547,8 @@ __switch_to(struct task_struct *prev_p, mcl->op = __HYPERVISOR_fpu_taskswitch; mcl->args[0] = 1; mcl++; @@ -6877,7 +7703,7 @@ Acked-by: jbeulich@novell.com /* * Reload esp0, LDT and the page table pointer: -@@ -607,21 +643,29 @@ __switch_to(struct task_struct *prev_p, +@@ -607,21 +643,29 @@ __switch_to(struct task_struct *prev_p, write_pda(oldrsp, next->userrsp); write_pda(pcurrent, next_p); write_pda(kernelstack, @@ -6926,679 +7752,8 @@ Acked-by: jbeulich@novell.com sp -= get_random_int() % 8192; return sp & ~0xf; } ---- a/arch/x86/kernel/setup64-xen.c -+++ b/arch/x86/kernel/setup64-xen.c -@@ -31,7 +31,7 @@ - #include <asm/hypervisor.h> - #endif - --char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; -+char x86_boot_params[BOOT_PARAM_SIZE] __initdata; - - cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; - -@@ -55,8 +55,10 @@ Control non executable mappings for 64bi - on Enable(default) - off Disable - */ --int __init nonx_setup(char *str) -+static int __init nonx_setup(char *str) - { -+ if (!str) -+ return -EINVAL; - if (!strncmp(str, "on", 2)) { - __supported_pte_mask |= _PAGE_NX; - do_not_nx = 0; -@@ -64,9 +66,9 @@ int __init nonx_setup(char *str) - do_not_nx = 1; - __supported_pte_mask &= ~_PAGE_NX; - } -- return 1; -+ return 0; - } --__setup("noexec=", nonx_setup); /* parsed early actually */ -+early_param("noexec", nonx_setup); - - int force_personality32 = 0; - -@@ -102,12 +104,9 @@ void __init setup_per_cpu_areas(void) - #endif - - /* Copy section for each CPU (we discard the original) */ -- size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); --#ifdef CONFIG_MODULES -- if (size < PERCPU_ENOUGH_ROOM) -- size = PERCPU_ENOUGH_ROOM; --#endif -+ size = PERCPU_ENOUGH_ROOM; - -+ printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", size); - for_each_cpu_mask (i, cpu_possible_map) { - char *ptr; - -@@ -169,7 +168,10 @@ void pda_init(int cpu) - /* Setup up data that may be needed in __get_free_pages early */ - asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); - #ifndef CONFIG_XEN -+ /* Memory clobbers used to order PDA accessed */ -+ mb(); - wrmsrl(MSR_GS_BASE, pda); -+ mb(); - #else - if (HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL, - (unsigned long)pda)) -@@ -302,28 +304,17 @@ void __cpuinit cpu_init (void) - * set up and load the per-CPU TSS - */ - for (v = 0; v < N_EXCEPTION_STACKS; v++) { -+ static const unsigned int order[N_EXCEPTION_STACKS] = { -+ [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, -+ [DEBUG_STACK - 1] = DEBUG_STACK_ORDER -+ }; - if (cpu) { -- static const unsigned int order[N_EXCEPTION_STACKS] = { -- [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, -- [DEBUG_STACK - 1] = DEBUG_STACK_ORDER -- }; -- - estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); - if (!estacks) - panic("Cannot allocate exception stack %ld %d\n", - v, cpu); - } -- switch (v + 1) { --#if DEBUG_STKSZ > EXCEPTION_STKSZ -- case DEBUG_STACK: -- cpu_pda(cpu)->debugstack = (unsigned long)estacks; -- estacks += DEBUG_STKSZ; -- break; --#endif -- default: -- estacks += EXCEPTION_STKSZ; -- break; -- } -+ estacks += PAGE_SIZE << order[v]; - orig_ist->ist[v] = t->ist[v] = (unsigned long)estacks; - } - ---- a/arch/x86/kernel/setup_32-xen.c -+++ b/arch/x86/kernel/setup_32-xen.c -@@ -56,6 +56,7 @@ - #include <asm/apic.h> - #include <asm/e820.h> - #include <asm/mpspec.h> -+#include <asm/mmzone.h> - #include <asm/setup.h> - #include <asm/arch_hooks.h> - #include <asm/sections.h> -@@ -83,9 +84,6 @@ static struct notifier_block xen_panic_b - xen_panic_event, NULL, 0 /* try to go last */ - }; - --extern char hypercall_page[PAGE_SIZE]; --EXPORT_SYMBOL(hypercall_page); -- - int disable_pse __devinitdata = 0; - - /* -@@ -105,18 +103,6 @@ EXPORT_SYMBOL(boot_cpu_data); - - unsigned long mmu_cr4_features; - --#ifdef CONFIG_ACPI -- int acpi_disabled = 0; --#else -- int acpi_disabled = 1; --#endif --EXPORT_SYMBOL(acpi_disabled); -- --#ifdef CONFIG_ACPI --int __initdata acpi_force = 0; --extern acpi_interrupt_flags acpi_sci_flags; --#endif -- - /* for MCA, but anyone else can use it if they want */ - unsigned int machine_id; - #ifdef CONFIG_MCA -@@ -170,7 +156,6 @@ struct e820map machine_e820; - #endif - - extern void early_cpu_init(void); --extern void generic_apic_probe(char *); - extern int root_mountflags; - - unsigned long saved_videomode; -@@ -243,9 +228,6 @@ static struct resource adapter_rom_resou - .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM - } }; - --#define ADAPTER_ROM_RESOURCES \ -- (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0]) -- - static struct resource video_rom_resource = { - .name = "Video ROM", - .start = 0xc0000, -@@ -307,9 +289,6 @@ static struct resource standard_io_resou - .flags = IORESOURCE_BUSY | IORESOURCE_IO - } }; - --#define STANDARD_IO_RESOURCES \ -- (sizeof standard_io_resources / sizeof standard_io_resources[0]) -- - #define romsignature(x) (*(unsigned short *)(x) == 0xaa55) - - static int __init romchecksum(unsigned char *rom, unsigned long length) -@@ -372,7 +351,7 @@ static void __init probe_roms(void) - } - - /* check for adapter roms on 2k boundaries */ -- for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) { -+ for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) { - rom = isa_bus_to_virt(start); - if (!romsignature(rom)) - continue; -@@ -779,246 +758,152 @@ static inline void copy_edd(void) - } - #endif - --static void __init parse_cmdline_early (char ** cmdline_p) -+static int __initdata user_defined_memmap = 0; -+ -+/* -+ * "mem=nopentium" disables the 4MB page tables. -+ * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM -+ * to <mem>, overriding the bios size. -+ * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from -+ * <start> to <start>+<mem>, overriding the bios size. -+ * -+ * HPA tells me bootloaders need to parse mem=, so no new -+ * option should be mem= [also see Documentation/i386/boot.txt] -+ */ -+static int __init parse_mem(char *arg) - { -- char c = ' ', *to = command_line, *from = saved_command_line; -- int len = 0, max_cmdline; -- int userdef = 0; -- -- if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) -- max_cmdline = COMMAND_LINE_SIZE; -- memcpy(saved_command_line, xen_start_info->cmd_line, max_cmdline); -- /* Save unparsed command line copy for /proc/cmdline */ -- saved_command_line[max_cmdline-1] = '\0'; -- -- for (;;) { -- if (c != ' ') -- goto next_char; -- /* -- * "mem=nopentium" disables the 4MB page tables. -- * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM -- * to <mem>, overriding the bios size. -- * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from -- * <start> to <start>+<mem>, overriding the bios size. -- * -- * HPA tells me bootloaders need to parse mem=, so no new -- * option should be mem= [also see Documentation/i386/boot.txt] -- */ -- if (!memcmp(from, "mem=", 4)) { -- if (to != command_line) -- to--; -- if (!memcmp(from+4, "nopentium", 9)) { -- from += 9+4; -- clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability); -- disable_pse = 1; -- } else { -- /* If the user specifies memory size, we -- * limit the BIOS-provided memory map to -- * that size. exactmap can be used to specify -- * the exact map. mem=number can be used to -- * trim the existing memory map. -- */ -- unsigned long long mem_size; -- -- mem_size = memparse(from+4, &from); -- limit_regions(mem_size); -- userdef=1; -- } -- } -+ if (!arg) -+ return -EINVAL; - -- else if (!memcmp(from, "memmap=", 7)) { -- if (to != command_line) -- to--; -- if (!memcmp(from+7, "exactmap", 8)) { --#ifdef CONFIG_CRASH_DUMP -- /* If we are doing a crash dump, we -- * still need to know the real mem -- * size before original memory map is -- * reset. -- */ -- find_max_pfn(); -- saved_max_pfn = max_pfn; --#endif -- from += 8+7; -- e820.nr_map = 0; -- userdef = 1; -- } else { -- /* If the user specifies memory size, we -- * limit the BIOS-provided memory map to -- * that size. exactmap can be used to specify -- * the exact map. mem=number can be used to -- * trim the existing memory map. -- */ -- unsigned long long start_at, mem_size; -+ if (strcmp(arg, "nopentium") == 0) { -+ clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability); -+ disable_pse = 1; -+ } else { -+ /* If the user specifies memory size, we -+ * limit the BIOS-provided memory map to -+ * that size. exactmap can be used to specify -+ * the exact map. mem=number can be used to -+ * trim the existing memory map. -+ */ -+ unsigned long long mem_size; - -- mem_size = memparse(from+7, &from); -- if (*from == '@') { -- start_at = memparse(from+1, &from); -- add_memory_region(start_at, mem_size, E820_RAM); -- } else if (*from == '#') { -- start_at = memparse(from+1, &from); -- add_memory_region(start_at, mem_size, E820_ACPI); -- } else if (*from == '$') { -- start_at = memparse(from+1, &from); -- add_memory_region(start_at, mem_size, E820_RESERVED); -- } else { -- limit_regions(mem_size); -- userdef=1; -- } -- } -- } -- -- else if (!memcmp(from, "noexec=", 7)) -- noexec_setup(from + 7); -+ mem_size = memparse(arg, &arg); -+ limit_regions(mem_size); -+ user_defined_memmap = 1; -+ } -+ return 0; -+} -+early_param("mem", parse_mem); - -+static int __init parse_memmap(char *arg) -+{ -+ if (!arg) -+ return -EINVAL; - --#ifdef CONFIG_X86_MPPARSE -- /* -- * If the BIOS enumerates physical processors before logical, -- * maxcpus=N at enumeration-time can be used to disable HT. -+ if (strcmp(arg, "exactmap") == 0) { -+#ifdef CONFIG_CRASH_DUMP -+ /* If we are doing a crash dump, we -+ * still need to know the real mem -+ * size before original memory map is -+ * reset. - */ -- else if (!memcmp(from, "maxcpus=", 8)) { -- extern unsigned int maxcpus; -- -- maxcpus = simple_strtoul(from + 8, NULL, 0); -- } -+ find_max_pfn(); -+ saved_max_pfn = max_pfn; - #endif -+ e820.nr_map = 0; -+ user_defined_memmap = 1; -+ } else { -+ /* If the user specifies memory size, we -+ * limit the BIOS-provided memory map to -+ * that size. exactmap can be used to specify -+ * the exact map. mem=number can be used to -+ * trim the existing memory map. -+ */ -+ unsigned long long start_at, mem_size; - --#ifdef CONFIG_ACPI -- /* "acpi=off" disables both ACPI table parsing and interpreter */ -- else if (!memcmp(from, "acpi=off", 8)) { -- disable_acpi(); -- } -- -- /* acpi=force to over-ride black-list */ -- else if (!memcmp(from, "acpi=force", 10)) { -- acpi_force = 1; -- acpi_ht = 1; -- acpi_disabled = 0; -- } -- -- /* acpi=strict disables out-of-spec workarounds */ -- else if (!memcmp(from, "acpi=strict", 11)) { -- acpi_strict = 1; -- } -- -- /* Limit ACPI just to boot-time to enable HT */ -- else if (!memcmp(from, "acpi=ht", 7)) { -- if (!acpi_force) -- disable_acpi(); -- acpi_ht = 1; -- } -- -- /* "pci=noacpi" disable ACPI IRQ routing and PCI scan */ -- else if (!memcmp(from, "pci=noacpi", 10)) { -- acpi_disable_pci(); -- } -- /* "acpi=noirq" disables ACPI interrupt routing */ -- else if (!memcmp(from, "acpi=noirq", 10)) { -- acpi_noirq_set(); -+ mem_size = memparse(arg, &arg); -+ if (*arg == '@') { -+ start_at = memparse(arg+1, &arg); -+ add_memory_region(start_at, mem_size, E820_RAM); -+ } else if (*arg == '#') { -+ start_at = memparse(arg+1, &arg); -+ add_memory_region(start_at, mem_size, E820_ACPI); -+ } else if (*arg == '$') { -+ start_at = memparse(arg+1, &arg); -+ add_memory_region(start_at, mem_size, E820_RESERVED); -+ } else { -+ limit_regions(mem_size); -+ user_defined_memmap = 1; - } -+ } -+ return 0; -+} -+early_param("memmap", parse_memmap); - -- else if (!memcmp(from, "acpi_sci=edge", 13)) -- acpi_sci_flags.trigger = 1; -+#ifdef CONFIG_PROC_VMCORE -+/* elfcorehdr= specifies the location of elf core header -+ * stored by the crashed kernel. -+ */ -+static int __init parse_elfcorehdr(char *arg) -+{ -+ if (!arg) -+ return -EINVAL; - -- else if (!memcmp(from, "acpi_sci=level", 14)) -- acpi_sci_flags.trigger = 3; -+ elfcorehdr_addr = memparse(arg, &arg); -+ return 0; -+} -+early_param("elfcorehdr", parse_elfcorehdr); -+#endif /* CONFIG_PROC_VMCORE */ - -- else if (!memcmp(from, "acpi_sci=high", 13)) -- acpi_sci_flags.polarity = 1; -+/* -+ * highmem=size forces highmem to be exactly 'size' bytes. -+ * This works even on boxes that have no highmem otherwise. -+ * This also works to reduce highmem size on bigger boxes. -+ */ -+static int __init parse_highmem(char *arg) -+{ -+ if (!arg) -+ return -EINVAL; - -- else if (!memcmp(from, "acpi_sci=low", 12)) -- acpi_sci_flags.polarity = 3; -+ highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT; -+ return 0; -+} -+early_param("highmem", parse_highmem); - --#ifdef CONFIG_X86_IO_APIC -- else if (!memcmp(from, "acpi_skip_timer_override", 24)) -- acpi_skip_timer_override = 1; -+/* -+ * vmalloc=size forces the vmalloc area to be exactly 'size' -+ * bytes. This can be used to increase (or decrease) the -+ * vmalloc area - the default is 128m. -+ */ -+static int __init parse_vmalloc(char *arg) -+{ -+ if (!arg) -+ return -EINVAL; - -- if (!memcmp(from, "disable_timer_pin_1", 19)) -- disable_timer_pin_1 = 1; -- if (!memcmp(from, "enable_timer_pin_1", 18)) -- disable_timer_pin_1 = -1; -- -- /* disable IO-APIC */ -- else if (!memcmp(from, "noapic", 6)) -- disable_ioapic_setup(); --#endif /* CONFIG_X86_IO_APIC */ --#endif /* CONFIG_ACPI */ -- --#ifdef CONFIG_X86_LOCAL_APIC -- /* enable local APIC */ -- else if (!memcmp(from, "lapic", 5)) -- lapic_enable(); -- -- /* disable local APIC */ -- else if (!memcmp(from, "nolapic", 6)) -- lapic_disable(); --#endif /* CONFIG_X86_LOCAL_APIC */ -+ __VMALLOC_RESERVE = memparse(arg, &arg); -+ return 0; -+} -+early_param("vmalloc", parse_vmalloc); - --#ifdef CONFIG_KEXEC -- /* crashkernel=size@addr specifies the location to reserve for -- * a crash kernel. By reserving this memory we guarantee -- * that linux never set's it up as a DMA target. -- * Useful for holding code to do something appropriate -- * after a kernel panic. -- */ -- else if (!memcmp(from, "crashkernel=", 12)) { - #ifndef CONFIG_XEN -- unsigned long size, base; -- size = memparse(from+12, &from); -- if (*from == '@') { -- base = memparse(from+1, &from); -- /* FIXME: Do I want a sanity check -- * to validate the memory range? -- */ -- crashk_res.start = base; -- crashk_res.end = base + size - 1; -- } --#else -- printk("Ignoring crashkernel command line, " -- "parameter will be supplied by xen\n"); --#endif -- } --#endif --#ifdef CONFIG_PROC_VMCORE -- /* elfcorehdr= specifies the location of elf core header -- * stored by the crashed kernel. -- */ -- else if (!memcmp(from, "elfcorehdr=", 11)) -- elfcorehdr_addr = memparse(from+11, &from); --#endif -+/* -+ * reservetop=size reserves a hole at the top of the kernel address space which -+ * a hypervisor can load into later. Needed for dynamically loaded hypervisors, -+ * so relocating the fixmap can be done before paging initialization. -+ */ -+static int __init parse_reservetop(char *arg) -+{ -+ unsigned long address; - -- /* -- * highmem=size forces highmem to be exactly 'size' bytes. -- * This works even on boxes that have no highmem otherwise. -- * This also works to reduce highmem size on bigger boxes. -- */ -- else if (!memcmp(from, "highmem=", 8)) -- highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT; -- -- /* -- * vmalloc=size forces the vmalloc area to be exactly 'size' -- * bytes. This can be used to increase (or decrease) the -- * vmalloc area - the default is 128m. -- */ -- else if (!memcmp(from, "vmalloc=", 8)) -- __VMALLOC_RESERVE = memparse(from+8, &from); -+ if (!arg) -+ return -EINVAL; - -- next_char: -- c = *(from++); -- if (!c) -- break; -- if (COMMAND_LINE_SIZE <= ++len) -- break; -- *(to++) = c; -- } -- *to = '\0'; -- *cmdline_p = command_line; -- if (userdef) { -- printk(KERN_INFO "user-defined physical RAM map:\n"); -- print_memory_map("user"); -- } -+ address = memparse(arg, &arg); -+ reserve_top_address(address); -+ return 0; - } -+early_param("reservetop", parse_reservetop); -+#endif - - /* - * Callback for efi_memory_walk. -@@ -1039,7 +924,7 @@ efi_find_max_pfn(unsigned long start, un - static int __init - efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg) - { -- memory_present(0, start, end); -+ memory_present(0, PFN_UP(start), PFN_DOWN(end)); - return 0; - } - -@@ -1306,6 +1191,14 @@ static unsigned long __init setup_memory - } - printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", - pages_to_mb(highend_pfn - highstart_pfn)); -+ num_physpages = highend_pfn; -+ high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; -+#else -+ num_physpages = max_low_pfn; -+ high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; -+#endif -+#ifdef CONFIG_FLATMEM -+ max_mapnr = num_physpages; - #endif - printk(KERN_NOTICE "%ldMB LOWMEM available.\n", - pages_to_mb(max_low_pfn)); -@@ -1317,22 +1210,21 @@ static unsigned long __init setup_memory - - void __init zone_sizes_init(void) - { -- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; -- unsigned int max_dma, low; -- -- max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; -- low = max_low_pfn; -- -- if (low < max_dma) -- zones_size[ZONE_DMA] = low; -- else { -- zones_size[ZONE_DMA] = max_dma; -- zones_size[ZONE_NORMAL] = low - max_dma; -+ unsigned long max_zone_pfns[MAX_NR_ZONES]; -+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); -+ max_zone_pfns[ZONE_DMA] = -+ virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; -+ max_zone_pfns[ZONE_NORMAL] = max_low_pfn; - #ifdef CONFIG_HIGHMEM -- zones_size[ZONE_HIGHMEM] = highend_pfn - low; -+ max_zone_pfns[ZONE_HIGHMEM] = highend_pfn; -+ add_active_range(0, 0, min(xen_start_info->nr_pages, highend_pfn)); -+ add_active_range(0, highend_pfn, highend_pfn); -+#else -+ add_active_range(0, 0, min(xen_start_info->nr_pages, max_low_pfn)); -+ add_active_range(0, max_low_pfn, max_low_pfn); - #endif -- } -- free_area_init(zones_size); -+ -+ free_area_init_nodes(max_zone_pfns); - } - #else - extern unsigned long __init setup_memory(void); -@@ -1389,6 +1281,7 @@ void __init setup_bootmem_allocator(void - */ - acpi_reserve_bootmem(); - #endif -+ numa_kva_reserve(); - #endif /* !CONFIG_XEN */ - - #ifdef CONFIG_BLK_DEV_INITRD -@@ -1574,7 +1467,7 @@ static int __init request_standard_resou - request_resource(&iomem_resource, &video_ram_resource); - - /* request I/O space for devices used on all i[345]86 PCs */ -- for (i = 0; i < STANDARD_IO_RESOURCES; i++) -+ for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++) - request_resource(&ioport_resource, &standard_io_resources[i]); - return 0; - } -@@ -1705,17 +1598,19 @@ void __init setup_arch(char **cmdline_p) - data_resource.start = virt_to_phys(_etext); - data_resource.end = virt_to_phys(_edata)-1; - -- parse_cmdline_early(cmdline_p); -+ if ((i = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) -+ i = COMMAND_LINE_SIZE; -+ memcpy(saved_command_line, xen_start_info->cmd_line, i); -+ saved_command_line[i - 1] = '\0'; -+ parse_early_param(); - --#ifdef CONFIG_EARLY_PRINTK -- { -- char *s = strstr(*cmdline_p, "earlyprintk="); -- if (s) { -- setup_early_printk(strchr(s, '=') + 1); -- printk("early console enabled\n"); -- } -+ if (user_defined_memmap) { -+ printk(KERN_INFO "user-defined physical RAM map:\n"); -+ print_memory_map("user"); - } --#endif -+ -+ strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE); -+ *cmdline_p = command_line; - - max_low_pfn = setup_memory(); - -@@ -1822,7 +1717,7 @@ void __init setup_arch(char **cmdline_p) - dmi_scan_machine(); - - #ifdef CONFIG_X86_GENERICARCH -- generic_apic_probe(*cmdline_p); -+ generic_apic_probe(); - #endif - if (efi_enabled) - efi_map_memmap(); -@@ -1843,9 +1738,11 @@ void __init setup_arch(char **cmdline_p) - acpi_boot_table_init(); - #endif - -+#ifdef CONFIG_PCI - #ifdef CONFIG_X86_IO_APIC - check_acpi_pci(); /* Checks more than just ACPI actually */ - #endif -+#endif - - #ifdef CONFIG_ACPI - acpi_boot_init(); ---- a/arch/x86/kernel/setup_64-xen.c -+++ b/arch/x86/kernel/setup_64-xen.c +--- head.orig/arch/x86/kernel/setup_64-xen.c 2010-10-05 09:58:12.000000000 +0200 ++++ head/arch/x86/kernel/setup_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -88,9 +88,6 @@ extern struct edid_info edid_info; shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page; EXPORT_SYMBOL(HYPERVISOR_shared_info); @@ -7637,7 +7792,7 @@ Acked-by: jbeulich@novell.com extern int root_mountflags; -@@ -181,9 +164,6 @@ struct resource standard_io_resources[] +@@ -181,9 +164,6 @@ struct resource standard_io_resources[] .flags = IORESOURCE_BUSY | IORESOURCE_IO } }; @@ -8015,7 +8170,7 @@ Acked-by: jbeulich@novell.com #endif } -@@ -1272,6 +1111,8 @@ static void __cpuinit init_intel(struct +@@ -1272,6 +1111,8 @@ static void __cpuinit init_intel(struct if ((c->x86 == 0xf && c->x86_model >= 0x03) || (c->x86 == 0x6 && c->x86_model >= 0x0e)) set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); @@ -8024,7 +8179,7 @@ Acked-by: jbeulich@novell.com set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); c->x86_max_cores = intel_num_cpu_cores(c); -@@ -1492,8 +1333,8 @@ static int show_cpuinfo(struct seq_file +@@ -1492,8 +1333,8 @@ static int show_cpuinfo(struct seq_file /* Intel-defined (#2) */ "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", @@ -8035,109 +8190,103 @@ Acked-by: jbeulich@novell.com NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* VIA/Cyrix/Centaur-defined */ ---- a/arch/x86/kernel/smp_32-xen.c -+++ b/arch/x86/kernel/smp_32-xen.c -@@ -279,8 +279,7 @@ static inline void leave_mm (unsigned lo - * 2) Leave the mm if we are in the lazy tlb mode. - */ +--- head.orig/arch/x86/kernel/setup64-xen.c 2011-01-31 17:02:29.000000000 +0100 ++++ head/arch/x86/kernel/setup64-xen.c 2011-01-31 17:29:16.000000000 +0100 +@@ -31,7 +31,7 @@ + #include <asm/hypervisor.h> + #endif --irqreturn_t smp_invalidate_interrupt(int irq, void *dev_id, -- struct pt_regs *regs) -+irqreturn_t smp_invalidate_interrupt(int irq, void *dev_id) - { - unsigned long cpu; +-char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; ++char x86_boot_params[BOOT_PARAM_SIZE] __initdata; -@@ -567,16 +566,14 @@ void smp_send_stop(void) - * all the work is done automatically when - * we return from the interrupt. - */ --irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id, -- struct pt_regs *regs) -+irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id) + cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; + +@@ -55,8 +55,10 @@ Control non executable mappings for 64bi + on Enable(default) + off Disable + */ +-int __init nonx_setup(char *str) ++static int __init nonx_setup(char *str) { ++ if (!str) ++ return -EINVAL; + if (!strncmp(str, "on", 2)) { + __supported_pte_mask |= _PAGE_NX; + do_not_nx = 0; +@@ -64,9 +66,9 @@ int __init nonx_setup(char *str) + do_not_nx = 1; + __supported_pte_mask &= ~_PAGE_NX; + } +- return 1; ++ return 0; + } +-__setup("noexec=", nonx_setup); /* parsed early actually */ ++early_param("noexec", nonx_setup); - return IRQ_HANDLED; - } + int force_personality32 = 0; - #include <linux/kallsyms.h> --irqreturn_t smp_call_function_interrupt(int irq, void *dev_id, -- struct pt_regs *regs) -+irqreturn_t smp_call_function_interrupt(int irq, void *dev_id) - { - void (*func) (void *info) = call_data->func; - void *info = call_data->info; -@@ -603,3 +600,69 @@ irqreturn_t smp_call_function_interrupt( - return IRQ_HANDLED; - } +@@ -102,12 +104,9 @@ void __init setup_per_cpu_areas(void) + #endif -+/* -+ * this function sends a 'generic call function' IPI to one other CPU -+ * in the system. -+ * -+ * cpu is a standard Linux logical CPU number. -+ */ -+static void -+__smp_call_function_single(int cpu, void (*func) (void *info), void *info, -+ int nonatomic, int wait) -+{ -+ struct call_data_struct data; -+ int cpus = 1; -+ -+ data.func = func; -+ data.info = info; -+ atomic_set(&data.started, 0); -+ data.wait = wait; -+ if (wait) -+ atomic_set(&data.finished, 0); -+ -+ call_data = &data; -+ wmb(); -+ /* Send a message to all other CPUs and wait for them to respond */ -+ send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); -+ -+ /* Wait for response */ -+ while (atomic_read(&data.started) != cpus) -+ cpu_relax(); -+ -+ if (!wait) -+ return; -+ -+ while (atomic_read(&data.finished) != cpus) -+ cpu_relax(); -+} -+ -+/* -+ * smp_call_function_single - Run a function on another CPU -+ * @func: The function to run. This must be fast and non-blocking. -+ * @info: An arbitrary pointer to pass to the function. -+ * @nonatomic: Currently unused. -+ * @wait: If true, wait until function has completed on other CPUs. -+ * -+ * Retrurns 0 on success, else a negative status code. -+ * -+ * Does not return until the remote CPU is nearly ready to execute <func> -+ * or is or has executed. -+ */ -+ -+int smp_call_function_single(int cpu, void (*func) (void *info), void *info, -+ int nonatomic, int wait) -+{ -+ /* prevent preemption and reschedule on another processor */ -+ int me = get_cpu(); -+ if (cpu == me) { -+ WARN_ON(1); -+ put_cpu(); -+ return -EBUSY; -+ } -+ spin_lock_bh(&call_lock); -+ __smp_call_function_single(cpu, func, info, nonatomic, wait); -+ spin_unlock_bh(&call_lock); -+ put_cpu(); -+ return 0; -+} -+EXPORT_SYMBOL(smp_call_function_single); ---- a/arch/x86/kernel/smp_64-xen.c -+++ b/arch/x86/kernel/smp_64-xen.c + /* Copy section for each CPU (we discard the original) */ +- size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); +-#ifdef CONFIG_MODULES +- if (size < PERCPU_ENOUGH_ROOM) +- size = PERCPU_ENOUGH_ROOM; +-#endif ++ size = PERCPU_ENOUGH_ROOM; + ++ printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", size); + for_each_cpu_mask (i, cpu_possible_map) { + char *ptr; + +@@ -169,7 +168,10 @@ void pda_init(int cpu) + /* Setup up data that may be needed in __get_free_pages early */ + asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); + #ifndef CONFIG_XEN ++ /* Memory clobbers used to order PDA accessed */ ++ mb(); + wrmsrl(MSR_GS_BASE, pda); ++ mb(); + #else + if (HYPERVISOR_set_segment_base(SEGBASE_GS_KERNEL, + (unsigned long)pda)) +@@ -302,28 +304,17 @@ void __cpuinit cpu_init (void) + * set up and load the per-CPU TSS + */ + for (v = 0; v < N_EXCEPTION_STACKS; v++) { ++ static const unsigned int order[N_EXCEPTION_STACKS] = { ++ [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, ++ [DEBUG_STACK - 1] = DEBUG_STACK_ORDER ++ }; + if (cpu) { +- static const unsigned int order[N_EXCEPTION_STACKS] = { +- [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, +- [DEBUG_STACK - 1] = DEBUG_STACK_ORDER +- }; +- + estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); + if (!estacks) + panic("Cannot allocate exception stack %ld %d\n", + v, cpu); + } +- switch (v + 1) { +-#if DEBUG_STKSZ > EXCEPTION_STKSZ +- case DEBUG_STACK: +- cpu_pda(cpu)->debugstack = (unsigned long)estacks; +- estacks += DEBUG_STKSZ; +- break; +-#endif +- default: +- estacks += EXCEPTION_STKSZ; +- break; +- } ++ estacks += PAGE_SIZE << order[v]; + orig_ist->ist[v] = t->ist[v] = (unsigned long)estacks; + } + +--- head.orig/arch/x86/kernel/smp_64-xen.c 2008-04-02 12:34:02.000000000 +0200 ++++ head/arch/x86/kernel/smp_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -381,9 +381,8 @@ int smp_call_function_single (int cpu, v /* prevent preemption and reschedule on another processor */ int me = get_cpu(); @@ -8199,641 +8348,8 @@ Acked-by: jbeulich@novell.com - return 0; /* Should not happen */ -#endif -} ---- a/arch/x86/kernel/time-xen.c -+++ b/arch/x86/kernel/time-xen.c -@@ -88,7 +88,6 @@ int pit_latch_buggy; /* ext - unsigned long vxtime_hz = PIT_TICK_RATE; - struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ - volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; --unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES; - struct timespec __xtime __section_xtime; - struct timezone __sys_tz __section_sys_tz; - #endif -@@ -96,8 +95,6 @@ struct timezone __sys_tz __section_sys_t - unsigned int cpu_khz; /* Detected as we calibrate the TSC */ - EXPORT_SYMBOL(cpu_khz); - --extern unsigned long wall_jiffies; -- - DEFINE_SPINLOCK(rtc_lock); - EXPORT_SYMBOL(rtc_lock); - -@@ -243,11 +240,10 @@ static void __update_wallclock(time_t se - time_t wtm_sec, xtime_sec; - u64 tmp, wc_nsec; - -- /* Adjust wall-clock time base based on wall_jiffies ticks. */ -+ /* Adjust wall-clock time base. */ - wc_nsec = processed_system_time; - wc_nsec += sec * (u64)NSEC_PER_SEC; - wc_nsec += nsec; -- wc_nsec -= (jiffies - wall_jiffies) * (u64)NS_PER_TICK; - - /* Split wallclock base into seconds and nanoseconds. */ - tmp = wc_nsec; -@@ -376,16 +372,10 @@ void do_gettimeofday(struct timeval *tv) - shadow = &per_cpu(shadow_time, cpu); - - do { -- unsigned long lost; -- - local_time_version = shadow->version; - seq = read_seqbegin(&xtime_lock); - - usec = get_usec_offset(shadow); -- lost = jiffies - wall_jiffies; -- -- if (unlikely(lost)) -- usec += lost * (USEC_PER_SEC / HZ); - - sec = xtime.tv_sec; - usec += (xtime.tv_nsec / NSEC_PER_USEC); -@@ -551,7 +541,7 @@ static void sync_xen_wallclock(unsigned - write_seqlock_irq(&xtime_lock); - - sec = xtime.tv_sec; -- nsec = xtime.tv_nsec + ((jiffies - wall_jiffies) * (u64)NS_PER_TICK); -+ nsec = xtime.tv_nsec; - __normalize_time(&sec, &nsec); - - op.cmd = XENPF_settime; -@@ -625,42 +615,49 @@ unsigned long long sched_clock(void) - } - #endif - --#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) - unsigned long profile_pc(struct pt_regs *regs) - { - unsigned long pc = instruction_pointer(regs); - --#ifdef __x86_64__ -- /* Assume the lock function has either no stack frame or only a single word. -- This checks if the address on the stack looks like a kernel text address. -- There is a small window for false hits, but in that case the tick -- is just accounted to the spinlock function. -- Better would be to write these functions in assembler again -- and check exactly. */ -+#if defined(CONFIG_SMP) || defined(__x86_64__) - if (!user_mode_vm(regs) && in_lock_functions(pc)) { -- char *v = *(char **)regs->rsp; -- if ((v >= _stext && v <= _etext) || -- (v >= _sinittext && v <= _einittext) || -- (v >= (char *)MODULES_VADDR && v <= (char *)MODULES_END)) -- return (unsigned long)v; -- return ((unsigned long *)regs->rsp)[1]; -+# ifdef CONFIG_FRAME_POINTER -+# ifdef __i386__ -+ return ((unsigned long *)regs->ebp)[1]; -+# else -+ return ((unsigned long *)regs->rbp)[1]; -+# endif -+# else -+# ifdef __i386__ -+ unsigned long *sp; -+ if ((regs->xcs & 2) == 0) -+ sp = (unsigned long *)®s->esp; -+ else -+ sp = (unsigned long *)regs->esp; -+# else -+ unsigned long *sp = (unsigned long *)regs->rsp; -+# endif -+ /* Return address is either directly at stack pointer -+ or above a saved eflags. Eflags has bits 22-31 zero, -+ kernel addresses don't. */ -+ if (sp[0] >> 22) -+ return sp[0]; -+ if (sp[1] >> 22) -+ return sp[1]; -+# endif - } --#else -- if (!user_mode_vm(regs) && in_lock_functions(pc)) -- return *(unsigned long *)(regs->ebp + 4); - #endif - - return pc; - } - EXPORT_SYMBOL(profile_pc); --#endif - - /* - * This is the same as the above, except we _also_ save the current - * Time Stamp Counter value at the time of the timer interrupt, so that - * we later on can estimate the time of day more exactly. - */ --irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) -+irqreturn_t timer_interrupt(int irq, void *dev_id) - { - s64 delta, delta_cpu, stolen, blocked; - u64 sched_time; -@@ -719,10 +716,15 @@ irqreturn_t timer_interrupt(int irq, voi - } - - /* System-wide jiffy work. */ -- while (delta >= NS_PER_TICK) { -- delta -= NS_PER_TICK; -- processed_system_time += NS_PER_TICK; -- do_timer(regs); -+ if (delta >= NS_PER_TICK) { -+ do_div(delta, NS_PER_TICK); -+ processed_system_time += delta * NS_PER_TICK; -+ while (delta > HZ) { -+ clobber_induction_variable(delta); -+ do_timer(HZ); -+ delta -= HZ; -+ } -+ do_timer(delta); - } - - if (shadow_tv_version != HYPERVISOR_shared_info->wc_version) { -@@ -769,7 +771,7 @@ irqreturn_t timer_interrupt(int irq, voi - if (delta_cpu > 0) { - do_div(delta_cpu, NS_PER_TICK); - per_cpu(processed_system_time, cpu) += delta_cpu * NS_PER_TICK; -- if (user_mode_vm(regs)) -+ if (user_mode_vm(get_irq_regs())) - account_user_time(current, (cputime_t)delta_cpu); - else - account_system_time(current, HARDIRQ_OFFSET, -@@ -783,10 +785,10 @@ irqreturn_t timer_interrupt(int irq, voi - /* Local timer processing (see update_process_times()). */ - run_local_timers(); - if (rcu_pending(cpu)) -- rcu_check_callbacks(cpu, user_mode_vm(regs)); -+ rcu_check_callbacks(cpu, user_mode_vm(get_irq_regs())); - scheduler_tick(); - run_posix_cpu_timers(current); -- profile_tick(CPU_PROFILING, regs); -+ profile_tick(CPU_PROFILING); - - return IRQ_HANDLED; - } -@@ -996,10 +998,11 @@ extern void (*late_time_init)(void); - /* Duplicate of time_init() below, with hpet_enable part added */ - static void __init hpet_time_init(void) - { -- xtime.tv_sec = get_cmos_time(); -- xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); -- set_normalized_timespec(&wall_to_monotonic, -- -xtime.tv_sec, -xtime.tv_nsec); -+ struct timespec ts; -+ ts.tv_sec = get_cmos_time(); -+ ts.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); -+ -+ do_settimeofday(&ts); - - if ((hpet_enable() >= 0) && hpet_use_timer) { - printk("Using HPET for base-timer\n"); ---- a/arch/x86/kernel/traps_32-xen.c -+++ b/arch/x86/kernel/traps_32-xen.c -@@ -28,6 +28,7 @@ - #include <linux/kprobes.h> - #include <linux/kexec.h> - #include <linux/unwind.h> -+#include <linux/uaccess.h> - - #ifdef CONFIG_EISA - #include <linux/ioport.h> -@@ -40,7 +41,6 @@ - - #include <asm/processor.h> - #include <asm/system.h> --#include <asm/uaccess.h> - #include <asm/io.h> - #include <asm/atomic.h> - #include <asm/debugreg.h> -@@ -51,11 +51,14 @@ - #include <asm/smp.h> - #include <asm/arch_hooks.h> - #include <asm/kdebug.h> -+#include <asm/stacktrace.h> - - #include <linux/module.h> - - #include "mach_traps.h" - -+int panic_on_unrecovered_nmi; -+ - asmlinkage int system_call(void); - - struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, -@@ -124,62 +127,63 @@ static inline int valid_stack_ptr(struct - p < (void *)tinfo + THREAD_SIZE - 3; - } - --/* -- * Print one address/symbol entries per line. -- */ --static inline void print_addr_and_symbol(unsigned long addr, char *log_lvl) --{ -- printk(" [<%08lx>] ", addr); -- -- print_symbol("%s\n", addr); --} -- - static inline unsigned long print_context_stack(struct thread_info *tinfo, - unsigned long *stack, unsigned long ebp, -- char *log_lvl) -+ struct stacktrace_ops *ops, void *data) - { - unsigned long addr; - - #ifdef CONFIG_FRAME_POINTER - while (valid_stack_ptr(tinfo, (void *)ebp)) { -+ unsigned long new_ebp; - addr = *(unsigned long *)(ebp + 4); -- print_addr_and_symbol(addr, log_lvl); -+ ops->address(data, addr); - /* - * break out of recursive entries (such as -- * end_of_stack_stop_unwind_function): -+ * end_of_stack_stop_unwind_function). Also, -+ * we can never allow a frame pointer to -+ * move downwards! - */ -- if (ebp == *(unsigned long *)ebp) -+ new_ebp = *(unsigned long *)ebp; -+ if (new_ebp <= ebp) - break; -- ebp = *(unsigned long *)ebp; -+ ebp = new_ebp; - } - #else - while (valid_stack_ptr(tinfo, stack)) { - addr = *stack++; - if (__kernel_text_address(addr)) -- print_addr_and_symbol(addr, log_lvl); -+ ops->address(data, addr); - } - #endif - return ebp; - } - -+struct ops_and_data { -+ struct stacktrace_ops *ops; -+ void *data; -+}; -+ - static asmlinkage int --show_trace_unwind(struct unwind_frame_info *info, void *log_lvl) -+dump_trace_unwind(struct unwind_frame_info *info, void *data) - { -+ struct ops_and_data *oad = (struct ops_and_data *)data; - int n = 0; - - while (unwind(info) == 0 && UNW_PC(info)) { - n++; -- print_addr_and_symbol(UNW_PC(info), log_lvl); -+ oad->ops->address(oad->data, UNW_PC(info)); - if (arch_unw_user_mode(info)) - break; - } - return n; - } - --static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, -- unsigned long *stack, char *log_lvl) -+void dump_trace(struct task_struct *task, struct pt_regs *regs, -+ unsigned long *stack, -+ struct stacktrace_ops *ops, void *data) - { -- unsigned long ebp; -+ unsigned long ebp = 0; - - if (!task) - task = current; -@@ -187,54 +191,116 @@ static void show_trace_log_lvl(struct ta - if (call_trace >= 0) { - int unw_ret = 0; - struct unwind_frame_info info; -+ struct ops_and_data oad = { .ops = ops, .data = data }; - - if (regs) { - if (unwind_init_frame_info(&info, task, regs) == 0) -- unw_ret = show_trace_unwind(&info, log_lvl); -+ unw_ret = dump_trace_unwind(&info, &oad); - } else if (task == current) -- unw_ret = unwind_init_running(&info, show_trace_unwind, log_lvl); -+ unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad); - else { - if (unwind_init_blocked(&info, task) == 0) -- unw_ret = show_trace_unwind(&info, log_lvl); -+ unw_ret = dump_trace_unwind(&info, &oad); - } - if (unw_ret > 0) { - if (call_trace == 1 && !arch_unw_user_mode(&info)) { -- print_symbol("DWARF2 unwinder stuck at %s\n", -+ ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n", - UNW_PC(&info)); - if (UNW_SP(&info) >= PAGE_OFFSET) { -- printk("Leftover inexact backtrace:\n"); -+ ops->warning(data, "Leftover inexact backtrace:\n"); - stack = (void *)UNW_SP(&info); -+ if (!stack) -+ return; -+ ebp = UNW_FP(&info); - } else -- printk("Full inexact backtrace again:\n"); -+ ops->warning(data, "Full inexact backtrace again:\n"); - } else if (call_trace >= 1) - return; - else -- printk("Full inexact backtrace again:\n"); -+ ops->warning(data, "Full inexact backtrace again:\n"); - } else -- printk("Inexact backtrace:\n"); -+ ops->warning(data, "Inexact backtrace:\n"); - } -- -- if (task == current) { -- /* Grab ebp right from our regs */ -- asm ("movl %%ebp, %0" : "=r" (ebp) : ); -- } else { -- /* ebp is the last reg pushed by switch_to */ -- ebp = *(unsigned long *) task->thread.esp; -+ if (!stack) { -+ unsigned long dummy; -+ stack = &dummy; -+ if (task && task != current) -+ stack = (unsigned long *)task->thread.esp; -+ } -+ -+#ifdef CONFIG_FRAME_POINTER -+ if (!ebp) { -+ if (task == current) { -+ /* Grab ebp right from our regs */ -+ asm ("movl %%ebp, %0" : "=r" (ebp) : ); -+ } else { -+ /* ebp is the last reg pushed by switch_to */ -+ ebp = *(unsigned long *) task->thread.esp; -+ } - } -+#endif - - while (1) { - struct thread_info *context; - context = (struct thread_info *) - ((unsigned long)stack & (~(THREAD_SIZE - 1))); -- ebp = print_context_stack(context, stack, ebp, log_lvl); -+ ebp = print_context_stack(context, stack, ebp, ops, data); -+ /* Should be after the line below, but somewhere -+ in early boot context comes out corrupted and we -+ can't reference it -AK */ -+ if (ops->stack(data, "IRQ") < 0) -+ break; - stack = (unsigned long*)context->previous_esp; - if (!stack) - break; -- printk("%s =======================\n", log_lvl); - } - } -+EXPORT_SYMBOL(dump_trace); - --void show_trace(struct task_struct *task, struct pt_regs *regs, unsigned long * stack) -+static void -+print_trace_warning_symbol(void *data, char *msg, unsigned long symbol) -+{ -+ printk(data); -+ print_symbol(msg, symbol); -+ printk("\n"); -+} -+ -+static void print_trace_warning(void *data, char *msg) -+{ -+ printk("%s%s\n", (char *)data, msg); -+} -+ -+static int print_trace_stack(void *data, char *name) -+{ -+ return 0; -+} -+ -+/* -+ * Print one address/symbol entries per line. -+ */ -+static void print_trace_address(void *data, unsigned long addr) -+{ -+ printk("%s [<%08lx>] ", (char *)data, addr); -+ print_symbol("%s\n", addr); -+} -+ -+static struct stacktrace_ops print_trace_ops = { -+ .warning = print_trace_warning, -+ .warning_symbol = print_trace_warning_symbol, -+ .stack = print_trace_stack, -+ .address = print_trace_address, -+}; -+ -+static void -+show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, -+ unsigned long * stack, char *log_lvl) -+{ -+ dump_trace(task, regs, stack, &print_trace_ops, log_lvl); -+ printk("%s =======================\n", log_lvl); -+} -+ -+void show_trace(struct task_struct *task, struct pt_regs *regs, -+ unsigned long * stack) - { - show_trace_log_lvl(task, regs, stack, ""); - } -@@ -297,12 +363,13 @@ void show_registers(struct pt_regs *regs - ss = regs->xss & 0xffff; - } - print_modules(); -- printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n" -- "EFLAGS: %08lx (%s %.*s) \n", -+ printk(KERN_EMERG "CPU: %d\n" -+ KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" -+ KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", - smp_processor_id(), 0xffff & regs->xcs, regs->eip, -- print_tainted(), regs->eflags, system_utsname.release, -- (int)strcspn(system_utsname.version, " "), -- system_utsname.version); -+ print_tainted(), regs->eflags, init_utsname()->release, -+ (int)strcspn(init_utsname()->version, " "), -+ init_utsname()->version); - print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); - printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", - regs->eax, regs->ebx, regs->ecx, regs->edx); -@@ -319,6 +386,8 @@ void show_registers(struct pt_regs *regs - */ - if (in_kernel) { - u8 __user *eip; -+ int code_bytes = 64; -+ unsigned char c; - - printk("\n" KERN_EMERG "Stack: "); - show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); -@@ -326,9 +395,12 @@ void show_registers(struct pt_regs *regs - printk(KERN_EMERG "Code: "); - - eip = (u8 __user *)regs->eip - 43; -- for (i = 0; i < 64; i++, eip++) { -- unsigned char c; -- -+ if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) { -+ /* try starting at EIP */ -+ eip = (u8 __user *)regs->eip; -+ code_bytes = 32; -+ } -+ for (i = 0; i < code_bytes; i++, eip++) { - if (eip < (u8 __user *)PAGE_OFFSET || __get_user(c, eip)) { - printk(" Bad EIP value."); - break; -@@ -349,7 +421,7 @@ static void handle_BUG(struct pt_regs *r - - if (eip < PAGE_OFFSET) - return; -- if (__get_user(ud2, (unsigned short __user *)eip)) -+ if (probe_kernel_address((unsigned short __user *)eip, ud2)) - return; - if (ud2 != 0x0b0f) - return; -@@ -362,7 +434,8 @@ static void handle_BUG(struct pt_regs *r - char *file; - char c; - -- if (__get_user(line, (unsigned short __user *)(eip + 2))) -+ if (probe_kernel_address((unsigned short __user *)(eip + 2), -+ line)) - break; - if (__get_user(file, (char * __user *)(eip + 4)) || - (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) -@@ -604,18 +677,24 @@ gp_in_kernel: - } - } - --static void mem_parity_error(unsigned char reason, struct pt_regs * regs) -+static __kprobes void -+mem_parity_error(unsigned char reason, struct pt_regs * regs) - { -- printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying " -- "to continue\n"); -+ printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " -+ "CPU %d.\n", reason, smp_processor_id()); - printk(KERN_EMERG "You probably have a hardware problem with your RAM " - "chips\n"); -+ if (panic_on_unrecovered_nmi) -+ panic("NMI: Not continuing"); -+ -+ printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); - - /* Clear and disable the memory parity error line. */ - clear_mem_error(reason); - } - --static void io_check_error(unsigned char reason, struct pt_regs * regs) -+static __kprobes void -+io_check_error(unsigned char reason, struct pt_regs * regs) - { - printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n"); - show_registers(regs); -@@ -624,7 +703,8 @@ static void io_check_error(unsigned char - clear_io_check_error(reason); - } - --static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs) -+static __kprobes void -+unknown_nmi_error(unsigned char reason, struct pt_regs * regs) - { - #ifdef CONFIG_MCA - /* Might actually be able to figure out what the guilty party -@@ -634,15 +714,18 @@ static void unknown_nmi_error(unsigned c - return; - } - #endif -- printk("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n", -- reason, smp_processor_id()); -- printk("Dazed and confused, but trying to continue\n"); -- printk("Do you have a strange power saving mode enabled?\n"); -+ printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " -+ "CPU %d.\n", reason, smp_processor_id()); -+ printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n"); -+ if (panic_on_unrecovered_nmi) -+ panic("NMI: Not continuing"); -+ -+ printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); - } - - static DEFINE_SPINLOCK(nmi_print_lock); - --void die_nmi (struct pt_regs *regs, const char *msg) -+void __kprobes die_nmi(struct pt_regs *regs, const char *msg) - { - if (notify_die(DIE_NMIWATCHDOG, msg, regs, 0, 2, SIGINT) == - NOTIFY_STOP) -@@ -674,7 +757,7 @@ void die_nmi (struct pt_regs *regs, cons - do_exit(SIGSEGV); - } - --static void default_do_nmi(struct pt_regs * regs) -+static __kprobes void default_do_nmi(struct pt_regs * regs) - { - unsigned char reason = 0; - -@@ -691,12 +774,12 @@ static void default_do_nmi(struct pt_reg - * Ok, so this is none of the documented NMI sources, - * so it must be the NMI watchdog. - */ -- if (nmi_watchdog) { -- nmi_watchdog_tick(regs); -+ if (nmi_watchdog_tick(regs, reason)) - return; -- } -+ if (!do_nmi_callback(regs, smp_processor_id())) - #endif -- unknown_nmi_error(reason, regs); -+ unknown_nmi_error(reason, regs); -+ - return; - } - if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) -@@ -712,14 +795,7 @@ static void default_do_nmi(struct pt_reg - reassert_nmi(); - } - --static int dummy_nmi_callback(struct pt_regs * regs, int cpu) --{ -- return 0; --} -- --static nmi_callback_t nmi_callback = dummy_nmi_callback; -- --fastcall void do_nmi(struct pt_regs * regs, long error_code) -+fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) - { - int cpu; - -@@ -729,25 +805,11 @@ fastcall void do_nmi(struct pt_regs * re - - ++nmi_count(cpu); - -- if (!rcu_dereference(nmi_callback)(regs, cpu)) -- default_do_nmi(regs); -+ default_do_nmi(regs); - - nmi_exit(); - } - --void set_nmi_callback(nmi_callback_t callback) --{ -- vmalloc_sync_all(); -- rcu_assign_pointer(nmi_callback, callback); --} --EXPORT_SYMBOL_GPL(set_nmi_callback); -- --void unset_nmi_callback(void) --{ -- nmi_callback = dummy_nmi_callback; --} --EXPORT_SYMBOL_GPL(unset_nmi_callback); -- - #ifdef CONFIG_KPROBES - fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) - { ---- a/arch/x86/kernel/traps_64-xen.c -+++ b/arch/x86/kernel/traps_64-xen.c +--- head.orig/arch/x86/kernel/traps_64-xen.c 2008-04-02 12:34:02.000000000 +0200 ++++ head/arch/x86/kernel/traps_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -23,6 +23,7 @@ #include <linux/delay.h> #include <linux/spinlock.h> @@ -9279,7 +8795,7 @@ Acked-by: jbeulich@novell.com if (strcmp(s, "old") == 0) call_trace = -1; else if (strcmp(s, "both") == 0) -@@ -1167,7 +1241,7 @@ static int __init call_trace_setup(char +@@ -1167,7 +1241,7 @@ static int __init call_trace_setup(char call_trace = 1; else if (strcmp(s, "new") == 0) call_trace = 2; @@ -9289,8 +8805,8 @@ Acked-by: jbeulich@novell.com -__setup("call_trace=", call_trace_setup); +early_param("call_trace", call_trace_setup); #endif ---- a/arch/x86/kernel/vsyscall_64-xen.c -+++ b/arch/x86/kernel/vsyscall_64-xen.c +--- head.orig/arch/x86/kernel/vsyscall_64-xen.c 2007-06-18 08:38:13.000000000 +0200 ++++ head/arch/x86/kernel/vsyscall_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -26,6 +26,10 @@ #include <linux/seqlock.h> #include <linux/jiffies.h> @@ -9414,7 +8930,7 @@ Acked-by: jbeulich@novell.com } iounmap(map2); out: -@@ -200,6 +246,48 @@ static ctl_table kernel_root_table2[] = +@@ -200,6 +246,48 @@ static ctl_table kernel_root_table2[] = #endif @@ -9484,111 +9000,8 @@ Acked-by: jbeulich@novell.com return 0; } ---- a/arch/x86/mach-xen/setup.c -+++ b/arch/x86/mach-xen/setup.c -@@ -102,8 +102,10 @@ void __init pre_setup_arch_hook(void) - - setup_xen_features(); - -- if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) -- set_fixaddr_top(pp.virt_start); -+ if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) { -+ hypervisor_virt_start = pp.virt_start; -+ reserve_top_address(0UL - pp.virt_start); -+ } - - if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) { - machine_to_phys_mapping = (unsigned long *)mapping.v_start; ---- a/arch/x86/mm/fault_32-xen.c -+++ b/arch/x86/mm/fault_32-xen.c -@@ -27,21 +27,24 @@ - #include <asm/uaccess.h> - #include <asm/desc.h> - #include <asm/kdebug.h> -+#include <asm/segment.h> - - extern void die(const char *,struct pt_regs *,long); - --#ifdef CONFIG_KPROBES --ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); -+static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); -+ - int register_page_fault_notifier(struct notifier_block *nb) - { - vmalloc_sync_all(); - return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); - } -+EXPORT_SYMBOL_GPL(register_page_fault_notifier); - - int unregister_page_fault_notifier(struct notifier_block *nb) - { - return atomic_notifier_chain_unregister(¬ify_page_fault_chain, nb); - } -+EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); - - static inline int notify_page_fault(enum die_val val, const char *str, - struct pt_regs *regs, long err, int trap, int sig) -@@ -55,14 +58,6 @@ static inline int notify_page_fault(enum - }; - return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args); - } --#else --static inline int notify_page_fault(enum die_val val, const char *str, -- struct pt_regs *regs, long err, int trap, int sig) --{ -- return NOTIFY_DONE; --} --#endif -- - - /* - * Unlock any spinlocks which will prevent us from getting the -@@ -119,10 +114,10 @@ static inline unsigned long get_segment_ - } - - /* The standard kernel/user address space limit. */ -- *eip_limit = (seg & 2) ? USER_DS.seg : KERNEL_DS.seg; -+ *eip_limit = user_mode(regs) ? USER_DS.seg : KERNEL_DS.seg; - - /* By far the most common cases. */ -- if (likely(seg == __USER_CS || seg == GET_KERNEL_CS())) -+ if (likely(SEGMENT_IS_FLAT_CODE(seg))) - return eip; - - /* Check the segment exists, is within the current LDT/GDT size, -@@ -559,11 +554,7 @@ good_area: - write = 0; - switch (error_code & 3) { - default: /* 3: write, present */ --#ifdef TEST_VERIFY_AREA -- if (regs->cs == GET_KERNEL_CS()) -- printk("WP fault at %08lx\n", regs->eip); --#endif -- /* fall through */ -+ /* fall through */ - case 2: /* write, not present */ - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; -@@ -572,7 +563,7 @@ good_area: - case 1: /* read, present */ - goto bad_area; - case 0: /* read, not present */ -- if (!(vma->vm_flags & (VM_READ | VM_EXEC))) -+ if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) - goto bad_area; - } - -@@ -704,7 +695,7 @@ no_context: - */ - out_of_memory: - up_read(&mm->mmap_sem); -- if (tsk->pid == 1) { -+ if (is_init(tsk)) { - yield(); - down_read(&mm->mmap_sem); - goto survive; ---- a/arch/x86/mm/fault_64-xen.c -+++ b/arch/x86/mm/fault_64-xen.c +--- head.orig/arch/x86/mm/fault_64-xen.c 2011-10-07 10:44:29.000000000 +0200 ++++ head/arch/x86/mm/fault_64-xen.c 2011-07-26 09:24:01.000000000 +0200 @@ -40,8 +40,7 @@ #define PF_RSVD (1<<3) #define PF_INSTR (1<<4) @@ -9599,7 +9012,7 @@ Acked-by: jbeulich@novell.com /* Hook to register for page fault notifications */ int register_page_fault_notifier(struct notifier_block *nb) -@@ -49,11 +48,13 @@ int register_page_fault_notifier(struct +@@ -49,11 +48,13 @@ int register_page_fault_notifier(struct vmalloc_sync_all(); return atomic_notifier_chain_register(¬ify_page_fault_chain, nb); } @@ -9726,593 +9139,8 @@ Acked-by: jbeulich@novell.com pgd_page_table(unlock, page); } spin_unlock(&pgd_lock); ---- a/arch/x86/mm/highmem_32-xen.c -+++ b/arch/x86/mm/highmem_32-xen.c -@@ -38,11 +38,9 @@ static void *__kmap_atomic(struct page * - - idx = type + KM_TYPE_NR*smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); --#ifdef CONFIG_DEBUG_HIGHMEM - if (!pte_none(*(kmap_pte-idx))) - BUG(); --#endif -- set_pte_at_sync(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); -+ set_pte_at(&init_mm, vaddr, kmap_pte-idx, mk_pte(page, prot)); - - return (void*) vaddr; - } -@@ -62,36 +60,26 @@ void *kmap_atomic_pte(struct page *page, - - void kunmap_atomic(void *kvaddr, enum km_type type) - { --#if defined(CONFIG_DEBUG_HIGHMEM) || defined(CONFIG_XEN) - unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; - enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); - -- if (vaddr < FIXADDR_START) { // FIXME -+#ifdef CONFIG_DEBUG_HIGHMEM -+ if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) { - dec_preempt_count(); - preempt_check_resched(); - return; - } --#endif - --#if defined(CONFIG_DEBUG_HIGHMEM) - if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx)) - BUG(); -- -- /* -- * force other mappings to Oops if they'll try to access -- * this pte without first remap it -- */ -- pte_clear(&init_mm, vaddr, kmap_pte-idx); -- __flush_tlb_one(vaddr); --#elif defined(CONFIG_XEN) -+#endif - /* -- * We must ensure there are no dangling pagetable references when -- * returning memory to Xen (decrease_reservation). -- * XXX TODO: We could make this faster by only zapping when -- * kmap_flush_unused is called but that is trickier and more invasive. -+ * Force other mappings to Oops if they'll try to access this pte -+ * without first remap it. Keeping stale mappings around is a bad idea -+ * also, in case the page changes cacheability attributes or becomes -+ * a protected page in a hypervisor. - */ -- pte_clear(&init_mm, vaddr, kmap_pte-idx); --#endif -+ kpte_clear_flush(kmap_pte-idx, vaddr); - - dec_preempt_count(); - preempt_check_resched(); -@@ -110,7 +98,6 @@ void *kmap_atomic_pfn(unsigned long pfn, - idx = type + KM_TYPE_NR*smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); - set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); -- __flush_tlb_one(vaddr); - - return (void*) vaddr; - } ---- a/arch/x86/mm/hypervisor.c -+++ b/arch/x86/mm/hypervisor.c -@@ -31,6 +31,7 @@ - */ - - #include <linux/sched.h> -+#include <linux/hardirq.h> - #include <linux/mm.h> - #include <linux/vmalloc.h> - #include <asm/page.h> -@@ -44,6 +45,300 @@ - #include <asm/tlbflush.h> - #include <linux/highmem.h> - -+EXPORT_SYMBOL(hypercall_page); -+ -+#define NR_MC BITS_PER_LONG -+#define NR_MMU BITS_PER_LONG -+#define NR_MMUEXT (BITS_PER_LONG / 4) -+ -+DEFINE_PER_CPU(bool, xen_lazy_mmu); -+struct lazy_mmu { -+ unsigned int nr_mc, nr_mmu, nr_mmuext; -+ multicall_entry_t mc[NR_MC]; -+ mmu_update_t mmu[NR_MMU]; -+ struct mmuext_op mmuext[NR_MMUEXT]; -+}; -+static DEFINE_PER_CPU(struct lazy_mmu, lazy_mmu); -+ -+static inline bool use_lazy_mmu_mode(void) -+{ -+#ifdef CONFIG_PREEMPT -+ if (!preempt_count()) -+ return false; -+#endif -+ return !irq_count(); -+} -+ -+static void multicall_failed(const multicall_entry_t *mc, int rc) -+{ -+ printk(KERN_EMERG "hypercall#%lu(%lx, %lx, %lx, %lx)" -+ " failed: %d (caller %lx)\n", -+ mc->op, mc->args[0], mc->args[1], mc->args[2], mc->args[3], -+ rc, mc->args[5]); -+ BUG(); -+} -+ -+int xen_multicall_flush(bool ret_last) { -+ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); -+ multicall_entry_t *mc = lazy->mc; -+ unsigned int count = lazy->nr_mc; -+ -+ if (!count || !use_lazy_mmu_mode()) -+ return 0; -+ -+ lazy->nr_mc = 0; -+ lazy->nr_mmu = 0; -+ lazy->nr_mmuext = 0; -+ -+ if (count == 1) { -+ int rc = _hypercall(int, mc->op, mc->args[0], mc->args[1], -+ mc->args[2], mc->args[3], mc->args[4]); -+ -+ if (unlikely(rc)) { -+ if (ret_last) -+ return rc; -+ multicall_failed(mc, rc); -+ } -+ } else { -+ if (HYPERVISOR_multicall(mc, count)) -+ BUG(); -+ while (count-- > ret_last) -+ if (unlikely(mc++->result)) -+ multicall_failed(mc - 1, mc[-1].result); -+ if (ret_last) -+ return mc->result; -+ } -+ -+ return 0; -+} -+ -+int xen_multi_update_va_mapping(unsigned long va, pte_t pte, -+ unsigned long uvmf) -+{ -+ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); -+ multicall_entry_t *mc; -+ -+ if (unlikely(!use_lazy_mmu_mode())) -+#ifdef CONFIG_X86_PAE -+ return _hypercall4(int, update_va_mapping, va, -+ pte.pte_low, pte.pte_high, uvmf); -+#else -+ return _hypercall3(int, update_va_mapping, va, -+ pte.pte, uvmf); -+#endif -+ -+ if (unlikely(lazy->nr_mc == NR_MC)) -+ xen_multicall_flush(false); -+ -+ mc = lazy->mc + lazy->nr_mc++; -+ mc->op = __HYPERVISOR_update_va_mapping; -+ mc->args[0] = va; -+#ifndef CONFIG_X86_PAE -+ mc->args[1] = pte.pte; -+#else -+ mc->args[1] = pte.pte_low; -+ mc->args[2] = pte.pte_high; -+#endif -+ mc->args[MULTI_UVMFLAGS_INDEX] = uvmf; -+ mc->args[5] = (long)__builtin_return_address(0); -+ -+ return 0; -+} -+ -+static inline bool mmu_may_merge(const multicall_entry_t *mc, -+ unsigned int op, domid_t domid) -+{ -+ return mc->op == op && !mc->args[2] && mc->args[3] == domid; -+} -+ -+int xen_multi_mmu_update(mmu_update_t *src, unsigned int count, -+ unsigned int *success_count, domid_t domid) -+{ -+ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); -+ multicall_entry_t *mc = lazy->mc + lazy->nr_mc; -+ mmu_update_t *dst; -+ bool commit, merge; -+ -+ if (unlikely(!use_lazy_mmu_mode())) -+ return _hypercall4(int, mmu_update, src, count, -+ success_count, domid); -+ -+ commit = (lazy->nr_mmu + count) > NR_MMU || success_count; -+ merge = lazy->nr_mc && !commit -+ && mmu_may_merge(mc - 1, __HYPERVISOR_mmu_update, domid); -+ if (unlikely(lazy->nr_mc == NR_MC) && !merge) { -+ xen_multicall_flush(false); -+ mc = lazy->mc; -+ commit = count > NR_MMU || success_count; -+ } -+ -+ if (!lazy->nr_mc && unlikely(commit)) -+ return _hypercall4(int, mmu_update, src, count, -+ success_count, domid); -+ -+ dst = lazy->mmu + lazy->nr_mmu; -+ lazy->nr_mmu += count; -+ if (merge) { -+ mc[-1].args[1] += count; -+ memcpy(dst, src, count * sizeof(*src)); -+ } else { -+ ++lazy->nr_mc; -+ mc->op = __HYPERVISOR_mmu_update; -+ if (!commit) { -+ mc->args[0] = (unsigned long)dst; -+ memcpy(dst, src, count * sizeof(*src)); -+ } else -+ mc->args[0] = (unsigned long)src; -+ mc->args[1] = count; -+ mc->args[2] = (unsigned long)success_count; -+ mc->args[3] = domid; -+ mc->args[5] = (long)__builtin_return_address(0); -+ } -+ -+ while (!commit && count--) -+ switch (src++->ptr & (sizeof(pteval_t) - 1)) { -+ case MMU_NORMAL_PT_UPDATE: -+ case MMU_PT_UPDATE_PRESERVE_AD: -+ break; -+ default: -+ commit = true; -+ break; -+ } -+ -+ return commit ? xen_multicall_flush(true) : 0; -+} -+ -+int xen_multi_mmuext_op(struct mmuext_op *src, unsigned int count, -+ unsigned int *success_count, domid_t domid) -+{ -+ struct lazy_mmu *lazy = &__get_cpu_var(lazy_mmu); -+ multicall_entry_t *mc; -+ struct mmuext_op *dst; -+ bool commit, merge; -+ -+ if (unlikely(!use_lazy_mmu_mode())) -+ return _hypercall4(int, mmuext_op, src, count, -+ success_count, domid); -+ -+ /* -+ * While it could be useful in theory, I've never seen the body of -+ * this conditional to be reached, hence it seems more reasonable -+ * to disable it for the time being. -+ */ -+ if (0 && likely(count) -+ && likely(!success_count) -+ && likely(domid == DOMID_SELF) -+ && likely(lazy->nr_mc) -+ && lazy->mc[lazy->nr_mc - 1].op == __HYPERVISOR_update_va_mapping) { -+ unsigned long oldf, newf = UVMF_NONE; -+ -+ switch (src->cmd) { -+ case MMUEXT_TLB_FLUSH_ALL: -+ newf = UVMF_TLB_FLUSH | UVMF_ALL; -+ break; -+ case MMUEXT_INVLPG_ALL: -+ newf = UVMF_INVLPG | UVMF_ALL; -+ break; -+ case MMUEXT_TLB_FLUSH_MULTI: -+ newf = UVMF_TLB_FLUSH | UVMF_MULTI -+ | (unsigned long)src->arg2.vcpumask.p; -+ break; -+ case MMUEXT_INVLPG_MULTI: -+ newf = UVMF_INVLPG | UVMF_MULTI -+ | (unsigned long)src->arg2.vcpumask.p; -+ break; -+ case MMUEXT_TLB_FLUSH_LOCAL: -+ newf = UVMF_TLB_FLUSH | UVMF_LOCAL; -+ break; -+ case MMUEXT_INVLPG_LOCAL: -+ newf = UVMF_INVLPG | UVMF_LOCAL; -+ break; -+ } -+ mc = lazy->mc + lazy->nr_mc - 1; -+ oldf = mc->args[MULTI_UVMFLAGS_INDEX]; -+ if (newf == UVMF_NONE || oldf == UVMF_NONE -+ || newf == (UVMF_TLB_FLUSH | UVMF_ALL)) -+ ; -+ else if (oldf == (UVMF_TLB_FLUSH | UVMF_ALL)) -+ newf = UVMF_TLB_FLUSH | UVMF_ALL; -+ else if ((newf & UVMF_FLUSHTYPE_MASK) == UVMF_INVLPG -+ && (oldf & UVMF_FLUSHTYPE_MASK) == UVMF_INVLPG -+ && ((src->arg1.linear_addr ^ mc->args[0]) -+ >> PAGE_SHIFT)) -+ newf = UVMF_NONE; -+ else if (((oldf | newf) & UVMF_ALL) -+ && !((oldf ^ newf) & UVMF_FLUSHTYPE_MASK)) -+ newf |= UVMF_ALL; -+ else if ((oldf ^ newf) & ~UVMF_FLUSHTYPE_MASK) -+ newf = UVMF_NONE; -+ else if ((oldf & UVMF_FLUSHTYPE_MASK) == UVMF_TLB_FLUSH) -+ newf = (newf & ~UVMF_FLUSHTYPE_MASK) | UVMF_TLB_FLUSH; -+ else if ((newf & UVMF_FLUSHTYPE_MASK) != UVMF_TLB_FLUSH -+ && ((newf ^ oldf) & UVMF_FLUSHTYPE_MASK)) -+ newf = UVMF_NONE; -+ if (newf != UVMF_NONE) { -+ mc->args[MULTI_UVMFLAGS_INDEX] = newf; -+ ++src; -+ if (!--count) -+ return 0; -+ } -+ } -+ -+ mc = lazy->mc + lazy->nr_mc; -+ commit = (lazy->nr_mmuext + count) > NR_MMUEXT || success_count; -+ merge = lazy->nr_mc && !commit -+ && mmu_may_merge(mc - 1, __HYPERVISOR_mmuext_op, domid); -+ if (unlikely(lazy->nr_mc == NR_MC) && !merge) { -+ xen_multicall_flush(false); -+ mc = lazy->mc; -+ commit = count > NR_MMUEXT || success_count; -+ } -+ -+ if (!lazy->nr_mc && unlikely(commit)) -+ return _hypercall4(int, mmuext_op, src, count, -+ success_count, domid); -+ -+ dst = lazy->mmuext + lazy->nr_mmuext; -+ lazy->nr_mmuext += count; -+ if (merge) { -+ mc[-1].args[1] += count; -+ memcpy(dst, src, count * sizeof(*src)); -+ } else { -+ ++lazy->nr_mc; -+ mc->op = __HYPERVISOR_mmuext_op; -+ if (!commit) { -+ mc->args[0] = (unsigned long)dst; -+ memcpy(dst, src, count * sizeof(*src)); -+ } else -+ mc->args[0] = (unsigned long)src; -+ mc->args[1] = count; -+ mc->args[2] = (unsigned long)success_count; -+ mc->args[3] = domid; -+ mc->args[5] = (long)__builtin_return_address(0); -+ } -+ -+ while (!commit && count--) -+ switch (src++->cmd) { -+ case MMUEXT_PIN_L1_TABLE: -+ case MMUEXT_PIN_L2_TABLE: -+ case MMUEXT_PIN_L3_TABLE: -+ case MMUEXT_PIN_L4_TABLE: -+ case MMUEXT_UNPIN_TABLE: -+ case MMUEXT_TLB_FLUSH_LOCAL: -+ case MMUEXT_INVLPG_LOCAL: -+ case MMUEXT_TLB_FLUSH_MULTI: -+ case MMUEXT_INVLPG_MULTI: -+ case MMUEXT_TLB_FLUSH_ALL: -+ case MMUEXT_INVLPG_ALL: -+ break; -+ default: -+ commit = true; -+ break; -+ } -+ -+ return commit ? xen_multicall_flush(true) : 0; -+} -+ - void xen_l1_entry_update(pte_t *ptr, pte_t val) - { - mmu_update_t u; -@@ -619,7 +914,8 @@ int write_ldt_entry(void *ldt, int entry - #define MAX_BATCHED_FULL_PTES 32 - - int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd, -- unsigned long addr, unsigned long end, pgprot_t newprot) -+ unsigned long addr, unsigned long end, pgprot_t newprot, -+ int dirty_accountable) - { - int rc = 0, i = 0; - mmu_update_t u[MAX_BATCHED_FULL_PTES]; -@@ -632,10 +928,14 @@ int xen_change_pte_range(struct mm_struc - pte = pte_offset_map_lock(mm, pmd, addr, &ptl); - do { - if (pte_present(*pte)) { -+ pte_t ptent = pte_modify(*pte, newprot); -+ -+ if (dirty_accountable && pte_dirty(ptent)) -+ ptent = pte_mkwrite(ptent); - u[i].ptr = (__pmd_val(*pmd) & PHYSICAL_PAGE_MASK) - | ((unsigned long)pte & ~PAGE_MASK) - | MMU_PT_UPDATE_PRESERVE_AD; -- u[i].val = __pte_val(pte_modify(*pte, newprot)); -+ u[i].val = __pte_val(ptent); - if (++i == MAX_BATCHED_FULL_PTES) { - if ((rc = HYPERVISOR_mmu_update( - &u[0], i, NULL, DOMID_SELF)) != 0) ---- a/arch/x86/mm/init_32-xen.c -+++ b/arch/x86/mm/init_32-xen.c -@@ -313,8 +313,7 @@ static void __init permanent_kmaps_init( - static void __meminit free_new_highpage(struct page *page, int pfn) - { - init_page_count(page); -- if (pfn < xen_start_info->nr_pages) -- __free_page(page); -+ __free_page(page); - totalhigh_pages++; - } - -@@ -357,8 +356,16 @@ extern void set_highmem_pages_init(int); - static void __init set_highmem_pages_init(int bad_ppro) - { - int pfn; -- for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) -+ for (pfn = highstart_pfn; pfn < highend_pfn -+ && pfn < xen_start_info->nr_pages; pfn++) - add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); -+ -+ /* XEN: init high-mem pages outside initial allocation. */ -+ for (; pfn < highend_pfn; pfn++) { -+ ClearPageReserved(pfn_to_page(pfn)); -+ init_page_count(pfn_to_page(pfn)); -+ } -+ - totalram_pages += totalhigh_pages; - } - #endif /* CONFIG_FLATMEM */ -@@ -462,16 +469,22 @@ EXPORT_SYMBOL(__supported_pte_mask); - * on Enable - * off Disable - */ --void __init noexec_setup(const char *str) -+static int __init noexec_setup(char *str) - { -- if (!strncmp(str, "on",2) && cpu_has_nx) { -- __supported_pte_mask |= _PAGE_NX; -- disable_nx = 0; -- } else if (!strncmp(str,"off",3)) { -+ if (!str || !strcmp(str, "on")) { -+ if (cpu_has_nx) { -+ __supported_pte_mask |= _PAGE_NX; -+ disable_nx = 0; -+ } -+ } else if (!strcmp(str,"off")) { - disable_nx = 1; - __supported_pte_mask &= ~_PAGE_NX; -- } -+ } else -+ return -EINVAL; -+ -+ return 0; - } -+early_param("noexec", noexec_setup); - - int nx_enabled = 0; - #ifdef CONFIG_X86_PAE -@@ -514,6 +527,7 @@ int __init set_kernel_exec(unsigned long - pte->pte_high &= ~(1 << (_PAGE_BIT_NX - 32)); - else - pte->pte_high |= 1 << (_PAGE_BIT_NX - 32); -+ pte_update_defer(&init_mm, vaddr, pte); - __flush_tlb_all(); - out: - return ret; -@@ -596,18 +610,6 @@ static void __init test_wp_bit(void) - } - } - --static void __init set_max_mapnr_init(void) --{ --#ifdef CONFIG_HIGHMEM -- num_physpages = highend_pfn; --#else -- num_physpages = max_low_pfn; --#endif --#ifdef CONFIG_FLATMEM -- max_mapnr = num_physpages; --#endif --} -- - static struct kcore_list kcore_mem, kcore_vmalloc; - - void __init mem_init(void) -@@ -623,8 +625,7 @@ void __init mem_init(void) - #endif - - #ifdef CONFIG_FLATMEM -- if (!mem_map) -- BUG(); -+ BUG_ON(!mem_map); - #endif - - bad_ppro = ppro_with_ram_bug(); -@@ -639,24 +640,12 @@ void __init mem_init(void) - } - #endif - -- set_max_mapnr_init(); -- --#ifdef CONFIG_HIGHMEM -- high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; --#else -- high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; --#endif -- printk("vmalloc area: %lx-%lx, maxmem %lx\n", -- VMALLOC_START,VMALLOC_END,MAXMEM); -- BUG_ON(VMALLOC_START > VMALLOC_END); -- - /* this will put all low memory onto the freelists */ - totalram_pages += free_all_bootmem(); -- /* XEN: init and count low-mem pages outside initial allocation. */ -+ /* XEN: init low-mem pages outside initial allocation. */ - for (pfn = xen_start_info->nr_pages; pfn < max_low_pfn; pfn++) { - ClearPageReserved(pfn_to_page(pfn)); - init_page_count(pfn_to_page(pfn)); -- totalram_pages++; - } - - reservedpages = 0; -@@ -687,6 +676,48 @@ void __init mem_init(void) - (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) - ); - -+#if 1 /* double-sanity-check paranoia */ -+ printk("virtual kernel memory layout:\n" -+ " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" -+#ifdef CONFIG_HIGHMEM -+ " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n" -+#endif -+ " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" -+ " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" -+ " .init : 0x%08lx - 0x%08lx (%4ld kB)\n" -+ " .data : 0x%08lx - 0x%08lx (%4ld kB)\n" -+ " .text : 0x%08lx - 0x%08lx (%4ld kB)\n", -+ FIXADDR_START, FIXADDR_TOP, -+ (FIXADDR_TOP - FIXADDR_START) >> 10, -+ -+#ifdef CONFIG_HIGHMEM -+ PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE, -+ (LAST_PKMAP*PAGE_SIZE) >> 10, -+#endif -+ -+ VMALLOC_START, VMALLOC_END, -+ (VMALLOC_END - VMALLOC_START) >> 20, -+ -+ (unsigned long)__va(0), (unsigned long)high_memory, -+ ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, -+ -+ (unsigned long)&__init_begin, (unsigned long)&__init_end, -+ ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10, -+ -+ (unsigned long)&_etext, (unsigned long)&_edata, -+ ((unsigned long)&_edata - (unsigned long)&_etext) >> 10, -+ -+ (unsigned long)&_text, (unsigned long)&_etext, -+ ((unsigned long)&_etext - (unsigned long)&_text) >> 10); -+ -+#ifdef CONFIG_HIGHMEM -+ BUG_ON(PKMAP_BASE+LAST_PKMAP*PAGE_SIZE > FIXADDR_START); -+ BUG_ON(VMALLOC_END > PKMAP_BASE); -+#endif -+ BUG_ON(VMALLOC_START > VMALLOC_END); -+ BUG_ON((unsigned long)high_memory > VMALLOC_START); -+#endif /* double-sanity-check paranoia */ -+ - #ifdef CONFIG_X86_PAE - if (!cpu_has_pae) - panic("cannot execute a PAE-enabled kernel on a PAE-less CPU!"); -@@ -717,7 +748,7 @@ void __init mem_init(void) - int arch_add_memory(int nid, u64 start, u64 size) - { - struct pglist_data *pgdata = &contig_page_data; -- struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1; -+ struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM; - unsigned long start_pfn = start >> PAGE_SHIFT; - unsigned long nr_pages = size >> PAGE_SHIFT; - ---- a/arch/x86/mm/init_64-xen.c -+++ b/arch/x86/mm/init_64-xen.c +--- head.orig/arch/x86/mm/init_64-xen.c 2011-10-17 10:45:09.000000000 +0200 ++++ head/arch/x86/mm/init_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -61,8 +61,6 @@ EXPORT_SYMBOL(__kernel_page_user); int after_bootmem; @@ -10358,7 +9186,7 @@ Acked-by: jbeulich@novell.com pte = alloc_static_page(&pte_phys); pte_save = pte; for (k = 0; k < PTRS_PER_PTE; pte++, k++, address += PTE_SIZE) { -@@ -478,40 +483,35 @@ phys_pmd_init(pmd_t *pmd, unsigned long +@@ -478,40 +483,35 @@ phys_pmd_init(pmd_t *pmd, unsigned long static void __meminit phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end) { @@ -10625,57 +9453,8 @@ Acked-by: jbeulich@novell.com } int kern_addr_valid(unsigned long addr) ---- a/arch/x86/mm/ioremap-xen.c -+++ b/arch/x86/mm/ioremap-xen.c -@@ -12,7 +12,7 @@ - #include <linux/init.h> - #include <linux/slab.h> - #include <linux/module.h> --#include <asm/io.h> -+#include <linux/io.h> - #include <asm/fixmap.h> - #include <asm/cacheflush.h> - #include <asm/tlbflush.h> -@@ -114,7 +114,7 @@ int direct_remap_pfn_range(struct vm_are - if (domid == DOMID_SELF) - return -EINVAL; - -- vma->vm_flags |= VM_IO | VM_RESERVED; -+ vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; - - vma->vm_mm->context.has_foreign_mappings = 1; - -@@ -184,6 +184,7 @@ void __iomem * __ioremap(unsigned long p - void __iomem * addr; - struct vm_struct * area; - unsigned long offset, last_addr; -+ pgprot_t prot; - domid_t domid = DOMID_IO; - - /* Don't allow wraparound or zero size */ -@@ -215,6 +216,8 @@ void __iomem * __ioremap(unsigned long p - domid = DOMID_SELF; - } - -+ prot = __pgprot(_KERNPG_TABLE | flags); -+ - /* - * Mappings have to be page-aligned - */ -@@ -230,10 +233,9 @@ void __iomem * __ioremap(unsigned long p - return NULL; - area->phys_addr = phys_addr; - addr = (void __iomem *) area->addr; -- flags |= _KERNPG_TABLE; - if (__direct_remap_pfn_range(&init_mm, (unsigned long)addr, - phys_addr>>PAGE_SHIFT, -- size, __pgprot(flags), domid)) { -+ size, prot, domid)) { - vunmap((void __force *) addr); - return NULL; - } ---- a/arch/x86/mm/pageattr_64-xen.c -+++ b/arch/x86/mm/pageattr_64-xen.c +--- head.orig/arch/x86/mm/pageattr_64-xen.c 2009-03-18 10:39:31.000000000 +0100 ++++ head/arch/x86/mm/pageattr_64-xen.c 2011-01-31 17:29:16.000000000 +0100 @@ -377,8 +377,8 @@ static void revert_page(unsigned long ad BUG_ON(pud_none(*pud)); pmd = pmd_offset(pud, address); @@ -10724,7 +9503,7 @@ Acked-by: jbeulich@novell.com set_pte(kpte, pfn_pte(pfn, ref_prot)); BUG_ON(page_private(kpte_page) == 0); page_private(kpte_page)--; -@@ -470,10 +466,12 @@ int change_page_attr_addr(unsigned long +@@ -470,10 +466,12 @@ int change_page_attr_addr(unsigned long * lowmem */ if (__pa(address) < KERNEL_TEXT_SIZE) { unsigned long addr2; @@ -10740,65 +9519,8 @@ Acked-by: jbeulich@novell.com } } up_write(&init_mm.mmap_sem); ---- a/arch/x86/mm/pgtable_32-xen.c -+++ b/arch/x86/mm/pgtable_32-xen.c -@@ -68,7 +68,9 @@ void show_mem(void) - printk(KERN_INFO "%lu pages writeback\n", - global_page_state(NR_WRITEBACK)); - printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED)); -- printk(KERN_INFO "%lu pages slab\n", global_page_state(NR_SLAB)); -+ printk(KERN_INFO "%lu pages slab\n", -+ global_page_state(NR_SLAB_RECLAIMABLE) + -+ global_page_state(NR_SLAB_UNRECLAIMABLE)); - printk(KERN_INFO "%lu pages pagetables\n", - global_page_state(NR_PAGETABLE)); - } -@@ -108,18 +110,11 @@ void set_pmd_pfn(unsigned long vaddr, un - __flush_tlb_one(vaddr); - } - --static int nr_fixmaps = 0; -+static int fixmaps; - unsigned long hypervisor_virt_start = HYPERVISOR_VIRT_START; --unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - 2 * PAGE_SIZE); -+unsigned long __FIXADDR_TOP = (HYPERVISOR_VIRT_START - PAGE_SIZE); - EXPORT_SYMBOL(__FIXADDR_TOP); - --void __init set_fixaddr_top(unsigned long top) --{ -- BUG_ON(nr_fixmaps > 0); -- hypervisor_virt_start = top; -- __FIXADDR_TOP = hypervisor_virt_start - 2 * PAGE_SIZE; --} -- - void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags) - { - unsigned long address = __fix_to_virt(idx); -@@ -141,7 +136,21 @@ void __set_fixmap (enum fixed_addresses - if (HYPERVISOR_update_va_mapping(address, pte, - UVMF_INVLPG|UVMF_ALL)) - BUG(); -- nr_fixmaps++; -+ fixmaps++; -+} -+ -+/** -+ * reserve_top_address - reserves a hole in the top of kernel address space -+ * @reserve - size of hole to reserve -+ * -+ * Can be used to relocate the fixmap area and poke a hole in the top -+ * of kernel address space to make room for a hypervisor. -+ */ -+void __init reserve_top_address(unsigned long reserve) -+{ -+ BUG_ON(fixmaps > 0); -+ __FIXADDR_TOP = -reserve - PAGE_SIZE; -+ __VMALLOC_RESERVE += reserve; - } - - pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) ---- a/drivers/char/tpm/tpm_xen.c -+++ b/drivers/char/tpm/tpm_xen.c +--- head.orig/drivers/char/tpm/tpm_xen.c 2012-03-12 12:51:05.000000000 +0100 ++++ head/drivers/char/tpm/tpm_xen.c 2012-03-12 13:31:05.000000000 +0100 @@ -85,8 +85,7 @@ static struct tpm_private *my_priv; /* local function prototypes */ @@ -10818,8 +9540,8 @@ Acked-by: jbeulich@novell.com { struct tpm_private *tp = tpm_priv; unsigned long flags; ---- a/drivers/pci/Kconfig -+++ b/drivers/pci/Kconfig +--- head.orig/drivers/pci/Kconfig 2012-04-10 15:13:46.000000000 +0200 ++++ head/drivers/pci/Kconfig 2012-04-10 16:14:10.000000000 +0200 @@ -88,7 +88,7 @@ config XEN_PCIDEV_FRONTEND config HT_IRQ bool "Interrupts on hypertransport devices" @@ -10829,8 +9551,8 @@ Acked-by: jbeulich@novell.com help This allows native hypertransport devices to use interrupts. ---- a/drivers/pci/msi-xen.c -+++ b/drivers/pci/msi-xen.c +--- head.orig/drivers/pci/msi-xen.c 2011-10-17 10:45:09.000000000 +0200 ++++ head/drivers/pci/msi-xen.c 2011-11-03 12:01:13.000000000 +0100 @@ -6,6 +6,7 @@ * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) */ @@ -11062,8 +9784,8 @@ Acked-by: jbeulich@novell.com * allocated for this device function, are reclaimed to unused state, * which may be used later on. **/ ---- a/drivers/xen/Kconfig -+++ b/drivers/xen/Kconfig +--- head.orig/drivers/xen/Kconfig 2011-11-03 11:58:46.000000000 +0100 ++++ head/drivers/xen/Kconfig 2011-11-03 12:01:19.000000000 +0100 @@ -344,6 +344,10 @@ endmenu config HAVE_IRQ_IGNORE_UNHANDLED def_bool y @@ -11075,8 +9797,8 @@ Acked-by: jbeulich@novell.com config NO_IDLE_HZ def_bool y ---- a/drivers/xen/balloon/balloon.c -+++ b/drivers/xen/balloon/balloon.c +--- head.orig/drivers/xen/balloon/balloon.c 2012-01-20 14:18:49.000000000 +0100 ++++ head/drivers/xen/balloon/balloon.c 2012-01-20 14:44:32.000000000 +0100 @@ -38,6 +38,7 @@ #include <linux/errno.h> #include <linux/list.h> @@ -11264,7 +9986,7 @@ Acked-by: jbeulich@novell.com } balloon_unlock(flags); -@@ -733,7 +768,8 @@ void balloon_release_driver_page(struct +@@ -733,7 +768,8 @@ void balloon_release_driver_page(struct unsigned long flags; balloon_lock(flags); @@ -11274,8 +9996,8 @@ Acked-by: jbeulich@novell.com bs.driver_pages--; balloon_unlock(flags); ---- a/drivers/xen/blkback/blkback.c -+++ b/drivers/xen/blkback/blkback.c +--- head.orig/drivers/xen/blkback/blkback.c 2012-04-04 08:57:09.000000000 +0200 ++++ head/drivers/xen/blkback/blkback.c 2012-03-26 12:19:17.000000000 +0200 @@ -297,7 +297,7 @@ static void blkif_notify_work(blkif_t *b wake_up(&blkif->wq); } @@ -11285,8 +10007,8 @@ Acked-by: jbeulich@novell.com { blkif_notify_work(dev_id); return IRQ_HANDLED; ---- a/drivers/xen/blkback/common.h -+++ b/drivers/xen/blkback/common.h +--- head.orig/drivers/xen/blkback/common.h 2012-03-22 13:27:48.000000000 +0100 ++++ head/drivers/xen/blkback/common.h 2012-03-22 13:43:37.000000000 +0100 @@ -135,7 +135,7 @@ void blkif_interface_init(void); void blkif_xenbus_init(void); @@ -11296,8 +10018,8 @@ Acked-by: jbeulich@novell.com int blkif_schedule(void *arg); void blkback_barrier(struct xenbus_transaction, struct backend_info *, ---- a/drivers/xen/blkfront/blkfront.c -+++ b/drivers/xen/blkfront/blkfront.c +--- head.orig/drivers/xen/blkfront/blkfront.c 2012-03-12 12:51:05.000000000 +0100 ++++ head/drivers/xen/blkfront/blkfront.c 2012-03-12 13:31:12.000000000 +0100 @@ -69,9 +69,9 @@ static int setup_blkring(struct xenbus_d static void kick_pending_request_queues(struct blkfront_info *); @@ -11359,9 +10081,9 @@ Acked-by: jbeulich@novell.com } int blkfront_is_ready(struct xenbus_device *dev) ---- a/drivers/xen/blktap/blktap.c -+++ b/drivers/xen/blktap/blktap.c -@@ -1265,7 +1265,7 @@ static void blkif_notify_work(blkif_t *b +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-14 08:37:24.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:04:38.000000000 +0200 +@@ -1273,7 +1273,7 @@ static void blkif_notify_work(blkif_t *b wake_up(&blkif->wq); } @@ -11370,8 +10092,8 @@ Acked-by: jbeulich@novell.com { blkif_notify_work(dev_id); return IRQ_HANDLED; ---- a/drivers/xen/blktap/common.h -+++ b/drivers/xen/blktap/common.h +--- head.orig/drivers/xen/blktap/common.h 2011-11-22 09:56:23.000000000 +0100 ++++ head/drivers/xen/blktap/common.h 2011-11-28 09:45:53.000000000 +0100 @@ -104,7 +104,7 @@ void tap_blkif_interface_init(void); void tap_blkif_xenbus_init(void); @@ -11381,8 +10103,8 @@ Acked-by: jbeulich@novell.com int tap_blkif_schedule(void *arg); int dom_to_devid(domid_t domid, int xenbus_id, blkif_t *blkif); ---- a/drivers/xen/blktap2/sysfs.c -+++ b/drivers/xen/blktap2/sysfs.c +--- head.orig/drivers/xen/blktap2/sysfs.c 2012-02-16 11:09:01.000000000 +0100 ++++ head/drivers/xen/blktap2/sysfs.c 2011-01-31 17:29:16.000000000 +0100 @@ -150,7 +150,7 @@ blktap_sysfs_pause_device(struct class_d err = blktap_device_pause(tap); if (!err) { @@ -11471,8 +10193,8 @@ Acked-by: jbeulich@novell.com - return 0; + return err; } ---- a/drivers/xen/console/console.c -+++ b/drivers/xen/console/console.c +--- head.orig/drivers/xen/console/console.c 2012-03-22 13:40:44.000000000 +0100 ++++ head/drivers/xen/console/console.c 2012-03-22 13:43:32.000000000 +0100 @@ -352,7 +352,7 @@ static struct tty_struct *xencons_tty; static int xencons_priv_irq; static char x_char; @@ -11518,8 +10240,8 @@ Acked-by: jbeulich@novell.com .open = xencons_open, .close = xencons_close, .write = xencons_write, ---- a/drivers/xen/console/xencons.h -+++ b/drivers/xen/console/xencons.h +--- head.orig/drivers/xen/console/xencons.h 2012-03-22 13:27:48.000000000 +0100 ++++ head/drivers/xen/console/xencons.h 2012-03-22 13:43:22.000000000 +0100 @@ -5,7 +5,7 @@ void xencons_force_flush(void); /* Interrupt work hooks. Receive data, or kick data out. */ @@ -11529,9 +10251,9 @@ Acked-by: jbeulich@novell.com void xencons_tx(void); int xencons_ring_init(void); ---- a/drivers/xen/console/xencons_ring.c -+++ b/drivers/xen/console/xencons_ring.c -@@ -64,7 +64,7 @@ int xencons_ring_send(const char *data, +--- head.orig/drivers/xen/console/xencons_ring.c 2012-03-22 13:27:48.000000000 +0100 ++++ head/drivers/xen/console/xencons_ring.c 2012-03-22 13:43:28.000000000 +0100 +@@ -64,7 +64,7 @@ int xencons_ring_send(const char *data, return sent; } @@ -11549,8 +10271,8 @@ Acked-by: jbeulich@novell.com cons++; } ---- a/drivers/xen/core/evtchn.c -+++ b/drivers/xen/core/evtchn.c +--- head.orig/drivers/xen/core/evtchn.c 2010-11-25 09:36:37.000000000 +0100 ++++ head/drivers/xen/core/evtchn.c 2011-01-31 17:29:16.000000000 +0100 @@ -539,7 +539,7 @@ static void unbind_from_irq(unsigned int int bind_caller_port_to_irqhandler( @@ -11830,8 +10552,8 @@ Acked-by: jbeulich@novell.com + handle_fasteoi_irq, "fasteoi"); } } ---- a/drivers/xen/core/gnttab.c -+++ b/drivers/xen/core/gnttab.c +--- head.orig/drivers/xen/core/gnttab.c 2012-05-14 08:37:24.000000000 +0200 ++++ head/drivers/xen/core/gnttab.c 2012-03-12 13:31:19.000000000 +0100 @@ -595,6 +595,7 @@ static void gnttab_page_free(struct page BUG_ON(order); ClearPageForeign(page); @@ -11849,8 +10571,8 @@ Acked-by: jbeulich@novell.com *pagep = new_page; SetPageForeign(page, gnttab_page_free); ---- a/drivers/xen/core/reboot.c -+++ b/drivers/xen/core/reboot.c +--- head.orig/drivers/xen/core/reboot.c 2011-06-30 15:37:44.000000000 +0200 ++++ head/drivers/xen/core/reboot.c 2011-01-31 17:29:16.000000000 +0100 @@ -1,4 +1,3 @@ -#define __KERNEL_SYSCALLS__ #include <linux/version.h> @@ -11882,8 +10604,8 @@ Acked-by: jbeulich@novell.com { switch_shutdown_state(SHUTDOWN_SUSPEND); return IRQ_HANDLED; ---- a/drivers/xen/core/smpboot.c -+++ b/drivers/xen/core/smpboot.c +--- head.orig/drivers/xen/core/smpboot.c 2012-01-20 14:38:21.000000000 +0100 ++++ head/drivers/xen/core/smpboot.c 2012-01-20 14:44:39.000000000 +0100 @@ -23,8 +23,8 @@ #include <xen/cpu_hotplug.h> #include <xen/xenbus.h> @@ -11904,8 +10626,8 @@ Acked-by: jbeulich@novell.com #endif void __init prefill_possible_map(void) ---- a/drivers/xen/fbfront/xenfb.c -+++ b/drivers/xen/fbfront/xenfb.c +--- head.orig/drivers/xen/fbfront/xenfb.c 2011-12-21 10:02:58.000000000 +0100 ++++ head/drivers/xen/fbfront/xenfb.c 2011-01-31 17:29:16.000000000 +0100 @@ -524,8 +524,7 @@ static struct fb_ops xenfb_fb_ops = { .fb_set_par = xenfb_set_par, }; @@ -11916,8 +10638,8 @@ Acked-by: jbeulich@novell.com { /* * No in events recognized, simply ignore them all. ---- a/drivers/xen/fbfront/xenkbd.c -+++ b/drivers/xen/fbfront/xenkbd.c +--- head.orig/drivers/xen/fbfront/xenkbd.c 2011-12-21 10:02:58.000000000 +0100 ++++ head/drivers/xen/fbfront/xenkbd.c 2011-01-31 17:29:16.000000000 +0100 @@ -46,7 +46,7 @@ static void xenkbd_disconnect_backend(st * to do that. */ @@ -11927,9 +10649,9 @@ Acked-by: jbeulich@novell.com { struct xenkbd_info *info = dev_id; struct xenkbd_page *page = info->page; ---- a/drivers/xen/gntdev/gntdev.c -+++ b/drivers/xen/gntdev/gntdev.c -@@ -714,9 +714,6 @@ static pte_t gntdev_clear_pte(struct vm_ +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-14 08:37:24.000000000 +0200 ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:04:13.000000000 +0200 +@@ -687,9 +687,6 @@ static pte_t gntdev_clear_pte(struct vm_ BUG(); } @@ -11939,37 +10661,39 @@ Acked-by: jbeulich@novell.com /* Calculate the grant relating to this PTE. */ slot_index = vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT); -@@ -731,6 +728,10 @@ static pte_t gntdev_clear_pte(struct vm_ - GNTDEV_INVALID_HANDLE && - !xen_feature(XENFEAT_auto_translated_physmap)) { - /* NOT USING SHADOW PAGE TABLES. */ -+ -+ /* Copy the existing value of the PTE for returning. */ -+ copy = *ptep; -+ - gnttab_set_unmap_op(&op, ptep_to_machine(ptep), - GNTMAP_contains_pte, - private_data->grants[slot_index] -@@ -743,7 +744,7 @@ static pte_t gntdev_clear_pte(struct vm_ - op.status); - } else { - /* USING SHADOW PAGE TABLES. */ -- pte_clear_full(vma->vm_mm, addr, ptep, is_fullmm); -+ copy = ptep_get_and_clear_full(vma->vm_mm, addr, ptep, is_fullmm); - } - - /* Finally, we unmap the grant from kernel space. */ -@@ -771,7 +772,7 @@ static pte_t gntdev_clear_pte(struct vm_ - INVALID_P2M_ENTRY); - +@@ -696,15 +693,17 @@ static pte_t gntdev_clear_pte(struct vm_ + /* Only unmap grants if the slot has been mapped. This could be being + * called from a failing mmap(). + */ +- if (private_data->grants[slot_index].state != GNTDEV_SLOT_MAPPED) { +- pte_clear_full(vma->vm_mm, addr, ptep, is_fullmm); +- return copy; +- } ++ if (private_data->grants[slot_index].state != GNTDEV_SLOT_MAPPED) ++ return ptep_get_and_clear_full(vma->vm_mm, addr, ptep, is_fullmm); + + /* Clear the user space mapping, if it has been made. */ + if (private_data->grants[slot_index].u.valid.user_handle != + GNTDEV_INVALID_HANDLE) { + /* NOT USING SHADOW PAGE TABLES (and user handle valid). */ ++ ++ /* Copy the existing value of the PTE for returning. */ ++ copy = *ptep; ++ + gnttab_set_unmap_op(&op[0], ptep_to_machine(ptep), + GNTMAP_contains_pte, + private_data->grants[slot_index].u.valid +@@ -712,7 +711,7 @@ static pte_t gntdev_clear_pte(struct vm_ + nr = 1; } else { + /* USING SHADOW PAGE TABLES (or user handle invalid). */ - pte_clear_full(vma->vm_mm, addr, ptep, is_fullmm); + copy = ptep_get_and_clear_full(vma->vm_mm, addr, ptep, is_fullmm); + nr = 0; } - return copy; ---- a/drivers/xen/netback/accel.c -+++ b/drivers/xen/netback/accel.c +--- head.orig/drivers/xen/netback/accel.c 2011-06-30 15:37:44.000000000 +0200 ++++ head/drivers/xen/netback/accel.c 2011-01-31 17:29:16.000000000 +0100 @@ -65,7 +65,7 @@ static int match_accelerator(struct xenb if (IS_ERR(eth_name)) { @@ -11979,8 +10703,8 @@ Acked-by: jbeulich@novell.com __FUNCTION__, PTR_ERR(eth_name)); return 0; } else { ---- a/drivers/xen/netback/common.h -+++ b/drivers/xen/netback/common.h +--- head.orig/drivers/xen/netback/common.h 2012-01-06 10:19:49.000000000 +0100 ++++ head/drivers/xen/netback/common.h 2012-01-06 10:40:16.000000000 +0100 @@ -91,6 +91,7 @@ typedef struct netif_st { /* Statistics */ @@ -11998,8 +10722,8 @@ Acked-by: jbeulich@novell.com static inline int netbk_can_queue(struct net_device *dev) { ---- a/drivers/xen/netback/interface.c -+++ b/drivers/xen/netback/interface.c +--- head.orig/drivers/xen/netback/interface.c 2011-10-17 10:45:09.000000000 +0200 ++++ head/drivers/xen/netback/interface.c 2011-11-03 12:01:26.000000000 +0100 @@ -173,6 +173,7 @@ static const struct netif_stat { u16 offset; } netbk_stats[] = { @@ -12008,8 +10732,8 @@ Acked-by: jbeulich@novell.com }; static int netbk_get_stats_count(struct net_device *dev) ---- a/drivers/xen/netback/loopback.c -+++ b/drivers/xen/netback/loopback.c +--- head.orig/drivers/xen/netback/loopback.c 2011-01-03 12:43:21.000000000 +0100 ++++ head/drivers/xen/netback/loopback.c 2011-01-31 17:29:16.000000000 +0100 @@ -152,16 +152,6 @@ static int loopback_start_xmit(struct sk np->stats.rx_bytes += skb->len; np->stats.rx_packets++; @@ -12027,8 +10751,8 @@ Acked-by: jbeulich@novell.com skb->pkt_type = PACKET_HOST; /* overridden by eth_type_trans() */ skb->protocol = eth_type_trans(skb, dev); skb->dev = dev; ---- a/drivers/xen/netback/netback.c -+++ b/drivers/xen/netback/netback.c +--- head.orig/drivers/xen/netback/netback.c 2011-11-22 09:56:23.000000000 +0100 ++++ head/drivers/xen/netback/netback.c 2011-04-11 14:28:01.000000000 +0200 @@ -41,6 +41,7 @@ #include <xen/evtchn.h> #include <xen/gnttab.h> @@ -12045,7 +10769,7 @@ Acked-by: jbeulich@novell.com dev_kfree_skb(skb); skb = nskb; } -@@ -708,10 +708,14 @@ static void net_rx_action(unsigned long +@@ -708,10 +708,14 @@ static void net_rx_action(unsigned long id = meta[npo.meta_cons].id; flags = nr_frags ? NETRXF_more_data : 0; @@ -12062,7 +10786,7 @@ Acked-by: jbeulich@novell.com if (meta[npo.meta_cons].copy) offset = 0; -@@ -1453,18 +1457,12 @@ static void net_tx_action(unsigned long +@@ -1453,18 +1457,12 @@ static void net_tx_action(unsigned long netif_idx_release(pending_idx); } @@ -12085,7 +10809,7 @@ Acked-by: jbeulich@novell.com netbk_fill_frags(skb); -@@ -1481,6 +1479,12 @@ static void net_tx_action(unsigned long +@@ -1481,6 +1479,12 @@ static void net_tx_action(unsigned long skb->dev = netif->dev; skb->protocol = eth_type_trans(skb, skb->dev); @@ -12116,8 +10840,8 @@ Acked-by: jbeulich@novell.com { struct list_head *ent; netif_t *netif; ---- a/drivers/xen/netfront/netfront.c -+++ b/drivers/xen/netfront/netfront.c +--- head.orig/drivers/xen/netfront/netfront.c 2012-03-12 12:51:05.000000000 +0100 ++++ head/drivers/xen/netfront/netfront.c 2012-03-12 13:31:26.000000000 +0100 @@ -63,6 +63,7 @@ #include <asm/uaccess.h> #include <xen/interface/grant_table.h> @@ -12168,7 +10892,7 @@ Acked-by: jbeulich@novell.com { struct net_device *dev = dev_id; struct netfront_info *np = netdev_priv(dev); -@@ -1426,18 +1425,13 @@ err: +@@ -1426,18 +1425,13 @@ err: skb->truesize += skb->data_len - (RX_COPY_THRESHOLD - len); skb->len += skb->data_len; @@ -12191,7 +10915,7 @@ Acked-by: jbeulich@novell.com np->stats.rx_packets++; np->stats.rx_bytes += skb->len; -@@ -1482,6 +1476,11 @@ err: +@@ -1482,6 +1476,11 @@ err: /* Ethernet work: Delayed to here as it peeks the header. */ skb->protocol = eth_type_trans(skb, dev); @@ -12259,8 +10983,8 @@ Acked-by: jbeulich@novell.com }; #ifdef CONFIG_SYSFS ---- a/drivers/xen/netfront/netfront.h -+++ b/drivers/xen/netfront/netfront.h +--- head.orig/drivers/xen/netfront/netfront.h 2012-02-16 11:09:01.000000000 +0100 ++++ head/drivers/xen/netfront/netfront.h 2011-02-09 15:35:17.000000000 +0100 @@ -150,6 +150,7 @@ struct netfront_info { struct net_device *netdev; @@ -12269,8 +10993,18 @@ Acked-by: jbeulich@novell.com struct netif_tx_front_ring tx; struct netif_rx_front_ring rx; ---- a/drivers/xen/pcifront/pci_op.c -+++ b/drivers/xen/pcifront/pci_op.c +--- head.orig/drivers/xen/pcifront/pcifront.h 2010-10-05 09:58:12.000000000 +0200 ++++ head/drivers/xen/pcifront/pcifront.h 2011-01-31 17:29:16.000000000 +0100 +@@ -51,6 +51,6 @@ void pcifront_free_roots(struct pcifront + + void pcifront_do_aer( void *data); + +-irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs); ++irqreturn_t pcifront_handler_aer(int irq, void *dev); + + #endif /* __XEN_PCIFRONT_H__ */ +--- head.orig/drivers/xen/pcifront/pci_op.c 2012-04-04 08:57:09.000000000 +0200 ++++ head/drivers/xen/pcifront/pci_op.c 2012-04-04 09:49:51.000000000 +0200 @@ -654,7 +654,7 @@ void pcifront_do_aer(void *data) } @@ -12280,18 +11014,8 @@ Acked-by: jbeulich@novell.com { struct pcifront_device *pdev = dev; schedule_pcifront_aer_op(pdev); ---- a/drivers/xen/pcifront/pcifront.h -+++ b/drivers/xen/pcifront/pcifront.h -@@ -51,6 +51,6 @@ void pcifront_free_roots(struct pcifront - - void pcifront_do_aer( void *data); - --irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs); -+irqreturn_t pcifront_handler_aer(int irq, void *dev); - - #endif /* __XEN_PCIFRONT_H__ */ ---- a/drivers/xen/privcmd/compat_privcmd.c -+++ b/drivers/xen/privcmd/compat_privcmd.c +--- head.orig/drivers/xen/privcmd/compat_privcmd.c 2010-01-27 14:01:48.000000000 +0100 ++++ head/drivers/xen/privcmd/compat_privcmd.c 2011-01-31 17:29:16.000000000 +0100 @@ -18,7 +18,6 @@ * Authors: Jimi Xenidis <jimix@watson.ibm.com> */ @@ -12300,8 +11024,8 @@ Acked-by: jbeulich@novell.com #include <linux/compat.h> #include <linux/ioctl.h> #include <linux/syscalls.h> ---- a/drivers/xen/privcmd/privcmd.c -+++ b/drivers/xen/privcmd/privcmd.c +--- head.orig/drivers/xen/privcmd/privcmd.c 2012-01-20 14:18:49.000000000 +0100 ++++ head/drivers/xen/privcmd/privcmd.c 2012-01-20 14:44:49.000000000 +0100 @@ -65,43 +65,16 @@ static long privcmd_ioctl(struct file *f if (copy_from_user(&hypercall, udata, sizeof(hypercall))) return -EFAULT; @@ -12362,8 +11086,8 @@ Acked-by: jbeulich@novell.com vma->vm_ops = &privcmd_vm_ops; vma->vm_private_data = NULL; ---- a/drivers/xen/scsiback/common.h -+++ b/drivers/xen/scsiback/common.h +--- head.orig/drivers/xen/scsiback/common.h 2012-01-20 14:18:49.000000000 +0100 ++++ head/drivers/xen/scsiback/common.h 2012-01-20 14:44:55.000000000 +0100 @@ -136,7 +136,7 @@ typedef struct { #define VSCSI_TYPE_HOST 1 @@ -12373,8 +11097,8 @@ Acked-by: jbeulich@novell.com int scsiback_init_sring(struct vscsibk_info *, grant_ref_t, evtchn_port_t); int scsiback_schedule(void *data); ---- a/drivers/xen/scsiback/scsiback.c -+++ b/drivers/xen/scsiback/scsiback.c +--- head.orig/drivers/xen/scsiback/scsiback.c 2012-01-20 14:18:49.000000000 +0100 ++++ head/drivers/xen/scsiback/scsiback.c 2011-04-11 14:27:51.000000000 +0200 @@ -461,7 +461,7 @@ void scsiback_cmd_exec(pending_req_t *pe write = (data_dir == DMA_TO_DEVICE); rq = blk_get_request(pending_req->sdev->request_queue, write, GFP_KERNEL); @@ -12393,8 +11117,8 @@ Acked-by: jbeulich@novell.com { scsiback_notify_work((struct vscsibk_info *)dev_id); return IRQ_HANDLED; ---- a/drivers/xen/scsifront/common.h -+++ b/drivers/xen/scsifront/common.h +--- head.orig/drivers/xen/scsifront/common.h 2012-03-12 12:51:05.000000000 +0100 ++++ head/drivers/xen/scsifront/common.h 2012-03-12 13:31:30.000000000 +0100 @@ -127,7 +127,7 @@ struct vscsifrnt_info { int scsifront_xenbus_init(void); void scsifront_xenbus_unregister(void); @@ -12404,9 +11128,9 @@ Acked-by: jbeulich@novell.com int scsifront_cmd_done(struct vscsifrnt_info *info); ---- a/drivers/xen/scsifront/scsifront.c -+++ b/drivers/xen/scsifront/scsifront.c -@@ -100,7 +100,7 @@ static void scsifront_do_request(struct +--- head.orig/drivers/xen/scsifront/scsifront.c 2011-02-02 12:19:11.000000000 +0100 ++++ head/drivers/xen/scsifront/scsifront.c 2011-01-31 17:29:16.000000000 +0100 +@@ -100,7 +100,7 @@ static void scsifront_do_request(struct notify_remote_via_irq(irq); } @@ -12415,8 +11139,8 @@ Acked-by: jbeulich@novell.com { scsifront_notify_work((struct vscsifrnt_info *)dev_id); return IRQ_HANDLED; ---- a/drivers/xen/sfc_netback/accel_xenbus.c -+++ b/drivers/xen/sfc_netback/accel_xenbus.c +--- head.orig/drivers/xen/sfc_netback/accel_xenbus.c 2010-01-04 11:56:34.000000000 +0100 ++++ head/drivers/xen/sfc_netback/accel_xenbus.c 2011-01-31 17:29:16.000000000 +0100 @@ -69,8 +69,7 @@ static void unlink_bend(struct netback_a @@ -12437,8 +11161,8 @@ Acked-by: jbeulich@novell.com { VPRINTK("netirq %d from device %s\n", irq, ((struct xenbus_device *)context)->nodename); ---- a/drivers/xen/sfc_netfront/accel.h -+++ b/drivers/xen/sfc_netfront/accel.h +--- head.orig/drivers/xen/sfc_netfront/accel.h 2009-04-07 13:58:48.000000000 +0200 ++++ head/drivers/xen/sfc_netfront/accel.h 2011-01-31 17:29:16.000000000 +0100 @@ -467,10 +467,8 @@ void netfront_accel_msg_tx_fastpath(netf u32 ip, u16 port, u8 protocol); @@ -12452,8 +11176,8 @@ Acked-by: jbeulich@novell.com #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) extern void netfront_accel_msg_from_bend(struct work_struct *context); ---- a/drivers/xen/sfc_netfront/accel_msg.c -+++ b/drivers/xen/sfc_netfront/accel_msg.c +--- head.orig/drivers/xen/sfc_netfront/accel_msg.c 2009-04-07 13:58:48.000000000 +0200 ++++ head/drivers/xen/sfc_netfront/accel_msg.c 2011-01-31 17:29:16.000000000 +0100 @@ -488,8 +488,7 @@ void netfront_accel_msg_from_bend(void * } @@ -12474,8 +11198,8 @@ Acked-by: jbeulich@novell.com { netfront_accel_vnic *vnic = (netfront_accel_vnic *)context; struct net_device *net_dev = vnic->net_dev; ---- a/drivers/xen/sfc_netfront/accel_tso.c -+++ b/drivers/xen/sfc_netfront/accel_tso.c +--- head.orig/drivers/xen/sfc_netfront/accel_tso.c 2008-02-26 10:54:12.000000000 +0100 ++++ head/drivers/xen/sfc_netfront/accel_tso.c 2011-01-31 17:29:16.000000000 +0100 @@ -363,7 +363,7 @@ int netfront_accel_enqueue_skb_tso(netfr tso_check_safe(skb); @@ -12485,8 +11209,8 @@ Acked-by: jbeulich@novell.com EPRINTK("Trying to TSO send a packet without HW checksum\n"); tso_start(&state, skb); ---- a/drivers/xen/sfc_netfront/accel_vi.c -+++ b/drivers/xen/sfc_netfront/accel_vi.c +--- head.orig/drivers/xen/sfc_netfront/accel_vi.c 2011-06-30 15:37:44.000000000 +0200 ++++ head/drivers/xen/sfc_netfront/accel_vi.c 2011-06-30 16:03:00.000000000 +0200 @@ -463,7 +463,7 @@ netfront_accel_enqueue_skb_multi(netfron frag_i = -1; @@ -12505,8 +11229,8 @@ Acked-by: jbeulich@novell.com /* Set to zero to encourage falcon to work it out for us */ *(u16*)(skb->h.raw + skb->csum) = 0; } ---- a/drivers/xen/tpmback/common.h -+++ b/drivers/xen/tpmback/common.h +--- head.orig/drivers/xen/tpmback/common.h 2011-12-21 10:02:58.000000000 +0100 ++++ head/drivers/xen/tpmback/common.h 2011-12-21 10:33:05.000000000 +0100 @@ -70,7 +70,7 @@ void tpmif_deschedule_work(tpmif_t * tpm int tpmif_xenbus_init(void); void tpmif_xenbus_exit(void); @@ -12516,9 +11240,9 @@ Acked-by: jbeulich@novell.com long int tpmback_get_instance(struct backend_info *bi); ---- a/drivers/xen/tpmback/tpmback.c -+++ b/drivers/xen/tpmback/tpmback.c -@@ -497,7 +497,7 @@ static ssize_t vtpm_op_read(struct file +--- head.orig/drivers/xen/tpmback/tpmback.c 2010-09-23 15:39:04.000000000 +0200 ++++ head/drivers/xen/tpmback/tpmback.c 2011-01-31 17:29:16.000000000 +0100 +@@ -497,7 +497,7 @@ static ssize_t vtpm_op_read(struct file list_del(&pak->next); write_unlock_irqrestore(&dataex.pak_lock, flags); @@ -12527,7 +11251,7 @@ Acked-by: jbeulich@novell.com ret_size = min_t(size_t, size, left); -@@ -894,7 +894,7 @@ static void tpm_tx_action(unsigned long +@@ -894,7 +894,7 @@ static void tpm_tx_action(unsigned long } } @@ -12536,8 +11260,8 @@ Acked-by: jbeulich@novell.com { tpmif_t *tpmif = (tpmif_t *) dev_id; ---- a/drivers/xen/usbback/usbback.c -+++ b/drivers/xen/usbback/usbback.c +--- head.orig/drivers/xen/usbback/usbback.c 2011-09-22 14:33:35.000000000 +0200 ++++ head/drivers/xen/usbback/usbback.c 2011-04-11 14:27:33.000000000 +0200 @@ -290,7 +290,7 @@ static void usbbk_notify_work(usbif_t *u wake_up(&usbif->wq); } @@ -12556,8 +11280,8 @@ Acked-by: jbeulich@novell.com { pending_req_t *pending_req = (pending_req_t *)urb->context; ---- a/drivers/xen/usbback/usbback.h -+++ b/drivers/xen/usbback/usbback.h +--- head.orig/drivers/xen/usbback/usbback.h 2012-01-20 14:18:49.000000000 +0100 ++++ head/drivers/xen/usbback/usbback.h 2012-01-20 14:45:00.000000000 +0100 @@ -150,7 +150,7 @@ int portid_add(const char *busid, int portid_remove(const domid_t domid, const unsigned int handle, @@ -12567,8 +11291,8 @@ Acked-by: jbeulich@novell.com int usbbk_schedule(void *arg); struct usbstub *find_attached_device(usbif_t *usbif, int port); void usbbk_attach_device(usbif_t *usbif, struct usbstub *stub); ---- a/drivers/xen/usbback/usbstub.c -+++ b/drivers/xen/usbback/usbstub.c +--- head.orig/drivers/xen/usbback/usbstub.c 2012-02-16 11:09:01.000000000 +0100 ++++ head/drivers/xen/usbback/usbstub.c 2011-03-11 10:54:35.000000000 +0100 @@ -283,7 +283,7 @@ static ssize_t usbstub_show_portids(stru static DRIVER_ATTR(port_ids, S_IRUSR, usbstub_show_portids, NULL); @@ -12596,8 +11320,19 @@ Acked-by: jbeulich@novell.com &driver_attr_port_ids); usb_deregister(&usbback_usb_driver); } ---- a/drivers/xen/usbfront/usbfront-dbg.c -+++ b/drivers/xen/usbfront/usbfront-dbg.c +--- head.orig/drivers/xen/usbfront/usbfront.h 2009-10-15 11:45:41.000000000 +0200 ++++ head/drivers/xen/usbfront/usbfront.h 2011-01-31 17:29:16.000000000 +0100 +@@ -195,7 +195,7 @@ timer_action(struct usbfront_info *info, + extern struct kmem_cache *xenhcd_urbp_cachep; + extern struct hc_driver xen_usb20_hc_driver; + extern struct hc_driver xen_usb11_hc_driver; +-irqreturn_t xenhcd_int(int irq, void *dev_id, struct pt_regs *ptregs); ++irqreturn_t xenhcd_int(int irq, void *dev_id); + void xenhcd_rhport_state_change(struct usbfront_info *info, + int port, enum usb_device_speed speed); + int xenhcd_schedule(void *arg); +--- head.orig/drivers/xen/usbfront/usbfront-dbg.c 2009-10-15 11:45:41.000000000 +0200 ++++ head/drivers/xen/usbfront/usbfront-dbg.c 2011-01-31 17:29:16.000000000 +0100 @@ -90,7 +90,9 @@ static CLASS_DEVICE_ATTR(statistics, S_I static inline void create_debug_file(struct usbfront_info *info) { @@ -12609,8 +11344,8 @@ Acked-by: jbeulich@novell.com } static inline void remove_debug_file(struct usbfront_info *info) ---- a/drivers/xen/usbfront/usbfront-q.c -+++ b/drivers/xen/usbfront/usbfront-q.c +--- head.orig/drivers/xen/usbfront/usbfront-q.c 2009-10-15 11:45:41.000000000 +0200 ++++ head/drivers/xen/usbfront/usbfront-q.c 2011-01-31 17:29:16.000000000 +0100 @@ -236,7 +236,7 @@ __acquires(info->lock) COUNT(info->stats.complete); } @@ -12629,19 +11364,8 @@ Acked-by: jbeulich@novell.com { xenhcd_notify_work((struct usbfront_info *) dev_id); return IRQ_HANDLED; ---- a/drivers/xen/usbfront/usbfront.h -+++ b/drivers/xen/usbfront/usbfront.h -@@ -195,7 +195,7 @@ timer_action(struct usbfront_info *info, - extern struct kmem_cache *xenhcd_urbp_cachep; - extern struct hc_driver xen_usb20_hc_driver; - extern struct hc_driver xen_usb11_hc_driver; --irqreturn_t xenhcd_int(int irq, void *dev_id, struct pt_regs *ptregs); -+irqreturn_t xenhcd_int(int irq, void *dev_id); - void xenhcd_rhport_state_change(struct usbfront_info *info, - int port, enum usb_device_speed speed); - int xenhcd_schedule(void *arg); ---- a/drivers/xen/xenbus/xenbus_comms.c -+++ b/drivers/xen/xenbus/xenbus_comms.c +--- head.orig/drivers/xen/xenbus/xenbus_comms.c 2011-04-11 13:43:15.000000000 +0200 ++++ head/drivers/xen/xenbus/xenbus_comms.c 2011-01-31 17:29:16.000000000 +0100 @@ -54,7 +54,7 @@ static DECLARE_WORK(probe_work, xenbus_p static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); @@ -12651,8 +11375,8 @@ Acked-by: jbeulich@novell.com { int old, new; ---- a/drivers/xen/xenoprof/xenoprofile.c -+++ b/drivers/xen/xenoprof/xenoprofile.c +--- head.orig/drivers/xen/xenoprof/xenoprofile.c 2012-02-16 11:09:01.000000000 +0100 ++++ head/drivers/xen/xenoprof/xenoprofile.c 2012-02-16 12:29:10.000000000 +0100 @@ -198,8 +198,7 @@ done: oprofile_add_domain_switch(COORDINATOR_DOMAIN); } @@ -12663,8 +11387,8 @@ Acked-by: jbeulich@novell.com { struct xenoprof_buf * buf; static unsigned long flag; ---- a/include/asm-generic/pgtable.h -+++ b/include/asm-generic/pgtable.h +--- head.orig/include/asm-generic/pgtable.h 2012-04-10 15:40:47.000000000 +0200 ++++ head/include/asm-generic/pgtable.h 2012-04-10 16:13:47.000000000 +0200 @@ -158,7 +158,7 @@ static inline void pmdp_set_wrprotect(st #endif @@ -12674,8 +11398,1169 @@ Acked-by: jbeulich@novell.com #endif #ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH ---- a/include/xen/evtchn.h -+++ b/include/xen/evtchn.h +--- head.orig/arch/x86/include/mach-xen/asm/desc_32.h 2008-01-28 12:24:19.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/desc_32.h 2011-01-31 17:29:16.000000000 +0100 +@@ -32,52 +32,110 @@ static inline struct desc_struct *get_cp + return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; + } + ++/* ++ * This is the ldt that every process will get unless we need ++ * something other than this. ++ */ ++extern struct desc_struct default_ldt[]; ++extern struct desc_struct idt_table[]; ++extern void set_intr_gate(unsigned int irq, void * addr); ++ ++static inline void pack_descriptor(__u32 *a, __u32 *b, ++ unsigned long base, unsigned long limit, unsigned char type, unsigned char flags) ++{ ++ *a = ((base & 0xffff) << 16) | (limit & 0xffff); ++ *b = (base & 0xff000000) | ((base & 0xff0000) >> 16) | ++ (limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20); ++} ++ ++static inline void pack_gate(__u32 *a, __u32 *b, ++ unsigned long base, unsigned short seg, unsigned char type, unsigned char flags) ++{ ++ *a = (seg << 16) | (base & 0xffff); ++ *b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff); ++} ++ ++#define DESCTYPE_LDT 0x82 /* present, system, DPL-0, LDT */ ++#define DESCTYPE_TSS 0x89 /* present, system, DPL-0, 32-bit TSS */ ++#define DESCTYPE_TASK 0x85 /* present, system, DPL-0, task gate */ ++#define DESCTYPE_INT 0x8e /* present, system, DPL-0, interrupt gate */ ++#define DESCTYPE_TRAP 0x8f /* present, system, DPL-0, trap gate */ ++#define DESCTYPE_DPL3 0x60 /* DPL-3 */ ++#define DESCTYPE_S 0x10 /* !system */ ++ + #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) + #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) + + #define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) + #define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) +-#define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr)) +-#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt)) ++#define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr)) ++#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt)) + + #define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) + #define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) +-#define store_tr(tr) __asm__ ("str %0":"=mr" (tr)) +-#define store_ldt(ldt) __asm__ ("sldt %0":"=mr" (ldt)) ++#define store_tr(tr) __asm__ ("str %0":"=m" (tr)) ++#define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt)) + +-/* +- * This is the ldt that every process will get unless we need +- * something other than this. +- */ +-extern struct desc_struct default_ldt[]; +-extern void set_intr_gate(unsigned int irq, void * addr); ++#if TLS_SIZE != 24 ++# error update this code. ++#endif ++ ++static inline void load_TLS(struct thread_struct *t, unsigned int cpu) ++{ ++#define C(i) if (HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i]), \ ++ *(u64 *)&t->tls_array[i]) \ ++ BUG() ++ C(0); C(1); C(2); ++#undef C ++} + +-#define _set_tssldt_desc(n,addr,limit,type) \ +-__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \ +- "movw %w1,2(%2)\n\t" \ +- "rorl $16,%1\n\t" \ +- "movb %b1,4(%2)\n\t" \ +- "movb %4,5(%2)\n\t" \ +- "movb $0,6(%2)\n\t" \ +- "movb %h1,7(%2)\n\t" \ +- "rorl $16,%1" \ +- : "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type)) ++#ifndef CONFIG_XEN ++static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) ++{ ++ __u32 *lp = (__u32 *)((char *)dt + entry*8); ++ *lp = entry_a; ++ *(lp+1) = entry_b; ++} + +-#ifndef CONFIG_X86_NO_TSS +-static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) ++#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) ++#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) ++#else ++extern int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b); ++extern int write_gdt_entry(void *gdt, int entry, __u32 entry_a, __u32 entry_b); ++#endif ++#ifndef CONFIG_X86_NO_IDT ++#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) ++ ++static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) + { +- _set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr, +- offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89); ++ __u32 a, b; ++ pack_gate(&a, &b, (unsigned long)addr, seg, type, 0); ++ write_idt_entry(idt_table, gate, a, b); + } ++#endif + +-#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) ++#ifndef CONFIG_X86_NO_TSS ++static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) ++{ ++ __u32 a, b; ++ pack_descriptor(&a, &b, (unsigned long)addr, ++ offsetof(struct tss_struct, __cacheline_filler) - 1, ++ DESCTYPE_TSS, 0); ++ write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b); ++} + #endif + +-static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) ++static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int entries) + { +- _set_tssldt_desc(&get_cpu_gdt_table(cpu)[GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82); ++ __u32 a, b; ++ pack_descriptor(&a, &b, (unsigned long)addr, ++ entries * sizeof(struct desc_struct) - 1, ++ DESCTYPE_LDT, 0); ++ write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b); + } + ++#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) ++ + #define LDT_entry_a(info) \ + ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) + +@@ -103,21 +161,6 @@ static inline void set_ldt_desc(unsigned + (info)->seg_not_present == 1 && \ + (info)->useable == 0 ) + +-extern int write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b); +- +-#if TLS_SIZE != 24 +-# error update this code. +-#endif +- +-static inline void load_TLS(struct thread_struct *t, unsigned int cpu) +-{ +-#define C(i) if (HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i]), \ +- *(u64 *)&t->tls_array[i])) \ +- BUG(); +- C(0); C(1); C(2); +-#undef C +-} +- + static inline void clear_LDT(void) + { + int cpu = get_cpu(); +--- head.orig/arch/x86/include/mach-xen/asm/fixmap_32.h 2007-06-12 13:14:02.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/fixmap_32.h 2011-01-31 17:29:16.000000000 +0100 +@@ -55,7 +55,7 @@ enum fixed_addresses { + #ifdef CONFIG_X86_LOCAL_APIC + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ + #endif +-#ifdef CONFIG_X86_IO_APIC ++#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_XEN) + FIX_IO_APIC_BASE_0, + FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, + #endif +@@ -95,10 +95,9 @@ enum fixed_addresses { + __end_of_fixed_addresses + }; + +-extern void set_fixaddr_top(unsigned long top); +- + extern void __set_fixmap(enum fixed_addresses idx, + maddr_t phys, pgprot_t flags); ++extern void reserve_top_address(unsigned long reserve); + + #define set_fixmap(idx, phys) \ + __set_fixmap(idx, phys, PAGE_KERNEL) +--- head.orig/arch/x86/include/mach-xen/asm/hypercall_32.h 2009-06-23 09:28:21.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypercall_32.h 2011-01-31 17:29:16.000000000 +0100 +@@ -128,6 +128,23 @@ + __res; \ + }) + ++#define _hypercall(type, op, a1, a2, a3, a4, a5) \ ++({ \ ++ type __res; \ ++ register typeof((a1)+0) __arg1 asm("ebx") = (a1); \ ++ register typeof((a2)+0) __arg2 asm("ecx") = (a2); \ ++ register typeof((a3)+0) __arg3 asm("edx") = (a3); \ ++ register typeof((a4)+0) __arg4 asm("esi") = (a4); \ ++ register typeof((a5)+0) __arg5 asm("edi") = (a5); \ ++ asm volatile ( \ ++ "call *%6" \ ++ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ ++ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ ++ : "0" (hypercall_page + (op) * 32) \ ++ : "memory" ); \ ++ __res; \ ++}) ++ + static inline int __must_check + HYPERVISOR_set_trap_table( + const trap_info_t *table) +@@ -140,6 +157,8 @@ HYPERVISOR_mmu_update( + mmu_update_t *req, unsigned int count, unsigned int *success_count, + domid_t domid) + { ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_mmu_update(req, count, success_count, domid); + return _hypercall4(int, mmu_update, req, count, success_count, domid); + } + +@@ -148,6 +167,8 @@ HYPERVISOR_mmuext_op( + struct mmuext_op *op, unsigned int count, unsigned int *success_count, + domid_t domid) + { ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_mmuext_op(op, count, success_count, domid); + return _hypercall4(int, mmuext_op, op, count, success_count, domid); + } + +@@ -238,6 +259,8 @@ static inline int __must_check + HYPERVISOR_memory_op( + unsigned int cmd, void *arg) + { ++ if (arch_use_lazy_mmu_mode()) ++ xen_multicall_flush(false); + return _hypercall2(int, memory_op, cmd, arg); + } + +@@ -253,6 +276,9 @@ HYPERVISOR_update_va_mapping( + unsigned long va, pte_t new_val, unsigned long flags) + { + unsigned long pte_hi = 0; ++ ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_update_va_mapping(va, new_val, flags); + #ifdef CONFIG_X86_PAE + pte_hi = new_val.pte_high; + #endif +@@ -316,6 +342,8 @@ static inline int __must_check + HYPERVISOR_grant_table_op( + unsigned int cmd, void *uop, unsigned int count) + { ++ if (arch_use_lazy_mmu_mode()) ++ xen_multicall_flush(false); + return _hypercall3(int, grant_table_op, cmd, uop, count); + } + +--- head.orig/arch/x86/include/mach-xen/asm/hypercall_64.h 2009-06-23 09:28:21.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypercall_64.h 2011-01-31 17:29:16.000000000 +0100 +@@ -135,6 +135,23 @@ + __res; \ + }) + ++#define _hypercall(type, op, a1, a2, a3, a4, a5) \ ++({ \ ++ type __res; \ ++ register typeof((a1)+0) __arg1 asm("rdi") = (a1); \ ++ register typeof((a2)+0) __arg2 asm("rsi") = (a2); \ ++ register typeof((a3)+0) __arg3 asm("rdx") = (a3); \ ++ register typeof((a4)+0) __arg4 asm("r10") = (a4); \ ++ register typeof((a5)+0) __arg5 asm("r8") = (a5); \ ++ asm volatile ( \ ++ "call *%6" \ ++ : "=a" (__res), "+r" (__arg1), "+r" (__arg2), \ ++ "+r" (__arg3), "+r" (__arg4), "+r" (__arg5) \ ++ : "0" (hypercall_page + (op) * 32) \ ++ : "memory" ); \ ++ __res; \ ++}) ++ + static inline int __must_check + HYPERVISOR_set_trap_table( + const trap_info_t *table) +@@ -147,6 +164,8 @@ HYPERVISOR_mmu_update( + mmu_update_t *req, unsigned int count, unsigned int *success_count, + domid_t domid) + { ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_mmu_update(req, count, success_count, domid); + return _hypercall4(int, mmu_update, req, count, success_count, domid); + } + +@@ -155,6 +174,8 @@ HYPERVISOR_mmuext_op( + struct mmuext_op *op, unsigned int count, unsigned int *success_count, + domid_t domid) + { ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_mmuext_op(op, count, success_count, domid); + return _hypercall4(int, mmuext_op, op, count, success_count, domid); + } + +@@ -248,6 +269,8 @@ static inline int __must_check + HYPERVISOR_memory_op( + unsigned int cmd, void *arg) + { ++ if (arch_use_lazy_mmu_mode()) ++ xen_multicall_flush(false); + return _hypercall2(int, memory_op, cmd, arg); + } + +@@ -262,6 +285,8 @@ static inline int __must_check + HYPERVISOR_update_va_mapping( + unsigned long va, pte_t new_val, unsigned long flags) + { ++ if (arch_use_lazy_mmu_mode()) ++ return xen_multi_update_va_mapping(va, new_val, flags); + return _hypercall3(int, update_va_mapping, va, new_val.pte, flags); + } + +@@ -321,6 +346,8 @@ static inline int __must_check + HYPERVISOR_grant_table_op( + unsigned int cmd, void *uop, unsigned int count) + { ++ if (arch_use_lazy_mmu_mode()) ++ xen_multicall_flush(false); + return _hypercall3(int, grant_table_op, cmd, uop, count); + } + +--- head.orig/arch/x86/include/mach-xen/asm/hypervisor.h 2009-07-13 14:25:35.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/hypervisor.h 2011-01-31 17:29:16.000000000 +0100 +@@ -44,6 +44,7 @@ + #include <xen/interface/sched.h> + #include <xen/interface/nmi.h> + #include <xen/interface/tmem.h> ++#include <asm/percpu.h> + #include <asm/ptrace.h> + #include <asm/page.h> + #if defined(__i386__) +@@ -139,7 +140,44 @@ void scrub_pages(void *, unsigned int); + #define scrub_pages(_p,_n) ((void)0) + #endif + +-#include <xen/hypercall.h> ++#if defined(CONFIG_XEN) && !defined(MODULE) ++ ++DECLARE_PER_CPU(bool, xen_lazy_mmu); ++ ++int xen_multicall_flush(bool); ++ ++int __must_check xen_multi_update_va_mapping(unsigned long va, pte_t, ++ unsigned long flags); ++int __must_check xen_multi_mmu_update(mmu_update_t *, unsigned int count, ++ unsigned int *success_count, domid_t); ++int __must_check xen_multi_mmuext_op(struct mmuext_op *, unsigned int count, ++ unsigned int *success_count, domid_t); ++ ++#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE ++static inline void arch_enter_lazy_mmu_mode(void) ++{ ++ __get_cpu_var(xen_lazy_mmu) = true; ++} ++ ++static inline void arch_leave_lazy_mmu_mode(void) ++{ ++ __get_cpu_var(xen_lazy_mmu) = false; ++ xen_multicall_flush(false); ++} ++ ++#ifndef arch_use_lazy_mmu_mode ++#define arch_use_lazy_mmu_mode() unlikely(__get_cpu_var(xen_lazy_mmu)) ++#endif ++ ++#else /* !CONFIG_XEN || MODULE */ ++ ++static inline void xen_multicall_flush(bool ignore) {} ++#define arch_use_lazy_mmu_mode() false ++#define xen_multi_update_va_mapping(...) ({ BUG(); -ENOSYS; }) ++#define xen_multi_mmu_update(...) ({ BUG(); -ENOSYS; }) ++#define xen_multi_mmuext_op(...) ({ BUG(); -ENOSYS; }) ++ ++#endif /* CONFIG_XEN && !MODULE */ + + #if defined(CONFIG_X86_64) + #define MULTI_UVMFLAGS_INDEX 2 +@@ -151,11 +189,15 @@ void scrub_pages(void *, unsigned int); + + #ifdef CONFIG_XEN + #define is_running_on_xen() 1 ++extern char hypercall_page[PAGE_SIZE]; + #else + extern char *hypercall_stubs; ++#define hypercall_page hypercall_stubs + #define is_running_on_xen() (!!hypercall_stubs) + #endif + ++#include <xen/hypercall.h> ++ + static inline int + HYPERVISOR_yield( + void) +--- head.orig/arch/x86/include/mach-xen/asm/pgtable-3level.h 2008-04-02 12:34:02.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/pgtable-3level.h 2011-01-31 17:29:16.000000000 +0100 +@@ -53,7 +53,6 @@ static inline int pte_exec_kernel(pte_t + * not possible, use pte_get_and_clear to obtain the old pte + * value and then use set_pte to update it. -ben + */ +-#define __HAVE_ARCH_SET_PTE_ATOMIC + + static inline void set_pte(pte_t *ptep, pte_t pte) + { +@@ -70,14 +69,6 @@ static inline void set_pte(pte_t *ptep, + set_pte((ptep), (pteval)); \ + } while (0) + +-#define set_pte_at_sync(_mm,addr,ptep,pteval) do { \ +- if (((_mm) != current->mm && (_mm) != &init_mm) || \ +- HYPERVISOR_update_va_mapping((addr), (pteval), UVMF_INVLPG)) { \ +- set_pte((ptep), (pteval)); \ +- xen_invlpg((addr)); \ +- } \ +-} while (0) +- + #define set_pmd(pmdptr,pmdval) \ + xen_l2_entry_update((pmdptr), (pmdval)) + #define set_pud(pudptr,pudval) \ +@@ -94,7 +85,7 @@ static inline void pud_clear (pud_t * pu + #define pud_page(pud) \ + ((struct page *) __va(pud_val(pud) & PAGE_MASK)) + +-#define pud_page_kernel(pud) \ ++#define pud_page_vaddr(pud) \ + ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) + + +@@ -124,6 +115,7 @@ static inline void pte_clear(struct mm_s + + #define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) + ++#define __HAVE_ARCH_PTEP_GET_AND_CLEAR + static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) + { + pte_t pte = *ptep; +@@ -142,6 +134,7 @@ static inline pte_t ptep_get_and_clear(s + return pte; + } + ++#define __HAVE_ARCH_PTEP_CLEAR_FLUSH + #define ptep_clear_flush(vma, addr, ptep) \ + ({ \ + pte_t *__ptep = (ptep); \ +@@ -159,6 +152,7 @@ static inline pte_t ptep_get_and_clear(s + __res; \ + }) + ++#define __HAVE_ARCH_PTE_SAME + static inline int pte_same(pte_t a, pte_t b) + { + return a.pte_low == b.pte_low && a.pte_high == b.pte_high; +--- head.orig/arch/x86/include/mach-xen/asm/pgtable_32.h 2011-04-11 13:43:15.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/pgtable_32.h 2011-02-07 15:37:16.000000000 +0100 +@@ -260,31 +260,89 @@ static inline pte_t pte_mkhuge(pte_t pte + # include <asm/pgtable-2level.h> + #endif + +-#define ptep_test_and_clear_dirty(vma, addr, ptep) \ ++/* ++ * Rules for using pte_update - it must be called after any PTE update which ++ * has not been done using the set_pte / clear_pte interfaces. It is used by ++ * shadow mode hypervisors to resynchronize the shadow page tables. Kernel PTE ++ * updates should either be sets, clears, or set_pte_atomic for P->P ++ * transitions, which means this hook should only be called for user PTEs. ++ * This hook implies a P->P protection or access change has taken place, which ++ * requires a subsequent TLB flush. The notification can optionally be delayed ++ * until the TLB flush event by using the pte_update_defer form of the ++ * interface, but care must be taken to assure that the flush happens while ++ * still holding the same page table lock so that the shadow and primary pages ++ * do not become out of sync on SMP. ++ */ ++#define pte_update(mm, addr, ptep) do { } while (0) ++#define pte_update_defer(mm, addr, ptep) do { } while (0) ++ ++ ++/* ++ * We only update the dirty/accessed state if we set ++ * the dirty bit by hand in the kernel, since the hardware ++ * will do the accessed bit for us, and we don't want to ++ * race with other CPU's that might be updating the dirty ++ * bit at the same time. ++ */ ++#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS ++#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ ++do { \ ++ if (dirty) \ ++ ptep_establish(vma, address, ptep, entry); \ ++} while (0) ++ ++/* ++ * We don't actually have these, but we want to advertise them so that ++ * we can encompass the flush here. ++ */ ++#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY ++#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG ++ ++/* ++ * Rules for using ptep_establish: the pte MUST be a user pte, and ++ * must be a present->present transition. ++ */ ++#define __HAVE_ARCH_PTEP_ESTABLISH ++#define ptep_establish(vma, address, ptep, pteval) \ ++do { \ ++ if ( likely((vma)->vm_mm == current->mm) ) { \ ++ BUG_ON(HYPERVISOR_update_va_mapping(address, \ ++ pteval, \ ++ (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ ++ UVMF_INVLPG|UVMF_MULTI)); \ ++ } else { \ ++ xen_l1_entry_update(ptep, pteval); \ ++ flush_tlb_page(vma, address); \ ++ } \ ++} while (0) ++ ++#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH ++#define ptep_clear_flush_dirty(vma, address, ptep) \ + ({ \ + pte_t __pte = *(ptep); \ +- int __ret = pte_dirty(__pte); \ +- if (__ret) { \ +- __pte = pte_mkclean(__pte); \ +- if ((vma)->vm_mm != current->mm || \ +- HYPERVISOR_update_va_mapping(addr, __pte, 0)) \ +- (ptep)->pte_low = __pte.pte_low; \ +- } \ +- __ret; \ ++ int __dirty = pte_dirty(__pte); \ ++ __pte = pte_mkclean(__pte); \ ++ if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ ++ ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ ++ else if (__dirty) \ ++ (ptep)->pte_low = __pte.pte_low; \ ++ __dirty; \ + }) + +-#define ptep_test_and_clear_young(vma, addr, ptep) \ ++#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH ++#define ptep_clear_flush_young(vma, address, ptep) \ + ({ \ + pte_t __pte = *(ptep); \ +- int __ret = pte_young(__pte); \ +- if (__ret) \ +- __pte = pte_mkold(__pte); \ +- if ((vma)->vm_mm != current->mm || \ +- HYPERVISOR_update_va_mapping(addr, __pte, 0)) \ +- (ptep)->pte_low = __pte.pte_low; \ +- __ret; \ ++ int __young = pte_young(__pte); \ ++ __pte = pte_mkold(__pte); \ ++ if (test_bit(PG_pinned, &virt_to_page((vma)->vm_mm->pgd)->flags)) \ ++ ptep_set_access_flags(vma, address, ptep, __pte, __young); \ ++ else if (__young) \ ++ (ptep)->pte_low = __pte.pte_low; \ ++ __young; \ + }) + ++#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL + #define ptep_get_and_clear_full(mm, addr, ptep, full) \ + ((full) ? ({ \ + pte_t __res = *(ptep); \ +@@ -296,6 +354,7 @@ static inline pte_t pte_mkhuge(pte_t pte + }) : \ + ptep_get_and_clear(mm, addr, ptep)) + ++#define __HAVE_ARCH_PTEP_SET_WRPROTECT + static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) + { + pte_t pte = *ptep; +@@ -391,11 +450,11 @@ static inline pte_t pte_modify(pte_t pte + #define pte_index(address) \ + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) + #define pte_offset_kernel(dir, address) \ +- ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) ++ ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) + + #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) + +-#define pmd_page_kernel(pmd) \ ++#define pmd_page_vaddr(pmd) \ + ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) + + /* +@@ -418,8 +477,6 @@ extern pte_t *lookup_address(unsigned lo + static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} + #endif + +-extern void noexec_setup(const char *str); +- + #if defined(CONFIG_HIGHPTE) + #define pte_offset_map(dir, address) \ + ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)),KM_PTE0) + \ +@@ -437,37 +494,17 @@ extern void noexec_setup(const char *str + #define pte_unmap_nested(pte) do { } while (0) + #endif + +-#define __HAVE_ARCH_PTEP_ESTABLISH +-#define ptep_establish(vma, address, ptep, pteval) \ +- do { \ +- if ( likely((vma)->vm_mm == current->mm) ) { \ +- BUG_ON(HYPERVISOR_update_va_mapping(address, \ +- pteval, \ +- (unsigned long)(vma)->vm_mm->cpu_vm_mask.bits| \ +- UVMF_INVLPG|UVMF_MULTI)); \ +- } else { \ +- xen_l1_entry_update(ptep, pteval); \ +- flush_tlb_page(vma, address); \ +- } \ +- } while (0) ++/* Clear a kernel PTE and flush it from the TLB */ ++#define kpte_clear_flush(ptep, vaddr) do { \ ++ if (HYPERVISOR_update_va_mapping(vaddr, __pte(0), UVMF_INVLPG)) \ ++ BUG(); \ ++} while (0) + + /* + * The i386 doesn't have any external MMU info: the kernel page + * tables contain all the necessary information. +- * +- * Also, we only update the dirty/accessed state if we set +- * the dirty bit by hand in the kernel, since the hardware +- * will do the accessed bit for us, and we don't want to +- * race with other CPU's that might be updating the dirty +- * bit at the same time. + */ + #define update_mmu_cache(vma,address,pte) do { } while (0) +-#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS +-#define ptep_set_access_flags(vma, address, ptep, entry, dirty) \ +- do { \ +- if (dirty) \ +- ptep_establish(vma, address, ptep, entry); \ +- } while (0) + + #include <xen/features.h> + void make_lowmem_page_readonly(void *va, unsigned int feature); +@@ -523,10 +560,11 @@ int create_lookup_pte_addr(struct mm_str + uint64_t *ptep); + + int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd, +- unsigned long addr, unsigned long end, pgprot_t newprot); ++ unsigned long addr, unsigned long end, pgprot_t newprot, ++ int dirty_accountable); + +-#define arch_change_pte_range(mm, pmd, addr, end, newprot) \ +- xen_change_pte_range(mm, pmd, addr, end, newprot) ++#define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \ ++ xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) + + #define io_remap_pfn_range(vma,from,pfn,size,prot) \ + direct_remap_pfn_range(vma,from,pfn,size,prot,DOMID_IO) +@@ -535,13 +573,6 @@ direct_remap_pfn_range(vma,from,pfn,size + #define GET_IOSPACE(pfn) 0 + #define GET_PFN(pfn) (pfn) + +-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY +-#define __HAVE_ARCH_PTEP_GET_AND_CLEAR +-#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL +-#define __HAVE_ARCH_PTEP_CLEAR_FLUSH +-#define __HAVE_ARCH_PTEP_SET_WRPROTECT +-#define __HAVE_ARCH_PTE_SAME + #include <asm-generic/pgtable.h> + + #endif /* _I386_PGTABLE_H */ +--- head.orig/arch/x86/include/mach-xen/asm/processor_32.h 2011-01-31 17:02:29.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/processor_32.h 2011-01-31 17:29:16.000000000 +0100 +@@ -146,6 +146,18 @@ static inline void detect_ht(struct cpui + #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ + #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ + ++static inline void __cpuid(unsigned int *eax, unsigned int *ebx, ++ unsigned int *ecx, unsigned int *edx) ++{ ++ /* ecx is often an input as well as an output. */ ++ __asm__(XEN_CPUID ++ : "=a" (*eax), ++ "=b" (*ebx), ++ "=c" (*ecx), ++ "=d" (*edx) ++ : "0" (*eax), "2" (*ecx)); ++} ++ + /* + * Generic CPUID function + * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx +@@ -153,24 +165,18 @@ static inline void detect_ht(struct cpui + */ + static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) + { +- __asm__(XEN_CPUID +- : "=a" (*eax), +- "=b" (*ebx), +- "=c" (*ecx), +- "=d" (*edx) +- : "0" (op), "c"(0)); ++ *eax = op; ++ *ecx = 0; ++ __cpuid(eax, ebx, ecx, edx); + } + + /* Some CPUID calls want 'count' to be placed in ecx */ + static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, +- int *edx) ++ int *edx) + { +- __asm__(XEN_CPUID +- : "=a" (*eax), +- "=b" (*ebx), +- "=c" (*ecx), +- "=d" (*edx) +- : "0" (op), "c" (count)); ++ *eax = op; ++ *ecx = count; ++ __cpuid(eax, ebx, ecx, edx); + } + + /* +@@ -178,42 +184,30 @@ static inline void cpuid_count(int op, i + */ + static inline unsigned int cpuid_eax(unsigned int op) + { +- unsigned int eax; ++ unsigned int eax, ebx, ecx, edx; + +- __asm__(XEN_CPUID +- : "=a" (eax) +- : "0" (op) +- : "bx", "cx", "dx"); ++ cpuid(op, &eax, &ebx, &ecx, &edx); + return eax; + } + static inline unsigned int cpuid_ebx(unsigned int op) + { +- unsigned int eax, ebx; ++ unsigned int eax, ebx, ecx, edx; + +- __asm__(XEN_CPUID +- : "=a" (eax), "=b" (ebx) +- : "0" (op) +- : "cx", "dx" ); ++ cpuid(op, &eax, &ebx, &ecx, &edx); + return ebx; + } + static inline unsigned int cpuid_ecx(unsigned int op) + { +- unsigned int eax, ecx; ++ unsigned int eax, ebx, ecx, edx; + +- __asm__(XEN_CPUID +- : "=a" (eax), "=c" (ecx) +- : "0" (op) +- : "bx", "dx" ); ++ cpuid(op, &eax, &ebx, &ecx, &edx); + return ecx; + } + static inline unsigned int cpuid_edx(unsigned int op) + { +- unsigned int eax, edx; ++ unsigned int eax, ebx, ecx, edx; + +- __asm__(XEN_CPUID +- : "=a" (eax), "=d" (edx) +- : "0" (op) +- : "bx", "cx"); ++ cpuid(op, &eax, &ebx, &ecx, &edx); + return edx; + } + +@@ -315,6 +309,8 @@ static inline void __mwait(unsigned long + : :"a" (eax), "c" (ecx)); + } + ++extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); ++ + /* from system description table in BIOS. Mostly for MCA use, but + others may find it useful. */ + extern unsigned int machine_id; +--- head.orig/arch/x86/include/mach-xen/asm/smp_32.h 2007-06-12 13:14:02.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/smp_32.h 2011-01-31 17:29:16.000000000 +0100 +@@ -79,25 +79,36 @@ static inline int hard_smp_processor_id( + return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); + } + #endif +- +-static __inline int logical_smp_processor_id(void) +-{ +- /* we don't want to mark this access volatile - bad code generation */ +- return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); +-} +- + #endif + ++#define safe_smp_processor_id() smp_processor_id() + extern int __cpu_disable(void); + extern void __cpu_die(unsigned int cpu); + extern void prefill_possible_map(void); ++extern unsigned int num_processors; ++ + #endif /* !__ASSEMBLY__ */ + + #else /* CONFIG_SMP */ + ++#define safe_smp_processor_id() 0 + #define cpu_physical_id(cpu) boot_cpu_physical_apicid + + #define NO_PROC_ID 0xFF /* No processor magic marker */ + + #endif ++ ++#ifndef __ASSEMBLY__ ++ ++extern u8 apicid_2_node[]; ++ ++#ifdef CONFIG_X86_LOCAL_APIC ++static __inline int logical_smp_processor_id(void) ++{ ++ /* we don't want to mark this access volatile - bad code generation */ ++ return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); ++} ++#endif ++#endif ++ + #endif +--- head.orig/arch/x86/include/mach-xen/asm/tlbflush_32.h 2007-11-26 16:59:25.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/tlbflush_32.h 2011-01-31 17:29:16.000000000 +0100 +@@ -8,8 +8,6 @@ + #define __flush_tlb_global() xen_tlb_flush() + #define __flush_tlb_all() xen_tlb_flush() + +-extern unsigned long pgkern_mask; +- + #define cpu_has_invlpg (boot_cpu_data.x86 > 3) + + #define __flush_tlb_single(addr) xen_invlpg(addr) +--- head.orig/arch/x86/include/mach-xen/asm/fixmap_64.h 2007-06-12 13:14:13.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/fixmap_64.h 2011-01-31 17:29:16.000000000 +0100 +@@ -41,7 +41,7 @@ enum fixed_addresses { + #ifdef CONFIG_X86_LOCAL_APIC + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ + #endif +-#ifdef CONFIG_X86_IO_APIC ++#ifndef CONFIG_XEN + FIX_IO_APIC_BASE_0, + FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, + #endif +--- head.orig/arch/x86/include/mach-xen/asm/pgtable_64.h 2011-04-11 13:43:15.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/pgtable_64.h 2011-02-07 15:37:14.000000000 +0100 +@@ -44,12 +44,9 @@ extern unsigned long __supported_pte_mas + + #define swapper_pg_dir init_level4_pgt + +-extern int nonx_setup(char *str); + extern void paging_init(void); + extern void clear_kernel_mapping(unsigned long addr, unsigned long size); + +-extern unsigned long pgkern_mask; +- + /* + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. +@@ -119,9 +116,6 @@ static inline void pgd_clear (pgd_t * pg + set_pgd(__user_pgd(pgd), __pgd(0)); + } + +-#define pud_page(pud) \ +- ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) +- + #define pte_same(a, b) ((a).pte == (b).pte) + + #define pte_pgprot(a) (__pgprot((a).pte & ~PHYSICAL_PAGE_MASK)) +@@ -333,7 +327,7 @@ static inline pte_t ptep_get_and_clear_f + #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) + static inline int pte_user(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } + static inline int pte_read(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } +-static inline int pte_exec(pte_t pte) { return __pte_val(pte) & _PAGE_USER; } ++static inline int pte_exec(pte_t pte) { return !(__pte_val(pte) & _PAGE_NX); } + static inline int pte_dirty(pte_t pte) { return __pte_val(pte) & _PAGE_DIRTY; } + static inline int pte_young(pte_t pte) { return __pte_val(pte) & _PAGE_ACCESSED; } + static inline int pte_write(pte_t pte) { return __pte_val(pte) & _PAGE_RW; } +@@ -346,29 +340,12 @@ static inline pte_t pte_mkclean(pte_t pt + static inline pte_t pte_mkold(pte_t pte) { __pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } + static inline pte_t pte_wrprotect(pte_t pte) { __pte_val(pte) &= ~_PAGE_RW; return pte; } + static inline pte_t pte_mkread(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; } +-static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) |= _PAGE_USER; return pte; } ++static inline pte_t pte_mkexec(pte_t pte) { __pte_val(pte) &= ~_PAGE_NX; return pte; } + static inline pte_t pte_mkdirty(pte_t pte) { __pte_val(pte) |= _PAGE_DIRTY; return pte; } + static inline pte_t pte_mkyoung(pte_t pte) { __pte_val(pte) |= _PAGE_ACCESSED; return pte; } + static inline pte_t pte_mkwrite(pte_t pte) { __pte_val(pte) |= _PAGE_RW; return pte; } + static inline pte_t pte_mkhuge(pte_t pte) { __pte_val(pte) |= _PAGE_PSE; return pte; } +- +-#define ptep_test_and_clear_dirty(vma, addr, ptep) \ +-({ \ +- pte_t __pte = *(ptep); \ +- int __ret = pte_dirty(__pte); \ +- if (__ret) \ +- set_pte_at((vma)->vm_mm, addr, ptep, pte_mkclean(__pte)); \ +- __ret; \ +-}) +- +-#define ptep_test_and_clear_young(vma, addr, ptep) \ +-({ \ +- pte_t __pte = *(ptep); \ +- int __ret = pte_young(__pte); \ +- if (__ret) \ +- set_pte_at((vma)->vm_mm, addr, ptep, pte_mkold(__pte)); \ +- __ret; \ +-}) ++static inline pte_t pte_clrhuge(pte_t pte) { __pte_val(pte) &= ~_PAGE_PSE; return pte; } + + static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) + { +@@ -395,7 +372,8 @@ static inline int pmd_large(pmd_t pte) { + /* + * Level 4 access. + */ +-#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK)) ++#define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_val(pgd) & PTE_MASK)) ++#define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT)) + #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) + #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) + #define pgd_offset_k(address) (init_level4_pgt + pgd_index(address)) +@@ -404,16 +382,18 @@ static inline int pmd_large(pmd_t pte) { + + /* PUD - Level3 access */ + /* to find an entry in a page-table-directory. */ ++#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK)) ++#define pud_page(pud) (pfn_to_page(pud_val(pud) >> PAGE_SHIFT)) + #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) +-#define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address)) ++#define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) + #define pud_present(pud) (__pud_val(pud) & _PAGE_PRESENT) + + /* PMD - Level 2 access */ +-#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) ++#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) + #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) + + #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) +-#define pmd_offset(dir, address) ((pmd_t *) pud_page(*(dir)) + \ ++#define pmd_offset(dir, address) ((pmd_t *) pud_page_vaddr(*(dir)) + \ + pmd_index(address)) + #define pmd_none(x) (!__pmd_val(x)) + #if CONFIG_XEN_COMPAT <= 0x030002 +@@ -444,6 +424,7 @@ static inline pte_t mk_pte_phys(unsigned + { + unsigned long pteval; + pteval = physpage | pgprot_val(pgprot); ++ pteval &= __supported_pte_mask; + return __pte(pteval); + } + +@@ -465,7 +446,7 @@ static inline pte_t pte_modify(pte_t pte + + #define pte_index(address) \ + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +-#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ ++#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \ + pte_index(address)) + + /* x86-64 always has all page tables mapped. */ +@@ -506,6 +487,40 @@ static inline pte_t pte_modify(pte_t pte + ptep_establish(vma, address, ptep, entry); \ + } while (0) + ++ ++/* ++ * i386 says: We don't actually have these, but we want to advertise ++ * them so that we can encompass the flush here. ++ */ ++#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY ++#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG ++ ++#define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH ++#define ptep_clear_flush_dirty(vma, address, ptep) \ ++({ \ ++ pte_t __pte = *(ptep); \ ++ int __dirty = pte_dirty(__pte); \ ++ __pte = pte_mkclean(__pte); \ ++ if ((vma)->vm_mm->context.pinned) \ ++ ptep_set_access_flags(vma, address, ptep, __pte, __dirty); \ ++ else if (__dirty) \ ++ set_pte(ptep, __pte); \ ++ __dirty; \ ++}) ++ ++#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH ++#define ptep_clear_flush_young(vma, address, ptep) \ ++({ \ ++ pte_t __pte = *(ptep); \ ++ int __young = pte_young(__pte); \ ++ __pte = pte_mkold(__pte); \ ++ if ((vma)->vm_mm->context.pinned) \ ++ ptep_set_access_flags(vma, address, ptep, __pte, __young); \ ++ else if (__young) \ ++ set_pte(ptep, __pte); \ ++ __young; \ ++}) ++ + /* Encode and de-code a swap entry */ + #define __swp_type(x) (((x).val >> 1) & 0x3f) + #define __swp_offset(x) ((x).val >> 8) +@@ -543,10 +558,11 @@ int create_lookup_pte_addr(struct mm_str + uint64_t *ptep); + + int xen_change_pte_range(struct mm_struct *mm, pmd_t *pmd, +- unsigned long addr, unsigned long end, pgprot_t newprot); ++ unsigned long addr, unsigned long end, pgprot_t newprot, ++ int dirty_accountable); + +-#define arch_change_pte_range(mm, pmd, addr, end, newprot) \ +- xen_change_pte_range(mm, pmd, addr, end, newprot) ++#define arch_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) \ ++ xen_change_pte_range(mm, pmd, addr, end, newprot, dirty_accountable) + + #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ + direct_remap_pfn_range(vma,vaddr,pfn,size,prot,DOMID_IO) +@@ -568,8 +584,6 @@ int xen_change_pte_range(struct mm_struc + #define kc_offset_to_vaddr(o) \ + (((o) & (1UL << (__VIRTUAL_MASK_SHIFT-1))) ? ((o) | (~__VIRTUAL_MASK)) : (o)) + +-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY + #define __HAVE_ARCH_PTEP_GET_AND_CLEAR + #define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL + #define __HAVE_ARCH_PTEP_CLEAR_FLUSH +--- head.orig/arch/x86/include/mach-xen/asm/processor_64.h 2008-03-06 08:54:32.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/processor_64.h 2011-01-31 17:29:16.000000000 +0100 +@@ -484,6 +484,8 @@ static inline void __mwait(unsigned long + : :"a" (eax), "c" (ecx)); + } + ++extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); ++ + #define stack_current() \ + ({ \ + struct thread_info *ti; \ +--- head.orig/arch/x86/include/mach-xen/asm/smp_64.h 2007-06-12 13:14:13.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/smp_64.h 2011-01-31 17:29:16.000000000 +0100 +@@ -4,15 +4,12 @@ + /* + * We need the APIC definitions automatically as part of 'smp.h' + */ +-#ifndef __ASSEMBLY__ + #include <linux/threads.h> + #include <linux/cpumask.h> + #include <linux/bitops.h> + extern int disable_apic; +-#endif + + #ifdef CONFIG_X86_LOCAL_APIC +-#ifndef __ASSEMBLY__ + #include <asm/fixmap.h> + #include <asm/mpspec.h> + #ifdef CONFIG_X86_IO_APIC +@@ -21,10 +18,8 @@ extern int disable_apic; + #include <asm/apic.h> + #include <asm/thread_info.h> + #endif +-#endif + + #ifdef CONFIG_SMP +-#ifndef ASSEMBLY + + #include <asm/pda.h> + +@@ -41,14 +36,11 @@ extern cpumask_t cpu_initialized; + + extern void smp_alloc_memory(void); + extern volatile unsigned long smp_invalidate_needed; +-extern int pic_mode; + extern void lock_ipi_call_lock(void); + extern void unlock_ipi_call_lock(void); + extern int smp_num_siblings; + extern void smp_send_reschedule(int cpu); + void smp_stop_cpu(void); +-extern int smp_call_function_single(int cpuid, void (*func) (void *info), +- void *info, int retry, int wait); + + extern cpumask_t cpu_sibling_map[NR_CPUS]; + extern cpumask_t cpu_core_map[NR_CPUS]; +@@ -77,20 +69,16 @@ static inline int hard_smp_processor_id( + } + #endif + +-extern int safe_smp_processor_id(void); + extern int __cpu_disable(void); + extern void __cpu_die(unsigned int cpu); + extern void prefill_possible_map(void); + extern unsigned num_processors; + extern unsigned disabled_cpus; + +-#endif /* !ASSEMBLY */ +- + #define NO_PROC_ID 0xFF /* No processor magic marker */ + + #endif + +-#ifndef ASSEMBLY + /* + * Some lowlevel functions might want to know about + * the real APIC ID <-> CPU # mapping. +@@ -114,11 +102,8 @@ static inline int cpu_present_to_apicid( + } + #endif + +-#endif /* !ASSEMBLY */ +- + #ifndef CONFIG_SMP + #define stack_smp_processor_id() 0 +-#define safe_smp_processor_id() 0 + #define cpu_logical_map(x) (x) + #else + #include <asm/thread_info.h> +@@ -130,7 +115,6 @@ static inline int cpu_present_to_apicid( + }) + #endif + +-#ifndef __ASSEMBLY__ + #ifdef CONFIG_X86_LOCAL_APIC + static __inline int logical_smp_processor_id(void) + { +@@ -138,13 +122,18 @@ static __inline int logical_smp_processo + return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); + } + #endif +-#endif + + #ifdef CONFIG_SMP + #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] + #else + #define cpu_physical_id(cpu) boot_cpu_id +-#endif +- ++static inline int smp_call_function_single(int cpuid, void (*func) (void *info), ++ void *info, int retry, int wait) ++{ ++ /* Disable interrupts here? */ ++ func(info); ++ return 0; ++} ++#endif /* !CONFIG_SMP */ + #endif + +--- head.orig/arch/x86/include/mach-xen/asm/tlbflush_64.h 2007-11-26 16:59:25.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/tlbflush_64.h 2011-01-31 17:29:16.000000000 +0100 +@@ -12,9 +12,6 @@ + */ + #define __flush_tlb_global() xen_tlb_flush() + +- +-extern unsigned long pgkern_mask; +- + #define __flush_tlb_all() __flush_tlb_global() + + #define __flush_tlb_one(addr) xen_invlpg((unsigned long)addr) +--- head.orig/include/xen/evtchn.h 2011-01-31 15:14:12.000000000 +0100 ++++ head/include/xen/evtchn.h 2011-01-31 17:29:16.000000000 +0100 @@ -57,34 +57,34 @@ */ int bind_caller_port_to_irqhandler( @@ -12716,8 +12601,8 @@ Acked-by: jbeulich@novell.com unsigned long irqflags, const char *devname, void *dev_id); ---- /dev/null -+++ b/include/xen/net-util.h +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ head/include/xen/net-util.h 2011-02-09 15:49:42.000000000 +0100 @@ -0,0 +1,74 @@ +#ifndef __XEN_NETUTIL_H__ +#define __XEN_NETUTIL_H__ @@ -12793,8 +12678,8 @@ Acked-by: jbeulich@novell.com +} + +#endif /* __XEN_NETUTIL_H__ */ ---- a/mm/mprotect.c -+++ b/mm/mprotect.c +--- head.orig/mm/mprotect.c 2011-06-30 15:38:52.000000000 +0200 ++++ head/mm/mprotect.c 2011-01-31 17:29:16.000000000 +0100 @@ -97,7 +97,7 @@ static inline void change_pmd_range(stru } if (pmd_none_or_clear_bad(pmd)) @@ -12804,8 +12689,8 @@ Acked-by: jbeulich@novell.com continue; change_pte_range(vma->vm_mm, pmd, addr, next, newprot, dirty_accountable); ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c +--- head.orig/mm/page_alloc.c 2012-02-08 10:53:13.000000000 +0100 ++++ head/mm/page_alloc.c 2012-04-10 16:13:35.000000000 +0200 @@ -5047,6 +5047,23 @@ void setup_per_zone_wmarks(void) spin_unlock_irqrestore(&zone->lock, flags); } diff --git a/patches.xen/xen3-patch-2.6.24 b/patches.xen/xen3-patch-2.6.24 index a33e322f88..306b7f5625 100644 --- a/patches.xen/xen3-patch-2.6.24 +++ b/patches.xen/xen3-patch-2.6.24 @@ -118,9 +118,9 @@ Acked-by: jbeulich@novell.com select HOTPLUG default y help ---- head.orig/arch/x86/Makefile 2012-04-10 15:44:36.000000000 +0200 -+++ head/arch/x86/Makefile 2012-04-10 16:39:03.000000000 +0200 -@@ -181,8 +181,8 @@ BOOT_TARGETS = bzlilo bzdisk fdimage fdi +--- head.orig/arch/x86/Makefile 2012-05-23 12:53:17.000000000 +0200 ++++ head/arch/x86/Makefile 2012-05-23 13:29:54.000000000 +0200 +@@ -184,8 +184,8 @@ BOOT_TARGETS = bzlilo bzdisk fdimage fdi PHONY += bzImage vmlinuz $(BOOT_TARGETS) ifdef CONFIG_XEN @@ -131,7 +131,7 @@ Acked-by: jbeulich@novell.com ifdef CONFIG_X86_64 LDFLAGS_vmlinux := -e startup_64 -@@ -196,6 +196,8 @@ KBUILD_IMAGE := $(boot)/vmlinuz +@@ -199,6 +199,8 @@ KBUILD_IMAGE := $(boot)/vmlinuz vmlinuz: vmlinux $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) @@ -218,7 +218,7 @@ Acked-by: jbeulich@novell.com kfree(buf); return -EINVAL; } ---- head.orig/arch/x86/kernel/cpu/Makefile 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/Makefile 2012-02-16 12:31:44.000000000 +0100 @@ -40,6 +40,8 @@ obj-$(CONFIG_MTRR) += mtrr/ @@ -250,7 +250,7 @@ Acked-by: jbeulich@novell.com c->x86_clflush_size = 32; memset(&c->x86_capability, 0, sizeof c->x86_capability); ---- head.orig/arch/x86/kernel/cpu/intel.c 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/arch/x86/kernel/cpu/intel.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/intel.c 2012-02-08 11:36:23.000000000 +0100 @@ -302,6 +302,7 @@ static void __cpuinit srat_detect_node(s #endif @@ -4269,7 +4269,7 @@ Acked-by: jbeulich@novell.com /* Copied from arch/i386/pci/common.c */ pci_cache_line_size = 32 >> 2; ---- head.orig/drivers/acpi/processor_core.c 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/drivers/acpi/processor_core.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/acpi/processor_core.c 2012-02-08 11:38:53.000000000 +0100 @@ -199,11 +199,21 @@ int acpi_get_cpuid(acpi_handle handle, i } @@ -4335,7 +4335,7 @@ Acked-by: jbeulich@novell.com static inline int ---- head.orig/drivers/cpuidle/Kconfig 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/drivers/cpuidle/Kconfig 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/cpuidle/Kconfig 2012-02-29 10:35:17.000000000 +0100 @@ -1,6 +1,7 @@ @@ -4345,7 +4345,7 @@ Acked-by: jbeulich@novell.com default y if ACPI || PPC_PSERIES help CPU idle is a generic framework for supporting software-controlled ---- head.orig/drivers/dma/Kconfig 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/drivers/dma/Kconfig 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/dma/Kconfig 2011-01-31 17:56:27.000000000 +0100 @@ -61,7 +61,7 @@ config INTEL_IOATDMA tristate "Intel I/OAT DMA support" @@ -4356,14 +4356,14 @@ Acked-by: jbeulich@novell.com select ASYNC_TX_DISABLE_PQ_VAL_DMA select ASYNC_TX_DISABLE_XOR_VAL_DMA help ---- head.orig/drivers/dma/ioat/Makefile 2011-01-05 01:50:19.000000000 +0100 +--- head.orig/drivers/dma/ioat/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/dma/ioat/Makefile 2011-01-31 17:56:27.000000000 +0100 @@ -1,2 +1,3 @@ obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o -ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o dca.o +dca-$(CONFIG_DCA) := dca.o +ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o $(dca-y) $(dca-m) ---- head.orig/drivers/dma/ioat/dca.c 2009-12-03 04:51:21.000000000 +0100 +--- head.orig/drivers/dma/ioat/dca.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/dma/ioat/dca.c 2011-01-31 17:56:27.000000000 +0100 @@ -682,3 +682,15 @@ ioat3_dca_init(struct pci_dev *pdev, voi @@ -4381,7 +4381,7 @@ Acked-by: jbeulich@novell.com + free_dca_provider(device->dca); + device->dca = NULL; +} ---- head.orig/drivers/dma/ioat/dma.h 2012-04-20 14:55:32.000000000 +0200 +--- head.orig/drivers/dma/ioat/dma.h 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/dma/ioat/dma.h 2012-04-10 16:38:51.000000000 +0200 @@ -324,4 +324,22 @@ void ioat_kobject_del(struct ioatdma_dev extern const struct sysfs_ops ioat_sysfs_ops; @@ -4406,7 +4406,7 @@ Acked-by: jbeulich@novell.com +#endif + #endif /* IOATDMA_H */ ---- head.orig/drivers/dma/ioat/pci.c 2011-10-24 09:10:05.000000000 +0200 +--- head.orig/drivers/dma/ioat/pci.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/dma/ioat/pci.c 2011-09-07 15:36:19.000000000 +0200 @@ -29,7 +29,6 @@ #include <linux/module.h> @@ -4905,7 +4905,7 @@ Acked-by: jbeulich@novell.com #endif --- head.orig/drivers/xen/blktap/blktap.c 2011-01-31 17:32:16.000000000 +0100 +++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:44:12.000000000 +0100 -@@ -786,8 +786,8 @@ static int blktap_ioctl(struct inode *in +@@ -794,8 +794,8 @@ static int blktap_ioctl(struct inode *in case BLKTAP_IOCTL_PRINT_IDXS: { if (info) { @@ -5485,9 +5485,9 @@ Acked-by: jbeulich@novell.com break; case XENKBD_TYPE_POS: if (event->pos.rel_z) ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 14:44:43.000000000 +0100 -+++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 14:50:24.000000000 +0100 -@@ -374,14 +374,14 @@ static int __init gntdev_init(void) +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:04:13.000000000 +0200 ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:29:28.000000000 +0200 +@@ -365,14 +365,14 @@ static int __init gntdev_init(void) int err; if (!is_running_on_xen()) { @@ -5504,8 +5504,8 @@ Acked-by: jbeulich@novell.com return err; } -@@ -461,7 +461,7 @@ static int gntdev_mmap (struct file *fli - gntdev_file_private_data_t *private_data = flip->private_data; +@@ -453,7 +453,7 @@ static int gntdev_mmap (struct file *fli + struct vm_foreign_map *foreign_map; if (unlikely(!private_data)) { - printk(KERN_ERR "File's private data is NULL.\n"); @@ -5513,22 +5513,21 @@ Acked-by: jbeulich@novell.com return -EINVAL; } -@@ -469,21 +469,21 @@ static int gntdev_mmap (struct file *fli - down_read(&private_data->grants_sem); - if (unlikely(!private_data->grants)) { - up_read(&private_data->grants_sem); +@@ -463,28 +463,27 @@ static int gntdev_mmap (struct file *fli + up_read(&private_data->grants_sem); + + if (unlikely(!grants)) { - printk(KERN_ERR "Attempted to mmap before ioctl.\n"); + pr_err("attempted to mmap before ioctl\n"); return -EINVAL; } - up_read(&private_data->grants_sem); + grants += slot_index; - if (unlikely((size <= 0) || - (size + slot_index) > private_data->grants_size)) { + if (unlikely(size + slot_index <= slot_index || + size + slot_index > private_data->grants_size)) { - printk(KERN_ERR "Invalid number of pages or offset" -- "(num_pages = %d, first_slot = %ld).\n", + pr_err("Invalid number of pages or offset" -+ "(num_pages = %d, first_slot = %ld)\n", + "(num_pages = %lu, first_slot = %lu)\n", size, slot_index); return -ENXIO; } @@ -5539,28 +5538,27 @@ Acked-by: jbeulich@novell.com return -EINVAL; } -@@ -492,8 +492,8 @@ static int gntdev_mmap (struct file *fli - for (i = 0; i < size; ++i) { - if (private_data->grants[slot_index + i].state != - GNTDEV_SLOT_NOT_YET_MAPPED) { -- printk(KERN_ERR "Slot (index = %ld) is in the wrong " -- "state (%d).\n", slot_index + i, -+ pr_err("Slot (index = %ld) is in the wrong " -+ "state (%d)\n", slot_index + i, - private_data->grants[slot_index + i].state); - up_write(&private_data->grants_sem); - return -EINVAL; -@@ -508,8 +508,7 @@ static int gntdev_mmap (struct file *fli - vma->vm_private_data = kzalloc(size * sizeof(struct page *), - GFP_KERNEL); - if (vma->vm_private_data == NULL) { + foreign_map = kmalloc(sizeof(*foreign_map), GFP_KERNEL); + if (!foreign_map) { - printk(KERN_ERR "Couldn't allocate mapping structure for VM " - "area.\n"); + pr_err("couldn't allocate mapping structure for VM area\n"); return -ENOMEM; } - -@@ -554,7 +553,7 @@ static int gntdev_mmap (struct file *fli + foreign_map->map = &private_data->foreign_pages[slot_index]; +@@ -493,9 +492,8 @@ static int gntdev_mmap (struct file *fli + down_write(&private_data->grants_sem); + for (i = 0; i < size; ++i) { + if (grants[i].state != GNTDEV_SLOT_NOT_YET_MAPPED) { +- printk(KERN_ERR "Slot (index = %lu) is in the wrong " +- "state (%d).\n", slot_index + i, +- grants[i].state); ++ pr_err("Slot (index = %lu) is in the wrong state (%d)\n", ++ slot_index + i, grants[i].state); + up_write(&private_data->grants_sem); + kfree(foreign_map); + return -EINVAL; +@@ -547,7 +545,7 @@ static int gntdev_mmap (struct file *fli BUG_ON(ret); if (op.status != GNTST_okay) { if (op.status != GNTST_eagain) @@ -5568,49 +5566,39 @@ Acked-by: jbeulich@novell.com + pr_err("Error mapping the grant reference " "into the kernel (%d). domid = %d; ref = %d\n", op.status, - private_data->grants[slot_index+i] -@@ -601,8 +600,8 @@ static int gntdev_mmap (struct file *fli - + (i << PAGE_SHIFT), - &ptep))) - { -- printk(KERN_ERR "Error obtaining PTE pointer " -- "(%d).\n", ret); -+ pr_err("Error obtaining PTE pointer (%d)\n", -+ ret); - goto undo_map_out; - } - -@@ -633,7 +632,7 @@ static int gntdev_mmap (struct file *fli - &op, 1); - BUG_ON(ret); - if (op.status != GNTST_okay) { -- printk(KERN_ERR "Error mapping the grant " -+ pr_err("Error mapping the grant " - "reference into user space (%d). domid " - "= %d; ref = %d\n", op.status, - private_data->grants[slot_index+i].u -@@ -740,8 +739,8 @@ static pte_t gntdev_clear_pte(struct vm_ - GNTTABOP_unmap_grant_ref, &op, 1); - BUG_ON(ret); - if (op.status != GNTST_okay) -- printk("User unmap grant status = %d\n", -- op.status); -+ pr_warning("User unmap grant status = %d\n", -+ op.status); - } else { - /* USING SHADOW PAGE TABLES. */ - copy = ptep_get_and_clear_full(vma->vm_mm, addr, ptep, is_fullmm); -@@ -757,7 +756,8 @@ static pte_t gntdev_clear_pte(struct vm_ + grants[i].u.valid.domid, +@@ -592,8 +590,7 @@ static int gntdev_mmap (struct file *fli + user_vaddr, + &ptep))) + { +- printk(KERN_ERR "Error obtaining PTE pointer (%d)\n", +- ret); ++ pr_err("Error obtaining PTE pointer (%d)\n", ret); + goto undo_map_out; + } + +@@ -616,7 +613,7 @@ static int gntdev_mmap (struct file *fli &op, 1); BUG_ON(ret); - if (op.status != GNTST_okay) -- printk("Kernel unmap grant status = %d\n", op.status); -+ pr_warning("Kernel unmap grant status = %d\n", -+ op.status); - - - /* Return slot to the not-yet-mapped state, so that it may be -@@ -815,8 +815,7 @@ static long gntdev_ioctl(struct file *fl + if (op.status != GNTST_okay) { +- printk(KERN_ERR "Error mapping the grant reference " ++ pr_err("Error mapping the grant reference " + "into user space (%d). domid = %d; ref = %d\n", + op.status, + grants[i].u.valid.domid, +@@ -726,9 +723,9 @@ static pte_t gntdev_clear_pte(struct vm_ + BUG_ON(ret); + + if (nr && op[0].status != GNTST_okay) +- printk("User unmap grant status = %d\n", op[0].status); ++ pr_warning("User unmap grant status = %d\n", op[0].status); + if (op[nr].status != GNTST_okay) +- printk("Kernel unmap grant status = %d\n", op[nr].status); ++ pr_warning("Kernel unmap grant status = %d\n", op[nr].status); + + /* Return slot to the not-yet-mapped state, so that it may be + * mapped again, or removed by a subsequent ioctl. +@@ -781,8 +778,7 @@ static long gntdev_ioctl(struct file *fl up_write(&private_data->grants_sem); if (rc) { @@ -5620,7 +5608,7 @@ Acked-by: jbeulich@novell.com return rc; } } -@@ -858,22 +857,22 @@ private_data_initialised: +@@ -824,22 +820,22 @@ private_data_initialised: if (op.count == 1) { if ((rc = add_grant_reference(private_data, op.refs, &op.index)) < 0) { @@ -5649,25 +5637,17 @@ Acked-by: jbeulich@novell.com goto map_out; } compress_free_list(private_data); -@@ -912,15 +911,13 @@ private_data_initialised: - != GNTDEV_SLOT_NOT_YET_MAPPED)) { - if (private_data->grants[start_index + i].state - == GNTDEV_SLOT_INVALID) { -- printk(KERN_ERR -- "Tried to remove an invalid " -+ pr_err("Tried to remove an invalid " - "grant at offset 0x%x.", - (start_index + i) - << PAGE_SHIFT); - rc = -EINVAL; - } else { -- printk(KERN_ERR -- "Tried to remove a grant which " -+ pr_err("Tried to remove a grant which " - "is currently mmap()-ed at " - "offset 0x%x.", - (start_index + i) -@@ -968,7 +965,7 @@ private_data_initialised: +@@ -892,8 +888,7 @@ private_data_initialised: + rc = -ENXIO; + break; + } +- printk(KERN_ERR "%s[%d] tried to remove a grant" +- " which is %s at %#x+%#x\n", ++ pr_err("%s[%d] tried to remove a grant which is %s at %#x+%#x\n", + current->comm, current->pid, + what, start_index, i); + goto unmap_out; +@@ -936,7 +931,7 @@ private_data_initialised: goto get_offset_out; } if (vma->vm_start != vaddr) { @@ -9916,7 +9896,7 @@ Acked-by: jbeulich@novell.com +#else +# include "xor_64.h" +#endif ---- head.orig/arch/x86/include/asm/mmu.h 2011-07-22 04:17:23.000000000 +0200 +--- head.orig/arch/x86/include/asm/mmu.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/mmu.h 2011-06-30 16:30:20.000000000 +0200 @@ -16,6 +16,9 @@ typedef struct { /* True if mm supports a task running in 32 bit compatibility mode. */ @@ -9957,7 +9937,7 @@ Acked-by: jbeulich@novell.com /* add a backtrace entry, to be called from the ->backtrace callback */ void oprofile_add_trace(unsigned long eip); ---- head.orig/include/linux/sysctl.h 2012-04-10 14:24:30.000000000 +0200 +--- head.orig/include/linux/sysctl.h 2012-05-23 12:40:44.000000000 +0200 +++ head/include/linux/sysctl.h 2011-01-31 17:56:27.000000000 +0100 @@ -59,6 +59,7 @@ enum CTL_BUS=8, /* Busses */ @@ -10147,7 +10127,7 @@ Acked-by: jbeulich@novell.com #endif VMCOREINFO_SYMBOL(_stext); VMCOREINFO_SYMBOL(vmlist); ---- head.orig/kernel/sysctl_binary.c 2012-04-10 14:24:50.000000000 +0200 +--- head.orig/kernel/sysctl_binary.c 2012-05-23 12:40:44.000000000 +0200 +++ head/kernel/sysctl_binary.c 2011-01-31 17:56:27.000000000 +0100 @@ -873,6 +873,14 @@ static const struct bin_table bin_bus_ta }; diff --git a/patches.xen/xen3-patch-2.6.25 b/patches.xen/xen3-patch-2.6.25 index efa7f1b03c..6aee323e6b 100644 --- a/patches.xen/xen3-patch-2.6.25 +++ b/patches.xen/xen3-patch-2.6.25 @@ -147,7 +147,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches reboot.o smpboot_$(BITS).o tsc_$(BITS).o tsc_sync.o -disabled-obj-$(CONFIG_XEN_UNPRIVILEGED_GUEST) += mpparse_64.o -%/head_64.o %/head_64.s: asflags-$(CONFIG_XEN) := ---- head.orig/arch/x86/kernel/acpi/boot.c 2012-04-10 16:13:27.000000000 +0200 +--- head.orig/arch/x86/kernel/acpi/boot.c 2012-05-23 13:04:45.000000000 +0200 +++ head/arch/x86/kernel/acpi/boot.c 2011-03-11 10:56:21.000000000 +0100 @@ -162,6 +162,11 @@ char *__init __acpi_map_table(unsigned l if (!phys || !size) @@ -5634,7 +5634,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches + unsigned long range_end = mm->brk + 0x02000000; + return randomize_range(mm->brk, range_end, 0) ? : mm->brk; +} ---- head.orig/arch/x86/kernel/rtc.c 2012-01-05 00:55:44.000000000 +0100 +--- head.orig/arch/x86/kernel/rtc.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/rtc.c 2011-12-21 10:59:00.000000000 +0100 @@ -30,6 +30,7 @@ EXPORT_SYMBOL(cmos_lock); DEFINE_SPINLOCK(rtc_lock); @@ -17615,7 +17615,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches vdso32.so-$(CONFIG_XEN) += $(xen-vdso32-y) vdso32-images = $(vdso32.so-y:%=vdso32-%.so) ---- head.orig/arch/x86/vdso/vdso32/syscall.S 2008-04-17 04:49:44.000000000 +0200 +--- head.orig/arch/x86/vdso/vdso32/syscall.S 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/vdso/vdso32/syscall.S 2011-01-31 18:01:51.000000000 +0100 @@ -19,8 +19,10 @@ __kernel_vsyscall: .Lpush_ebp: @@ -17628,7 +17628,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches movl %ebp, %ecx popl %ebp .Lpop_ebp: ---- head.orig/arch/x86/vdso/vdso32.S 2008-10-10 00:13:53.000000000 +0200 +--- head.orig/arch/x86/vdso/vdso32.S 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/vdso/vdso32.S 2011-01-31 18:01:51.000000000 +0100 @@ -19,4 +19,16 @@ vdso32_sysenter_start: .incbin "arch/x86/vdso/vdso32-sysenter.so" @@ -18452,7 +18452,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches -{ - return 0; -} ---- head.orig/drivers/pci/pci.c 2012-04-20 15:00:53.000000000 +0200 +--- head.orig/drivers/pci/pci.c 2012-05-08 10:47:31.000000000 +0200 +++ head/drivers/pci/pci.c 2012-04-10 16:43:39.000000000 +0200 @@ -482,7 +482,12 @@ pci_find_parent_resource(const struct pc * Restore the BAR values for a given device, so as to make it @@ -19333,26 +19333,26 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches + } +} +EXPORT_SYMBOL(xen_spin_kick); ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 14:50:24.000000000 +0100 -+++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 14:51:11.000000000 +0100 -@@ -743,7 +743,7 @@ static pte_t gntdev_clear_pte(struct vm_ - op.status); - } else { - /* USING SHADOW PAGE TABLES. */ -- copy = ptep_get_and_clear_full(vma->vm_mm, addr, ptep, is_fullmm); -+ copy = xen_ptep_get_and_clear_full(vma, addr, ptep, is_fullmm); - } - - /* Finally, we unmap the grant from kernel space. */ -@@ -772,7 +772,7 @@ static pte_t gntdev_clear_pte(struct vm_ - INVALID_P2M_ENTRY); - +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:29:28.000000000 +0200 ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:33:01.000000000 +0200 +@@ -691,7 +691,7 @@ static pte_t gntdev_clear_pte(struct vm_ + * called from a failing mmap(). + */ + if (private_data->grants[slot_index].state != GNTDEV_SLOT_MAPPED) +- return ptep_get_and_clear_full(vma->vm_mm, addr, ptep, is_fullmm); ++ return xen_ptep_get_and_clear_full(vma, addr, ptep, is_fullmm); + + /* Clear the user space mapping, if it has been made. */ + if (private_data->grants[slot_index].u.valid.user_handle != +@@ -708,7 +708,7 @@ static pte_t gntdev_clear_pte(struct vm_ + nr = 1; } else { + /* USING SHADOW PAGE TABLES (or user handle invalid). */ - copy = ptep_get_and_clear_full(vma->vm_mm, addr, ptep, is_fullmm); + copy = xen_ptep_get_and_clear_full(vma, addr, ptep, is_fullmm); + nr = 0; } - return copy; --- head.orig/drivers/xen/scsifront/scsifront.c 2011-01-31 17:56:27.000000000 +0100 +++ head/drivers/xen/scsifront/scsifront.c 2011-01-31 18:01:51.000000000 +0100 @@ -260,19 +260,19 @@ static int map_data_for_request(struct v @@ -19484,7 +19484,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches .resume = xenoprof_resume, .suspend = xenoprof_suspend }; ---- head.orig/arch/x86/include/asm/e820.h 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/arch/x86/include/asm/e820.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/e820.h 2011-01-31 18:01:51.000000000 +0100 @@ -66,7 +66,11 @@ struct e820map { struct e820entry map[E820_X_MAX]; @@ -19498,7 +19498,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches #define ISA_END_ADDRESS 0x100000 #define BIOS_BEGIN 0x000a0000 ---- head.orig/arch/x86/include/asm/hardirq.h 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/include/asm/hardirq.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/hardirq.h 2012-04-10 16:43:33.000000000 +0200 @@ -18,7 +18,11 @@ typedef struct { #ifdef CONFIG_SMP @@ -26961,7 +26961,7 @@ Automatically created from "patches.kernel.org/patch-2.6.25" by xen-port-patches void leave_mm(int cpu); #else static inline void leave_mm(int cpu) ---- head.orig/arch/x86/include/asm/ptrace.h 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/include/asm/ptrace.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/ptrace.h 2012-04-10 16:42:31.000000000 +0200 @@ -285,7 +285,9 @@ static inline unsigned long regs_get_ker } diff --git a/patches.xen/xen3-patch-2.6.26 b/patches.xen/xen3-patch-2.6.26 index 671295b0f4..aec8838847 100644 --- a/patches.xen/xen3-patch-2.6.26 +++ b/patches.xen/xen3-patch-2.6.26 @@ -697,7 +697,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches } void mtrr_ap_init(void) ---- head.orig/arch/x86/kernel/cpu/bugs.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/bugs.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/bugs.c 2011-09-07 15:43:05.000000000 +0200 @@ -17,6 +17,7 @@ #include <asm/paravirt.h> @@ -740,7 +740,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches } /* ---- head.orig/arch/x86/kernel/cpu/proc.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/proc.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/proc.c 2011-03-03 16:38:42.000000000 +0100 @@ -10,7 +10,7 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c, @@ -2233,7 +2233,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches return error; } ---- head.orig/arch/x86/kernel/mmconf-fam10h_64.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/mmconf-fam10h_64.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/mmconf-fam10h_64.c 2011-01-31 18:07:35.000000000 +0100 @@ -205,12 +205,20 @@ void __cpuinit fam10h_check_enable_mmcfg return; @@ -14834,7 +14834,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches down_write(&mm->mmap_sem); /* Test compat mode once here, in case someone ---- head.orig/drivers/acpi/processor_driver.c 2012-04-10 15:42:44.000000000 +0200 +--- head.orig/drivers/acpi/processor_driver.c 2012-05-23 12:52:45.000000000 +0200 +++ head/drivers/acpi/processor_driver.c 2012-02-08 11:47:21.000000000 +0100 @@ -369,7 +369,7 @@ static int acpi_processor_get_info(struc * of /proc/cpuinfo @@ -14898,7 +14898,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches EXPORT_SYMBOL(pci_disable_msix); /** ---- head.orig/drivers/video/Kconfig 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/drivers/video/Kconfig 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/video/Kconfig 2012-04-10 16:44:11.000000000 +0200 @@ -2264,7 +2264,7 @@ config FB_VIRTUAL @@ -15249,7 +15249,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches xlvbd_del(struct blkfront_info *info) { --- head.orig/drivers/xen/blktap/blktap.c 2012-01-02 14:26:06.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:49:22.000000000 +0100 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:33:13.000000000 +0200 @@ -112,6 +112,7 @@ typedef struct tap_blkif { unsigned long mode; /*current switching mode */ int minor; /*Minor number for tapdisk device */ @@ -15278,7 +15278,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches } static pte_t blktap_clear_pte(struct vm_area_struct *vma, -@@ -409,7 +408,7 @@ static void blktap_vma_close(struct vm_a +@@ -411,7 +410,7 @@ static void blktap_vma_close(struct vm_a } static struct vm_operations_struct blktap_vm_ops = { @@ -15287,7 +15287,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches zap_pte: blktap_clear_pte, open: blktap_vma_open, close: blktap_vma_close, -@@ -505,9 +504,8 @@ found: +@@ -507,9 +506,8 @@ found: tapfds[minor] = info; if ((class = get_xen_class()) != NULL) @@ -15299,7 +15299,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches } out: -@@ -550,7 +548,7 @@ void signal_tapdisk(int idx) +@@ -552,7 +550,7 @@ void signal_tapdisk(int idx) return; if (info->pid > 0) { @@ -15308,7 +15308,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches if (ptask) info->status = CLEANSHUTDOWN; } -@@ -800,7 +798,9 @@ static int blktap_ioctl(struct inode *in +@@ -808,7 +806,9 @@ static int blktap_ioctl(struct inode *in { if (info) { info->pid = (pid_t)arg; @@ -15319,7 +15319,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches } return 0; } -@@ -1736,9 +1736,7 @@ static int __init blkif_init(void) +@@ -1744,9 +1744,7 @@ static int __init blkif_init(void) * We only create the device when a request of a new device is * made. */ @@ -15939,7 +15939,7 @@ Automatically created from "patches.kernel.org/patch-2.6.26" by xen-port-patches }; static int xenfb_mmap(struct fb_info *fb_info, struct vm_area_struct *vma) ---- head.orig/drivers/xen/features.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/drivers/xen/features.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/xen/features.c 2011-01-31 18:07:35.000000000 +0100 @@ -9,14 +9,21 @@ #include <linux/cache.h> diff --git a/patches.xen/xen3-patch-2.6.27 b/patches.xen/xen3-patch-2.6.27 index 5af4b7be5d..48b825be4a 100644 --- a/patches.xen/xen3-patch-2.6.27 +++ b/patches.xen/xen3-patch-2.6.27 @@ -40,7 +40,7 @@ have been needed - see SLE11 SPn). config X86_DECODER_SELFTEST bool "x86 instruction decoder selftest" ---- head.orig/arch/x86/Makefile 2012-04-10 16:39:03.000000000 +0200 +--- head.orig/arch/x86/Makefile 2012-05-23 13:29:54.000000000 +0200 +++ head/arch/x86/Makefile 2012-04-10 16:46:44.000000000 +0200 @@ -134,8 +134,8 @@ KBUILD_CFLAGS += $(call cc-option,-mno-s KBUILD_CFLAGS += $(call cc-option,-mno-avx,) @@ -358,7 +358,7 @@ have been needed - see SLE11 SPn). /* * If acpi_disabled, bail out ---- head.orig/arch/x86/kernel/amd_nb.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/amd_nb.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/amd_nb.c 2011-04-13 13:47:56.000000000 +0200 @@ -15,6 +15,10 @@ static u32 *flush_words; const struct pci_device_id amd_nb_misc_ids[] = { @@ -385,7 +385,7 @@ have been needed - see SLE11 SPn). #ifndef CONFIG_XEN static int modern_apic(void) ---- head.orig/arch/x86/kernel/cpu/amd.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/amd.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/amd.c 2012-05-08 10:49:58.000000000 +0200 @@ -634,6 +634,7 @@ static void __cpuinit init_amd(struct cp fam10h_check_enable_mmcfg(); @@ -403,7 +403,7 @@ have been needed - see SLE11 SPn). /* * Family 0x12 and above processors have APIC timer ---- head.orig/arch/x86/kernel/cpu/bugs_64.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/bugs_64.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/bugs_64.c 2011-02-01 14:38:38.000000000 +0100 @@ -20,6 +20,7 @@ void __init check_bugs(void) #endif @@ -5057,7 +5057,7 @@ have been needed - see SLE11 SPn). cmpl $nr_syscalls,%eax jb syscall_call jmp syscall_exit ---- head.orig/arch/x86/kernel/entry_64.S 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/entry_64.S 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/entry_64.S 2012-04-10 16:47:12.000000000 +0200 @@ -1299,7 +1299,7 @@ ENTRY(arch_unwind_init_running) END(arch_unwind_init_running) @@ -10033,7 +10033,7 @@ have been needed - see SLE11 SPn). }; void __init no_iommu_init(void) ---- head.orig/arch/x86/kernel/probe_roms.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/kernel/probe_roms.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/probe_roms.c 2012-04-10 16:47:21.000000000 +0200 @@ -233,7 +233,7 @@ void __init probe_roms(void) upper = system_rom_resource.start; @@ -21012,7 +21012,7 @@ have been needed - see SLE11 SPn). void make_lowmem_page_readonly(void *va, unsigned int feature) { pte_t *pte; ---- head.orig/arch/x86/pci/amd_bus.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/pci/amd_bus.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/pci/amd_bus.c 2012-02-08 11:51:07.000000000 +0100 @@ -330,6 +330,7 @@ static int __init early_fill_mp_bus_info @@ -21061,7 +21061,7 @@ have been needed - see SLE11 SPn). if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) return 0; ---- head.orig/arch/x86/pci/mmconfig-shared.c 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/pci/mmconfig-shared.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/pci/mmconfig-shared.c 2011-07-06 12:20:45.000000000 +0200 @@ -21,6 +21,10 @@ #include <asm/pci_x86.h> @@ -21337,8 +21337,8 @@ have been needed - see SLE11 SPn). status = acpi_evaluate_object(handle, "_PDC", pdc_in, NULL); --- head.orig/drivers/acpi/processor_driver.c 2012-02-08 11:47:21.000000000 +0100 -+++ head/drivers/acpi/processor_driver.c 2012-04-10 16:46:19.000000000 +0200 -@@ -614,7 +614,7 @@ static int __cpuinit acpi_processor_add( ++++ head/drivers/acpi/processor_driver.c 2012-05-23 13:33:40.000000000 +0200 +@@ -613,7 +613,7 @@ static int __cpuinit acpi_processor_add( #ifndef CONFIG_XEN per_cpu(processor_device_array, pr->id) = device; #else @@ -21347,7 +21347,7 @@ have been needed - see SLE11 SPn). #endif per_cpu(processors, pr->id) = pr; -@@ -623,6 +623,9 @@ static int __cpuinit acpi_processor_add( +@@ -622,6 +622,9 @@ static int __cpuinit acpi_processor_add( result = -EFAULT; goto err_clear_processor; } @@ -21357,7 +21357,7 @@ have been needed - see SLE11 SPn). /* * Do not start hotplugged CPUs now, but when they -@@ -679,7 +682,8 @@ static int acpi_processor_remove(struct +@@ -678,7 +681,8 @@ static int acpi_processor_remove(struct acpi_processor_power_exit(pr, device); @@ -21593,8 +21593,8 @@ have been needed - see SLE11 SPn). { char memstring[64], *endchar; unsigned long long target_bytes; ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 10:49:22.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:49:49.000000000 +0100 +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:33:13.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:33:28.000000000 +0200 @@ -56,6 +56,7 @@ #include <linux/gfp.h> #include <linux/poll.h> @@ -21603,7 +21603,7 @@ have been needed - see SLE11 SPn). #include <asm/tlbflush.h> #define MAX_TAP_DEV 256 /*the maximum number of tapdisk ring devices */ -@@ -505,7 +506,7 @@ found: +@@ -507,7 +508,7 @@ found: if ((class = get_xen_class()) != NULL) device_create(class, NULL, MKDEV(blktap_major, minor), @@ -21612,7 +21612,7 @@ have been needed - see SLE11 SPn). } out: -@@ -1736,7 +1737,8 @@ static int __init blkif_init(void) +@@ -1744,7 +1745,8 @@ static int __init blkif_init(void) * We only create the device when a request of a new device is * made. */ @@ -21796,7 +21796,7 @@ have been needed - see SLE11 SPn). /* No event channels are 'live' right now. */ for (i = 0; i < NR_EVENT_CHANNELS; i++) --- head.orig/drivers/xen/core/gnttab.c 2012-03-12 15:32:00.000000000 +0100 -+++ head/drivers/xen/core/gnttab.c 2012-03-12 13:47:59.000000000 +0100 ++++ head/drivers/xen/core/gnttab.c 2012-05-23 13:33:34.000000000 +0200 @@ -40,7 +40,7 @@ #include <xen/gnttab.h> #include <asm/pgtable.h> @@ -21932,7 +21932,7 @@ have been needed - see SLE11 SPn). #else /* !CONFIG_XEN */ -@@ -846,6 +919,18 @@ int __devinit gnttab_init(void) +@@ -850,6 +923,18 @@ int __devinit gnttab_init(void) gnttab_free_count = nr_init_grefs - NR_RESERVED_ENTRIES; gnttab_free_head = NR_RESERVED_ENTRIES; @@ -22675,7 +22675,7 @@ have been needed - see SLE11 SPn). if (fd < 0) return fd; ---- head.orig/include/Kbuild 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/include/Kbuild 2012-05-23 12:40:44.000000000 +0200 +++ head/include/Kbuild 2011-02-01 14:38:38.000000000 +0100 @@ -8,5 +8,6 @@ header-y += mtd/ header-y += rdma/ @@ -24900,7 +24900,7 @@ have been needed - see SLE11 SPn). -#define ARCH_SETUP machine_specific_arch_setup(); - -static void __init machine_specific_arch_setup(void); ---- head.orig/arch/x86/include/asm/traps.h 2012-05-08 10:45:52.000000000 +0200 +--- head.orig/arch/x86/include/asm/traps.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/traps.h 2011-09-07 15:45:44.000000000 +0200 @@ -40,6 +40,9 @@ asmlinkage void alignment_check(void); asmlinkage void machine_check(void); diff --git a/patches.xen/xen3-patch-2.6.28 b/patches.xen/xen3-patch-2.6.28 index 45d72eaaaa..e744650e83 100644 --- a/patches.xen/xen3-patch-2.6.28 +++ b/patches.xen/xen3-patch-2.6.28 @@ -9,7 +9,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches 3.4/arch/x86/Kconfig.cpu ---- head.orig/arch/ia64/Kconfig 2012-04-10 14:24:58.000000000 +0200 +--- head.orig/arch/ia64/Kconfig 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/ia64/Kconfig 2011-09-07 15:50:17.000000000 +0200 @@ -234,7 +234,7 @@ config IA64_HP_SIM config IA64_XEN_GUEST @@ -20,7 +20,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches help Build a kernel that runs on Xen guest domain. At this moment only 16KB page size in supported. ---- head.orig/arch/ia64/Makefile 2010-10-20 22:30:22.000000000 +0200 +--- head.orig/arch/ia64/Makefile 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/ia64/Makefile 2011-02-01 14:39:24.000000000 +0100 @@ -55,7 +55,7 @@ core-$(CONFIG_IA64_XEN_GUEST) += arch/ia core-$(CONFIG_IA64_SGI_SN2) += arch/ia64/sn/ @@ -31,7 +31,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches drivers-$(CONFIG_PCI) += arch/ia64/pci/ drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/ ---- head.orig/arch/ia64/include/asm/xen/hypervisor.h 2010-02-24 19:52:17.000000000 +0100 +--- head.orig/arch/ia64/include/asm/xen/hypervisor.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/ia64/include/asm/xen/hypervisor.h 2011-02-01 14:39:24.000000000 +0100 @@ -40,7 +40,7 @@ #include <xen/xen.h> @@ -42,7 +42,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches extern struct shared_info *HYPERVISOR_shared_info; extern struct start_info *xen_start_info; ---- head.orig/arch/ia64/include/asm/xen/interface.h 2012-04-10 14:24:13.000000000 +0200 +--- head.orig/arch/ia64/include/asm/xen/interface.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/ia64/include/asm/xen/interface.h 2012-04-10 16:50:49.000000000 +0200 @@ -56,31 +56,19 @@ #ifndef _ASM_IA64_XEN_INTERFACE_H @@ -91,7 +91,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches #ifndef __ASSEMBLY__ ---- head.orig/arch/ia64/kernel/asm-offsets.c 2012-04-10 14:24:13.000000000 +0200 +--- head.orig/arch/ia64/kernel/asm-offsets.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/ia64/kernel/asm-offsets.c 2011-02-01 14:39:24.000000000 +0100 @@ -290,7 +290,7 @@ void foo(void) DEFINE(IA64_ITC_LASTCYCLE_OFFSET, @@ -102,7 +102,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches BLANK(); DEFINE(XEN_NATIVE_ASM, XEN_NATIVE); ---- head.orig/arch/ia64/xen/Kconfig 2009-03-24 00:12:14.000000000 +0100 +--- head.orig/arch/ia64/xen/Kconfig 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/ia64/xen/Kconfig 2011-02-02 15:36:46.000000000 +0100 @@ -2,7 +2,7 @@ # This Kconfig describes xen/ia64 options @@ -125,7 +125,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches - depends on XEN + depends on PARAVIRT_XEN bool ---- head.orig/arch/ia64/xen/xcom_hcall.c 2008-12-25 00:26:37.000000000 +0100 +--- head.orig/arch/ia64/xen/xcom_hcall.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/ia64/xen/xcom_hcall.c 2011-02-01 14:39:24.000000000 +0100 @@ -343,7 +343,7 @@ xencommize_memory_reservation(struct xen int @@ -184,7 +184,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches Use PAT attributes to setup page level cache control. --- head.orig/arch/x86/Makefile 2012-04-10 16:46:44.000000000 +0200 -+++ head/arch/x86/Makefile 2012-04-10 16:50:39.000000000 +0200 ++++ head/arch/x86/Makefile 2012-05-23 13:33:52.000000000 +0200 @@ -134,7 +134,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-s KBUILD_CFLAGS += $(call cc-option,-mno-avx,) @@ -194,7 +194,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches mcore-$(CONFIG_XEN) := arch/x86/mach-xen/ KBUILD_CFLAGS += $(mflags-y) -@@ -182,7 +182,7 @@ PHONY += bzImage vmlinuz $(BOOT_TARGETS) +@@ -185,7 +185,7 @@ PHONY += bzImage vmlinuz $(BOOT_TARGETS) ifdef CONFIG_XEN KBUILD_CPPFLAGS := -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION) \ @@ -313,7 +313,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches .quad sys_getgroups16 /* 80 */ .quad sys_setgroups16 .quad sys32_old_select ---- head.orig/arch/x86/include/asm/agp.h 2009-12-03 04:51:21.000000000 +0100 +--- head.orig/arch/x86/include/asm/agp.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/agp.h 2011-02-01 14:39:24.000000000 +0100 @@ -15,6 +15,9 @@ #define map_page_into_agp(page) set_pages_uc(page, 1) @@ -325,7 +325,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches /* * Could use CLFLUSH here if the cpu supports it. But then it would * need to be called for each cacheline of the whole page so it may ---- head.orig/arch/x86/include/asm/cpufeature.h 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/include/asm/cpufeature.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/cpufeature.h 2012-04-10 16:51:08.000000000 +0200 @@ -296,7 +296,11 @@ extern const char * const x86_power_flag #define cpu_has_xmm4_1 boot_cpu_has(X86_FEATURE_XMM4_1) @@ -339,7 +339,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches #define cpu_has_osxsave boot_cpu_has(X86_FEATURE_OSXSAVE) #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR) #define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ) ---- head.orig/arch/x86/include/asm/hw_irq.h 2012-01-05 00:55:44.000000000 +0100 +--- head.orig/arch/x86/include/asm/hw_irq.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/hw_irq.h 2011-09-07 15:49:58.000000000 +0200 @@ -151,6 +151,7 @@ extern void smp_error_interrupt(struct p extern asmlinkage void smp_irq_move_cleanup_interrupt(void); @@ -362,7 +362,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches #endif extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void); ---- head.orig/arch/x86/include/asm/mc146818rtc.h 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/include/asm/mc146818rtc.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/mc146818rtc.h 2012-04-10 16:51:13.000000000 +0200 @@ -13,7 +13,7 @@ #define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ @@ -373,7 +373,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches /* * This lock provides nmi access to the CMOS/RTC registers. It has some * special properties. It is owned by a CPU and stores the index register ---- head.orig/arch/x86/include/asm/segment.h 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/include/asm/segment.h 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/include/asm/segment.h 2011-04-13 13:50:26.000000000 +0200 @@ -188,7 +188,9 @@ #define __KERNEL_DS (GDT_ENTRY_KERNEL_DS*8) @@ -1834,7 +1834,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches #endif return 0; ---- head.orig/arch/x86/kernel/cpu/topology.c 2010-10-20 22:30:22.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/topology.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/cpu/topology.c 2011-02-01 14:39:24.000000000 +0100 @@ -28,7 +28,7 @@ */ @@ -4025,7 +4025,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches - if (is_uv_system()) - uv_cpu_init(); -} ---- head.orig/arch/x86/kernel/dumpstack_64.c 2012-04-10 14:24:56.000000000 +0200 +--- head.orig/arch/x86/kernel/dumpstack_64.c 2012-05-23 12:40:44.000000000 +0200 +++ head/arch/x86/kernel/dumpstack_64.c 2011-02-01 14:39:24.000000000 +0100 @@ -21,6 +21,7 @@ #define N_EXCEPTION_STACKS_END \ @@ -22473,7 +22473,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches /* * On UP processor, there is no _MAT or MADT table. * So above apic_id is always set to -1. ---- head.orig/drivers/acpi/processor_driver.c 2012-04-10 16:46:19.000000000 +0200 +--- head.orig/drivers/acpi/processor_driver.c 2012-05-23 13:33:40.000000000 +0200 +++ head/drivers/acpi/processor_driver.c 2012-02-08 12:02:58.000000000 +0100 @@ -325,7 +325,8 @@ static int acpi_processor_get_info(struc */ @@ -22495,7 +22495,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches #define ACPI_PROCESSOR_CLASS "processor" #define _COMPONENT ACPI_PROCESSOR_COMPONENT ACPI_MODULE_NAME("processor_extcntl") ---- head.orig/drivers/char/agp/generic.c 2012-03-19 00:15:34.000000000 +0100 +--- head.orig/drivers/char/agp/generic.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/char/agp/generic.c 2011-04-28 11:13:24.000000000 +0200 @@ -1228,7 +1228,7 @@ int agp_generic_alloc_pages(struct agp_b } @@ -22515,7 +22515,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches #endif for (i = 0; i < mem->page_count; i++) { ---- head.orig/drivers/firmware/dmi_scan.c 2012-01-05 00:55:44.000000000 +0100 +--- head.orig/drivers/firmware/dmi_scan.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/firmware/dmi_scan.c 2011-02-17 10:11:37.000000000 +0100 @@ -482,6 +482,11 @@ static bool dmi_matches(const struct dmi { @@ -22529,7 +22529,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches WARN(!dmi_initialized, KERN_ERR "dmi check: not initialized yet.\n"); for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) { ---- head.orig/drivers/idle/Kconfig 2010-10-20 22:30:22.000000000 +0200 +--- head.orig/drivers/idle/Kconfig 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/idle/Kconfig 2011-02-01 14:39:24.000000000 +0100 @@ -10,7 +10,7 @@ config INTEL_IDLE processors intel_idle does not support. @@ -22586,7 +22586,7 @@ Automatically created from "patches.kernel.org/patch-2.6.28" by xen-port-patches + return; + msi_acpi_init(); +} ---- head.orig/drivers/pci/probe.c 2012-04-10 14:24:24.000000000 +0200 +--- head.orig/drivers/pci/probe.c 2012-05-23 12:40:44.000000000 +0200 +++ head/drivers/pci/probe.c 2012-04-10 16:51:44.000000000 +0200 @@ -1300,6 +1300,11 @@ static void pci_init_capabilities(struct /* Vital Product Data */ diff --git a/patches.xen/xen3-patch-2.6.29 b/patches.xen/xen3-patch-2.6.29 index d019726f77..cb1f82659e 100644 --- a/patches.xen/xen3-patch-2.6.29 +++ b/patches.xen/xen3-patch-2.6.29 @@ -43,9 +43,9 @@ Automatically created from "patches.kernel.org/patch-2.6.29" by xen-port-patches ---help--- This option enables a workaround that fixes a source of spurious interrupts. This is recommended when threaded ---- head.orig/arch/x86/Makefile 2012-04-10 16:50:39.000000000 +0200 -+++ head/arch/x86/Makefile 2012-04-10 16:55:54.000000000 +0200 -@@ -181,8 +181,8 @@ BOOT_TARGETS = bzlilo bzdisk fdimage fdi +--- head.orig/arch/x86/Makefile 2012-05-23 13:33:52.000000000 +0200 ++++ head/arch/x86/Makefile 2012-05-23 13:34:01.000000000 +0200 +@@ -184,8 +184,8 @@ BOOT_TARGETS = bzlilo bzdisk fdimage fdi PHONY += bzImage vmlinuz $(BOOT_TARGETS) ifdef CONFIG_XEN @@ -93,7 +93,7 @@ Automatically created from "patches.kernel.org/patch-2.6.29" by xen-port-patches typedef int vector_irq_t[NR_VECTORS]; DECLARE_PER_CPU(vector_irq_t, vector_irq); ---- head.orig/arch/x86/include/asm/hypervisor.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/include/asm/hypervisor.h 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/include/asm/hypervisor.h 2011-04-13 13:52:09.000000000 +0200 @@ -60,3 +60,7 @@ static inline bool hypervisor_x2apic_ava } @@ -8859,7 +8859,7 @@ Automatically created from "patches.kernel.org/patch-2.6.29" by xen-port-patches int acpi_processor_cst_has_changed(struct acpi_processor *pr) { int cpu; ---- head.orig/drivers/gpu/drm/i915/i915_drv.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/gpu/drm/i915/i915_drv.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/i915/i915_drv.c 2012-04-10 16:55:32.000000000 +0200 @@ -885,7 +885,7 @@ static const struct file_operations i915 .open = drm_open, @@ -8870,7 +8870,7 @@ Automatically created from "patches.kernel.org/patch-2.6.29" by xen-port-patches .poll = drm_poll, .fasync = drm_fasync, .read = drm_read, ---- head.orig/drivers/gpu/drm/i915/i915_drv.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/gpu/drm/i915/i915_drv.h 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/i915/i915_drv.h 2012-04-10 16:55:30.000000000 +0200 @@ -1276,6 +1276,11 @@ int __must_check i915_add_request(struct int __must_check i915_wait_request(struct intel_ring_buffer *ring, @@ -8884,7 +8884,7 @@ Automatically created from "patches.kernel.org/patch-2.6.29" by xen-port-patches int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); int __must_check i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, ---- head.orig/drivers/gpu/drm/i915/i915_gem.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/gpu/drm/i915/i915_gem.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/i915/i915_gem.c 2012-05-08 10:50:24.000000000 +0200 @@ -1099,6 +1099,17 @@ i915_gem_mmap_ioctl(struct drm_device *d return 0; @@ -10317,7 +10317,7 @@ Automatically created from "patches.kernel.org/patch-2.6.29" by xen-port-patches } ret = HYPERVISOR_xenoprof_op(XENOPROF_reserve_counters, NULL); ---- head.orig/include/acpi/processor.h 2012-02-16 11:44:13.000000000 +0100 +--- head.orig/include/acpi/processor.h 2012-05-23 12:53:00.000000000 +0200 +++ head/include/acpi/processor.h 2011-12-21 11:11:31.000000000 +0100 @@ -85,13 +85,24 @@ struct acpi_processor_cx { }; diff --git a/patches.xen/xen3-patch-2.6.30 b/patches.xen/xen3-patch-2.6.30 index 1036d6de56..b43527e547 100644 --- a/patches.xen/xen3-patch-2.6.30 +++ b/patches.xen/xen3-patch-2.6.30 @@ -24,7 +24,7 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches extern struct shared_info *HYPERVISOR_shared_info; extern struct start_info *xen_start_info; ---- head.orig/arch/ia64/kernel/vmlinux.lds.S 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/ia64/kernel/vmlinux.lds.S 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/ia64/kernel/vmlinux.lds.S 2012-04-10 16:57:52.000000000 +0200 @@ -182,7 +182,7 @@ SECTIONS { __start_gate_section = .; @@ -91,8 +91,8 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches config X86_REROUTE_FOR_BROKEN_BOOT_IRQS bool "Reroute for broken boot IRQs" depends on X86_IO_APIC && !XEN ---- head.orig/arch/x86/Makefile 2012-04-10 16:55:54.000000000 +0200 -+++ head/arch/x86/Makefile 2012-04-10 16:57:41.000000000 +0200 +--- head.orig/arch/x86/Makefile 2012-05-23 13:34:01.000000000 +0200 ++++ head/arch/x86/Makefile 2012-05-23 13:34:11.000000000 +0200 @@ -133,10 +133,6 @@ endif KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) KBUILD_CFLAGS += $(call cc-option,-mno-avx,) @@ -104,7 +104,7 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches KBUILD_CFLAGS += $(mflags-y) KBUILD_AFLAGS += $(mflags-y) -@@ -212,10 +208,10 @@ endif +@@ -215,10 +211,10 @@ endif $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) $(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@ @@ -167,7 +167,7 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches #endif # define KEXEC_CONTROL_CODE_MAX_SIZE 2048 ---- head.orig/arch/x86/include/asm/page_64_types.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/include/asm/page_64_types.h 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/include/asm/page_64_types.h 2011-04-13 13:53:28.000000000 +0200 @@ -69,7 +69,15 @@ extern void init_extra_mapping_wb(unsign #endif /* !__ASSEMBLY__ */ @@ -3544,7 +3544,7 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); #endif ---- head.orig/arch/x86/kernel/apic/Makefile 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/kernel/apic/Makefile 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/kernel/apic/Makefile 2012-02-08 12:11:33.000000000 +0100 @@ -25,3 +25,9 @@ obj-$(CONFIG_X86_ES7000) += es7000_32.o @@ -11146,9 +11146,9 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches #ifdef CONFIG_XEN static int xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr) ---- head.orig/arch/x86/kernel/setup_percpu.c 2012-05-08 10:45:51.000000000 +0200 -+++ head/arch/x86/kernel/setup_percpu.c 2011-04-13 13:53:28.000000000 +0200 -@@ -219,7 +219,7 @@ void __init setup_per_cpu_areas(void) +--- head.orig/arch/x86/kernel/setup_percpu.c 2012-05-23 12:40:43.000000000 +0200 ++++ head/arch/x86/kernel/setup_percpu.c 2012-05-23 13:34:18.000000000 +0200 +@@ -231,7 +231,7 @@ void __init setup_per_cpu_areas(void) * are zeroed indicating that the static arrays are * gone. */ @@ -11157,7 +11157,7 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches per_cpu(x86_cpu_to_apicid, cpu) = early_per_cpu_map(x86_cpu_to_apicid, cpu); per_cpu(x86_bios_cpu_apicid, cpu) = -@@ -256,7 +256,7 @@ void __init setup_per_cpu_areas(void) +@@ -268,7 +268,7 @@ void __init setup_per_cpu_areas(void) } /* indicate the early static arrays will soon be gone */ @@ -17915,7 +17915,7 @@ Automatically created from "patches.kernel.org/patch-2.6.30" by xen-port-patches }, }; ---- head.orig/kernel/sched/core.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/kernel/sched/core.c 2012-05-23 12:40:43.000000000 +0200 +++ head/kernel/sched/core.c 2012-04-10 16:56:46.000000000 +0200 @@ -3285,6 +3285,11 @@ void __sched schedule_preempt_disabled(v } diff --git a/patches.xen/xen3-patch-2.6.31 b/patches.xen/xen3-patch-2.6.31 index 2d051eeff6..c488eb156d 100644 --- a/patches.xen/xen3-patch-2.6.31 +++ b/patches.xen/xen3-patch-2.6.31 @@ -71,7 +71,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches #endif #endif ---- head.orig/arch/x86/include/asm/required-features.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/include/asm/required-features.h 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/include/asm/required-features.h 2011-04-13 13:55:08.000000000 +0200 @@ -48,7 +48,7 @@ #endif @@ -2504,8 +2504,8 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches } void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c) ---- head.orig/arch/x86/kernel/cpu/mcheck/mce.c 2012-04-10 15:45:12.000000000 +0200 -+++ head/arch/x86/kernel/cpu/mcheck/mce.c 2012-04-10 17:00:37.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/mcheck/mce.c 2012-05-23 12:53:26.000000000 +0200 ++++ head/arch/x86/kernel/cpu/mcheck/mce.c 2012-05-23 13:34:46.000000000 +0200 @@ -118,8 +118,10 @@ void mce_setup(struct mce *m) m->time = get_seconds(); m->cpuvendor = boot_cpu_data.x86_vendor; @@ -2517,7 +2517,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches rdmsrl(MSR_IA32_MCG_CAP, m->mcgcap); } -@@ -2294,7 +2296,7 @@ static __init int mcheck_init_device(voi +@@ -2302,7 +2304,7 @@ static __init int mcheck_init_device(voi #ifdef CONFIG_X86_XEN_MCE if (is_initial_xendomain()) { /* Register vIRQ handler for MCE LOG processing */ @@ -3002,7 +3002,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches #include <asm/segment.h> #include <asm/page.h> #include <asm/msr.h> ---- head.orig/arch/x86/kernel/init_task.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/kernel/init_task.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/kernel/init_task.c 2011-04-13 13:55:08.000000000 +0200 @@ -31,6 +31,7 @@ union thread_union init_thread_union __i struct task_struct init_task = INIT_TASK(init_task); @@ -4934,7 +4934,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches if (pgd == NULL) goto out; ---- head.orig/arch/x86/pci/i386.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/pci/i386.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/pci/i386.c 2012-04-10 17:00:16.000000000 +0200 @@ -323,12 +323,14 @@ void __init pcibios_resource_survey(void pcibios_allocate_resources(1); @@ -5028,7 +5028,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches return new; } ---- head.orig/drivers/edac/Kconfig 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/edac/Kconfig 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/edac/Kconfig 2011-11-17 11:40:04.000000000 +0100 @@ -74,6 +74,7 @@ config EDAC_MM_EDAC config EDAC_AMD64 @@ -5038,7 +5038,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches help Support for error detection and correction of DRAM ECC errors on the AMD64 families of memory controllers (K8 and F10h) ---- head.orig/drivers/gpu/drm/ttm/ttm_bo.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/gpu/drm/ttm/ttm_bo.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/ttm/ttm_bo.c 2012-04-10 16:59:49.000000000 +0200 @@ -1467,6 +1467,14 @@ int ttm_bo_global_init(struct drm_global ret = -ENOMEM; @@ -5055,7 +5055,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches INIT_LIST_HEAD(&glob->swap_lru); INIT_LIST_HEAD(&glob->device_list); ---- head.orig/drivers/gpu/drm/ttm/ttm_bo_vm.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/gpu/drm/ttm/ttm_bo_vm.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/ttm/ttm_bo_vm.c 2012-04-10 16:59:52.000000000 +0200 @@ -171,7 +171,13 @@ static int ttm_bo_vm_fault(struct vm_are if (bo->mem.bus.is_iomem) { @@ -5511,8 +5511,8 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches if (info->gd->flags & GENHD_FL_CD) return sprintf(buf, "cdrom\n"); ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 10:49:49.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:55:35.000000000 +0100 +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:33:28.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:34:28.000000000 +0200 @@ -276,6 +276,15 @@ static inline unsigned int OFFSET_TO_SEG } while(0) @@ -5529,7 +5529,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches /****************************************************************** * BLKTAP VM OPS */ -@@ -440,7 +449,6 @@ static const struct file_operations blkt +@@ -442,7 +451,6 @@ static const struct file_operations blkt static tap_blkif_t *get_next_free_dev(void) { @@ -5537,7 +5537,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches tap_blkif_t *info; int minor; -@@ -504,9 +512,9 @@ found: +@@ -506,9 +514,9 @@ found: wmb(); tapfds[minor] = info; @@ -5550,7 +5550,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches } out: -@@ -549,7 +557,8 @@ void signal_tapdisk(int idx) +@@ -551,7 +559,8 @@ void signal_tapdisk(int idx) return; if (info->pid > 0) { @@ -5560,7 +5560,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches if (ptask) info->status = CLEANSHUTDOWN; } -@@ -1693,7 +1702,6 @@ static void make_response(blkif_t *blkif +@@ -1701,7 +1710,6 @@ static void make_response(blkif_t *blkif static int __init blkif_init(void) { int i, ret; @@ -5568,7 +5568,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches if (!is_running_on_xen()) return -ENODEV; -@@ -1729,7 +1737,7 @@ static int __init blkif_init(void) +@@ -1737,7 +1745,7 @@ static int __init blkif_init(void) DPRINTK("Created misc_dev %d:0 [/dev/xen/blktap0]\n", ret); /* Make sure the xen class exists */ @@ -5577,7 +5577,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches /* * This will allow udev to create the blktap ctrl device. * We only want to create blktap0 first. We don't want -@@ -1737,8 +1745,9 @@ static int __init blkif_init(void) +@@ -1745,8 +1753,9 @@ static int __init blkif_init(void) * We only create the device when a request of a new device is * made. */ @@ -6188,7 +6188,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches xen_spinlock_cleanup(cpu); } ---- head.orig/drivers/xen/evtchn.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/evtchn.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/xen/evtchn.c 2011-04-13 13:55:08.000000000 +0200 @@ -48,10 +48,17 @@ #include <linux/mutex.h> @@ -6325,9 +6325,9 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches int ret, val; switch (backend_state) { ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 14:51:11.000000000 +0100 -+++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 14:58:48.000000000 +0100 -@@ -365,6 +365,7 @@ nomem_out: +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:33:01.000000000 +0200 ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:34:31.000000000 +0200 +@@ -356,6 +356,7 @@ nomem_out: static struct miscdevice gntdev_miscdev = { .minor = MISC_DYNAMIC_MINOR, .name = GNTDEV_NAME, @@ -6834,7 +6834,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches netfront_accel_vnic *vnic = (netfront_accel_vnic *)np->accel_priv; DPRINTK("%s %s\n", __FUNCTION__, dev->nodename); ---- head.orig/drivers/xen/sys-hypervisor.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/sys-hypervisor.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/xen/sys-hypervisor.c 2012-02-17 14:32:15.000000000 +0100 @@ -12,14 +12,20 @@ #include <linux/module.h> @@ -7629,7 +7629,7 @@ Automatically created from "patches.kernel.org/patch-2.6.31" by xen-port-patches } void ---- head.orig/mm/init-mm.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/mm/init-mm.c 2012-05-23 12:40:43.000000000 +0200 +++ head/mm/init-mm.c 2011-04-13 13:55:08.000000000 +0200 @@ -13,6 +13,10 @@ #define INIT_MM_CONTEXT(name) diff --git a/patches.xen/xen3-patch-2.6.32 b/patches.xen/xen3-patch-2.6.32 index c65aea5959..5aef400560 100644 --- a/patches.xen/xen3-patch-2.6.32 +++ b/patches.xen/xen3-patch-2.6.32 @@ -207,7 +207,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches - .quad sys_perf_counter_open + .quad sys_perf_event_open ia32_syscall_end: ---- head.orig/arch/x86/include/asm/nmi.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/include/asm/nmi.h 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/include/asm/nmi.h 2011-04-13 13:55:46.000000000 +0200 @@ -17,7 +17,10 @@ struct ctl_table; extern int proc_nmi_enabled(struct ctl_table *, int , @@ -220,7 +220,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches void arch_trigger_all_cpu_backtrace(void); #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace #endif ---- head.orig/arch/x86/include/asm/uv/uv_hub.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/include/asm/uv/uv_hub.h 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/include/asm/uv/uv_hub.h 2011-02-01 14:54:13.000000000 +0100 @@ -11,7 +11,7 @@ #ifndef _ASM_X86_UV_UV_HUB_H @@ -494,7 +494,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches extern void arch_report_meminfo(struct seq_file *m); --- head.orig/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:46:07.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:46:37.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/processor.h 2012-05-23 09:35:22.000000000 +0200 @@ -27,6 +27,7 @@ struct mm_struct; #include <linux/cpumask.h> #include <linux/cache.h> @@ -549,12 +549,13 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches } static inline void __monitor(const void *eax, unsigned long ecx, -@@ -954,4 +975,35 @@ extern void start_thread(struct pt_regs +@@ -954,4 +975,37 @@ extern void start_thread(struct pt_regs extern int get_tsc_mode(unsigned long adr); extern int set_tsc_mode(unsigned int val); +extern int amd_get_nb_id(int cpu); + ++#ifndef CONFIG_XEN +struct aperfmperf { + u64 aperf, mperf; +}; @@ -583,6 +584,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches + + return ratio; +} ++#endif + #endif /* _ASM_X86_PROCESSOR_H */ --- /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -720,7 +722,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches endif disabled-obj-$(CONFIG_XEN) := %_uv.o crash.o early-quirks.o hpet.o i8237.o \ ---- head.orig/arch/x86/kernel/apic/hw_nmi.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/kernel/apic/hw_nmi.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/kernel/apic/hw_nmi.c 2011-04-13 13:55:59.000000000 +0200 @@ -26,6 +26,10 @@ u64 hw_nmi_get_sample_period(int watchdo #endif @@ -1770,7 +1772,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches #endif /* Make sure %fs and %gs are initialized properly in idle threads */ ---- head.orig/arch/x86/kernel/cpu/mcheck/mce-inject.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/mcheck/mce-inject.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/kernel/cpu/mcheck/mce-inject.c 2012-02-08 12:15:59.000000000 +0100 @@ -151,7 +151,7 @@ static void raise_mce(struct mce *m) if (context == MCJ_CTX_RANDOM) @@ -4005,7 +4007,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches #endif /* CONFIG_X86_32 */ #ifdef CONFIG_XEN ---- head.orig/arch/x86/platform/sfi/sfi.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/platform/sfi/sfi.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/platform/sfi/sfi.c 2011-02-02 08:45:00.000000000 +0100 @@ -32,6 +32,7 @@ #include <asm/apic.h> @@ -5743,7 +5745,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches BUG(); } else { xen_l1_entry_update(ptep, entry); ---- head.orig/arch/x86/mm/physaddr.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/mm/physaddr.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/mm/physaddr.c 2011-02-01 14:54:13.000000000 +0100 @@ -8,6 +8,10 @@ @@ -5768,8 +5770,8 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches ACPI 4.0 defines processor Aggregator, which enables OS to perform specific processor configuration and control that applies to all --- head.orig/drivers/acpi/processor_driver.c 2012-02-08 12:13:33.000000000 +0100 -+++ head/drivers/acpi/processor_driver.c 2012-02-16 13:32:43.000000000 +0100 -@@ -508,7 +508,7 @@ static __ref int acpi_processor_start(st ++++ head/drivers/acpi/processor_driver.c 2012-05-23 13:34:56.000000000 +0200 +@@ -507,7 +507,7 @@ static __ref int acpi_processor_start(st result = processor_extcntl_prepare(pr); if (result) @@ -5778,7 +5780,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches pr->cdev = thermal_cooling_device_register("Processor", device, &processor_cooling_ops); ---- head.orig/drivers/char/agp/agp.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/char/agp/agp.h 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/char/agp/agp.h 2011-02-01 14:54:13.000000000 +0100 @@ -31,6 +31,10 @@ @@ -5791,7 +5793,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches #define PFX "agpgart: " //#define AGP_DEBUG 1 ---- head.orig/drivers/char/agp/amd-k7-agp.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/char/agp/amd-k7-agp.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/char/agp/amd-k7-agp.c 2011-02-17 10:18:42.000000000 +0100 @@ -142,7 +142,7 @@ static int amd_create_gatt_table(struct @@ -5811,7 +5813,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches page_dir.remapped+GET_PAGE_DIR_OFF(addr)); readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ } ---- head.orig/drivers/char/agp/amd64-agp.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/char/agp/amd64-agp.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/char/agp/amd64-agp.c 2011-02-01 14:54:13.000000000 +0100 @@ -178,7 +178,7 @@ static const struct aper_size_info_32 am @@ -5831,7 +5833,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches amd64_aperture_sizes[bridge->aperture_size_idx].size); agp_remove_bridge(bridge); agp_put_bridge(bridge); ---- head.orig/drivers/char/agp/ati-agp.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/char/agp/ati-agp.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/char/agp/ati-agp.c 2011-02-01 14:54:13.000000000 +0100 @@ -361,7 +361,7 @@ static int ati_create_gatt_table(struct @@ -5851,7 +5853,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches page_dir.remapped+GET_PAGE_DIR_OFF(addr)); readl(page_dir.remapped+GET_PAGE_DIR_OFF(addr)); /* PCI Posting. */ } ---- head.orig/drivers/char/agp/efficeon-agp.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/char/agp/efficeon-agp.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/char/agp/efficeon-agp.c 2011-02-01 14:54:13.000000000 +0100 @@ -227,7 +227,7 @@ static int efficeon_create_gatt_table(st @@ -5882,7 +5884,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches /* AK: bogus, should encode addresses > 4GB */ for (i = 0; i < num_entries; i++) { ---- head.orig/drivers/char/agp/sworks-agp.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/char/agp/sworks-agp.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/char/agp/sworks-agp.c 2011-02-01 14:54:13.000000000 +0100 @@ -155,7 +155,7 @@ static int serverworks_create_gatt_table /* Create a fake scratch directory */ @@ -5922,7 +5924,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches #endif #endif /* IOATDMA_H */ ---- head.orig/drivers/dma/ioat/dma_v2.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/dma/ioat/dma_v2.h 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/dma/ioat/dma_v2.h 2011-02-01 14:54:13.000000000 +0100 @@ -176,4 +176,10 @@ int ioat2_quiesce(struct ioat_chan_commo int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo); @@ -5935,7 +5937,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches +#endif + #endif /* IOATDMA_V2_H */ ---- head.orig/drivers/dma/ioat/hw.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/dma/ioat/hw.h 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/dma/ioat/hw.h 2011-02-01 14:54:13.000000000 +0100 @@ -39,7 +39,11 @@ #define IOAT_VER_3_0 0x30 /* Version 3.0 */ @@ -5949,7 +5951,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches struct ioat_dma_descriptor { uint32_t size; ---- head.orig/drivers/gpu/drm/radeon/radeon_device.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/gpu/drm/radeon/radeon_device.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/radeon/radeon_device.c 2012-04-10 17:01:29.000000000 +0200 @@ -448,6 +448,18 @@ int radeon_dummy_page_init(struct radeon rdev->dummy_page.page = alloc_page(GFP_DMA32 | GFP_KERNEL | __GFP_ZERO); @@ -6216,7 +6218,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches else if (dev->multifunction) next_fn = next_trad_fn; ---- head.orig/drivers/sfi/sfi_core.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/sfi/sfi_core.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/sfi/sfi_core.c 2011-02-01 14:54:13.000000000 +0100 @@ -486,6 +486,11 @@ void __init sfi_init(void) if (!acpi_disabled) @@ -6230,7 +6232,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches if (sfi_disabled) return; ---- head.orig/drivers/hv/Kconfig 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/hv/Kconfig 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/hv/Kconfig 2012-02-08 12:16:15.000000000 +0100 @@ -2,7 +2,7 @@ menu "Microsoft Hyper-V guest support" @@ -6359,8 +6361,8 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches { .owner = THIS_MODULE, .open = blkif_open, ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 10:55:35.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:55:50.000000000 +0100 +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:34:28.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:35:02.000000000 +0200 @@ -276,13 +276,13 @@ static inline unsigned int OFFSET_TO_SEG } while(0) @@ -6377,7 +6379,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches }; /****************************************************************** -@@ -1722,7 +1722,7 @@ static int __init blkif_init(void) +@@ -1730,7 +1730,7 @@ static int __init blkif_init(void) tap_blkif_xenbus_init(); /* Dynamically allocate a major for this device */ @@ -6538,9 +6540,9 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches .fops = &evtchn_fops, }; static int __init evtchn_init(void) ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 14:58:48.000000000 +0100 -+++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 15:00:28.000000000 +0100 -@@ -365,7 +365,7 @@ nomem_out: +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:34:31.000000000 +0200 ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:34:59.000000000 +0200 +@@ -356,7 +356,7 @@ nomem_out: static struct miscdevice gntdev_miscdev = { .minor = MISC_DYNAMIC_MINOR, .name = GNTDEV_NAME, @@ -6773,7 +6775,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches #include <linux/proc_fs.h> #include <linux/notifier.h> #include <linux/mutex.h> ---- head.orig/fs/proc/kcore.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/fs/proc/kcore.c 2012-05-23 12:40:43.000000000 +0200 +++ head/fs/proc/kcore.c 2011-04-13 13:58:56.000000000 +0200 @@ -130,7 +130,7 @@ static void __kcore_update_ram(struct li } @@ -6796,7 +6798,7 @@ Automatically created from "patches.kernel.org/patch-2.6.32" by xen-port-patches ent->type = KCORE_RAM; list_add(&ent->list, &head); __kcore_update_ram(&head); ---- head.orig/include/linux/nmi.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/include/linux/nmi.h 2012-05-23 12:40:43.000000000 +0200 +++ head/include/linux/nmi.h 2011-02-16 09:06:03.000000000 +0100 @@ -18,6 +18,9 @@ #include <asm/nmi.h> diff --git a/patches.xen/xen3-patch-2.6.33 b/patches.xen/xen3-patch-2.6.33 index 0092707457..712c66f60e 100644 --- a/patches.xen/xen3-patch-2.6.33 +++ b/patches.xen/xen3-patch-2.6.33 @@ -158,7 +158,7 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches return 1; /* ---- head.orig/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:46:37.000000000 +0100 +--- head.orig/arch/x86/include/mach-xen/asm/processor.h 2012-05-23 09:35:22.000000000 +0200 +++ head/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:46:54.000000000 +0100 @@ -31,6 +31,7 @@ struct mm_struct; #include <linux/init.h> @@ -3545,7 +3545,7 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches .child = kernel_table2 }, {} }; ---- head.orig/arch/x86/kernel/x8664_ksyms_64.c 2011-05-19 06:06:34.000000000 +0200 +--- head.orig/arch/x86/kernel/x8664_ksyms_64.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/kernel/x8664_ksyms_64.c 2011-04-13 13:57:11.000000000 +0200 @@ -55,6 +55,6 @@ EXPORT_SYMBOL(__memcpy); EXPORT_SYMBOL(memmove); @@ -4014,7 +4014,7 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches .procname = "abi", .mode = 0555, .child = abi_table2 ---- head.orig/drivers/gpu/drm/vmwgfx/Kconfig 2012-01-05 00:55:44.000000000 +0100 +--- head.orig/drivers/gpu/drm/vmwgfx/Kconfig 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/vmwgfx/Kconfig 2011-02-01 14:55:46.000000000 +0100 @@ -1,6 +1,6 @@ config DRM_VMWGFX @@ -4456,7 +4456,7 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches depends on ACPI depends on HOTPLUG default !X86 ---- head.orig/drivers/scsi/Kconfig 2012-04-10 14:24:24.000000000 +0200 +--- head.orig/drivers/scsi/Kconfig 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/scsi/Kconfig 2012-04-10 17:02:26.000000000 +0200 @@ -657,7 +657,7 @@ config SCSI_FLASHPOINT @@ -4806,8 +4806,8 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches /* --- head.orig/include/acpi/processor.h 2011-12-21 11:11:31.000000000 +0100 -+++ head/include/acpi/processor.h 2012-02-16 13:33:09.000000000 +0100 -@@ -319,7 +319,7 @@ static inline void acpi_processor_ppc_ex ++++ head/include/acpi/processor.h 2012-05-23 13:35:16.000000000 +0200 +@@ -318,7 +318,7 @@ static inline void acpi_processor_ppc_ex return; } #ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL @@ -4816,7 +4816,7 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches #else static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) -@@ -334,11 +334,11 @@ static inline int acpi_processor_ppc_has +@@ -333,11 +333,11 @@ static inline int acpi_processor_ppc_has } return 0; } @@ -4870,7 +4870,7 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches /* * Use these to access the event channel underlying the IRQ handle returned * by bind_*_to_irqhandler(). ---- head.orig/include/xen/xen.h 2010-02-24 19:52:17.000000000 +0100 +--- head.orig/include/xen/xen.h 2012-05-23 12:40:43.000000000 +0200 +++ head/include/xen/xen.h 2011-02-01 14:55:46.000000000 +0100 @@ -7,8 +7,10 @@ enum xen_domain_type { XEN_HVM_DOMAIN, /* running in a Xen hvm domain */ @@ -4911,7 +4911,7 @@ Automatically created from "patches.kernel.org/patch-2.6.33" by xen-port-patches static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data, size_t data_len) ---- head.orig/kernel/ksysfs.c 2012-04-10 14:24:50.000000000 +0200 +--- head.orig/kernel/ksysfs.c 2012-05-23 12:40:43.000000000 +0200 +++ head/kernel/ksysfs.c 2011-12-02 14:07:10.000000000 +0100 @@ -107,6 +107,7 @@ static ssize_t kexec_crash_size_show(str { diff --git a/patches.xen/xen3-patch-2.6.34 b/patches.xen/xen3-patch-2.6.34 index 6efc18ee39..7860c5ffae 100644 --- a/patches.xen/xen3-patch-2.6.34 +++ b/patches.xen/xen3-patch-2.6.34 @@ -56,7 +56,7 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches .quad sys_modify_ldt .quad compat_sys_adjtimex .quad sys32_mprotect /* 125 */ ---- head.orig/arch/x86/include/asm/i8259.h 2011-01-05 01:50:19.000000000 +0100 +--- head.orig/arch/x86/include/asm/i8259.h 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/include/asm/i8259.h 2011-04-13 13:58:56.000000000 +0200 @@ -54,6 +54,7 @@ extern struct irq_chip i8259A_chip; @@ -2997,8 +2997,8 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches cpuid = acpi_get_cpuid(handle, type, acpi_id); if (cpuid == -1) ---- head.orig/drivers/acpi/processor_driver.c 2012-02-16 13:32:43.000000000 +0100 -+++ head/drivers/acpi/processor_driver.c 2012-02-16 13:33:25.000000000 +0100 +--- head.orig/drivers/acpi/processor_driver.c 2012-05-23 13:34:56.000000000 +0200 ++++ head/drivers/acpi/processor_driver.c 2012-05-23 13:35:30.000000000 +0200 @@ -110,7 +110,9 @@ static struct acpi_driver acpi_processor #define UNINSTALL_NOTIFY_HANDLER 2 @@ -3020,7 +3020,7 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches return -ENODEV; } /* -@@ -573,8 +575,6 @@ static int __cpuinit acpi_processor_add( +@@ -572,8 +574,6 @@ static int __cpuinit acpi_processor_add( strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); device->driver_data = pr; @@ -3106,7 +3106,7 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches goto exit_entry_free; } ---- head.orig/drivers/misc/Kconfig 2012-04-10 14:24:50.000000000 +0200 +--- head.orig/drivers/misc/Kconfig 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/misc/Kconfig 2012-02-21 11:39:49.000000000 +0100 @@ -427,7 +427,7 @@ config TI_DAC7512 @@ -3395,7 +3395,7 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches #include <linux/irq.h> #include <linux/interrupt.h> #include <linux/sched.h> ---- head.orig/drivers/xen/core/gnttab.c 2012-03-12 13:47:59.000000000 +0100 +--- head.orig/drivers/xen/core/gnttab.c 2012-05-23 13:33:34.000000000 +0200 +++ head/drivers/xen/core/gnttab.c 2012-03-12 16:17:09.000000000 +0100 @@ -32,6 +32,7 @@ */ @@ -3435,7 +3435,7 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches #include <linux/input.h> #include <asm/hypervisor.h> #include <xen/evtchn.h> ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 15:00:28.000000000 +0100 +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:34:59.000000000 +0200 +++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 15:02:32.000000000 +0100 @@ -23,6 +23,7 @@ #include <linux/fs.h> @@ -3547,9 +3547,9 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches #include <linux/notifier.h> #include <asm/io.h> ---- head.orig/include/acpi/processor.h 2012-02-16 13:33:09.000000000 +0100 -+++ head/include/acpi/processor.h 2012-02-16 13:33:22.000000000 +0100 -@@ -440,11 +440,9 @@ static inline int processor_pmthr_extern +--- head.orig/include/acpi/processor.h 2012-05-23 13:35:16.000000000 +0200 ++++ head/include/acpi/processor.h 2012-05-23 13:35:23.000000000 +0200 +@@ -439,11 +439,9 @@ static inline int processor_pmthr_extern extern int processor_notify_external(struct acpi_processor *pr, int event, int type); @@ -3561,7 +3561,7 @@ Automatically created from "patches.kernel.org/patch-2.6.34" by xen-port-patches #else static inline int processor_cntl_external(void) {return 0;} static inline int processor_pm_external(void) {return 0;} -@@ -455,7 +453,6 @@ static inline int processor_notify_exter +@@ -454,7 +452,6 @@ static inline int processor_notify_exter { return 0; } diff --git a/patches.xen/xen3-patch-2.6.35 b/patches.xen/xen3-patch-2.6.35 index 5dfc888087..7ed4389c0a 100644 --- a/patches.xen/xen3-patch-2.6.35 +++ b/patches.xen/xen3-patch-2.6.35 @@ -1847,7 +1847,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches } static void *memtype_seq_start(struct seq_file *seq, loff_t *pos) ---- head.orig/arch/x86/mm/pat_internal.h 2010-08-02 00:11:14.000000000 +0200 +--- head.orig/arch/x86/mm/pat_internal.h 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/mm/pat_internal.h 2011-04-13 14:02:46.000000000 +0200 @@ -21,6 +21,10 @@ static inline char *cattr_name(unsigned case _PAGE_CACHE_UC_MINUS: return "uncached-minus"; @@ -1870,8 +1870,8 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches #include <asm/system.h> #include <asm/pgtable.h> ---- head.orig/drivers/acpi/processor_driver.c 2012-02-16 13:33:25.000000000 +0100 -+++ head/drivers/acpi/processor_driver.c 2012-02-16 13:33:43.000000000 +0100 +--- head.orig/drivers/acpi/processor_driver.c 2012-05-23 13:35:30.000000000 +0200 ++++ head/drivers/acpi/processor_driver.c 2012-05-23 13:35:40.000000000 +0200 @@ -331,6 +331,11 @@ static int acpi_processor_get_info(struc pr->acpi_id) < 0) return -ENODEV; @@ -1884,7 +1884,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches /* * On some boxes several processors use the same processor bus id. * But they are located in different scope. For example: -@@ -505,7 +510,8 @@ static __ref int acpi_processor_start(st +@@ -504,7 +509,8 @@ static __ref int acpi_processor_start(st acpi_processor_get_limit_info(pr); } @@ -1894,7 +1894,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches acpi_processor_power_init(pr, device); result = processor_extcntl_prepare(pr); -@@ -583,8 +589,11 @@ static int __cpuinit acpi_processor_add( +@@ -582,8 +588,11 @@ static int __cpuinit acpi_processor_add( } #ifdef CONFIG_SMP @@ -1939,7 +1939,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches if (processor_pm_external()) processor_notify_external(pr, ---- head.orig/drivers/edac/i7core_edac.c 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/drivers/edac/i7core_edac.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/edac/i7core_edac.c 2011-11-17 13:11:45.000000000 +0100 @@ -1932,7 +1932,7 @@ static int i7core_mce_check_error(struct if (mce->bank != 8) @@ -1950,7 +1950,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches /* Only handle if it is the right mc controller */ if (mce->socketid != pvt->i7core_dev->socket) return NOTIFY_DONE; ---- head.orig/drivers/gpu/drm/ttm/ttm_page_alloc.c 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/drivers/gpu/drm/ttm/ttm_page_alloc.c 2012-05-23 12:40:43.000000000 +0200 +++ head/drivers/gpu/drm/ttm/ttm_page_alloc.c 2012-04-10 17:05:48.000000000 +0200 @@ -491,6 +491,19 @@ static int ttm_alloc_new_pages(struct li for (i = 0, cpages = 0; i < count; ++i) { @@ -2251,9 +2251,9 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches else vm_total_pages = nr_free_pagecache_pages(); #endif ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 10:55:50.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:56:12.000000000 +0100 -@@ -1761,3 +1761,4 @@ static int __init blkif_init(void) +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:35:02.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:35:43.000000000 +0200 +@@ -1769,3 +1769,4 @@ static int __init blkif_init(void) module_init(blkif_init); MODULE_LICENSE("Dual BSD/GPL"); @@ -2384,7 +2384,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches MODULE_LICENSE("GPL"); +MODULE_ALIAS("devname:xen/evtchn"); --- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 15:02:32.000000000 +0100 -+++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 15:02:58.000000000 +0100 ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:35:46.000000000 +0200 @@ -40,6 +40,9 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); @@ -2395,7 +2395,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches #define MAX_GRANTS_LIMIT 1024 #define DEFAULT_MAX_GRANTS 128 -@@ -153,8 +156,6 @@ static struct vm_operations_struct gntde +@@ -152,8 +155,6 @@ static struct vm_operations_struct gntde .zap_pte = gntdev_clear_pte }; @@ -2498,7 +2498,7 @@ Automatically created from "patches.kernel.org/patch-2.6.35" by xen-port-patches static inline struct usbfront_info *hcd_to_info(struct usb_hcd *hcd) { return (struct usbfront_info *) (hcd->hcd_priv); ---- head.orig/include/acpi/processor.h 2012-02-16 13:33:22.000000000 +0100 +--- head.orig/include/acpi/processor.h 2012-05-23 13:35:23.000000000 +0200 +++ head/include/acpi/processor.h 2011-12-21 11:18:27.000000000 +0100 @@ -74,8 +74,9 @@ struct acpi_processor_cx { u32 power; diff --git a/patches.xen/xen3-patch-2.6.36 b/patches.xen/xen3-patch-2.6.36 index f043b78971..06ff09c0e7 100644 --- a/patches.xen/xen3-patch-2.6.36 +++ b/patches.xen/xen3-patch-2.6.36 @@ -217,7 +217,7 @@ Automatically created from "patches.kernel.org/patch-2.6.36" by xen-port-patches #define update_mmu_cache(vma, address, ptep) do { } while (0) --- head.orig/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:47:17.000000000 +0100 -+++ head/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:47:27.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/processor.h 2012-05-23 13:36:57.000000000 +0200 @@ -716,6 +716,7 @@ extern void init_c1e_mask(void); extern unsigned long boot_option_idle_override; extern unsigned long idle_halt; @@ -226,9 +226,9 @@ Automatically created from "patches.kernel.org/patch-2.6.36" by xen-port-patches #ifndef CONFIG_XEN /* -@@ -979,4 +980,24 @@ unsigned long calc_aperfmperf_ratio(stru - return ratio; +@@ -981,4 +982,24 @@ unsigned long calc_aperfmperf_ratio(stru } + #endif +/* + * AMD errata checking @@ -428,7 +428,7 @@ Automatically created from "patches.kernel.org/patch-2.6.36" by xen-port-patches /* * Initialize MSR_IA32_ENERGY_PERF_BIAS if BIOS did not. ---- head.orig/arch/x86/kernel/cpu/scattered.c 2012-04-10 14:24:22.000000000 +0200 +--- head.orig/arch/x86/kernel/cpu/scattered.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/kernel/cpu/scattered.c 2012-02-16 13:40:13.000000000 +0100 @@ -41,6 +41,7 @@ void __cpuinit init_scattered_cpuid_feat { X86_FEATURE_XSAVEOPT, CR_EAX, 0, 0x0000000d, 1 }, @@ -1052,9 +1052,9 @@ Automatically created from "patches.kernel.org/patch-2.6.36" by xen-port-patches config XEN_MAX_DOMAIN_MEMORY int ---- head.orig/arch/x86/xen/enlighten.c 2012-04-10 14:24:22.000000000 +0200 -+++ head/arch/x86/xen/enlighten.c 2012-04-10 17:06:21.000000000 +0200 -@@ -124,8 +124,8 @@ static int have_vcpu_info_placement = 1; +--- head.orig/arch/x86/xen/enlighten.c 2012-05-23 12:40:43.000000000 +0200 ++++ head/arch/x86/xen/enlighten.c 2012-05-23 13:36:06.000000000 +0200 +@@ -125,8 +125,8 @@ static int have_vcpu_info_placement = 1; static void clamp_max_cpus(void) { #ifdef CONFIG_SMP @@ -1065,7 +1065,7 @@ Automatically created from "patches.kernel.org/patch-2.6.36" by xen-port-patches #endif } -@@ -137,11 +137,11 @@ static void xen_vcpu_setup(int cpu) +@@ -138,11 +138,11 @@ static void xen_vcpu_setup(int cpu) BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info); @@ -1265,9 +1265,9 @@ Automatically created from "patches.kernel.org/patch-2.6.36" by xen-port-patches return -ENOSYS; } #endif ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 10:56:12.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:59:08.000000000 +0100 -@@ -433,14 +433,14 @@ static tap_blkif_t *get_next_free_dev(vo +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:35:43.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:35:55.000000000 +0200 +@@ -435,14 +435,14 @@ static tap_blkif_t *get_next_free_dev(vo static int blktap_open(struct inode *inode, struct file *filp); static int blktap_release(struct inode *inode, struct file *filp); static int blktap_mmap(struct file *filp, struct vm_area_struct *vma); @@ -1285,7 +1285,7 @@ Automatically created from "patches.kernel.org/patch-2.6.36" by xen-port-patches .open = blktap_open, .release = blktap_release, .mmap = blktap_mmap, -@@ -768,8 +768,8 @@ static int blktap_mmap(struct file *filp +@@ -776,8 +776,8 @@ static int blktap_mmap(struct file *filp } diff --git a/patches.xen/xen3-patch-2.6.37 b/patches.xen/xen3-patch-2.6.37 index 9116c01214..a49f496fd2 100644 --- a/patches.xen/xen3-patch-2.6.37 +++ b/patches.xen/xen3-patch-2.6.37 @@ -92,7 +92,7 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches #endif #endif ---- head.orig/arch/x86/include/asm/io.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/include/asm/io.h 2012-05-23 12:40:41.000000000 +0200 +++ head/arch/x86/include/asm/io.h 2011-09-07 16:07:28.000000000 +0200 @@ -331,7 +331,7 @@ extern void early_iounmap(void __iomem * extern void fixup_early_ioremap(void); @@ -392,7 +392,7 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches #define update_mmu_cache(vma, address, ptep) do { } while (0) ---- head.orig/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:47:27.000000000 +0100 +--- head.orig/arch/x86/include/mach-xen/asm/processor.h 2012-05-23 13:36:57.000000000 +0200 +++ head/arch/x86/include/mach-xen/asm/processor.h 2011-03-03 16:47:48.000000000 +0100 @@ -120,6 +120,8 @@ struct cpuinfo_x86 { u16 phys_proc_id; @@ -3994,7 +3994,7 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches return 0; } ---- head.orig/arch/x86/kernel/resource.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/kernel/resource.c 2012-05-23 12:40:43.000000000 +0200 +++ head/arch/x86/kernel/resource.c 2011-09-23 14:48:43.000000000 +0200 @@ -1,3 +1,7 @@ +#ifdef CONFIG_XEN @@ -6324,9 +6324,9 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches #ifdef CONFIG_SYSFS static ssize_t show_media(struct device *dev, ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 10:59:08.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 10:59:27.000000000 +0100 -@@ -443,6 +443,7 @@ static const struct file_operations blkt +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:35:55.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:38:37.000000000 +0200 +@@ -445,6 +445,7 @@ static const struct file_operations blkt .unlocked_ioctl = blktap_ioctl, .open = blktap_open, .release = blktap_release, @@ -6334,7 +6334,7 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches .mmap = blktap_mmap, }; -@@ -576,6 +577,8 @@ static int blktap_open(struct inode *ino +@@ -578,6 +579,8 @@ static int blktap_open(struct inode *ino tap_blkif_t *info; int i; @@ -7247,9 +7247,9 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT; ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 15:02:58.000000000 +0100 -+++ head/drivers/xen/gntdev/gntdev.c 2012-01-20 15:05:50.000000000 +0100 -@@ -141,6 +141,7 @@ static long gntdev_ioctl(struct file *fl +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:35:46.000000000 +0200 ++++ head/drivers/xen/gntdev/gntdev.c 2012-05-23 13:38:40.000000000 +0200 +@@ -140,6 +140,7 @@ static long gntdev_ioctl(struct file *fl static const struct file_operations gntdev_fops = { .owner = THIS_MODULE, .open = gntdev_open, @@ -7257,7 +7257,7 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches .release = gntdev_release, .mmap = gntdev_mmap, .unlocked_ioctl = gntdev_ioctl -@@ -403,6 +404,8 @@ static int gntdev_open(struct inode *ino +@@ -394,6 +395,8 @@ static int gntdev_open(struct inode *ino { gntdev_file_private_data_t *private_data; @@ -7266,8 +7266,8 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches /* Allocate space for the per-instance private data. */ private_data = kmalloc(sizeof(*private_data), GFP_KERNEL); if (!private_data) ---- head.orig/drivers/xen/pci.c 2012-05-08 10:45:51.000000000 +0200 -+++ head/drivers/xen/pci.c 2011-11-17 13:22:46.000000000 +0100 +--- head.orig/drivers/xen/pci.c 2012-05-23 12:40:43.000000000 +0200 ++++ head/drivers/xen/pci.c 2012-05-22 11:51:14.000000000 +0200 @@ -23,11 +23,20 @@ #include <xen/interface/physdev.h> #include <xen/interface/xen.h> @@ -7289,6 +7289,15 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches static int xen_add_device(struct device *dev) { +@@ -59,7 +68,7 @@ static int xen_add_device(struct device + + #ifdef CONFIG_ACPI + handle = DEVICE_ACPI_HANDLE(&pci_dev->dev); +- if (!handle) ++ if (!handle && pci_dev->bus->bridge) + handle = DEVICE_ACPI_HANDLE(pci_dev->bus->bridge); + #ifdef CONFIG_PCI_IOV + if (!handle && pci_dev->is_virtfn) @@ -86,7 +95,9 @@ static int xen_add_device(struct device r = HYPERVISOR_physdev_op(PHYSDEVOP_pci_device_add, &add); if (r != -ENOSYS) @@ -7514,7 +7523,7 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches typedef struct xen_memory_map xen_memory_map_t; DEFINE_XEN_GUEST_HANDLE(xen_memory_map_t); ---- head.orig/include/xen/privcmd.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/include/xen/privcmd.h 2012-05-23 12:40:43.000000000 +0200 +++ head/include/xen/privcmd.h 2011-04-13 14:05:37.000000000 +0200 @@ -1,77 +1,3 @@ -/****************************************************************************** @@ -7607,7 +7616,7 @@ Automatically created from "patches.kernel.org/patch-2.6.37" by xen-port-patches typedef struct privcmd_hypercall { ---- head.orig/kernel/power/Kconfig 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/kernel/power/Kconfig 2012-05-23 12:40:43.000000000 +0200 +++ head/kernel/power/Kconfig 2011-11-17 13:22:58.000000000 +0100 @@ -139,7 +139,7 @@ config PM_ADVANCED_DEBUG diff --git a/patches.xen/xen3-patch-2.6.39 b/patches.xen/xen3-patch-2.6.39 index 6628d3bc31..6ab9d178da 100644 --- a/patches.xen/xen3-patch-2.6.39 +++ b/patches.xen/xen3-patch-2.6.39 @@ -91,7 +91,7 @@ Acked-by: jbeulich@novell.com extern const unsigned char acpi_wakeup_code[]; #define acpi_wakeup_address (__pa(TRAMPOLINE_SYM(acpi_wakeup_code))) ---- head.orig/arch/x86/include/asm/trampoline.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/arch/x86/include/asm/trampoline.h 2012-05-23 12:40:41.000000000 +0200 +++ head/arch/x86/include/asm/trampoline.h 2011-04-14 14:59:31.000000000 +0200 @@ -1,4 +1,4 @@ -#ifndef _ASM_X86_TRAMPOLINE_H @@ -1929,9 +1929,9 @@ Acked-by: jbeulich@novell.com mcheck_init(); local_irq_save(flags); ---- head.orig/arch/x86/kernel/setup_percpu.c 2011-04-13 13:53:28.000000000 +0200 -+++ head/arch/x86/kernel/setup_percpu.c 2011-04-14 17:07:02.000000000 +0200 -@@ -219,7 +219,8 @@ void __init setup_per_cpu_areas(void) +--- head.orig/arch/x86/kernel/setup_percpu.c 2012-05-23 13:34:18.000000000 +0200 ++++ head/arch/x86/kernel/setup_percpu.c 2012-05-23 13:38:58.000000000 +0200 +@@ -231,7 +231,8 @@ void __init setup_per_cpu_areas(void) * are zeroed indicating that the static arrays are * gone. */ @@ -1941,7 +1941,7 @@ Acked-by: jbeulich@novell.com per_cpu(x86_cpu_to_apicid, cpu) = early_per_cpu_map(x86_cpu_to_apicid, cpu); per_cpu(x86_bios_cpu_apicid, cpu) = -@@ -229,6 +230,7 @@ void __init setup_per_cpu_areas(void) +@@ -241,6 +242,7 @@ void __init setup_per_cpu_areas(void) per_cpu(x86_cpu_to_logical_apicid, cpu) = early_per_cpu_map(x86_cpu_to_logical_apicid, cpu); #endif @@ -1949,7 +1949,7 @@ Acked-by: jbeulich@novell.com #ifdef CONFIG_X86_64 per_cpu(irq_stack_ptr, cpu) = per_cpu(irq_stack_union.irq_stack, cpu) + -@@ -256,13 +258,15 @@ void __init setup_per_cpu_areas(void) +@@ -268,13 +270,15 @@ void __init setup_per_cpu_areas(void) } /* indicate the early static arrays will soon be gone */ @@ -2632,14 +2632,14 @@ Acked-by: jbeulich@novell.com obj-$(CONFIG_USB_CATC) += usb/ obj-$(CONFIG_USB_KAWETH) += usb/ ---- head.orig/drivers/net/xen-netback/Makefile 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/net/xen-netback/Makefile 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/net/xen-netback/Makefile 2011-04-13 14:42:19.000000000 +0200 @@ -1,3 +1,3 @@ -obj-$(CONFIG_XEN_NETDEV_BACKEND) := xen-netback.o +obj-$(CONFIG_PARAVIRT_XEN_NETDEV_BACKEND) := xen-netback.o xen-netback-y := netback.o xenbus.o interface.o ---- head.orig/drivers/watchdog/Kconfig 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/watchdog/Kconfig 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/watchdog/Kconfig 2012-04-10 17:11:45.000000000 +0200 @@ -1184,7 +1184,7 @@ config WATCHDOG_RIO @@ -2650,7 +2650,7 @@ Acked-by: jbeulich@novell.com help Say Y here to support the hypervisor watchdog capability provided by Xen 4.0 and newer. The watchdog timeout period is normally one ---- head.orig/drivers/watchdog/xen_wdt.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/watchdog/xen_wdt.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/watchdog/xen_wdt.c 2012-04-10 17:11:39.000000000 +0200 @@ -1,7 +1,8 @@ /* diff --git a/patches.xen/xen3-patch-3.1 b/patches.xen/xen3-patch-3.1 index 3874cc4193..28f85697be 100644 --- a/patches.xen/xen3-patch-3.1 +++ b/patches.xen/xen3-patch-3.1 @@ -1276,7 +1276,7 @@ Acked-by: jbeulich@suse.com pte = pfn_pte(phys >> PAGE_SHIFT, flags); set_pte_vaddr_pud(level3_user_pgt, address, pte); break; ---- head.orig/drivers/gpu/drm/i915/intel_display.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/gpu/drm/i915/intel_display.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/gpu/drm/i915/intel_display.c 2012-05-08 10:53:11.000000000 +0200 @@ -8440,7 +8440,11 @@ void gen6_update_ring_freq(struct drm_i9 * over @@ -1708,7 +1708,7 @@ Acked-by: jbeulich@suse.com sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group); return 0; } ---- head.orig/drivers/iommu/Kconfig 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/iommu/Kconfig 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/iommu/Kconfig 2011-09-09 17:53:01.000000000 +0200 @@ -4,6 +4,7 @@ config IOMMU_API @@ -1718,7 +1718,7 @@ Acked-by: jbeulich@suse.com default y ---help--- Say Y here if you want to compile device drivers for IO Memory ---- head.orig/drivers/virtio/Kconfig 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/virtio/Kconfig 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/virtio/Kconfig 2011-09-09 17:52:44.000000000 +0200 @@ -8,6 +8,7 @@ config VIRTIO_RING depends on VIRTIO @@ -2025,13 +2025,27 @@ Acked-by: jbeulich@suse.com #include <asm/uaccess.h> #define DPRINTK(_f, _a...) pr_debug(_f, ## _a) ---- head.orig/drivers/xen/blktap/blktap.c 2012-01-06 10:59:27.000000000 +0100 -+++ head/drivers/xen/blktap/blktap.c 2012-01-06 11:01:07.000000000 +0100 -@@ -1765,3 +1765,4 @@ module_init(blkif_init); +--- head.orig/drivers/xen/blktap/blktap.c 2012-05-23 13:38:37.000000000 +0200 ++++ head/drivers/xen/blktap/blktap.c 2012-05-23 13:39:15.000000000 +0200 +@@ -1773,3 +1773,4 @@ module_init(blkif_init); MODULE_LICENSE("Dual BSD/GPL"); MODULE_ALIAS("devname:xen/blktap0"); +MODULE_ALIAS("xen-backend:tap"); +--- head.orig/drivers/xen/blktap2/control.c 2011-02-24 15:17:25.000000000 +0100 ++++ head/drivers/xen/blktap2/control.c 2012-05-23 13:39:18.000000000 +0200 +@@ -283,3 +283,4 @@ module_init(blktap_init); + module_exit(blktap_exit); + MODULE_LICENSE("Dual BSD/GPL"); + MODULE_ALIAS("devname:" BLKTAP2_DEV_DIR "control"); ++MODULE_ALIAS("xen-backend:tap2"); +--- head.orig/drivers/xen/blktap2-new/control.c 2011-02-24 15:17:28.000000000 +0100 ++++ head/drivers/xen/blktap2-new/control.c 2012-05-23 13:39:23.000000000 +0200 +@@ -314,3 +314,4 @@ module_init(blktap_init); + module_exit(blktap_exit); + MODULE_LICENSE("Dual BSD/GPL"); + MODULE_ALIAS("devname:" BLKTAP2_DEV_DIR "control"); ++MODULE_ALIAS("xen-backend:tap2"); --- head.orig/drivers/xen/core/evtchn.c 2012-01-31 18:19:24.000000000 +0100 +++ head/drivers/xen/core/evtchn.c 2012-01-26 13:48:33.000000000 +0100 @@ -38,7 +38,7 @@ @@ -2043,7 +2057,7 @@ Acked-by: jbeulich@suse.com #include <asm/system.h> #include <asm/ptrace.h> #include <xen/evtchn.h> ---- head.orig/drivers/xen/gntdev/gntdev.c 2012-01-20 15:05:50.000000000 +0100 +--- head.orig/drivers/xen/gntdev/gntdev.c 2012-05-23 13:38:40.000000000 +0200 +++ head/drivers/xen/gntdev/gntdev.c 2011-09-09 09:39:43.000000000 +0200 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -2356,7 +2370,7 @@ Acked-by: jbeulich@suse.com MODULE_DESCRIPTION("Xen USB backend driver (usbback)"); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_ALIAS("xen-backend:vusb"); ---- head.orig/drivers/xen/xen-pciback/Makefile 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-pciback/Makefile 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-pciback/Makefile 2011-09-19 13:15:03.000000000 +0200 @@ -1,7 +1,13 @@ -obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback.o @@ -2377,7 +2391,7 @@ Acked-by: jbeulich@suse.com +$(pcibk-y)-$(CONFIG_XEN_PCIDEV_BACKEND_PASSTHROUGH) += passthrough.o +$(pcibk-y)-$(CONFIG_XEN_PCIDEV_BACKEND_SLOT) += slot.o +$(pcibk-y)-$(CONFIG_XEN_PCIDEV_BACKEND_CONTROLLER) += controller.o ---- head.orig/drivers/xen/xen-pciback/conf_space_capability.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-pciback/conf_space_capability.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-pciback/conf_space_capability.c 2011-09-16 14:20:03.000000000 +0200 @@ -140,6 +140,21 @@ static int pm_ctrl_write(struct pci_dev goto out; @@ -2401,7 +2415,7 @@ Acked-by: jbeulich@suse.com out: return err; } ---- head.orig/drivers/xen/xen-pciback/conf_space_header.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-pciback/conf_space_header.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-pciback/conf_space_header.c 2011-11-17 13:56:29.000000000 +0100 @@ -39,10 +39,11 @@ static int command_read(struct pci_dev * @@ -2643,7 +2657,7 @@ Acked-by: jbeulich@suse.com + .add = _xen_pcibk_add_pci_dev, + .get = _xen_pcibk_get_pci_dev, +}; ---- head.orig/drivers/xen/xen-pciback/pci_stub.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-pciback/pci_stub.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-pciback/pci_stub.c 2012-04-10 17:21:31.000000000 +0200 @@ -14,9 +14,14 @@ #include <linux/wait.h> @@ -2795,7 +2809,7 @@ Acked-by: jbeulich@suse.com if (err) pcistub_exit(); ---- head.orig/drivers/xen/xen-pciback/pciback.h 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-pciback/pciback.h 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-pciback/pciback.h 2012-04-10 17:21:33.000000000 +0200 @@ -10,12 +10,16 @@ #include <linux/interrupt.h> @@ -2866,7 +2880,7 @@ Acked-by: jbeulich@suse.com extern const struct xen_pcibk_backend *xen_pcibk_backend; static inline int xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, ---- head.orig/drivers/xen/xen-pciback/pciback_ops.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-pciback/pciback_ops.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-pciback/pciback_ops.c 2012-04-10 17:21:35.000000000 +0200 @@ -6,13 +6,18 @@ #include <linux/module.h> @@ -3184,7 +3198,7 @@ Acked-by: jbeulich@suse.com + .add = _xen_pcibk_add_pci_dev, + .get = _xen_pcibk_get_pci_dev, +}; ---- head.orig/drivers/xen/xen-pciback/xenbus.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-pciback/xenbus.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-pciback/xenbus.c 2012-02-21 11:40:18.000000000 +0100 @@ -6,30 +6,77 @@ #include <linux/module.h> @@ -3399,7 +3413,7 @@ Acked-by: jbeulich@suse.com pr_info(DRV_NAME ": backend is %s\n", xen_pcibk_backend->name); return xenbus_register_backend(&xen_pcibk_driver); } ---- head.orig/drivers/xen/xen-selfballoon.c 2012-05-08 10:45:51.000000000 +0200 +--- head.orig/drivers/xen/xen-selfballoon.c 2012-05-23 12:40:41.000000000 +0200 +++ head/drivers/xen/xen-selfballoon.c 2012-02-08 13:03:38.000000000 +0100 @@ -79,6 +79,10 @@ #include <xen/tmem.h> diff --git a/patches.xen/xen3-patch-3.3 b/patches.xen/xen3-patch-3.3 index bed63b4cf1..95351fc56f 100644 --- a/patches.xen/xen3-patch-3.3 +++ b/patches.xen/xen3-patch-3.3 @@ -10,93 +10,8 @@ Acked-by: jbeulich@suse.com 3.4/arch/x86/include/mach-xen/asm/i387.h (moved to fpu-internal.h) ---- - arch/x86/ia32/ia32entry-xen.S | 390 +----------------------------- - arch/x86/include/asm/debugreg.h | 2 - arch/x86/include/mach-xen/asm/desc.h | 12 - arch/x86/include/mach-xen/asm/fixmap.h | 2 - arch/x86/include/mach-xen/asm/pci.h | 9 - arch/x86/include/mach-xen/asm/pgtable.h | 2 - arch/x86/include/mach-xen/asm/processor.h | 6 - arch/x86/include/mach-xen/asm/smp.h | 6 - arch/x86/include/mach-xen/asm/spinlock.h | 13 - - arch/x86/include/mach-xen/asm/xor_64.h | 6 - arch/x86/kernel/apic/io_apic-xen.c | 6 - arch/x86/kernel/cpu/common-xen.c | 49 +++ - arch/x86/kernel/cpu/mcheck/mce-inject.c | 2 - arch/x86/kernel/e820-xen.c | 137 ++++------ - arch/x86/kernel/early_printk-xen.c | 4 - arch/x86/kernel/entry_32-xen.S | 77 ++--- - arch/x86/kernel/entry_64-xen.S | 66 +++-- - arch/x86/kernel/head-xen.c | 11 - arch/x86/kernel/head32-xen.c | 7 - arch/x86/kernel/head64-xen.c | 5 - arch/x86/kernel/irq-xen.c | 13 - - arch/x86/kernel/microcode_core-xen.c | 13 - - arch/x86/kernel/mpparse-xen.c | 12 - arch/x86/kernel/pci-dma-xen.c | 11 - arch/x86/kernel/process-xen.c | 2 - arch/x86/kernel/process_32-xen.c | 50 --- - arch/x86/kernel/process_64-xen.c | 62 +--- - arch/x86/kernel/setup-xen.c | 28 -- - arch/x86/kernel/smp-xen.c | 45 +++ - arch/x86/kernel/syscall_32-xen.c | 20 + - arch/x86/kernel/traps-xen.c | 65 ++--- - arch/x86/kernel/vsyscall_64-xen.c | 77 +++++ - arch/x86/mm/fault-xen.c | 26 +- - arch/x86/mm/init-xen.c | 29 ++ - arch/x86/mm/init_32-xen.c | 74 ++--- - arch/x86/mm/init_64-xen.c | 18 - - arch/x86/mm/pageattr-xen.c | 8 - drivers/acpi/osl.c | 4 - drivers/acpi/processor_core.c | 2 - drivers/acpi/processor_driver.c | 4 - drivers/acpi/processor_perflib.c | 2 - drivers/pci/msi-xen.c | 261 +++++++++++++++++--- - drivers/xen/Kconfig | 7 - drivers/xen/Makefile | 5 - drivers/xen/balloon/balloon.c | 29 -- - drivers/xen/balloon/sysfs.c | 86 +++--- - drivers/xen/blkback/blkback.c | 13 - - drivers/xen/blkback/common.h | 7 - drivers/xen/blkback/vbd.c | 3 - drivers/xen/blkback/xenbus.c | 55 +--- - drivers/xen/blkfront/blkfront.c | 20 + - drivers/xen/blkfront/block.h | 3 - drivers/xen/blkfront/vbd.c | 4 - drivers/xen/blktap/blktap.c | 2 - drivers/xen/blktap2-new/device.c | 2 - drivers/xen/blktap2-new/sysfs.c | 2 - drivers/xen/blktap2/device.c | 2 - drivers/xen/blktap2/sysfs.c | 2 - drivers/xen/console/console.c | 2 - drivers/xen/core/cpu_hotplug.c | 6 - drivers/xen/core/evtchn.c | 2 - drivers/xen/core/smpboot.c | 1 - drivers/xen/core/spinlock.c | 4 - drivers/xen/netback/interface.c | 3 - drivers/xen/netback/netback.c | 4 - drivers/xen/netfront/netfront.c | 18 - - drivers/xen/pcifront/xenbus.c | 4 - drivers/xen/xen-pciback/pci_stub.c | 2 - drivers/xen/xenbus/Makefile | 7 - drivers/xen/xenbus/xenbus_client.c | 197 ++++++++++++--- - drivers/xen/xenbus/xenbus_comms.h | 4 - drivers/xen/xenbus/xenbus_dev_backend.c | 4 - drivers/xen/xenbus/xenbus_probe.c | 6 - drivers/xen/xenbus/xenbus_probe.h | 2 - include/xen/balloon.h | 6 - include/xen/blkif.h | 8 - include/xen/evtchn.h | 1 - include/xen/interface/grant_table.h | 12 - include/xen/interface/io/blkif.h | 25 + - lib/swiotlb-xen.c | 4 - 80 files changed, 1155 insertions(+), 1047 deletions(-) - -Index: linux-3.4-rc6-master/arch/x86/ia32/ia32entry-xen.S -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/ia32/ia32entry-xen.S -+++ linux-3.4-rc6-master/arch/x86/ia32/ia32entry-xen.S +--- head.orig/arch/x86/ia32/ia32entry-xen.S 2011-11-17 15:56:06.000000000 +0100 ++++ head/arch/x86/ia32/ia32entry-xen.S 2012-02-09 12:46:23.000000000 +0100 @@ -14,6 +14,7 @@ #include <asm/segment.h> #include <asm/irqflags.h> @@ -571,10 +486,8 @@ Index: linux-3.4-rc6-master/arch/x86/ia32/ia32entry-xen.S - .quad compat_sys_process_vm_readv - .quad compat_sys_process_vm_writev -ia32_syscall_end: -Index: linux-3.4-rc6-master/arch/x86/include/asm/debugreg.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/asm/debugreg.h -+++ linux-3.4-rc6-master/arch/x86/include/asm/debugreg.h +--- head.orig/arch/x86/include/asm/debugreg.h 2012-05-23 12:40:41.000000000 +0200 ++++ head/arch/x86/include/asm/debugreg.h 2012-04-10 17:25:00.000000000 +0200 @@ -168,7 +168,7 @@ extern void aout_dump_debugregs(struct u extern void hw_breakpoint_restore(void); @@ -584,10 +497,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/asm/debugreg.h DECLARE_PER_CPU(int, debug_stack_usage); static inline void debug_stack_usage_inc(void) { -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/desc.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/desc.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/desc.h +--- head.orig/arch/x86/include/mach-xen/asm/desc.h 2011-09-08 16:54:08.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/desc.h 2012-02-09 12:32:50.000000000 +0100 @@ -36,6 +36,8 @@ static inline void fill_ldt(struct desc_ #ifndef CONFIG_X86_NO_IDT extern struct desc_ptr idt_descr; @@ -614,10 +525,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/desc.h static inline void _set_gate(int gate, unsigned type, void *addr, unsigned dpl, unsigned ist, unsigned seg) { -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/fixmap.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/fixmap.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/fixmap.h +--- head.orig/arch/x86/include/mach-xen/asm/fixmap.h 2011-09-08 16:54:08.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/fixmap.h 2012-02-09 12:32:50.000000000 +0100 @@ -124,7 +124,7 @@ enum fixed_addresses { #endif FIX_TEXT_POKE1, /* reserve 2 pages for text_poke() */ @@ -627,10 +536,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/fixmap.h FIX_LNW_VRTC, #endif __end_of_permanent_fixed_addresses, -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/pci.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/pci.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/pci.h +--- head.orig/arch/x86/include/mach-xen/asm/pci.h 2011-07-01 15:19:34.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/pci.h 2012-02-09 12:32:50.000000000 +0100 @@ -118,19 +118,28 @@ static inline void x86_teardown_msi_irq( { x86_msi.teardown_msi_irq(irq); @@ -660,10 +567,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/pci.h #endif #define PCI_DMA_BUS_IS_PHYS 0 -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/pgtable.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/pgtable.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/pgtable.h +--- head.orig/arch/x86/include/mach-xen/asm/pgtable.h 2011-03-23 10:10:00.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/pgtable.h 2012-02-09 12:32:50.000000000 +0100 @@ -738,7 +738,7 @@ static inline void ptep_set_wrprotect(st set_pte_at(mm, addr, ptep, pte_wrprotect(pte)); } @@ -673,10 +578,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/pgtable.h #define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot)) -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/processor.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/processor.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/processor.h +--- head.orig/arch/x86/include/mach-xen/asm/processor.h 2011-11-17 16:53:30.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/processor.h 2012-02-29 10:59:05.000000000 +0100 @@ -109,7 +109,7 @@ struct cpuinfo_x86 { u16 initial_apicid; #endif @@ -706,10 +609,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/processor.h union thread_xstate *state; }; -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/smp.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/smp.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/smp.h +--- head.orig/arch/x86/include/mach-xen/asm/smp.h 2011-04-13 17:01:31.000000000 +0200 ++++ head/arch/x86/include/mach-xen/asm/smp.h 2012-02-09 12:32:50.000000000 +0100 @@ -231,5 +231,11 @@ extern int hard_smp_processor_id(void); #endif /* CONFIG_X86_LOCAL_APIC */ @@ -722,10 +623,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/smp.h + #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_SMP_H */ -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/spinlock.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/spinlock.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/spinlock.h +--- head.orig/arch/x86/include/mach-xen/asm/spinlock.h 2012-02-01 09:13:39.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/spinlock.h 2012-02-09 12:49:39.000000000 +0100 @@ -137,19 +137,8 @@ static __always_inline void __ticket_spi { register struct __raw_tickets new; @@ -747,10 +646,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/spinlock.h # undef UNLOCK_LOCK_PREFIX #endif new = ACCESS_ONCE(lock->tickets); -Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/xor_64.h -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/include/mach-xen/asm/xor_64.h -+++ linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/xor_64.h +--- head.orig/arch/x86/include/mach-xen/asm/xor_64.h 2011-02-01 14:39:24.000000000 +0100 ++++ head/arch/x86/include/mach-xen/asm/xor_64.h 2012-02-21 13:49:31.000000000 +0100 @@ -1,6 +1,8 @@ #ifndef _ASM_X86_XOR_64_H #define _ASM_X86_XOR_64_H @@ -778,10 +675,8 @@ Index: linux-3.4-rc6-master/arch/x86/include/mach-xen/asm/xor_64.h stts(); \ preempt_enable(); \ } while (0) -Index: linux-3.4-rc6-master/arch/x86/kernel/apic/io_apic-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/apic/io_apic-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/apic/io_apic-xen.c +--- head.orig/arch/x86/kernel/apic/io_apic-xen.c 2011-11-28 10:08:44.000000000 +0100 ++++ head/arch/x86/kernel/apic/io_apic-xen.c 2012-02-09 12:32:50.000000000 +0100 @@ -2502,8 +2502,8 @@ asmlinkage void smp_irq_move_cleanup_int unsigned vector, me; @@ -803,10 +698,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/apic/io_apic-xen.c panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a " "report. Then try booting with the 'noapic' option.\n"); out: -Index: linux-3.4-rc6-master/arch/x86/kernel/cpu/common-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/cpu/common-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/cpu/common-xen.c +--- head.orig/arch/x86/kernel/cpu/common-xen.c 2011-11-17 15:56:06.000000000 +0100 ++++ head/arch/x86/kernel/cpu/common-xen.c 2012-04-20 15:15:12.000000000 +0200 @@ -711,9 +711,7 @@ static void __init early_identify_cpu(st if (this_cpu->c_early_init) this_cpu->c_early_init(c); @@ -911,10 +804,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/cpu/common-xen.c } } -Index: linux-3.4-rc6-master/arch/x86/kernel/cpu/mcheck/mce-inject.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/cpu/mcheck/mce-inject.c -+++ linux-3.4-rc6-master/arch/x86/kernel/cpu/mcheck/mce-inject.c +--- head.orig/arch/x86/kernel/cpu/mcheck/mce-inject.c 2012-02-08 12:15:59.000000000 +0100 ++++ head/arch/x86/kernel/cpu/mcheck/mce-inject.c 2012-02-16 17:51:33.000000000 +0100 @@ -93,6 +93,7 @@ static int mce_raise_notify(unsigned int return NMI_HANDLED; } @@ -931,10 +822,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/cpu/mcheck/mce-inject.c /* Inject mce on current CPU */ static int raise_local(void) -Index: linux-3.4-rc6-master/arch/x86/kernel/e820-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/e820-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/e820-xen.c +--- head.orig/arch/x86/kernel/e820-xen.c 2011-12-21 12:00:26.000000000 +0100 ++++ head/arch/x86/kernel/e820-xen.c 2012-02-16 17:12:00.000000000 +0100 @@ -19,6 +19,7 @@ #include <linux/acpi.h> #include <linux/firmware-map.h> @@ -1169,10 +1058,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/e820-xen.c + set_dma_reserve(nr_pages - nr_free_pages); #endif } -Index: linux-3.4-rc6-master/arch/x86/kernel/early_printk-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/early_printk-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/early_printk-xen.c +--- head.orig/arch/x86/kernel/early_printk-xen.c 2011-02-01 15:41:35.000000000 +0100 ++++ head/arch/x86/kernel/early_printk-xen.c 2012-02-09 12:32:50.000000000 +0100 @@ -272,14 +272,14 @@ static int __init setup_early_printk(cha if (!strncmp(buf, "xen", 3)) early_console_register(&xenboot_console, keep); @@ -1190,10 +1077,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/early_printk-xen.c early_console_register(&early_hsu_console, keep); } #endif -Index: linux-3.4-rc6-master/arch/x86/kernel/entry_32-xen.S -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/entry_32-xen.S -+++ linux-3.4-rc6-master/arch/x86/kernel/entry_32-xen.S +--- head.orig/arch/x86/kernel/entry_32-xen.S 2012-02-29 14:20:19.000000000 +0100 ++++ head/arch/x86/kernel/entry_32-xen.S 2012-02-29 14:23:02.000000000 +0100 @@ -42,6 +42,7 @@ */ @@ -1415,10 +1300,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/entry_32-xen.S #endif /* TIF_CSTAR */ /* -Index: linux-3.4-rc6-master/arch/x86/kernel/entry_64-xen.S -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/entry_64-xen.S -+++ linux-3.4-rc6-master/arch/x86/kernel/entry_64-xen.S +--- head.orig/arch/x86/kernel/entry_64-xen.S 2011-11-17 15:56:06.000000000 +0100 ++++ head/arch/x86/kernel/entry_64-xen.S 2012-02-10 08:50:41.000000000 +0100 @@ -58,6 +58,7 @@ #include <asm/processor-flags.h> #include <asm/ftrace.h> @@ -1585,10 +1468,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/entry_64-xen.S RESTORE_REST DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF -Index: linux-3.4-rc6-master/arch/x86/kernel/head-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/head-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/head-xen.c +--- head.orig/arch/x86/kernel/head-xen.c 2012-02-08 16:16:55.000000000 +0100 ++++ head/arch/x86/kernel/head-xen.c 2012-02-09 17:46:13.000000000 +0100 @@ -54,7 +54,7 @@ void __init reserve_ebda_region(void) lowmem = 0x9f000; @@ -1614,10 +1495,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/head-xen.c #ifdef CONFIG_X86_32 { -Index: linux-3.4-rc6-master/arch/x86/kernel/head32-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/head32-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/head32-xen.c +--- head.orig/arch/x86/kernel/head32-xen.c 2011-07-01 15:19:34.000000000 +0200 ++++ head/arch/x86/kernel/head32-xen.c 2012-02-09 12:32:50.000000000 +0100 @@ -47,9 +47,8 @@ void __init i386_start_kernel(void) BUG_ON(pte_index(hypervisor_virt_start)); #endif @@ -1639,10 +1518,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/head32-xen.c } #endif -Index: linux-3.4-rc6-master/arch/x86/kernel/head64-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/head64-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/head64-xen.c +--- head.orig/arch/x86/kernel/head64-xen.c 2011-04-12 15:59:10.000000000 +0200 ++++ head/arch/x86/kernel/head64-xen.c 2012-02-09 12:32:50.000000000 +0100 @@ -117,9 +117,8 @@ void __init x86_64_start_reservations(ch { copy_bootdata(__va(real_mode_data)); @@ -1655,10 +1532,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/head64-xen.c /* * At this point everything still needed from the boot loader -Index: linux-3.4-rc6-master/arch/x86/kernel/irq-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/irq-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/irq-xen.c +--- head.orig/arch/x86/kernel/irq-xen.c 2011-11-17 15:56:06.000000000 +0100 ++++ head/arch/x86/kernel/irq-xen.c 2012-02-09 12:32:50.000000000 +0100 @@ -78,6 +78,12 @@ int arch_show_interrupts(struct seq_file for_each_online_cpu(j) seq_printf(p, "%10u ", irq_stats(j)->apic_irq_work_irqs); @@ -1703,11 +1578,37 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/irq-xen.c inc_irq_stat(x86_platform_ipis); if (x86_platform_ipi_callback) -Index: linux-3.4-rc6-master/arch/x86/kernel/microcode_core-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/microcode_core-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/microcode_core-xen.c -@@ -186,16 +186,21 @@ static int request_microcode(const char +--- head.orig/arch/x86/kernel/irq_64.c 2012-03-19 00:15:34.000000000 +0100 ++++ head/arch/x86/kernel/irq_64.c 2012-05-11 10:57:43.000000000 +0200 +@@ -39,7 +39,9 @@ static inline void stack_overflow_check( + { + #ifdef CONFIG_DEBUG_STACKOVERFLOW + #define STACK_TOP_MARGIN 128 ++#ifndef CONFIG_X86_NO_TSS + struct orig_ist *oist; ++#endif + u64 irq_stack_top, irq_stack_bottom; + u64 estack_top, estack_bottom; + u64 curbase = (u64)task_stack_page(current); +@@ -58,11 +60,15 @@ static inline void stack_overflow_check( + if (regs->sp >= irq_stack_top && regs->sp <= irq_stack_bottom) + return; + ++#ifndef CONFIG_X86_NO_TSS + oist = &__get_cpu_var(orig_ist); + estack_top = (u64)oist->ist[0] - EXCEPTION_STKSZ + STACK_TOP_MARGIN; + estack_bottom = (u64)oist->ist[N_EXCEPTION_STACKS - 1]; + if (regs->sp >= estack_top && regs->sp <= estack_bottom) + return; ++#else ++ estack_top = estack_bottom = 0; ++#endif + + WARN_ONCE(1, "do_IRQ(): %s has overflown the kernel stack (cur:%Lx,sp:%lx,irq stk top-bottom:%Lx-%Lx,exception stk top-bottom:%Lx-%Lx)\n", + current->comm, curbase, regs->sp, +--- head.orig/arch/x86/kernel/microcode_core-xen.c 2011-12-01 15:28:13.000000000 +0100 ++++ head/arch/x86/kernel/microcode_core-xen.c 2012-02-09 14:22:00.000000000 +0100 +@@ -186,16 +186,21 @@ static int request_microcode(const char static int __init microcode_init(void) { const struct cpuinfo_x86 *c = &boot_cpu_data; @@ -1733,10 +1634,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/microcode_core-xen.c pr_err("no support for this CPU vendor\n"); return -ENODEV; } -Index: linux-3.4-rc6-master/arch/x86/kernel/mpparse-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/mpparse-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/mpparse-xen.c +--- head.orig/arch/x86/kernel/mpparse-xen.c 2011-12-21 11:56:23.000000000 +0100 ++++ head/arch/x86/kernel/mpparse-xen.c 2012-02-09 12:32:50.000000000 +0100 @@ -591,9 +591,7 @@ void __init default_get_smp_config(unsig #ifndef CONFIG_XEN static void __init smp_reserve_memory(struct mpf_intel *mpf) @@ -1770,10 +1669,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/mpparse-xen.c } static int __init update_mp_table(void) -Index: linux-3.4-rc6-master/arch/x86/kernel/pci-dma-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/pci-dma-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/pci-dma-xen.c +--- head.orig/arch/x86/kernel/pci-dma-xen.c 2012-04-04 14:32:31.000000000 +0200 ++++ head/arch/x86/kernel/pci-dma-xen.c 2012-04-04 14:32:53.000000000 +0200 @@ -42,6 +42,15 @@ int iommu_detected __read_mostly = 0; * guests and not for driver dma translation. */ @@ -1799,10 +1696,8 @@ Index: linux-3.4-rc6-master/arch/x86/kernel/pci-dma-xen.c gart_parse_options(p); #endif -Index: linux-3.4-rc6-master/arch/x86/kernel/process-xen.c -=================================================================== ---- linux-3.4-rc6-master.orig/arch/x86/kernel/process-xen.c -+++ linux-3.4-rc6-master/arch/x86/kernel/process-xen.c +--- head.orig/arch/x86/kernel/process-xen.c 2011-12-21 11:59:08.000000000 +0100 ++++ head/arch/x86/kernel/process-xen.c 2012-02-09 12:32:50.000000000 +0100 @@ -280,7 +280,7 @@ int kernel_threa |