aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/xen/enlighten.c20
-rw-r--r--arch/x86/xen/irq.c2
-rw-r--r--arch/x86/xen/mmu.c34
-rw-r--r--arch/x86/xen/setup.c4
-rw-r--r--arch/x86/xen/smp.c8
-rw-r--r--arch/x86/xen/time.c8
-rw-r--r--arch/x86/xen/xen-ops.h2
-rw-r--r--drivers/xen/Makefile24
-rw-r--r--drivers/xen/balloon.c25
-rw-r--r--drivers/xen/sys-hypervisor.c2
10 files changed, 63 insertions, 66 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index e3c6a06cf725..dd7b88f2ec7a 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -235,7 +235,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
235 *dx &= maskedx; 235 *dx &= maskedx;
236} 236}
237 237
238static __init void xen_init_cpuid_mask(void) 238static void __init xen_init_cpuid_mask(void)
239{ 239{
240 unsigned int ax, bx, cx, dx; 240 unsigned int ax, bx, cx, dx;
241 unsigned int xsave_mask; 241 unsigned int xsave_mask;
@@ -400,7 +400,7 @@ static void xen_load_gdt(const struct desc_ptr *dtr)
400/* 400/*
401 * load_gdt for early boot, when the gdt is only mapped once 401 * load_gdt for early boot, when the gdt is only mapped once
402 */ 402 */
403static __init void xen_load_gdt_boot(const struct desc_ptr *dtr) 403static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
404{ 404{
405 unsigned long va = dtr->address; 405 unsigned long va = dtr->address;
406 unsigned int size = dtr->size + 1; 406 unsigned int size = dtr->size + 1;
@@ -662,7 +662,7 @@ static void xen_write_gdt_entry(struct desc_struct *dt, int entry,
662 * Version of write_gdt_entry for use at early boot-time needed to 662 * Version of write_gdt_entry for use at early boot-time needed to
663 * update an entry as simply as possible. 663 * update an entry as simply as possible.
664 */ 664 */
665static __init void xen_write_gdt_entry_boot(struct desc_struct *dt, int entry, 665static void __init xen_write_gdt_entry_boot(struct desc_struct *dt, int entry,
666 const void *desc, int type) 666 const void *desc, int type)
667{ 667{
668 switch (type) { 668 switch (type) {
@@ -933,18 +933,18 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
933 return ret; 933 return ret;
934} 934}
935 935
936static const struct pv_info xen_info __initdata = { 936static const struct pv_info xen_info __initconst = {
937 .paravirt_enabled = 1, 937 .paravirt_enabled = 1,
938 .shared_kernel_pmd = 0, 938 .shared_kernel_pmd = 0,
939 939
940 .name = "Xen", 940 .name = "Xen",
941}; 941};
942 942
943static const struct pv_init_ops xen_init_ops __initdata = { 943static const struct pv_init_ops xen_init_ops __initconst = {
944 .patch = xen_patch, 944 .patch = xen_patch,
945}; 945};
946 946
947static const struct pv_cpu_ops xen_cpu_ops __initdata = { 947static const struct pv_cpu_ops xen_cpu_ops __initconst = {
948 .cpuid = xen_cpuid, 948 .cpuid = xen_cpuid,
949 949
950 .set_debugreg = xen_set_debugreg, 950 .set_debugreg = xen_set_debugreg,
@@ -1004,7 +1004,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
1004 .end_context_switch = xen_end_context_switch, 1004 .end_context_switch = xen_end_context_switch,
1005}; 1005};
1006 1006
1007static const struct pv_apic_ops xen_apic_ops __initdata = { 1007static const struct pv_apic_ops xen_apic_ops __initconst = {
1008#ifdef CONFIG_X86_LOCAL_APIC 1008#ifdef CONFIG_X86_LOCAL_APIC
1009 .startup_ipi_hook = paravirt_nop, 1009 .startup_ipi_hook = paravirt_nop,
1010#endif 1010#endif
@@ -1055,7 +1055,7 @@ int xen_panic_handler_init(void)
1055 return 0; 1055 return 0;
1056} 1056}
1057 1057
1058static const struct machine_ops __initdata xen_machine_ops = { 1058static const struct machine_ops xen_machine_ops __initconst = {
1059 .restart = xen_restart, 1059 .restart = xen_restart,
1060 .halt = xen_machine_halt, 1060 .halt = xen_machine_halt,
1061 .power_off = xen_machine_halt, 1061 .power_off = xen_machine_halt,
@@ -1332,7 +1332,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
1332 return NOTIFY_OK; 1332 return NOTIFY_OK;
1333} 1333}
1334 1334
1335static struct notifier_block __cpuinitdata xen_hvm_cpu_notifier = { 1335static struct notifier_block xen_hvm_cpu_notifier __cpuinitdata = {
1336 .notifier_call = xen_hvm_cpu_notify, 1336 .notifier_call = xen_hvm_cpu_notify,
1337}; 1337};
1338 1338
@@ -1381,7 +1381,7 @@ bool xen_hvm_need_lapic(void)
1381} 1381}
1382EXPORT_SYMBOL_GPL(xen_hvm_need_lapic); 1382EXPORT_SYMBOL_GPL(xen_hvm_need_lapic);
1383 1383
1384const __refconst struct hypervisor_x86 x86_hyper_xen_hvm = { 1384const struct hypervisor_x86 x86_hyper_xen_hvm __refconst = {
1385 .name = "Xen HVM", 1385 .name = "Xen HVM",
1386 .detect = xen_hvm_platform, 1386 .detect = xen_hvm_platform,
1387 .init_platform = xen_hvm_guest_init, 1387 .init_platform = xen_hvm_guest_init,
diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
index 6a6fe8939645..8bbb465b6f0a 100644
--- a/arch/x86/xen/irq.c
+++ b/arch/x86/xen/irq.c
@@ -113,7 +113,7 @@ static void xen_halt(void)
113 xen_safe_halt(); 113 xen_safe_halt();
114} 114}
115 115
116static const struct pv_irq_ops xen_irq_ops __initdata = { 116static const struct pv_irq_ops xen_irq_ops __initconst = {
117 .save_fl = PV_CALLEE_SAVE(xen_save_fl), 117 .save_fl = PV_CALLEE_SAVE(xen_save_fl),
118 .restore_fl = PV_CALLEE_SAVE(xen_restore_fl), 118 .restore_fl = PV_CALLEE_SAVE(xen_restore_fl),
119 .irq_disable = PV_CALLEE_SAVE(xen_irq_disable), 119 .irq_disable = PV_CALLEE_SAVE(xen_irq_disable),
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 0684f3c74d53..b5f776f60b1b 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1054,7 +1054,7 @@ void xen_mm_pin_all(void)
1054 * that's before we have page structures to store the bits. So do all 1054 * that's before we have page structures to store the bits. So do all
1055 * the book-keeping now. 1055 * the book-keeping now.
1056 */ 1056 */
1057static __init int xen_mark_pinned(struct mm_struct *mm, struct page *page, 1057static int __init xen_mark_pinned(struct mm_struct *mm, struct page *page,
1058 enum pt_level level) 1058 enum pt_level level)
1059{ 1059{
1060 SetPagePinned(page); 1060 SetPagePinned(page);
@@ -1271,7 +1271,7 @@ void xen_exit_mmap(struct mm_struct *mm)
1271 spin_unlock(&mm->page_table_lock); 1271 spin_unlock(&mm->page_table_lock);
1272} 1272}
1273 1273
1274static __init void xen_pagetable_setup_start(pgd_t *base) 1274static void __init xen_pagetable_setup_start(pgd_t *base)
1275{ 1275{
1276} 1276}
1277 1277
@@ -1291,7 +1291,7 @@ static __init void xen_mapping_pagetable_reserve(u64 start, u64 end)
1291 1291
1292static void xen_post_allocator_init(void); 1292static void xen_post_allocator_init(void);
1293 1293
1294static __init void xen_pagetable_setup_done(pgd_t *base) 1294static void __init xen_pagetable_setup_done(pgd_t *base)
1295{ 1295{
1296 xen_setup_shared_info(); 1296 xen_setup_shared_info();
1297 xen_post_allocator_init(); 1297 xen_post_allocator_init();
@@ -1488,7 +1488,7 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)
1488} 1488}
1489 1489
1490#ifdef CONFIG_X86_32 1490#ifdef CONFIG_X86_32
1491static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) 1491static pte_t __init mask_rw_pte(pte_t *ptep, pte_t pte)
1492{ 1492{
1493 /* If there's an existing pte, then don't allow _PAGE_RW to be set */ 1493 /* If there's an existing pte, then don't allow _PAGE_RW to be set */
1494 if (pte_val_ma(*ptep) & _PAGE_PRESENT) 1494 if (pte_val_ma(*ptep) & _PAGE_PRESENT)
@@ -1498,7 +1498,7 @@ static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte)
1498 return pte; 1498 return pte;
1499} 1499}
1500#else /* CONFIG_X86_64 */ 1500#else /* CONFIG_X86_64 */
1501static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) 1501static pte_t __init mask_rw_pte(pte_t *ptep, pte_t pte)
1502{ 1502{
1503 unsigned long pfn = pte_pfn(pte); 1503 unsigned long pfn = pte_pfn(pte);
1504 1504
@@ -1519,7 +1519,7 @@ static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte)
1519 1519
1520/* Init-time set_pte while constructing initial pagetables, which 1520/* Init-time set_pte while constructing initial pagetables, which
1521 doesn't allow RO pagetable pages to be remapped RW */ 1521 doesn't allow RO pagetable pages to be remapped RW */
1522static __init void xen_set_pte_init(pte_t *ptep, pte_t pte) 1522static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
1523{ 1523{
1524 pte = mask_rw_pte(ptep, pte); 1524 pte = mask_rw_pte(ptep, pte);
1525 1525
@@ -1537,7 +1537,7 @@ static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
1537 1537
1538/* Early in boot, while setting up the initial pagetable, assume 1538/* Early in boot, while setting up the initial pagetable, assume
1539 everything is pinned. */ 1539 everything is pinned. */
1540static __init void xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn) 1540static void __init xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn)
1541{ 1541{
1542#ifdef CONFIG_FLATMEM 1542#ifdef CONFIG_FLATMEM
1543 BUG_ON(mem_map); /* should only be used early */ 1543 BUG_ON(mem_map); /* should only be used early */
@@ -1547,7 +1547,7 @@ static __init void xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn)
1547} 1547}
1548 1548
1549/* Used for pmd and pud */ 1549/* Used for pmd and pud */
1550static __init void xen_alloc_pmd_init(struct mm_struct *mm, unsigned long pfn) 1550static void __init xen_alloc_pmd_init(struct mm_struct *mm, unsigned long pfn)
1551{ 1551{
1552#ifdef CONFIG_FLATMEM 1552#ifdef CONFIG_FLATMEM
1553 BUG_ON(mem_map); /* should only be used early */ 1553 BUG_ON(mem_map); /* should only be used early */
@@ -1557,13 +1557,13 @@ static __init void xen_alloc_pmd_init(struct mm_struct *mm, unsigned long pfn)
1557 1557
1558/* Early release_pte assumes that all pts are pinned, since there's 1558/* Early release_pte assumes that all pts are pinned, since there's
1559 only init_mm and anything attached to that is pinned. */ 1559 only init_mm and anything attached to that is pinned. */
1560static __init void xen_release_pte_init(unsigned long pfn) 1560static void __init xen_release_pte_init(unsigned long pfn)
1561{ 1561{
1562 pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn); 1562 pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn);
1563 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn))); 1563 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
1564} 1564}
1565 1565
1566static __init void xen_release_pmd_init(unsigned long pfn) 1566static void __init xen_release_pmd_init(unsigned long pfn)
1567{ 1567{
1568 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn))); 1568 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
1569} 1569}
@@ -1689,7 +1689,7 @@ static void set_page_prot(void *addr, pgprot_t prot)
1689 BUG(); 1689 BUG();
1690} 1690}
1691 1691
1692static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) 1692static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
1693{ 1693{
1694 unsigned pmdidx, pteidx; 1694 unsigned pmdidx, pteidx;
1695 unsigned ident_pte; 1695 unsigned ident_pte;
@@ -1772,7 +1772,7 @@ static void convert_pfn_mfn(void *v)
1772 * of the physical mapping once some sort of allocator has been set 1772 * of the physical mapping once some sort of allocator has been set
1773 * up. 1773 * up.
1774 */ 1774 */
1775__init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, 1775pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd,
1776 unsigned long max_pfn) 1776 unsigned long max_pfn)
1777{ 1777{
1778 pud_t *l3; 1778 pud_t *l3;
@@ -1843,7 +1843,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
1843static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD); 1843static RESERVE_BRK_ARRAY(pmd_t, initial_kernel_pmd, PTRS_PER_PMD);
1844static RESERVE_BRK_ARRAY(pmd_t, swapper_kernel_pmd, PTRS_PER_PMD); 1844static RESERVE_BRK_ARRAY(pmd_t, swapper_kernel_pmd, PTRS_PER_PMD);
1845 1845
1846static __init void xen_write_cr3_init(unsigned long cr3) 1846static void __init xen_write_cr3_init(unsigned long cr3)
1847{ 1847{
1848 unsigned long pfn = PFN_DOWN(__pa(swapper_pg_dir)); 1848 unsigned long pfn = PFN_DOWN(__pa(swapper_pg_dir));
1849 1849
@@ -1880,7 +1880,7 @@ static __init void xen_write_cr3_init(unsigned long cr3)
1880 pv_mmu_ops.write_cr3 = &xen_write_cr3; 1880 pv_mmu_ops.write_cr3 = &xen_write_cr3;
1881} 1881}
1882 1882
1883__init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, 1883pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd,
1884 unsigned long max_pfn) 1884 unsigned long max_pfn)
1885{ 1885{
1886 pmd_t *kernel_pmd; 1886 pmd_t *kernel_pmd;
@@ -1986,7 +1986,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
1986#endif 1986#endif
1987} 1987}
1988 1988
1989__init void xen_ident_map_ISA(void) 1989void __init xen_ident_map_ISA(void)
1990{ 1990{
1991 unsigned long pa; 1991 unsigned long pa;
1992 1992
@@ -2009,7 +2009,7 @@ __init void xen_ident_map_ISA(void)
2009 xen_flush_tlb(); 2009 xen_flush_tlb();
2010} 2010}
2011 2011
2012static __init void xen_post_allocator_init(void) 2012static void __init xen_post_allocator_init(void)
2013{ 2013{
2014#ifdef CONFIG_XEN_DEBUG 2014#ifdef CONFIG_XEN_DEBUG
2015 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug); 2015 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug);
@@ -2046,7 +2046,7 @@ static void xen_leave_lazy_mmu(void)
2046 preempt_enable(); 2046 preempt_enable();
2047} 2047}
2048 2048
2049static const struct pv_mmu_ops xen_mmu_ops __initdata = { 2049static const struct pv_mmu_ops xen_mmu_ops __initconst = {
2050 .read_cr2 = xen_read_cr2, 2050 .read_cr2 = xen_read_cr2,
2051 .write_cr2 = xen_write_cr2, 2051 .write_cr2 = xen_write_cr2,
2052 2052
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 90bac0aac3a5..d3663df2f967 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -50,7 +50,7 @@ phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
50 */ 50 */
51#define EXTRA_MEM_RATIO (10) 51#define EXTRA_MEM_RATIO (10)
52 52
53static __init void xen_add_extra_mem(unsigned long pages) 53static void __init xen_add_extra_mem(unsigned long pages)
54{ 54{
55 unsigned long pfn; 55 unsigned long pfn;
56 56
@@ -336,7 +336,7 @@ static void __init fiddle_vdso(void)
336#endif 336#endif
337} 337}
338 338
339static __cpuinit int register_callback(unsigned type, const void *func) 339static int __cpuinit register_callback(unsigned type, const void *func)
340{ 340{
341 struct callback_register callback = { 341 struct callback_register callback = {
342 .type = type, 342 .type = type,
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 30612441ed99..194a3edef5cb 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -57,7 +57,7 @@ static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
57 return IRQ_HANDLED; 57 return IRQ_HANDLED;
58} 58}
59 59
60static __cpuinit void cpu_bringup(void) 60static void __cpuinit cpu_bringup(void)
61{ 61{
62 int cpu = smp_processor_id(); 62 int cpu = smp_processor_id();
63 63
@@ -85,7 +85,7 @@ static __cpuinit void cpu_bringup(void)
85 wmb(); /* make sure everything is out */ 85 wmb(); /* make sure everything is out */
86} 86}
87 87
88static __cpuinit void cpu_bringup_and_idle(void) 88static void __cpuinit cpu_bringup_and_idle(void)
89{ 89{
90 cpu_bringup(); 90 cpu_bringup();
91 cpu_idle(); 91 cpu_idle();
@@ -242,7 +242,7 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
242 } 242 }
243} 243}
244 244
245static __cpuinit int 245static int __cpuinit
246cpu_initialize_context(unsigned int cpu, struct task_struct *idle) 246cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
247{ 247{
248 struct vcpu_guest_context *ctxt; 248 struct vcpu_guest_context *ctxt;
@@ -486,7 +486,7 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
486 return IRQ_HANDLED; 486 return IRQ_HANDLED;
487} 487}
488 488
489static const struct smp_ops xen_smp_ops __initdata = { 489static const struct smp_ops xen_smp_ops __initconst = {
490 .smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu, 490 .smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
491 .smp_prepare_cpus = xen_smp_prepare_cpus, 491 .smp_prepare_cpus = xen_smp_prepare_cpus,
492 .smp_cpus_done = xen_smp_cpus_done, 492 .smp_cpus_done = xen_smp_cpus_done,
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 2e2d370a47b1..bd4ffd7d9589 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -439,11 +439,11 @@ void xen_timer_resume(void)
439 } 439 }
440} 440}
441 441
442static const struct pv_time_ops xen_time_ops __initdata = { 442static const struct pv_time_ops xen_time_ops __initconst = {
443 .sched_clock = xen_clocksource_read, 443 .sched_clock = xen_clocksource_read,
444}; 444};
445 445
446static __init void xen_time_init(void) 446static void __init xen_time_init(void)
447{ 447{
448 int cpu = smp_processor_id(); 448 int cpu = smp_processor_id();
449 struct timespec tp; 449 struct timespec tp;
@@ -468,7 +468,7 @@ static __init void xen_time_init(void)
468 xen_setup_cpu_clockevents(); 468 xen_setup_cpu_clockevents();
469} 469}
470 470
471__init void xen_init_time_ops(void) 471void __init xen_init_time_ops(void)
472{ 472{
473 pv_time_ops = xen_time_ops; 473 pv_time_ops = xen_time_ops;
474 474
@@ -490,7 +490,7 @@ static void xen_hvm_setup_cpu_clockevents(void)
490 xen_setup_cpu_clockevents(); 490 xen_setup_cpu_clockevents();
491} 491}
492 492
493__init void xen_hvm_init_time_ops(void) 493void __init xen_hvm_init_time_ops(void)
494{ 494{
495 /* vector callback is needed otherwise we cannot receive interrupts 495 /* vector callback is needed otherwise we cannot receive interrupts
496 * on cpu > 0 and at this point we don't know how many cpus are 496 * on cpu > 0 and at this point we don't know how many cpus are
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 3112f55638c4..97dfdc8757b3 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -74,7 +74,7 @@ static inline void xen_hvm_smp_init(void) {}
74 74
75#ifdef CONFIG_PARAVIRT_SPINLOCKS 75#ifdef CONFIG_PARAVIRT_SPINLOCKS
76void __init xen_init_spinlocks(void); 76void __init xen_init_spinlocks(void);
77__cpuinit void xen_init_lock_cpu(int cpu); 77void __cpuinit xen_init_lock_cpu(int cpu);
78void xen_uninit_lock_cpu(int cpu); 78void xen_uninit_lock_cpu(int cpu);
79#else 79#else
80static inline void xen_init_spinlocks(void) 80static inline void xen_init_spinlocks(void)
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index f420f1ff7f13..4781f806701d 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -4,21 +4,21 @@ obj-y += xenbus/
4nostackp := $(call cc-option, -fno-stack-protector) 4nostackp := $(call cc-option, -fno-stack-protector)
5CFLAGS_features.o := $(nostackp) 5CFLAGS_features.o := $(nostackp)
6 6
7obj-$(CONFIG_BLOCK) += biomerge.o 7obj-$(CONFIG_BLOCK) += biomerge.o
8obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o 8obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o
9obj-$(CONFIG_XEN_XENCOMM) += xencomm.o 9obj-$(CONFIG_XEN_XENCOMM) += xencomm.o
10obj-$(CONFIG_XEN_BALLOON) += xen-balloon.o 10obj-$(CONFIG_XEN_BALLOON) += xen-balloon.o
11obj-$(CONFIG_XEN_DEV_EVTCHN) += xen-evtchn.o 11obj-$(CONFIG_XEN_DEV_EVTCHN) += xen-evtchn.o
12obj-$(CONFIG_XEN_GNTDEV) += xen-gntdev.o 12obj-$(CONFIG_XEN_GNTDEV) += xen-gntdev.o
13obj-$(CONFIG_XEN_GRANT_DEV_ALLOC) += xen-gntalloc.o 13obj-$(CONFIG_XEN_GRANT_DEV_ALLOC) += xen-gntalloc.o
14obj-$(CONFIG_XENFS) += xenfs/ 14obj-$(CONFIG_XENFS) += xenfs/
15obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o 15obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o
16obj-$(CONFIG_XEN_PLATFORM_PCI) += xen-platform-pci.o 16obj-$(CONFIG_XEN_PLATFORM_PCI) += xen-platform-pci.o
17obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o 17obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o
18obj-$(CONFIG_XEN_DOM0) += pci.o 18obj-$(CONFIG_XEN_DOM0) += pci.o
19 19
20xen-evtchn-y := evtchn.o 20xen-evtchn-y := evtchn.o
21xen-gntdev-y := gntdev.o 21xen-gntdev-y := gntdev.o
22xen-gntalloc-y := gntalloc.o 22xen-gntalloc-y := gntalloc.o
23 23
24xen-platform-pci-y := platform-pci.o 24xen-platform-pci-y := platform-pci.o
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 043af8ad6b60..f54290baa3db 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -114,7 +114,6 @@ static void __balloon_append(struct page *page)
114 if (PageHighMem(page)) { 114 if (PageHighMem(page)) {
115 list_add_tail(&page->lru, &ballooned_pages); 115 list_add_tail(&page->lru, &ballooned_pages);
116 balloon_stats.balloon_high++; 116 balloon_stats.balloon_high++;
117 dec_totalhigh_pages();
118 } else { 117 } else {
119 list_add(&page->lru, &ballooned_pages); 118 list_add(&page->lru, &ballooned_pages);
120 balloon_stats.balloon_low++; 119 balloon_stats.balloon_low++;
@@ -124,6 +123,8 @@ static void __balloon_append(struct page *page)
124static void balloon_append(struct page *page) 123static void balloon_append(struct page *page)
125{ 124{
126 __balloon_append(page); 125 __balloon_append(page);
126 if (PageHighMem(page))
127 dec_totalhigh_pages();
127 totalram_pages--; 128 totalram_pages--;
128} 129}
129 130
@@ -193,7 +194,7 @@ static enum bp_state update_schedule(enum bp_state state)
193 return BP_EAGAIN; 194 return BP_EAGAIN;
194} 195}
195 196
196static unsigned long current_target(void) 197static long current_credit(void)
197{ 198{
198 unsigned long target = balloon_stats.target_pages; 199 unsigned long target = balloon_stats.target_pages;
199 200
@@ -202,7 +203,7 @@ static unsigned long current_target(void)
202 balloon_stats.balloon_low + 203 balloon_stats.balloon_low +
203 balloon_stats.balloon_high); 204 balloon_stats.balloon_high);
204 205
205 return target; 206 return target - balloon_stats.current_pages;
206} 207}
207 208
208static enum bp_state increase_reservation(unsigned long nr_pages) 209static enum bp_state increase_reservation(unsigned long nr_pages)
@@ -246,7 +247,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
246 set_phys_to_machine(pfn, frame_list[i]); 247 set_phys_to_machine(pfn, frame_list[i]);
247 248
248 /* Link back into the page tables if not highmem. */ 249 /* Link back into the page tables if not highmem. */
249 if (!xen_hvm_domain() && pfn < max_low_pfn) { 250 if (xen_pv_domain() && !PageHighMem(page)) {
250 int ret; 251 int ret;
251 ret = HYPERVISOR_update_va_mapping( 252 ret = HYPERVISOR_update_va_mapping(
252 (unsigned long)__va(pfn << PAGE_SHIFT), 253 (unsigned long)__va(pfn << PAGE_SHIFT),
@@ -293,7 +294,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
293 294
294 scrub_page(page); 295 scrub_page(page);
295 296
296 if (!xen_hvm_domain() && !PageHighMem(page)) { 297 if (xen_pv_domain() && !PageHighMem(page)) {
297 ret = HYPERVISOR_update_va_mapping( 298 ret = HYPERVISOR_update_va_mapping(
298 (unsigned long)__va(pfn << PAGE_SHIFT), 299 (unsigned long)__va(pfn << PAGE_SHIFT),
299 __pte_ma(0), 0); 300 __pte_ma(0), 0);
@@ -337,7 +338,7 @@ static void balloon_process(struct work_struct *work)
337 mutex_lock(&balloon_mutex); 338 mutex_lock(&balloon_mutex);
338 339
339 do { 340 do {
340 credit = current_target() - balloon_stats.current_pages; 341 credit = current_credit();
341 342
342 if (credit > 0) 343 if (credit > 0)
343 state = increase_reservation(credit); 344 state = increase_reservation(credit);
@@ -420,7 +421,7 @@ void free_xenballooned_pages(int nr_pages, struct page** pages)
420 } 421 }
421 422
422 /* The balloon may be too large now. Shrink it if needed. */ 423 /* The balloon may be too large now. Shrink it if needed. */
423 if (current_target() != balloon_stats.current_pages) 424 if (current_credit())
424 schedule_delayed_work(&balloon_worker, 0); 425 schedule_delayed_work(&balloon_worker, 0);
425 426
426 mutex_unlock(&balloon_mutex); 427 mutex_unlock(&balloon_mutex);
@@ -429,7 +430,7 @@ EXPORT_SYMBOL(free_xenballooned_pages);
429 430
430static int __init balloon_init(void) 431static int __init balloon_init(void)
431{ 432{
432 unsigned long pfn, nr_pages, extra_pfn_end; 433 unsigned long pfn, extra_pfn_end;
433 struct page *page; 434 struct page *page;
434 435
435 if (!xen_domain()) 436 if (!xen_domain())
@@ -437,11 +438,7 @@ static int __init balloon_init(void)
437 438
438 pr_info("xen/balloon: Initialising balloon driver.\n"); 439 pr_info("xen/balloon: Initialising balloon driver.\n");
439 440
440 if (xen_pv_domain()) 441 balloon_stats.current_pages = xen_pv_domain() ? min(xen_start_info->nr_pages, max_pfn) : max_pfn;
441 nr_pages = xen_start_info->nr_pages;
442 else
443 nr_pages = max_pfn;
444 balloon_stats.current_pages = min(nr_pages, max_pfn);
445 balloon_stats.target_pages = balloon_stats.current_pages; 442 balloon_stats.target_pages = balloon_stats.current_pages;
446 balloon_stats.balloon_low = 0; 443 balloon_stats.balloon_low = 0;
447 balloon_stats.balloon_high = 0; 444 balloon_stats.balloon_high = 0;
@@ -466,7 +463,7 @@ static int __init balloon_init(void)
466 pfn < extra_pfn_end; 463 pfn < extra_pfn_end;
467 pfn++) { 464 pfn++) {
468 page = pfn_to_page(pfn); 465 page = pfn_to_page(pfn);
469 /* totalram_pages doesn't include the boot-time 466 /* totalram_pages and totalhigh_pages do not include the boot-time
470 balloon extension, so don't subtract from it. */ 467 balloon extension, so don't subtract from it. */
471 __balloon_append(page); 468 __balloon_append(page);
472 } 469 }
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index 60f1827a32cb..1e0fe01eb670 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -215,7 +215,7 @@ static struct attribute_group xen_compilation_group = {
215 .attrs = xen_compile_attrs, 215 .attrs = xen_compile_attrs,
216}; 216};
217 217
218int __init static xen_compilation_init(void) 218static int __init xen_compilation_init(void)
219{ 219{
220 return sysfs_create_group(hypervisor_kobj, &xen_compilation_group); 220 return sysfs_create_group(hypervisor_kobj, &xen_compilation_group);
221} 221}