rpms/kernel-xen-2.6/devel ext4-patchqueue.patch, NONE, 1.1 git-linus.diff, NONE, 1.1 linux-2.6-debug-list_debug_rcu.patch, NONE, 1.1 linux-2.6-debug-softlockup-modules-list.patch, NONE, 1.1 linux-2.6-defaults-acpi-video.patch, NONE, 1.1 linux-2.6-export-shmem-bits-for-gem.patch, NONE, 1.1 linux-2.6-lockdep-uvc.patch, NONE, 1.1 linux-2.6-net-8139-pio-mmio-fallback.patch, NONE, 1.1 linux-2.6-ptrace-cleanup.patch, NONE, 1.1 linux-2.6-tracehook.patch, NONE, 1.1 linux-2.6-xen-0001-xen-execshield-Add-xen-specific-load_user_cs_desc.patch, NONE, 1.1 linux-2.6-xen-0002-xen-execshield-fix-endless-GPF-fault-loop.patch, NONE, 1.1 linux-2.6-xen-0003-xen-Add-a-vmlinuz-target.patch, NONE, 1.1 linux-2.6-xen-0004-xen-Add-empty-xenctrl-module.patch, NONE, 1.1 linux-2.6-xen-0005-xen-Add-proc-xen-capabilities.patch, NONE, 1.1 linux-2.6-xen-0006-xen-Add-proc-xen-privcmd.patch, NONE, 1.1 linux-2.6-xen-0007-xen-Add-proc-xen-xenbus.patch, NONE, 1.1 linux-2.6-xen-0008-xen-Add-Xen-s-sys-hypervisor-interface.patch, NONE, 1.1 linux-2.6-xen-0009-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch, NONE, 1.1 linux-2.6-xen-0010-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch, NONE, 1.1 linux-2.6-xen-0011-x86-paravirt-call-paravirt_pagetable_setup_-start.patch, NONE, 1.1 linux-2.6-xen-0012-pvops-64-call-paravirt_post_allocator_init-on-set.patch, NONE, 1.1 linux-2.6-xen-0013-x86_64-there-s-no-need-to-preallocate-level1_fixmap.patch, NONE, 1.1 linux-2.6-xen-0014-x86-clean-up-formatting-of-__switch_to.patch, NONE, 1.1 linux-2.6-xen-0015-x86-use-__page_aligned_data-bss.patch, NONE, 1.1 linux-2.6-xen-0016-x86_64-adjust-exception-frame-in-ia32entry.patch, NONE, 1.1 linux-2.6-xen-0017-x86_64-unstatic-get_local_pda.patch, NONE, 1.1 linux-2.6-xen-0018-xen-print-backtrace-on-multicall-failure.patch, NONE, 1.1 linux-2.6-xen-0019-xen-netfront-fix-xennet_release_tx_bufs.patch, NONE, 1.1 linux-2.6-xen-0020-xen-add-xen_arch_resume-xen_timer_resume-hook-for.patch, NONE, 1.1 linux-2.6-xen-0021-xen-define-set_pte-from-the-outset.patch, NONE, 1.1 linux-2.6-xen-0022-xen64-define-asm-xen-interface-for-64-bit.patch, NONE, 1.1 linux-2.6-xen-0023-xen-make-ELF-notes-work-for-32-and-64-bit.patch, NONE, 1.1 linux-2.6-xen-0024-xen-fix-64-bit-hypercall-variants.patch, NONE, 1.1 linux-2.6-xen-0025-xen64-fix-calls-into-hypercall-page.patch, NONE, 1.1 linux-2.6-xen-0026-xen64-add-extra-pv_mmu_ops.patch, NONE, 1.1 linux-2.6-xen-0027-xen64-random-ifdefs-to-mask-out-32-bit-only-code.patch, NONE, 1.1 linux-2.6-xen-0028-xen64-get-active_mm-from-the-pda.patch, NONE, 1.1 linux-2.6-xen-0029-xen-move-smp-setup-into-smp.c.patch, NONE, 1.1 linux-2.6-xen-0030-x86_64-add-workaround-for-no-gs-based-percpu.patch, NONE, 1.1 linux-2.6-xen-0031-xen64-smp.c-compile-hacking.patch, NONE, 1.1 linux-2.6-xen-0032-xen64-add-xen-head-code-to-head_64.S.patch, NONE, 1.1 linux-2.6-xen-0033-xen64-add-asm-offsets.patch, NONE, 1.1 linux-2.6-xen-0034-xen64-add-64-bit-assembler.patch, NONE, 1.1 linux-2.6-xen-0035-xen64-use-set_fixmap-for-shared_info-structure.patch, NONE, 1.1 linux-2.6-xen-0036-xen-cpu_detect-is-32-bit-only.patch, NONE, 1.1 linux-2.6-xen-0037-xen64-add-hypervisor-callbacks-for-events-etc.patch, NONE, 1.1 linux-2.6-xen-0038-xen64-early-mapping-setup.patch, NONE, 1.1 linux-2.6-xen-0039-xen64-64-bit-starts-using-set_pte-from-very-early.patch, NONE, 1.1 linux-2.6-xen-0040-xen64-map-an-initial-chunk-of-physical-memory.patch, NONE, 1.1 linux-2.6-xen-0041-xen32-create-initial-mappings-like-64-bit.patch, NONE, 1.1 linux-2.6-xen-0042-xen-fix-truncation-of-machine-address.patch, NONE, 1.1 linux-2.6-xen-0043-xen64-use-arbitrary_virt_to_machine-for-xen_set_pmd.patch, NONE, 1.1 linux-2.6-xen-0044-xen-set-num_processors.patch, NONE, 1.1 linux-2.6-xen-0045-xen64-defer-setting-pagetable-alloc-release-ops.patch, NONE, 1.1 linux-2.6-xen-0046-xen-use-set_pte_vaddr.patch, NONE, 1.1 linux-2.6-xen-0047-xen64-xen_write_idt_entry-and-cvt_gate_to_trap.patch, NONE, 1.1 linux-2.6-xen-0048-xen64-deal-with-extra-words-Xen-pushes-onto-excepti.patch, NONE, 1.1 linux-2.6-xen-0049-xen64-add-pvop-for-swapgs.patch, NONE, 1.1 linux-2.6-xen-0050-xen64-register-callbacks-in-arch-independent-way.patch, NONE, 1.1 linux-2.6-xen-0051-xen64-add-identity-irq-vector-map.patch, NONE, 1.1 linux-2.6-xen-0052-Xen64-HYPERVISOR_set_segment_base-implementation.patch, NONE, 1.1 linux-2.6-xen-0053-xen64-implement-xen_load_gs_index.patch, NONE, 1.1 linux-2.6-xen-0054-xen-rework-pgd_walk-to-deal-with-32-64-bit.patch, NONE, 1.1 linux-2.6-xen-0055-xen-make-sure-the-kernel-command-line-is-right.patch, NONE, 1.1 linux-2.6-xen-0056-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch, NONE, 1.1 linux-2.6-xen-0057-xen64-implement-failsafe-callback.patch, NONE, 1.1 linux-2.6-xen-0058-xen64-Clear-fs-on-xen_load_tls.patch, NONE, 1.1 linux-2.6-xen-0059-xen64-implement-64-bit-update_descriptor.patch, NONE, 1.1 linux-2.6-xen-0060-xen64-save-lots-of-registers.patch, NONE, 1.1 linux-2.6-xen-0061-xen64-allocate-and-manage-user-pagetables.patch, NONE, 1.1 linux-2.6-xen-0062-xen64-set-up-syscall-and-sysenter-entrypoints-for-6.patch, NONE, 1.1 linux-2.6-xen-0063-xen64-set-up-userspace-syscall-patch.patch, NONE, 1.1 linux-2.6-xen-0064-xen-implement-Xen-write_msr-operation.patch, NONE, 1.1 linux-2.6-xen-0065-xen-update-Kconfig-to-allow-64-bit-Xen.patch, NONE, 1.1 linux-2.6-xen-0066-xen64-fix-HVC_XEN-build-dependency.patch, NONE, 1.1 linux-2.6-xen-0067-xen64-fix-build-error-on-32-bit-HIGHMEM.patch, NONE, 1.1 linux-2.6-xen-0068-Revert-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch, NONE, 1.1 linux-2.6-xen-0069-Revert-x86_64-there-s-no-need-to-preallocate-level.patch, NONE, 1.1 linux-2.6-xen-0070-xen64-disable-32-bit-syscall-sysenter-if-not-suppor.patch, NONE, 1.1 linux-2.6-xen-0071-x86-xen-vdso-fix-build-error.patch, NONE, 1.1 linux-2.6-xen-0072-x86_64-further-cleanup-of-32-bit-compat-syscall-mec.patch, NONE, 1.1 linux-2.6-xen-0073-x86-xen-no-need-to-disable-vdso32.patch, NONE, 1.1 linux-2.6-xen-0074-x86_64-adjust-exception-frame-on-paranoid-exception.patch, NONE, 1.1 linux-2.6-xen-0075-x86-xen-power-fix-up-config-dependencies-on-PM.patch, NONE, 1.1 linux-2.6-xen-0076-linux-next-pci-tree-build-failure.patch, NONE, 1.1 linux-2.6.26.tar.bz2.sign, NONE, 1.1 patch-2.6.26-git6.bz2.sign, NONE, 1.1 .cvsignore, 1.18, 1.19 .gitignore, 1.8, 1.9 Makefile, 1.23, 1.24 Makefile.config, 1.23, 1.24 config-debug, 1.5, 1.6 config-generic, 1.9, 1.10 config-ia64, 1.2, 1.3 config-ia64-generic, 1.4, 1.5 config-nodebug, 1.6, 1.7 config-powerpc-generic, 1.5, 1.6 config-powerpc32-generic, 1.5, 1.6 config-powerpc64, 1.5, 1.6 config-s390x, 1.4, 1.5 config-sparc64-generic, 1.5, 1.6 config-sparc64-smp, 1.2, 1.3 config-x86-generic, 1.5, 1.6 config-x86_64-generic, 1.7, 1.8 config-xen-generic, 1.6, 1.7 config-xen-x86_64, 1.7, 1.8 kernel.spec, 1.46, 1.47 linux-2.6-debug-nmi-timeout.patch, 1.3, 1.4 linux-2.6-execshield.patch, 1.5, 1.6 linux-2.6-merge-efifb-imacfb.patch, 1.2, 1.3 linux-2.6-net-8139-pio-modparam.patch, 1.1, 1.2 linux-2.6-net-8139-pio-oqo2.patch, 1.1, 1.2 linux-2.6-silence-noise.patch, 1.6, 1.7 linux-2.6-utrace.patch, 1.5, 1.6 linux-2.6-wireless-pending.patch, 1.8, 1.9 linux-2.6-wireless.patch, 1.8, 1.9 sources, 1.18, 1.19 upstream, 1.8, 1.9 config-sparc, 1.2, NONE config-sparc-generic, 1.3, NONE config-sparc-smp, 1.2, NONE config-sparc64, 1.2, NONE linux-2.6-alsa-kill-annoying-messages.patch, 1.2, NONE linux-2.6-hda-intel-fix-dma-position-inaccuracy.patch, 1.1, NONE linux-2.6-powerpc-zImage-32MiB.patch, 1.1, NONE linux-2.6-ppc-use-libgcc.patch, 1.2, NONE linux-2.6-selinux-deffered-context-mapping-no-sleep.patch, 1.1, NONE linux-2.6-selinux-deffered-context-mapping.patch, 1.1, NONE linux-2.6-selinux-generic-ioctl.patch, 1.1, NONE linux-2.6-selinux-get-invalid-xattrs.patch, 1.1, NONE linux-2.6-selinux-new-proc-checks.patch, 1.1, NONE linux-2.6-silence-x86-decompressor.patch, 1.1, NONE linux-2.6-uvcvideo.patch, 1.3, NONE linux-2.6-xen-0001-squashfs-Fix-build-without-CONFIG_SMP.patch, 1.8, NONE linux-2.6-xen-0002-xen-execshield-Add-xen-specific-load_user_cs_desc.patch, 1.8, NONE linux-2.6-xen-0003-xen-execshield-fix-endless-GPF-fault-loop.patch, 1.8, NONE linux-2.6-xen-0004-xen-Enable-Xen-console-by-default-in-domU.patch, 1.1, NONE linux-2.6-xen-0005-xen-Add-a-vmlinuz-target.patch, 1.1, NONE linux-2.6-xen-0006-xen-Add-empty-xenctrl-module.patch, 1.1, NONE linux-2.6-xen-0007-xen-Add-proc-xen-capabilities.patch, 1.1, NONE linux-2.6-xen-0008-xen-Add-proc-xen-privcmd.patch, 1.1, NONE linux-2.6-xen-0009-xen-Add-proc-xen-xenbus.patch, 1.1, NONE linux-2.6-xen-0010-xen-Add-Xen-s-sys-hypervisor-interface.patch, 1.1, NONE linux-2.6-xen-0011-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch, 1.1, NONE linux-2.6-xen-0012-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch, 1.1, NONE linux-2.6-xen-0013-xen-expose-set_pte_vaddr-and-make-xen-use-it.patch, 1.1, NONE linux-2.6-xen-0014-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch, 1.1, NONE linux-2.6-xen-0015-x86_64-Expose-set_pte_vaddr.patch, 1.1, NONE linux-2.6-xen-0016-x86_64-Split-set_pte_vaddr.patch, 1.1, NONE linux-2.6-xen-0017-x86_64-Add-clear_fixmap.patch, 1.1, NONE linux-2.6-xen-0018-xen-x86_64-Make-set_fixmap-a-paravirt-op-on-64-bi.patch, 1.1, NONE linux-2.6-xen-0019-xen-x86_64-Hack-to-set-vsyscall-pages-on-user-space.patch, 1.1, NONE linux-2.6-xen-0020-Handle-VSYSCALL_FIRST_PAGE-on-xen_set_pte.patch, 1.1, NONE linux-2.6-xen-0021-xen-x86_64-Remove-the-640K-1M-hole-and-disable-DMI.patch, 1.1, NONE linux-2.6-xen-0022-xen-x86_64-Add-update_va_mapping-64-bit-code.patch, 1.1, NONE linux-2.6-xen-0023-x86_64-Add-sync_cmpxchg.patch, 1.1, NONE linux-2.6-xen-0024-xen-x86_64-Implement-HYPERVISOR-MULTI-_update_desc.patch, 1.1, NONE linux-2.6-xen-0025-xen-x86_64-Add-hacky-64-bit-x86_-read-write-_percpu.patch, 1.1, NONE linux-2.6-xen-0026-xen-x86_64-Use-x86_read_percpu-only-to-refer-to-a.patch, 1.1, NONE linux-2.6-xen-0027-Add-FIX_PARAVIRT_BOOTAP-to-fixmap_64.h-too.patch, 1.1, NONE linux-2.6-xen-0028-Add-gate_offset-and-gate_segment-macros.patch, 1.1, NONE linux-2.6-xen-0029-xen_write_idt_entry-and-cvt_gate_to_trap.patch, 1.1, NONE linux-2.6-xen-0030-typedefs-for-pte_val-and-friends.patch, 1.1, NONE linux-2.6-xen-0031-x86_64-implementation-of-some-page.h-macros.patch, 1.1, NONE linux-2.6-xen-0032-Chainsaw-style-ifdefs.patch, 1.1, NONE linux-2.6-xen-0033-xen-Make-xen_pte_val-generic.patch, 1.1, NONE linux-2.6-xen-0034-More-chainsaw-ifdefs.patch, 1.1, NONE linux-2.6-xen-0035-Chainsaw-ifdefs-on-assembly-percpu-handling.patch, 1.1, NONE linux-2.6-xen-0036-x86_64-percpu-assembly-macros.patch, 1.1, NONE linux-2.6-xen-0037-Some-xen-asm.S-x86_64-code.patch, 1.1, NONE linux-2.6-xen-0038-Chainsaw-party-SPLITME.patch, 1.1, NONE linux-2.6-xen-0039-xen-asm.S-x86_64-notes.patch, 1.1, NONE linux-2.6-xen-0040-xen-x86_64-Make-hypercall-assembly-code-work.patch, 1.1, NONE linux-2.6-xen-0041-xen-x86_64-pda-initialization.patch, 1.1, NONE linux-2.6-xen-0042-Disable-early_printk-by-default.patch, 1.1, NONE linux-2.6-xen-0043-xen-Set-__HYPERVISOR_VIRT_START-for-x86_64.patch, 1.1, NONE linux-2.6-xen-0044-Set-__PAGE_OFFSET-as-required-by-Xen.patch, 1.1, NONE linux-2.6-xen-0045-DEBUG-Add-xprintk-to-log-directly-via-hypercall-fo.patch, 1.1, NONE linux-2.6-xen-0046-DEBUG-Add-xprintk-debugging-printk-prototype-to-hvc.patch, 1.1, NONE linux-2.6-xen-0047-Use-__pgd-on-mk_kernel_pgd.patch, 1.1, NONE linux-2.6-xen-0048-Include-user-page-tables-on-head_64.S.patch, 1.1, NONE linux-2.6-xen-0049-Avoid-using-mk_unsigned_long.patch, 1.1, NONE linux-2.6-xen-0050-Lots-of-unrelated-changes.patch, 1.1, NONE linux-2.6-xen-0051-Hack-disable-vsmp.patch, 1.1, NONE linux-2.6-xen-0052-Export-early_make_page_readonly.patch, 1.1, NONE linux-2.6-xen-0053-Disable-multicalls.c-too-verbose-debugging.patch, 1.1, NONE linux-2.6-xen-0054-Xen-64-bit-ready-MMU-operations.patch, 1.1, NONE linux-2.6-xen-0055-Some-xen-mmu-pv-ops-implemented.patch, 1.1, NONE linux-2.6-xen-0056-Trying-to-make-the-pagetable-initialization-code-wor.patch, 1.1, NONE linux-2.6-xen-0057-Xen-specific-find_early_table_space-FIXME.patch, 1.1, NONE linux-2.6-xen-0058-Xen-call-e820_print_map-when-setting-up-memory.patch, 1.1, NONE linux-2.6-xen-0059-Comment-debugging-msgs.patch, 1.1, NONE linux-2.6-xen-0060-Try-to-make-pagetables-read-only.patch, 1.1, NONE linux-2.6-xen-0061-Debug-dump-pgtables-on-make_page_readonly.patch, 1.1, NONE linux-2.6-xen-0062-Disable-apic-at-compile-time-FIXME.patch, 1.1, NONE linux-2.6-xen-0063-Parse-early-params-after-init_memory_mapping.patch, 1.1, NONE linux-2.6-xen-0064-xen-Move-addr_to_page-to-init.h.patch, 1.1, NONE linux-2.6-xen-0065-Make-xen_pxx_val-and-xen_make_pxx-handle-attr-bi.patch, 1.1, NONE linux-2.6-xen-0066-Pull-xen_finish_init_mappin-from-XS-upstream.patch, 1.1, NONE linux-2.6-xen-0067-Pull-spp_getpage-changes-from-XS-upstream-REVIEWM.patch, 1.1, NONE linux-2.6-xen-0068-Pull-xen_extend_init_mapping-from-XS-upstream-FIX.patch, 1.1, NONE linux-2.6-xen-0069-New-enum-fixed_addresses-values-REVIEWME.patch, 1.1, NONE linux-2.6-xen-0070-Reserve-bootmem-areas-used-by-Xen-FIXME.patch, 1.1, NONE linux-2.6-xen-0071-xen_convert_trap_info-use-sizeof-struct-gate_desc.patch, 1.1, NONE linux-2.6-xen-0072-Call-paravirt_pagetable_setup_-start-done-REVIEW.patch, 1.1, NONE linux-2.6-xen-0073-ifdef-CONFIG_X86_32-on-xen-enlighten.c-REVIEWME.patch, 1.1, NONE linux-2.6-xen-0074-Handle-Xen-exception-stack-it-is-different-from-bar.patch, 1.1, NONE linux-2.6-xen-0075-Implement-64-bit-version-of-HYPERVISOR_set_callbacks.patch, 1.1, NONE linux-2.6-xen-0076-Make-arch_vcpu_info-be-of-the-right-size-on-both-32.patch, 1.1, NONE linux-2.6-xen-0077-Implement-asm-xen_iret.patch, 1.1, NONE linux-2.6-xen-0078-xen-64-xen_iret-use-iretq-directly-if-returning-t.patch, 1.1, NONE linux-2.6-xen-0079-Implement-xen_irqenable_syscall_ret.patch, 1.1, NONE linux-2.6-xen-0080-DEBUG-xen_iret-always-return-through-the-hyperviso.patch, 1.1, NONE linux-2.6-xen-0081-Implement-some-xen-callbacks-on-xen-entry_64.S.patch, 1.1, NONE linux-2.6-xen-0082-Xen-specific-ifdef-hacks-on-kernel-entry_64.S-FIXM.patch, 1.1, NONE linux-2.6-xen-0083-Disable-syscall32-code-temporarily-FIXME.patch, 1.1, NONE linux-2.6-xen-0084-Use-__KERNEL_DS-as-SS-when-returning-to-a-kernel-thr.patch, 1.1, NONE linux-2.6-xen-0085-Use-apic_xen-on-genapic-by-default-FIXME.patch, 1.1, NONE linux-2.6-xen-0086-irq-vector-ifdef-chainsaw-FIXME.patch, 1.1, NONE linux-2.6-xen-0087-ifdef-chainsaw-on-syscall_init-FIXME.patch, 1.1, NONE linux-2.6-xen-0088-Pull-xen-genapic-implementation-from-upstream-Xen.patch, 1.1, NONE linux-2.6-xen-0089-Debugging-printk-s.patch, 1.1, NONE linux-2.6-xen-0090-Leave-lazy_cpu_mode-on-__switch_to.patch, 1.1, NONE linux-2.6-xen-0091-xen-64-Handle-fs-and-gs-on-xen_load_tls-properl.patch, 1.1, NONE linux-2.6-xen-0092-Disable-vcpu_info_placement-temporarily-FIXME.patch, 1.1, NONE linux-2.6-xen-0093-Fix-typo-on-ifdef-again.patch, 1.1, NONE linux-2.6-xen-0094-DEBUG-Don-t-try-to-actually-read-the-page-on-show_.patch, 1.1, NONE linux-2.6-xen-0095-Make-load_gs_index-a-paravirt-operation.patch, 1.1, NONE linux-2.6-xen-0096-xen-pgd_walk-use-limit-argument-instead-of-FIXADD.patch, 1.1, NONE linux-2.6-xen-0097-xen-pgd_walk-Eliminate-BUG_ON-limit-FIXADDR_TOP.patch, 1.1, NONE linux-2.6-xen-0098-xen-pgd_walk-accept-start-parameter.patch, 1.1, NONE linux-2.6-xen-0099-xen-64-reserve_bootmem-xen_start_info-area.patch, 1.1, NONE linux-2.6-xen-0100-pvops-64-call-paravirt_post_allocator_init-on-set.patch, 1.1, NONE linux-2.6-xen-0101-use-write_gdt_entry-on-vsyscall_set_cpu-CLEANME.patch, 1.1, NONE linux-2.6-xen-0102-xen-64-implement-xen_load_gs_index.patch, 1.1, NONE linux-2.6-xen-0103-Make-xen_pgd_unpin-non-static-REVIEWME.patch, 1.1, NONE linux-2.6-xen-0104-Xen-64-pgd-allocation-hack-FIXME.patch, 1.1, NONE linux-2.6-xen-0105-Set-both-kernel-and-user-PGDs-on-pgd_populate-FI.patch, 1.1, NONE linux-2.6-xen-0106-Multi-pagetable-write_cr3-implementation-FIXME.patch, 1.1, NONE linux-2.6-xen-0107-Disable-the-weird-count-loop-on-kcons_write_dom0.patch, 1.1, NONE linux-2.6-xen-0108-Make-xen_start_info-read-only.patch, 1.1, NONE linux-2.6-xen-0109-Hack-to-implement-return-to-userspace-without-SWAPGS.patch, 1.1, NONE linux-2.6-xen-0110-Xen-SEGBASE_-defines.patch, 1.1, NONE linux-2.6-xen-0111-Xen-HYPERVISOR_set_segment_base-implementation.patch, 1.1, NONE linux-2.6-xen-0112-Change-signature-of-paravirt_alloc_-pt-pd-REVIEWME.patch, 1.1, NONE linux-2.6-xen-0113-Comment-e820_print_map-call-TEMPORARY.patch, 1.1, NONE linux-2.6-xen-0114-Xen-missing-includes.patch, 1.1, NONE linux-2.6-xen-0115-asm-x86-pgtable_64.h-include-linux-spinlock.h.patch, 1.1, NONE linux-2.6-xen-0116-asm-x86-pgtable.h-include-asm-page.h.patch, 1.1, NONE linux-2.6-xen-0117-fix-pxxval_t-usage-on-mm-init_64.c.patch, 1.1, NONE linux-2.6-xen-0118-Missing-Xen-include.patch, 1.1, NONE linux-2.6-xen-0119-un-static-ipi_to_irq.patch, 1.1, NONE linux-2.6-xen-0120-Don-t-use-_PAGE_GLOBAL-bit-under-Xen-FIXME.patch, 1.1, NONE linux-2.6-xen-0121-Trying-to-organize-the-xen-bootmem-allocation-mess.patch, 1.1, NONE linux-2.6-xen-0122-Xen-reserve_bootmem-xenstore-and-console-interfac.patch, 1.1, NONE linux-2.6-xen-0123-pvops-64-call-paravirt_activate_mm-on-activate_mm.patch, 1.1, NONE linux-2.6-xen-0124-Xen-64-bit-support-on-xen_pgd_pin.patch, 1.1, NONE linux-2.6-xen-0125-Xen-64-pin-user-PGD-on-activate_mm-and-dup_mmap.patch, 1.1, NONE linux-2.6-xen-0126-Hack-pgd_walk-to-walk-to-TASK_SIZE-PAGE_SIZE-on-x8.patch, 1.1, NONE linux-2.6-xen-0127-Xen-64-Unpin-user-pagetable-on-xen_pgd_unpin.patch, 1.1, NONE linux-2.6-xen-0128-Use-un-pin_page-when-un-pinning-pgd.patch, 1.1, NONE linux-2.6-xen-0129-Allow-enabling-Xen-on-x86_64.patch, 1.1, NONE linux-2.6-xen-0130-Add-include-linux-spinlock_types.h-to-asm-x86-pgt.patch, 1.1, NONE linux-2.6-xen-0131-Restore-some-sanity-on-the-initial-pagetable-bootmem.patch, 1.1, NONE linux-2.6-xen-0132-Xen-Use-system_call_after_swapgs-as-the-syscall-c.patch, 1.1, NONE linux-2.6-xen-0133-Add-a-system_call_after_saveargs-label-to-entry_64.S.patch, 1.1, NONE linux-2.6-xen-0134-Create-xen-specific-syscall-entry.patch, 1.1, NONE linux-2.6-xen-0135-syscall-related-Xen-ifdefs-FIXME.patch, 1.1, NONE linux-2.6-xen-0136-Point-set_pte-to-xen_set_pte-since-the-beginning.patch, 1.1, NONE linux-2.6-xen-0137-DEBUG-slab-debugging.patch, 1.1, NONE linux-2.6-xen-0138-pvops-64-Include-rsi-on-the-register-clobber-list.patch, 1.1, NONE linux-2.6-xen-0139-Xen-64-quick-ugly-hack-to-fix-pgd_clear-pagetabl.patch, 1.1, NONE linux-2.6-xen-0140-Add-missing-acpi-include-to-xen-setup.c.patch, 1.1, NONE linux-2.6-xen-0141-Don-t-use-FIX_VDSO-on-64-bit.patch, 1.1, NONE linux-2.6-xen-0142-Mark-init-pages-read-write-again-on-free_init_pages.patch, 1.1, NONE linux-2.6-xen-0143-reserve_early-kernel-text-and-data-segments.patch, 1.1, NONE linux-2.6-xen-0144-Xen-Clear-__START_KERNEL_map-PTEs-on-free_init_page.patch, 1.1, NONE linux-2.6-xen-0145-Set-pvops-machine_ops-for-Xen-on-x86_64-also-MERGE.patch, 1.1, NONE linux-2.6-xen-0146-Pull-xen_failsafe_callback-implementation-from-XenSo.patch, 1.1, NONE linux-2.6-xen-0147-Save-fs-and-gs-before-load_TLS-and-arch_leave_la.patch, 1.1, NONE linux-2.6-xen-0148-xen-64-Clear-fs-on-xen_load_tls.patch, 1.1, NONE linux-2.6-xen-0149-ia32entry.S-Replace-cli-sti-cases-with-DISABLE_INTE.patch, 1.1, NONE linux-2.6-xen-0150-Introduce-xen_ia32_syscall.patch, 1.1, NONE linux-2.6-xen-0151-Use-xen_ia32_syscall-if-CONFIG_XEN-is-enabled-FIX.patch, 1.1, NONE linux-2.6-xen-0152-Make-the-int80-and-syscall-vdso32-implementations-se.patch, 1.1, NONE linux-2.6-xen-0153-Use-vdso32-int80-by-default-if-Xen-is-enabled-FIXME.patch, 1.1, NONE linux-2.6-xen-0154-xen_pgd_pin-use-TASK_SIZE64-on-x86_64.patch, 1.1, NONE linux-2.6-xen-0155-paravirt-ops-64-Save-rdi-also-on-asm-version-of-PV.patch, 1.1, NONE linux-2.6-xen-0156-X86_VSMP-make-not-depend-on-XEN-REVIEWME.patch, 1.1, NONE linux-2.6-xen-0157-Add-do_IRQ-prototype-to-asm-x86-irq_64.h.patch, 1.1, NONE linux-2.6-xen-0158-Disable-sysenter-on-x86_64-temporarily-REVIEWME.patch, 1.1, NONE linux-2.6-xen-0159-Add-xen_-alloc-release-_pud-functions-for-x86_64-x.patch, 1.1, NONE linux-2.6-xen-0160-Extract-reserve_initrd-from-x86_64_start_kernel.patch, 1.1, NONE linux-2.6-xen-0161-Make-reserve_initrd-non-static.patch, 1.1, NONE linux-2.6-xen-0162-xen-64-Reserve-initrd-on-xen_start_kernel-also.patch, 1.1, NONE linux-2.6.25.tar.bz2.sign, 1.1, NONE patch-2.6.26-rc6-git2.bz2.sign, 1.1, NONE patch-2.6.26-rc6.bz2.sign, 1.1, NONE

Mark McLoughlin (markmc) fedora-extras-commits at redhat.com
Fri Jul 18 14:58:32 UTC 2008


Author: markmc

Update of /cvs/pkgs/rpms/kernel-xen-2.6/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9922

Modified Files:
	.cvsignore .gitignore Makefile Makefile.config config-debug 
	config-generic config-ia64 config-ia64-generic config-nodebug 
	config-powerpc-generic config-powerpc32-generic 
	config-powerpc64 config-s390x config-sparc64-generic 
	config-sparc64-smp config-x86-generic config-x86_64-generic 
	config-xen-generic config-xen-x86_64 kernel.spec 
	linux-2.6-debug-nmi-timeout.patch linux-2.6-execshield.patch 
	linux-2.6-merge-efifb-imacfb.patch 
	linux-2.6-net-8139-pio-modparam.patch 
	linux-2.6-net-8139-pio-oqo2.patch 
	linux-2.6-silence-noise.patch linux-2.6-utrace.patch 
	linux-2.6-wireless-pending.patch linux-2.6-wireless.patch 
	sources upstream 
Added Files:
	ext4-patchqueue.patch git-linus.diff 
	linux-2.6-debug-list_debug_rcu.patch 
	linux-2.6-debug-softlockup-modules-list.patch 
	linux-2.6-defaults-acpi-video.patch 
	linux-2.6-export-shmem-bits-for-gem.patch 
	linux-2.6-lockdep-uvc.patch 
	linux-2.6-net-8139-pio-mmio-fallback.patch 
	linux-2.6-ptrace-cleanup.patch linux-2.6-tracehook.patch 
	linux-2.6-xen-0001-xen-execshield-Add-xen-specific-load_user_cs_desc.patch 
	linux-2.6-xen-0002-xen-execshield-fix-endless-GPF-fault-loop.patch 
	linux-2.6-xen-0003-xen-Add-a-vmlinuz-target.patch 
	linux-2.6-xen-0004-xen-Add-empty-xenctrl-module.patch 
	linux-2.6-xen-0005-xen-Add-proc-xen-capabilities.patch 
	linux-2.6-xen-0006-xen-Add-proc-xen-privcmd.patch 
	linux-2.6-xen-0007-xen-Add-proc-xen-xenbus.patch 
	linux-2.6-xen-0008-xen-Add-Xen-s-sys-hypervisor-interface.patch 
	linux-2.6-xen-0009-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch 
	linux-2.6-xen-0010-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch 
	linux-2.6-xen-0011-x86-paravirt-call-paravirt_pagetable_setup_-start.patch 
	linux-2.6-xen-0012-pvops-64-call-paravirt_post_allocator_init-on-set.patch 
	linux-2.6-xen-0013-x86_64-there-s-no-need-to-preallocate-level1_fixmap.patch 
	linux-2.6-xen-0014-x86-clean-up-formatting-of-__switch_to.patch 
	linux-2.6-xen-0015-x86-use-__page_aligned_data-bss.patch 
	linux-2.6-xen-0016-x86_64-adjust-exception-frame-in-ia32entry.patch 
	linux-2.6-xen-0017-x86_64-unstatic-get_local_pda.patch 
	linux-2.6-xen-0018-xen-print-backtrace-on-multicall-failure.patch 
	linux-2.6-xen-0019-xen-netfront-fix-xennet_release_tx_bufs.patch 
	linux-2.6-xen-0020-xen-add-xen_arch_resume-xen_timer_resume-hook-for.patch 
	linux-2.6-xen-0021-xen-define-set_pte-from-the-outset.patch 
	linux-2.6-xen-0022-xen64-define-asm-xen-interface-for-64-bit.patch 
	linux-2.6-xen-0023-xen-make-ELF-notes-work-for-32-and-64-bit.patch 
	linux-2.6-xen-0024-xen-fix-64-bit-hypercall-variants.patch 
	linux-2.6-xen-0025-xen64-fix-calls-into-hypercall-page.patch 
	linux-2.6-xen-0026-xen64-add-extra-pv_mmu_ops.patch 
	linux-2.6-xen-0027-xen64-random-ifdefs-to-mask-out-32-bit-only-code.patch 
	linux-2.6-xen-0028-xen64-get-active_mm-from-the-pda.patch 
	linux-2.6-xen-0029-xen-move-smp-setup-into-smp.c.patch 
	linux-2.6-xen-0030-x86_64-add-workaround-for-no-gs-based-percpu.patch 
	linux-2.6-xen-0031-xen64-smp.c-compile-hacking.patch 
	linux-2.6-xen-0032-xen64-add-xen-head-code-to-head_64.S.patch 
	linux-2.6-xen-0033-xen64-add-asm-offsets.patch 
	linux-2.6-xen-0034-xen64-add-64-bit-assembler.patch 
	linux-2.6-xen-0035-xen64-use-set_fixmap-for-shared_info-structure.patch 
	linux-2.6-xen-0036-xen-cpu_detect-is-32-bit-only.patch 
	linux-2.6-xen-0037-xen64-add-hypervisor-callbacks-for-events-etc.patch 
	linux-2.6-xen-0038-xen64-early-mapping-setup.patch 
	linux-2.6-xen-0039-xen64-64-bit-starts-using-set_pte-from-very-early.patch 
	linux-2.6-xen-0040-xen64-map-an-initial-chunk-of-physical-memory.patch 
	linux-2.6-xen-0041-xen32-create-initial-mappings-like-64-bit.patch 
	linux-2.6-xen-0042-xen-fix-truncation-of-machine-address.patch 
	linux-2.6-xen-0043-xen64-use-arbitrary_virt_to_machine-for-xen_set_pmd.patch 
	linux-2.6-xen-0044-xen-set-num_processors.patch 
	linux-2.6-xen-0045-xen64-defer-setting-pagetable-alloc-release-ops.patch 
	linux-2.6-xen-0046-xen-use-set_pte_vaddr.patch 
	linux-2.6-xen-0047-xen64-xen_write_idt_entry-and-cvt_gate_to_trap.patch 
	linux-2.6-xen-0048-xen64-deal-with-extra-words-Xen-pushes-onto-excepti.patch 
	linux-2.6-xen-0049-xen64-add-pvop-for-swapgs.patch 
	linux-2.6-xen-0050-xen64-register-callbacks-in-arch-independent-way.patch 
	linux-2.6-xen-0051-xen64-add-identity-irq-vector-map.patch 
	linux-2.6-xen-0052-Xen64-HYPERVISOR_set_segment_base-implementation.patch 
	linux-2.6-xen-0053-xen64-implement-xen_load_gs_index.patch 
	linux-2.6-xen-0054-xen-rework-pgd_walk-to-deal-with-32-64-bit.patch 
	linux-2.6-xen-0055-xen-make-sure-the-kernel-command-line-is-right.patch 
	linux-2.6-xen-0056-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch 
	linux-2.6-xen-0057-xen64-implement-failsafe-callback.patch 
	linux-2.6-xen-0058-xen64-Clear-fs-on-xen_load_tls.patch 
	linux-2.6-xen-0059-xen64-implement-64-bit-update_descriptor.patch 
	linux-2.6-xen-0060-xen64-save-lots-of-registers.patch 
	linux-2.6-xen-0061-xen64-allocate-and-manage-user-pagetables.patch 
	linux-2.6-xen-0062-xen64-set-up-syscall-and-sysenter-entrypoints-for-6.patch 
	linux-2.6-xen-0063-xen64-set-up-userspace-syscall-patch.patch 
	linux-2.6-xen-0064-xen-implement-Xen-write_msr-operation.patch 
	linux-2.6-xen-0065-xen-update-Kconfig-to-allow-64-bit-Xen.patch 
	linux-2.6-xen-0066-xen64-fix-HVC_XEN-build-dependency.patch 
	linux-2.6-xen-0067-xen64-fix-build-error-on-32-bit-HIGHMEM.patch 
	linux-2.6-xen-0068-Revert-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch 
	linux-2.6-xen-0069-Revert-x86_64-there-s-no-need-to-preallocate-level.patch 
	linux-2.6-xen-0070-xen64-disable-32-bit-syscall-sysenter-if-not-suppor.patch 
	linux-2.6-xen-0071-x86-xen-vdso-fix-build-error.patch 
	linux-2.6-xen-0072-x86_64-further-cleanup-of-32-bit-compat-syscall-mec.patch 
	linux-2.6-xen-0073-x86-xen-no-need-to-disable-vdso32.patch 
	linux-2.6-xen-0074-x86_64-adjust-exception-frame-on-paranoid-exception.patch 
	linux-2.6-xen-0075-x86-xen-power-fix-up-config-dependencies-on-PM.patch 
	linux-2.6-xen-0076-linux-next-pci-tree-build-failure.patch 
	linux-2.6.26.tar.bz2.sign patch-2.6.26-git6.bz2.sign 
Removed Files:
	config-sparc config-sparc-generic config-sparc-smp 
	config-sparc64 linux-2.6-alsa-kill-annoying-messages.patch 
	linux-2.6-hda-intel-fix-dma-position-inaccuracy.patch 
	linux-2.6-powerpc-zImage-32MiB.patch 
	linux-2.6-ppc-use-libgcc.patch 
	linux-2.6-selinux-deffered-context-mapping-no-sleep.patch 
	linux-2.6-selinux-deffered-context-mapping.patch 
	linux-2.6-selinux-generic-ioctl.patch 
	linux-2.6-selinux-get-invalid-xattrs.patch 
	linux-2.6-selinux-new-proc-checks.patch 
	linux-2.6-silence-x86-decompressor.patch 
	linux-2.6-uvcvideo.patch 
	linux-2.6-xen-0001-squashfs-Fix-build-without-CONFIG_SMP.patch 
	linux-2.6-xen-0002-xen-execshield-Add-xen-specific-load_user_cs_desc.patch 
	linux-2.6-xen-0003-xen-execshield-fix-endless-GPF-fault-loop.patch 
	linux-2.6-xen-0004-xen-Enable-Xen-console-by-default-in-domU.patch 
	linux-2.6-xen-0005-xen-Add-a-vmlinuz-target.patch 
	linux-2.6-xen-0006-xen-Add-empty-xenctrl-module.patch 
	linux-2.6-xen-0007-xen-Add-proc-xen-capabilities.patch 
	linux-2.6-xen-0008-xen-Add-proc-xen-privcmd.patch 
	linux-2.6-xen-0009-xen-Add-proc-xen-xenbus.patch 
	linux-2.6-xen-0010-xen-Add-Xen-s-sys-hypervisor-interface.patch 
	linux-2.6-xen-0011-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch 
	linux-2.6-xen-0012-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch 
	linux-2.6-xen-0013-xen-expose-set_pte_vaddr-and-make-xen-use-it.patch 
	linux-2.6-xen-0014-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch 
	linux-2.6-xen-0015-x86_64-Expose-set_pte_vaddr.patch 
	linux-2.6-xen-0016-x86_64-Split-set_pte_vaddr.patch 
	linux-2.6-xen-0017-x86_64-Add-clear_fixmap.patch 
	linux-2.6-xen-0018-xen-x86_64-Make-set_fixmap-a-paravirt-op-on-64-bi.patch 
	linux-2.6-xen-0019-xen-x86_64-Hack-to-set-vsyscall-pages-on-user-space.patch 
	linux-2.6-xen-0020-Handle-VSYSCALL_FIRST_PAGE-on-xen_set_pte.patch 
	linux-2.6-xen-0021-xen-x86_64-Remove-the-640K-1M-hole-and-disable-DMI.patch 
	linux-2.6-xen-0022-xen-x86_64-Add-update_va_mapping-64-bit-code.patch 
	linux-2.6-xen-0023-x86_64-Add-sync_cmpxchg.patch 
	linux-2.6-xen-0024-xen-x86_64-Implement-HYPERVISOR-MULTI-_update_desc.patch 
	linux-2.6-xen-0025-xen-x86_64-Add-hacky-64-bit-x86_-read-write-_percpu.patch 
	linux-2.6-xen-0026-xen-x86_64-Use-x86_read_percpu-only-to-refer-to-a.patch 
	linux-2.6-xen-0027-Add-FIX_PARAVIRT_BOOTAP-to-fixmap_64.h-too.patch 
	linux-2.6-xen-0028-Add-gate_offset-and-gate_segment-macros.patch 
	linux-2.6-xen-0029-xen_write_idt_entry-and-cvt_gate_to_trap.patch 
	linux-2.6-xen-0030-typedefs-for-pte_val-and-friends.patch 
	linux-2.6-xen-0031-x86_64-implementation-of-some-page.h-macros.patch 
	linux-2.6-xen-0032-Chainsaw-style-ifdefs.patch 
	linux-2.6-xen-0033-xen-Make-xen_pte_val-generic.patch 
	linux-2.6-xen-0034-More-chainsaw-ifdefs.patch 
	linux-2.6-xen-0035-Chainsaw-ifdefs-on-assembly-percpu-handling.patch 
	linux-2.6-xen-0036-x86_64-percpu-assembly-macros.patch 
	linux-2.6-xen-0037-Some-xen-asm.S-x86_64-code.patch 
	linux-2.6-xen-0038-Chainsaw-party-SPLITME.patch 
	linux-2.6-xen-0039-xen-asm.S-x86_64-notes.patch 
	linux-2.6-xen-0040-xen-x86_64-Make-hypercall-assembly-code-work.patch 
	linux-2.6-xen-0041-xen-x86_64-pda-initialization.patch 
	linux-2.6-xen-0042-Disable-early_printk-by-default.patch 
	linux-2.6-xen-0043-xen-Set-__HYPERVISOR_VIRT_START-for-x86_64.patch 
	linux-2.6-xen-0044-Set-__PAGE_OFFSET-as-required-by-Xen.patch 
	linux-2.6-xen-0045-DEBUG-Add-xprintk-to-log-directly-via-hypercall-fo.patch 
	linux-2.6-xen-0046-DEBUG-Add-xprintk-debugging-printk-prototype-to-hvc.patch 
	linux-2.6-xen-0047-Use-__pgd-on-mk_kernel_pgd.patch 
	linux-2.6-xen-0048-Include-user-page-tables-on-head_64.S.patch 
	linux-2.6-xen-0049-Avoid-using-mk_unsigned_long.patch 
	linux-2.6-xen-0050-Lots-of-unrelated-changes.patch 
	linux-2.6-xen-0051-Hack-disable-vsmp.patch 
	linux-2.6-xen-0052-Export-early_make_page_readonly.patch 
	linux-2.6-xen-0053-Disable-multicalls.c-too-verbose-debugging.patch 
	linux-2.6-xen-0054-Xen-64-bit-ready-MMU-operations.patch 
	linux-2.6-xen-0055-Some-xen-mmu-pv-ops-implemented.patch 
	linux-2.6-xen-0056-Trying-to-make-the-pagetable-initialization-code-wor.patch 
	linux-2.6-xen-0057-Xen-specific-find_early_table_space-FIXME.patch 
	linux-2.6-xen-0058-Xen-call-e820_print_map-when-setting-up-memory.patch 
	linux-2.6-xen-0059-Comment-debugging-msgs.patch 
	linux-2.6-xen-0060-Try-to-make-pagetables-read-only.patch 
	linux-2.6-xen-0061-Debug-dump-pgtables-on-make_page_readonly.patch 
	linux-2.6-xen-0062-Disable-apic-at-compile-time-FIXME.patch 
	linux-2.6-xen-0063-Parse-early-params-after-init_memory_mapping.patch 
	linux-2.6-xen-0064-xen-Move-addr_to_page-to-init.h.patch 
	linux-2.6-xen-0065-Make-xen_pxx_val-and-xen_make_pxx-handle-attr-bi.patch 
	linux-2.6-xen-0066-Pull-xen_finish_init_mappin-from-XS-upstream.patch 
	linux-2.6-xen-0067-Pull-spp_getpage-changes-from-XS-upstream-REVIEWM.patch 
	linux-2.6-xen-0068-Pull-xen_extend_init_mapping-from-XS-upstream-FIX.patch 
	linux-2.6-xen-0069-New-enum-fixed_addresses-values-REVIEWME.patch 
	linux-2.6-xen-0070-Reserve-bootmem-areas-used-by-Xen-FIXME.patch 
	linux-2.6-xen-0071-xen_convert_trap_info-use-sizeof-struct-gate_desc.patch 
	linux-2.6-xen-0072-Call-paravirt_pagetable_setup_-start-done-REVIEW.patch 
	linux-2.6-xen-0073-ifdef-CONFIG_X86_32-on-xen-enlighten.c-REVIEWME.patch 
	linux-2.6-xen-0074-Handle-Xen-exception-stack-it-is-different-from-bar.patch 
	linux-2.6-xen-0075-Implement-64-bit-version-of-HYPERVISOR_set_callbacks.patch 
	linux-2.6-xen-0076-Make-arch_vcpu_info-be-of-the-right-size-on-both-32.patch 
	linux-2.6-xen-0077-Implement-asm-xen_iret.patch 
	linux-2.6-xen-0078-xen-64-xen_iret-use-iretq-directly-if-returning-t.patch 
	linux-2.6-xen-0079-Implement-xen_irqenable_syscall_ret.patch 
	linux-2.6-xen-0080-DEBUG-xen_iret-always-return-through-the-hyperviso.patch 
	linux-2.6-xen-0081-Implement-some-xen-callbacks-on-xen-entry_64.S.patch 
	linux-2.6-xen-0082-Xen-specific-ifdef-hacks-on-kernel-entry_64.S-FIXM.patch 
	linux-2.6-xen-0083-Disable-syscall32-code-temporarily-FIXME.patch 
	linux-2.6-xen-0084-Use-__KERNEL_DS-as-SS-when-returning-to-a-kernel-thr.patch 
	linux-2.6-xen-0085-Use-apic_xen-on-genapic-by-default-FIXME.patch 
	linux-2.6-xen-0086-irq-vector-ifdef-chainsaw-FIXME.patch 
	linux-2.6-xen-0087-ifdef-chainsaw-on-syscall_init-FIXME.patch 
	linux-2.6-xen-0088-Pull-xen-genapic-implementation-from-upstream-Xen.patch 
	linux-2.6-xen-0089-Debugging-printk-s.patch 
	linux-2.6-xen-0090-Leave-lazy_cpu_mode-on-__switch_to.patch 
	linux-2.6-xen-0091-xen-64-Handle-fs-and-gs-on-xen_load_tls-properl.patch 
	linux-2.6-xen-0092-Disable-vcpu_info_placement-temporarily-FIXME.patch 
	linux-2.6-xen-0093-Fix-typo-on-ifdef-again.patch 
	linux-2.6-xen-0094-DEBUG-Don-t-try-to-actually-read-the-page-on-show_.patch 
	linux-2.6-xen-0095-Make-load_gs_index-a-paravirt-operation.patch 
	linux-2.6-xen-0096-xen-pgd_walk-use-limit-argument-instead-of-FIXADD.patch 
	linux-2.6-xen-0097-xen-pgd_walk-Eliminate-BUG_ON-limit-FIXADDR_TOP.patch 
	linux-2.6-xen-0098-xen-pgd_walk-accept-start-parameter.patch 
	linux-2.6-xen-0099-xen-64-reserve_bootmem-xen_start_info-area.patch 
	linux-2.6-xen-0100-pvops-64-call-paravirt_post_allocator_init-on-set.patch 
	linux-2.6-xen-0101-use-write_gdt_entry-on-vsyscall_set_cpu-CLEANME.patch 
	linux-2.6-xen-0102-xen-64-implement-xen_load_gs_index.patch 
	linux-2.6-xen-0103-Make-xen_pgd_unpin-non-static-REVIEWME.patch 
	linux-2.6-xen-0104-Xen-64-pgd-allocation-hack-FIXME.patch 
	linux-2.6-xen-0105-Set-both-kernel-and-user-PGDs-on-pgd_populate-FI.patch 
	linux-2.6-xen-0106-Multi-pagetable-write_cr3-implementation-FIXME.patch 
	linux-2.6-xen-0107-Disable-the-weird-count-loop-on-kcons_write_dom0.patch 
	linux-2.6-xen-0108-Make-xen_start_info-read-only.patch 
	linux-2.6-xen-0109-Hack-to-implement-return-to-userspace-without-SWAPGS.patch 
	linux-2.6-xen-0110-Xen-SEGBASE_-defines.patch 
	linux-2.6-xen-0111-Xen-HYPERVISOR_set_segment_base-implementation.patch 
	linux-2.6-xen-0112-Change-signature-of-paravirt_alloc_-pt-pd-REVIEWME.patch 
	linux-2.6-xen-0113-Comment-e820_print_map-call-TEMPORARY.patch 
	linux-2.6-xen-0114-Xen-missing-includes.patch 
	linux-2.6-xen-0115-asm-x86-pgtable_64.h-include-linux-spinlock.h.patch 
	linux-2.6-xen-0116-asm-x86-pgtable.h-include-asm-page.h.patch 
	linux-2.6-xen-0117-fix-pxxval_t-usage-on-mm-init_64.c.patch 
	linux-2.6-xen-0118-Missing-Xen-include.patch 
	linux-2.6-xen-0119-un-static-ipi_to_irq.patch 
	linux-2.6-xen-0120-Don-t-use-_PAGE_GLOBAL-bit-under-Xen-FIXME.patch 
	linux-2.6-xen-0121-Trying-to-organize-the-xen-bootmem-allocation-mess.patch 
	linux-2.6-xen-0122-Xen-reserve_bootmem-xenstore-and-console-interfac.patch 
	linux-2.6-xen-0123-pvops-64-call-paravirt_activate_mm-on-activate_mm.patch 
	linux-2.6-xen-0124-Xen-64-bit-support-on-xen_pgd_pin.patch 
	linux-2.6-xen-0125-Xen-64-pin-user-PGD-on-activate_mm-and-dup_mmap.patch 
	linux-2.6-xen-0126-Hack-pgd_walk-to-walk-to-TASK_SIZE-PAGE_SIZE-on-x8.patch 
	linux-2.6-xen-0127-Xen-64-Unpin-user-pagetable-on-xen_pgd_unpin.patch 
	linux-2.6-xen-0128-Use-un-pin_page-when-un-pinning-pgd.patch 
	linux-2.6-xen-0129-Allow-enabling-Xen-on-x86_64.patch 
	linux-2.6-xen-0130-Add-include-linux-spinlock_types.h-to-asm-x86-pgt.patch 
	linux-2.6-xen-0131-Restore-some-sanity-on-the-initial-pagetable-bootmem.patch 
	linux-2.6-xen-0132-Xen-Use-system_call_after_swapgs-as-the-syscall-c.patch 
	linux-2.6-xen-0133-Add-a-system_call_after_saveargs-label-to-entry_64.S.patch 
	linux-2.6-xen-0134-Create-xen-specific-syscall-entry.patch 
	linux-2.6-xen-0135-syscall-related-Xen-ifdefs-FIXME.patch 
	linux-2.6-xen-0136-Point-set_pte-to-xen_set_pte-since-the-beginning.patch 
	linux-2.6-xen-0137-DEBUG-slab-debugging.patch 
	linux-2.6-xen-0138-pvops-64-Include-rsi-on-the-register-clobber-list.patch 
	linux-2.6-xen-0139-Xen-64-quick-ugly-hack-to-fix-pgd_clear-pagetabl.patch 
	linux-2.6-xen-0140-Add-missing-acpi-include-to-xen-setup.c.patch 
	linux-2.6-xen-0141-Don-t-use-FIX_VDSO-on-64-bit.patch 
	linux-2.6-xen-0142-Mark-init-pages-read-write-again-on-free_init_pages.patch 
	linux-2.6-xen-0143-reserve_early-kernel-text-and-data-segments.patch 
	linux-2.6-xen-0144-Xen-Clear-__START_KERNEL_map-PTEs-on-free_init_page.patch 
	linux-2.6-xen-0145-Set-pvops-machine_ops-for-Xen-on-x86_64-also-MERGE.patch 
	linux-2.6-xen-0146-Pull-xen_failsafe_callback-implementation-from-XenSo.patch 
	linux-2.6-xen-0147-Save-fs-and-gs-before-load_TLS-and-arch_leave_la.patch 
	linux-2.6-xen-0148-xen-64-Clear-fs-on-xen_load_tls.patch 
	linux-2.6-xen-0149-ia32entry.S-Replace-cli-sti-cases-with-DISABLE_INTE.patch 
	linux-2.6-xen-0150-Introduce-xen_ia32_syscall.patch 
	linux-2.6-xen-0151-Use-xen_ia32_syscall-if-CONFIG_XEN-is-enabled-FIX.patch 
	linux-2.6-xen-0152-Make-the-int80-and-syscall-vdso32-implementations-se.patch 
	linux-2.6-xen-0153-Use-vdso32-int80-by-default-if-Xen-is-enabled-FIXME.patch 
	linux-2.6-xen-0154-xen_pgd_pin-use-TASK_SIZE64-on-x86_64.patch 
	linux-2.6-xen-0155-paravirt-ops-64-Save-rdi-also-on-asm-version-of-PV.patch 
	linux-2.6-xen-0156-X86_VSMP-make-not-depend-on-XEN-REVIEWME.patch 
	linux-2.6-xen-0157-Add-do_IRQ-prototype-to-asm-x86-irq_64.h.patch 
	linux-2.6-xen-0158-Disable-sysenter-on-x86_64-temporarily-REVIEWME.patch 
	linux-2.6-xen-0159-Add-xen_-alloc-release-_pud-functions-for-x86_64-x.patch 
	linux-2.6-xen-0160-Extract-reserve_initrd-from-x86_64_start_kernel.patch 
	linux-2.6-xen-0161-Make-reserve_initrd-non-static.patch 
	linux-2.6-xen-0162-xen-64-Reserve-initrd-on-xen_start_kernel-also.patch 
	linux-2.6.25.tar.bz2.sign patch-2.6.26-rc6-git2.bz2.sign 
	patch-2.6.26-rc6.bz2.sign 
Log Message:
* Fri Jun 18 2008 Mark McLoughlin <markmc at redhat.com>
- Rebase to kernel-2_6_27-0_159_rc0_git6_fc10
- Drop Eduardo's 64bit tree and switch to Jeremy's x86.git tree
- Re-enable SMP etc.


ext4-patchqueue.patch:

--- NEW FILE ext4-patchqueue.patch ---
Index: linux-2.6/fs/ext4/ext4.h
===================================================================
--- linux-2.6.orig/fs/ext4/ext4.h	2008-07-07 20:08:38.789291868 -0500
+++ linux-2.6/fs/ext4/ext4.h	2008-07-14 17:16:50.156291373 -0500
@@ -22,7 +22,7 @@
 #include "ext4_i.h"
 
 /*
- * The second extended filesystem constants/structures
+ * The fourth extended filesystem constants/structures
  */
 
 /*
@@ -45,7 +45,7 @@
 #define ext4_debug(f, a...)						\
 	do {								\
 		printk (KERN_DEBUG "EXT4-fs DEBUG (%s, %d): %s:",	\
-			__FILE__, __LINE__, __FUNCTION__);		\
+			__FILE__, __LINE__, __func__);			\
 		printk (KERN_DEBUG f, ## a);				\
 	} while (0)
 #else
@@ -74,6 +74,9 @@
 #define EXT4_MB_HINT_GOAL_ONLY		256
 /* goal is meaningful */
 #define EXT4_MB_HINT_TRY_GOAL		512
+/* blocks already pre-reserved by delayed allocation */
+#define EXT4_MB_DELALLOC_RESERVED      1024
+
 
 struct ext4_allocation_request {
 	/* target inode for block we're allocating */
@@ -94,6 +97,11 @@ struct ext4_allocation_request {
 	unsigned long len;
 	/* flags. see above EXT4_MB_HINT_* */
 	unsigned long flags;
+	/*
+	 * for ext4 online defrag:
+	 * the block group which is excepted from allocation target
+	 */
+	long long excepted_group;
 };
 
 /*
@@ -170,6 +178,15 @@ struct ext4_group_desc
 	__u32	bg_reserved2[3];
 };
 
+/*
+ * Structure of a flex block group info
+ */
+
+struct flex_groups {
+	__u32 free_inodes;
+	__u32 free_blocks;
+};
+
 #define EXT4_BG_INODE_UNINIT	0x0001 /* Inode table/bitmap not in use */
 #define EXT4_BG_BLOCK_UNINIT	0x0002 /* Block bitmap not in use */
 #define EXT4_BG_INODE_ZEROED	0x0004 /* On-disk itable initialized to zero */
@@ -289,6 +306,14 @@ struct ext4_new_group_data {
 #define EXT4_IOC_GETRSVSZ		_IOR('f', 5, long)
 #define EXT4_IOC_SETRSVSZ		_IOW('f', 6, long)
 #define EXT4_IOC_MIGRATE		_IO('f', 7)
+#define EXT4_IOC_FIBMAP			_IOW('f', 9, ext4_fsblk_t)
+#define EXT4_IOC_DEFRAG		_IOW('f', 10, struct ext4_ext_defrag_data)
+#define EXT4_IOC_GROUP_INFO	_IOW('f', 11, struct ext4_group_data_info)
+#define EXT4_IOC_FREE_BLOCKS_INFO	_IOW('f', 12, struct ext4_extents_info)
+#define EXT4_IOC_EXTENTS_INFO		_IOW('f', 13, struct ext4_extents_info)
+#define EXT4_IOC_RESERVE_BLOCK		_IOW('f', 14, struct ext4_extents_info)
+#define EXT4_IOC_MOVE_VICTIM		_IOW('f', 15, struct ext4_extents_info)
+#define EXT4_IOC_BLOCK_RELEASE		_IO('f', 8)
 
 /*
  * ioctl commands in 32 bit emulation
@@ -306,6 +331,57 @@ struct ext4_new_group_data {
 #define EXT4_IOC32_GETVERSION_OLD	FS_IOC32_GETVERSION
 #define EXT4_IOC32_SETVERSION_OLD	FS_IOC32_SETVERSION
 
+/*
+ * Will go away.
+ * ext4 online defrag supports only 4KB block size.
+ */
+#define DEFRAG_BLOCK_SIZE	4096
+
+/*
+ * The following four macros are used for the defrag force mode.
+ *
+ * DEFRAG_MAX_ENT:	the maximum number of extents for exchanging between
+ *			kernel-space and user-space per an ioctl
+ * DEFRAG_FORCE_TRY:	check whether we have free space fragmentation or not
+ * DEFRAG_FORCE_VICTIM:	move victim extents to make sufficient space
+ * DEFRAG_FORCE_GATHER:	move the target file into the free space made in the
+ *			DEFRAG_FORCE_VICTIM phase
+ */
+#define DEFRAG_MAX_ENT		32
+#define DEFRAG_FORCE_TRY	1
+#define DEFRAG_FORCE_VICTIM	2
+#define DEFRAG_FORCE_GATHER	3
+
+struct ext4_extent_data {
+	ext4_lblk_t block;		/* start logical block number */
+	ext4_fsblk_t start;		/* start physical block number */
+	int len;			/* blocks count */
+};
+
+struct ext4_ext_defrag_data {
+	ext4_lblk_t start_offset;	/* start offset to defrag in blocks */
+	ext4_lblk_t defrag_size;	/* size of defrag in blocks */
+	ext4_fsblk_t goal;		/* block offset for allocation */
+	int flag;			/* free space mode flag */
+	struct ext4_extent_data ext;
+};
+
+struct ext4_group_data_info {
+	int s_blocks_per_group;		/* blocks per group */
+	int s_inodes_per_group;		/* inodes per group */
+};
+
+struct ext4_extents_info {
+	unsigned long long ino;		/* inode number */
+	int max_entries;		/* maximum extents count */
+	int entries;			/* extent number/count */
+	ext4_lblk_t f_offset;		/* file offset */
+	ext4_grpblk_t g_offset;		/* group offset */
+	ext4_fsblk_t goal;		/* block offset for allocation */
+	struct ext4_extent_data ext[DEFRAG_MAX_ENT];
+};
+
+#define EXT4_TRANS_META_BLOCKS 4 /* bitmap + group desc + sb + inode */
 
 /*
  *  Mount options
@@ -527,6 +603,7 @@ do {									       \
 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT	0x1000000 /* Journal Async Commit */
 #define EXT4_MOUNT_I_VERSION            0x2000000 /* i_version support */
 #define EXT4_MOUNT_MBALLOC		0x4000000 /* Buddy allocation support */
+#define EXT4_MOUNT_DELALLOC		0x8000000 /* Delalloc support */
 /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
 #ifndef _LINUX_EXT2_FS_H
 #define clear_opt(o, opt)		o &= ~EXT4_MOUNT_##opt
@@ -647,7 +724,10 @@ struct ext4_super_block {
 	__le16  s_mmp_interval;         /* # seconds to wait in MMP checking */
 	__le64  s_mmp_block;            /* Block for multi-mount protection */
 	__le32  s_raid_stripe_width;    /* blocks on all data disks (N*stride)*/
-	__u32   s_reserved[163];        /* Padding to the end of the block */
+	__u8	s_log_groups_per_flex;  /* FLEX_BG group size */
+	__u8	s_reserved_char_pad2;
+	__le16  s_reserved_pad;
+	__u32   s_reserved[162];        /* Padding to the end of the block */
 };
 
 #ifdef __KERNEL__
@@ -958,12 +1038,17 @@ extern ext4_grpblk_t ext4_block_group_of
 extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
 extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
 			ext4_group_t group);
-extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
+extern ext4_fsblk_t ext4_new_meta_block(handle_t *handle, struct inode *inode,
 			ext4_fsblk_t goal, int *errp);
-extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
+extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode,
 			ext4_fsblk_t goal, unsigned long *count, int *errp);
-extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
+extern ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
+					ext4_lblk_t iblock, ext4_fsblk_t goal,
+					unsigned long *count, int *errp);
+extern ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
 			ext4_fsblk_t goal, unsigned long *count, int *errp);
+extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
+						ext4_fsblk_t nblocks);
 extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
 			ext4_fsblk_t block, unsigned long count, int metadata);
 extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
@@ -977,6 +1062,17 @@ extern struct ext4_group_desc * ext4_get
 extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
 extern void ext4_init_block_alloc_info(struct inode *);
 extern void ext4_rsv_window_add(struct super_block *sb, struct ext4_reserve_window_node *rsv);
+extern void try_to_extend_reservation(struct ext4_reserve_window_node *,
+					struct super_block *, int);
+extern int alloc_new_reservation(struct ext4_reserve_window_node *,
+				ext4_grpblk_t, struct super_block *,
+				ext4_group_t, struct buffer_head *);
+extern ext4_grpblk_t bitmap_search_next_usable_block(ext4_grpblk_t,
+				struct buffer_head *, ext4_grpblk_t);
+extern int rsv_is_empty(struct ext4_reserve_window *rsv);
+extern int goal_in_my_reservation(struct ext4_reserve_window *rsv,
+				ext4_grpblk_t grp_goal, ext4_group_t group,
+				struct super_block *sb);
 
 /* dir.c */
 extern int ext4_check_dir_entry(const char *, struct inode *,
@@ -986,6 +1082,7 @@ extern int ext4_htree_store_dirent(struc
 				    __u32 minor_hash,
 				    struct ext4_dir_entry_2 *dirent);
 extern void ext4_htree_free_dir_info(struct dir_private_info *p);
+extern sector_t ext4_bmap(struct address_space *mapping, sector_t block);
 
 /* fsync.c */
[...9904 lines suppressed...]
+	unsigned int hole_size;
+	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
+	u64 len_bytes, phys_bytes, virt_bytes;
+	struct buffer_head *di_bh = NULL;
+	struct ocfs2_extent_rec rec;
+
+	ret = fiemap_check_flags(fieinfo, OCFS2_FIEMAP_FLAGS);
+	if (ret)
+		return ret;
+
+	ret = ocfs2_inode_lock(inode, &di_bh, 0);
+	if (ret) {
+		mlog_errno(ret);
+		goto out;
+	}
+
+	down_read(&OCFS2_I(inode)->ip_alloc_sem);
+
+	/*
+	 * Handle inline-data separately.
+	 */
+	if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
+		ret = ocfs2_fiemap_inline(inode, di_bh, fieinfo, map_start);
+		goto out_unlock;
+	}
+
+	cpos = map_start >> osb->s_clustersize_bits;
+	mapping_end = ocfs2_clusters_for_bytes(inode->i_sb,
+					       map_start + map_len);
+	mapping_end -= cpos;
+	is_last = 0;
+	while (cpos < mapping_end && !is_last) {
+		u32 fe_flags;
+
+		ret = ocfs2_get_clusters_nocache(inode, di_bh, cpos,
+						 &hole_size, &rec, &is_last);
+		if (ret) {
+			mlog_errno(ret);
+			goto out;
+		}
+
+		if (rec.e_blkno == 0ULL) {
+			cpos += hole_size;
+			continue;
+		}
+
+		fe_flags = 0;
+		if (rec.e_flags & OCFS2_EXT_UNWRITTEN)
+			fe_flags |= FIEMAP_EXTENT_UNWRITTEN;
+		if (is_last)
+			fe_flags |= FIEMAP_EXTENT_LAST;
+		len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits;
+		phys_bytes = le64_to_cpu(rec.e_blkno) << osb->sb->s_blocksize_bits;
+		virt_bytes = (u64)le32_to_cpu(rec.e_cpos) << osb->s_clustersize_bits;
+
+		ret = fiemap_fill_next_extent(fieinfo, virt_bytes, phys_bytes,
+					      len_bytes, fe_flags,
+					      inode->i_sb->s_dev);
+		if (ret)
+			break;
+
+		cpos = le32_to_cpu(rec.e_cpos)+ le16_to_cpu(rec.e_leaf_clusters);
+	}
+
+	if (ret > 0)
+		ret = 0;
+
+out_unlock:
+	brelse(di_bh);
+
+	up_read(&OCFS2_I(inode)->ip_alloc_sem);
+
+	ocfs2_inode_unlock(inode, 0);
+out:
+
+	return ret;
+}
Index: linux-2.6/fs/ocfs2/extent_map.h
===================================================================
--- linux-2.6.orig/fs/ocfs2/extent_map.h	2008-07-14 17:14:57.397291280 -0500
+++ linux-2.6/fs/ocfs2/extent_map.h	2008-07-14 17:16:47.259290989 -0500
@@ -50,4 +50,7 @@ int ocfs2_get_clusters(struct inode *ino
 int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
 				u64 *ret_count, unsigned int *extent_flags);
 
+int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+		 u64 map_start, u64 map_len);
+
 #endif  /* _EXTENT_MAP_H */
Index: linux-2.6/fs/ocfs2/file.c
===================================================================
--- linux-2.6.orig/fs/ocfs2/file.c	2008-07-14 17:14:57.397291280 -0500
+++ linux-2.6/fs/ocfs2/file.c	2008-07-14 17:16:47.285290893 -0500
@@ -2228,6 +2228,7 @@ const struct inode_operations ocfs2_file
 	.getattr	= ocfs2_getattr,
 	.permission	= ocfs2_permission,
 	.fallocate	= ocfs2_fallocate,
+	.fiemap		= ocfs2_fiemap,
 };
 
 const struct inode_operations ocfs2_special_file_iops = {
Index: linux-2.6/fs/ext2/ext2.h
===================================================================
--- linux-2.6.orig/fs/ext2/ext2.h	2008-07-14 17:14:53.944291751 -0500
+++ linux-2.6/fs/ext2/ext2.h	2008-07-14 17:16:48.757291178 -0500
@@ -133,6 +133,8 @@ extern void ext2_truncate (struct inode 
 extern int ext2_setattr (struct dentry *, struct iattr *);
 extern void ext2_set_inode_flags(struct inode *inode);
 extern void ext2_get_inode_flags(struct ext2_inode_info *);
+extern int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+		       u64 start, u64 len);
 int __ext2_write_begin(struct file *file, struct address_space *mapping,
 		loff_t pos, unsigned len, unsigned flags,
 		struct page **pagep, void **fsdata);
Index: linux-2.6/fs/ext2/file.c
===================================================================
--- linux-2.6.orig/fs/ext2/file.c	2008-07-14 17:14:53.944291751 -0500
+++ linux-2.6/fs/ext2/file.c	2008-07-14 17:16:48.782291153 -0500
@@ -86,4 +86,5 @@ const struct inode_operations ext2_file_
 #endif
 	.setattr	= ext2_setattr,
 	.permission	= ext2_permission,
+	.fiemap		= ext2_fiemap,
 };
Index: linux-2.6/fs/ext2/inode.c
===================================================================
--- linux-2.6.orig/fs/ext2/inode.c	2008-07-14 17:14:53.944291751 -0500
+++ linux-2.6/fs/ext2/inode.c	2008-07-14 17:16:48.825290935 -0500
@@ -31,6 +31,7 @@
 #include <linux/writeback.h>
 #include <linux/buffer_head.h>
 #include <linux/mpage.h>
+#include <linux/fiemap.h>
 #include "ext2.h"
 #include "acl.h"
 #include "xip.h"
@@ -704,6 +705,13 @@ int ext2_get_block(struct inode *inode, 
 
 }
 
+int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+		u64 start, u64 len)
+{
+	return generic_block_fiemap(inode, fieinfo, start, len,
+				    ext2_get_block);
+}
+
 static int ext2_writepage(struct page *page, struct writeback_control *wbc)
 {
 	return block_write_full_page(page, ext2_get_block, wbc);
Index: linux-2.6/fs/ext3/file.c
===================================================================
--- linux-2.6.orig/fs/ext3/file.c	2008-07-14 17:14:53.954291057 -0500
+++ linux-2.6/fs/ext3/file.c	2008-07-14 17:16:48.875291196 -0500
@@ -134,5 +134,6 @@ const struct inode_operations ext3_file_
 	.removexattr	= generic_removexattr,
 #endif
 	.permission	= ext3_permission,
+	.fiemap		= ext3_fiemap,
 };
 
Index: linux-2.6/fs/ext3/inode.c
===================================================================
--- linux-2.6.orig/fs/ext3/inode.c	2008-07-14 17:14:53.954291057 -0500
+++ linux-2.6/fs/ext3/inode.c	2008-07-14 17:16:48.901291166 -0500
@@ -36,6 +36,7 @@
 #include <linux/mpage.h>
 #include <linux/uio.h>
 #include <linux/bio.h>
+#include <linux/fiemap.h>
 #include "xattr.h"
 #include "acl.h"
 
@@ -981,6 +982,13 @@ out:
 	return ret;
 }
 
+int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+		u64 start, u64 len)
+{
+	return generic_block_fiemap(inode, fieinfo, start, len,
+				    ext3_get_block);
+}
+
 /*
  * `handle' can be NULL if create is zero
  */
Index: linux-2.6/include/linux/ext3_fs.h
===================================================================
--- linux-2.6.orig/include/linux/ext3_fs.h	2008-07-14 17:14:53.955291262 -0500
+++ linux-2.6/include/linux/ext3_fs.h	2008-07-14 17:16:48.991290977 -0500
@@ -836,6 +836,8 @@ extern void ext3_truncate (struct inode 
 extern void ext3_set_inode_flags(struct inode *);
 extern void ext3_get_inode_flags(struct ext3_inode_info *);
 extern void ext3_set_aops(struct inode *inode);
+extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+		       u64 start, u64 len);
 
 /* ioctl.c */
 extern int ext3_ioctl (struct inode *, struct file *, unsigned int,

git-linus.diff:

***** Error reading new file: [Errno 2] No such file or directory: 'git-linus.diff'
linux-2.6-debug-list_debug_rcu.patch:

--- NEW FILE linux-2.6-debug-list_debug_rcu.patch ---
list debug support for the rcu variants of the list helpers.
Also factor out the checking.

Signed-off-by: Dave Jones <davej at redhat.com>

diff --git a/include/linux/list.h b/include/linux/list.h
index 08cf4f6..f1bab0c 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -90,6 +90,7 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
+#ifndef CONFIG_DEBUG_LIST
 static inline void __list_add_rcu(struct list_head * new,
 		struct list_head * prev, struct list_head * next)
 {
@@ -99,6 +100,10 @@ static inline void __list_add_rcu(struct list_head * new,
 	next->prev = new;
 	prev->next = new;
 }
+#else
+extern void __list_add_rcu(struct list_head *new,
+		struct list_head *prev, struct list_head *next);
+#endif
 
 /**
  * list_add_rcu - add a new entry to rcu-protected list
@@ -197,11 +202,15 @@ extern void list_del(struct list_head *entry);
  * or call_rcu() must be used to defer freeing until an RCU
  * grace period has elapsed.
  */
+#ifndef CONFIG_DEBUG_LIST
 static inline void list_del_rcu(struct list_head *entry)
 {
 	__list_del(entry->prev, entry->next);
 	entry->prev = LIST_POISON2;
 }
+#else
+extern void list_del_rcu(struct list_head *entry);
+#endif
 
 /**
  * list_replace - replace old entry by new one
diff --git a/lib/list_debug.c b/lib/list_debug.c
index 4350ba9..609e5a8 100644
--- a/lib/list_debug.c
+++ b/lib/list_debug.c
@@ -9,6 +9,39 @@
 #include <linux/module.h>
 #include <linux/list.h>
 
+static void listcheck_add(struct list_head *next,
+	struct list_head *prev, char *funcname)
+{
+	if (unlikely(next->prev != prev)) {
+		printk(KERN_ERR "%s corruption. next->prev should be "
+			"prev (%p), but was %p. (next=%p).\n",
+			funcname, prev, next->prev, next);
+		BUG();
+	}
+	if (unlikely(prev->next != next)) {
+		printk(KERN_ERR "%s corruption. prev->next should be "
+			"next (%p), but was %p. (prev=%p).\n",
+			funcname, next, prev->next, prev);
+		BUG();
+	}
+}
+
+static void listcheck_del(struct list_head *entry, char *funcname)
+{
+	if (unlikely(entry->prev->next != entry)) {
+		printk(KERN_ERR "%s corruption. prev->next should be %p, "
+				"but was %p\n",
+				funcname, entry, entry->prev->next);
+		BUG();
+	}
+	if (unlikely(entry->next->prev != entry)) {
+		printk(KERN_ERR "%s corruption. next->prev should be %p, "
+				"but was %p\n",
+				funcname, entry, entry->next->prev);
+		BUG();
+	}
+}
+
 /*
  * Insert a new entry between two known consecutive entries.
  *
@@ -20,18 +53,7 @@ void __list_add(struct list_head *new,
 			      struct list_head *prev,
 			      struct list_head *next)
 {
-	if (unlikely(next->prev != prev)) {
-		printk(KERN_ERR "list_add corruption. next->prev should be "
-			"prev (%p), but was %p. (next=%p).\n",
-			prev, next->prev, next);
-		BUG();
-	}
-	if (unlikely(prev->next != next)) {
-		printk(KERN_ERR "list_add corruption. prev->next should be "
-			"next (%p), but was %p. (prev=%p).\n",
-			next, prev->next, prev);
-		BUG();
-	}
+	listcheck_add(prev, next, "__list_add");
 	next->prev = new;
 	new->next = next;
 	new->prev = prev;
@@ -61,18 +83,42 @@ EXPORT_SYMBOL(list_add);
  */
 void list_del(struct list_head *entry)
 {
-	if (unlikely(entry->prev->next != entry)) {
-		printk(KERN_ERR "list_del corruption. prev->next should be %p, "
-				"but was %p\n", entry, entry->prev->next);
-		BUG();
-	}
-	if (unlikely(entry->next->prev != entry)) {
-		printk(KERN_ERR "list_del corruption. next->prev should be %p, "
-				"but was %p\n", entry, entry->next->prev);
-		BUG();
-	}
+	listcheck_del(entry, "list_del");
 	__list_del(entry->prev, entry->next);
 	entry->next = LIST_POISON1;
 	entry->prev = LIST_POISON2;
 }
 EXPORT_SYMBOL(list_del);
+
+/*
+ * Insert a new entry between two known consecutive entries.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+void __list_add_rcu(struct list_head *new,
+		struct list_head *prev, struct list_head *next)
+{
+	listcheck_add(prev, next, "__list_add_rcu");
+
+	new->next = next;
+	new->prev = prev;
+	smp_wmb();
+	next->prev = new;
+	prev->next = new;
+}
+EXPORT_SYMBOL_GPL(__list_add_rcu);
+
+/**
+ * list_del_rcu - deletes entry from list without re-initialization
+ * @entry: the element to delete from the list.
+ *
+ * Note we can't poison the ->next pointer, see list.h for details.
+ */
+void list_del_rcu(struct list_head *entry)
+{
+	listcheck_del(entry, "list_del_rcu");
+	__list_del(entry->prev, entry->next);
+	entry->prev = LIST_POISON2;
+}
+EXPORT_SYMBOL_GPL(list_del_rcu);

linux-2.6-debug-softlockup-modules-list.patch:

--- NEW FILE linux-2.6-debug-softlockup-modules-list.patch ---
>From davej  Thu Jun 26 13:20:23 2008
Return-Path: <SRS0+cba5e387e114a98fb717+1768+infradead.org+arjan at casper.srs.infradead.org>
X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on
	gelk.kernelslacker.org
X-Spam-Level: 
X-Spam-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,
	UNPARSEABLE_RELAY autolearn=ham version=3.2.4
Received: from pobox.devel.redhat.com [10.11.255.8]
	by gelk.kernelslacker.org with IMAP (fetchmail-6.3.8)
	for <davej at localhost> (single-drop); Thu, 26 Jun 2008 13:20:23 -0400 (EDT)
Received: from pobox.devel.redhat.com ([unix socket])
	 by pobox.devel.redhat.com (Cyrus v2.2.12-Invoca-RPM-2.2.12-8.1.RHEL4) with LMTPA;
	 Thu, 26 Jun 2008 13:19:18 -0400
X-Sieve: CMU Sieve 2.2
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
	by pobox.devel.redhat.com (8.13.1/8.13.1) with ESMTP id m5QHJIwd028244
	for <davej at pobox.devel.redhat.com>; Thu, 26 Jun 2008 13:19:18 -0400
Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32])
	by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5QHJHg4028301
	for <davej at redhat.com>; Thu, 26 Jun 2008 13:19:17 -0400
Received: from casper.infradead.org (casper.infradead.org [85.118.1.10])
	by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id m5QHJ1vw004507
	for <davej at redhat.com>; Thu, 26 Jun 2008 13:19:01 -0400
Received: from c-67-171-131-73.hsd1.or.comcast.net ([67.171.131.73] helo=localhost.localdomain)
	by casper.infradead.org with esmtpsa (Exim 4.69 #1 (Red Hat Linux))
	id 1KBv7M-0004BD-LQ
	for davej at redhat.com; Thu, 26 Jun 2008 17:18:45 +0000
Date: Thu, 26 Jun 2008 10:18:59 -0700
From: Arjan van de Ven <arjan at infradead.org>
To: davej at redhat.com
Subject: Fw: [patch] softlockup: print a module list on being stuck
Message-ID: <20080626101859.4070f7d8 at infradead.org>
Organization: Intel
X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.10; i386-redhat-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-MIME-Error: demime acl condition: uuencoded line length does not match advertised number of bytes
X-SRS-Rewrite: SMTP reverse-path rewritten from <arjan at infradead.org> by casper.infradead.org
	See http://www.infradead.org/rpr.html
X-RedHat-Spam-Score: -1 
X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254
X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32
Status: RO
Content-Length: 1938
Lines: 62



Begin forwarded message:

Date: Wed, 25 Jun 2008 18:36:51 +0200
From: Ingo Molnar <mingo at elte.hu>
To: Linus Torvalds <torvalds at linux-foundation.org>
Cc: linux-kernel at vger.kernel.org, Arjan van de Ven <arjan at infradead.org>
Subject: [patch] softlockup: print a module list on being stuck



Linus,

Arjan has been observing lots of softlockup reports on kerneloops.org 
and would like to have the patch below in v2.6.26 to narrow the real 
source of it down some more, and has asked for this patch to be applied 
sooner than planned.

The patch is queued up for the next merge window at the moment. It's 
well-tested and obvious. The module list is printed here the same way 
it's printed for oopses.

Discard it if you feel in any way nervous about it.

	Ingo

---------------->
commit 688c91755dc3d3c03d8c67c1df13c02be258768e
Author: Arjan van de Ven <arjan at linux.intel.com>
Date:       Mon Jun 16 15:51:08 2008 -0700
CommitDate: Wed Jun 18 15:26:54 2008 +0200

    softlockup: print a module list on being stuck
    
    Most places in the kernel that go BUG: print a module list
    (which is very useful for doing statistics and finding patterns),
    however the softlockup detector does not do this yet.
    
    This patch adds the one line change to fix this gap.
    
    Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
    Signed-off-by: Ingo Molnar <mingo at elte.hu>


--- linux-2.6.25.noarch/kernel/softlockup.c~	2008-06-26 17:46:12.000000000 -0400
+++ linux-2.6.25.noarch/kernel/softlockup.c	2008-06-26 17:46:44.000000000 -0400
@@ -120,6 +120,7 @@ void softlockup_tick(void)
 	printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n",
 			this_cpu, now - touch_timestamp,
 			current->comm, task_pid_nr(current));
+	print_modules();
 	if (regs)
 		show_regs(regs);
 	else

linux-2.6-defaults-acpi-video.patch:

--- NEW FILE linux-2.6-defaults-acpi-video.patch ---
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index d8d7596..a1b7117 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -71,7 +71,7 @@ MODULE_AUTHOR("Bruno Ducrot");
 MODULE_DESCRIPTION("ACPI Video Driver");
 MODULE_LICENSE("GPL");
 
-static int brightness_switch_enabled = 1;
+static int brightness_switch_enabled = 0;
 module_param(brightness_switch_enabled, bool, 0644);
 
 static int acpi_video_bus_add(struct acpi_device *device);

linux-2.6-export-shmem-bits-for-gem.patch:

--- NEW FILE linux-2.6-export-shmem-bits-for-gem.patch ---
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c31a9cd..d3466e9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -713,6 +713,17 @@ static inline int shmem_lock(struct file *file, int lock,
 #endif
 struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
 
+/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */
+enum sgp_type {
+	SGP_READ,	/* don't exceed i_size, don't allocate page */
+	SGP_CACHE,	/* don't exceed i_size, may allocate page */
+	SGP_DIRTY,	/* like SGP_CACHE, but set new page dirty */
+	SGP_WRITE,	/* may exceed i_size, may allocate page */
+};
+
+extern int shmem_getpage(struct inode *inode, unsigned long idx,
+			 struct page **pagep, enum sgp_type sgp, int *type);
+
 int shmem_zero_setup(struct vm_area_struct *);
 
 #ifndef CONFIG_MMU
diff --git a/mm/shmem.c b/mm/shmem.c
index e2a6ae1..b283554 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -77,14 +77,6 @@
 /* Pretend that each entry is of this size in directory's i_size */
 #define BOGO_DIRENT_SIZE 20
 
-/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */
-enum sgp_type {
-	SGP_READ,	/* don't exceed i_size, don't allocate page */
-	SGP_CACHE,	/* don't exceed i_size, may allocate page */
-	SGP_DIRTY,	/* like SGP_CACHE, but set new page dirty */
-	SGP_WRITE,	/* may exceed i_size, may allocate page */
-};
-
 #ifdef CONFIG_TMPFS
 static unsigned long shmem_default_max_blocks(void)
 {
@@ -97,9 +89,6 @@ static unsigned long shmem_default_max_inodes(void)
 }
 #endif
 
-static int shmem_getpage(struct inode *inode, unsigned long idx,
-			 struct page **pagep, enum sgp_type sgp, int *type);
-
 static inline struct page *shmem_dir_alloc(gfp_t gfp_mask)
 {
 	/*
@@ -1173,8 +1162,8 @@ static inline struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo)
  * vm. If we swap it in we mark it dirty since we also free the swap
  * entry since a page cannot live in both the swap and page cache
  */
-static int shmem_getpage(struct inode *inode, unsigned long idx,
-			struct page **pagep, enum sgp_type sgp, int *type)
+int shmem_getpage(struct inode *inode, unsigned long idx,
+		  struct page **pagep, enum sgp_type sgp, int *type)
 {
 	struct address_space *mapping = inode->i_mapping;
 	struct shmem_inode_info *info = SHMEM_I(inode);
@@ -1421,6 +1410,7 @@ failed:
 	}
 	return error;
 }
+EXPORT_SYMBOL(shmem_getpage);
 
 static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
@@ -2558,6 +2548,7 @@ put_memory:
 	shmem_unacct_size(flags, size);
 	return ERR_PTR(error);
 }
+EXPORT_SYMBOL(shmem_file_setup);
 
 /**
  * shmem_zero_setup - setup a shared anonymous mapping

linux-2.6-lockdep-uvc.patch:

--- NEW FILE linux-2.6-lockdep-uvc.patch ---
>From davej  Mon Jul  7 13:41:07 2008
Return-Path: <linux-kernel-owner at vger.kernel.org>
X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on
	gelk.kernelslacker.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,MISSING_MIMEOLE,
	RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.2.4
Received: from pobox.devel.redhat.com [10.11.255.8]
	by gelk.kernelslacker.org with IMAP (fetchmail-6.3.8)
	for <davej at localhost> (single-drop); Mon, 07 Jul 2008 13:41:07 -0400 (EDT)
Received: from pobox.devel.redhat.com ([unix socket])
	 by pobox.devel.redhat.com (Cyrus v2.2.12-Invoca-RPM-2.2.12-8.1.RHEL4) with LMTPA;
	 Mon, 07 Jul 2008 13:41:06 -0400
X-Sieve: CMU Sieve 2.2
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
	by pobox.devel.redhat.com (8.13.1/8.13.1) with ESMTP id m67Hf66M019742
	for <davej at pobox.devel.redhat.com>; Mon, 7 Jul 2008 13:41:06 -0400
Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32])
	by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m67Hf57u021300;
	Mon, 7 Jul 2008 13:41:05 -0400
Received: from vger.kernel.org (vger.kernel.org [209.132.176.167])
	by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id m67HCQvN003998;
	Mon, 7 Jul 2008 13:40:52 -0400
Received: (majordomo at vger.kernel.org) by vger.kernel.org via listexpand
	id S1755714AbYGGRkj (ORCPT <rfc822;zwu at redhat.com> + 8 others);
	Mon, 7 Jul 2008 13:40:39 -0400
Received: (majordomo at vger.kernel.org) by vger.kernel.org id S1753898AbYGGRkc
	(ORCPT <rfc822;linux-kernel-outgoing>);
	Mon, 7 Jul 2008 13:40:32 -0400
Received: from qmta01.westchester.pa.mail.comcast.net ([76.96.62.16]:57787
	"EHLO QMTA01.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK)
	by vger.kernel.org with ESMTP id S1753751AbYGGRkb (ORCPT
	<rfc822;linux-kernel at vger.kernel.org>);
	Mon, 7 Jul 2008 13:40:31 -0400
Received: from OMTA06.westchester.pa.mail.comcast.net ([76.96.62.51])
	by QMTA01.westchester.pa.mail.comcast.net with comcast
	id n4481Z00n16LCl05103200; Mon, 07 Jul 2008 17:40:30 +0000
Received: from hellmouth.digitalvampire.org ([76.126.214.20])
	by OMTA06.westchester.pa.mail.comcast.net with comcast
	id n5gV1Z0030SyXVG3S5gV7w; Mon, 07 Jul 2008 17:40:30 +0000
X-Authority-Analysis: v=1.0 c=1 a=fmkApugzUIIA:10 a=kpXAE35kjxYA:10
 a=_IJnZSgf9f5JNVSi5xgA:9 a=slYTfeDnTvTaJRxpne8A:7
 a=8mjJQg54jTdEpqmjD8f-b9wE5HgA:4 a=JTUSPwgBgNAA:10 a=oCUJXWGl-OwA:10
Received: from shaolin.home.digitalvampire.org (shaolin.home.digitalvampire.org [10.1.0.2])
	by hellmouth.digitalvampire.org (Postfix) with ESMTP id A1F6382D52;
	Mon,  7 Jul 2008 10:40:28 -0700 (PDT)
Received: by shaolin.home.digitalvampire.org (Postfix, from userid 1000)
	id 730202B82D0; Mon,  7 Jul 2008 10:40:28 -0700 (PDT)
To: Romano Giannetti <romano at dea.icai.upcomillas.es>
Cc: linux-kernel at vger.kernel.org, linux-uvc-devel at berlios.de,
        laurent.pinchart at skynet.be
Subject: Re: Linux 2.6.26-rc9 circular lock with uvcvideo on resume from hibernation
X-Message-Flag: 	Warning: May contain useful information
X-Priority: 1
X-MSMail-Priority: High
References: <1215426867.5113.8.camel at pern>
From: Roland Dreier <roland at digitalvampire.org>
Date: 	Mon, 07 Jul 2008 10:40:28 -0700
In-Reply-To: <1215426867.5113.8.camel at pern> (Romano Giannetti's message of "Mon, 07 Jul 2008 12:34:26 +0200")
Message-ID: <878wwdbnjn.fsf at shaolin.home.digitalvampire.org>
User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.21 (linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Sender: linux-kernel-owner at vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: 	linux-kernel at vger.kernel.org
X-RedHat-Spam-Score: -3.999 
X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254
X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32
Status: RO
Content-Length: 3145
Lines: 75

 > [ 1132.942569] khubd/2264 is trying to acquire lock:
 > [ 1132.942614]  (videodev_lock){--..}, at: [<f89e4595>] video_unregister_device+0x15/0x60 [videodev]
 > [ 1132.942810] 
 > [ 1132.942811] but task is already holding lock:
 > [ 1132.942890]  (&uvc_driver.open_mutex){--..}, at: [<f8a35c09>] uvc_disconnect+0x29/0x50 [uvcvideo]

Thanks very much for the report (and for testing development kernels
with lockdep enabled!).  I think the patch below should fix this.

Laurent -- if this patch looks good to you, please forward on for
merging.

Thanks,
  Roland

---

[PATCH] uvc: Fix possible AB-BA deadlock with videodev_lock and open_mutex

The uvcvideo driver's uvc_v4l2_open() method is called from videodev's
video_open() function, which means it is called with the videodev_lock
mutex held.  uvc_v4l2_open() then takes uvc_driver.open_mutex to check
dev->state and avoid racing against a device disconnect, which means
that open_mutex must nest inside videodev_lock.

However uvc_disconnect() takes the open_mutex around setting
dev->state and also around putting its device reference.  However, if
uvc_disconnect() ends up dropping the last reference, it will call
uvc_delete(), which calls into the videodev code to unregister its
device, and this will end up taking videodev_lock.  This opens a
(unlikely in practice) window for an AB-BA deadlock and also causes a
lockdep warning because of the lock misordering.

Fortunately there is no apparent reason to hold open_mutex when doing
kref_put() in uvc_disconnect(): if uvc_v4l2_open() runs before the
state is set to UVC_DEV_DISCONNECTED, then it will take another
reference to the device and kref_put() won't call uvc_delete; if
uvc_v4l2_open() runs after the state is set, it will run before
uvc_delete(), see the state, and return immediately -- uvc_delete()
does uvc_unregister_video() (and hence video_unregister_device(),
which is synchronized with videodev_lock) as its first thing, so there
is no risk of use-after-free in uvc_v4l2_open().

Bug diagnosed based on a lockdep warning reported by Romano Giannetti
<romano at dea.icai.upcomillas.es>.

Signed-off-by: Roland Dreier <roland at digitalvampire.org>
---
 drivers/media/video/uvc/uvc_driver.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index 60ced58..5d60cb3 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1634,11 +1634,10 @@ static void uvc_disconnect(struct usb_interface *intf)
 	 * chance to increase the reference count (kref_get).
 	 */
 	mutex_lock(&uvc_driver.open_mutex);
-
 	dev->state |= UVC_DEV_DISCONNECTED;
-	kref_put(&dev->kref, uvc_delete);
-
 	mutex_unlock(&uvc_driver.open_mutex);
+
+	kref_put(&dev->kref, uvc_delete);
 }
 
 static int uvc_suspend(struct usb_interface *intf, pm_message_t message)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-2.6-net-8139-pio-mmio-fallback.patch:

--- NEW FILE linux-2.6-net-8139-pio-mmio-fallback.patch ---
From: Dave Jones <davej at redhat.com>
To: netdev at vger.kernel.org
Subject: [3/3] 8139too: Fall back to PIO when MMIO fails.

Signed-off-by: Dave Jones <davej at redhat.com>

--- linux-2.6.26.noarch/drivers/net/8139too.c~	2008-07-15 18:49:02.000000000 -0400
+++ linux-2.6.26.noarch/drivers/net/8139too.c	2008-07-15 18:53:07.000000000 -0400
@@ -784,6 +784,7 @@ static int __devinit rtl8139_init_board 
 	DPRINTK("PIO region size == 0x%02X\n", pio_len);
 	DPRINTK("MMIO region size == 0x%02lX\n", mmio_len);
 
+retry:
 	if (use_io) {
 		/* make sure PCI base addr 0 is PIO */
 		if (!(pio_flags & IORESOURCE_IO)) {
@@ -832,9 +833,10 @@ static int __devinit rtl8139_init_board 
 		/* ioremap MMIO region */
 		ioaddr = pci_iomap(pdev, 1, 0);
 		if (ioaddr == NULL) {
-			dev_err(&pdev->dev, "cannot remap MMIO, aborting\n");
-			rc = -EIO;
-			goto err_out;
+			dev_err(&pdev->dev, "cannot remap MMIO, trying PIO\n");
+			pci_release_regions(pdev);
+			use_io = 1;
+			goto retry;
 		}
 		dev->base_addr = (long) ioaddr;
 		tp->regs_len = mmio_len;

linux-2.6-ptrace-cleanup.patch:

--- NEW FILE linux-2.6-ptrace-cleanup.patch ---
 arch/powerpc/kernel/entry_32.S    |    4 +-
 arch/powerpc/kernel/ptrace.c      |   19 ++-
 arch/powerpc/kernel/signal.c      |   12 +-
 arch/powerpc/kernel/signal_32.c   |    2 +-
 arch/ppc/kernel/entry.S           |    4 +-
 arch/x86/ia32/ia32entry.S         |   14 +-
 arch/x86/kernel/entry_32.S        |   23 +--
 arch/x86/kernel/entry_64.S        |   20 +-
 arch/x86/kernel/ptrace.c          |  151 +++++--------
 arch/x86/kernel/signal_32.c       |    6 -
 arch/x86/kernel/signal_64.c       |    6 -
 arch/x86/kernel/step.c            |   35 +++-
 include/asm-powerpc/processor.h   |    2 +
 include/asm-powerpc/ptrace.h      |    4 +
 include/asm-powerpc/thread_info.h |   17 +-
 include/asm-x86/calling.h         |    6 +-
 include/asm-x86/ptrace-abi.h      |    6 +-
 include/asm-x86/thread_info_32.h  |   12 +-
 include/asm-x86/thread_info_64.h  |   17 ++-
 include/linux/init_task.h         |    4 +-
 include/linux/sched.h             |   26 +--
 kernel/exit.c                     |  451 +++++++++++++++++++++++--------------
 kernel/fork.c                     |    6 +-
 kernel/ptrace.c                   |   37 ++-
 24 files changed, 511 insertions(+), 373 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 0c8614d..3a05e9f 100644  
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -668,7 +668,7 @@ user_exc_return:		/* r10 contains MSR_KE
 	/* Check current_thread_info()->flags */
 	rlwinm	r9,r1,0,0,(31-THREAD_SHIFT)
 	lwz	r9,TI_FLAGS(r9)
-	andi.	r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED)
+	andi.	r0,r9,_TIF_USER_WORK_MASK
 	bne	do_work
 
 restore_user:
@@ -925,7 +925,7 @@ recheck:
 	lwz	r9,TI_FLAGS(r9)
 	andi.	r0,r9,_TIF_NEED_RESCHED
 	bne-	do_resched
-	andi.	r0,r9,_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK
+	andi.	r0,r9,_TIF_USER_WORK_MASK
 	beq	restore_user
 do_user_signal:			/* r10 contains MSR_KERNEL here */
 	ori	r10,r10,MSR_EE
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 2a9fe97..91ee077 100644  
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -619,12 +619,29 @@ void user_enable_single_step(struct task
 		task->thread.dbcr0 = DBCR0_IDM | DBCR0_IC;
 		regs->msr |= MSR_DE;
 #else
+		regs->msr &= ~MSR_BE;
 		regs->msr |= MSR_SE;
 #endif
 	}
 	set_tsk_thread_flag(task, TIF_SINGLESTEP);
 }
 
+void user_enable_block_step(struct task_struct *task)
+{
+	struct pt_regs *regs = task->thread.regs;
+
+	if (regs != NULL) {
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+		task->thread.dbcr0 = DBCR0_IDM | DBCR0_BT;
+		regs->msr |= MSR_DE;
+#else
+		regs->msr &= ~MSR_SE;
+		regs->msr |= MSR_BE;
+#endif
+	}
+	set_tsk_thread_flag(task, TIF_SINGLESTEP);
+}
+
 void user_disable_single_step(struct task_struct *task)
 {
 	struct pt_regs *regs = task->thread.regs;
@@ -634,7 +651,7 @@ void user_disable_single_step(struct tas
 		task->thread.dbcr0 = 0;
 		regs->msr &= ~MSR_DE;
 #else
-		regs->msr &= ~MSR_SE;
+		regs->msr &= ~(MSR_SE | MSR_BE);
 #endif
 	}
 	clear_tsk_thread_flag(task, TIF_SINGLESTEP);
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index a65a44f..ad55488 100644  
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -120,7 +120,7 @@ int do_signal(sigset_t *oldset, struct p
 	int ret;
 	int is32 = is_32bit_task();
 
-	if (test_thread_flag(TIF_RESTORE_SIGMASK))
+	if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK)
 		oldset = &current->saved_sigmask;
 	else if (!oldset)
 		oldset = &current->blocked;
@@ -131,9 +131,10 @@ int do_signal(sigset_t *oldset, struct p
 	check_syscall_restart(regs, &ka, signr > 0);
 
 	if (signr <= 0) {
+		struct thread_info *ti = current_thread_info();
 		/* No signal to deliver -- put the saved sigmask back */
-		if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
-			clear_thread_flag(TIF_RESTORE_SIGMASK);
+		if (ti->local_flags & _TLF_RESTORE_SIGMASK) {
+			ti->local_flags &= ~_TLF_RESTORE_SIGMASK;
 			sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
 		}
 		return 0;               /* no signals delivered */
@@ -169,10 +170,9 @@ int do_signal(sigset_t *oldset, struct p
 
 		/*
 		 * A signal was successfully delivered; the saved sigmask is in
-		 * its frame, and we can clear the TIF_RESTORE_SIGMASK flag.
+		 * its frame, and we can clear the TLF_RESTORE_SIGMASK flag.
 		 */
-		if (test_thread_flag(TIF_RESTORE_SIGMASK))
-			clear_thread_flag(TIF_RESTORE_SIGMASK);
+		current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK;
 	}
 
 	return ret;
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index ad69434..4ae16d1 100644  
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -243,7 +243,7 @@ long sys_sigsuspend(old_sigset_t mask)
 
  	current->state = TASK_INTERRUPTIBLE;
  	schedule();
- 	set_thread_flag(TIF_RESTORE_SIGMASK);
+	set_restore_sigmask();
  	return -ERESTARTNOHAND;
 }
 
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index 5f3a5d0..fcd830a 100644  
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -647,7 +647,7 @@ user_exc_return:		/* r10 contains MSR_KE
 	/* Check current_thread_info()->flags */
 	rlwinm	r9,r1,0,0,18
 	lwz	r9,TI_FLAGS(r9)
-	andi.	r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED)
+	andi.	r0,r9,_TIF_USER_WORK_MASK
 	bne	do_work
 
 restore_user:
@@ -898,7 +898,7 @@ recheck:
 	lwz	r9,TI_FLAGS(r9)
 	andi.	r0,r9,_TIF_NEED_RESCHED
 	bne-	do_resched
-	andi.	r0,r9,_TIF_SIGPENDING
+	andi.	r0,r9,_TIF_USER_WORK_MASK
 	beq	restore_user
 do_user_signal:			/* r10 contains MSR_KERNEL here */
 	ori	r10,r10,MSR_EE
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index b5e329d..0b2ab50 100644  
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -37,6 +37,11 @@
 	movq	%rax,R8(%rsp)
 	.endm
 
+	/*
+	 * Reload arg registers from stack in case ptrace changed them.
+	 * We don't reload %eax because syscall_trace_enter() returned
+	 * the value it wants us to use in the table lookup.
+	 */
 	.macro LOAD_ARGS32 offset
 	movl \offset(%rsp),%r11d
 	movl \offset+8(%rsp),%r10d
@@ -46,7 +51,6 @@
 	movl \offset+48(%rsp),%edx
 	movl \offset+56(%rsp),%esi
 	movl \offset+64(%rsp),%edi
-	movl \offset+72(%rsp),%eax
 	.endm
 	
 	.macro CFI_STARTPROC32 simple
@@ -124,12 +128,12 @@ ENTRY(ia32_sysenter_target)
  	.previous	
 	GET_THREAD_INFO(%r10)
 	orl    $TS_COMPAT,threadinfo_status(%r10)
-	testl  $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
+	testl  $_TIF_WORK_SYSCALL_ENTRY,threadinfo_flags(%r10)
 	CFI_REMEMBER_STATE
 	jnz  sysenter_tracesys
-sysenter_do_call:	
 	cmpl	$(IA32_NR_syscalls-1),%eax
 	ja	ia32_badsys
+sysenter_do_call:
 	IA32_ARG_FIXUP 1
 	call	*ia32_sys_call_table(,%rax,8)
 	movq	%rax,RAX-ARGOFFSET(%rsp)
@@ -231,7 +235,7 @@ ENTRY(ia32_cstar_target)
 	.previous	
 	GET_THREAD_INFO(%r10)
 	orl   $TS_COMPAT,threadinfo_status(%r10)
-	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
+	testl $_TIF_WORK_SYSCALL_ENTRY,threadinfo_flags(%r10)
 	CFI_REMEMBER_STATE
 	jnz   cstar_tracesys
 cstar_do_call:	
@@ -325,7 +329,7 @@ ENTRY(ia32_syscall)
 	SAVE_ARGS 0,0,1
 	GET_THREAD_INFO(%r10)
 	orl   $TS_COMPAT,threadinfo_status(%r10)
-	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
+	testl $_TIF_WORK_SYSCALL_ENTRY,threadinfo_flags(%r10)
 	jnz ia32_tracesys
 ia32_do_syscall:	
 	cmpl $(IA32_NR_syscalls-1),%eax
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index c778e4f..f5d312c 100644  
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -331,7 +331,7 @@ sysenter_past_esp:
 	GET_THREAD_INFO(%ebp)
 
 	/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
-	testw $(_TIF_SYSCALL_EMU|_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
+	testw $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
 	jnz syscall_trace_entry
 	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
@@ -369,7 +369,7 @@ ENTRY(system_call)
 	GET_THREAD_INFO(%ebp)
 					# system call tracing in operation / emulation
 	/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
-	testw $(_TIF_SYSCALL_EMU|_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
+	testw $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
 	jnz syscall_trace_entry
 	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
@@ -382,10 +382,6 @@ syscall_exit:
 					# setting need_resched or sigpending
 					# between sampling and the iret
 	TRACE_IRQS_OFF
-	testl $X86_EFLAGS_TF,PT_EFLAGS(%esp)	# If tracing set singlestep flag on exit
-	jz no_singlestep
-	orl $_TIF_SINGLESTEP,TI_flags(%ebp)
-no_singlestep:
 	movl TI_flags(%ebp), %ecx
 	testw $_TIF_ALLWORK_MASK, %cx	# current->work
 	jne syscall_exit_work
@@ -513,12 +509,8 @@ END(work_pending)
 syscall_trace_entry:
 	movl $-ENOSYS,PT_EAX(%esp)
 	movl %esp, %eax
-	xorl %edx,%edx
-	call do_syscall_trace
-	cmpl $0, %eax
-	jne resume_userspace		# ret != 0 -> running under PTRACE_SYSEMU,
-					# so must skip actual syscall
-	movl PT_ORIG_EAX(%esp), %eax
+	call syscall_trace_enter
+	/* What it returned is what we'll actually use.  */
 	cmpl $(nr_syscalls), %eax
 	jnae syscall_call
 	jmp syscall_exit
@@ -527,14 +519,13 @@ END(syscall_trace_entry)
 	# perform syscall exit tracing
 	ALIGN
 syscall_exit_work:
-	testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP), %cl
+	testb $_TIF_WORK_SYSCALL_EXIT, %cl
 	jz work_pending
 	TRACE_IRQS_ON
-	ENABLE_INTERRUPTS(CLBR_ANY)	# could let do_syscall_trace() call
+	ENABLE_INTERRUPTS(CLBR_ANY)	# could let syscall_trace_leave() call
 					# schedule() instead
 	movl %esp, %eax
-	movl $1, %edx
-	call do_syscall_trace
+	call syscall_trace_leave
 	jmp resume_userspace
 END(syscall_exit_work)
 	CFI_ENDPROC
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 556a8df..21c72a9 100644  
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -244,7 +244,7 @@ ENTRY(system_call_after_swapgs)
 	movq  %rcx,RIP-ARGOFFSET(%rsp)
 	CFI_REL_OFFSET rip,RIP-ARGOFFSET
 	GET_THREAD_INFO(%rcx)
-	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
+	testl $_TIF_WORK_SYSCALL_ENTRY,threadinfo_flags(%rcx)
 	jnz tracesys
 	cmpq $__NR_syscall_max,%rax
 	ja badsys
@@ -305,7 +305,7 @@ sysret_signal:
 	leaq -ARGOFFSET(%rsp),%rdi # &pt_regs -> arg1
 	xorl %esi,%esi # oldset -> arg2
 	call ptregscall_common
-1:	movl $_TIF_NEED_RESCHED,%edi
+1:	movl $_TIF_WORK_MASK,%edi
 	/* Use IRET because user could have changed frame. This
 	   works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
 	DISABLE_INTERRUPTS(CLBR_NONE)
@@ -323,7 +323,12 @@ tracesys:			 
 	FIXUP_TOP_OF_STACK %rdi
 	movq %rsp,%rdi
 	call syscall_trace_enter
-	LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed it */
+	/*
+	 * Reload arg registers from stack in case ptrace changed them.
+	 * We don't reload %rax because syscall_trace_enter() returned
+	 * the value it wants us to use in the table lookup.
+	 */
+	LOAD_ARGS ARGOFFSET, 1
 	RESTORE_REST
 	cmpq $__NR_syscall_max,%rax
 	ja   int_ret_from_sys_call	/* RAX(%rsp) set to -ENOSYS above */
@@ -376,7 +381,7 @@ int_very_careful:
 	ENABLE_INTERRUPTS(CLBR_NONE)
 	SAVE_REST
 	/* Check for syscall exit trace */	
-	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edx
+	testl $_TIF_WORK_SYSCALL_EXIT,%edx
 	jz int_signal
 	pushq %rdi
 	CFI_ADJUST_CFA_OFFSET 8
@@ -384,7 +389,7 @@ int_very_careful:
 	call syscall_trace_leave
 	popq %rdi
 	CFI_ADJUST_CFA_OFFSET -8
-	andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
+	andl $~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU),%edi
 	jmp int_restore_rest
 	
 int_signal:
@@ -393,7 +398,7 @@ int_signal:
 	movq %rsp,%rdi		# &ptregs -> arg1
 	xorl %esi,%esi		# oldset -> arg2
 	call do_notify_resume
-1:	movl $_TIF_NEED_RESCHED,%edi	
+1:	movl $_TIF_WORK_MASK,%edi
 int_restore_rest:
 	RESTORE_REST
 	DISABLE_INTERRUPTS(CLBR_NONE)
@@ -647,9 +652,8 @@ retint_signal:
 	RESTORE_REST
 	DISABLE_INTERRUPTS(CLBR_NONE)
 	TRACE_IRQS_OFF
-	movl $_TIF_NEED_RESCHED,%edi
 	GET_THREAD_INFO(%rcx)
-	jmp retint_check
+	jmp retint_with_reschedule
 
 #ifdef CONFIG_PREEMPT
 	/* Returning to kernel space. Check if we need preemption */
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index a7835f2..652f550 100644  
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1357,8 +1357,6 @@ const struct user_regset_view *task_user
 #endif
 }
 
-#ifdef CONFIG_X86_32
-
 void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
 {
 	struct siginfo info;
@@ -1377,89 +1375,10 @@ void send_sigtrap(struct task_struct *ts
 	force_sig_info(SIGTRAP, &info, tsk);
 }
 
-/* notification of system call entry/exit
- * - triggered by current->work.syscall_trace
- */
-int do_syscall_trace(struct pt_regs *regs, int entryexit)
-{
-	int is_sysemu = test_thread_flag(TIF_SYSCALL_EMU);
-	/*
-	 * With TIF_SYSCALL_EMU set we want to ignore TIF_SINGLESTEP for syscall
-	 * interception
-	 */
-	int is_singlestep = !is_sysemu && test_thread_flag(TIF_SINGLESTEP);
-	int ret = 0;
-
-	/* do the secure computing check first */
-	if (!entryexit)
-		secure_computing(regs->orig_ax);
-
-	if (unlikely(current->audit_context)) {
-		if (entryexit)
-			audit_syscall_exit(AUDITSC_RESULT(regs->ax),
-						regs->ax);
-		/* Debug traps, when using PTRACE_SINGLESTEP, must be sent only
-		 * on the syscall exit path. Normally, when TIF_SYSCALL_AUDIT is
-		 * not used, entry.S will call us only on syscall exit, not
-		 * entry; so when TIF_SYSCALL_AUDIT is used we must avoid
-		 * calling send_sigtrap() on syscall entry.
-		 *
-		 * Note that when PTRACE_SYSEMU_SINGLESTEP is used,
-		 * is_singlestep is false, despite his name, so we will still do
-		 * the correct thing.
-		 */
-		else if (is_singlestep)
-			goto out;
-	}
-
-	if (!(current->ptrace & PT_PTRACED))
-		goto out;
-
-	/* If a process stops on the 1st tracepoint with SYSCALL_TRACE
-	 * and then is resumed with SYSEMU_SINGLESTEP, it will come in
-	 * here. We have to check this and return */
-	if (is_sysemu && entryexit)
-		return 0;
-
-	/* Fake a debug trap */
-	if (is_singlestep)
-		send_sigtrap(current, regs, 0);
-
- 	if (!test_thread_flag(TIF_SYSCALL_TRACE) && !is_sysemu)
-		goto out;
-
-	/* the 0x80 provides a way for the tracing parent to distinguish
-	   between a syscall stop and SIGTRAP delivery */
-	/* Note that the debugger could change the result of test_thread_flag!*/
-	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ? 0x80:0));
-
-	/*
-	 * this isn't the same as continuing with a signal, but it will do
-	 * for normal use.  strace only continues with a signal if the
-	 * stopping signal is not SIGTRAP.  -brl
-	 */
-	if (current->exit_code) {
-		send_sig(current->exit_code, current, 1);
-		current->exit_code = 0;
-	}
-	ret = is_sysemu;
-out:
-	if (unlikely(current->audit_context) && !entryexit)
-		audit_syscall_entry(AUDIT_ARCH_I386, regs->orig_ax,
-				    regs->bx, regs->cx, regs->dx, regs->si);
-	if (ret == 0)
-		return 0;
-
-	regs->orig_ax = -1; /* force skip of syscall restarting */
-	if (unlikely(current->audit_context))
-		audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax);
-	return 1;
-}
-
-#else  /* CONFIG_X86_64 */
-
 static void syscall_trace(struct pt_regs *regs)
 {
+	if (!(current->ptrace & PT_PTRACED))
+		return;
 
 #if 0
 	printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n",
@@ -1481,39 +1400,81 @@ static void syscall_trace(struct pt_regs
 	}
 }
 
-asmlinkage void syscall_trace_enter(struct pt_regs *regs)
+#ifdef CONFIG_X86_32
+# define IS_IA32	1
+#elif defined CONFIG_IA32_EMULATION
+# define IS_IA32	test_thread_flag(TIF_IA32)
+#else
+# define IS_IA32	0
+#endif
+
+/*
+ * We must return the syscall number to actually look up in the table.
+ * This can be -1L to skip running any syscall at all.
+ */
+asmregparm long syscall_trace_enter(struct pt_regs *regs)
 {
+	long ret = 0;
+
+	/*
+	 * If we stepped into a sysenter/syscall insn, it trapped in
+	 * kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
+	 * If user-mode had set TF itself, then it's still clear from
+	 * do_debug() and we need to set it again to restore the user
+	 * state.  If we entered on the slow path, TF was already set.
+	 */
+	if (test_thread_flag(TIF_SINGLESTEP))
+		regs->flags |= X86_EFLAGS_TF;
+
 	/* do the secure computing check first */
 	secure_computing(regs->orig_ax);
 
-	if (test_thread_flag(TIF_SYSCALL_TRACE)
-	    && (current->ptrace & PT_PTRACED))
+	if (unlikely(test_thread_flag(TIF_SYSCALL_EMU)))
+		ret = -1L;
+
+	if (ret || test_thread_flag(TIF_SYSCALL_TRACE))
 		syscall_trace(regs);
 
 	if (unlikely(current->audit_context)) {
-		if (test_thread_flag(TIF_IA32)) {
+		if (IS_IA32)
 			audit_syscall_entry(AUDIT_ARCH_I386,
 					    regs->orig_ax,
 					    regs->bx, regs->cx,
 					    regs->dx, regs->si);
-		} else {
+#ifdef CONFIG_X86_64
+		else
 			audit_syscall_entry(AUDIT_ARCH_X86_64,
 					    regs->orig_ax,
 					    regs->di, regs->si,
 					    regs->dx, regs->r10);
-		}
+#endif
 	}
+
+	return ret ?: regs->orig_ax;
 }
 
-asmlinkage void syscall_trace_leave(struct pt_regs *regs)
+asmregparm void syscall_trace_leave(struct pt_regs *regs)
 {
 	if (unlikely(current->audit_context))
 		audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax);
 
-	if ((test_thread_flag(TIF_SYSCALL_TRACE)
-	     || test_thread_flag(TIF_SINGLESTEP))
-	    && (current->ptrace & PT_PTRACED))
+	if (test_thread_flag(TIF_SYSCALL_TRACE))
 		syscall_trace(regs);
-}
 
-#endif	/* CONFIG_X86_32 */
+	/*
+	 * If TIF_SYSCALL_EMU is set, we only get here because of
+	 * TIF_SINGLESTEP (i.e. this is PTRACE_SYSEMU_SINGLESTEP).
+	 * We already reported this syscall instruction in
+	 * syscall_trace_enter(), so don't do any more now.
+	 */
+	if (unlikely(test_thread_flag(TIF_SYSCALL_EMU)))
+		return;
+
+	/*
+	 * If we are single-stepping, synthesize a trap to follow the
+	 * system call instruction.
+	 */
+	if (test_thread_flag(TIF_SINGLESTEP) &&
+	    (current->ptrace & PT_PTRACED))
+		send_sigtrap(current, regs, 0);
+}
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index d923736..295b5f5 100644  
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -657,12 +657,6 @@ static void do_signal(struct pt_regs *re
 void
 do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
 {
-	/* Pending single-step? */
-	if (thread_info_flags & _TIF_SINGLESTEP) {
-		regs->flags |= X86_EFLAGS_TF;
-		clear_thread_flag(TIF_SINGLESTEP);
-	}
-
 	/* deal with pending signal delivery */
 	if (thread_info_flags & _TIF_SIGPENDING)
 		do_signal(regs);
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index e53b267..bf87684 100644  
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -487,12 +487,6 @@ static void do_signal(struct pt_regs *re
 void do_notify_resume(struct pt_regs *regs, void *unused,
 		      __u32 thread_info_flags)
 {
-	/* Pending single-step? */
-	if (thread_info_flags & _TIF_SINGLESTEP) {
-		regs->flags |= X86_EFLAGS_TF;
-		clear_thread_flag(TIF_SINGLESTEP);
-	}
-
 #ifdef CONFIG_X86_MCE
 	/* notify userspace of pending MCEs */
 	if (thread_info_flags & _TIF_MCE_NOTIFY)
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index 92c20fe..e8b9863 100644  
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -105,6 +105,20 @@ static int is_setting_trap_flag(struct t
 static int enable_single_step(struct task_struct *child)
 {
 	struct pt_regs *regs = task_pt_regs(child);
+	unsigned long oflags;
+
+	/*
+	 * If we stepped into a sysenter/syscall insn, it trapped in
+	 * kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
+	 * If user-mode had set TF itself, then it's still clear from
+	 * do_debug() and we need to set it again to restore the user
+	 * state so we don't wrongly set TIF_FORCED_TF below.
+	 * If enable_single_step() was used last and that is what
+	 * set TIF_SINGLESTEP, then both TF and TIF_FORCED_TF are
+	 * already set and our bookkeeping is fine.
+	 */
+	if (unlikely(test_tsk_thread_flag(child, TIF_SINGLESTEP)))
+		regs->flags |= X86_EFLAGS_TF;
 
 	/*
 	 * Always set TIF_SINGLESTEP - this guarantees that
@@ -113,11 +127,7 @@ static int enable_single_step(struct tas
 	 */
 	set_tsk_thread_flag(child, TIF_SINGLESTEP);
 
-	/*
-	 * If TF was already set, don't do anything else
-	 */
-	if (regs->flags & X86_EFLAGS_TF)
-		return 0;
+	oflags = regs->flags;
 
 	/* Set TF on the kernel stack.. */
 	regs->flags |= X86_EFLAGS_TF;
@@ -126,9 +136,22 @@ static int enable_single_step(struct tas
 	 * ..but if TF is changed by the instruction we will trace,
 	 * don't mark it as being "us" that set it, so that we
 	 * won't clear it by hand later.
+	 *
+	 * Note that if we don't actually execute the popf because
+	 * of a signal arriving right now or suchlike, we will lose
+	 * track of the fact that it really was "us" that set it.
 	 */
-	if (is_setting_trap_flag(child, regs))
+	if (is_setting_trap_flag(child, regs)) {
+		clear_tsk_thread_flag(child, TIF_FORCED_TF);
 		return 0;
+	}
+
+	/*
+	 * If TF was already set, check whether it was us who set it.
+	 * If not, we should never attempt a block step.
+	 */
+	if (oflags & X86_EFLAGS_TF)
+		return test_tsk_thread_flag(child, TIF_FORCED_TF);
 
 	set_tsk_thread_flag(child, TIF_FORCED_TF);
 
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index cf83f2d..865db56 100644  
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -214,6 +214,8 @@ struct thread_struct {
 #define thread_saved_pc(tsk)    \
         ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
 
+#define task_pt_regs(tsk)	((struct pt_regs *)(tsk)->thread.regs)
+
 unsigned long get_wchan(struct task_struct *p);
 
 #define KSTK_EIP(tsk)  ((tsk)->thread.regs? (tsk)->thread.regs->nip: 0)
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 39023dd..6a3892d 100644  
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -135,7 +135,9 @@ do {									      \
  * These are defined as per linux/ptrace.h, which see.
  */
 #define arch_has_single_step()	(1)
+#define arch_has_block_step()	(1)
 extern void user_enable_single_step(struct task_struct *);
+extern void user_enable_block_step(struct task_struct *);
 extern void user_disable_single_step(struct task_struct *);
 
 #endif /* __ASSEMBLY__ */
@@ -276,4 +278,6 @@ extern void user_disable_single_step(str
 #define PPC_PTRACE_PEEKUSR_3264  0x91
 #define PPC_PTRACE_POKEUSR_3264  0x90
 
+#define PTRACE_SINGLEBLOCK	0x100	/* resume execution until next branch */
+
 #endif /* _ASM_POWERPC_PTRACE_H */
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index d030f5c..e079e81 100644  
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -116,7 +116,6 @@ static inline struct thread_info *curren
 #define TIF_SECCOMP		10	/* secure computing */
 #define TIF_RESTOREALL		11	/* Restore all regs (implies NOERROR) */
 #define TIF_NOERROR		12	/* Force successful syscall return */
-#define TIF_RESTORE_SIGMASK	13	/* Restore signal mask in do_signal */
 #define TIF_FREEZE		14	/* Freezing for suspend */
 #define TIF_RUNLATCH		15	/* Is the runlatch enabled? */
 #define TIF_ABI_PENDING		16	/* 32/64 bit switch needed */
@@ -134,21 +133,31 @@ static inline struct thread_info *curren
 #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
 #define _TIF_RESTOREALL		(1<<TIF_RESTOREALL)
 #define _TIF_NOERROR		(1<<TIF_NOERROR)
-#define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
 #define _TIF_FREEZE		(1<<TIF_FREEZE)
 #define _TIF_RUNLATCH		(1<<TIF_RUNLATCH)
 #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)
 #define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
 
-#define _TIF_USER_WORK_MASK	( _TIF_SIGPENDING | \
-				 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
+#define _TIF_USER_WORK_MASK	(_TIF_SIGPENDING | _TIF_NEED_RESCHED)
 #define _TIF_PERSYSCALL_MASK	(_TIF_RESTOREALL|_TIF_NOERROR)
 
 /* Bits in local_flags */
 /* Don't move TLF_NAPPING without adjusting the code in entry_32.S */
 #define TLF_NAPPING		0	/* idle thread enabled NAP mode */
+#define TLF_RESTORE_SIGMASK	1	/* Restore signal mask in do_signal */
 
 #define _TLF_NAPPING		(1 << TLF_NAPPING)
+#define _TLF_RESTORE_SIGMASK	(1 << TLF_RESTORE_SIGMASK)
+
+#ifndef __ASSEMBLY__
+#define HAVE_SET_RESTORE_SIGMASK	1
+static inline void set_restore_sigmask(void)
+{
+	struct thread_info *ti = current_thread_info();
+	ti->local_flags |= _TLF_RESTORE_SIGMASK;
+	set_bit(TIF_SIGPENDING, &ti->flags);
+}
+#endif	/* !__ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
 
diff --git a/include/asm-x86/calling.h b/include/asm-x86/calling.h
index f13e62e..2bc162e 100644  
--- a/include/asm-x86/calling.h
+++ b/include/asm-x86/calling.h
@@ -104,7 +104,7 @@
 	.endif
 	.endm
 
-	.macro LOAD_ARGS offset
+	.macro LOAD_ARGS offset, skiprax=0
 	movq \offset(%rsp),    %r11
 	movq \offset+8(%rsp),  %r10
 	movq \offset+16(%rsp), %r9
@@ -113,7 +113,10 @@
 	movq \offset+48(%rsp), %rdx
 	movq \offset+56(%rsp), %rsi
 	movq \offset+64(%rsp), %rdi
+	.if \skiprax
+	.else
 	movq \offset+72(%rsp), %rax
+	.endif
 	.endm
 
 #define REST_SKIP	6*8
diff --git a/include/asm-x86/ptrace-abi.h b/include/asm-x86/ptrace-abi.h
index f224eb3..72e7b9d 100644  
--- a/include/asm-x86/ptrace-abi.h
+++ b/include/asm-x86/ptrace-abi.h
@@ -73,11 +73,11 @@
 
 #ifdef __x86_64__
 # define PTRACE_ARCH_PRCTL	  30
-#else
-# define PTRACE_SYSEMU		  31
-# define PTRACE_SYSEMU_SINGLESTEP 32
 #endif
 
+#define PTRACE_SYSEMU		  31
+#define PTRACE_SYSEMU_SINGLESTEP  32
+
 #define PTRACE_SINGLEBLOCK	33	/* resume execution until next branch */
 
 #ifndef __ASSEMBLY__
diff --git a/include/asm-x86/thread_info_32.h b/include/asm-x86/thread_info_32.h
index b633882..3267d9c 100644  
--- a/include/asm-x86/thread_info_32.h
+++ b/include/asm-x86/thread_info_32.h
@@ -160,10 +160,19 @@ static inline struct thread_info *curren
 #define _TIF_DS_AREA_MSR	(1 << TIF_DS_AREA_MSR)
 #define _TIF_BTS_TRACE_TS	(1 << TIF_BTS_TRACE_TS)
 
+/* work to do in syscall_trace_enter() */
+#define _TIF_WORK_SYSCALL_ENTRY	\
+	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \
+	 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
+
+/* work to do in syscall_trace_leave() */
+#define _TIF_WORK_SYSCALL_EXIT	\
+	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP)
+
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK							\
 	(0x0000FFFF & ~(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT |	\
-			_TIF_SECCOMP | _TIF_SYSCALL_EMU))
+			_TIF_SINGLESTEP | _TIF_SECCOMP | _TIF_SYSCALL_EMU))
 /* work to do on any return to u-space */
 #define _TIF_ALLWORK_MASK	(0x0000FFFF & ~_TIF_SECCOMP)
 
diff --git a/include/asm-x86/thread_info_64.h b/include/asm-x86/thread_info_64.h
index cb69f70..a531e79 100644  
--- a/include/asm-x86/thread_info_64.h
+++ b/include/asm-x86/thread_info_64.h
@@ -107,6 +107,7 @@ static inline struct thread_info *stack_
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_SINGLESTEP		4	/* reenable singlestep on user return*/
 #define TIF_IRET		5	/* force IRET */
+#define TIF_SYSCALL_EMU		6	/* syscall emulation active */
 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
 #define TIF_SECCOMP		8	/* secure computing */
 #define TIF_MCE_NOTIFY		10	/* notify userspace of an MCE */
@@ -130,6 +131,7 @@ static inline struct thread_info *stack_
 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
 #define _TIF_IRET		(1 << TIF_IRET)
+#define _TIF_SYSCALL_EMU	(1 << TIF_SYSCALL_EMU)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
 #define _TIF_MCE_NOTIFY		(1 << TIF_MCE_NOTIFY)
@@ -146,15 +148,24 @@ static inline struct thread_info *stack_
 #define _TIF_BTS_TRACE_TS	(1 << TIF_BTS_TRACE_TS)
 #define _TIF_NOTSC		(1 << TIF_NOTSC)
 
+/* work to do in syscall_trace_enter() */
+#define _TIF_WORK_SYSCALL_ENTRY	\
+	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \
+	 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
+
+/* work to do in syscall_trace_leave() */
+#define _TIF_WORK_SYSCALL_EXIT	\
+	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP)
+
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK							\
-	(0x0000FFFF &							\
-	 ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP|_TIF_SECCOMP))
+	(0x0000FFFF & ~(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT |	\
+			_TIF_SINGLESTEP | _TIF_SECCOMP | _TIF_SYSCALL_EMU))
 /* work to do on any return to user space */
 #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
 
 #define _TIF_DO_NOTIFY_MASK						\
-	(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY|_TIF_HRTICK_RESCHED)
+	(_TIF_SIGPENDING|_TIF_MCE_NOTIFY|_TIF_HRTICK_RESCHED)
 
 /* flags to check in __switch_to() */
 #define _TIF_WORK_CTXSW							\
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 9927a88..93c45ac 100644  
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -140,8 +140,8 @@ extern struct group_info init_groups;
 		.nr_cpus_allowed = NR_CPUS,				\
 	},								\
 	.tasks		= LIST_HEAD_INIT(tsk.tasks),			\
-	.ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children),		\
-	.ptrace_list	= LIST_HEAD_INIT(tsk.ptrace_list),		\
+	.ptraced	= LIST_HEAD_INIT(tsk.ptraced),			\
+	.ptrace_entry	= LIST_HEAD_INIT(tsk.ptrace_entry),		\
 	.real_parent	= &tsk,						\
 	.parent		= &tsk,						\
 	.children	= LIST_HEAD_INIT(tsk.children),			\
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c5d3f84..75145b7 100644  
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1075,12 +1075,6 @@ struct task_struct {
 #endif
 
 	struct list_head tasks;
-	/*
-	 * ptrace_list/ptrace_children forms the list of my children
-	 * that were stolen by a ptracer.
-	 */
-	struct list_head ptrace_children;
-	struct list_head ptrace_list;
 
 	struct mm_struct *mm, *active_mm;
 
@@ -1102,18 +1096,25 @@ struct task_struct {
 	/* 
 	 * pointers to (original) parent process, youngest child, younger sibling,
 	 * older sibling, respectively.  (p->father can be replaced with 
-	 * p->parent->pid)
+	 * p->real_parent->pid)
 	 */
-	struct task_struct *real_parent; /* real parent process (when being debugged) */
-	struct task_struct *parent;	/* parent process */
+	struct task_struct *real_parent; /* real parent process */
+	struct task_struct *parent; /* recipient of SIGCHLD, wait4() reports */
 	/*
-	 * children/sibling forms the list of my children plus the
-	 * tasks I'm ptracing.
+	 * children/sibling forms the list of my natural children
 	 */
 	struct list_head children;	/* list of my children */
 	struct list_head sibling;	/* linkage in my parent's children list */
 	struct task_struct *group_leader;	/* threadgroup leader */
 
+	/*
+	 * ptraced is the list of tasks this task is using ptrace on.
+	 * This includes both natural children and PTRACE_ATTACH targets.
+	 * p->ptrace_entry is p's link on the p->parent->ptraced list.
+	 */
+	struct list_head ptraced;
+	struct list_head ptrace_entry;
+
 	/* PID/PID hash table linkage. */
 	struct pid_link pids[PIDTYPE_MAX];
 	struct list_head thread_group;
@@ -1870,9 +1871,6 @@ extern void wait_task_inactive(struct ta
 #define wait_task_inactive(p)	do { } while (0)
 #endif
 
-#define remove_parent(p)	list_del_init(&(p)->sibling)
-#define add_parent(p)		list_add_tail(&(p)->sibling,&(p)->parent->children)
-
 #define next_task(p)	list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
 
 #define for_each_process(p) \
diff --git a/kernel/exit.c b/kernel/exit.c
index 8f6185e..fa7b700 100644  
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -70,7 +70,7 @@ static void __unhash_process(struct task
 		__get_cpu_var(process_counts)--;
 	}
 	list_del_rcu(&p->thread_group);
-	remove_parent(p);
+	list_del_init(&p->sibling);
 }
 
 /*
@@ -151,6 +151,18 @@ static void delayed_put_task_struct(stru
 	put_task_struct(container_of(rhp, struct task_struct, rcu));
 }
 
+/*
+ * Do final ptrace-related cleanup of a zombie being reaped.
+ *
+ * Called with write_lock(&tasklist_lock) held.
+ */
+static void ptrace_release_task(struct task_struct *p)
+{
+	BUG_ON(!list_empty(&p->ptraced));
+	ptrace_unlink(p);
+	BUG_ON(!list_empty(&p->ptrace_entry));
+}
+
 void release_task(struct task_struct * p)
 {
 	struct task_struct *leader;
@@ -159,8 +171,7 @@ repeat:
 	atomic_dec(&p->user->processes);
 	proc_flush_task(p);
 	write_lock_irq(&tasklist_lock);
-	ptrace_unlink(p);
-	BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children));
+	ptrace_release_task(p);
 	__exit_signal(p);
 
 	/*
@@ -314,9 +325,8 @@ static void reparent_to_kthreadd(void)
 
 	ptrace_unlink(current);
 	/* Reparent to init */
-	remove_parent(current);
 	current->real_parent = current->parent = kthreadd_task;
-	add_parent(current);
+	list_move_tail(&current->sibling, &current->real_parent->children);
 
 	/* Set the exit signal to SIGCHLD so we signal init on exit */
 	current->exit_signal = SIGCHLD;
@@ -691,37 +701,97 @@ static void exit_mm(struct task_struct *
 	mmput(mm);
 }
 
-static void
-reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
+/*
+ * Return nonzero if @parent's children should reap themselves.
+ *
+ * Called with write_lock_irq(&tasklist_lock) held.
+ */
+static int ignoring_children(struct task_struct *parent)
 {
-	if (p->pdeath_signal)
-		/* We already hold the tasklist_lock here.  */
-		group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
+	int ret;
+	struct sighand_struct *psig = parent->sighand;
+	unsigned long flags;
+	spin_lock_irqsave(&psig->siglock, flags);
+	ret = (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN ||
+	       (psig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT));
+	spin_unlock_irqrestore(&psig->siglock, flags);
+	return ret;
+}
 
-	/* Move the child from its dying parent to the new one.  */
-	if (unlikely(traced)) {
-		/* Preserve ptrace links if someone else is tracing this child.  */
-		list_del_init(&p->ptrace_list);
-		if (ptrace_reparented(p))
-			list_add(&p->ptrace_list, &p->real_parent->ptrace_children);
-	} else {
-		/* If this child is being traced, then we're the one tracing it
-		 * anyway, so let go of it.
+/*
+ * Detach all tasks we were using ptrace on.
+ * Any that need to be release_task'd are put on the @dead list.
+ *
+ * Called with write_lock(&tasklist_lock) held.
+ */
+static void ptrace_exit(struct task_struct *parent, struct list_head *dead)
+{
+	struct task_struct *p, *n;
+	int ign = -1;
+
+	list_for_each_entry_safe(p, n, &parent->ptraced, ptrace_entry) {
+		__ptrace_unlink(p);
+
+		if (p->exit_state != EXIT_ZOMBIE)
+			continue;
+
+		/*
+		 * If it's a zombie, our attachedness prevented normal
+		 * parent notification or self-reaping.  Do notification
+		 * now if it would have happened earlier.  If it should
+		 * reap itself, add it to the @dead list.  We can't call
+		 * release_task() here because we already hold tasklist_lock.
+		 *
+		 * If it's our own child, there is no notification to do.
+		 * But if our normal children self-reap, then this child
+		 * was prevented by ptrace and we must reap it now.
 		 */
-		p->ptrace = 0;
-		remove_parent(p);
-		p->parent = p->real_parent;
-		add_parent(p);
+		if (!task_detached(p) && thread_group_empty(p)) {
+			if (!same_thread_group(p->real_parent, parent))
+				do_notify_parent(p, p->exit_signal);
+			else {
+				if (ign < 0)
+					ign = ignoring_children(parent);
+				if (ign)
+					p->exit_signal = -1;
+			}
+		}
 
-		if (task_is_traced(p)) {
+		if (task_detached(p)) {
 			/*
-			 * If it was at a trace stop, turn it into
-			 * a normal stop since it's no longer being
-			 * traced.
+			 * Mark it as in the process of being reaped.
 			 */
-			ptrace_untrace(p);
+			p->exit_state = EXIT_DEAD;
+			list_add(&p->ptrace_entry, dead);
 		}
 	}
+}
+
+/*
+ * Finish up exit-time ptrace cleanup.
+ *
+ * Called without locks.
+ */
+static void ptrace_exit_finish(struct task_struct *parent,
+			       struct list_head *dead)
+{
+	struct task_struct *p, *n;
+
+	BUG_ON(!list_empty(&parent->ptraced));
+
+	list_for_each_entry_safe(p, n, dead, ptrace_entry) {
+		list_del_init(&p->ptrace_entry);
+		release_task(p);
+	}
+}
+
+static void reparent_thread(struct task_struct *p, struct task_struct *father)
+{
+	if (p->pdeath_signal)
+		/* We already hold the tasklist_lock here.  */
+		group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
+
+	list_move_tail(&p->sibling, &p->real_parent->children);
 
 	/* If this is a threaded reparent there is no need to
 	 * notify anyone anything has happened.
@@ -736,7 +806,8 @@ reparent_thread(struct task_struct *p, s
 	/* If we'd notified the old parent about this child's death,
 	 * also notify the new parent.
 	 */
-	if (!traced && p->exit_state == EXIT_ZOMBIE &&
+	if (!ptrace_reparented(p) &&
+	    p->exit_state == EXIT_ZOMBIE &&
 	    !task_detached(p) && thread_group_empty(p))
 		do_notify_parent(p, p->exit_signal);
 
@@ -753,12 +824,15 @@ reparent_thread(struct task_struct *p, s
 static void forget_original_parent(struct task_struct *father)
 {
 	struct task_struct *p, *n, *reaper = father;
-	struct list_head ptrace_dead;
-
-	INIT_LIST_HEAD(&ptrace_dead);
+	LIST_HEAD(ptrace_dead);
 
 	write_lock_irq(&tasklist_lock);
 
+	/*
+	 * First clean up ptrace if we were using it.
+	 */
+	ptrace_exit(father, &ptrace_dead);
+
 	do {
 		reaper = next_thread(reaper);
 		if (reaper == father) {
@@ -767,58 +841,19 @@ static void forget_original_parent(struc
 		}
 	} while (reaper->flags & PF_EXITING);
 
-	/*
-	 * There are only two places where our children can be:
-	 *
-	 * - in our child list
-	 * - in our ptraced child list
-	 *
-	 * Search them and reparent children.
-	 */
 	list_for_each_entry_safe(p, n, &father->children, sibling) {
-		int ptrace;
-
-		ptrace = p->ptrace;
-
-		/* if father isn't the real parent, then ptrace must be enabled */
-		BUG_ON(father != p->real_parent && !ptrace);
-
-		if (father == p->real_parent) {
-			/* reparent with a reaper, real father it's us */
-			p->real_parent = reaper;
-			reparent_thread(p, father, 0);
-		} else {
-			/* reparent ptraced task to its real parent */
-			__ptrace_unlink (p);
-			if (p->exit_state == EXIT_ZOMBIE && !task_detached(p) &&
-			    thread_group_empty(p))
-				do_notify_parent(p, p->exit_signal);
-		}
-
-		/*
-		 * if the ptraced child is a detached zombie we must collect
-		 * it before we exit, or it will remain zombie forever since
-		 * we prevented it from self-reap itself while it was being
-		 * traced by us, to be able to see it in wait4.
-		 */
-		if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && task_detached(p)))
-			list_add(&p->ptrace_list, &ptrace_dead);
-	}
-
-	list_for_each_entry_safe(p, n, &father->ptrace_children, ptrace_list) {
 		p->real_parent = reaper;
-		reparent_thread(p, father, 1);
+		if (p->parent == father) {
+			BUG_ON(p->ptrace);
+			p->parent = p->real_parent;
+		}
+		reparent_thread(p, father);
 	}
 
 	write_unlock_irq(&tasklist_lock);
 	BUG_ON(!list_empty(&father->children));
-	BUG_ON(!list_empty(&father->ptrace_children));
-
-	list_for_each_entry_safe(p, n, &ptrace_dead, ptrace_list) {
-		list_del_init(&p->ptrace_list);
-		release_task(p);
-	}
 
+	ptrace_exit_finish(father, &ptrace_dead);
 }
 
 /*
@@ -1179,13 +1214,6 @@ static int eligible_child(enum pid_type 
 			return 0;
 	}
 
-	/*
-	 * Do not consider detached threads that are
-	 * not ptraced:
-	 */
-	if (task_detached(p) && !p->ptrace)
-		return 0;
-
 	/* Wait for all children (clone and not) if __WALL is set;
 	 * otherwise, wait for clone children *only* if __WCLONE is
 	 * set; otherwise, wait for non-clone children *only*.  (Note:
@@ -1196,14 +1224,10 @@ static int eligible_child(enum pid_type 
 		return 0;
 
 	err = security_task_wait(p);
-	if (likely(!err))
-		return 1;
+	if (err)
+		return err;
 
-	if (type != PIDTYPE_PID)
-		return 0;
-	/* This child was explicitly requested, abort */
-	read_unlock(&tasklist_lock);
-	return err;
+	return 1;
 }
 
 static int wait_noreap_copyout(struct task_struct *p, pid_t pid, uid_t uid,
@@ -1237,7 +1261,7 @@ static int wait_noreap_copyout(struct ta
  * the lock and this task is uninteresting.  If we return nonzero, we have
  * released the lock and the system call should return.
  */
-static int wait_task_zombie(struct task_struct *p, int noreap,
+static int wait_task_zombie(struct task_struct *p, int options,
 			    struct siginfo __user *infop,
 			    int __user *stat_addr, struct rusage __user *ru)
 {
@@ -1245,7 +1269,10 @@ static int wait_task_zombie(struct task_
 	int retval, status, traced;
 	pid_t pid = task_pid_vnr(p);
 
-	if (unlikely(noreap)) {
+	if (!likely(options & WEXITED))
+		return 0;
+
+	if (unlikely(options & WNOWAIT)) {
 		uid_t uid = p->uid;
 		int exit_code = p->exit_code;
 		int why, status;
@@ -1395,21 +1422,24 @@ static int wait_task_zombie(struct task_
  * the lock and this task is uninteresting.  If we return nonzero, we have
  * released the lock and the system call should return.
  */
-static int wait_task_stopped(struct task_struct *p,
-			     int noreap, struct siginfo __user *infop,
+static int wait_task_stopped(int ptrace, struct task_struct *p,
+			     int options, struct siginfo __user *infop,
 			     int __user *stat_addr, struct rusage __user *ru)
 {
 	int retval, exit_code, why;
 	uid_t uid = 0; /* unneeded, required by compiler */
 	pid_t pid;
 
+	if (!(options & WUNTRACED))
+		return 0;
+
 	exit_code = 0;
 	spin_lock_irq(&p->sighand->siglock);
 
 	if (unlikely(!task_is_stopped_or_traced(p)))
 		goto unlock_sig;
 
-	if (!(p->ptrace & PT_PTRACED) && p->signal->group_stop_count > 0)
+	if (!ptrace && p->signal->group_stop_count > 0)
 		/*
 		 * A group stop is in progress and this is the group leader.
 		 * We won't report until all threads have stopped.
@@ -1420,7 +1450,7 @@ static int wait_task_stopped(struct task
 	if (!exit_code)
 		goto unlock_sig;
 
-	if (!noreap)
+	if (!unlikely(options & WNOWAIT))
 		p->exit_code = 0;
 
 	uid = p->uid;
@@ -1438,10 +1468,10 @@ unlock_sig:
 	 */
 	get_task_struct(p);
 	pid = task_pid_vnr(p);
-	why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;
+	why = ptrace ? CLD_TRAPPED : CLD_STOPPED;
 	read_unlock(&tasklist_lock);
 
-	if (unlikely(noreap))
+	if (unlikely(options & WNOWAIT))
 		return wait_noreap_copyout(p, pid, uid,
 					   why, exit_code,
 					   infop, ru);
@@ -1475,7 +1505,7 @@ unlock_sig:
  * the lock and this task is uninteresting.  If we return nonzero, we have
  * released the lock and the system call should return.
  */
-static int wait_task_continued(struct task_struct *p, int noreap,
+static int wait_task_continued(struct task_struct *p, int options,
 			       struct siginfo __user *infop,
 			       int __user *stat_addr, struct rusage __user *ru)
 {
@@ -1483,6 +1513,9 @@ static int wait_task_continued(struct ta
 	pid_t pid;
 	uid_t uid;
 
+	if (!unlikely(options & WCONTINUED))
+		return 0;
+
 	if (!(p->signal->flags & SIGNAL_STOP_CONTINUED))
 		return 0;
 
@@ -1492,7 +1525,7 @@ static int wait_task_continued(struct ta
 		spin_unlock_irq(&p->sighand->siglock);
 		return 0;
 	}
-	if (!noreap)
+	if (!unlikely(options & WNOWAIT))
 		p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
 	spin_unlock_irq(&p->sighand->siglock);
 
@@ -1518,89 +1551,161 @@ static int wait_task_continued(struct ta
 	return retval;
 }
 
+/*
+ * Consider @p for a wait by @parent.
+ *
+ * -ECHILD should be in *@notask_error before the first call.
+ * Returns nonzero for a final return, when we have unlocked tasklist_lock.
+ * Returns zero if the search for a child should continue;
+ * then *@notask_error is 0 if @p is an eligible child,
+ * or another error from security_task_wait(), or still -ECHILD.
+ */
+static int wait_consider_task(struct task_struct *parent, int ptrace,
+			      struct task_struct *p, int *notask_error,
+			      enum pid_type type, struct pid *pid, int options,
+			      struct siginfo __user *infop,
+			      int __user *stat_addr, struct rusage __user *ru)
+{
+	int ret = eligible_child(type, pid, options, p);
+	if (!ret)
+		return ret;
+
+	if (unlikely(ret < 0)) {
+		/*
+		 * If we have not yet seen any eligible child,
+		 * then let this error code replace -ECHILD.
+		 * A permission error will give the user a clue
+		 * to look for security policy problems, rather
+		 * than for mysterious wait bugs.
+		 */
+		if (*notask_error)
+			*notask_error = ret;
+	}
+
+	if (likely(!ptrace) && unlikely(p->ptrace)) {
+		/*
+		 * This child is hidden by ptrace.
+		 * We aren't allowed to see it now, but eventually we will.
+		 */
+		*notask_error = 0;
+		return 0;
+	}
+
+	if (p->exit_state == EXIT_DEAD)
+		return 0;
+
+	/*
+	 * We don't reap group leaders with subthreads.
+	 */
+	if (p->exit_state == EXIT_ZOMBIE && !delay_group_leader(p))
+		return wait_task_zombie(p, options, infop, stat_addr, ru);
+
+	/*
+	 * It's stopped or running now, so it might
+	 * later continue, exit, or stop again.
+	 */
+	*notask_error = 0;
+
+	if (task_is_stopped_or_traced(p))
+		return wait_task_stopped(ptrace, p, options,
+					 infop, stat_addr, ru);
+
+	return wait_task_continued(p, options, infop, stat_addr, ru);
+}
+
+/*
+ * Do the work of do_wait() for one thread in the group, @tsk.
+ *
+ * -ECHILD should be in *@notask_error before the first call.
+ * Returns nonzero for a final return, when we have unlocked tasklist_lock.
+ * Returns zero if the search for a child should continue; then
+ * *@notask_error is 0 if there were any eligible children,
+ * or another error from security_task_wait(), or still -ECHILD.
+ */
+static int do_wait_thread(struct task_struct *tsk, int *notask_error,
+			  enum pid_type type, struct pid *pid, int options,
+			  struct siginfo __user *infop, int __user *stat_addr,
+			  struct rusage __user *ru)
+{
+	struct task_struct *p;
+
+	list_for_each_entry(p, &tsk->children, sibling) {
+		/*
+		 * Do not consider detached threads.
+		 */
+		if (!task_detached(p)) {
+			int ret = wait_consider_task(tsk, 0, p, notask_error,
+						     type, pid, options,
+						     infop, stat_addr, ru);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
+static int ptrace_do_wait(struct task_struct *tsk, int *notask_error,
+			  enum pid_type type, struct pid *pid, int options,
+			  struct siginfo __user *infop, int __user *stat_addr,
+			  struct rusage __user *ru)
+{
+	struct task_struct *p;
+
+	/*
+	 * Traditionally we see ptrace'd stopped tasks regardless of options.
+	 */
+	options |= WUNTRACED;
+
+	list_for_each_entry(p, &tsk->ptraced, ptrace_entry) {
+		int ret = wait_consider_task(tsk, 1, p, notask_error,
+					     type, pid, options,
+					     infop, stat_addr, ru);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
 static long do_wait(enum pid_type type, struct pid *pid, int options,
 		    struct siginfo __user *infop, int __user *stat_addr,
 		    struct rusage __user *ru)
 {
 	DECLARE_WAITQUEUE(wait, current);
 	struct task_struct *tsk;
-	int flag, retval;
+	int retval;
 
 	add_wait_queue(&current->signal->wait_chldexit,&wait);
 repeat:
-	/* If there is nothing that can match our critier just get out */
+	/*
+	 * If there is nothing that can match our critiera just get out.
+	 * We will clear @retval to zero if we see any child that might later
+	 * match our criteria, even if we are not able to reap it yet.
+	 */
 	retval = -ECHILD;
 	if ((type < PIDTYPE_MAX) && (!pid || hlist_empty(&pid->tasks[type])))
 		goto end;
 
-	/*
-	 * We will set this flag if we see any child that might later
-	 * match our criteria, even if we are not able to reap it yet.
-	 */
-	flag = retval = 0;
 	current->state = TASK_INTERRUPTIBLE;
 	read_lock(&tasklist_lock);
 	tsk = current;
 	do {
-		struct task_struct *p;
-
-		list_for_each_entry(p, &tsk->children, sibling) {
-			int ret = eligible_child(type, pid, options, p);
-			if (!ret)
-				continue;
-
-			if (unlikely(ret < 0)) {
-				retval = ret;
-			} else if (task_is_stopped_or_traced(p)) {
-				/*
-				 * It's stopped now, so it might later
-				 * continue, exit, or stop again.
-				 */
-				flag = 1;
-				if (!(p->ptrace & PT_PTRACED) &&
-				    !(options & WUNTRACED))
-					continue;
-
-				retval = wait_task_stopped(p,
-						(options & WNOWAIT), infop,
-						stat_addr, ru);
-			} else if (p->exit_state == EXIT_ZOMBIE &&
-					!delay_group_leader(p)) {
-				/*
-				 * We don't reap group leaders with subthreads.
-				 */
-				if (!likely(options & WEXITED))
-					continue;
-				retval = wait_task_zombie(p,
-						(options & WNOWAIT), infop,
-						stat_addr, ru);
-			} else if (p->exit_state != EXIT_DEAD) {
-				/*
-				 * It's running now, so it might later
-				 * exit, stop, or stop and then continue.
-				 */
-				flag = 1;
-				if (!unlikely(options & WCONTINUED))
-					continue;
-				retval = wait_task_continued(p,
-						(options & WNOWAIT), infop,
-						stat_addr, ru);
-			}
-			if (retval != 0) /* tasklist_lock released */
-				goto end;
-		}
-		if (!flag) {
-			list_for_each_entry(p, &tsk->ptrace_children,
-								ptrace_list) {
-				flag = eligible_child(type, pid, options, p);
-				if (!flag)
-					continue;
-				if (likely(flag > 0))
-					break;
-				retval = flag;
-				goto end;
-			}
+		int tsk_result = do_wait_thread(tsk, &retval,
+						type, pid, options,
+						infop, stat_addr, ru);
+		if (!tsk_result)
+			tsk_result = ptrace_do_wait(tsk, &retval,
+						    type, pid, options,
+						    infop, stat_addr, ru);
+		if (tsk_result) {
+			/*
+			 * tasklist_lock is unlocked and we have a final result.
+			 */
+			retval = tsk_result;
+			goto end;
 		}
+
 		if (options & __WNOTHREAD)
 			break;
 		tsk = next_thread(tsk);
@@ -1608,16 +1713,14 @@ repeat:
 	} while (tsk != current);
 	read_unlock(&tasklist_lock);
 
-	if (flag) {
-		if (options & WNOHANG)
-			goto end;
+	if (!retval && !(options & WNOHANG)) {
 		retval = -ERESTARTSYS;
-		if (signal_pending(current))
-			goto end;
-		schedule();
-		goto repeat;
+		if (!signal_pending(current)) {
+			schedule();
+			goto repeat;
+		}
 	}
-	retval = -ECHILD;
+
 end:
 	current->state = TASK_RUNNING;
 	remove_wait_queue(&current->signal->wait_chldexit,&wait);
diff --git a/kernel/fork.c b/kernel/fork.c
index 19908b2..df8fe06 100644  
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1124,8 +1124,8 @@ static struct task_struct *copy_process(
 	 */
 	p->group_leader = p;
 	INIT_LIST_HEAD(&p->thread_group);
-	INIT_LIST_HEAD(&p->ptrace_children);
-	INIT_LIST_HEAD(&p->ptrace_list);
+	INIT_LIST_HEAD(&p->ptrace_entry);
+	INIT_LIST_HEAD(&p->ptraced);
 
 	/* Now that the task is set up, run cgroup callbacks if
 	 * necessary. We need to run them before the task is visible
@@ -1197,7 +1197,7 @@ static struct task_struct *copy_process(
 	}
 
 	if (likely(p->pid)) {
-		add_parent(p);
+		list_add_tail(&p->sibling, &p->real_parent->children);
 		if (unlikely(p->ptrace & PT_PTRACED))
 			__ptrace_link(p, current->parent);
 
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 6c19e94..acf80a4 100644  
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -33,13 +33,9 @@
  */
 void __ptrace_link(struct task_struct *child, struct task_struct *new_parent)
 {
-	BUG_ON(!list_empty(&child->ptrace_list));
-	if (child->parent == new_parent)
-		return;
-	list_add(&child->ptrace_list, &child->parent->ptrace_children);
-	remove_parent(child);
+	BUG_ON(!list_empty(&child->ptrace_entry));
+	list_add(&child->ptrace_entry, &new_parent->ptraced);
 	child->parent = new_parent;
-	add_parent(child);
 }
  
 /*
@@ -73,12 +69,8 @@ void __ptrace_unlink(struct task_struct 
 	BUG_ON(!child->ptrace);
 
 	child->ptrace = 0;
-	if (ptrace_reparented(child)) {
-		list_del_init(&child->ptrace_list);
-		remove_parent(child);
-		child->parent = child->real_parent;
-		add_parent(child);
-	}
+	child->parent = child->real_parent;
+	list_del_init(&child->ptrace_entry);
 
 	if (task_is_traced(child))
 		ptrace_untrace(child);
@@ -492,14 +484,33 @@ int ptrace_traceme(void)
 	/*
 	 * Are we already being traced?
 	 */
+repeat:
 	task_lock(current);
 	if (!(current->ptrace & PT_PTRACED)) {
+		/*
+		 * See ptrace_attach() comments about the locking here.
+		 */
+		unsigned long flags;
+		if (!write_trylock_irqsave(&tasklist_lock, flags)) {
+			task_unlock(current);
+			do {
+				cpu_relax();
+			} while (!write_can_lock(&tasklist_lock));
+			goto repeat;
+		}
+
 		ret = security_ptrace(current->parent, current);
+
 		/*
 		 * Set the ptrace bit in the process ptrace flags.
+		 * Then link us on our parent's ptraced list.
 		 */
-		if (!ret)
+		if (!ret) {
 			current->ptrace |= PT_PTRACED;
+			__ptrace_link(current, current->real_parent);
+		}
+
+		write_unlock_irqrestore(&tasklist_lock, flags);
 	}
 	task_unlock(current);
 	return ret;

linux-2.6-tracehook.patch:

--- NEW FILE linux-2.6-tracehook.patch ---
 arch/Kconfig                      |   18 ++
 arch/ia64/Kconfig                 |    1 +
 arch/ia64/kernel/perfmon.c        |   11 +-
 arch/ia64/kernel/process.c        |   22 +-
 arch/ia64/kernel/ptrace.c         |   43 +--
 arch/ia64/kernel/signal.c         |    8 +
 arch/mips/kernel/irixelf.c        |    2 -
 arch/powerpc/Kconfig              |    1 +
 arch/powerpc/kernel/entry_32.S    |   11 +-
 arch/powerpc/kernel/entry_64.S    |   10 +-
 arch/powerpc/kernel/ptrace.c      |   47 ++--
 arch/powerpc/kernel/signal.c      |   21 ++-
 arch/sparc64/Kconfig              |    1 +
 arch/sparc64/kernel/ptrace.c      |   24 +--
 arch/sparc64/kernel/rtrap.S       |    6 +-
 arch/sparc64/kernel/signal.c      |    5 +
 arch/x86/Kconfig                  |    1 +
 arch/x86/ia32/ia32_aout.c         |    6 -
 arch/x86/kernel/ptrace.c          |   34 +--
 arch/x86/kernel/signal_32.c       |   11 +-
 arch/x86/kernel/signal_64.c       |   49 +---
 fs/binfmt_aout.c                  |    6 -
 fs/binfmt_elf.c                   |    6 -
 fs/binfmt_elf_fdpic.c             |    7 -
 fs/binfmt_flat.c                  |    3 -
 fs/binfmt_som.c                   |    2 -
 fs/exec.c                         |   12 +-
 fs/proc/array.c                   |    9 +-
 fs/proc/base.c                    |   39 +++-
 include/asm-generic/syscall.h     |  141 +++++++++
 include/asm-ia64/thread_info.h    |    3 -
 include/asm-powerpc/ptrace.h      |    1 +
 include/asm-powerpc/signal.h      |    3 +-
 include/asm-powerpc/syscall.h     |   73 +++++
 include/asm-powerpc/thread_info.h |    5 +-
 include/asm-sparc64/ptrace.h      |    1 +
 include/asm-sparc64/syscall.h     |   70 +++++
 include/asm-sparc64/thread_info.h |    8 +-
 include/asm-x86/ptrace.h          |    5 +
 include/asm-x86/syscall.h         |  210 ++++++++++++++
 include/asm-x86/thread_info_32.h  |    2 +
 include/asm-x86/thread_info_64.h  |    4 +-
 include/linux/ptrace.h            |   72 +++++
 include/linux/sched.h             |   10 +-
 include/linux/tracehook.h         |  575 +++++++++++++++++++++++++++++++++++++
 kernel/exit.c                     |   53 ++---
 kernel/fork.c                     |   74 ++---
 kernel/kthread.c                  |    2 +-
 kernel/ptrace.c                   |    2 +-
 kernel/sched.c                    |   29 ++-
 kernel/signal.c                   |   99 ++++---
 lib/Makefile                      |    2 +
 lib/syscall.c                     |   75 +++++
 mm/nommu.c                        |    4 +-
 security/selinux/hooks.c          |   22 +--
 55 files changed, 1590 insertions(+), 371 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 3ea332b..1955fbd 100644  
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -39,3 +39,21 @@ config HAVE_KRETPROBES
 
 config HAVE_DMA_ATTRS
 	def_bool n
+
+#
+# An arch should select this if it provides all these things:
+#
+#	task_pt_regs()		in asm/processor.h or asm/ptrace.h
+#	arch_has_single_step()	if there is hardware single-step support
+#	arch_has_block_step()	if there is hardware block-step support
+#	arch_ptrace()		and not #define __ARCH_SYS_PTRACE
+#	compat_arch_ptrace()	and #define __ARCH_WANT_COMPAT_SYS_PTRACE
+#	asm/syscall.h		supplying asm-generic/syscall.h interface
+#	linux/regset.h		user_regset interfaces
+#	CORE_DUMP_USE_REGSET	#define'd in linux/elf.h
+#	TIF_SYSCALL_TRACE	calls tracehook_report_syscall_{entry,exit}
+#	TIF_NOTIFY_RESUME	calls tracehook_notify_resume()
+#	signal delivery		calls tracehook_signal_handler()
+#
+config HAVE_ARCH_TRACEHOOK
+	def_bool n
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 16be414..f23a54a 100644  
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -19,6 +19,7 @@ config IA64
 	select HAVE_OPROFILE
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
+	select HAVE_ARCH_TRACEHOOK
 	select HAVE_DMA_ATTRS
 	select HAVE_KVM
 	default y
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 7714a97..189d525 100644  
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -40,6 +40,7 @@
 #include <linux/capability.h>
 #include <linux/rcupdate.h>
 #include <linux/completion.h>
+#include <linux/tracehook.h>
 
 #include <asm/errno.h>
 #include <asm/intrinsics.h>
@@ -2626,7 +2627,7 @@ pfm_task_incompatible(pfm_context_t *ctx
 	/*
 	 * make sure the task is off any CPU
 	 */
-	wait_task_inactive(task);
+	wait_task_inactive(task, 0);
 
 	/* more to come... */
 
@@ -3684,7 +3685,7 @@ pfm_restart(pfm_context_t *ctx, void *ar
 
 		PFM_SET_WORK_PENDING(task, 1);
 
-		tsk_set_notify_resume(task);
+		set_notify_resume(task);
 
 		/*
 		 * XXX: send reschedule if task runs on another CPU
@@ -4774,7 +4775,7 @@ recheck:
 
 		UNPROTECT_CTX(ctx, flags);
 
-		wait_task_inactive(task);
+		wait_task_inactive(task, 0);
 
 		PROTECT_CTX(ctx, flags);
 
@@ -5044,8 +5045,6 @@ pfm_handle_work(void)
 
 	PFM_SET_WORK_PENDING(current, 0);
 
-	tsk_clear_notify_resume(current);
-
 	regs = task_pt_regs(current);
 
 	/*
@@ -5414,7 +5413,7 @@ pfm_overflow_handler(struct task_struct 
 			 * when coming from ctxsw, current still points to the
 			 * previous task, therefore we must work with task and not current.
 			 */
-			tsk_set_notify_resume(task);
+			set_notify_resume(task);
 		}
 		/*
 		 * defer until state is changed (shorten spin window). the context is locked
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index a3a34b4..5164aab 100644  
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -28,6 +28,7 @@
 #include <linux/delay.h>
 #include <linux/kdebug.h>
 #include <linux/utsname.h>
+#include <linux/tracehook.h>
 
 #include <asm/cpu.h>
 #include <asm/delay.h>
@@ -156,21 +157,6 @@ show_regs (struct pt_regs *regs)
 		show_stack(NULL, NULL);
 }
 
-void tsk_clear_notify_resume(struct task_struct *tsk)
-{
-#ifdef CONFIG_PERFMON
-	if (tsk->thread.pfm_needs_checking)
-		return;
-#endif
-	if (test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_RSE))
-		return;
-	clear_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME);
-}
-
-/*
- * do_notify_resume_user():
- *	Called from notify_resume_user at entry.S, with interrupts disabled.
- */
 void
 do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
 {
@@ -199,6 +185,11 @@ do_notify_resume_user(sigset_t *unused, 
 		ia64_do_signal(scr, in_syscall);
 	}
 
+	if (test_thread_flag(TIF_NOTIFY_RESUME)) {
+		clear_thread_flag(TIF_NOTIFY_RESUME);
+		tracehook_notify_resume(&scr->pt);
+	}
+
 	/* copy user rbs to kernel rbs */
 	if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) {
 		local_irq_enable();	/* force interrupt enable */
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
[...2942 lines suppressed...]
+		do_group_exit(info->si_signo);
 		/* NOTREACHED */
 	}
 	spin_unlock_irq(&sighand->siglock);
@@ -1909,7 +1937,7 @@ void exit_signals(struct task_struct *ts
 out:
 	spin_unlock_irq(&tsk->sighand->siglock);
 
-	if (unlikely(group_stop)) {
+	if (unlikely(group_stop) && tracehook_notify_jctl(1, CLD_STOPPED)) {
 		read_lock(&tasklist_lock);
 		do_notify_parent_cldstop(tsk, CLD_STOPPED);
 		read_unlock(&tasklist_lock);
@@ -1921,7 +1949,6 @@ EXPORT_SYMBOL_GPL(dequeue_signal);
 EXPORT_SYMBOL(flush_signals);
 EXPORT_SYMBOL(force_sig);
 EXPORT_SYMBOL(kill_proc);
-EXPORT_SYMBOL(ptrace_notify);
 EXPORT_SYMBOL(send_sig);
 EXPORT_SYMBOL(send_sig_info);
 EXPORT_SYMBOL(sigprocmask);
@@ -2325,7 +2352,7 @@ int do_sigaction(int sig, struct k_sigac
 		 *   (for example, SIGCHLD), shall cause the pending signal to
 		 *   be discarded, whether or not it is blocked"
 		 */
-		if (__sig_ignored(t, sig)) {
+		if (sig_handler_ignored(sig_handler(t, sig), sig)) {
 			sigemptyset(&mask);
 			sigaddset(&mask, sig);
 			rm_from_queue_full(&mask, &t->signal->shared_pending);
diff --git a/lib/Makefile b/lib/Makefile
index 74b0cfb..62dfd16 100644  
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -72,6 +72,8 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o
 
 obj-$(CONFIG_HAVE_LMB) += lmb.o
 
+obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
+
 hostprogs-y	:= gen_crc32table
 clean-files	:= crc32table.h
 
diff --git a/lib/syscall.c b/lib/syscall.c
new file mode 100644
index ...a4f7067 100644  
--- /dev/null
+++ b/lib/syscall.c
@@ -0,0 +1,75 @@
+#include <linux/ptrace.h>
+#include <linux/sched.h>
+#include <linux/module.h>
+#include <asm/syscall.h>
+
+static int collect_syscall(struct task_struct *target, long *callno,
+			   unsigned long args[6], unsigned int maxargs,
+			   unsigned long *sp, unsigned long *pc)
+{
+	struct pt_regs *regs = task_pt_regs(target);
+	if (unlikely(!regs))
+		return -EAGAIN;
+
+	*sp = user_stack_pointer(regs);
+	*pc = instruction_pointer(regs);
+
+	*callno = syscall_get_nr(target, regs);
+	if (*callno != -1L && maxargs > 0)
+		syscall_get_arguments(target, regs, 0, maxargs, args);
+
+	return 0;
+}
+
+/**
+ * task_current_syscall - Discover what a blocked task is doing.
+ * @target:		thread to examine
+ * @callno:		filled with system call number or -1
+ * @args:		filled with @maxargs system call arguments
+ * @maxargs:		number of elements in @args to fill
+ * @sp:			filled with user stack pointer
+ * @pc:			filled with user PC
+ *
+ * If @target is blocked in a system call, returns zero with *@callno
+ * set to the the call's number and @args filled in with its arguments.
+ * Registers not used for system call arguments may not be available and
+ * it is not kosher to use &struct user_regset calls while the system
+ * call is still in progress.  Note we may get this result if @target
+ * has finished its system call but not yet returned to user mode, such
+ * as when it's stopped for signal handling or syscall exit tracing.
+ *
+ * If @target is blocked in the kernel during a fault or exception,
+ * returns zero with *@callno set to -1 and does not fill in @args.
+ * If so, it's now safe to examine @target using &struct user_regset
+ * get() calls as long as we're sure @target won't return to user mode.
+ *
+ * Returns -%EAGAIN if @target does not remain blocked.
+ *
+ * Returns -%EINVAL if @maxargs is too large (maximum is six).
+ */
+int task_current_syscall(struct task_struct *target, long *callno,
+			 unsigned long args[6], unsigned int maxargs,
+			 unsigned long *sp, unsigned long *pc)
+{
+	long state;
+	unsigned long ncsw;
+
+	if (unlikely(maxargs > 6))
+		return -EINVAL;
+
+	if (target == current)
+		return collect_syscall(target, callno, args, maxargs, sp, pc);
+
+	state = target->state;
+	if (unlikely(!state))
+		return -EAGAIN;
+
+	ncsw = wait_task_inactive(target, state);
+	if (unlikely(!ncsw) ||
+	    unlikely(collect_syscall(target, callno, args, maxargs, sp, pc)) ||
+	    unlikely(wait_task_inactive(target, state) != ncsw))
+		return -EAGAIN;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(task_current_syscall);
diff --git a/mm/nommu.c b/mm/nommu.c
index 4462b6a..5edccd9 100644  
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -22,7 +22,7 @@
 #include <linux/pagemap.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
-#include <linux/ptrace.h>
+#include <linux/tracehook.h>
 #include <linux/blkdev.h>
 #include <linux/backing-dev.h>
 #include <linux/mount.h>
@@ -745,7 +745,7 @@ static unsigned long determine_vm_flags(
 	 * it's being traced - otherwise breakpoints set in it may interfere
 	 * with another untraced process
 	 */
-	if ((flags & MAP_PRIVATE) && (current->ptrace & PT_PTRACED))
+	if ((flags & MAP_PRIVATE) && tracehook_expect_breakpoints(current))
 		vm_flags &= ~VM_MAYSHARE;
 
 	return vm_flags;
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 1c864c0..f92c6af 100644  
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -24,7 +24,7 @@
 
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/ptrace.h>
+#include <linux/tracehook.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/security.h>
@@ -1910,22 +1910,6 @@ static int selinux_vm_enough_memory(stru
 	return __vm_enough_memory(mm, pages, cap_sys_admin);
 }
 
-/**
- * task_tracer_task - return the task that is tracing the given task
- * @task:		task to consider
- *
- * Returns NULL if noone is tracing @task, or the &struct task_struct
- * pointer to its tracer.
- *
- * Must be called under rcu_read_lock().
- */
-static struct task_struct *task_tracer_task(struct task_struct *task)
-{
-	if (task->ptrace & PT_PTRACED)
-		return rcu_dereference(task->parent);
-	return NULL;
-}
-
 /* binprm security operations */
 
 static int selinux_bprm_alloc_security(struct linux_binprm *bprm)
@@ -2177,7 +2161,7 @@ static void selinux_bprm_apply_creds(str
 			u32 ptsid = 0;
 
 			rcu_read_lock();
-			tracer = task_tracer_task(current);
+			tracer = tracehook_tracer_task(current);
 			if (likely(tracer != NULL)) {
 				sec = tracer->security;
 				ptsid = sec->sid;
@@ -5205,7 +5189,7 @@ static int selinux_setprocattr(struct ta
 		   Otherwise, leave SID unchanged and fail. */
 		task_lock(p);
 		rcu_read_lock();
-		tracer = task_tracer_task(p);
+		tracer = tracehook_tracer_task(p);
 		if (tracer != NULL) {
 			struct task_security_struct *ptsec = tracer->security;
 			u32 ptsid = ptsec->sid;

linux-2.6-xen-0001-xen-execshield-Add-xen-specific-load_user_cs_desc.patch:

--- NEW FILE linux-2.6-xen-0001-xen-execshield-Add-xen-specific-load_user_cs_desc.patch ---
>From 92d67a7c3a6b059befa7cb3095713f2bbe57baf6 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 11 Mar 2008 18:05:30 +0000
Subject: [PATCH] xen execshield: Add xen-specific load_user_cs_desc()

x86 32-bit execshield uses load_user_cs_desc() to setup the user CS
descriptor, but the Xen version needs to do this via a hypercall.

Add this via a new pv_cpu_ops->load_user_cs_desc pv_ops indirection
so that it can be selected appropriately at run-time.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/paravirt.c |    1 +
 arch/x86/xen/enlighten.c   |   17 +++++++++++++++++
 include/asm-x86/desc.h     |    8 ++++++--
 include/asm-x86/paravirt.h |    6 ++++++
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index e0f571d..cc185d2 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -323,6 +323,7 @@ struct pv_cpu_ops pv_cpu_ops = {
 	.read_tscp = native_read_tscp,
 	.load_tr_desc = native_load_tr_desc,
 	.set_ldt = native_set_ldt,
+	.load_user_cs_desc = native_load_user_cs_desc,
 	.load_gdt = native_load_gdt,
 	.load_idt = native_load_idt,
 	.store_gdt = native_store_gdt,
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index bb50845..bedcec8 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -323,6 +323,22 @@ static void xen_set_ldt(const void *addr, unsigned entries)
 	xen_mc_issue(PARAVIRT_LAZY_CPU);
 }
 
+static inline void xen_load_user_cs_desc(int cpu, struct mm_struct *mm)
+{
+	void *gdt;
+	xmaddr_t mgdt;
+	u64 descriptor;
+	struct desc_struct user_cs;
+	
+	gdt = &get_cpu_gdt_table(cpu)[GDT_ENTRY_DEFAULT_USER_CS];
+	mgdt = virt_to_machine(gdt);
+
+	user_cs = mm->context.user_cs;
+	descriptor = (u64) user_cs.a | ((u64) user_cs.b) << 32;
+
+	HYPERVISOR_update_descriptor(mgdt.maddr, descriptor);
+}
+
 static void xen_load_gdt(const struct desc_ptr *dtr)
 {
 	unsigned long *frames;
@@ -1093,6 +1109,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 
 	.load_tr_desc = paravirt_nop,
 	.set_ldt = xen_set_ldt,
+	.load_user_cs_desc = xen_load_user_cs_desc,
 	.load_gdt = xen_load_gdt,
 	.load_idt = xen_load_idt,
 	.load_tls = xen_load_tls,
diff --git a/include/asm-x86/desc.h b/include/asm-x86/desc.h
index a455501..eaba600 100644
--- a/include/asm-x86/desc.h
+++ b/include/asm-x86/desc.h
@@ -6,6 +6,7 @@
 #include <asm/ldt.h>
 #include <asm/mmu.h>
 #include <linux/smp.h>
+#include <linux/mm_types.h>
 
 static inline void fill_ldt(struct desc_struct *desc,
 			    const struct user_desc *info)
@@ -90,6 +91,7 @@ static inline int desc_empty(const void *ptr)
 
 #define load_TLS(t, cpu) native_load_tls(t, cpu)
 #define set_ldt native_set_ldt
+#define load_user_cs_desc native_load_user_cs_desc
 
 #define write_ldt_entry(dt, entry, desc)	\
 	native_write_ldt_entry(dt, entry, desc)
@@ -380,8 +382,10 @@ static inline void set_user_cs(struct desc_struct *desc, unsigned long limit)
 	desc->b = (limit & 0xf0000) | 0x00c0fb00;
 }
 
-#define load_user_cs_desc(cpu, mm) \
-	get_cpu_gdt_table(cpu)[GDT_ENTRY_DEFAULT_USER_CS] = (mm)->context.user_cs
+static inline void native_load_user_cs_desc(int cpu, struct mm_struct *mm)
+{
+	get_cpu_gdt_table(cpu)[GDT_ENTRY_DEFAULT_USER_CS] = mm->context.user_cs;
+}
 
 extern void arch_add_exec_range(struct mm_struct *mm, unsigned long limit);
 extern void arch_remove_exec_range(struct mm_struct *mm, unsigned long limit);
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index ef5e8ec..fd6aed1 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -113,6 +113,7 @@ struct pv_cpu_ops {
 	void (*store_gdt)(struct desc_ptr *);
 	void (*store_idt)(struct desc_ptr *);
 	void (*set_ldt)(const void *desc, unsigned entries);
+	void (*load_user_cs_desc)(int cpu, struct mm_struct *mm);
 	unsigned long (*store_tr)(void);
 	void (*load_tls)(struct thread_struct *t, unsigned int cpu);
 #ifdef CONFIG_X86_64
@@ -830,6 +831,11 @@ static inline void set_ldt(const void *addr, unsigned entries)
 {
 	PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries);
 }
+static inline void load_user_cs_desc(unsigned int cpu, 
+				     struct mm_struct *mm)
+{
+	PVOP_VCALL2(pv_cpu_ops.load_user_cs_desc, cpu, mm);
+}
 static inline void store_gdt(struct desc_ptr *dtr)
 {
 	PVOP_VCALL1(pv_cpu_ops.store_gdt, dtr);
-- 
1.5.4.1


linux-2.6-xen-0002-xen-execshield-fix-endless-GPF-fault-loop.patch:

--- NEW FILE linux-2.6-xen-0002-xen-execshield-fix-endless-GPF-fault-loop.patch ---
>From 99a0fe2ac9cac34a9be13fb65f1dd5054c7a8e55 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 11 Mar 2008 18:07:31 +0000
Subject: [PATCH] xen execshield: fix endless GPF fault loop

Under Xen, loading the user_cs descriptor does not necessarily load
the descriptor with the exact same values the kernel requested: some
of the control bits in the descriptor may be modified by the
hypervisor.

With execshield, the check_lazy_exec_limit() function is needed to
test whether a fault has been caused by the existing user_cs
descriptor being too constrained: if so, it performs a lazy expansion
of the legal cs segment bounds.  But it does so via an exact match on
the descriptor values against their current expected values, so if
Xen modifies any control bits in the descriptor, it looks as if the
user_cs is out-of-sync; so check_lazy_exec_limit() resets the
descriptor and retakes the fault unnecessarily.

This means that a GPF fault can be retried indefinitely, with the
kernel always seeing the wrong values in user_cs and continually
trying to correct them and retake the fault.

Fix it by masking off the xen-sensitive control bits when checking
that the segment descriptor is up-to-date, and comparing only the
bits which affect the segment base and limit.

Affects 32-bit only; execshield on 64-bit uses NX for this
functionality.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/traps_32.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 93b2ad5..10cb168 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -633,7 +633,8 @@ check_lazy_exec_limit(int cpu, struct pt_regs *regs, long error_code)
 	desc1 = &current->mm->context.user_cs;
 	desc2 = get_cpu_gdt_table(cpu) + GDT_ENTRY_DEFAULT_USER_CS;
 
-	if (desc1->a != desc2->a || desc1->b != desc2->b) {
+	if ((desc1->a & 0xff0000ff) != (desc2->a & 0xff0000ff) || 
+	    desc1->b != desc2->b) {
 		/*
 		 * The CS was not in sync - reload it and retry the
 		 * instruction. If the instruction still faults then
-- 
1.5.4.1


linux-2.6-xen-0003-xen-Add-a-vmlinuz-target.patch:

--- NEW FILE linux-2.6-xen-0003-xen-Add-a-vmlinuz-target.patch ---
>From 8baae5025ee047922b5d7d86110588fe2fc36601 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Tue, 19 Feb 2008 15:34:32 +0000
Subject: [PATCH] xen: Add a vmlinuz target

Although patches are in progress to allow Xen boot
a DomU using a bzImage, support for booting a Dom0
using a bzImage is still a ways off.

For now, just add a target to build a gzip-ed ELF
file which Xen can use to boot both Dom0 and DomU.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/Makefile        |    9 +++++++++
 arch/x86/boot/.gitignore |    1 +
 arch/x86/boot/Makefile   |    9 +++++++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 919ce21..9fd7f4d 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -184,6 +184,15 @@ boot := arch/x86/boot
 PHONY += zImage bzImage compressed zlilo bzlilo \
          zdisk bzdisk fdimage fdimage144 fdimage288 isoimage install
 
+ifdef CONFIG_XEN
+PHONY += vmlinuz
+all: vmlinuz
+
+vmlinuz: KBUILD_IMAGE := $(boot)/vmlinuz
+vmlinuz: vmlinux
+	$(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
+endif
+
 # Default kernel to build
 all: bzImage
 
diff --git a/arch/x86/boot/.gitignore b/arch/x86/boot/.gitignore
index 172cf8a..109cf54 100644
--- a/arch/x86/boot/.gitignore
+++ b/arch/x86/boot/.gitignore
@@ -6,3 +6,4 @@ offsets.h
 setup
 setup.bin
 setup.elf
+vmlinuz
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 7ee102f..6edcbff 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -26,6 +26,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
 #RAMDISK := -DRAMDISK=512
 
 targets		:= vmlinux.bin setup.bin setup.elf zImage bzImage
+targets		+= vmlinuz vmlinux-stripped
 subdir-		:= compressed
 
 setup-y		+= a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o
@@ -119,6 +120,14 @@ $(obj)/setup.bin: $(obj)/setup.elf FORCE
 $(obj)/compressed/vmlinux: FORCE
 	$(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
 
+$(obj)/vmlinuz: $(obj)/vmlinux-stripped FORCE
+	$(call if_changed,gzip)
+	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+$(obj)/vmlinux-stripped: OBJCOPYFLAGS := -g --strip-unneeded
+$(obj)/vmlinux-stripped: vmlinux FORCE
+	$(call if_changed,objcopy)
+
 # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel
 FDARGS =
 # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel
-- 
1.5.4.1


linux-2.6-xen-0004-xen-Add-empty-xenctrl-module.patch:

--- NEW FILE linux-2.6-xen-0004-xen-Add-empty-xenctrl-module.patch ---
>From 6dfc3a1ea93f9569118e0ee463b0c63e7eae8acf Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 4 Feb 2008 08:30:37 +0000
Subject: [PATCH] xen: Add empty xenctrl module

Add the basic infrastructure for a xenctrl module
which will contain the various kernel interfaces
used by (mainly Dom0) Xen userspace.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/Kconfig         |    9 +++++-
 drivers/xen/Makefile         |    2 +
 drivers/xen/xenctrl/Makefile |    4 +++
 drivers/xen/xenctrl/main.c   |   62 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 1 deletions(-)
 create mode 100644 drivers/xen/xenctrl/Makefile
 create mode 100644 drivers/xen/xenctrl/main.c

diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index c2cc995..b5e3aa2 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -21,4 +21,11 @@ config XEN_MAX_DOMAIN_MEMORY
          The pseudo-physical to machine address array is sized
          according to the maximum possible memory size of a Xen
          domain.  This array uses 1 page per gigabyte, so there's no
-         need to be too stingy here.
\ No newline at end of file
+         need to be too stingy here.
+
+config XENCTRL
+	tristate "Xen's user space control interfaces"
+	depends on XEN && PROC_FS
+	default y if XEN
+	help
+	  This is the /proc/xen interface used by Xen's libxc.
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 363286c..5f1a721 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -2,3 +2,5 @@ obj-y	+= grant-table.o features.o events.o manage.o
 obj-y	+= xenbus/
 obj-$(CONFIG_XEN_XENCOMM)	+= xencomm.o
 obj-$(CONFIG_XEN_BALLOON)	+= balloon.o
+
+obj-$(CONFIG_XENCTRL) += xenctrl/
diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
new file mode 100644
index 0000000..1f43a43
--- /dev/null
+++ b/drivers/xen/xenctrl/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_XENCTRL) += xenctrl.o
+
+xenctrl-objs  =
+xenctrl-objs += main.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
new file mode 100644
index 0000000..2965ceb
--- /dev/null
+++ b/drivers/xen/xenctrl/main.c
@@ -0,0 +1,62 @@
+/******************************************************************************
+ *
+ * main.c
+ *
+ * Xen userspace control interfaces
+ *
+ * Copyright (c) 2002-2004, K A Fraser, B Dragovic
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <asm/xen/hypervisor.h>
+
+static int __init xenctrl_init(void)
+{
+	struct proc_dir_entry *dir;
+
+	if (!is_running_on_xen())
+		return -ENODEV;
+
+	dir = proc_mkdir("xen", NULL);
+	if (!dir)
+		return -ENOMEM;
+
+	dir->owner = THIS_MODULE;
+
+	return 0;
+}
+
+static void __exit xenctrl_exit(void)
+{
+	remove_proc_entry("xen", NULL);
+}
+
+module_init(xenctrl_init);
+module_exit(xenctrl_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
-- 
1.5.4.1


linux-2.6-xen-0005-xen-Add-proc-xen-capabilities.patch:

--- NEW FILE linux-2.6-xen-0005-xen-Add-proc-xen-capabilities.patch ---
>From 5858879e8eb3083db8c4008ca84f75b719569133 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 4 Feb 2008 09:16:51 +0000
Subject: [PATCH] xen: Add /proc/xen/capabilities

/proc/xen/capabilities is used by the xend init script
to check whether it is running on Dom0.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenctrl/Makefile       |    1 +
 drivers/xen/xenctrl/capabilities.c |   68 ++++++++++++++++++++++++++++++++++++
 drivers/xen/xenctrl/main.c         |   11 ++++++
 drivers/xen/xenctrl/xenctrl.h      |   39 ++++++++++++++++++++
 4 files changed, 119 insertions(+), 0 deletions(-)
 create mode 100644 drivers/xen/xenctrl/capabilities.c
 create mode 100644 drivers/xen/xenctrl/xenctrl.h

diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index 1f43a43..631f535 100644
--- a/drivers/xen/xenctrl/Makefile
+++ b/drivers/xen/xenctrl/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_XENCTRL) += xenctrl.o
 
 xenctrl-objs  =
 xenctrl-objs += main.o
+xenctrl-objs += capabilities.o
diff --git a/drivers/xen/xenctrl/capabilities.c b/drivers/xen/xenctrl/capabilities.c
new file mode 100644
index 0000000..1ff078a
--- /dev/null
+++ b/drivers/xen/xenctrl/capabilities.c
@@ -0,0 +1,68 @@
+/******************************************************************************
+ *
+ * capabilities.c
+ *
+ * /proc/xen/capabilities
+ *
+ * Copyright (c) 2002-2004, K A Fraser, B Dragovic
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <asm/xen/hypervisor.h>
+
+static int capabilities_read(char *page, char **start, off_t off,
+			     int count, int *eof, void *data)
+{
+	int len = 0;
+	*page = 0;
+
+	if (is_initial_xendomain())
+		len = sprintf(page, "control_d\n");
+
+	*eof = 1;
+	return len;
+}
+
+int __init capabilities_create_proc_entry(void)
+{
+	struct proc_dir_entry *entry;
+
+	entry = create_proc_entry("xen/capabilities", 0400, NULL);
+	if (!entry)
+		return -ENOMEM;
+
+	entry->owner = THIS_MODULE;
+	entry->read_proc = capabilities_read;
+
+	return 0;
+}
+
+void __exit capabilities_remove_proc_entry(void)
+{
+	remove_proc_entry("xen/capabilities", NULL);
+}
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index 2965ceb..0e42f7e 100644
--- a/drivers/xen/xenctrl/main.c
+++ b/drivers/xen/xenctrl/main.c
@@ -31,6 +31,8 @@
  * IN THE SOFTWARE.
  */
 
+#include "xenctrl.h"
+
 #include <linux/proc_fs.h>
 #include <linux/module.h>
 #include <asm/xen/hypervisor.h>
@@ -38,6 +40,7 @@
 static int __init xenctrl_init(void)
 {
 	struct proc_dir_entry *dir;
+	int ret;
 
 	if (!is_running_on_xen())
 		return -ENODEV;
@@ -48,11 +51,19 @@ static int __init xenctrl_init(void)
 
 	dir->owner = THIS_MODULE;
 
+	ret = capabilities_create_proc_entry();
+	if (ret)
+		goto fail1;
+
 	return 0;
+
+ fail1:	remove_proc_entry("xen", NULL);
+	return ret;
 }
 
 static void __exit xenctrl_exit(void)
 {
+	capabilities_remove_proc_entry();
 	remove_proc_entry("xen", NULL);
 }
 
diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h
new file mode 100644
index 0000000..7378dde
--- /dev/null
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * xenctl.h
+ * 
+ * Xen userspace control interfaces
+ * 
+ * Copyright (c) 2002-2004, K A Fraser, B Dragovic
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <linux/init.h>
+
+/*
+ * capabilities.c
+ */
+int capabilities_create_proc_entry(void) __init;
+void capabilities_remove_proc_entry(void) __exit;
-- 
1.5.4.1


linux-2.6-xen-0006-xen-Add-proc-xen-privcmd.patch:

--- NEW FILE linux-2.6-xen-0006-xen-Add-proc-xen-privcmd.patch ---
>From f65f1b7c305c444689988e6ee6354ec374dcbdf4 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 4 Feb 2008 08:24:57 +0000
Subject: [PATCH] xen: Add /proc/xen/privcmd

/proc/xen/privcmd is an ioctl() interface which allows
userspace apps to invoke hypercalls.

There should also be an ioctl (IOCTL_PRIVCMD_MMAP)
which is used to map foreign pages into a processes
address space, but we leave this unimplemented for
now pending further work on foreign page support.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenctrl/Makefile    |    1 +
 drivers/xen/xenctrl/main.c      |    6 +++
 drivers/xen/xenctrl/privcmd.c   |   81 +++++++++++++++++++++++++++++++++++++++
 drivers/xen/xenctrl/xenctrl.h   |    6 +++
 include/asm-x86/xen/hypercall.h |   28 +++++++++++++
 include/xen/sys/privcmd.h       |   79 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 201 insertions(+), 0 deletions(-)
 create mode 100644 drivers/xen/xenctrl/privcmd.c
 create mode 100644 include/xen/sys/privcmd.h

diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index 631f535..8a706cb 100644
--- a/drivers/xen/xenctrl/Makefile
+++ b/drivers/xen/xenctrl/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_XENCTRL) += xenctrl.o
 xenctrl-objs  =
 xenctrl-objs += main.o
 xenctrl-objs += capabilities.o
+xenctrl-objs += privcmd.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index 0e42f7e..d1fe6ef 100644
--- a/drivers/xen/xenctrl/main.c
+++ b/drivers/xen/xenctrl/main.c
@@ -55,14 +55,20 @@ static int __init xenctrl_init(void)
 	if (ret)
 		goto fail1;
 
+	ret = privcmd_create_proc_entry();
+	if (ret)
+		goto fail2;
+
 	return 0;
 
+ fail2: capabilities_remove_proc_entry();
  fail1:	remove_proc_entry("xen", NULL);
 	return ret;
 }
 
 static void __exit xenctrl_exit(void)
 {
+	privcmd_remove_proc_entry();
 	capabilities_remove_proc_entry();
 	remove_proc_entry("xen", NULL);
 }
diff --git a/drivers/xen/xenctrl/privcmd.c b/drivers/xen/xenctrl/privcmd.c
new file mode 100644
index 0000000..58c4b83
--- /dev/null
+++ b/drivers/xen/xenctrl/privcmd.c
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * privcmd.c
+ * 
+ * Interface to privileged domain-0 commands.
+ * 
+ * Copyright (c) 2002-2004, K A Fraser, B Dragovic
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <linux/uaccess.h>
+#include <asm/xen/hypervisor.h>
+#include <xen/sys/privcmd.h>
+
+static long privcmd_ioctl(struct file *file, unsigned int cmd,
+			  unsigned long arg)
+{
+	switch (cmd) {
+	case IOCTL_PRIVCMD_HYPERCALL: {
+		privcmd_hypercall_t cmd;
+  
+		if (copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)))
+			return -EFAULT;
+
+		return privcmd_hypercall(&cmd);
+	}
+
+	case IOCTL_PRIVCMD_MMAP:
+	case IOCTL_PRIVCMD_MMAPBATCH:
+		printk(KERN_WARNING "IOCTL_PRIVCMD_MMAP ioctl not yet implemented\n");
+	default:
+		return -EINVAL;
+	}
+}
+
+static const struct file_operations privcmd_file_ops = {
+	.unlocked_ioctl = privcmd_ioctl,
+};
+
+int __init privcmd_create_proc_entry(void)
+{
+	static struct proc_dir_entry *entry;
+
+	entry = create_proc_entry("xen/privcmd", 0400, NULL);
+	if (!entry)
+		return -ENOMEM;
+
+	entry->owner = THIS_MODULE;
+	entry->proc_fops = &privcmd_file_ops;
+
+	return 0;
+}
+
+void __exit privcmd_remove_proc_entry(void)
+{
+	remove_proc_entry("xen/privcmd", NULL);
+}
diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h
index 7378dde..a35209a 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -37,3 +37,9 @@
  */
 int capabilities_create_proc_entry(void) __init;
 void capabilities_remove_proc_entry(void) __exit;
+
+/*
+ * privcmd.c
+ */
+int privcmd_create_proc_entry(void) __init;
+void privcmd_remove_proc_entry(void) __exit;
diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index 2a4f9b4..b261030 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -423,4 +423,32 @@ MULTI_stack_switch(struct multicall_entry *mcl,
 	mcl->args[1] = esp;
 }
 
+#include <xen/sys/privcmd.h>
+
+static inline int privcmd_hypercall(privcmd_hypercall_t *hypercall)
+{
+	int ret;
+
+	if (hypercall->op >= (PAGE_SIZE >> 5))
+		return -EINVAL;
+
+	__asm__ __volatile__ (
+		"pushl %%ebx; pushl %%ecx; pushl %%edx; "
+		"pushl %%esi; pushl %%edi; "
+		"movl  8(%%eax),%%ebx ;"
+		"movl 16(%%eax),%%ecx ;"
+		"movl 24(%%eax),%%edx ;"
+		"movl 32(%%eax),%%esi ;"
+		"movl 40(%%eax),%%edi ;"
+		"movl   (%%eax),%%eax ;"
+		"shll $5,%%eax ;"
+		"addl $hypercall_page,%%eax ;"
+		"call *%%eax ;"
+		"popl %%edi; popl %%esi; popl %%edx; "
+		"popl %%ecx; popl %%ebx"
+		: "=a" (ret) : "0" (hypercall) : "memory" );
+
+	return ret;
+}
+
 #endif /* __HYPERCALL_H__ */
diff --git a/include/xen/sys/privcmd.h b/include/xen/sys/privcmd.h
new file mode 100644
index 0000000..9cfa9d7
--- /dev/null
+++ b/include/xen/sys/privcmd.h
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * privcmd.h
+ * 
+ * Interface to /proc/xen/privcmd.
+ * 
+ * Copyright (c) 2003-2005, K A Fraser
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __LINUX_PUBLIC_PRIVCMD_H__
+#define __LINUX_PUBLIC_PRIVCMD_H__
+
+#include <linux/types.h>
+
+#ifndef __user
+#define __user
+#endif
+
+typedef struct privcmd_hypercall
+{
+	__u64 op;
+	__u64 arg[5];
+} privcmd_hypercall_t;
+
+typedef struct privcmd_mmap_entry {
+	__u64 va;
+	__u64 mfn;
+	__u64 npages;
+} privcmd_mmap_entry_t; 
+
+typedef struct privcmd_mmap {
+	int num;
+	domid_t dom; /* target domain */
+	privcmd_mmap_entry_t __user *entry;
+} privcmd_mmap_t; 
+
+typedef struct privcmd_mmapbatch {
+	int num;     /* number of pages to populate */
+	domid_t dom; /* target domain */
+	__u64 addr;  /* virtual address */
+	ulong __user *arr; /* array of mfns - top nibble set on err */
+} privcmd_mmapbatch_t; 
+
+/*
+ * @cmd: IOCTL_PRIVCMD_HYPERCALL
+ * @arg: &privcmd_hypercall_t
+ * Return: Value returned from execution of the specified hypercall.
+ */
+#define IOCTL_PRIVCMD_HYPERCALL					\
+	_IOC(_IOC_NONE, 'P', 0, sizeof(privcmd_hypercall_t))
+#define IOCTL_PRIVCMD_MMAP					\
+	_IOC(_IOC_NONE, 'P', 2, sizeof(privcmd_mmap_t))
+#define IOCTL_PRIVCMD_MMAPBATCH					\
+	_IOC(_IOC_NONE, 'P', 3, sizeof(privcmd_mmapbatch_t))
+
+#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
-- 
1.5.4.1


linux-2.6-xen-0007-xen-Add-proc-xen-xenbus.patch:

--- NEW FILE linux-2.6-xen-0007-xen-Add-proc-xen-xenbus.patch ---
>From 99347028aaffbd71ec50420929f2dd10c9f78705 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 4 Feb 2008 22:04:36 +0000
Subject: [PATCH] xen: Add /proc/xen/xenbus

This interface is used by userspace programs to talk to
xenstored.

Since xenstored makes itself available to Dom0 userspace
via a socket this should only really be useful in Domu,
but it turns out that Dom0 apps historically default
to using /proc/xen/xenbus rather than the socket.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenbus/xenbus_comms.h |    1 -
 drivers/xen/xenbus/xenbus_probe.c |    2 +
 drivers/xen/xenbus/xenbus_xs.c    |    1 +
 drivers/xen/xenctrl/Makefile      |    1 +
 drivers/xen/xenctrl/main.c        |    6 +
 drivers/xen/xenctrl/xenbus.c      |  398 +++++++++++++++++++++++++++++++++++++
 drivers/xen/xenctrl/xenctrl.h     |    6 +
 include/xen/xenbus.h              |    2 +
 8 files changed, 416 insertions(+), 1 deletions(-)
 create mode 100644 drivers/xen/xenctrl/xenbus.c

diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
index c21db75..fcc9b29 100644
--- a/drivers/xen/xenbus/xenbus_comms.h
+++ b/drivers/xen/xenbus/xenbus_comms.h
@@ -41,6 +41,5 @@ int xb_data_to_read(void);
 int xb_wait_for_data_to_read(void);
 int xs_input_avail(void);
 extern struct xenstore_domain_interface *xen_store_interface;
-extern int xen_store_evtchn;
 
 #endif /* _XENBUS_COMMS_H */
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 57ceb53..c811581 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -56,6 +56,8 @@
 #include "xenbus_probe.h"
 
 int xen_store_evtchn;
+EXPORT_SYMBOL_GPL(xen_store_evtchn);
+
 struct xenstore_domain_interface *xen_store_interface;
 static unsigned long xen_store_mfn;
 
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 7f2f91c..e325eab 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -184,6 +184,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
 
 	return ret;
 }
+EXPORT_SYMBOL(xenbus_dev_request_and_reply);
 
 /* Send message to xs, get kmalloc'ed reply.  ERR_PTR() on error. */
 static void *xs_talkv(struct xenbus_transaction t,
diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index 8a706cb..23dafa3 100644
--- a/drivers/xen/xenctrl/Makefile
+++ b/drivers/xen/xenctrl/Makefile
@@ -4,3 +4,4 @@ xenctrl-objs  =
 xenctrl-objs += main.o
 xenctrl-objs += capabilities.o
 xenctrl-objs += privcmd.o
+xenctrl-objs += xenbus.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index d1fe6ef..b0cf61b 100644
--- a/drivers/xen/xenctrl/main.c
+++ b/drivers/xen/xenctrl/main.c
@@ -59,8 +59,13 @@ static int __init xenctrl_init(void)
 	if (ret)
 		goto fail2;
 
+	ret = xenbus_create_proc_entry();
+	if (ret)
+		goto fail3;
+
 	return 0;
 
+ fail3: privcmd_remove_proc_entry();
  fail2: capabilities_remove_proc_entry();
  fail1:	remove_proc_entry("xen", NULL);
 	return ret;
@@ -68,6 +73,7 @@ static int __init xenctrl_init(void)
 
 static void __exit xenctrl_exit(void)
 {
+	xenbus_remove_proc_entry();
 	privcmd_remove_proc_entry();
 	capabilities_remove_proc_entry();
 	remove_proc_entry("xen", NULL);
diff --git a/drivers/xen/xenctrl/xenbus.c b/drivers/xen/xenctrl/xenbus.c
new file mode 100644
index 0000000..57d5501
--- /dev/null
+++ b/drivers/xen/xenctrl/xenbus.c
@@ -0,0 +1,398 @@
+/*
+ * xenbus.c
+ * 
+ * /proc/xen/xenbus gives user-space access to the kernel's xenbus
+ * connection to xenstore.
+ * 
+ * Copyright (c) 2005, Christian Limpach
+ * Copyright (c) 2005, Rusty Russell, IBM Corporation
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <linux/uaccess.h>
+#include <linux/poll.h>
+
+#include <xen/xenbus.h>
+
+struct xenbus_dev_transaction {
+	struct list_head list;
+	struct xenbus_transaction handle;
+};
+
+struct read_buffer {
+	struct list_head list;
+	unsigned int cons;
+	unsigned int len;
+	char msg[];
+};
+
+struct xenbus_dev_data {
+	/* In-progress transaction. */
+	struct list_head transactions;
+
+	/* Active watches. */
+	struct list_head watches;
+
+	/* Partial request. */
+	unsigned int len;
+	union {
+		struct xsd_sockmsg msg;
+		char buffer[PAGE_SIZE];
+	} u;
+
+	/* Response queue. */
+	struct list_head read_buffers;
+	wait_queue_head_t read_waitq;
+
+	struct mutex reply_mutex;
+};
+
+static ssize_t xenbus_dev_read(struct file *filp,
+			       char __user *ubuf,
+			       size_t len, loff_t *ppos)
+{
+	struct xenbus_dev_data *u = filp->private_data;
+	struct read_buffer *rb;
+	int i, ret;
+
+	mutex_lock(&u->reply_mutex);
+	while (list_empty(&u->read_buffers)) {
+		mutex_unlock(&u->reply_mutex);
+		ret = wait_event_interruptible(u->read_waitq,
+					       !list_empty(&u->read_buffers));
+		if (ret)
+			return ret;
+		mutex_lock(&u->reply_mutex);
+	}
+
+	rb = list_entry(u->read_buffers.next, struct read_buffer, list);
+	for (i = 0; i < len;) {
+		put_user(rb->msg[rb->cons], ubuf + i);
+		i++;
+		rb->cons++;
+		if (rb->cons == rb->len) {
+			list_del(&rb->list);
+			kfree(rb);
+			if (list_empty(&u->read_buffers))
+				break;
+			rb = list_entry(u->read_buffers.next,
+					struct read_buffer, list);
+		}
+	}
+	mutex_unlock(&u->reply_mutex);
+
+	return i;
+}
+
+static void queue_reply(struct xenbus_dev_data *u,
+			char *data, unsigned int len)
+{
+	struct read_buffer *rb;
+
+	if (len == 0)
+		return;
+
+	rb = kmalloc(sizeof(*rb) + len, GFP_KERNEL);
+	BUG_ON(rb == NULL);
+
+	rb->cons = 0;
+	rb->len = len;
+
+	memcpy(rb->msg, data, len);
+
+	list_add_tail(&rb->list, &u->read_buffers);
+
+	wake_up(&u->read_waitq);
+}
+
+struct watch_adapter
+{
+	struct list_head list;
+	struct xenbus_watch watch;
+	struct xenbus_dev_data *dev_data;
+	char *token;
+};
+
+static void free_watch_adapter(struct watch_adapter *watch)
+{
+	kfree(watch->watch.node);
+	kfree(watch->token);
+	kfree(watch);
+}
+
+static void watch_fired(struct xenbus_watch *watch,
+			const char **vec,
+			unsigned int len)
+{
+	struct watch_adapter *adap =
+            container_of(watch, struct watch_adapter, watch);
+	struct xsd_sockmsg hdr;
+	const char *path, *token;
+	int path_len, tok_len, body_len;
+
+	path = vec[XS_WATCH_PATH];
+	token = adap->token;
+
+	path_len = strlen(path) + 1;
+	tok_len = strlen(token) + 1;
+	body_len = path_len + tok_len;
+
+	hdr.type = XS_WATCH_EVENT;
+	hdr.len = body_len;
+
+	mutex_lock(&adap->dev_data->reply_mutex);
+	queue_reply(adap->dev_data, (char *)&hdr, sizeof(hdr));
+	queue_reply(adap->dev_data, (char *)path, path_len);
+	queue_reply(adap->dev_data, (char *)token, tok_len);
+	mutex_unlock(&adap->dev_data->reply_mutex);
+}
+
+static LIST_HEAD(watch_list);
+
+static ssize_t xenbus_dev_write(struct file *filp,
+				const char __user *ubuf,
+				size_t len, loff_t *ppos)
+{
+	struct xenbus_dev_data *u = filp->private_data;
+	struct xenbus_dev_transaction *trans = NULL;
+	uint32_t msg_type;
+	void *reply;
+	char *path, *token;
+	struct watch_adapter *watch, *tmp_watch;
+	int err, rc = len;
+
+	if ((len + u->len) > sizeof(u->u.buffer)) {
+		rc = -EINVAL;
+		goto out;
+	}
+
+	if (copy_from_user(u->u.buffer + u->len, ubuf, len) != 0) {
+		rc = -EFAULT;
+		goto out;
+	}
+
+	u->len += len;
+	if ((u->len < sizeof(u->u.msg)) ||
+	    (u->len < (sizeof(u->u.msg) + u->u.msg.len)))
+		return rc;
+
+	msg_type = u->u.msg.type;
+
+	switch (msg_type) {
+	case XS_TRANSACTION_START:
+	case XS_TRANSACTION_END:
+	case XS_DIRECTORY:
+	case XS_READ:
+	case XS_GET_PERMS:
+	case XS_RELEASE:
+	case XS_GET_DOMAIN_PATH:
+	case XS_WRITE:
+	case XS_MKDIR:
+	case XS_RM:
+	case XS_SET_PERMS:
+		if (msg_type == XS_TRANSACTION_START) {
+			trans = kmalloc(sizeof(*trans), GFP_KERNEL);
+			if (!trans) {
+				rc = -ENOMEM;
+				goto out;
+			}
+		}
+
+		reply = xenbus_dev_request_and_reply(&u->u.msg);
+		if (IS_ERR(reply)) {
+			kfree(trans);
+			rc = PTR_ERR(reply);
+			goto out;
+		}
+
+		if (msg_type == XS_TRANSACTION_START) {
+			trans->handle.id = simple_strtoul(reply, NULL, 0);
+			list_add(&trans->list, &u->transactions);
+		} else if (msg_type == XS_TRANSACTION_END) {
+			list_for_each_entry(trans, &u->transactions, list)
+				if (trans->handle.id == u->u.msg.tx_id)
+					break;
+			BUG_ON(&trans->list == &u->transactions);
+			list_del(&trans->list);
+			kfree(trans);
+		}
+		mutex_lock(&u->reply_mutex);
+		queue_reply(u, (char *)&u->u.msg, sizeof(u->u.msg));
+		queue_reply(u, (char *)reply, u->u.msg.len);
+		mutex_unlock(&u->reply_mutex);
+		kfree(reply);
+		break;
+
+	case XS_WATCH:
+	case XS_UNWATCH: {
+		static const char *XS_RESP = "OK";
+		struct xsd_sockmsg hdr;
+
+		path = u->u.buffer + sizeof(u->u.msg);
+		token = memchr(path, 0, u->u.msg.len);
+		if (token == NULL) {
+			rc = -EILSEQ;
+			goto out;
+		}
+		token++;
+
+		if (msg_type == XS_WATCH) {
+			watch = kmalloc(sizeof(*watch), GFP_KERNEL);
+			watch->watch.node = kmalloc(strlen(path)+1,
+                                                    GFP_KERNEL);
+			strcpy((char *)watch->watch.node, path);
+			watch->watch.callback = watch_fired;
+			watch->token = kmalloc(strlen(token)+1, GFP_KERNEL);
+			strcpy(watch->token, token);
+			watch->dev_data = u;
+
+			err = register_xenbus_watch(&watch->watch);
+			if (err) {
+				free_watch_adapter(watch);
+				rc = err;
+				goto out;
+			}
+			
+			list_add(&watch->list, &u->watches);
+		} else {
+			list_for_each_entry_safe(watch, tmp_watch,
+                                                 &u->watches, list) {
+				if (!strcmp(watch->token, token) &&
+				    !strcmp(watch->watch.node, path))
+				{
+					unregister_xenbus_watch(&watch->watch);
+					list_del(&watch->list);
+					free_watch_adapter(watch);
+					break;
+				}
+			}
+		}
+
+		hdr.type = msg_type;
+		hdr.len = strlen(XS_RESP) + 1;
+		mutex_lock(&u->reply_mutex);
+		queue_reply(u, (char *)&hdr, sizeof(hdr));
+		queue_reply(u, (char *)XS_RESP, hdr.len);
+		mutex_unlock(&u->reply_mutex);
+		break;
+	}
+
+	default:
+		rc = -EINVAL;
+		break;
+	}
+
+ out:
+	u->len = 0;
+	return rc;
+}
+
+static int xenbus_dev_open(struct inode *inode, struct file *filp)
+{
+	struct xenbus_dev_data *u;
+
+	if (xen_store_evtchn == 0)
+		return -ENOENT;
+
+	nonseekable_open(inode, filp);
+
+	u = kzalloc(sizeof(*u), GFP_KERNEL);
+	if (u == NULL)
+		return -ENOMEM;
+
+	INIT_LIST_HEAD(&u->transactions);
+	INIT_LIST_HEAD(&u->watches);
+	INIT_LIST_HEAD(&u->read_buffers);
+	init_waitqueue_head(&u->read_waitq);
+
+	mutex_init(&u->reply_mutex);
+
+	filp->private_data = u;
+
+	return 0;
+}
+
+static int xenbus_dev_release(struct inode *inode, struct file *filp)
+{
+	struct xenbus_dev_data *u = filp->private_data;
+	struct xenbus_dev_transaction *trans, *tmp;
+	struct watch_adapter *watch, *tmp_watch;
+
+	list_for_each_entry_safe(trans, tmp, &u->transactions, list) {
+		xenbus_transaction_end(trans->handle, 1);
+		list_del(&trans->list);
+		kfree(trans);
+	}
+
+	list_for_each_entry_safe(watch, tmp_watch, &u->watches, list) {
+		unregister_xenbus_watch(&watch->watch);
+		list_del(&watch->list);
+		free_watch_adapter(watch);
+	}
+
+	kfree(u);
+
+	return 0;
+}
+
+static unsigned int xenbus_dev_poll(struct file *file, poll_table *wait)
+{
+	struct xenbus_dev_data *u = file->private_data;
+
+	poll_wait(file, &u->read_waitq, wait);
+	if (!list_empty(&u->read_buffers))
+		return POLLIN | POLLRDNORM;
+	return 0;
+}
+
+static const struct file_operations xenbus_dev_file_ops = {
+	.read = xenbus_dev_read,
+	.write = xenbus_dev_write,
+	.open = xenbus_dev_open,
+	.release = xenbus_dev_release,
+	.poll = xenbus_dev_poll,
+};
+
+int __init xenbus_create_proc_entry(void)
+{
+	struct proc_dir_entry *entry;
+
+	entry = create_proc_entry("xen/xenbus", 0400, NULL);
+	if (!entry)
+		return -ENOMEM;
+
+	entry->owner = THIS_MODULE;
+	entry->proc_fops = &xenbus_dev_file_ops;
+
+	return 0;
+}
+
+void __exit xenbus_remove_proc_entry(void)
+{
+	remove_proc_entry("xen/xenbus", NULL);
+}
diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h
index a35209a..e585c4b 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -43,3 +43,9 @@ void capabilities_remove_proc_entry(void) __exit;
  */
 int privcmd_create_proc_entry(void) __init;
 void privcmd_remove_proc_entry(void) __exit;
+
+/*
+ * xenbus.c
+ */
+int xenbus_create_proc_entry(void) __init;
+void xenbus_remove_proc_entry(void) __exit;
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 6369d89..a3fef9d 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -232,4 +232,6 @@ const char *xenbus_strstate(enum xenbus_state state);
 int xenbus_dev_is_online(struct xenbus_device *dev);
 int xenbus_frontend_closed(struct xenbus_device *dev);
 
+extern int xen_store_evtchn;
+
 #endif /* _XEN_XENBUS_H */
-- 
1.5.4.1


linux-2.6-xen-0008-xen-Add-Xen-s-sys-hypervisor-interface.patch:

--- NEW FILE linux-2.6-xen-0008-xen-Add-Xen-s-sys-hypervisor-interface.patch ---
>From 1e8f36fd7994750457292685cdfb71dd6be1750c Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Thu, 7 Feb 2008 15:32:28 +0000
Subject: [PATCH] xen: Add Xen's /sys/hypervisor interface

Hook up Xen's /sys/hypervisor interface:

  /sys/hypervisor/
    -> type
    -> uuid
    -> compilation
         -> compile_date
         -> compiled_by
         -> compiler
    -> properties
         -> capabilities
         -> changeset
         -> pagesize
         -> virtual_start
         -> writable_pt
    -> version
         -> extra
         -> major
         -> minor

Note: the hypervisor subsys hook requires that
SYS_HYPERVISOR is selected to enabled it, which in
turns means that the subsys will be registered by
a pv-ops kernel with Xen support, even on bare
metal. This hook needs to be changed to be runtime
enabled.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/Kconfig            |    3 +-
 drivers/xen/xenctrl/Makefile    |    1 +
 drivers/xen/xenctrl/main.c      |    6 +
 drivers/xen/xenctrl/sysfs.c     |  349 +++++++++++++++++++++++++++++++++++++++
 drivers/xen/xenctrl/xenctrl.h   |    6 +
 include/xen/interface/version.h |    6 +
 6 files changed, 370 insertions(+), 1 deletions(-)
 create mode 100644 drivers/xen/xenctrl/sysfs.c

diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index b5e3aa2..2983253 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -25,7 +25,8 @@ config XEN_MAX_DOMAIN_MEMORY
 
 config XENCTRL
 	tristate "Xen's user space control interfaces"
-	depends on XEN && PROC_FS
+	depends on XEN && PROC_FS && SYSFS
 	default y if XEN
+	select SYS_HYPERVISOR
 	help
 	  This is the /proc/xen interface used by Xen's libxc.
diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index 23dafa3..e126e76 100644
--- a/drivers/xen/xenctrl/Makefile
+++ b/drivers/xen/xenctrl/Makefile
@@ -5,3 +5,4 @@ xenctrl-objs += main.o
 xenctrl-objs += capabilities.o
 xenctrl-objs += privcmd.o
 xenctrl-objs += xenbus.o
+xenctrl-objs += sysfs.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index b0cf61b..87d0dba 100644
--- a/drivers/xen/xenctrl/main.c
+++ b/drivers/xen/xenctrl/main.c
@@ -63,8 +63,13 @@ static int __init xenctrl_init(void)
 	if (ret)
 		goto fail3;
 
+	ret = sys_hypervisor_init();
+	if (ret)
+		goto fail4;
+
 	return 0;
 
+ fail4: xenbus_remove_proc_entry();
  fail3: privcmd_remove_proc_entry();
  fail2: capabilities_remove_proc_entry();
  fail1:	remove_proc_entry("xen", NULL);
@@ -73,6 +78,7 @@ static int __init xenctrl_init(void)
 
 static void __exit xenctrl_exit(void)
 {
+	sys_hypervisor_exit();
 	xenbus_remove_proc_entry();
 	privcmd_remove_proc_entry();
 	capabilities_remove_proc_entry();
diff --git a/drivers/xen/xenctrl/sysfs.c b/drivers/xen/xenctrl/sysfs.c
new file mode 100644
index 0000000..8cbf4d6
--- /dev/null
+++ b/drivers/xen/xenctrl/sysfs.c
@@ -0,0 +1,349 @@
+/*
+ *  copyright (c) 2006 IBM Corporation
+ *  Authored by: Mike D. Day <ncmike at us.ibm.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+#include <linux/err.h>
+#include <asm/xen/hypervisor.h>
+#include <xen/xenbus.h>
+#include "xenctrl.h"
+
+#define HYPERVISOR_ATTR_RO(_name) \
+static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
+
+#define HYPERVISOR_ATTR_RW(_name) \
+static struct kobj_attribute _name##_attr = \
+	__ATTR(_name, 0644, _name##_show, _name##_store)
+
+static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	return sprintf(buffer, "xen\n");
+}
+
+HYPERVISOR_ATTR_RO(type);
+
+static int __init xen_sysfs_type_init(void)
+{
+	return sysfs_create_file(hypervisor_kobj, &type_attr.attr);
+}
+
+static void xen_sysfs_type_destroy(void)
+{
+	sysfs_remove_file(hypervisor_kobj, &type_attr.attr);
+}
+
+static ssize_t major_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	int version;
+
+	version = HYPERVISOR_xen_version(XENVER_version, NULL);
+	if (!version)
+		return -ENODEV;
+
+	return sprintf(buffer, "%d\n", version >> 16);
+}
+
+HYPERVISOR_ATTR_RO(major);
+
+static ssize_t minor_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	int version;
+
+	version = HYPERVISOR_xen_version(XENVER_version, NULL);
+	if (!version)
+		return -ENODEV;
+
+	return sprintf(buffer, "%d\n", version & 0xff);
+}
+
+HYPERVISOR_ATTR_RO(minor);
+
+static ssize_t extra_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	int ret;
+	struct xen_extraversion extra;
+
+	ret = HYPERVISOR_xen_version(XENVER_extraversion, &extra);
+	if (ret)
+		return ret;
+
+	return sprintf(buffer, "%s\n", extra.extraversion);
+}
+
+HYPERVISOR_ATTR_RO(extra);
+
+static struct attribute *version_attrs[] = {
+	&major_attr.attr,
+	&minor_attr.attr,
+	&extra_attr.attr,
+	NULL
+};
+
+static struct attribute_group version_group = {
+	.name = "version",
+	.attrs = version_attrs,
+};
+
+static int __init xen_sysfs_version_init(void)
+{
+	return sysfs_create_group(hypervisor_kobj, &version_group);
+}
+
+static void xen_sysfs_version_destroy(void)
+{
+	sysfs_remove_group(hypervisor_kobj, &version_group);
+}
+
+static ssize_t uuid_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	char *vm, *val;
+	int ret;
+
+	vm = xenbus_read(XBT_NIL, "vm", "", NULL);
+	if (IS_ERR(vm))
+		return PTR_ERR(vm);
+
+	val = xenbus_read(XBT_NIL, vm, "uuid", NULL);
+	if (IS_ERR(val)) {
+		ret = PTR_ERR(val);
+		goto out;
+	}
+
+	ret = sprintf(buffer, "%s\n", val);
+
+	kfree(val);
+out:	kfree(vm);
+
+	return ret;
+}
+
+HYPERVISOR_ATTR_RO(uuid);
+
+static int __init xen_sysfs_uuid_init(void)
+{
+	return sysfs_create_file(hypervisor_kobj, &uuid_attr.attr);
+}
+
+static void xen_sysfs_uuid_destroy(void)
+{
+	sysfs_remove_file(hypervisor_kobj, &uuid_attr.attr);
+}
+
+static ssize_t compiler_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	struct xen_compile_info info;
+	int ret;
+
+	ret = HYPERVISOR_xen_version(XENVER_compile_info, &info);
+	if (ret)
+		return ret;
+
+	return sprintf(buffer, "%s\n", info.compiler);
+}
+
+HYPERVISOR_ATTR_RO(compiler);
+
+static ssize_t compiled_by_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	struct xen_compile_info info;
+	int ret;
+
+	ret = HYPERVISOR_xen_version(XENVER_compile_info, &info);
+	if (ret)
+		return ret;
+
+	return sprintf(buffer, "%s\n", info.compile_by);
+}
+
+HYPERVISOR_ATTR_RO(compiled_by);
+
+static ssize_t compile_date_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	struct xen_compile_info info;
+	int ret;
+
+	ret = HYPERVISOR_xen_version(XENVER_compile_info, &info);
+	if (ret)
+		return ret;
+
+	return sprintf(buffer, "%s\n", info.compile_date);
+}
+
+HYPERVISOR_ATTR_RO(compile_date);
+
+static struct attribute *xen_compile_attrs[] = {
+	&compiler_attr.attr,
+	&compiled_by_attr.attr,
+	&compile_date_attr.attr,
+	NULL
+};
+
+static struct attribute_group xen_compilation_group = {
+	.name = "compilation",
+	.attrs = xen_compile_attrs,
+};
+
+static int __init xen_compilation_init(void)
+{
+	return sysfs_create_group(hypervisor_kobj,
+				  &xen_compilation_group);
+}
+
+static void xen_compilation_destroy(void)
+{
+	sysfs_remove_group(hypervisor_kobj,
+			   &xen_compilation_group);
+}
+
+static ssize_t capabilities_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	struct xen_capabilities_info *caps;
+	int ret;
+
+	caps = kmalloc(sizeof(struct xen_capabilities_info), GFP_KERNEL);
+	if (!caps)
+		return -ENOMEM;
+
+	ret = HYPERVISOR_xen_version(XENVER_capabilities, caps);
+	if (ret)
+		goto out;
+
+	ret = sprintf(buffer, "%s\n", caps->info);
+
+out:	kfree(caps);
+
+	return ret;
+}
+
+HYPERVISOR_ATTR_RO(capabilities);
+
+static ssize_t changeset_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	struct xen_changeset_info cset;
+	int ret;
+
+	ret = HYPERVISOR_xen_version(XENVER_changeset, &cset);
+	if (ret)
+		return ret;
+
+	return sprintf(buffer, "%s\n", cset.info);
+}
+
+HYPERVISOR_ATTR_RO(changeset);
+
+static ssize_t virtual_start_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	struct xen_platform_parameters parms;
+	int ret;
+
+	ret = HYPERVISOR_xen_version(XENVER_platform_parameters, &parms);
+	if (ret)
+		return ret;
+
+	return sprintf(buffer, "%lx\n", parms.virt_start);
+}
+
+HYPERVISOR_ATTR_RO(virtual_start);
+
+static ssize_t pagesize_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	int ret;
+
+	ret = HYPERVISOR_xen_version(XENVER_pagesize, NULL);
+	if (ret < 0)
+		return ret;
+
+	return sprintf(buffer, "%x\n", ret);
+}
+
+HYPERVISOR_ATTR_RO(pagesize);
+
+static ssize_t writable_pt_show(struct kobject *kobj, struct kobj_attribute *attr, char *buffer)
+{
+	struct xen_feature_info info;
+	int ret;
+
+	info.submap_idx = XENFEAT_writable_page_tables;
+
+	ret = HYPERVISOR_xen_version(XENVER_get_features, &info);
+	if (ret)
+		return ret;
+
+	return sprintf(buffer, "%d\n", info.submap);
+}
+
+HYPERVISOR_ATTR_RO(writable_pt);
+
+static struct attribute *xen_properties_attrs[] = {
+	&capabilities_attr.attr,
+	&changeset_attr.attr,
+	&virtual_start_attr.attr,
+	&pagesize_attr.attr,
+	&writable_pt_attr.attr,
+	NULL
+};
+
+static struct attribute_group xen_properties_group = {
+	.name = "properties",
+	.attrs = xen_properties_attrs,
+};
+
+static int __init xen_properties_init(void)
+{
+	return sysfs_create_group(hypervisor_kobj,
+				  &xen_properties_group);
+}
+
+static void xen_properties_destroy(void)
+{
+	sysfs_remove_group(hypervisor_kobj, &xen_properties_group);
+}
+
+int __init sys_hypervisor_init(void)
+{
+	int ret;
+
+	if (!is_running_on_xen())
+		return -ENODEV;
+
+	ret = xen_sysfs_type_init();
+	if (ret)
+		goto out;
+	ret = xen_sysfs_version_init();
+	if (ret)
+		goto version_out;
+	ret = xen_compilation_init();
+	if (ret)
+		goto comp_out;
+	ret = xen_sysfs_uuid_init();
+	if (ret)
+		goto uuid_out;
+	ret = xen_properties_init();
+	if (!ret)
+		goto out;
+
+	xen_sysfs_uuid_destroy();
+uuid_out:
+	xen_compilation_destroy();
+comp_out:
+	xen_sysfs_version_destroy();
+version_out:
+	xen_sysfs_type_destroy();
+out:
+	return ret;
+}
+
+void __exit sys_hypervisor_exit(void)
+{
+	xen_properties_destroy();
+	xen_compilation_destroy();
+	xen_sysfs_uuid_destroy();
+	xen_sysfs_version_destroy();
+	xen_sysfs_type_destroy();
+}
diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h
index e585c4b..1afbdfb 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -49,3 +49,9 @@ void privcmd_remove_proc_entry(void) __exit;
  */
 int xenbus_create_proc_entry(void) __init;
 void xenbus_remove_proc_entry(void) __exit;
+
+/*
+ * sysfs.c
+ */
+int sys_hypervisor_init(void) __init;
+void sys_hypervisor_exit(void) __exit;
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
index 453235e..dd58cf5 100644
--- a/include/xen/interface/version.h
+++ b/include/xen/interface/version.h
@@ -57,4 +57,10 @@ struct xen_feature_info {
 /* Declares the features reported by XENVER_get_features. */
 #include "features.h"
 
+/* arg == NULL; returns host memory page size. */
+#define XENVER_pagesize 7
+
+/* arg == xen_domain_handle_t. */
+#define XENVER_guest_handle 8
+
 #endif /* __XEN_PUBLIC_VERSION_H__ */
-- 
1.5.4.1


linux-2.6-xen-0009-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch:

--- NEW FILE linux-2.6-xen-0009-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch ---
>From bd26a092c493ca8fdc4e26d42fdcfb988fbc3fea Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Thu, 6 Mar 2008 11:10:59 +0000
Subject: [PATCH] xen x86_64: Add 64 bit version of privcmd_hypercall()

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 include/asm-x86/xen/hypercall.h |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index b261030..74465b7 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -425,6 +425,7 @@ MULTI_stack_switch(struct multicall_entry *mcl,
 
 #include <xen/sys/privcmd.h>
 
+#ifdef CONFIG_X86_32
 static inline int privcmd_hypercall(privcmd_hypercall_t *hypercall)
 {
 	int ret;
@@ -450,5 +451,32 @@ static inline int privcmd_hypercall(privcmd_hypercall_t *hypercall)
 
 	return ret;
 }
+#else /* CONFIG_X86_32 */
+static inline int privcmd_hypercall(privcmd_hypercall_t *hypercall)
+{
+	int ret;
+        long ign1, ign2, ign3;
+
+	if (hypercall->op >= (PAGE_SIZE >> 5))
+		return -EINVAL;
+
+        __asm__ __volatile__ (
+		"movq %8,%%r10; movq %9,%%r8;"
+                "shll $5,%%eax ;"
+                "addq $hypercall_page,%%rax ;"
+                "call *%%rax"
+                : "=a" (ret), "=D" (ign1),
+                  "=S" (ign2), "=d" (ign3)
+                : "0" ((unsigned int)hypercall->op),
+                  "1" (hypercall->arg[0]),
+                  "2" (hypercall->arg[1]),
+                  "3" (hypercall->arg[2]),
+                  "g" (hypercall->arg[3]),
+                  "g" (hypercall->arg[4])
+                : "r8", "r10", "memory" );
+
+	return ret;
+}
+#endif /* CONFIG_X86_32 */
 
 #endif /* __HYPERCALL_H__ */
-- 
1.5.4.1


linux-2.6-xen-0010-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch:

--- NEW FILE linux-2.6-xen-0010-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch ---
>From fe3adc294af5b5be37dbc9aa5e8393898bfb61bc Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Tue, 25 Mar 2008 11:56:43 +0000
Subject: [PATCH] xen x86_64: Only define load_user_cs_desc() on 32 bit

load_user_cs_desc() is only used on 32 bit, so only
define it in that case.

Fixes compile failure in native_load_user_cs_desc()
since mm_context_t->user_cs is only available on
32 bit.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/paravirt.c |    2 ++
 arch/x86/xen/enlighten.c   |    4 ++++
 include/asm-x86/desc.h     |    4 ++++
 include/asm-x86/paravirt.h |    4 ++++
 4 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index cc185d2..63ef48b 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -323,7 +323,9 @@ struct pv_cpu_ops pv_cpu_ops = {
 	.read_tscp = native_read_tscp,
 	.load_tr_desc = native_load_tr_desc,
 	.set_ldt = native_set_ldt,
+#ifdef CONFIG_X86_32
 	.load_user_cs_desc = native_load_user_cs_desc,
+#endif
 	.load_gdt = native_load_gdt,
 	.load_idt = native_load_idt,
 	.store_gdt = native_store_gdt,
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index bedcec8..7bf15e8 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -323,6 +323,7 @@ static void xen_set_ldt(const void *addr, unsigned entries)
 	xen_mc_issue(PARAVIRT_LAZY_CPU);
 }
 
+#ifdef CONFIG_X86_32
 static inline void xen_load_user_cs_desc(int cpu, struct mm_struct *mm)
 {
 	void *gdt;
@@ -338,6 +339,7 @@ static inline void xen_load_user_cs_desc(int cpu, struct mm_struct *mm)
 
 	HYPERVISOR_update_descriptor(mgdt.maddr, descriptor);
 }
+#endif
 
 static void xen_load_gdt(const struct desc_ptr *dtr)
 {
@@ -1109,7 +1111,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 
 	.load_tr_desc = paravirt_nop,
 	.set_ldt = xen_set_ldt,
+#ifdef CONFIG_X86_32
 	.load_user_cs_desc = xen_load_user_cs_desc,
+#endif
 	.load_gdt = xen_load_gdt,
 	.load_idt = xen_load_idt,
 	.load_tls = xen_load_tls,
diff --git a/include/asm-x86/desc.h b/include/asm-x86/desc.h
index eaba600..dc97a74 100644
--- a/include/asm-x86/desc.h
+++ b/include/asm-x86/desc.h
@@ -91,7 +91,9 @@ static inline int desc_empty(const void *ptr)
 
 #define load_TLS(t, cpu) native_load_tls(t, cpu)
 #define set_ldt native_set_ldt
+#ifdef CONFIG_X86_32
 #define load_user_cs_desc native_load_user_cs_desc
+#endif
 
 #define write_ldt_entry(dt, entry, desc)	\
 	native_write_ldt_entry(dt, entry, desc)
@@ -382,10 +384,12 @@ static inline void set_user_cs(struct desc_struct *desc, unsigned long limit)
 	desc->b = (limit & 0xf0000) | 0x00c0fb00;
 }
 
+#ifdef CONFIG_X86_32
 static inline void native_load_user_cs_desc(int cpu, struct mm_struct *mm)
 {
 	get_cpu_gdt_table(cpu)[GDT_ENTRY_DEFAULT_USER_CS] = mm->context.user_cs;
 }
+#endif
 
 extern void arch_add_exec_range(struct mm_struct *mm, unsigned long limit);
 extern void arch_remove_exec_range(struct mm_struct *mm, unsigned long limit);
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index fd6aed1..fd2f7b5 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -113,7 +113,9 @@ struct pv_cpu_ops {
 	void (*store_gdt)(struct desc_ptr *);
 	void (*store_idt)(struct desc_ptr *);
 	void (*set_ldt)(const void *desc, unsigned entries);
+#ifdef CONFIG_X86_32
 	void (*load_user_cs_desc)(int cpu, struct mm_struct *mm);
+#endif
 	unsigned long (*store_tr)(void);
 	void (*load_tls)(struct thread_struct *t, unsigned int cpu);
 #ifdef CONFIG_X86_64
@@ -831,11 +833,13 @@ static inline void set_ldt(const void *addr, unsigned entries)
 {
 	PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries);
 }
+#ifdef CONFIG_X86_32
 static inline void load_user_cs_desc(unsigned int cpu, 
 				     struct mm_struct *mm)
 {
 	PVOP_VCALL2(pv_cpu_ops.load_user_cs_desc, cpu, mm);
 }
+#endif
 static inline void store_gdt(struct desc_ptr *dtr)
 {
 	PVOP_VCALL1(pv_cpu_ops.store_gdt, dtr);
-- 
1.5.4.1


linux-2.6-xen-0011-x86-paravirt-call-paravirt_pagetable_setup_-start.patch:

--- NEW FILE linux-2.6-xen-0011-x86-paravirt-call-paravirt_pagetable_setup_-start.patch ---
>From a6e3b2a8cfca8c814a4b59337678383e1a6511bc Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost at redhat.com>
Date: Tue, 8 Jul 2008 15:06:23 -0700
Subject: [PATCH] x86/paravirt: call paravirt_pagetable_setup_{start, done}

Call paravirt_pagetable_setup_{start,done}

These paravirt_ops functions were not being called on x86_64.

Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/paravirt.c   |    4 ++++
 arch/x86/kernel/setup.c      |    2 ++
 arch/x86/xen/enlighten.c     |    4 ++++
 include/asm-x86/pgtable.h    |   18 ++++++++++++++++++
 include/asm-x86/pgtable_32.h |   15 ---------------
 5 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 63ef48b..c0053a0 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -29,6 +29,7 @@
 #include <asm/desc.h>
 #include <asm/setup.h>
 #include <asm/arch_hooks.h>
+#include <asm/pgtable.h>
 #include <asm/time.h>
 #include <asm/pgalloc.h>
 #include <asm/irq.h>
@@ -376,6 +377,9 @@ struct pv_mmu_ops pv_mmu_ops = {
 #ifndef CONFIG_X86_64
 	.pagetable_setup_start = native_pagetable_setup_start,
 	.pagetable_setup_done = native_pagetable_setup_done,
+#else
+	.pagetable_setup_start = paravirt_nop,
+	.pagetable_setup_done = paravirt_nop,
 #endif
 
 	.read_cr2 = native_read_cr2,
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 531b55b..a8071a9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -824,7 +824,9 @@ void __init setup_arch(char **cmdline_p)
 	vmi_init();
 #endif
 
+	paravirt_pagetable_setup_start(swapper_pg_dir);
 	paging_init();
+	paravirt_pagetable_setup_done(swapper_pg_dir);
 
 #ifdef CONFIG_X86_64
 	map_vsyscall();
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 7bf15e8..1731ff5 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -859,6 +859,7 @@ static __init void xen_set_pte_init(pte_t *ptep, pte_t pte)
 
 static __init void xen_pagetable_setup_start(pgd_t *base)
 {
+#ifdef CONFIG_X86_32
 	pgd_t *xen_pgd = (pgd_t *)xen_start_info->pt_base;
 	int i;
 
@@ -904,6 +905,7 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
 	/* Unpin initial Xen pagetable */
 	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE,
 			  PFN_DOWN(__pa(xen_start_info->pt_base)));
+#endif	/* CONFIG_X86_32 */
 }
 
 void xen_setup_shared_info(void)
@@ -945,9 +947,11 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 
 	xen_setup_shared_info();
 
+#ifdef CONFIG_X86_32
 	/* Actually pin the pagetable down, but we can't set PG_pinned
 	   yet because the page structures don't exist yet. */
 	pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(base)));
+#endif
 }
 
 static __init void xen_post_allocator_init(void)
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 49cbd76..96aa76e 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -302,6 +302,14 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
 /* Install a pte for a particular vaddr in kernel space. */
 void set_pte_vaddr(unsigned long vaddr, pte_t pte);
 
+#ifdef CONFIG_X86_32
+extern void native_pagetable_setup_start(pgd_t *base);
+extern void native_pagetable_setup_done(pgd_t *base);
+#else
+static inline void native_pagetable_setup_start(pgd_t *base) {}
+static inline void native_pagetable_setup_done(pgd_t *base) {}
+#endif
+
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
 #else  /* !CONFIG_PARAVIRT */
@@ -333,6 +341,16 @@ void set_pte_vaddr(unsigned long vaddr, pte_t pte);
 
 #define pte_update(mm, addr, ptep)              do { } while (0)
 #define pte_update_defer(mm, addr, ptep)        do { } while (0)
+
+static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
+{
+	native_pagetable_setup_start(base);
+}
+
+static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
+{
+	native_pagetable_setup_done(base);
+}
 #endif	/* CONFIG_PARAVIRT */
 
 #endif	/* __ASSEMBLY__ */
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index ec871c4..0611abf 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -171,21 +171,6 @@ do {						\
  */
 #define update_mmu_cache(vma, address, pte) do { } while (0)
 
-extern void native_pagetable_setup_start(pgd_t *base);
-extern void native_pagetable_setup_done(pgd_t *base);
-
-#ifndef CONFIG_PARAVIRT
-static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
-{
-	native_pagetable_setup_start(base);
-}
-
-static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
-{
-	native_pagetable_setup_done(base);
-}
-#endif	/* !CONFIG_PARAVIRT */
-
 #endif /* !__ASSEMBLY__ */
 
 /*
-- 
1.5.4.1


linux-2.6-xen-0012-pvops-64-call-paravirt_post_allocator_init-on-set.patch:

--- NEW FILE linux-2.6-xen-0012-pvops-64-call-paravirt_post_allocator_init-on-set.patch ---
>From e79a8c9d5d7011b99e6af7a6efe884ee05fa6b38 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost at redhat.com>
Date: Tue, 8 Jul 2008 15:06:24 -0700
Subject: [PATCH] pvops-64: call paravirt_post_allocator_init() on setup_arch()

Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/setup.c |    1 +
 arch/x86/mm/init_32.c   |    2 --
 arch/x86/xen/mmu.c      |    8 +++++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index a8071a9..c9010f8 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -827,6 +827,7 @@ void __init setup_arch(char **cmdline_p)
 	paravirt_pagetable_setup_start(swapper_pg_dir);
 	paging_init();
 	paravirt_pagetable_setup_done(swapper_pg_dir);
+	paravirt_post_allocator_init();
 
 #ifdef CONFIG_X86_64
 	map_vsyscall();
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 4d7c9d4..0d11673 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -869,8 +869,6 @@ void __init paging_init(void)
 	 */
 	sparse_init();
 	zone_sizes_init();
-
-	paravirt_post_allocator_init();
 }
 
 /*
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index ff0aa74..ebd6900 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -656,9 +656,11 @@ void xen_mm_pin_all(void)
 	spin_unlock_irqrestore(&pgd_lock, flags);
 }
 
-/* The init_mm pagetable is really pinned as soon as its created, but
-   that's before we have page structures to store the bits.  So do all
-   the book-keeping now. */
+/*
+ * The init_mm pagetable is really pinned as soon as its created, but
+ * that's before we have page structures to store the bits.  So do all
+ * the book-keeping now.
+ */
 static __init int mark_pinned(struct page *page, enum pt_level level)
 {
 	SetPagePinned(page);
-- 
1.5.4.1


linux-2.6-xen-0013-x86_64-there-s-no-need-to-preallocate-level1_fixmap.patch:

--- NEW FILE linux-2.6-xen-0013-x86_64-there-s-no-need-to-preallocate-level1_fixmap.patch ---
>From a2f5b35704e79fa3ec3685778349d0d20e0c7a18 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:25 -0700
Subject: [PATCH] x86_64: there's no need to preallocate level1_fixmap_pgt

Early fixmap will allocate its own L1 pagetable page for fixmap
mappings, so there's no need to preallocate one.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/head_64.S |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index b07ac7b..4b6bda2 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -362,12 +362,6 @@ NEXT_PAGE(level3_kernel_pgt)
 	.quad	level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
 
 NEXT_PAGE(level2_fixmap_pgt)
-	.fill	506,8,0
-	.quad	level1_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
-	/* 8MB reserved for vsyscalls + a 2MB hole = 4 + 1 entries */
-	.fill	5,8,0
-
-NEXT_PAGE(level1_fixmap_pgt)
 	.fill	512,8,0
 
 NEXT_PAGE(level2_ident_pgt)
-- 
1.5.4.1


linux-2.6-xen-0014-x86-clean-up-formatting-of-__switch_to.patch:

--- NEW FILE linux-2.6-xen-0014-x86-clean-up-formatting-of-__switch_to.patch ---
>From ab4defb35a96931fc4156438b55d6ed40a29d2ab Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:26 -0700
Subject: [PATCH] x86: clean up formatting of __switch_to

process_64.c:__switch_to has some very old strange formatting, some of
it dating back to pre-git.  Fix it up.

No functional changes.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/process_64.c |   56 +++++++++++++++++++++---------------------
 1 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index a8e5362..e8a8e1b 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -537,8 +537,8 @@ static inline void __switch_to_xtra(struct task_struct *prev_p,
 struct task_struct *
 __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 {
-	struct thread_struct *prev = &prev_p->thread,
-				 *next = &next_p->thread;
+	struct thread_struct *prev = &prev_p->thread;
+	struct thread_struct *next = &next_p->thread;
 	int cpu = smp_processor_id();
 	struct tss_struct *tss = &per_cpu(init_tss, cpu);
 	unsigned fsindex, gsindex;
@@ -586,35 +586,34 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 
 	/* 
 	 * Switch FS and GS.
+	 *
+	 * Segment register != 0 always requires a reload.  Also
+	 * reload when it has changed.  When prev process used 64bit
+	 * base always reload to avoid an information leak.
 	 */
-	{ 
-		/* segment register != 0 always requires a reload. 
-		   also reload when it has changed. 
-		   when prev process used 64bit base always reload
-		   to avoid an information leak. */
-		if (unlikely(fsindex | next->fsindex | prev->fs)) {
-			loadsegment(fs, next->fsindex);
-			/* check if the user used a selector != 0
-	                 * if yes clear 64bit base, since overloaded base
-                         * is always mapped to the Null selector
-                         */
-			if (fsindex)
+	if (unlikely(fsindex | next->fsindex | prev->fs)) {
+		loadsegment(fs, next->fsindex);
+		/* 
+		 * Check if the user used a selector != 0; if yes
+		 *  clear 64bit base, since overloaded base is always
+		 *  mapped to the Null selector
+		 */
+		if (fsindex)
 			prev->fs = 0;				
-		}
-		/* when next process has a 64bit base use it */
-		if (next->fs) 
-			wrmsrl(MSR_FS_BASE, next->fs); 
-		prev->fsindex = fsindex;
-
-		if (unlikely(gsindex | next->gsindex | prev->gs)) {
-			load_gs_index(next->gsindex);
-			if (gsindex)
+	}
+	/* when next process has a 64bit base use it */
+	if (next->fs)
+		wrmsrl(MSR_FS_BASE, next->fs);
+	prev->fsindex = fsindex;
+
+	if (unlikely(gsindex | next->gsindex | prev->gs)) {
+		load_gs_index(next->gsindex);
+		if (gsindex)
 			prev->gs = 0;				
-		}
-		if (next->gs)
-			wrmsrl(MSR_KERNEL_GS_BASE, next->gs); 
-		prev->gsindex = gsindex;
 	}
+	if (next->gs)
+		wrmsrl(MSR_KERNEL_GS_BASE, next->gs);
+	prev->gsindex = gsindex;
 
 	/* Must be after DS reload */
 	unlazy_fpu(prev_p);
@@ -627,7 +626,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 	write_pda(pcurrent, next_p); 
 
 	write_pda(kernelstack,
-	(unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
+		  (unsigned long)task_stack_page(next_p) +
+		  THREAD_SIZE - PDA_STACKOFFSET);
 #ifdef CONFIG_CC_STACKPROTECTOR
 	write_pda(stack_canary, next_p->stack_canary);
 	/*
-- 
1.5.4.1


linux-2.6-xen-0015-x86-use-__page_aligned_data-bss.patch:

--- NEW FILE linux-2.6-xen-0015-x86-use-__page_aligned_data-bss.patch ---
>From 3378e3b65c8240d0e82d61a07ed3fa6af1f74d80 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:27 -0700
Subject: [PATCH] x86: use __page_aligned_data/bss

Update arch/x86's use of page-aligned variables.  The change to
arch/x86/xen/mmu.c fixes an actual bug, but the rest are cleanups
and to set a precedent.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/cpu/common_64.c |    4 ++--
 arch/x86/kernel/irq_32.c        |    7 ++-----
 arch/x86/xen/mmu.c              |   15 ++++++---------
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c
index 7b8cc72..15419cd 100644
--- a/arch/x86/kernel/cpu/common_64.c
+++ b/arch/x86/kernel/cpu/common_64.c
@@ -16,6 +16,7 @@
 #include <asm/i387.h>
 #include <asm/msr.h>
 #include <asm/io.h>
+#include <asm/linkage.h>
 #include <asm/mmu_context.h>
 #include <asm/mtrr.h>
 #include <asm/mce.h>
@@ -517,8 +518,7 @@ void pda_init(int cpu)
 }
 
 char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ +
-			   DEBUG_STKSZ]
-__attribute__((section(".bss.page_aligned")));
+			   DEBUG_STKSZ] __page_aligned_bss;
 
 extern asmlinkage void ignore_sysret(void);
 
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 47a6f6f..1cf8c1f 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -83,11 +83,8 @@ union irq_ctx {
 static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
 static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
 
-static char softirq_stack[NR_CPUS * THREAD_SIZE]
-		__attribute__((__section__(".bss.page_aligned")));
-
-static char hardirq_stack[NR_CPUS * THREAD_SIZE]
-		__attribute__((__section__(".bss.page_aligned")));
+static char softirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
+static char hardirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss;
 
 static void call_on_stack(void *func, void *stack)
 {
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index ebd6900..4fca9d8 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -46,6 +46,7 @@
 #include <asm/tlbflush.h>
 #include <asm/mmu_context.h>
 #include <asm/paravirt.h>
+#include <asm/linkage.h>
 
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
@@ -60,22 +61,18 @@
 #define TOP_ENTRIES		(MAX_DOMAIN_PAGES / P2M_ENTRIES_PER_PAGE)
 
 /* Placeholder for holes in the address space */
-static unsigned long p2m_missing[P2M_ENTRIES_PER_PAGE]
-	__attribute__((section(".data.page_aligned"))) =
+static unsigned long p2m_missing[P2M_ENTRIES_PER_PAGE] __page_aligned_data =
 		{ [ 0 ... P2M_ENTRIES_PER_PAGE-1 ] = ~0UL };
 
  /* Array of pointers to pages containing p2m entries */
-static unsigned long *p2m_top[TOP_ENTRIES]
-	__attribute__((section(".data.page_aligned"))) =
+static unsigned long *p2m_top[TOP_ENTRIES] __page_aligned_data =
 		{ [ 0 ... TOP_ENTRIES - 1] = &p2m_missing[0] };
 
 /* Arrays of p2m arrays expressed in mfns used for save/restore */
-static unsigned long p2m_top_mfn[TOP_ENTRIES]
-	__attribute__((section(".bss.page_aligned")));
+static unsigned long p2m_top_mfn[TOP_ENTRIES] __page_aligned_bss;
 
-static unsigned long p2m_top_mfn_list[
-			PAGE_ALIGN(TOP_ENTRIES / P2M_ENTRIES_PER_PAGE)]
-	__attribute__((section(".bss.page_aligned")));
+static unsigned long p2m_top_mfn_list[TOP_ENTRIES / P2M_ENTRIES_PER_PAGE]
+	__page_aligned_bss;
 
 static inline unsigned p2m_top_index(unsigned long pfn)
 {
-- 
1.5.4.1


linux-2.6-xen-0016-x86_64-adjust-exception-frame-in-ia32entry.patch:

--- NEW FILE linux-2.6-xen-0016-x86_64-adjust-exception-frame-in-ia32entry.patch ---
>From 0b9a90061ba6a60f66e17c62b34a4c9d45144dfe Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:28 -0700
Subject: [PATCH] x86_64: adjust exception frame in ia32entry

The 32-bit compat int $0x80 entrypoint needs exception frame
adjustment.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/ia32/ia32entry.S |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 20371d0..0ae1e77 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -321,6 +321,7 @@ ENTRY(ia32_syscall)
 	/*CFI_REL_OFFSET	rflags,EFLAGS-RIP*/
 	/*CFI_REL_OFFSET	cs,CS-RIP*/
 	CFI_REL_OFFSET	rip,RIP-RIP
+	PARAVIRT_ADJUST_EXCEPTION_FRAME
 	SWAPGS
 	/*
 	 * No need to follow this irqs on/off section: the syscall
-- 
1.5.4.1


linux-2.6-xen-0017-x86_64-unstatic-get_local_pda.patch:

--- NEW FILE linux-2.6-xen-0017-x86_64-unstatic-get_local_pda.patch ---
>From 687ae3fc13cf31fec79cd5250a1c458a082f5066 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:29 -0700
Subject: [PATCH] x86_64: unstatic get_local_pda

This allows Xen's xen_cpu_up() to allocate a pda for the new CPU.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/smpboot.c |    2 +-
 include/asm-x86/smp.h     |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 687376a..1deb3b6 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -768,7 +768,7 @@ static void __cpuinit do_fork_idle(struct work_struct *work)
  *
  * Must be called after the _cpu_pda pointer table is initialized.
  */
-static int __cpuinit get_local_pda(int cpu)
+int __cpuinit get_local_pda(int cpu)
 {
 	struct x8664_pda *oldpda, *newpda;
 	unsigned long size = sizeof(struct x8664_pda);
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
index c2784b3..3c877f7 100644
--- a/include/asm-x86/smp.h
+++ b/include/asm-x86/smp.h
@@ -25,6 +25,8 @@ extern cpumask_t cpu_callin_map;
 extern void (*mtrr_hook)(void);
 extern void zap_low_mappings(void);
 
+extern int __cpuinit get_local_pda(int cpu);
+
 extern int smp_num_siblings;
 extern unsigned int num_processors;
 extern cpumask_t cpu_initialized;
-- 
1.5.4.1


linux-2.6-xen-0018-xen-print-backtrace-on-multicall-failure.patch:

--- NEW FILE linux-2.6-xen-0018-xen-print-backtrace-on-multicall-failure.patch ---
>From 0cd83638bb107ddba32d28589363e66037753cf7 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:30 -0700
Subject: [PATCH] xen: print backtrace on multicall failure

Print a backtrace if a multicall fails, to help with debugging.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/multicalls.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c
index 3c63c4d..9efd1c6 100644
--- a/arch/x86/xen/multicalls.c
+++ b/arch/x86/xen/multicalls.c
@@ -76,6 +76,7 @@ void xen_mc_flush(void)
 		if (ret) {
 			printk(KERN_ERR "%d multicall(s) failed: cpu %d\n",
 			       ret, smp_processor_id());
+			dump_stack();
 			for (i = 0; i < b->mcidx; i++) {
 				printk("  call %2d/%d: op=%lu arg=[%lx] result=%ld\n",
 				       i+1, b->mcidx,
-- 
1.5.4.1


linux-2.6-xen-0019-xen-netfront-fix-xennet_release_tx_bufs.patch:

--- NEW FILE linux-2.6-xen-0019-xen-netfront-fix-xennet_release_tx_bufs.patch ---
>From dd40cb3cab348c376b7dd56f2b596a7ae2fe0c6a Mon Sep 17 00:00:00 2001
From: Isaku Yamahata <yamahata at valinux.co.jp>
Date: Tue, 8 Jul 2008 15:06:31 -0700
Subject: [PATCH] xen-netfront: fix xennet_release_tx_bufs()

After restore on ia64 xen domain, kernel panics as follows.
This patch fixes it.

union skb_entry assumes sizeof(link->skb, pointer) ==
sizeof(list->link, unsigned).
However this isn't true on ia64. So  make link type unsigned long.
And introduced two accesor.

kernel unaligned access to 0xe0000000000000bd, ip=0xa0000001004c2ca0
xenwatch[14]: error during unaligned kernel access
 -1 [1]
Modules linked in:

Pid: 14, CPU 0, comm:             xenwatch
psr : 0000101008422010 ifs : 8000000000000307 ip  : [<a0000001004c2ca0>]    Not tainted (2.6.26-rc4xen-ia64-dirty)
ip is at dev_kfree_skb_irq+0x20/0x1a0
unat: 0000000000000000 pfs : 400000000000040b rsc : 0000000000000007
rnat: 0000000000000000 bsps: 0000000000000000 pr  : 000000000000a941
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70433f
csd : 0000000000000000 ssd : 0000000000000000
b0  : a0000001003efb70 b6  : a000000100070e40 b7  : a000000100070e40
f6  : 1003e000000fcb75352b1 f7  : 1003e000000000014ff97
f8  : 1003e00fcb74fc3454d80 f9  : 1003e0000000080000000
f10 : 1003e0000000000001431 f11 : 1003e0000000000989680
r1  : a000000100bfcf80 r2  : e0000000000000bd r3  : 000000000000308c
r8  : 0000000000000000 r9  : e00000000fc31310 r10 : a000000100a13b28
r11 : 0000000000000000 r12 : e00000000fd0fdf0 r13 : e00000000fd08000
r14 : 0000000000000000 r15 : e00000000fcc8000 r16 : 0000000000000009
r17 : e000010000104000 r18 : e000010000104000 r19 : a000000100a13b40
r20 : a0000001009c23f0 r21 : a0000001009fd4d0 r22 : 0000000000004000
r23 : 0000000000000000 r24 : fffffffffff04c10 r25 : 0000000000000002
r26 : 0000000000000000 r27 : 0000000000000000 r28 : e00000000fd08bd4
r29 : a0000001007570b8 r30 : a0000001009e5500 r31 : a0000001009e54a0

Call Trace:
 [<a000000100026000>] show_stack+0x40/0xa0
                                sp=e00000000fd0f670 bsp=e00000000fd08f68
 [<a000000100026a60>] show_regs+0x9a0/0x9e0
                                sp=e00000000fd0f840 bsp=e00000000fd08f10
 [<a000000100037680>] die+0x260/0x3a0
                                sp=e00000000fd0f840 bsp=e00000000fd08ec8
 [<a000000100037810>] die_if_kernel+0x50/0x80
                                sp=e00000000fd0f840 bsp=e00000000fd08e98
 [<a00000010003eb40>] ia64_handle_unaligned+0x2ea0/0x2fc0
                                sp=e00000000fd0f840 bsp=e00000000fd08df0
 [<a00000010001ca30>] ia64_prepare_handle_unaligned+0x30/0x60
                                sp=e00000000fd0fa10 bsp=e00000000fd08df0
 [<a00000010005d100>] paravirt_leave_kernel+0x0/0x40
                                sp=e00000000fd0fc20 bsp=e00000000fd08df0
 [<a0000001004c2ca0>] dev_kfree_skb_irq+0x20/0x1a0
                                sp=e00000000fd0fdf0 bsp=e00000000fd08db8
 [<a0000001003efb70>] xennet_release_tx_bufs+0xd0/0x120
                                sp=e00000000fd0fdf0 bsp=e00000000fd08d78
 [<a0000001003f14c0>] backend_changed+0xc40/0xf80
                                sp=e00000000fd0fdf0 bsp=e00000000fd08d08
 [<a00000010034bd50>] otherend_changed+0x190/0x1c0
                                sp=e00000000fd0fe00 bsp=e00000000fd08cc8
 [<a000000100349530>] xenwatch_thread+0x310/0x3c0
                                sp=e00000000fd0fe00 bsp=e00000000fd08ca0
 [<a0000001000cb040>] kthread+0xe0/0x160
                                sp=e00000000fd0fe30 bsp=e00000000fd08c68
 [<a000000100024450>] kernel_thread_helper+0x30/0x60
                                sp=e00000000fd0fe30 bsp=e00000000fd08c40
 [<a00000010001a8a0>] start_kernel_thread+0x20/0x40
                                sp=e00000000fd0fe30 bsp=e00000000fd08c40
Kernel panic - not syncing: Aiee, killing interrupt handler!

Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 drivers/net/xen-netfront.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index ef671d1..902bbe7 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -92,7 +92,7 @@ struct netfront_info {
 	 */
 	union skb_entry {
 		struct sk_buff *skb;
-		unsigned link;
+		unsigned long link;
 	} tx_skbs[NET_TX_RING_SIZE];
 	grant_ref_t gref_tx_head;
 	grant_ref_t grant_tx_ref[NET_TX_RING_SIZE];
@@ -125,6 +125,17 @@ struct netfront_rx_info {
 	struct xen_netif_extra_info extras[XEN_NETIF_EXTRA_TYPE_MAX - 1];
 };
 
+static void skb_entry_set_link(union skb_entry *list, unsigned short id)
+{
+	list->link = id;
+}
+
+static int skb_entry_is_link(const union skb_entry *list)
+{
+	BUILD_BUG_ON(sizeof(list->skb) != sizeof(list->link));
+	return ((unsigned long)list->skb < PAGE_OFFSET);
+}
+
 /*
  * Access macros for acquiring freeing slots in tx_skbs[].
  */
@@ -132,7 +143,7 @@ struct netfront_rx_info {
 static void add_id_to_freelist(unsigned *head, union skb_entry *list,
 			       unsigned short id)
 {
-	list[id].link = *head;
+	skb_entry_set_link(&list[id], *head);
 	*head = id;
 }
 
@@ -993,7 +1004,7 @@ static void xennet_release_tx_bufs(struct netfront_info *np)
 
 	for (i = 0; i < NET_TX_RING_SIZE; i++) {
 		/* Skip over entries which are actually freelist references */
-		if ((unsigned long)np->tx_skbs[i].skb < PAGE_OFFSET)
+		if (skb_entry_is_link(&np->tx_skbs[i]))
 			continue;
 
 		skb = np->tx_skbs[i].skb;
@@ -1123,7 +1134,7 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev
 	/* Initialise tx_skbs as a free chain containing every entry. */
 	np->tx_skb_freelist = 0;
 	for (i = 0; i < NET_TX_RING_SIZE; i++) {
-		np->tx_skbs[i].link = i+1;
+		skb_entry_set_link(&np->tx_skbs[i], i+1);
 		np->grant_tx_ref[i] = GRANT_INVALID_REF;
 	}
 
-- 
1.5.4.1


linux-2.6-xen-0020-xen-add-xen_arch_resume-xen_timer_resume-hook-for.patch:

--- NEW FILE linux-2.6-xen-0020-xen-add-xen_arch_resume-xen_timer_resume-hook-for.patch ---
>From 55db5c99dcf923bd85f026c63f9659e969e42ec5 Mon Sep 17 00:00:00 2001
From: Isaku Yamahata <yamahata at valinux.co.jp>
Date: Tue, 8 Jul 2008 15:06:32 -0700
Subject: [PATCH] xen: add xen_arch_resume()/xen_timer_resume hook for ia64 support

add xen_timer_resume() hook.

Timer resume should be done after event channel is resumed.
add xen_arch_resume() hook when ipi becomes usable after resume.
After resume, some cpu specific resource must be reinitialized
on ia64 that can't be set by another cpu.

However available hooks is run once on only one cpu so that ipi has
to be used.

During stop_machine_run() ipi can't be used because interrupt is masked.
So add another hook after stop_machine_run().
Another approach might be use resume hook which is run by
device_resume(). However device_resume() may be executed on
suspend error recovery path.

So it is necessary to determine whether it is executed on real resume path
or error recovery path.

Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/suspend.c |    5 ++++-
 arch/x86/xen/xen-ops.h |    1 -
 drivers/xen/manage.c   |    6 ++++--
 include/xen/xen-ops.h  |    3 +++
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 251669a..2a234db 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -38,8 +38,11 @@ void xen_post_suspend(int suspend_cancelled)
 		xen_cpu_initialized_map = cpu_online_map;
 #endif
 		xen_vcpu_restore();
-		xen_timer_resume();
 	}
 
 }
 
+void xen_arch_resume(void)
+{
+	/* nothing */
+}
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 6f4b104..77354d2 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -37,7 +37,6 @@ void __init xen_time_init(void);
 unsigned long xen_get_wallclock(void);
 int xen_set_wallclock(unsigned long time);
 unsigned long long xen_sched_clock(void);
-void xen_timer_resume(void);
 
 irqreturn_t xen_debug_interrupt(int irq, void *dev_id);
 
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 5b546e3..2bb268e 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -68,6 +68,7 @@ static int xen_suspend(void *data)
 	if (!*cancelled) {
 		xen_irq_resume();
 		xen_console_resume();
+		xen_timer_resume();
 	}
 
 	return 0;
@@ -107,9 +108,10 @@ static void do_suspend(void)
 		goto out;
 	}
 
-	if (!cancelled)
+	if (!cancelled) {
+		xen_arch_resume();
 		xenbus_resume();
-	else
+	} else
 		xenbus_suspend_cancel();
 
 	device_resume();
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index a706d6a..883a21b 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -11,4 +11,7 @@ void xen_post_suspend(int suspend_cancelled);
 void xen_mm_pin_all(void);
 void xen_mm_unpin_all(void);
 
+void xen_timer_resume(void);
+void xen_arch_resume(void);
+
 #endif /* INCLUDE_XEN_OPS_H */
-- 
1.5.4.1


linux-2.6-xen-0021-xen-define-set_pte-from-the-outset.patch:

--- NEW FILE linux-2.6-xen-0021-xen-define-set_pte-from-the-outset.patch ---
>From f4a5a9cceb80a825b75955ee148c2013696fdc26 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:33 -0700
Subject: [PATCH] xen: define set_pte from the outset

We need set_pte to work from a relatively early point, so enable it
from the start.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 1731ff5..9f07d2f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -863,9 +863,6 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
 	pgd_t *xen_pgd = (pgd_t *)xen_start_info->pt_base;
 	int i;
 
-	/* special set_pte for pagetable initialization */
-	pv_mmu_ops.set_pte = xen_set_pte_init;
-
 	init_mm.pgd = base;
 	/*
 	 * copy top-level of Xen-supplied pagetable into place.  This
@@ -1195,7 +1192,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 	.kmap_atomic_pte = xen_kmap_atomic_pte,
 #endif
 
-	.set_pte = NULL,	/* see xen_pagetable_setup_* */
+	.set_pte = xen_set_pte_init,
 	.set_pte_at = xen_set_pte_at,
 	.set_pmd = xen_set_pmd_hyper,
 
-- 
1.5.4.1


linux-2.6-xen-0022-xen64-define-asm-xen-interface-for-64-bit.patch:

--- NEW FILE linux-2.6-xen-0022-xen64-define-asm-xen-interface-for-64-bit.patch ---
>From 700f3081c0396a55c79f3420fbeae868448a00ea Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:34 -0700
Subject: [PATCH] xen64: define asm/xen/interface for 64-bit

Copy 64-bit definitions of various interface structures into place.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/mmu.h                 |   12 ---
 include/asm-x86/xen/interface.h    |  139 +++++++++++--------------------
 include/asm-x86/xen/interface_32.h |   97 ++++++++++++++++++++++
 include/asm-x86/xen/interface_64.h |  159 ++++++++++++++++++++++++++++++++++++
 include/xen/interface/callback.h   |    6 +-
 5 files changed, 308 insertions(+), 105 deletions(-)
 create mode 100644 include/asm-x86/xen/interface_32.h
 create mode 100644 include/asm-x86/xen/interface_64.h

diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index 297bf9f..7856e37 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -10,18 +10,6 @@ enum pt_level {
 	PT_PTE
 };
 
-/*
- * Page-directory addresses above 4GB do not fit into architectural %cr3.
- * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
- * must use the following accessor macros to pack/unpack valid MFNs.
- *
- * Note that Xen is using the fact that the pagetable base is always
- * page-aligned, and putting the 12 MSB of the address into the 12 LSB
- * of cr3.
- */
-#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
-#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
-
 
 void set_pte_mfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
 
diff --git a/include/asm-x86/xen/interface.h b/include/asm-x86/xen/interface.h
index 6227000..9d810f2 100644
--- a/include/asm-x86/xen/interface.h
+++ b/include/asm-x86/xen/interface.h
@@ -1,13 +1,13 @@
 /******************************************************************************
  * arch-x86_32.h
  *
- * Guest OS interface to x86 32-bit Xen.
+ * Guest OS interface to x86 Xen.
  *
  * Copyright (c) 2004, K A Fraser
  */
 
-#ifndef __XEN_PUBLIC_ARCH_X86_32_H__
-#define __XEN_PUBLIC_ARCH_X86_32_H__
+#ifndef __ASM_X86_XEN_INTERFACE_H
+#define __ASM_X86_XEN_INTERFACE_H
 
 #ifdef __XEN__
 #define __DEFINE_GUEST_HANDLE(name, type) \
@@ -57,6 +57,17 @@ DEFINE_GUEST_HANDLE(long);
 DEFINE_GUEST_HANDLE(void);
 #endif
 
+#ifndef HYPERVISOR_VIRT_START
+#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
+#endif
+
+#ifndef machine_to_phys_mapping
+#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
+#endif
+
+/* Maximum number of virtual CPUs in multi-processor guests. */
+#define MAX_VIRT_CPUS 32
+
 /*
  * SEGMENT DESCRIPTOR TABLES
  */
@@ -71,58 +82,21 @@ DEFINE_GUEST_HANDLE(void);
 #define FIRST_RESERVED_GDT_ENTRY (FIRST_RESERVED_GDT_BYTE / 8)
 
 /*
- * These flat segments are in the Xen-private section of every GDT. Since these
- * are also present in the initial GDT, many OSes will be able to avoid
- * installing their own GDT.
- */
-#define FLAT_RING1_CS 0xe019    /* GDT index 259 */
-#define FLAT_RING1_DS 0xe021    /* GDT index 260 */
-#define FLAT_RING1_SS 0xe021    /* GDT index 260 */
-#define FLAT_RING3_CS 0xe02b    /* GDT index 261 */
-#define FLAT_RING3_DS 0xe033    /* GDT index 262 */
-#define FLAT_RING3_SS 0xe033    /* GDT index 262 */
-
-#define FLAT_KERNEL_CS FLAT_RING1_CS
-#define FLAT_KERNEL_DS FLAT_RING1_DS
-#define FLAT_KERNEL_SS FLAT_RING1_SS
-#define FLAT_USER_CS    FLAT_RING3_CS
-#define FLAT_USER_DS    FLAT_RING3_DS
-#define FLAT_USER_SS    FLAT_RING3_SS
-
-/* And the trap vector is... */
-#define TRAP_INSTR "int $0x82"
-
-/*
- * Virtual addresses beyond this are not modifiable by guest OSes. The
- * machine->physical mapping table starts at this address, read-only.
- */
-#ifdef CONFIG_X86_PAE
-#define __HYPERVISOR_VIRT_START 0xF5800000
-#else
-#define __HYPERVISOR_VIRT_START 0xFC000000
-#endif
-
-#ifndef HYPERVISOR_VIRT_START
-#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
-#endif
-
-#ifndef machine_to_phys_mapping
-#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
-#endif
-
-/* Maximum number of virtual CPUs in multi-processor guests. */
-#define MAX_VIRT_CPUS 32
-
-#ifndef __ASSEMBLY__
-
-/*
  * Send an array of these to HYPERVISOR_set_trap_table()
+ * The privilege level specifies which modes may enter a trap via a software
+ * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
+ * privilege levels as follows:
+ *  Level == 0: Noone may enter
+ *  Level == 1: Kernel may enter
+ *  Level == 2: Kernel may enter
+ *  Level == 3: Everyone may enter
  */
 #define TI_GET_DPL(_ti)		((_ti)->flags & 3)
 #define TI_GET_IF(_ti)		((_ti)->flags & 4)
 #define TI_SET_DPL(_ti, _dpl)	((_ti)->flags |= (_dpl))
 #define TI_SET_IF(_ti, _if)	((_ti)->flags |= ((!!(_if))<<2))
 
+#ifndef __ASSEMBLY__
 struct trap_info {
     uint8_t       vector;  /* exception vector                              */
     uint8_t       flags;   /* 0-3: privilege level; 4: clear event enable?  */
@@ -131,32 +105,21 @@ struct trap_info {
 };
 DEFINE_GUEST_HANDLE_STRUCT(trap_info);
 
-struct cpu_user_regs {
-    uint32_t ebx;
-    uint32_t ecx;
-    uint32_t edx;
-    uint32_t esi;
-    uint32_t edi;
-    uint32_t ebp;
-    uint32_t eax;
-    uint16_t error_code;    /* private */
-    uint16_t entry_vector;  /* private */
-    uint32_t eip;
-    uint16_t cs;
-    uint8_t  saved_upcall_mask;
-    uint8_t  _pad0;
-    uint32_t eflags;        /* eflags.IF == !saved_upcall_mask */
-    uint32_t esp;
-    uint16_t ss, _pad1;
-    uint16_t es, _pad2;
-    uint16_t ds, _pad3;
-    uint16_t fs, _pad4;
-    uint16_t gs, _pad5;
+struct arch_shared_info {
+    unsigned long max_pfn;                  /* max pfn that appears in table */
+    /* Frame containing list of mfns containing list of mfns containing p2m. */
+    unsigned long pfn_to_mfn_frame_list_list;
+    unsigned long nmi_reason;
 };
-DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
+#endif	/* !__ASSEMBLY__ */
 
-typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
+#ifdef CONFIG_X86_32
+#include "interface_32.h"
+#else
+#include "interface_64.h"
+#endif
 
+#ifndef __ASSEMBLY__
 /*
  * The following is all CPU context. Note that the fpu_ctxt block is filled
  * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
@@ -173,33 +136,29 @@ struct vcpu_guest_context {
     unsigned long ldt_base, ldt_ents;       /* LDT (linear address, # ents) */
     unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
     unsigned long kernel_ss, kernel_sp;     /* Virtual TSS (only SS1/SP1)   */
+    /* NB. User pagetable on x86/64 is placed in ctrlreg[1]. */
     unsigned long ctrlreg[8];               /* CR0-CR7 (control registers)  */
     unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
+#ifdef __i386__
     unsigned long event_callback_cs;        /* CS:EIP of event callback     */
     unsigned long event_callback_eip;
     unsigned long failsafe_callback_cs;     /* CS:EIP of failsafe callback  */
     unsigned long failsafe_callback_eip;
+#else
+    unsigned long event_callback_eip;
+    unsigned long failsafe_callback_eip;
+    unsigned long syscall_callback_eip;
+#endif
     unsigned long vm_assist;                /* VMASST_TYPE_* bitmap */
+#ifdef __x86_64__
+    /* Segment base addresses. */
+    uint64_t      fs_base;
+    uint64_t      gs_base_kernel;
+    uint64_t      gs_base_user;
+#endif
 };
 DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context);
-
-struct arch_shared_info {
-    unsigned long max_pfn;                  /* max pfn that appears in table */
-    /* Frame containing list of mfns containing list of mfns containing p2m. */
-    unsigned long pfn_to_mfn_frame_list_list;
-    unsigned long nmi_reason;
-};
-
-struct arch_vcpu_info {
-    unsigned long cr2;
-    unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */
-};
-
-struct xen_callback {
-	unsigned long cs;
-	unsigned long eip;
-};
-#endif /* !__ASSEMBLY__ */
+#endif	/* !__ASSEMBLY__ */
 
 /*
  * Prefix forces emulation of some non-trapping instructions.
@@ -213,4 +172,4 @@ struct xen_callback {
 #define XEN_CPUID          XEN_EMULATE_PREFIX "cpuid"
 #endif
 
-#endif
+#endif	/* __ASM_X86_XEN_INTERFACE_H */
diff --git a/include/asm-x86/xen/interface_32.h b/include/asm-x86/xen/interface_32.h
new file mode 100644
index 0000000..d8ac41d
--- /dev/null
+++ b/include/asm-x86/xen/interface_32.h
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * arch-x86_32.h
+ *
+ * Guest OS interface to x86 32-bit Xen.
+ *
+ * Copyright (c) 2004, K A Fraser
+ */
+
+#ifndef __ASM_X86_XEN_INTERFACE_32_H
+#define __ASM_X86_XEN_INTERFACE_32_H
+
+
+/*
+ * These flat segments are in the Xen-private section of every GDT. Since these
+ * are also present in the initial GDT, many OSes will be able to avoid
+ * installing their own GDT.
+ */
+#define FLAT_RING1_CS 0xe019    /* GDT index 259 */
+#define FLAT_RING1_DS 0xe021    /* GDT index 260 */
+#define FLAT_RING1_SS 0xe021    /* GDT index 260 */
+#define FLAT_RING3_CS 0xe02b    /* GDT index 261 */
+#define FLAT_RING3_DS 0xe033    /* GDT index 262 */
+#define FLAT_RING3_SS 0xe033    /* GDT index 262 */
+
+#define FLAT_KERNEL_CS FLAT_RING1_CS
+#define FLAT_KERNEL_DS FLAT_RING1_DS
+#define FLAT_KERNEL_SS FLAT_RING1_SS
+#define FLAT_USER_CS    FLAT_RING3_CS
+#define FLAT_USER_DS    FLAT_RING3_DS
+#define FLAT_USER_SS    FLAT_RING3_SS
+
+/* And the trap vector is... */
+#define TRAP_INSTR "int $0x82"
+
+/*
+ * Virtual addresses beyond this are not modifiable by guest OSes. The
+ * machine->physical mapping table starts at this address, read-only.
+ */
+#define __HYPERVISOR_VIRT_START 0xF5800000
+
+#ifndef __ASSEMBLY__
+
+struct cpu_user_regs {
+    uint32_t ebx;
+    uint32_t ecx;
+    uint32_t edx;
+    uint32_t esi;
+    uint32_t edi;
+    uint32_t ebp;
+    uint32_t eax;
+    uint16_t error_code;    /* private */
+    uint16_t entry_vector;  /* private */
+    uint32_t eip;
+    uint16_t cs;
+    uint8_t  saved_upcall_mask;
+    uint8_t  _pad0;
+    uint32_t eflags;        /* eflags.IF == !saved_upcall_mask */
+    uint32_t esp;
+    uint16_t ss, _pad1;
+    uint16_t es, _pad2;
+    uint16_t ds, _pad3;
+    uint16_t fs, _pad4;
+    uint16_t gs, _pad5;
+};
+DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
+
+typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
+
+struct arch_vcpu_info {
+    unsigned long cr2;
+    unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */
+};
+
+struct xen_callback {
+	unsigned long cs;
+	unsigned long eip;
+};
+typedef struct xen_callback xen_callback_t;
+
+#define XEN_CALLBACK(__cs, __eip)				\
+	((struct xen_callback){ .cs = (__cs), .eip = (unsigned long)(__eip) })
+#endif /* !__ASSEMBLY__ */
+
+
+/*
+ * Page-directory addresses above 4GB do not fit into architectural %cr3.
+ * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
+ * must use the following accessor macros to pack/unpack valid MFNs.
+ *
+ * Note that Xen is using the fact that the pagetable base is always
+ * page-aligned, and putting the 12 MSB of the address into the 12 LSB
+ * of cr3.
+ */
+#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
+#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
+
+#endif	/* __ASM_X86_XEN_INTERFACE_32_H */
diff --git a/include/asm-x86/xen/interface_64.h b/include/asm-x86/xen/interface_64.h
new file mode 100644
index 0000000..842266c
--- /dev/null
+++ b/include/asm-x86/xen/interface_64.h
@@ -0,0 +1,159 @@
+#ifndef __ASM_X86_XEN_INTERFACE_64_H
+#define __ASM_X86_XEN_INTERFACE_64_H
+
+/*
+ * 64-bit segment selectors
+ * These flat segments are in the Xen-private section of every GDT. Since these
+ * are also present in the initial GDT, many OSes will be able to avoid
+ * installing their own GDT.
+ */
+
+#define FLAT_RING3_CS32 0xe023  /* GDT index 260 */
+#define FLAT_RING3_CS64 0xe033  /* GDT index 261 */
+#define FLAT_RING3_DS32 0xe02b  /* GDT index 262 */
+#define FLAT_RING3_DS64 0x0000  /* NULL selector */
+#define FLAT_RING3_SS32 0xe02b  /* GDT index 262 */
+#define FLAT_RING3_SS64 0xe02b  /* GDT index 262 */
+
+#define FLAT_KERNEL_DS64 FLAT_RING3_DS64
+#define FLAT_KERNEL_DS32 FLAT_RING3_DS32
+#define FLAT_KERNEL_DS   FLAT_KERNEL_DS64
+#define FLAT_KERNEL_CS64 FLAT_RING3_CS64
+#define FLAT_KERNEL_CS32 FLAT_RING3_CS32
+#define FLAT_KERNEL_CS   FLAT_KERNEL_CS64
+#define FLAT_KERNEL_SS64 FLAT_RING3_SS64
+#define FLAT_KERNEL_SS32 FLAT_RING3_SS32
+#define FLAT_KERNEL_SS   FLAT_KERNEL_SS64
+
+#define FLAT_USER_DS64 FLAT_RING3_DS64
+#define FLAT_USER_DS32 FLAT_RING3_DS32
+#define FLAT_USER_DS   FLAT_USER_DS64
+#define FLAT_USER_CS64 FLAT_RING3_CS64
+#define FLAT_USER_CS32 FLAT_RING3_CS32
+#define FLAT_USER_CS   FLAT_USER_CS64
+#define FLAT_USER_SS64 FLAT_RING3_SS64
+#define FLAT_USER_SS32 FLAT_RING3_SS32
+#define FLAT_USER_SS   FLAT_USER_SS64
+
+#define __HYPERVISOR_VIRT_START 0xFFFF800000000000
+#define __HYPERVISOR_VIRT_END   0xFFFF880000000000
+#define __MACH2PHYS_VIRT_START  0xFFFF800000000000
+#define __MACH2PHYS_VIRT_END    0xFFFF804000000000
+
+#ifndef HYPERVISOR_VIRT_START
+#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
+#define HYPERVISOR_VIRT_END   mk_unsigned_long(__HYPERVISOR_VIRT_END)
+#endif
+
+#define MACH2PHYS_VIRT_START  mk_unsigned_long(__MACH2PHYS_VIRT_START)
+#define MACH2PHYS_VIRT_END    mk_unsigned_long(__MACH2PHYS_VIRT_END)
+#define MACH2PHYS_NR_ENTRIES  ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3)
+#ifndef machine_to_phys_mapping
+#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
+#endif
+
+/*
+ * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
+ *  @which == SEGBASE_*  ;  @base == 64-bit base address
+ * Returns 0 on success.
+ */
+#define SEGBASE_FS          0
+#define SEGBASE_GS_USER     1
+#define SEGBASE_GS_KERNEL   2
+#define SEGBASE_GS_USER_SEL 3 /* Set user %gs specified in base[15:0] */
+
+/*
+ * int HYPERVISOR_iret(void)
+ * All arguments are on the kernel stack, in the following format.
+ * Never returns if successful. Current kernel context is lost.
+ * The saved CS is mapped as follows:
+ *   RING0 -> RING3 kernel mode.
+ *   RING1 -> RING3 kernel mode.
+ *   RING2 -> RING3 kernel mode.
+ *   RING3 -> RING3 user mode.
+ * However RING0 indicates that the guest kernel should return to iteself
+ * directly with
+ *      orb   $3,1*8(%rsp)
+ *      iretq
+ * If flags contains VGCF_in_syscall:
+ *   Restore RAX, RIP, RFLAGS, RSP.
+ *   Discard R11, RCX, CS, SS.
+ * Otherwise:
+ *   Restore RAX, R11, RCX, CS:RIP, RFLAGS, SS:RSP.
+ * All other registers are saved on hypercall entry and restored to user.
+ */
+/* Guest exited in SYSCALL context? Return to guest with SYSRET? */
+#define _VGCF_in_syscall 8
+#define VGCF_in_syscall  (1<<_VGCF_in_syscall)
+#define VGCF_IN_SYSCALL  VGCF_in_syscall
+
+#ifndef __ASSEMBLY__
+
+struct iret_context {
+    /* Top of stack (%rsp at point of hypercall). */
+    uint64_t rax, r11, rcx, flags, rip, cs, rflags, rsp, ss;
+    /* Bottom of iret stack frame. */
+};
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
+#define __DECL_REG(name) union { \
+    uint64_t r ## name, e ## name; \
+    uint32_t _e ## name; \
+}
+#else
+/* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */
+#define __DECL_REG(name) uint64_t r ## name
+#endif
+
+struct cpu_user_regs {
+    uint64_t r15;
+    uint64_t r14;
+    uint64_t r13;
+    uint64_t r12;
+    __DECL_REG(bp);
+    __DECL_REG(bx);
+    uint64_t r11;
+    uint64_t r10;
+    uint64_t r9;
+    uint64_t r8;
+    __DECL_REG(ax);
+    __DECL_REG(cx);
+    __DECL_REG(dx);
+    __DECL_REG(si);
+    __DECL_REG(di);
+    uint32_t error_code;    /* private */
+    uint32_t entry_vector;  /* private */
+    __DECL_REG(ip);
+    uint16_t cs, _pad0[1];
+    uint8_t  saved_upcall_mask;
+    uint8_t  _pad1[3];
+    __DECL_REG(flags);      /* rflags.IF == !saved_upcall_mask */
+    __DECL_REG(sp);
+    uint16_t ss, _pad2[3];
+    uint16_t es, _pad3[3];
+    uint16_t ds, _pad4[3];
+    uint16_t fs, _pad5[3]; /* Non-zero => takes precedence over fs_base.     */
+    uint16_t gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_usr. */
+};
+DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
+
+#undef __DECL_REG
+
+#define xen_pfn_to_cr3(pfn) ((unsigned long)(pfn) << 12)
+#define xen_cr3_to_pfn(cr3) ((unsigned long)(cr3) >> 12)
+
+struct arch_vcpu_info {
+    unsigned long cr2;
+    unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
+};
+
+typedef unsigned long xen_callback_t;
+
+#define XEN_CALLBACK(__cs, __rip)				\
+	((unsigned long)(__rip))
+
+#endif /* !__ASSEMBLY__ */
+
+
+#endif	/* __ASM_X86_XEN_INTERFACE_64_H */
diff --git a/include/xen/interface/callback.h b/include/xen/interface/callback.h
index 4aadcba..2ae3cd2 100644
--- a/include/xen/interface/callback.h
+++ b/include/xen/interface/callback.h
@@ -82,9 +82,9 @@
  */
 #define CALLBACKOP_register                0
 struct callback_register {
-    uint16_t type;
-    uint16_t flags;
-    struct xen_callback address;
+	uint16_t type;
+	uint16_t flags;
+	xen_callback_t address;
 };
 
 /*
-- 
1.5.4.1


linux-2.6-xen-0023-xen-make-ELF-notes-work-for-32-and-64-bit.patch:

--- NEW FILE linux-2.6-xen-0023-xen-make-ELF-notes-work-for-32-and-64-bit.patch ---
>From 6080ad1facb19051aa5155b94a35546a50a95048 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:35 -0700
Subject: [PATCH] xen: make ELF notes work for 32 and 64 bit

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/xen-head.S |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 7c0cf63..a9cac9d 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -5,7 +5,10 @@
 
 #include <linux/elfnote.h>
 #include <linux/init.h>
+
 #include <asm/boot.h>
+#include <asm/asm.h>
+
 #include <xen/interface/elfnote.h>
 #include <asm/xen/interface.h>
 
@@ -21,21 +24,21 @@ ENTRY(startup_xen)
 .pushsection .text
 	.align PAGE_SIZE_asm
 ENTRY(hypercall_page)
-	.skip 0x1000
+	.skip PAGE_SIZE_asm
 .popsection
 
 	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz "linux")
 	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz "2.6")
 	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz "xen-3.0")
-	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      .long  __PAGE_OFFSET)
-	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long  startup_xen)
-	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long  hypercall_page)
+	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      _ASM_PTR __PAGE_OFFSET)
+	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          _ASM_PTR startup_xen)
+	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz "!writable_page_tables|pae_pgdir_above_4gb")
 	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz "yes")
 	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz "generic")
 	ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,
 		.quad _PAGE_PRESENT; .quad _PAGE_PRESENT)
 	ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
-	ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   .long __HYPERVISOR_VIRT_START)
+	ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   _ASM_PTR __HYPERVISOR_VIRT_START)
 
 #endif /*CONFIG_XEN */
-- 
1.5.4.1


linux-2.6-xen-0024-xen-fix-64-bit-hypercall-variants.patch:

--- NEW FILE linux-2.6-xen-0024-xen-fix-64-bit-hypercall-variants.patch ---
>From a65b1ea260d2a311e69820ba8d973f14d9af75c4 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:36 -0700
Subject: [PATCH] xen: fix 64-bit hypercall variants

64-bit guests can pass 64-bit quantities in a single argument,
so fix up the hypercalls.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 include/asm-x86/xen/hypercall.h |   60 ++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index 74465b7..5e277c0 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -223,12 +223,12 @@ static inline int
 HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
 			     unsigned long flags)
 {
-	unsigned long pte_hi = 0;
-#ifdef CONFIG_X86_PAE
-	pte_hi = new_val.pte_high;
-#endif
-	return _hypercall4(int, update_va_mapping, va,
-			   new_val.pte_low, pte_hi, flags);
+	if (sizeof(new_val) == sizeof(long))
+		return _hypercall3(int, update_va_mapping, va,
+				   new_val.pte, flags);
+	else
+		return _hypercall4(int, update_va_mapping, va,
+				   new_val.pte, new_val.pte >> 32, flags);
 }
 
 static inline int
@@ -281,12 +281,13 @@ static inline int
 HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, pte_t new_val,
 					 unsigned long flags, domid_t domid)
 {
-	unsigned long pte_hi = 0;
-#ifdef CONFIG_X86_PAE
-	pte_hi = new_val.pte_high;
-#endif
-	return _hypercall5(int, update_va_mapping_otherdomain, va,
-			   new_val.pte_low, pte_hi, flags, domid);
+	if (sizeof(new_val) == sizeof(long))
+		return _hypercall4(int, update_va_mapping_otherdomain, va,
+				   new_val.pte, flags, domid);
+	else
+		return _hypercall5(int, update_va_mapping_otherdomain, va,
+				   new_val.pte, new_val.pte >> 32,
+				   flags, domid);
 }
 
 static inline int
@@ -327,14 +328,14 @@ MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
 {
 	mcl->op = __HYPERVISOR_update_va_mapping;
 	mcl->args[0] = va;
-#ifdef CONFIG_X86_PAE
-	mcl->args[1] = new_val.pte_low;
-	mcl->args[2] = new_val.pte_high;
-#else
-	mcl->args[1] = new_val.pte_low;
-	mcl->args[2] = 0;
-#endif
-	mcl->args[3] = flags;
+	if (sizeof(new_val) == sizeof(long)) {
+		mcl->args[1] = new_val.pte;
+		mcl->args[2] = flags;
+	} else {
+		mcl->args[1] = new_val.pte;
+		mcl->args[2] = new_val.pte >> 32;
+		mcl->args[3] = flags;
+	}
 }
 
 static inline void
@@ -354,15 +355,16 @@ MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long v
 {
 	mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
 	mcl->args[0] = va;
-#ifdef CONFIG_X86_PAE
-	mcl->args[1] = new_val.pte_low;
-	mcl->args[2] = new_val.pte_high;
-#else
-	mcl->args[1] = new_val.pte_low;
-	mcl->args[2] = 0;
-#endif
-	mcl->args[3] = flags;
-	mcl->args[4] = domid;
+	if (sizeof(new_val) == sizeof(long)) {
+		mcl->args[1] = new_val.pte;
+		mcl->args[2] = flags;
+		mcl->args[3] = domid;
+	} else {
+		mcl->args[1] = new_val.pte;
+		mcl->args[2] = new_val.pte >> 32;
+		mcl->args[3] = flags;
+		mcl->args[4] = domid;
+	}
 }
 
 static inline void
-- 
1.5.4.1


linux-2.6-xen-0025-xen64-fix-calls-into-hypercall-page.patch:

--- NEW FILE linux-2.6-xen-0025-xen64-fix-calls-into-hypercall-page.patch ---
>From cfa583b90c8ae0a5d8a8d9ab2c97d112610fdd85 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:37 -0700
Subject: [PATCH] xen64: fix calls into hypercall page

The 64-bit calling convention for hypercalls uses different registers
from 32-bit.  Annoyingly, gcc's asm syntax doesn't have a way to
specify one of the extra numeric reigisters in a constraint, so we
must use explicitly placed register variables.  Given that we have to
do it for some args, may as well do it for all.

Also fix syntax gcc generates for the call instruction itself.  We
need a plain direct call, but the asm expansion which works on 32-bit
generates a rip-relative addressing mode in 64-bit, which is treated
as an indirect call.  The alternative is to pass the hypercall page
offset into the asm, and have it add it to the hypercall page start
address to generate the call.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 include/asm-x86/xen/hypercall.h |  170 ++++++++++++++++++++++++++++-----------
 1 files changed, 122 insertions(+), 48 deletions(-)

diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index 5e277c0..8763b97 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -40,83 +40,157 @@
 #include <xen/interface/sched.h>
 #include <xen/interface/physdev.h>
 
+/*
+ * The hypercall asms have to meet several constraints:
+ * - Work on 32- and 64-bit.
+ *    The two architectures put their arguments in different sets of
+ *    registers.
+ *
+ * - Work around asm syntax quirks
+ *    It isn't possible to specify one of the rNN registers in a
+ *    constraint, so we use explicit register variables to get the
+ *    args into the right place.
+ *
+ * - Mark all registers as potentially clobbered
+ *    Even unused parameters can be clobbered by the hypervisor, so we
+ *    need to make sure gcc knows it.
+ *
+ * - Avoid compiler bugs.
+ *    This is the tricky part.  Because x86_32 has such a constrained
+ *    register set, gcc versions below 4.3 have trouble generating
+ *    code when all the arg registers and memory are trashed by the
+ *    asm.  There are syntactically simpler ways of achieving the
+ *    semantics below, but they cause the compiler to crash.
+ *
+ *    The only combination I found which works is:
+ *     - assign the __argX variables first
+ *     - list all actually used parameters as "+r" (__argX)
+ *     - clobber the rest
+ *
+ * The result certainly isn't pretty, and it really shows up cpp's
+ * weakness as as macro language.  Sorry.  (But let's just give thanks
+ * there aren't more than 5 arguments...)
+ */
+
 extern struct { char _entry[32]; } hypercall_page[];
 
+#define __HYPERCALL		"call hypercall_page+%c[offset]"
+#define __HYPERCALL_ENTRY(x)						\
+	[offset] "i" (__HYPERVISOR_##x * sizeof(hypercall_page[0]))
+
+#ifdef CONFIG_X86_32
+#define __HYPERCALL_RETREG	"eax"
+#define __HYPERCALL_ARG1REG	"ebx"
+#define __HYPERCALL_ARG2REG	"ecx"
+#define __HYPERCALL_ARG3REG	"edx"
+#define __HYPERCALL_ARG4REG	"esi"
+#define __HYPERCALL_ARG5REG	"edi"
+#else
+#define __HYPERCALL_RETREG	"rax"
+#define __HYPERCALL_ARG1REG	"rdi"
+#define __HYPERCALL_ARG2REG	"rsi"
+#define __HYPERCALL_ARG3REG	"rdx"
+#define __HYPERCALL_ARG4REG	"r10"
+#define __HYPERCALL_ARG5REG	"r8"
+#endif
+
+#define __HYPERCALL_DECLS						\
+	register unsigned long __res  asm(__HYPERCALL_RETREG);		\
+	register unsigned long __arg1 asm(__HYPERCALL_ARG1REG) = __arg1; \
+	register unsigned long __arg2 asm(__HYPERCALL_ARG2REG) = __arg2; \
+	register unsigned long __arg3 asm(__HYPERCALL_ARG3REG) = __arg3; \
+	register unsigned long __arg4 asm(__HYPERCALL_ARG4REG) = __arg4; \
+	register unsigned long __arg5 asm(__HYPERCALL_ARG5REG) = __arg5;
+
+#define __HYPERCALL_0PARAM	"=r" (__res)
+#define __HYPERCALL_1PARAM	__HYPERCALL_0PARAM, "+r" (__arg1)
+#define __HYPERCALL_2PARAM	__HYPERCALL_1PARAM, "+r" (__arg2)
+#define __HYPERCALL_3PARAM	__HYPERCALL_2PARAM, "+r" (__arg3)
+#define __HYPERCALL_4PARAM	__HYPERCALL_3PARAM, "+r" (__arg4)
+#define __HYPERCALL_5PARAM	__HYPERCALL_4PARAM, "+r" (__arg5)
+
+#define __HYPERCALL_0ARG()
+#define __HYPERCALL_1ARG(a1)						\
+	__HYPERCALL_0ARG()		__arg1 = (unsigned long)(a1);
+#define __HYPERCALL_2ARG(a1,a2)						\
+	__HYPERCALL_1ARG(a1)		__arg2 = (unsigned long)(a2);
+#define __HYPERCALL_3ARG(a1,a2,a3)					\
+	__HYPERCALL_2ARG(a1,a2)		__arg3 = (unsigned long)(a3);
+#define __HYPERCALL_4ARG(a1,a2,a3,a4)					\
+	__HYPERCALL_3ARG(a1,a2,a3)	__arg4 = (unsigned long)(a4);
+#define __HYPERCALL_5ARG(a1,a2,a3,a4,a5)				\
+	__HYPERCALL_4ARG(a1,a2,a3,a4)	__arg5 = (unsigned long)(a5);
+
+#define __HYPERCALL_CLOBBER5	"memory"
+#define __HYPERCALL_CLOBBER4	__HYPERCALL_CLOBBER5, __HYPERCALL_ARG5REG
+#define __HYPERCALL_CLOBBER3	__HYPERCALL_CLOBBER4, __HYPERCALL_ARG4REG
+#define __HYPERCALL_CLOBBER2	__HYPERCALL_CLOBBER3, __HYPERCALL_ARG3REG
+#define __HYPERCALL_CLOBBER1	__HYPERCALL_CLOBBER2, __HYPERCALL_ARG2REG
+#define __HYPERCALL_CLOBBER0	__HYPERCALL_CLOBBER1, __HYPERCALL_ARG1REG
+
 #define _hypercall0(type, name)						\
 ({									\
-	long __res;							\
-	asm volatile (							\
-		"call %[call]"						\
-		: "=a" (__res)						\
-		: [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-		: "memory" );						\
+	__HYPERCALL_DECLS;						\
+	__HYPERCALL_0ARG();						\
+	asm volatile (__HYPERCALL					\
+		      : __HYPERCALL_0PARAM				\
+		      : __HYPERCALL_ENTRY(name)				\
+		      : __HYPERCALL_CLOBBER0);				\
 	(type)__res;							\
 })
 
 #define _hypercall1(type, name, a1)					\
 ({									\
-	long __res, __ign1;						\
-	asm volatile (							\
-		"call %[call]"						\
-		: "=a" (__res), "=b" (__ign1)				\
-		: "1" ((long)(a1)),					\
-		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-		: "memory" );						\
+	__HYPERCALL_DECLS;						\
+	__HYPERCALL_1ARG(a1);						\
+	asm volatile (__HYPERCALL					\
+		      : __HYPERCALL_1PARAM				\
+		      : __HYPERCALL_ENTRY(name)				\
+		      : __HYPERCALL_CLOBBER1);				\
 	(type)__res;							\
 })
 
 #define _hypercall2(type, name, a1, a2)					\
 ({									\
-	long __res, __ign1, __ign2;					\
-	asm volatile (							\
-		"call %[call]"						\
-		: "=a" (__res), "=b" (__ign1), "=c" (__ign2)		\
-		: "1" ((long)(a1)), "2" ((long)(a2)),			\
-		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-		: "memory" );						\
+	__HYPERCALL_DECLS;						\
+	__HYPERCALL_2ARG(a1, a2);					\
+	asm volatile (__HYPERCALL					\
+		      : __HYPERCALL_2PARAM				\
+		      : __HYPERCALL_ENTRY(name)				\
+		      : __HYPERCALL_CLOBBER2);				\
 	(type)__res;							\
 })
 
 #define _hypercall3(type, name, a1, a2, a3)				\
 ({									\
-	long __res, __ign1, __ign2, __ign3;				\
-	asm volatile (							\
-		"call %[call]"						\
-		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),		\
-		"=d" (__ign3)						\
-		: "1" ((long)(a1)), "2" ((long)(a2)),			\
-		  "3" ((long)(a3)),					\
-		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-		: "memory" );						\
+	__HYPERCALL_DECLS;						\
+	__HYPERCALL_3ARG(a1, a2, a3);					\
+	asm volatile (__HYPERCALL					\
+		      : __HYPERCALL_3PARAM				\
+		      : __HYPERCALL_ENTRY(name)				\
+		      : __HYPERCALL_CLOBBER3);				\
 	(type)__res;							\
 })
 
 #define _hypercall4(type, name, a1, a2, a3, a4)				\
 ({									\
-	long __res, __ign1, __ign2, __ign3, __ign4;			\
-	asm volatile (							\
-		"call %[call]"						\
-		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),		\
-		"=d" (__ign3), "=S" (__ign4)				\
-		: "1" ((long)(a1)), "2" ((long)(a2)),			\
-		  "3" ((long)(a3)), "4" ((long)(a4)),			\
-		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-		: "memory" );						\
+	__HYPERCALL_DECLS;						\
+	__HYPERCALL_4ARG(a1, a2, a3, a4);				\
+	asm volatile (__HYPERCALL					\
+		      : __HYPERCALL_4PARAM				\
+		      : __HYPERCALL_ENTRY(name)				\
+		      : __HYPERCALL_CLOBBER4);				\
 	(type)__res;							\
 })
 
 #define _hypercall5(type, name, a1, a2, a3, a4, a5)			\
 ({									\
-	long __res, __ign1, __ign2, __ign3, __ign4, __ign5;		\
-	asm volatile (							\
-		"call %[call]"						\
-		: "=a" (__res), "=b" (__ign1), "=c" (__ign2),		\
-		"=d" (__ign3), "=S" (__ign4), "=D" (__ign5)		\
-		: "1" ((long)(a1)), "2" ((long)(a2)),			\
-		  "3" ((long)(a3)), "4" ((long)(a4)),			\
-		  "5" ((long)(a5)),					\
-		  [call] "m" (hypercall_page[__HYPERVISOR_##name])	\
-		: "memory" );						\
+	__HYPERCALL_DECLS;						\
+	__HYPERCALL_5ARG(a1, a2, a3, a4, a5);				\
+	asm volatile (__HYPERCALL					\
+		      : __HYPERCALL_5PARAM				\
+		      : __HYPERCALL_ENTRY(name)				\
+		      : __HYPERCALL_CLOBBER5);				\
 	(type)__res;							\
 })
 
-- 
1.5.4.1


linux-2.6-xen-0026-xen64-add-extra-pv_mmu_ops.patch:

--- NEW FILE linux-2.6-xen-0026-xen64-add-extra-pv_mmu_ops.patch ---
>From 9821b933cd663bcb3301b1c5bebf18a729a45473 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:38 -0700
Subject: [PATCH] xen64: add extra pv_mmu_ops

We need extra pv_mmu_ops for 64-bit, to deal with the extra level of
pagetable.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c   |   33 +++++++++++++++++++++++++++-
 arch/x86/xen/mmu.c         |   51 +++++++++++++++++++++++++++++++++++++++++++-
 arch/x86/xen/mmu.h         |   15 +++++++++++-
 include/asm-x86/xen/page.h |    4 +++
 4 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 9f07d2f..6d77330 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -821,6 +821,18 @@ static void xen_release_pmd(u32 pfn)
 	xen_release_ptpage(pfn, PT_PMD);
 }
 
+#if PAGETABLE_LEVELS == 4
+static void xen_alloc_pud(struct mm_struct *mm, u32 pfn)
+{
+	xen_alloc_ptpage(mm, pfn, PT_PUD);
+}
+
+static void xen_release_pud(u32 pfn)
+{
+	xen_release_ptpage(pfn, PT_PUD);
+}
+#endif
+
 #ifdef CONFIG_HIGHPTE
 static void *xen_kmap_atomic_pte(struct page *page, enum km_type type)
 {
@@ -940,6 +952,11 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 	pv_mmu_ops.alloc_pmd = xen_alloc_pmd;
 	pv_mmu_ops.release_pte = xen_release_pte;
 	pv_mmu_ops.release_pmd = xen_release_pmd;
+#if PAGETABLE_LEVELS == 4
+	pv_mmu_ops.alloc_pud = xen_alloc_pud;
+	pv_mmu_ops.release_pud = xen_release_pud;
+#endif
+
 	pv_mmu_ops.set_pte = xen_set_pte;
 
 	xen_setup_shared_info();
@@ -955,6 +972,9 @@ static __init void xen_post_allocator_init(void)
 {
 	pv_mmu_ops.set_pmd = xen_set_pmd;
 	pv_mmu_ops.set_pud = xen_set_pud;
+#if PAGETABLE_LEVELS == 4
+	pv_mmu_ops.set_pgd = xen_set_pgd;
+#endif
 
 	xen_mark_init_mm_pinned();
 }
@@ -1206,15 +1226,26 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 	.make_pte = xen_make_pte,
 	.make_pgd = xen_make_pgd,
 
+#ifdef CONFIG_X86_PAE
 	.set_pte_atomic = xen_set_pte_atomic,
 	.set_pte_present = xen_set_pte_at,
-	.set_pud = xen_set_pud_hyper,
 	.pte_clear = xen_pte_clear,
 	.pmd_clear = xen_pmd_clear,
+#endif	/* CONFIG_X86_PAE */
+	.set_pud = xen_set_pud_hyper,
 
 	.make_pmd = xen_make_pmd,
 	.pmd_val = xen_pmd_val,
 
+#if PAGETABLE_LEVELS == 4
+	.pud_val = xen_pud_val,
+	.make_pud = xen_make_pud,
+	.set_pgd = xen_set_pgd_hyper,
+
+	.alloc_pud = xen_alloc_pte_init,
+	.release_pud = xen_release_pte_init,
+#endif	/* PAGETABLE_LEVELS == 4 */
+
 	.activate_mm = xen_activate_mm,
 	.dup_mmap = xen_dup_mmap,
 	.exit_mmap = xen_exit_mmap,
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 4fca9d8..d0976b8 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -438,14 +438,19 @@ void xen_set_pud(pud_t *ptr, pud_t val)
 
 void xen_set_pte(pte_t *ptep, pte_t pte)
 {
+#ifdef CONFIG_X86_PAE
 	ptep->pte_high = pte.pte_high;
 	smp_wmb();
 	ptep->pte_low = pte.pte_low;
+#else
+	*ptep = pte;
+#endif
 }
 
+#ifdef CONFIG_X86_PAE
 void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
 {
-	set_64bit((u64 *)ptep, pte_val_ma(pte));
+	set_64bit((u64 *)ptep, native_pte_val(pte));
 }
 
 void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
@@ -459,6 +464,7 @@ void xen_pmd_clear(pmd_t *pmdp)
 {
 	set_pmd(pmdp, __pmd(0));
 }
+#endif	/* CONFIG_X86_PAE */
 
 pmd_t xen_make_pmd(pmdval_t pmd)
 {
@@ -466,6 +472,49 @@ pmd_t xen_make_pmd(pmdval_t pmd)
 	return native_make_pmd(pmd);
 }
 
+#if PAGETABLE_LEVELS == 4
+pudval_t xen_pud_val(pud_t pud)
+{
+	return pte_mfn_to_pfn(pud.pud);
+}
+
+pud_t xen_make_pud(pudval_t pud)
+{
+	pud = pte_pfn_to_mfn(pud);
+
+	return native_make_pud(pud);
+}
+
+void xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
+{
+	struct mmu_update u;
+
+	preempt_disable();
+
+	xen_mc_batch();
+
+	u.ptr = virt_to_machine(ptr).maddr;
+	u.val = pgd_val_ma(val);
+	extend_mmu_update(&u);
+
+	xen_mc_issue(PARAVIRT_LAZY_MMU);
+
+	preempt_enable();
+}
+
+void xen_set_pgd(pgd_t *ptr, pgd_t val)
+{
+	/* If page is not pinned, we can just update the entry
+	   directly */
+	if (!page_pinned(ptr)) {
+		*ptr = val;
+		return;
+	}
+
+	xen_set_pgd_hyper(ptr, val);
+}
+#endif	/* PAGETABLE_LEVELS == 4 */
+
 /*
   (Yet another) pagetable walker.  This one is intended for pinning a
   pagetable.  This means that it walks a pagetable and calls the
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index 7856e37..19d544b 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -32,13 +32,24 @@ pgd_t xen_make_pgd(pgdval_t);
 void xen_set_pte(pte_t *ptep, pte_t pteval);
 void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
 		    pte_t *ptep, pte_t pteval);
+
+#ifdef CONFIG_X86_PAE
 void xen_set_pte_atomic(pte_t *ptep, pte_t pte);
+void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
+void xen_pmd_clear(pmd_t *pmdp);
+#endif	/* CONFIG_X86_PAE */
+
 void xen_set_pmd(pmd_t *pmdp, pmd_t pmdval);
 void xen_set_pud(pud_t *ptr, pud_t val);
 void xen_set_pmd_hyper(pmd_t *pmdp, pmd_t pmdval);
 void xen_set_pud_hyper(pud_t *ptr, pud_t val);
-void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
-void xen_pmd_clear(pmd_t *pmdp);
+
+#if PAGETABLE_LEVELS == 4
+pudval_t xen_pud_val(pud_t pud);
+pud_t xen_make_pud(pudval_t pudval);
+void xen_set_pgd(pgd_t *pgdp, pgd_t pgd);
+void xen_set_pgd_hyper(pgd_t *pgdp, pgd_t pgd);
+#endif
 
 pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
 void  xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
index 377c045..a40be65 100644
--- a/include/asm-x86/xen/page.h
+++ b/include/asm-x86/xen/page.h
@@ -148,7 +148,11 @@ static inline pte_t __pte_ma(pteval_t x)
 }
 
 #define pmd_val_ma(v) ((v).pmd)
+#ifdef __PAGETABLE_PUD_FOLDED
 #define pud_val_ma(v) ((v).pgd.pgd)
+#else
+#define pud_val_ma(v) ((v).pud)
+#endif
 #define __pmd_ma(x)	((pmd_t) { (x) } )
 
 #define pgd_val_ma(x)	((x).pgd)
-- 
1.5.4.1


linux-2.6-xen-0027-xen64-random-ifdefs-to-mask-out-32-bit-only-code.patch:

--- NEW FILE linux-2.6-xen-0027-xen64-random-ifdefs-to-mask-out-32-bit-only-code.patch ---
>From 516f699b8ebe5d579b4eb523acb1db93f20da22c Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:39 -0700
Subject: [PATCH] xen64: random ifdefs to mask out 32-bit only code

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 6d77330..835bb38 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1317,6 +1317,7 @@ static const struct machine_ops __initdata xen_machine_ops = {
 
 static void __init xen_reserve_top(void)
 {
+#ifdef CONFIG_X86_32
 	unsigned long top = HYPERVISOR_VIRT_START;
 	struct xen_platform_parameters pp;
 
@@ -1324,6 +1325,7 @@ static void __init xen_reserve_top(void)
 		top = pp.virt_start;
 
 	reserve_top_address(-top + 2 * PAGE_SIZE);
+#endif	/* CONFIG_X86_32 */
 }
 
 /* First C function to be called on Xen boot */
@@ -1354,6 +1356,11 @@ asmlinkage void __init xen_start_kernel(void)
 
 	machine_ops = xen_machine_ops;
 
+#ifdef CONFIG_X86_64
+	/* Disable until direct per-cpu data access. */
+	have_vcpu_info_placement = 0;
+#endif
+
 #ifdef CONFIG_SMP
 	smp_ops = xen_smp_ops;
 #endif
@@ -1364,9 +1371,11 @@ asmlinkage void __init xen_start_kernel(void)
 
 	pgd = (pgd_t *)xen_start_info->pt_base;
 
+#ifdef CONFIG_X86_32
 	init_pg_tables_start = __pa(pgd);
 	init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE;
 	max_pfn_mapped = (init_pg_tables_end + 512*1024) >> PAGE_SHIFT;
+#endif
 
 	init_mm.pgd = pgd; /* use the Xen pagetables to start */
 
@@ -1393,7 +1402,9 @@ asmlinkage void __init xen_start_kernel(void)
 
 	/* set up basic CPUID stuff */
 	cpu_detect(&new_cpu_data);
+#ifdef CONFIG_X86_32
 	new_cpu_data.hard_math = 1;
+#endif
 	new_cpu_data.x86_capability[0] = cpuid_edx(1);
 
 	/* Poke various useful things into boot_params */
@@ -1409,5 +1420,9 @@ asmlinkage void __init xen_start_kernel(void)
 	}
 
 	/* Start the world */
+#ifdef CONFIG_X86_32
 	i386_start_kernel();
+#else
+	x86_64_start_kernel((char *)&boot_params);
+#endif
 }
-- 
1.5.4.1


linux-2.6-xen-0028-xen64-get-active_mm-from-the-pda.patch:

--- NEW FILE linux-2.6-xen-0028-xen64-get-active_mm-from-the-pda.patch ---
>From c281651c5de831bdeea93ba3242bd8b979dd8280 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:40 -0700
Subject: [PATCH] xen64: get active_mm from the pda

x86_64 stores the active_mm in the pda, so fetch it from there.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/mmu.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index d0976b8..2579e70 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -805,8 +805,15 @@ void xen_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
 static void drop_other_mm_ref(void *info)
 {
 	struct mm_struct *mm = info;
+	struct mm_struct *active_mm;
 
-	if (__get_cpu_var(cpu_tlbstate).active_mm == mm)
+#ifdef CONFIG_X86_64
+	active_mm = read_pda(active_mm);
+#else
+	active_mm = __get_cpu_var(cpu_tlbstate).active_mm;
+#endif
+
+	if (active_mm == mm)
 		leave_mm(smp_processor_id());
 
 	/* If this cpu still has a stale cr3 reference, then make sure
-- 
1.5.4.1


linux-2.6-xen-0029-xen-move-smp-setup-into-smp.c.patch:

--- NEW FILE linux-2.6-xen-0029-xen-move-smp-setup-into-smp.c.patch ---
>From a2d93a591a3e23d3ebf6b8c88633d80bde718828 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:41 -0700
Subject: [PATCH] xen: move smp setup into smp.c

Move all the smp_ops setup into smp.c, allowing a lot of things to
become static.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   19 +------------------
 arch/x86/xen/smp.c       |   34 ++++++++++++++++++++++++++--------
 arch/x86/xen/xen-ops.h   |   13 +++++--------
 3 files changed, 32 insertions(+), 34 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 835bb38..46348e8 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1258,21 +1258,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 	.set_fixmap = xen_set_fixmap,
 };
 
-#ifdef CONFIG_SMP
-static const struct smp_ops xen_smp_ops __initdata = {
-	.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
-	.smp_prepare_cpus = xen_smp_prepare_cpus,
-	.cpu_up = xen_cpu_up,
-	.smp_cpus_done = xen_smp_cpus_done,
-
-	.smp_send_stop = xen_smp_send_stop,
-	.smp_send_reschedule = xen_smp_send_reschedule,
-
-	.send_call_func_ipi = xen_smp_send_call_function_ipi,
-	.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
-};
-#endif	/* CONFIG_SMP */
-
 static void xen_reboot(int reason)
 {
 	struct sched_shutdown r = { .reason = reason };
@@ -1361,9 +1346,7 @@ asmlinkage void __init xen_start_kernel(void)
 	have_vcpu_info_placement = 0;
 #endif
 
-#ifdef CONFIG_SMP
-	smp_ops = xen_smp_ops;
-#endif
+	xen_smp_init();
 
 	/* Get mfn list */
 	if (!xen_feature(XENFEAT_auto_translated_physmap))
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 233156f..91fae8f 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -152,7 +152,7 @@ void __init xen_fill_possible_map(void)
 	}
 }
 
-void __init xen_smp_prepare_boot_cpu(void)
+static void __init xen_smp_prepare_boot_cpu(void)
 {
 	int cpu;
 
@@ -176,7 +176,7 @@ void __init xen_smp_prepare_boot_cpu(void)
 	xen_setup_vcpu_info_placement();
 }
 
-void __init xen_smp_prepare_cpus(unsigned int max_cpus)
+static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
 {
 	unsigned cpu;
 
@@ -276,7 +276,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
 	return 0;
 }
 
-int __cpuinit xen_cpu_up(unsigned int cpu)
+static int __cpuinit xen_cpu_up(unsigned int cpu)
 {
 	struct task_struct *idle = idle_task(cpu);
 	int rc;
@@ -319,7 +319,7 @@ int __cpuinit xen_cpu_up(unsigned int cpu)
 	return 0;
 }
 
-void xen_smp_cpus_done(unsigned int max_cpus)
+static void xen_smp_cpus_done(unsigned int max_cpus)
 {
 }
 
@@ -335,12 +335,12 @@ static void stop_self(void *v)
 	BUG();
 }
 
-void xen_smp_send_stop(void)
+static void xen_smp_send_stop(void)
 {
 	smp_call_function(stop_self, NULL, 0);
 }
 
-void xen_smp_send_reschedule(int cpu)
+static void xen_smp_send_reschedule(int cpu)
 {
 	xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR);
 }
@@ -355,7 +355,7 @@ static void xen_send_IPI_mask(cpumask_t mask, enum ipi_vector vector)
 		xen_send_IPI_one(cpu, vector);
 }
 
-void xen_smp_send_call_function_ipi(cpumask_t mask)
+static void xen_smp_send_call_function_ipi(cpumask_t mask)
 {
 	int cpu;
 
@@ -370,7 +370,7 @@ void xen_smp_send_call_function_ipi(cpumask_t mask)
 	}
 }
 
-void xen_smp_send_call_function_single_ipi(int cpu)
+static void xen_smp_send_call_function_single_ipi(int cpu)
 {
 	xen_send_IPI_mask(cpumask_of_cpu(cpu), XEN_CALL_FUNCTION_SINGLE_VECTOR);
 }
@@ -394,3 +394,21 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
 
 	return IRQ_HANDLED;
 }
+
+static const struct smp_ops xen_smp_ops __initdata = {
+	.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
+	.smp_prepare_cpus = xen_smp_prepare_cpus,
+	.cpu_up = xen_cpu_up,
+	.smp_cpus_done = xen_smp_cpus_done,
+
+	.smp_send_stop = xen_smp_send_stop,
+	.smp_send_reschedule = xen_smp_send_reschedule,
+
+	.send_call_func_ipi = xen_smp_send_call_function_ipi,
+	.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
+};
+
+void __init xen_smp_init(void)
+{
+	smp_ops = xen_smp_ops;
+}
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 77354d2..81a779f 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -47,17 +47,14 @@ void xen_mark_init_mm_pinned(void);
 void __init xen_fill_possible_map(void);
 
 void __init xen_setup_vcpu_info_placement(void);
-void xen_smp_prepare_boot_cpu(void);
-void xen_smp_prepare_cpus(unsigned int max_cpus);
-int xen_cpu_up(unsigned int cpu);
-void xen_smp_cpus_done(unsigned int max_cpus);
 
-void xen_smp_send_stop(void);
-void xen_smp_send_reschedule(int cpu);
-void xen_smp_send_call_function_ipi(cpumask_t mask);
-void xen_smp_send_call_function_single_ipi(int cpu);
+#ifdef CONFIG_SMP
+void xen_smp_init(void);
 
 extern cpumask_t xen_cpu_initialized_map;
+#else
+static inline void xen_smp_init(void) {}
+#endif
 
 
 /* Declare an asm function, along with symbols needed to make it
-- 
1.5.4.1


linux-2.6-xen-0030-x86_64-add-workaround-for-no-gs-based-percpu.patch:

--- NEW FILE linux-2.6-xen-0030-x86_64-add-workaround-for-no-gs-based-percpu.patch ---
>From 420363ef7b613bc24011cd1b9a7835b1fffb0748 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:42 -0700
Subject: [PATCH] x86_64: add workaround for no %gs-based percpu

As a stopgap until Mike Travis's x86-64 gs-based percpu patches are
ready, provide workaround functions for x86_read/write_percpu for
Xen's use.

Specifically, this means that we can't really make use of vcpu
placement, because we can't use a single gs-based memory access to get
to vcpu fields.  So disable all that for now.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/head64.c |   11 ++++++++---
 arch/x86/xen/enlighten.c |    5 +++++
 include/asm-x86/percpu.h |   26 ++++++++++++++++++++++++++
 include/asm-x86/setup.h  |    1 +
 4 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index c978198..1b318e9 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -39,6 +39,13 @@ static struct x8664_pda *__cpu_pda[NR_CPUS] __initdata;
 static struct x8664_pda *__cpu_pda[NR_CPUS] __read_mostly;
 #endif
 
+void __init x86_64_init_pda(void)
+{
+	_cpu_pda = __cpu_pda;
+	cpu_pda(0) = &_boot_cpu_pda;
+	pda_init(0);
+}
+
 static void __init zap_identity_mappings(void)
 {
 	pgd_t *pgd = pgd_offset_k(0UL);
@@ -102,9 +109,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
 
 	early_printk("Kernel alive\n");
 
-	_cpu_pda = __cpu_pda;
-	cpu_pda(0) = &_boot_cpu_pda;
-	pda_init(0);
+	x86_64_init_pda();
 
 	early_printk("Kernel really alive\n");
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 46348e8..b7dde92 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -989,6 +989,7 @@ void xen_setup_vcpu_info_placement(void)
 
 	/* xen_vcpu_setup managed to place the vcpu_info within the
 	   percpu area for all cpus, so make use of it */
+#ifdef CONFIG_X86_32
 	if (have_vcpu_info_placement) {
 		printk(KERN_INFO "Xen: using vcpu_info placement\n");
 
@@ -998,6 +999,7 @@ void xen_setup_vcpu_info_placement(void)
 		pv_irq_ops.irq_enable = xen_irq_enable_direct;
 		pv_mmu_ops.read_cr2 = xen_read_cr2_direct;
 	}
+#endif
 }
 
 static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
@@ -1018,10 +1020,12 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
 	goto patch_site
 
 	switch (type) {
+#ifdef CONFIG_X86_32
 		SITE(pv_irq_ops, irq_enable);
 		SITE(pv_irq_ops, irq_disable);
 		SITE(pv_irq_ops, save_fl);
 		SITE(pv_irq_ops, restore_fl);
+#endif /* CONFIG_X86_32 */
 #undef SITE
 
 	patch_site:
@@ -1344,6 +1348,7 @@ asmlinkage void __init xen_start_kernel(void)
 #ifdef CONFIG_X86_64
 	/* Disable until direct per-cpu data access. */
 	have_vcpu_info_placement = 0;
+	x86_64_init_pda();
 #endif
 
 	xen_smp_init();
diff --git a/include/asm-x86/percpu.h b/include/asm-x86/percpu.h
index 912a3a1..4e91ee1 100644
--- a/include/asm-x86/percpu.h
+++ b/include/asm-x86/percpu.h
@@ -22,6 +22,32 @@
 
 DECLARE_PER_CPU(struct x8664_pda, pda);
 
+/*
+ * These are supposed to be implemented as a single instruction which
+ * operates on the per-cpu data base segment.  x86-64 doesn't have
+ * that yet, so this is a fairly inefficient workaround for the
+ * meantime.  The single instruction is atomic with respect to
+ * preemption and interrupts, so we need to explicitly disable
+ * interrupts here to achieve the same effect.  However, because it
+ * can be used from within interrupt-disable/enable, we can't actually
+ * disable interrupts; disabling preemption is enough.
+ */
+#define x86_read_percpu(var)						\
+	({								\
+		typeof(per_cpu_var(var)) __tmp;				\
+		preempt_disable();					\
+		__tmp = __get_cpu_var(var);				\
+		preempt_enable();					\
+		__tmp;							\
+	})
+
+#define x86_write_percpu(var, val)					\
+	do {								\
+		preempt_disable();					\
+		__get_cpu_var(var) = (val);				\
+		preempt_enable();					\
+	} while(0)
+
 #else /* CONFIG_X86_64 */
 
 #ifdef __ASSEMBLY__
diff --git a/include/asm-x86/setup.h b/include/asm-x86/setup.h
index 90ab222..6594926 100644
--- a/include/asm-x86/setup.h
+++ b/include/asm-x86/setup.h
@@ -76,6 +76,7 @@ extern unsigned long init_pg_tables_start;
 extern unsigned long init_pg_tables_end;
 
 #else
+void __init x86_64_init_pda(void);
 void __init x86_64_start_kernel(char *real_mode);
 void __init x86_64_start_reservations(char *real_mode_data);
 
-- 
1.5.4.1


linux-2.6-xen-0031-xen64-smp.c-compile-hacking.patch:

--- NEW FILE linux-2.6-xen-0031-xen64-smp.c-compile-hacking.patch ---
>From 511aa06867f57bf53c913fa9f05d7caae66c0ceb Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:43 -0700
Subject: [PATCH] xen64: smp.c compile hacking

A number of random changes to make xen/smp.c compile in 64-bit mode.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>a
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/setup.c   |    7 +---
 arch/x86/xen/smp.c     |   98 ++++++++++++++++++++++++++++--------------------
 arch/x86/xen/xen-ops.h |    2 -
 3 files changed, 58 insertions(+), 49 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e0a3959..f52f385 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -98,7 +98,7 @@ void xen_enable_sysenter(void)
 	/* Mask events on entry, even though they get enabled immediately */
 	static struct callback_register sysenter = {
 		.type = CALLBACKTYPE_sysenter,
-		.address = { __KERNEL_CS, (unsigned long)xen_sysenter_target },
+		.address = XEN_CALLBACK(__KERNEL_CS, xen_sysenter_target),
 		.flags = CALLBACKF_mask_events,
 	};
 
@@ -143,11 +143,6 @@ void __init xen_arch_setup(void)
 
 	pm_idle = xen_idle;
 
-#ifdef CONFIG_SMP
-	/* fill cpus_possible with all available cpus */
-	xen_fill_possible_map();
-#endif
-
 	paravirt_disable_iospace();
 
 	fiddle_vdso();
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 91fae8f..800bb21 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -66,13 +66,21 @@ static __cpuinit void cpu_bringup_and_idle(void)
 	int cpu = smp_processor_id();
 
 	cpu_init();
+	preempt_disable();
+
 	xen_enable_sysenter();
 
-	preempt_disable();
-	per_cpu(cpu_state, cpu) = CPU_ONLINE;
+	cpu = smp_processor_id();
+	smp_store_cpu_info(cpu);
+	cpu_data(cpu).x86_max_cores = 1;
+	set_cpu_sibling_map(cpu);
 
 	xen_setup_cpu_clockevents();
 
+	cpu_set(cpu, cpu_online_map);
+	x86_write_percpu(cpu_state, CPU_ONLINE);
+	wmb();
+
 	/* We can take interrupts now: we're officially "up". */
 	local_irq_enable();
 
@@ -141,7 +149,7 @@ static int xen_smp_intr_init(unsigned int cpu)
 	return rc;
 }
 
-void __init xen_fill_possible_map(void)
+static void __init xen_fill_possible_map(void)
 {
 	int i, rc;
 
@@ -154,24 +162,12 @@ void __init xen_fill_possible_map(void)
 
 static void __init xen_smp_prepare_boot_cpu(void)
 {
-	int cpu;
-
 	BUG_ON(smp_processor_id() != 0);
 	native_smp_prepare_boot_cpu();
 
 	/* We've switched to the "real" per-cpu gdt, so make sure the
 	   old memory can be recycled */
-	make_lowmem_page_readwrite(&per_cpu__gdt_page);
-
-	for_each_possible_cpu(cpu) {
-		cpus_clear(per_cpu(cpu_sibling_map, cpu));
-		/*
-		 * cpu_core_map lives in a per cpu area that is cleared
-		 * when the per cpu array is allocated.
-		 *
-		 * cpus_clear(per_cpu(cpu_core_map, cpu));
-		 */
-	}
+	make_lowmem_page_readwrite(&per_cpu_var(gdt_page));
 
 	xen_setup_vcpu_info_placement();
 }
@@ -180,17 +176,8 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
 {
 	unsigned cpu;
 
-	for_each_possible_cpu(cpu) {
-		cpus_clear(per_cpu(cpu_sibling_map, cpu));
-		/*
-		 * cpu_core_ map will be zeroed when the per
-		 * cpu area is allocated.
-		 *
-		 * cpus_clear(per_cpu(cpu_core_map, cpu));
-		 */
-	}
-
 	smp_store_cpu_info(0);
+	cpu_data(0).x86_max_cores = 1;
 	set_cpu_sibling_map(0);
 
 	if (xen_smp_intr_init(0))
@@ -225,7 +212,7 @@ static __cpuinit int
 cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
 {
 	struct vcpu_guest_context *ctxt;
-	struct gdt_page *gdt = &per_cpu(gdt_page, cpu);
+	struct desc_struct *gdt;
 
 	if (cpu_test_and_set(cpu, xen_cpu_initialized_map))
 		return 0;
@@ -234,12 +221,15 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
 	if (ctxt == NULL)
 		return -ENOMEM;
 
+	gdt = get_cpu_gdt_table(cpu);
+
 	ctxt->flags = VGCF_IN_KERNEL;
 	ctxt->user_regs.ds = __USER_DS;
 	ctxt->user_regs.es = __USER_DS;
-	ctxt->user_regs.fs = __KERNEL_PERCPU;
-	ctxt->user_regs.gs = 0;
 	ctxt->user_regs.ss = __KERNEL_DS;
+#ifdef CONFIG_X86_32
+	ctxt->user_regs.fs = __KERNEL_PERCPU;
+#endif
 	ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle;
 	ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
 
@@ -249,11 +239,11 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
 
 	ctxt->ldt_ents = 0;
 
-	BUG_ON((unsigned long)gdt->gdt & ~PAGE_MASK);
-	make_lowmem_page_readonly(gdt->gdt);
+	BUG_ON((unsigned long)gdt & ~PAGE_MASK);
+	make_lowmem_page_readonly(gdt);
 
-	ctxt->gdt_frames[0] = virt_to_mfn(gdt->gdt);
-	ctxt->gdt_ents      = ARRAY_SIZE(gdt->gdt);
+	ctxt->gdt_frames[0] = virt_to_mfn(gdt);
+	ctxt->gdt_ents      = GDT_ENTRIES;
 
 	ctxt->user_regs.cs = __KERNEL_CS;
 	ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs);
@@ -261,9 +251,11 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
 	ctxt->kernel_ss = __KERNEL_DS;
 	ctxt->kernel_sp = idle->thread.sp0;
 
+#ifdef CONFIG_X86_32
 	ctxt->event_callback_cs     = __KERNEL_CS;
-	ctxt->event_callback_eip    = (unsigned long)xen_hypervisor_callback;
 	ctxt->failsafe_callback_cs  = __KERNEL_CS;
+#endif
+	ctxt->event_callback_eip    = (unsigned long)xen_hypervisor_callback;
 	ctxt->failsafe_callback_eip = (unsigned long)xen_failsafe_callback;
 
 	per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir);
@@ -287,11 +279,28 @@ static int __cpuinit xen_cpu_up(unsigned int cpu)
 		return rc;
 #endif
 
+#ifdef CONFIG_X86_64
+	/* Allocate node local memory for AP pdas */
+	WARN_ON(cpu == 0);
+	if (cpu > 0) {
+		rc = get_local_pda(cpu);
+		if (rc)
+			return rc;
+	}
+#endif
+
+#ifdef CONFIG_X86_32
 	init_gdt(cpu);
 	per_cpu(current_task, cpu) = idle;
 	irq_ctx_init(cpu);
+#else
+	cpu_pda(cpu)->pcurrent = idle;
+	clear_tsk_thread_flag(idle, TIF_FORK);
+#endif
 	xen_setup_timer(cpu);
 
+	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
+
 	/* make sure interrupts start blocked */
 	per_cpu(xen_vcpu, cpu)->evtchn_upcall_mask = 1;
 
@@ -306,16 +315,14 @@ static int __cpuinit xen_cpu_up(unsigned int cpu)
 	if (rc)
 		return rc;
 
-	smp_store_cpu_info(cpu);
-	set_cpu_sibling_map(cpu);
-	/* This must be done before setting cpu_online_map */
-	wmb();
-
-	cpu_set(cpu, cpu_online_map);
-
 	rc = HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL);
 	BUG_ON(rc);
 
+	while(per_cpu(cpu_state, cpu) != CPU_ONLINE) {
+		HYPERVISOR_sched_op(SCHEDOP_yield, 0);
+		barrier();
+	}
+
 	return 0;
 }
 
@@ -379,7 +386,11 @@ static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id)
 {
 	irq_enter();
 	generic_smp_call_function_interrupt();
+#ifdef CONFIG_X86_32
 	__get_cpu_var(irq_stat).irq_call_count++;
+#else
+	add_pda(irq_call_count, 1);
+#endif
 	irq_exit();
 
 	return IRQ_HANDLED;
@@ -389,7 +400,11 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
 {
 	irq_enter();
 	generic_smp_call_function_single_interrupt();
+#ifdef CONFIG_X86_32
 	__get_cpu_var(irq_stat).irq_call_count++;
+#else
+	add_pda(irq_call_count, 1);
+#endif
 	irq_exit();
 
 	return IRQ_HANDLED;
@@ -411,4 +426,5 @@ static const struct smp_ops xen_smp_ops __initdata = {
 void __init xen_smp_init(void)
 {
 	smp_ops = xen_smp_ops;
+	xen_fill_possible_map();
 }
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 81a779f..aca4a78 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -44,8 +44,6 @@ bool xen_vcpu_stolen(int vcpu);
 
 void xen_mark_init_mm_pinned(void);
 
-void __init xen_fill_possible_map(void);
-
 void __init xen_setup_vcpu_info_placement(void);
 
 #ifdef CONFIG_SMP
-- 
1.5.4.1


linux-2.6-xen-0032-xen64-add-xen-head-code-to-head_64.S.patch:

--- NEW FILE linux-2.6-xen-0032-xen64-add-xen-head-code-to-head_64.S.patch ---
>From 10117d36d4a955dd371287440ac05e5314c25182 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:44 -0700
Subject: [PATCH] xen64: add xen-head code to head_64.S

Add the Xen entrypoint and ELF notes to head_64.S.  Adapts xen-head.S
to compile either 32-bit or 64-bit.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/asm-offsets_64.c |    3 +++
 arch/x86/kernel/head_64.S        |    1 +
 arch/x86/xen/xen-head.S          |   15 +++++++++++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index bacf5de..0f7e1f0 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -131,5 +131,8 @@ int main(void)
 	OFFSET(BP_loadflags, boot_params, hdr.loadflags);
 	OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
 	OFFSET(BP_version, boot_params, hdr.version);
+
+	BLANK();
+	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
 	return 0;
 }
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 4b6bda2..2240f82 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -401,6 +401,7 @@ ENTRY(phys_base)
 	/* This must match the first entry in level2_kernel_pgt */
 	.quad   0x0000000000000000
 
+#include "../../x86/xen/xen-head.S"
 	
 	.section .bss, "aw", @nobits
 	.align L1_CACHE_BYTES
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index a9cac9d..63d49a5 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -8,15 +8,21 @@
 
 #include <asm/boot.h>
 #include <asm/asm.h>
+#include <asm/page.h>
 
 #include <xen/interface/elfnote.h>
 #include <asm/xen/interface.h>
 
 	__INIT
 ENTRY(startup_xen)
-	movl %esi,xen_start_info
 	cld
-	movl $(init_thread_union+THREAD_SIZE),%esp
+#ifdef CONFIG_X86_32
+	mov %esi,xen_start_info
+	mov $init_thread_union+THREAD_SIZE,%esp
+#else
+	mov %rsi,xen_start_info
+	mov $init_thread_union+THREAD_SIZE,%rsp
+#endif
 	jmp xen_start_kernel
 
 	__FINIT
@@ -30,7 +36,11 @@ ENTRY(hypercall_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz "linux")
 	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz "2.6")
 	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz "xen-3.0")
+#ifdef CONFIG_X86_32
 	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      _ASM_PTR __PAGE_OFFSET)
+#else
+	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      _ASM_PTR __START_KERNEL_map)
+#endif
 	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          _ASM_PTR startup_xen)
 	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz "!writable_page_tables|pae_pgdir_above_4gb")
@@ -40,5 +50,6 @@ ENTRY(hypercall_page)
 		.quad _PAGE_PRESENT; .quad _PAGE_PRESENT)
 	ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
 	ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   _ASM_PTR __HYPERVISOR_VIRT_START)
+	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   _ASM_PTR 0)
 
 #endif /*CONFIG_XEN */
-- 
1.5.4.1


linux-2.6-xen-0033-xen64-add-asm-offsets.patch:

--- NEW FILE linux-2.6-xen-0033-xen64-add-asm-offsets.patch ---
>From e9ab332e87499b85c141afc87a9f464680ed5ba6 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:45 -0700
Subject: [PATCH] xen64: add asm-offsets

Add Xen vcpu_info offsets to asm-offsets_64.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/asm-offsets_64.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 0f7e1f0..aa89387 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -18,6 +18,8 @@
 #include <asm/ia32.h>
 #include <asm/bootparam.h>
 
+#include <xen/interface/xen.h>
+
 #define __NO_STUBS 1
 #undef __SYSCALL
 #undef _ASM_X86_64_UNISTD_H_
@@ -134,5 +136,11 @@ int main(void)
 
 	BLANK();
 	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
+#ifdef CONFIG_XEN
+	BLANK();
+	OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
+	OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
+#undef ENTRY
+#endif
 	return 0;
 }
-- 
1.5.4.1


linux-2.6-xen-0034-xen64-add-64-bit-assembler.patch:

--- NEW FILE linux-2.6-xen-0034-xen64-add-64-bit-assembler.patch ---
>From 204ac7e91e27f692a279e94041af918df342ff1c Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:46 -0700
Subject: [PATCH] xen64: add 64-bit assembler

Split xen-asm into 32- and 64-bit files, and implement the 64-bit
variants.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/Makefile     |    2 +-
 arch/x86/xen/xen-asm.S    |  305 ---------------------------------------------
 arch/x86/xen/xen-asm_32.S |  305 +++++++++++++++++++++++++++++++++++++++++++++
 arch/x86/xen/xen-asm_64.S |  141 +++++++++++++++++++++
 4 files changed, 447 insertions(+), 306 deletions(-)
 delete mode 100644 arch/x86/xen/xen-asm.S
 create mode 100644 arch/x86/xen/xen-asm_32.S
 create mode 100644 arch/x86/xen/xen-asm_64.S

diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 2ba2d16..59c1e53 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -1,4 +1,4 @@
 obj-y		:= enlighten.o setup.o multicalls.o mmu.o \
-			time.o xen-asm.o grant-table.o suspend.o
+			time.o xen-asm_$(BITS).o grant-table.o suspend.o
 
 obj-$(CONFIG_SMP)	+= smp.o
diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S
deleted file mode 100644
index 2497a30..0000000
--- a/arch/x86/xen/xen-asm.S
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
-	Asm versions of Xen pv-ops, suitable for either direct use or inlining.
-	The inline versions are the same as the direct-use versions, with the
-	pre- and post-amble chopped off.
-
-	This code is encoded for size rather than absolute efficiency,
-	with a view to being able to inline as much as possible.
-
-	We only bother with direct forms (ie, vcpu in pda) of the operations
-	here; the indirect forms are better handled in C, since they're
-	generally too large to inline anyway.
- */
-
-#include <linux/linkage.h>
-
-#include <asm/asm-offsets.h>
-#include <asm/thread_info.h>
-#include <asm/percpu.h>
-#include <asm/processor-flags.h>
-#include <asm/segment.h>
-
-#include <xen/interface/xen.h>
-
-#define RELOC(x, v)	.globl x##_reloc; x##_reloc=v
-#define ENDPATCH(x)	.globl x##_end; x##_end=.
-
-/* Pseudo-flag used for virtual NMI, which we don't implement yet */
-#define XEN_EFLAGS_NMI	0x80000000
-
-/*
-	Enable events.  This clears the event mask and tests the pending
-	event status with one and operation.  If there are pending
-	events, then enter the hypervisor to get them handled.
- */
-ENTRY(xen_irq_enable_direct)
-	/* Unmask events */
-	movb $0, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
-
-	/* Preempt here doesn't matter because that will deal with
-	   any pending interrupts.  The pending check may end up being
-	   run on the wrong CPU, but that doesn't hurt. */
-
-	/* Test for pending */
-	testb $0xff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending
-	jz 1f
-
-2:	call check_events
-1:
-ENDPATCH(xen_irq_enable_direct)
-	ret
-	ENDPROC(xen_irq_enable_direct)
-	RELOC(xen_irq_enable_direct, 2b+1)
-
-
-/*
-	Disabling events is simply a matter of making the event mask
-	non-zero.
- */
-ENTRY(xen_irq_disable_direct)
-	movb $1, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
-ENDPATCH(xen_irq_disable_direct)
-	ret
-	ENDPROC(xen_irq_disable_direct)
-	RELOC(xen_irq_disable_direct, 0)
-
-/*
-	(xen_)save_fl is used to get the current interrupt enable status.
-	Callers expect the status to be in X86_EFLAGS_IF, and other bits
-	may be set in the return value.  We take advantage of this by
-	making sure that X86_EFLAGS_IF has the right value (and other bits
-	in that byte are 0), but other bits in the return value are
-	undefined.  We need to toggle the state of the bit, because
-	Xen and x86 use opposite senses (mask vs enable).
- */
-ENTRY(xen_save_fl_direct)
-	testb $0xff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
-	setz %ah
-	addb %ah,%ah
-ENDPATCH(xen_save_fl_direct)
-	ret
-	ENDPROC(xen_save_fl_direct)
-	RELOC(xen_save_fl_direct, 0)
-
-
-/*
-	In principle the caller should be passing us a value return
-	from xen_save_fl_direct, but for robustness sake we test only
-	the X86_EFLAGS_IF flag rather than the whole byte. After
-	setting the interrupt mask state, it checks for unmasked
-	pending events and enters the hypervisor to get them delivered
-	if so.
- */
-ENTRY(xen_restore_fl_direct)
-	testb $X86_EFLAGS_IF>>8, %ah
-	setz PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
-	/* Preempt here doesn't matter because that will deal with
-	   any pending interrupts.  The pending check may end up being
-	   run on the wrong CPU, but that doesn't hurt. */
-
-	/* check for unmasked and pending */
-	cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending
-	jz 1f
-2:	call check_events
-1:
-ENDPATCH(xen_restore_fl_direct)
-	ret
-	ENDPROC(xen_restore_fl_direct)
-	RELOC(xen_restore_fl_direct, 2b+1)
-
-/*
-	We can't use sysexit directly, because we're not running in ring0.
-	But we can easily fake it up using iret.  Assuming xen_sysexit
-	is jumped to with a standard stack frame, we can just strip it
-	back to a standard iret frame and use iret.
- */
-ENTRY(xen_sysexit)
-	movl PT_EAX(%esp), %eax			/* Shouldn't be necessary? */
-	orl $X86_EFLAGS_IF, PT_EFLAGS(%esp)
-	lea PT_EIP(%esp), %esp
-
-	jmp xen_iret
-ENDPROC(xen_sysexit)
-
-/*
-	This is run where a normal iret would be run, with the same stack setup:
-	      8: eflags
-	      4: cs
-	esp-> 0: eip
-
-	This attempts to make sure that any pending events are dealt
-	with on return to usermode, but there is a small window in
-	which an event can happen just before entering usermode.  If
-	the nested interrupt ends up setting one of the TIF_WORK_MASK
-	pending work flags, they will not be tested again before
-	returning to usermode. This means that a process can end up
-	with pending work, which will be unprocessed until the process
-	enters and leaves the kernel again, which could be an
-	unbounded amount of time.  This means that a pending signal or
-	reschedule event could be indefinitely delayed.
-
-	The fix is to notice a nested interrupt in the critical
-	window, and if one occurs, then fold the nested interrupt into
-	the current interrupt stack frame, and re-process it
-	iteratively rather than recursively.  This means that it will
-	exit via the normal path, and all pending work will be dealt
-	with appropriately.
-
-	Because the nested interrupt handler needs to deal with the
-	current stack state in whatever form its in, we keep things
-	simple by only using a single register which is pushed/popped
-	on the stack.
- */
-ENTRY(xen_iret)
-	/* test eflags for special cases */
-	testl $(X86_EFLAGS_VM | XEN_EFLAGS_NMI), 8(%esp)
-	jnz hyper_iret
-
-	push %eax
-	ESP_OFFSET=4	# bytes pushed onto stack
-
-	/* Store vcpu_info pointer for easy access.  Do it this
-	   way to avoid having to reload %fs */
-#ifdef CONFIG_SMP
-	GET_THREAD_INFO(%eax)
-	movl TI_cpu(%eax),%eax
-	movl __per_cpu_offset(,%eax,4),%eax
-	mov per_cpu__xen_vcpu(%eax),%eax
-#else
-	movl per_cpu__xen_vcpu, %eax
-#endif
-
-	/* check IF state we're restoring */
-	testb $X86_EFLAGS_IF>>8, 8+1+ESP_OFFSET(%esp)
-
-	/* Maybe enable events.  Once this happens we could get a
-	   recursive event, so the critical region starts immediately
-	   afterwards.  However, if that happens we don't end up
-	   resuming the code, so we don't have to be worried about
-	   being preempted to another CPU. */
-	setz XEN_vcpu_info_mask(%eax)
-xen_iret_start_crit:
-
-	/* check for unmasked and pending */
-	cmpw $0x0001, XEN_vcpu_info_pending(%eax)
-
-	/* If there's something pending, mask events again so we
-	   can jump back into xen_hypervisor_callback */
-	sete XEN_vcpu_info_mask(%eax)
-
-	popl %eax
-
-	/* From this point on the registers are restored and the stack
-	   updated, so we don't need to worry about it if we're preempted */
-iret_restore_end:
-
-	/* Jump to hypervisor_callback after fixing up the stack.
-	   Events are masked, so jumping out of the critical
-	   region is OK. */
-	je xen_hypervisor_callback
-
-1:	iret
-xen_iret_end_crit:
-.section __ex_table,"a"
-	.align 4
-	.long 1b,iret_exc
-.previous
-
-hyper_iret:
-	/* put this out of line since its very rarely used */
-	jmp hypercall_page + __HYPERVISOR_iret * 32
-
-	.globl xen_iret_start_crit, xen_iret_end_crit
-
-/*
-   This is called by xen_hypervisor_callback in entry.S when it sees
-   that the EIP at the time of interrupt was between xen_iret_start_crit
-   and xen_iret_end_crit.  We're passed the EIP in %eax so we can do
-   a more refined determination of what to do.
-
-   The stack format at this point is:
-	----------------
-	 ss		: (ss/esp may be present if we came from usermode)
-	 esp		:
-	 eflags		}  outer exception info
-	 cs		}
-	 eip		}
-	---------------- <- edi (copy dest)
-	 eax		:  outer eax if it hasn't been restored
-	----------------
-	 eflags		}  nested exception info
-	 cs		}   (no ss/esp because we're nested
-	 eip		}    from the same ring)
-	 orig_eax	}<- esi (copy src)
-	 - - - - - - - -
-	 fs		}
-	 es		}
-	 ds		}  SAVE_ALL state
-	 eax		}
-	  :		:
-	 ebx		}<- esp
-	----------------
-
-   In order to deliver the nested exception properly, we need to shift
-   everything from the return addr up to the error code so it
-   sits just under the outer exception info.  This means that when we
-   handle the exception, we do it in the context of the outer exception
-   rather than starting a new one.
-
-   The only caveat is that if the outer eax hasn't been
-   restored yet (ie, it's still on stack), we need to insert
-   its value into the SAVE_ALL state before going on, since
-   it's usermode state which we eventually need to restore.
- */
-ENTRY(xen_iret_crit_fixup)
-	/*
-	   Paranoia: Make sure we're really coming from kernel space.
-	   One could imagine a case where userspace jumps into the
-	   critical range address, but just before the CPU delivers a GP,
-	   it decides to deliver an interrupt instead.  Unlikely?
-	   Definitely.  Easy to avoid?  Yes.  The Intel documents
-	   explicitly say that the reported EIP for a bad jump is the
-	   jump instruction itself, not the destination, but some virtual
-	   environments get this wrong.
-	 */
-	movl PT_CS(%esp), %ecx
-	andl $SEGMENT_RPL_MASK, %ecx
-	cmpl $USER_RPL, %ecx
-	je 2f
-
-	lea PT_ORIG_EAX(%esp), %esi
-	lea PT_EFLAGS(%esp), %edi
-
-	/* If eip is before iret_restore_end then stack
-	   hasn't been restored yet. */
-	cmp $iret_restore_end, %eax
-	jae 1f
-
-	movl 0+4(%edi),%eax		/* copy EAX (just above top of frame) */
-	movl %eax, PT_EAX(%esp)
-
-	lea ESP_OFFSET(%edi),%edi	/* move dest up over saved regs */
-
-	/* set up the copy */
-1:	std
-	mov $PT_EIP / 4, %ecx		/* saved regs up to orig_eax */
-	rep movsl
-	cld
-
-	lea 4(%edi),%esp		/* point esp to new frame */
-2:	jmp xen_do_upcall
-
-
-/*
-	Force an event check by making a hypercall,
-	but preserve regs before making the call.
- */
-check_events:
-	push %eax
-	push %ecx
-	push %edx
-	call force_evtchn_callback
-	pop %edx
-	pop %ecx
-	pop %eax
-	ret
diff --git a/arch/x86/xen/xen-asm_32.S b/arch/x86/xen/xen-asm_32.S
new file mode 100644
index 0000000..2497a30
--- /dev/null
+++ b/arch/x86/xen/xen-asm_32.S
@@ -0,0 +1,305 @@
+/*
+	Asm versions of Xen pv-ops, suitable for either direct use or inlining.
+	The inline versions are the same as the direct-use versions, with the
+	pre- and post-amble chopped off.
+
+	This code is encoded for size rather than absolute efficiency,
+	with a view to being able to inline as much as possible.
+
+	We only bother with direct forms (ie, vcpu in pda) of the operations
+	here; the indirect forms are better handled in C, since they're
+	generally too large to inline anyway.
+ */
+
+#include <linux/linkage.h>
+
+#include <asm/asm-offsets.h>
+#include <asm/thread_info.h>
+#include <asm/percpu.h>
+#include <asm/processor-flags.h>
+#include <asm/segment.h>
+
+#include <xen/interface/xen.h>
+
+#define RELOC(x, v)	.globl x##_reloc; x##_reloc=v
+#define ENDPATCH(x)	.globl x##_end; x##_end=.
+
+/* Pseudo-flag used for virtual NMI, which we don't implement yet */
+#define XEN_EFLAGS_NMI	0x80000000
+
+/*
+	Enable events.  This clears the event mask and tests the pending
+	event status with one and operation.  If there are pending
+	events, then enter the hypervisor to get them handled.
+ */
+ENTRY(xen_irq_enable_direct)
+	/* Unmask events */
+	movb $0, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
+
+	/* Preempt here doesn't matter because that will deal with
+	   any pending interrupts.  The pending check may end up being
+	   run on the wrong CPU, but that doesn't hurt. */
+
+	/* Test for pending */
+	testb $0xff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending
+	jz 1f
+
+2:	call check_events
+1:
+ENDPATCH(xen_irq_enable_direct)
+	ret
+	ENDPROC(xen_irq_enable_direct)
+	RELOC(xen_irq_enable_direct, 2b+1)
+
+
+/*
+	Disabling events is simply a matter of making the event mask
+	non-zero.
+ */
+ENTRY(xen_irq_disable_direct)
+	movb $1, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
+ENDPATCH(xen_irq_disable_direct)
+	ret
+	ENDPROC(xen_irq_disable_direct)
+	RELOC(xen_irq_disable_direct, 0)
+
+/*
+	(xen_)save_fl is used to get the current interrupt enable status.
+	Callers expect the status to be in X86_EFLAGS_IF, and other bits
+	may be set in the return value.  We take advantage of this by
+	making sure that X86_EFLAGS_IF has the right value (and other bits
+	in that byte are 0), but other bits in the return value are
+	undefined.  We need to toggle the state of the bit, because
+	Xen and x86 use opposite senses (mask vs enable).
+ */
+ENTRY(xen_save_fl_direct)
+	testb $0xff, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
+	setz %ah
+	addb %ah,%ah
+ENDPATCH(xen_save_fl_direct)
+	ret
+	ENDPROC(xen_save_fl_direct)
+	RELOC(xen_save_fl_direct, 0)
+
+
+/*
+	In principle the caller should be passing us a value return
+	from xen_save_fl_direct, but for robustness sake we test only
+	the X86_EFLAGS_IF flag rather than the whole byte. After
+	setting the interrupt mask state, it checks for unmasked
+	pending events and enters the hypervisor to get them delivered
+	if so.
+ */
+ENTRY(xen_restore_fl_direct)
+	testb $X86_EFLAGS_IF>>8, %ah
+	setz PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_mask
+	/* Preempt here doesn't matter because that will deal with
+	   any pending interrupts.  The pending check may end up being
+	   run on the wrong CPU, but that doesn't hurt. */
+
+	/* check for unmasked and pending */
+	cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info)+XEN_vcpu_info_pending
+	jz 1f
+2:	call check_events
+1:
+ENDPATCH(xen_restore_fl_direct)
+	ret
+	ENDPROC(xen_restore_fl_direct)
+	RELOC(xen_restore_fl_direct, 2b+1)
+
+/*
+	We can't use sysexit directly, because we're not running in ring0.
+	But we can easily fake it up using iret.  Assuming xen_sysexit
+	is jumped to with a standard stack frame, we can just strip it
+	back to a standard iret frame and use iret.
+ */
+ENTRY(xen_sysexit)
+	movl PT_EAX(%esp), %eax			/* Shouldn't be necessary? */
+	orl $X86_EFLAGS_IF, PT_EFLAGS(%esp)
+	lea PT_EIP(%esp), %esp
+
+	jmp xen_iret
+ENDPROC(xen_sysexit)
+
+/*
+	This is run where a normal iret would be run, with the same stack setup:
+	      8: eflags
+	      4: cs
+	esp-> 0: eip
+
+	This attempts to make sure that any pending events are dealt
+	with on return to usermode, but there is a small window in
+	which an event can happen just before entering usermode.  If
+	the nested interrupt ends up setting one of the TIF_WORK_MASK
+	pending work flags, they will not be tested again before
+	returning to usermode. This means that a process can end up
+	with pending work, which will be unprocessed until the process
+	enters and leaves the kernel again, which could be an
+	unbounded amount of time.  This means that a pending signal or
+	reschedule event could be indefinitely delayed.
+
+	The fix is to notice a nested interrupt in the critical
+	window, and if one occurs, then fold the nested interrupt into
+	the current interrupt stack frame, and re-process it
+	iteratively rather than recursively.  This means that it will
+	exit via the normal path, and all pending work will be dealt
+	with appropriately.
+
+	Because the nested interrupt handler needs to deal with the
+	current stack state in whatever form its in, we keep things
+	simple by only using a single register which is pushed/popped
+	on the stack.
+ */
+ENTRY(xen_iret)
+	/* test eflags for special cases */
+	testl $(X86_EFLAGS_VM | XEN_EFLAGS_NMI), 8(%esp)
+	jnz hyper_iret
+
+	push %eax
+	ESP_OFFSET=4	# bytes pushed onto stack
+
+	/* Store vcpu_info pointer for easy access.  Do it this
+	   way to avoid having to reload %fs */
+#ifdef CONFIG_SMP
+	GET_THREAD_INFO(%eax)
+	movl TI_cpu(%eax),%eax
+	movl __per_cpu_offset(,%eax,4),%eax
+	mov per_cpu__xen_vcpu(%eax),%eax
+#else
+	movl per_cpu__xen_vcpu, %eax
+#endif
+
+	/* check IF state we're restoring */
+	testb $X86_EFLAGS_IF>>8, 8+1+ESP_OFFSET(%esp)
+
+	/* Maybe enable events.  Once this happens we could get a
+	   recursive event, so the critical region starts immediately
+	   afterwards.  However, if that happens we don't end up
+	   resuming the code, so we don't have to be worried about
+	   being preempted to another CPU. */
+	setz XEN_vcpu_info_mask(%eax)
+xen_iret_start_crit:
+
+	/* check for unmasked and pending */
+	cmpw $0x0001, XEN_vcpu_info_pending(%eax)
+
+	/* If there's something pending, mask events again so we
+	   can jump back into xen_hypervisor_callback */
+	sete XEN_vcpu_info_mask(%eax)
+
+	popl %eax
+
+	/* From this point on the registers are restored and the stack
+	   updated, so we don't need to worry about it if we're preempted */
+iret_restore_end:
+
+	/* Jump to hypervisor_callback after fixing up the stack.
+	   Events are masked, so jumping out of the critical
+	   region is OK. */
+	je xen_hypervisor_callback
+
+1:	iret
+xen_iret_end_crit:
+.section __ex_table,"a"
+	.align 4
+	.long 1b,iret_exc
+.previous
+
+hyper_iret:
+	/* put this out of line since its very rarely used */
+	jmp hypercall_page + __HYPERVISOR_iret * 32
+
+	.globl xen_iret_start_crit, xen_iret_end_crit
+
+/*
+   This is called by xen_hypervisor_callback in entry.S when it sees
+   that the EIP at the time of interrupt was between xen_iret_start_crit
+   and xen_iret_end_crit.  We're passed the EIP in %eax so we can do
+   a more refined determination of what to do.
+
+   The stack format at this point is:
+	----------------
+	 ss		: (ss/esp may be present if we came from usermode)
+	 esp		:
+	 eflags		}  outer exception info
+	 cs		}
+	 eip		}
+	---------------- <- edi (copy dest)
+	 eax		:  outer eax if it hasn't been restored
+	----------------
+	 eflags		}  nested exception info
+	 cs		}   (no ss/esp because we're nested
+	 eip		}    from the same ring)
+	 orig_eax	}<- esi (copy src)
+	 - - - - - - - -
+	 fs		}
+	 es		}
+	 ds		}  SAVE_ALL state
+	 eax		}
+	  :		:
+	 ebx		}<- esp
+	----------------
+
+   In order to deliver the nested exception properly, we need to shift
+   everything from the return addr up to the error code so it
+   sits just under the outer exception info.  This means that when we
+   handle the exception, we do it in the context of the outer exception
+   rather than starting a new one.
+
+   The only caveat is that if the outer eax hasn't been
+   restored yet (ie, it's still on stack), we need to insert
+   its value into the SAVE_ALL state before going on, since
+   it's usermode state which we eventually need to restore.
+ */
+ENTRY(xen_iret_crit_fixup)
+	/*
+	   Paranoia: Make sure we're really coming from kernel space.
+	   One could imagine a case where userspace jumps into the
+	   critical range address, but just before the CPU delivers a GP,
+	   it decides to deliver an interrupt instead.  Unlikely?
+	   Definitely.  Easy to avoid?  Yes.  The Intel documents
+	   explicitly say that the reported EIP for a bad jump is the
+	   jump instruction itself, not the destination, but some virtual
+	   environments get this wrong.
+	 */
+	movl PT_CS(%esp), %ecx
+	andl $SEGMENT_RPL_MASK, %ecx
+	cmpl $USER_RPL, %ecx
+	je 2f
+
+	lea PT_ORIG_EAX(%esp), %esi
+	lea PT_EFLAGS(%esp), %edi
+
+	/* If eip is before iret_restore_end then stack
+	   hasn't been restored yet. */
+	cmp $iret_restore_end, %eax
+	jae 1f
+
+	movl 0+4(%edi),%eax		/* copy EAX (just above top of frame) */
+	movl %eax, PT_EAX(%esp)
+
+	lea ESP_OFFSET(%edi),%edi	/* move dest up over saved regs */
+
+	/* set up the copy */
+1:	std
+	mov $PT_EIP / 4, %ecx		/* saved regs up to orig_eax */
+	rep movsl
+	cld
+
+	lea 4(%edi),%esp		/* point esp to new frame */
+2:	jmp xen_do_upcall
+
+
+/*
+	Force an event check by making a hypercall,
+	but preserve regs before making the call.
+ */
+check_events:
+	push %eax
+	push %ecx
+	push %edx
+	call force_evtchn_callback
+	pop %edx
+	pop %ecx
+	pop %eax
+	ret
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
new file mode 100644
index 0000000..4ec1082
--- /dev/null
+++ b/arch/x86/xen/xen-asm_64.S
@@ -0,0 +1,141 @@
+/*
+	Asm versions of Xen pv-ops, suitable for either direct use or inlining.
+	The inline versions are the same as the direct-use versions, with the
+	pre- and post-amble chopped off.
+
+	This code is encoded for size rather than absolute efficiency,
+	with a view to being able to inline as much as possible.
+
+	We only bother with direct forms (ie, vcpu in pda) of the operations
+	here; the indirect forms are better handled in C, since they're
+	generally too large to inline anyway.
+ */
+
+#include <linux/linkage.h>
+
+#include <asm/asm-offsets.h>
+#include <asm/processor-flags.h>
+
+#include <xen/interface/xen.h>
+
+#define RELOC(x, v)	.globl x##_reloc; x##_reloc=v
+#define ENDPATCH(x)	.globl x##_end; x##_end=.
+
+/* Pseudo-flag used for virtual NMI, which we don't implement yet */
+#define XEN_EFLAGS_NMI	0x80000000
+
+#if 0
+#include <asm/percpu.h>
+
+/*
+	Enable events.  This clears the event mask and tests the pending
+	event status with one and operation.  If there are pending
+	events, then enter the hypervisor to get them handled.
+ */
+ENTRY(xen_irq_enable_direct)
+	/* Unmask events */
+	movb $0, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask)
+
+	/* Preempt here doesn't matter because that will deal with
+	   any pending interrupts.  The pending check may end up being
+	   run on the wrong CPU, but that doesn't hurt. */
+
+	/* Test for pending */
+	testb $0xff, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_pending)
+	jz 1f
+
+2:	call check_events
+1:
+ENDPATCH(xen_irq_enable_direct)
+	ret
+	ENDPROC(xen_irq_enable_direct)
+	RELOC(xen_irq_enable_direct, 2b+1)
+
+/*
+	Disabling events is simply a matter of making the event mask
+	non-zero.
+ */
+ENTRY(xen_irq_disable_direct)
+	movb $1, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask)
+ENDPATCH(xen_irq_disable_direct)
+	ret
+	ENDPROC(xen_irq_disable_direct)
+	RELOC(xen_irq_disable_direct, 0)
+
+/*
+	(xen_)save_fl is used to get the current interrupt enable status.
+	Callers expect the status to be in X86_EFLAGS_IF, and other bits
+	may be set in the return value.  We take advantage of this by
+	making sure that X86_EFLAGS_IF has the right value (and other bits
+	in that byte are 0), but other bits in the return value are
+	undefined.  We need to toggle the state of the bit, because
+	Xen and x86 use opposite senses (mask vs enable).
+ */
+ENTRY(xen_save_fl_direct)
+	testb $0xff, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask)
+	setz %ah
+	addb %ah,%ah
+ENDPATCH(xen_save_fl_direct)
+	ret
+	ENDPROC(xen_save_fl_direct)
+	RELOC(xen_save_fl_direct, 0)
+
+/*
+	In principle the caller should be passing us a value return
+	from xen_save_fl_direct, but for robustness sake we test only
+	the X86_EFLAGS_IF flag rather than the whole byte. After
+	setting the interrupt mask state, it checks for unmasked
+	pending events and enters the hypervisor to get them delivered
+	if so.
+ */
+ENTRY(xen_restore_fl_direct)
+	testb $X86_EFLAGS_IF>>8, %ah
+	setz PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_mask)
+	/* Preempt here doesn't matter because that will deal with
+	   any pending interrupts.  The pending check may end up being
+	   run on the wrong CPU, but that doesn't hurt. */
+
+	/* check for unmasked and pending */
+	cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info, XEN_vcpu_info_pending)
+	jz 1f
+2:	call check_events
+1:
+ENDPATCH(xen_restore_fl_direct)
+	ret
+	ENDPROC(xen_restore_fl_direct)
+	RELOC(xen_restore_fl_direct, 2b+1)
+
+
+/*
+	Force an event check by making a hypercall,
+	but preserve regs before making the call.
+ */
+check_events:
+	push %rax
+	push %rcx
+	push %rdx
+	push %rsi
+	push %rdi
+	push %r8
+	push %r9
+	push %r10
+	push %r11
+	call force_evtchn_callback
+	pop %r11
+	pop %r10
+	pop %r9
+	pop %r8
+	pop %rdi
+	pop %rsi
+	pop %rdx
+	pop %rcx
+	pop %rax
+	ret
+#endif
+
+ENTRY(xen_iret)
+	pushq $0
+	jmp hypercall_page + __HYPERVISOR_iret * 32
+
+ENTRY(xen_sysexit)
+	ud2a
-- 
1.5.4.1


linux-2.6-xen-0035-xen64-use-set_fixmap-for-shared_info-structure.patch:

--- NEW FILE linux-2.6-xen-0035-xen64-use-set_fixmap-for-shared_info-structure.patch ---
>From 2353cb096f5f12979c63b20f2c0ac3ba73d9b431 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:47 -0700
Subject: [PATCH] xen64: use set_fixmap for shared_info structure

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index b7dde92..50092fa 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -920,18 +920,11 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
 void xen_setup_shared_info(void)
 {
 	if (!xen_feature(XENFEAT_auto_translated_physmap)) {
-		unsigned long addr = fix_to_virt(FIX_PARAVIRT_BOOTMAP);
-
-		/*
-		 * Create a mapping for the shared info page.
-		 * Should be set_fixmap(), but shared_info is a machine
-		 * address with no corresponding pseudo-phys address.
-		 */
-		set_pte_mfn(addr,
-			    PFN_DOWN(xen_start_info->shared_info),
-			    PAGE_KERNEL);
-
-		HYPERVISOR_shared_info = (struct shared_info *)addr;
+		set_fixmap(FIX_PARAVIRT_BOOTMAP,
+			   xen_start_info->shared_info);
+
+		HYPERVISOR_shared_info =
+			(struct shared_info *)fix_to_virt(FIX_PARAVIRT_BOOTMAP);
 	} else
 		HYPERVISOR_shared_info =
 			(struct shared_info *)__va(xen_start_info->shared_info);
@@ -1068,8 +1061,13 @@ static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
 #ifdef CONFIG_X86_F00F_BUG
 	case FIX_F00F_IDT:
 #endif
+#ifdef CONFIG_X86_32
 	case FIX_WP_TEST:
 	case FIX_VDSO:
+	case FIX_KMAP_BEGIN ... FIX_KMAP_END:
+#else
+	case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE:
+#endif
 #ifdef CONFIG_X86_LOCAL_APIC
 	case FIX_APIC_BASE:	/* maps dummy local APIC */
 #endif
-- 
1.5.4.1


linux-2.6-xen-0036-xen-cpu_detect-is-32-bit-only.patch:

--- NEW FILE linux-2.6-xen-0036-xen-cpu_detect-is-32-bit-only.patch ---
>From b8c895e9ca5e787e6782d4af1d1ea89775940330 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:48 -0700
Subject: [PATCH] xen: cpu_detect is 32-bit only

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 50092fa..c420697 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1386,12 +1386,12 @@ asmlinkage void __init xen_start_kernel(void)
 	/* set the limit of our address space */
 	xen_reserve_top();
 
+#ifdef CONFIG_X86_32
 	/* set up basic CPUID stuff */
 	cpu_detect(&new_cpu_data);
-#ifdef CONFIG_X86_32
 	new_cpu_data.hard_math = 1;
-#endif
 	new_cpu_data.x86_capability[0] = cpuid_edx(1);
+#endif
 
 	/* Poke various useful things into boot_params */
 	boot_params.hdr.type_of_loader = (9 << 4) | 0;
-- 
1.5.4.1


linux-2.6-xen-0037-xen64-add-hypervisor-callbacks-for-events-etc.patch:

--- NEW FILE linux-2.6-xen-0037-xen64-add-hypervisor-callbacks-for-events-etc.patch ---
>From 75d6eb01b579e6b5e34dc6b79d88b44f7075be30 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:49 -0700
Subject: [PATCH] xen64: add hypervisor callbacks for events, etc

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/entry_64.S |   98 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index ae63e58..7cc2de7 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1312,3 +1312,101 @@ KPROBE_ENTRY(ignore_sysret)
 	sysret
 	CFI_ENDPROC
 ENDPROC(ignore_sysret)
+
+#ifdef CONFIG_XEN
+ENTRY(xen_hypervisor_callback)
+	zeroentry xen_do_hypervisor_callback
+END(xen_hypervisor_callback)
+
+/*
+# A note on the "critical region" in our callback handler.
+# We want to avoid stacking callback handlers due to events occurring
+# during handling of the last event. To do this, we keep events disabled
+# until we've done all processing. HOWEVER, we must enable events before
+# popping the stack frame (can't be done atomically) and so it would still
+# be possible to get enough handler activations to overflow the stack.
+# Although unlikely, bugs of that kind are hard to track down, so we'd
+# like to avoid the possibility.
+# So, on entry to the handler we detect whether we interrupted an
+# existing activation in its critical region -- if so, we pop the current
+# activation and restart the handler using the previous one.
+*/
+ENTRY(xen_do_hypervisor_callback)   # do_hypervisor_callback(struct *pt_regs)
+	CFI_STARTPROC
+/* Since we don't modify %rdi, evtchn_do_upall(struct *pt_regs) will
+   see the correct pointer to the pt_regs */
+	movq %rdi, %rsp            # we don't return, adjust the stack frame
+	CFI_ENDPROC
+	CFI_DEFAULT_STACK
+11:	incl %gs:pda_irqcount
+	movq %rsp,%rbp
+	CFI_DEF_CFA_REGISTER rbp
+	cmovzq %gs:pda_irqstackptr,%rsp
+	pushq %rbp			# backlink for old unwinder
+	call xen_evtchn_do_upcall
+	popq %rsp
+	CFI_DEF_CFA_REGISTER rsp
+	decl %gs:pda_irqcount
+	jmp  error_exit
+	CFI_ENDPROC
+END(do_hypervisor_callback)
+
+/*
+# Hypervisor uses this for application faults while it executes.
+# We get here for two reasons:
+#  1. Fault while reloading DS, ES, FS or GS
+#  2. Fault while executing IRET
+# Category 1 we do not need to fix up as Xen has already reloaded all segment
+# registers that could be reloaded and zeroed the others.
+# Category 2 we fix up by killing the current process. We cannot use the
+# normal Linux return path in this case because if we use the IRET hypercall
+# to pop the stack frame we end up in an infinite loop of failsafe callbacks.
+# We distinguish between categories by comparing each saved segment register
+# with its current contents: any discrepancy means we in category 1.
+*/
+ENTRY(xen_failsafe_callback)
+#if 1
+	ud2a
+#else
+	_frame (RIP-0x30)
+	CFI_REL_OFFSET rcx, 0
+	CFI_REL_OFFSET r11, 8
+	movw %ds,%cx
+	cmpw %cx,0x10(%rsp)
+	CFI_REMEMBER_STATE
+	jne 1f
+	movw %es,%cx
+	cmpw %cx,0x18(%rsp)
+	jne 1f
+	movw %fs,%cx
+	cmpw %cx,0x20(%rsp)
+	jne 1f
+	movw %gs,%cx
+	cmpw %cx,0x28(%rsp)
+	jne 1f
+	/* All segments match their saved values => Category 2 (Bad IRET). */
+	movq (%rsp),%rcx
+	CFI_RESTORE rcx
+	movq 8(%rsp),%r11
+	CFI_RESTORE r11
+	addq $0x30,%rsp
+	CFI_ADJUST_CFA_OFFSET -0x30
+	movq $11,%rdi	/* SIGSEGV */
+	jmp do_exit
+	CFI_RESTORE_STATE
+1:	/* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */
+	movq (%rsp),%rcx
+	CFI_RESTORE rcx
+	movq 8(%rsp),%r11
+	CFI_RESTORE r11
+	addq $0x30,%rsp
+	CFI_ADJUST_CFA_OFFSET -0x30
+	pushq $0
+	CFI_ADJUST_CFA_OFFSET 8
+	SAVE_ALL
+	jmp error_exit
+	CFI_ENDPROC
+#endif
+END(xen_failsafe_callback)
+
+#endif /* CONFIG_XEN */
-- 
1.5.4.1


linux-2.6-xen-0038-xen64-early-mapping-setup.patch:

--- NEW FILE linux-2.6-xen-0038-xen64-early-mapping-setup.patch ---
>From 7f85fc54fc45fed6c96cb749df5e3f7427262c10 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:50 -0700
Subject: [PATCH] xen64: early mapping setup

Set up the initial pagetables to map the kernel mapping into the
physical mapping space.  This makes __va() usable, since it requires
physical mappings.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c     |  192 ++++++++++++++++++++++++++++++++++++++----
 include/asm-x86/pgtable_64.h |    2 +
 2 files changed, 178 insertions(+), 16 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c420697..60e3a28 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -33,6 +33,7 @@
 #include <xen/interface/sched.h>
 #include <xen/features.h>
 #include <xen/page.h>
+#include <xen/hvc-console.h>
 
 #include <asm/paravirt.h>
 #include <asm/page.h>
@@ -1315,6 +1316,157 @@ static void __init xen_reserve_top(void)
 #endif	/* CONFIG_X86_32 */
 }
 
+#ifdef CONFIG_X86_64
+/*
+ * Like __va(), but returns address in the kernel mapping (which is
+ * all we have until the physical memory mapping has been set up.
+ */
+static void *__ka(phys_addr_t paddr)
+{
+	return (void *)(paddr + __START_KERNEL_map);
+}
+
+/* Convert a machine address to physical address */
+static unsigned long m2p(phys_addr_t maddr)
+{
+	phys_addr_t paddr;
+
+	maddr &= PTE_MASK;
+	paddr = mfn_to_pfn(maddr >> PAGE_SHIFT) << PAGE_SHIFT;
+
+	return paddr;
+}
+
+/* Convert a machine address to kernel virtual */
+static void *m2v(phys_addr_t maddr)
+{
+	return __ka(m2p(maddr));
+}
+
+static void walk(pgd_t *pgd, unsigned long addr)
+{
+	unsigned l4idx = pgd_index(addr);
+	unsigned l3idx = pud_index(addr);
+	unsigned l2idx = pmd_index(addr);
+	unsigned l1idx = pte_index(addr);
+	pgd_t l4;
+	pud_t l3;
+	pmd_t l2;
+	pte_t l1;
+
+	xen_raw_printk("walk %p, %lx -> %d %d %d %d\n",
+		       pgd, addr, l4idx, l3idx, l2idx, l1idx);
+
+	l4 = pgd[l4idx];
+	xen_raw_printk("  l4: %016lx\n", l4.pgd);
+	xen_raw_printk("      %016lx\n", pgd_val(l4));
+
+	l3 = ((pud_t *)(m2v(l4.pgd)))[l3idx];
+	xen_raw_printk("  l3: %016lx\n", l3.pud);
+	xen_raw_printk("      %016lx\n", pud_val(l3));
+
+	l2 = ((pmd_t *)(m2v(l3.pud)))[l2idx];
+	xen_raw_printk("  l2: %016lx\n", l2.pmd);
+	xen_raw_printk("      %016lx\n", pmd_val(l2));
+
+	l1 = ((pte_t *)(m2v(l2.pmd)))[l1idx];
+	xen_raw_printk("  l1: %016lx\n", l1.pte);
+	xen_raw_printk("      %016lx\n", pte_val(l1));
+}
+
+static void set_page_prot(void *addr, pgprot_t prot)
+{
+	unsigned long pfn = __pa(addr) >> PAGE_SHIFT;
+	pte_t pte = pfn_pte(pfn, prot);
+
+	xen_raw_printk("addr=%p pfn=%lx mfn=%lx prot=%016x pte=%016x\n",
+		       addr, pfn, get_phys_to_machine(pfn),
+		       pgprot_val(prot), pte.pte);
+
+	if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, 0))
+		BUG();
+}
+
+static void convert_pfn_mfn(void *v)
+{
+	pte_t *pte = v;
+	int i;
+
+	/* All levels are converted the same way, so just treat them
+	   as ptes. */
+	for(i = 0; i < PTRS_PER_PTE; i++)
+		pte[i] = xen_make_pte(pte[i].pte);
+}
+
+/*
+ * Set up the inital kernel pagetable.
+ *
+ * We can construct this by grafting the Xen provided pagetable into
+ * head_64.S's preconstructed pagetables.  We copy the Xen L2's into
+ * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt.  This
+ * means that only the kernel has a physical mapping to start with -
+ * but that's enough to get __va working.  We need to fill in the rest
+ * of the physical mapping once some sort of allocator has been set
+ * up.
+ */
+static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd)
+{
+	pud_t *l3;
+	pmd_t *l2;
+
+	/* Zap identity mapping */
+	init_level4_pgt[0] = __pgd(0);
+
+	/* Pre-constructed entries are in pfn, so convert to mfn */
+	convert_pfn_mfn(init_level4_pgt);
+	convert_pfn_mfn(level3_ident_pgt);
+	convert_pfn_mfn(level3_kernel_pgt);
+
+	l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);
+	l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud);
+
+	memcpy(level2_ident_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD);
+	memcpy(level2_kernel_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD);
+
+	l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd);
+	l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud);
+	memcpy(level2_fixmap_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD);
+
+	/* Make pagetable pieces RO */
+	set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
+	set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);
+	set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);
+	set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
+	set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
+	set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
+
+	/* Pin down new L4 */
+	pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, PFN_DOWN(__pa(init_level4_pgt)));
+
+	/* Unpin Xen-provided one */
+	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
+
+	/* Switch over */
+	pgd = init_level4_pgt;
+	xen_write_cr3(__pa(pgd));
+
+	max_pfn_mapped = PFN_DOWN(__pa(pgd) +
+				  xen_start_info->nr_pt_frames*PAGE_SIZE +
+				  512*1024);
+
+	return pgd;
+}
+#else
+static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd)
+{
+	init_pg_tables_start = __pa(pgd);
+	init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE;
+	max_pfn_mapped = PFN_DOWN(init_pg_tables_end + 512*1024);
+
+	return pgd;
+}
+#endif	/* CONFIG_X86_64 */
+
 /* First C function to be called on Xen boot */
 asmlinkage void __init xen_start_kernel(void)
 {
@@ -1357,32 +1509,29 @@ asmlinkage void __init xen_start_kernel(void)
 
 	pgd = (pgd_t *)xen_start_info->pt_base;
 
-#ifdef CONFIG_X86_32
-	init_pg_tables_start = __pa(pgd);
-	init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE;
-	max_pfn_mapped = (init_pg_tables_end + 512*1024) >> PAGE_SHIFT;
-#endif
+	/* Prevent unwanted bits from being set in PTEs. */
+	__supported_pte_mask &= ~_PAGE_GLOBAL;
+	if (!is_initial_xendomain())
+		__supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
+
+	/* Don't do the full vcpu_info placement stuff until we have a
+	   possible map and a non-dummy shared_info. */
+	per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
+
+	xen_raw_console_write("mapping kernel into physical memory\n");
+	pgd = xen_setup_kernel_pagetable(pgd);
 
-	init_mm.pgd = pgd; /* use the Xen pagetables to start */
+	init_mm.pgd = pgd;
 
 	/* keep using Xen gdt for now; no urgent need to change it */
 
 	x86_write_percpu(xen_cr3, __pa(pgd));
 	x86_write_percpu(xen_current_cr3, __pa(pgd));
 
-	/* Don't do the full vcpu_info placement stuff until we have a
-	   possible map and a non-dummy shared_info. */
-	per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
-
 	pv_info.kernel_rpl = 1;
 	if (xen_feature(XENFEAT_supervisor_mode_kernel))
 		pv_info.kernel_rpl = 0;
 
-	/* Prevent unwanted bits from being set in PTEs. */
-	__supported_pte_mask &= ~_PAGE_GLOBAL;
-	if (!is_initial_xendomain())
-		__supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
-
 	/* set the limit of our address space */
 	xen_reserve_top();
 
@@ -1405,10 +1554,21 @@ asmlinkage void __init xen_start_kernel(void)
 		add_preferred_console("hvc", 0, NULL);
 	}
 
+	xen_raw_console_write("about to get started...\n");
+
+#if 0
+	xen_raw_printk("&boot_params=%p __pa(&boot_params)=%lx __va(__pa(&boot_params))=%lx\n",
+		       &boot_params, __pa_symbol(&boot_params),
+		       __va(__pa_symbol(&boot_params)));
+
+	walk(pgd, &boot_params);
+	walk(pgd, __va(__pa(&boot_params)));
+#endif
+
 	/* Start the world */
 #ifdef CONFIG_X86_32
 	i386_start_kernel();
 #else
-	x86_64_start_kernel((char *)&boot_params);
+	x86_64_start_reservations((char *)__pa_symbol(&boot_params));
 #endif
 }
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index fa7208b..805d312 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -16,6 +16,8 @@
 extern pud_t level3_kernel_pgt[512];
 extern pud_t level3_ident_pgt[512];
 extern pmd_t level2_kernel_pgt[512];
+extern pmd_t level2_fixmap_pgt[512];
+extern pmd_t level2_ident_pgt[512];
 extern pgd_t init_level4_pgt[];
 
 #define swapper_pg_dir init_level4_pgt
-- 
1.5.4.1


linux-2.6-xen-0039-xen64-64-bit-starts-using-set_pte-from-very-early.patch:

--- NEW FILE linux-2.6-xen-0039-xen64-64-bit-starts-using-set_pte-from-very-early.patch ---
>From 68b00b92bd4d76443d38b4bf9ff019c53aa1b248 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:51 -0700
Subject: [PATCH] xen64: 64-bit starts using set_pte from very early

It also doesn't need the 32-bit hack version of set_pte for initial
pagetable construction, so just make it use the real thing.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 60e3a28..85c095f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1215,7 +1215,11 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 	.kmap_atomic_pte = xen_kmap_atomic_pte,
 #endif
 
+#ifdef CONFIG_X86_64
+	.set_pte = xen_set_pte,
+#else
 	.set_pte = xen_set_pte_init,
+#endif
 	.set_pte_at = xen_set_pte_at,
 	.set_pmd = xen_set_pmd_hyper,
 
-- 
1.5.4.1


linux-2.6-xen-0040-xen64-map-an-initial-chunk-of-physical-memory.patch:

--- NEW FILE linux-2.6-xen-0040-xen64-map-an-initial-chunk-of-physical-memory.patch ---
>From 4fab383329cf6a1b6e6064c241188d476434890c Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:52 -0700
Subject: [PATCH] xen64: map an initial chunk of physical memory

Early in boot, map a chunk of extra physical memory for use later on.
We need a pool of mapped pages to allocate further pages to construct
pagetables mapping all physical memory.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   79 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 69 insertions(+), 10 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 85c095f..0abb337 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1403,6 +1403,61 @@ static void convert_pfn_mfn(void *v)
 }
 
 /*
+ * Identity map, in addition to plain kernel map.  This needs to be
+ * large enough to allocate page table pages to allocate the rest.
+ * Each page can map 2MB.
+ */
+static pte_t level1_ident_pgt[PTRS_PER_PTE * 4] __page_aligned_bss;
+
+static __init void xen_map_identity_early(unsigned long max_pfn)
+{
+	unsigned pmdidx, pteidx;
+	unsigned ident_pte;
+	unsigned long pfn;
+
+	ident_pte = 0;
+	pfn = 0;
+	for(pmdidx = 0; pmdidx < PTRS_PER_PMD && pfn < max_pfn; pmdidx++) {
+		pte_t *pte_page;
+
+		BUG_ON(level2_ident_pgt[pmdidx].pmd != level2_kernel_pgt[pmdidx].pmd);
+
+		/* Reuse or allocate a page of ptes */
+		if (pmd_present(level2_ident_pgt[pmdidx]))
+			pte_page = m2v(level2_ident_pgt[pmdidx].pmd);
+		else {
+			/* Check for free pte pages */
+			if (ident_pte == ARRAY_SIZE(level1_ident_pgt))
+				break;
+
+			pte_page = &level1_ident_pgt[ident_pte];
+			ident_pte += PTRS_PER_PTE;
+
+			/* Install new l1 in l2(s) */
+			level2_ident_pgt[pmdidx] = __pmd(__pa(pte_page) | _PAGE_TABLE);
+			level2_kernel_pgt[pmdidx] = level2_ident_pgt[pmdidx];
+		}
+
+		/* Install mappings */
+		for(pteidx = 0; pteidx < PTRS_PER_PTE; pteidx++, pfn++) {
+			pte_t pte;
+
+			if (pfn > max_pfn_mapped)
+				max_pfn_mapped = pfn;
+
+			if (!pte_none(pte_page[pteidx]))
+				continue;
+
+			pte = pfn_pte(pfn, PAGE_KERNEL_EXEC);
+			pte_page[pteidx] = pte;
+		}
+	}
+
+	for(pteidx = 0; pteidx < ident_pte; pteidx += PTRS_PER_PTE)
+		set_page_prot(&level1_ident_pgt[pteidx], PAGE_KERNEL_RO);
+}
+
+/*
  * Set up the inital kernel pagetable.
  *
  * We can construct this by grafting the Xen provided pagetable into
@@ -1413,7 +1468,7 @@ static void convert_pfn_mfn(void *v)
  * of the physical mapping once some sort of allocator has been set
  * up.
  */
-static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd)
+static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
 {
 	pud_t *l3;
 	pmd_t *l2;
@@ -1436,6 +1491,9 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd)
 	l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud);
 	memcpy(level2_fixmap_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD);
 
+	/* Set up identity map */
+	xen_map_identity_early(max_pfn);
+
 	/* Make pagetable pieces RO */
 	set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);
@@ -1445,7 +1503,7 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd)
 	set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
 
 	/* Pin down new L4 */
-	pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, PFN_DOWN(__pa(init_level4_pgt)));
+	pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, PFN_DOWN(__pa_symbol(init_level4_pgt)));
 
 	/* Unpin Xen-provided one */
 	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
@@ -1454,19 +1512,23 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd)
 	pgd = init_level4_pgt;
 	xen_write_cr3(__pa(pgd));
 
-	max_pfn_mapped = PFN_DOWN(__pa(pgd) +
-				  xen_start_info->nr_pt_frames*PAGE_SIZE +
-				  512*1024);
+	reserve_early(__pa(xen_start_info->pt_base),
+		      __pa(xen_start_info->pt_base +
+			   xen_start_info->nr_pt_frames * PAGE_SIZE),
+		      "XEN PAGETABLES");
 
 	return pgd;
 }
 #else
-static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd)
+static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
 {
 	init_pg_tables_start = __pa(pgd);
 	init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE;
 	max_pfn_mapped = PFN_DOWN(init_pg_tables_end + 512*1024);
 
+	x86_write_percpu(xen_cr3, __pa(pgd));
+	x86_write_percpu(xen_current_cr3, __pa(pgd));
+
 	return pgd;
 }
 #endif	/* CONFIG_X86_64 */
@@ -1523,15 +1585,12 @@ asmlinkage void __init xen_start_kernel(void)
 	per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
 
 	xen_raw_console_write("mapping kernel into physical memory\n");
-	pgd = xen_setup_kernel_pagetable(pgd);
+	pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
 
 	init_mm.pgd = pgd;
 
 	/* keep using Xen gdt for now; no urgent need to change it */
 
-	x86_write_percpu(xen_cr3, __pa(pgd));
-	x86_write_percpu(xen_current_cr3, __pa(pgd));
-
 	pv_info.kernel_rpl = 1;
 	if (xen_feature(XENFEAT_supervisor_mode_kernel))
 		pv_info.kernel_rpl = 0;
-- 
1.5.4.1


linux-2.6-xen-0041-xen32-create-initial-mappings-like-64-bit.patch:

--- NEW FILE linux-2.6-xen-0041-xen32-create-initial-mappings-like-64-bit.patch ---
>From e6d507c7644b8d338f4690c090cf423bcf74b2ce Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:53 -0700
Subject: [PATCH] xen32: create initial mappings like 64-bit

Rearrange the pagetable initialization to share code with the 64-bit
kernel.  Rather than deferring anything to pagetable_setup_start, just
set up an initial pagetable in swapper_pg_dir early at startup, and
create an additional 8MB of physical memory mappings.  This matches
the native head_32.S mappings to a large degree, and allows the rest
of the pagetable setup to continue without much Xen vs. native
difference.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |  130 ++++++++++++++++++---------------------------
 1 files changed, 52 insertions(+), 78 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 0abb337..f154f71 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -872,50 +872,6 @@ static __init void xen_set_pte_init(pte_t *ptep, pte_t pte)
 
 static __init void xen_pagetable_setup_start(pgd_t *base)
 {
-#ifdef CONFIG_X86_32
-	pgd_t *xen_pgd = (pgd_t *)xen_start_info->pt_base;
-	int i;
-
-	init_mm.pgd = base;
-	/*
-	 * copy top-level of Xen-supplied pagetable into place.  This
-	 * is a stand-in while we copy the pmd pages.
-	 */
-	memcpy(base, xen_pgd, PTRS_PER_PGD * sizeof(pgd_t));
-
-	/*
-	 * For PAE, need to allocate new pmds, rather than
-	 * share Xen's, since Xen doesn't like pmd's being
-	 * shared between address spaces.
-	 */
-	for (i = 0; i < PTRS_PER_PGD; i++) {
-		if (pgd_val_ma(xen_pgd[i]) & _PAGE_PRESENT) {
-			pmd_t *pmd = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
-
-			memcpy(pmd, (void *)pgd_page_vaddr(xen_pgd[i]),
-			       PAGE_SIZE);
-
-			make_lowmem_page_readonly(pmd);
-
-			set_pgd(&base[i], __pgd(1 + __pa(pmd)));
-		} else
-			pgd_clear(&base[i]);
-	}
-
-	/* make sure zero_page is mapped RO so we can use it in pagetables */
-	make_lowmem_page_readonly(empty_zero_page);
-	make_lowmem_page_readonly(base);
-	/*
-	 * Switch to new pagetable.  This is done before
-	 * pagetable_init has done anything so that the new pages
-	 * added to the table can be prepared properly for Xen.
-	 */
-	xen_write_cr3(__pa(base));
-
-	/* Unpin initial Xen pagetable */
-	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE,
-			  PFN_DOWN(__pa(xen_start_info->pt_base)));
-#endif	/* CONFIG_X86_32 */
 }
 
 void xen_setup_shared_info(void)
@@ -954,12 +910,6 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 	pv_mmu_ops.set_pte = xen_set_pte;
 
 	xen_setup_shared_info();
-
-#ifdef CONFIG_X86_32
-	/* Actually pin the pagetable down, but we can't set PG_pinned
-	   yet because the page structures don't exist yet. */
-	pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(base)));
-#endif
 }
 
 static __init void xen_post_allocator_init(void)
@@ -1320,14 +1270,17 @@ static void __init xen_reserve_top(void)
 #endif	/* CONFIG_X86_32 */
 }
 
-#ifdef CONFIG_X86_64
 /*
  * Like __va(), but returns address in the kernel mapping (which is
  * all we have until the physical memory mapping has been set up.
  */
 static void *__ka(phys_addr_t paddr)
 {
+#ifdef CONFIG_X86_64
 	return (void *)(paddr + __START_KERNEL_map);
+#else
+	return __va(paddr);
+#endif
 }
 
 /* Convert a machine address to physical address */
@@ -1347,6 +1300,7 @@ static void *m2v(phys_addr_t maddr)
 	return __ka(m2p(maddr));
 }
 
+#ifdef CONFIG_X86_64
 static void walk(pgd_t *pgd, unsigned long addr)
 {
 	unsigned l4idx = pgd_index(addr);
@@ -1377,13 +1331,14 @@ static void walk(pgd_t *pgd, unsigned long addr)
 	xen_raw_printk("  l1: %016lx\n", l1.pte);
 	xen_raw_printk("      %016lx\n", pte_val(l1));
 }
+#endif
 
 static void set_page_prot(void *addr, pgprot_t prot)
 {
 	unsigned long pfn = __pa(addr) >> PAGE_SHIFT;
 	pte_t pte = pfn_pte(pfn, prot);
 
-	xen_raw_printk("addr=%p pfn=%lx mfn=%lx prot=%016x pte=%016x\n",
+	xen_raw_printk("addr=%p pfn=%lx mfn=%lx prot=%016llx pte=%016llx\n",
 		       addr, pfn, get_phys_to_machine(pfn),
 		       pgprot_val(prot), pte.pte);
 
@@ -1391,17 +1346,6 @@ static void set_page_prot(void *addr, pgprot_t prot)
 		BUG();
 }
 
-static void convert_pfn_mfn(void *v)
-{
-	pte_t *pte = v;
-	int i;
-
-	/* All levels are converted the same way, so just treat them
-	   as ptes. */
-	for(i = 0; i < PTRS_PER_PTE; i++)
-		pte[i] = xen_make_pte(pte[i].pte);
-}
-
 /*
  * Identity map, in addition to plain kernel map.  This needs to be
  * large enough to allocate page table pages to allocate the rest.
@@ -1409,7 +1353,7 @@ static void convert_pfn_mfn(void *v)
  */
 static pte_t level1_ident_pgt[PTRS_PER_PTE * 4] __page_aligned_bss;
 
-static __init void xen_map_identity_early(unsigned long max_pfn)
+static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
 {
 	unsigned pmdidx, pteidx;
 	unsigned ident_pte;
@@ -1420,11 +1364,9 @@ static __init void xen_map_identity_early(unsigned long max_pfn)
 	for(pmdidx = 0; pmdidx < PTRS_PER_PMD && pfn < max_pfn; pmdidx++) {
 		pte_t *pte_page;
 
-		BUG_ON(level2_ident_pgt[pmdidx].pmd != level2_kernel_pgt[pmdidx].pmd);
-
 		/* Reuse or allocate a page of ptes */
-		if (pmd_present(level2_ident_pgt[pmdidx]))
-			pte_page = m2v(level2_ident_pgt[pmdidx].pmd);
+		if (pmd_present(pmd[pmdidx]))
+			pte_page = m2v(pmd[pmdidx].pmd);
 		else {
 			/* Check for free pte pages */
 			if (ident_pte == ARRAY_SIZE(level1_ident_pgt))
@@ -1433,9 +1375,7 @@ static __init void xen_map_identity_early(unsigned long max_pfn)
 			pte_page = &level1_ident_pgt[ident_pte];
 			ident_pte += PTRS_PER_PTE;
 
-			/* Install new l1 in l2(s) */
-			level2_ident_pgt[pmdidx] = __pmd(__pa(pte_page) | _PAGE_TABLE);
-			level2_kernel_pgt[pmdidx] = level2_ident_pgt[pmdidx];
+			pmd[pmdidx] = __pmd(__pa(pte_page) | _PAGE_TABLE);
 		}
 
 		/* Install mappings */
@@ -1455,6 +1395,20 @@ static __init void xen_map_identity_early(unsigned long max_pfn)
 
 	for(pteidx = 0; pteidx < ident_pte; pteidx += PTRS_PER_PTE)
 		set_page_prot(&level1_ident_pgt[pteidx], PAGE_KERNEL_RO);
+
+	set_page_prot(pmd, PAGE_KERNEL_RO);
+}
+
+#ifdef CONFIG_X86_64
+static void convert_pfn_mfn(void *v)
+{
+	pte_t *pte = v;
+	int i;
+
+	/* All levels are converted the same way, so just treat them
+	   as ptes. */
+	for(i = 0; i < PTRS_PER_PTE; i++)
+		pte[i] = xen_make_pte(pte[i].pte);
 }
 
 /*
@@ -1492,18 +1446,18 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pf
 	memcpy(level2_fixmap_pgt, l2, sizeof(pmd_t) * PTRS_PER_PMD);
 
 	/* Set up identity map */
-	xen_map_identity_early(max_pfn);
+	xen_map_identity_early(level2_ident_pgt, max_pfn);
 
 	/* Make pagetable pieces RO */
 	set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);
-	set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
 
 	/* Pin down new L4 */
-	pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, PFN_DOWN(__pa_symbol(init_level4_pgt)));
+	pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,
+			  PFN_DOWN(__pa_symbol(init_level4_pgt)));
 
 	/* Unpin Xen-provided one */
 	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
@@ -1519,17 +1473,37 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pf
 
 	return pgd;
 }
-#else
+#else	/* !CONFIG_X86_64 */
+static pmd_t level2_kernel_pgt[PTRS_PER_PMD] __page_aligned_bss;
+
 static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
 {
+	pmd_t *kernel_pmd;
+
 	init_pg_tables_start = __pa(pgd);
 	init_pg_tables_end = __pa(pgd) + xen_start_info->nr_pt_frames*PAGE_SIZE;
 	max_pfn_mapped = PFN_DOWN(init_pg_tables_end + 512*1024);
 
-	x86_write_percpu(xen_cr3, __pa(pgd));
-	x86_write_percpu(xen_current_cr3, __pa(pgd));
+	kernel_pmd = m2v(pgd[KERNEL_PGD_BOUNDARY].pgd);
+	memcpy(level2_kernel_pgt, kernel_pmd, sizeof(pmd_t) * PTRS_PER_PMD);
 
-	return pgd;
+	xen_map_identity_early(level2_kernel_pgt, max_pfn);
+
+	memcpy(swapper_pg_dir, pgd, sizeof(pgd_t) * PTRS_PER_PGD);
+	set_pgd(&swapper_pg_dir[KERNEL_PGD_BOUNDARY],
+			__pgd(__pa(level2_kernel_pgt) | _PAGE_PRESENT));
+
+	set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
+	set_page_prot(swapper_pg_dir, PAGE_KERNEL_RO);
+	set_page_prot(empty_zero_page, PAGE_KERNEL_RO);
+
+	pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
+
+	xen_write_cr3(__pa(swapper_pg_dir));
+
+	pin_pagetable_pfn(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(swapper_pg_dir)));
+
+	return swapper_pg_dir;
 }
 #endif	/* CONFIG_X86_64 */
 
-- 
1.5.4.1


linux-2.6-xen-0042-xen-fix-truncation-of-machine-address.patch:

--- NEW FILE linux-2.6-xen-0042-xen-fix-truncation-of-machine-address.patch ---
>From 569b42481af33a99bbbf9c5ebf4612cc704344a1 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:54 -0700
Subject: [PATCH] xen: fix truncation of machine address

arbitrary_virt_to_machine can truncate a machine address if its above
4G.  Cast the problem away.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/mmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 2579e70..05d7392 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -186,7 +186,7 @@ xmaddr_t arbitrary_virt_to_machine(unsigned long address)
 
 	BUG_ON(pte == NULL);
 
-	return XMADDR((pte_mfn(*pte) << PAGE_SHIFT) + offset);
+	return XMADDR(((phys_addr_t)pte_mfn(*pte) << PAGE_SHIFT) + offset);
 }
 
 void make_lowmem_page_readonly(void *vaddr)
-- 
1.5.4.1


linux-2.6-xen-0043-xen64-use-arbitrary_virt_to_machine-for-xen_set_pmd.patch:

--- NEW FILE linux-2.6-xen-0043-xen64-use-arbitrary_virt_to_machine-for-xen_set_pmd.patch ---
>From da868c49c8ae9b8c89106eca03cf41d36d14d0c1 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:55 -0700
Subject: [PATCH] xen64: use arbitrary_virt_to_machine for xen_set_pmd

When building initial pagetables in 64-bit kernel the pud/pmd pointer may
be in ioremap/fixmap space, so we need to walk the pagetable to look up the
physical address.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/mmu.c         |    9 ++++++---
 include/asm-x86/xen/page.h |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 05d7392..a8f0232 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -178,8 +178,9 @@ void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
 	p2m_top[topidx][idx] = mfn;
 }
 
-xmaddr_t arbitrary_virt_to_machine(unsigned long address)
+xmaddr_t arbitrary_virt_to_machine(void *vaddr)
 {
+	unsigned long address = (unsigned long)vaddr;
 	unsigned int level;
 	pte_t *pte = lookup_address(address, &level);
 	unsigned offset = address & ~PAGE_MASK;
@@ -253,7 +254,8 @@ void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val)
 
 	xen_mc_batch();
 
-	u.ptr = virt_to_machine(ptr).maddr;
+	/* ptr may be ioremapped for 64-bit pagetable setup */
+	u.ptr = arbitrary_virt_to_machine(ptr).maddr;
 	u.val = pmd_val_ma(val);
 	extend_mmu_update(&u);
 
@@ -415,7 +417,8 @@ void xen_set_pud_hyper(pud_t *ptr, pud_t val)
 
 	xen_mc_batch();
 
-	u.ptr = virt_to_machine(ptr).maddr;
+	/* ptr may be ioremapped for 64-bit pagetable setup */
+	u.ptr = arbitrary_virt_to_machine(ptr).maddr;
 	u.val = pud_val_ma(val);
 	extend_mmu_update(&u);
 
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
index a40be65..05e678a 100644
--- a/include/asm-x86/xen/page.h
+++ b/include/asm-x86/xen/page.h
@@ -158,7 +158,7 @@ static inline pte_t __pte_ma(pteval_t x)
 #define pgd_val_ma(x)	((x).pgd)
 
 
-xmaddr_t arbitrary_virt_to_machine(unsigned long address);
+xmaddr_t arbitrary_virt_to_machine(void *address);
 void make_lowmem_page_readonly(void *vaddr);
 void make_lowmem_page_readwrite(void *vaddr);
 
-- 
1.5.4.1


linux-2.6-xen-0044-xen-set-num_processors.patch:

--- NEW FILE linux-2.6-xen-0044-xen-set-num_processors.patch ---
>From 916610ddd166ca7073aa2721630f74a0f9d7faaa Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:56 -0700
Subject: [PATCH] xen: set num_processors

Someone's got to do it.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/smp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 800bb21..8310ca0 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -155,8 +155,10 @@ static void __init xen_fill_possible_map(void)
 
 	for (i = 0; i < NR_CPUS; i++) {
 		rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
-		if (rc >= 0)
+		if (rc >= 0) {
+			num_processors++;
 			cpu_set(i, cpu_possible_map);
+		}
 	}
 }
 
-- 
1.5.4.1


linux-2.6-xen-0045-xen64-defer-setting-pagetable-alloc-release-ops.patch:

--- NEW FILE linux-2.6-xen-0045-xen64-defer-setting-pagetable-alloc-release-ops.patch ---
>From 1631a02e16a7aa06429a7b0549f20568fea464b5 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:57 -0700
Subject: [PATCH] xen64: defer setting pagetable alloc/release ops

We need to wait until the page structure is available to use the
proper pagetable page alloc/release operations, since they use struct
page to determine if a pagetable is pinned.

This happened to work in 32bit because nobody allocated new pagetable
pages in the interim between xen_pagetable_setup_done and
xen_post_allocator_init, but the 64-bit kenrel needs to allocate more
pagetable levels.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f154f71..ddb4746 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -896,30 +896,29 @@ void xen_setup_shared_info(void)
 
 static __init void xen_pagetable_setup_done(pgd_t *base)
 {
-	/* This will work as long as patching hasn't happened yet
-	   (which it hasn't) */
-	pv_mmu_ops.alloc_pte = xen_alloc_pte;
-	pv_mmu_ops.alloc_pmd = xen_alloc_pmd;
-	pv_mmu_ops.release_pte = xen_release_pte;
-	pv_mmu_ops.release_pmd = xen_release_pmd;
-#if PAGETABLE_LEVELS == 4
-	pv_mmu_ops.alloc_pud = xen_alloc_pud;
-	pv_mmu_ops.release_pud = xen_release_pud;
-#endif
-
-	pv_mmu_ops.set_pte = xen_set_pte;
-
 	xen_setup_shared_info();
 }
 
 static __init void xen_post_allocator_init(void)
 {
+	pv_mmu_ops.set_pte = xen_set_pte;
 	pv_mmu_ops.set_pmd = xen_set_pmd;
 	pv_mmu_ops.set_pud = xen_set_pud;
 #if PAGETABLE_LEVELS == 4
 	pv_mmu_ops.set_pgd = xen_set_pgd;
 #endif
 
+	/* This will work as long as patching hasn't happened yet
+	   (which it hasn't) */
+	pv_mmu_ops.alloc_pte = xen_alloc_pte;
+	pv_mmu_ops.alloc_pmd = xen_alloc_pmd;
+	pv_mmu_ops.release_pte = xen_release_pte;
+	pv_mmu_ops.release_pmd = xen_release_pmd;
+#if PAGETABLE_LEVELS == 4
+	pv_mmu_ops.alloc_pud = xen_alloc_pud;
+	pv_mmu_ops.release_pud = xen_release_pud;
+#endif
+
 	xen_mark_init_mm_pinned();
 }
 
-- 
1.5.4.1


linux-2.6-xen-0046-xen-use-set_pte_vaddr.patch:

--- NEW FILE linux-2.6-xen-0046-xen-use-set_pte_vaddr.patch ---
>From 7d51998de8fe454fb910b558a3f898351c3e7640 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:06:58 -0700
Subject: [PATCH] xen: use set_pte_vaddr

Make Xen's set_pte_mfn() use set_pte_vaddr rather than copying it.

Signed-off-by: Jeremy Fitzhardinge <jeremy at xensource.com>
Signed-off-by: Juan Quintela <quintela at redhat.com>
Signed-off-by: Mark McLoughlin <markmc at redhat.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/mmu.c |   30 +-----------------------------
 1 files changed, 1 insertions(+), 29 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index a8f0232..eb31ed2 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -282,35 +282,7 @@ void xen_set_pmd(pmd_t *ptr, pmd_t val)
  */
 void set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags)
 {
-	pgd_t *pgd;
-	pud_t *pud;
-	pmd_t *pmd;
-	pte_t *pte;
-
-	pgd = swapper_pg_dir + pgd_index(vaddr);
-	if (pgd_none(*pgd)) {
-		BUG();
-		return;
-	}
-	pud = pud_offset(pgd, vaddr);
-	if (pud_none(*pud)) {
-		BUG();
-		return;
-	}
-	pmd = pmd_offset(pud, vaddr);
-	if (pmd_none(*pmd)) {
-		BUG();
-		return;
-	}
-	pte = pte_offset_kernel(pmd, vaddr);
-	/* <mfn,flags> stored as-is, to permit clearing entries */
-	xen_set_pte(pte, mfn_pte(mfn, flags));
-
-	/*
-	 * It's enough to flush this one mapping.
-	 * (PGE mappings get flushed as well)
-	 */
-	__flush_tlb_one(vaddr);
+	set_pte_vaddr(vaddr, mfn_pte(mfn, flags));
 }
 
 void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
-- 
1.5.4.1


linux-2.6-xen-0047-xen64-xen_write_idt_entry-and-cvt_gate_to_trap.patch:

--- NEW FILE linux-2.6-xen-0047-xen64-xen_write_idt_entry-and-cvt_gate_to_trap.patch ---
>From e6aa56dc60d076fd4b3d1423fa0e4fbbafd1ac4e Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost at Rawhide-64.localdomain>
Date: Tue, 8 Jul 2008 15:06:59 -0700
Subject: [PATCH] xen64: xen_write_idt_entry() and cvt_gate_to_trap()

Changed to use the (to-be-)unified descriptor structs.

Signed-off-by: Eduardo Habkost <ehabkost at Rawhide-64.localdomain>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   26 ++++++++++----------------
 1 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index ddb4746..5548e31 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -419,23 +419,18 @@ static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum,
 	preempt_enable();
 }
 
-static int cvt_gate_to_trap(int vector, u32 low, u32 high,
+static int cvt_gate_to_trap(int vector, const gate_desc *val,
 			    struct trap_info *info)
 {
-	u8 type, dpl;
-
-	type = (high >> 8) & 0x1f;
-	dpl = (high >> 13) & 3;
-
-	if (type != 0xf && type != 0xe)
+	if (val->type != 0xf && val->type != 0xe)
 		return 0;
 
 	info->vector = vector;
-	info->address = (high & 0xffff0000) | (low & 0x0000ffff);
-	info->cs = low >> 16;
-	info->flags = dpl;
+	info->address = gate_offset(*val);
+	info->cs = gate_segment(*val);
+	info->flags = val->dpl;
 	/* interrupt gates clear IF */
-	if (type == 0xe)
+	if (val->type == 0xe)
 		info->flags |= 4;
 
 	return 1;
@@ -462,11 +457,10 @@ static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g)
 
 	if (p >= start && (p + 8) <= end) {
 		struct trap_info info[2];
-		u32 *desc = (u32 *)g;
 
 		info[1].address = 0;
 
-		if (cvt_gate_to_trap(entrynum, desc[0], desc[1], &info[0]))
+		if (cvt_gate_to_trap(entrynum, g, &info[0]))
 			if (HYPERVISOR_set_trap_table(info))
 				BUG();
 	}
@@ -479,13 +473,13 @@ static void xen_convert_trap_info(const struct desc_ptr *desc,
 {
 	unsigned in, out, count;
 
-	count = (desc->size+1) / 8;
+	count = (desc->size+1) / sizeof(gate_desc);
 	BUG_ON(count > 256);
 
 	for (in = out = 0; in < count; in++) {
-		const u32 *entry = (u32 *)(desc->address + in * 8);
+		gate_desc *entry = (gate_desc*)(desc->address) + in;
 
-		if (cvt_gate_to_trap(in, entry[0], entry[1], &traps[out]))
+		if (cvt_gate_to_trap(in, entry, &traps[out]))
 			out++;
 	}
 	traps[out].address = 0;
-- 
1.5.4.1


linux-2.6-xen-0048-xen64-deal-with-extra-words-Xen-pushes-onto-excepti.patch:

--- NEW FILE linux-2.6-xen-0048-xen64-deal-with-extra-words-Xen-pushes-onto-excepti.patch ---
>From 18197726b6174ed93844c1255fa6a1027dfba66a Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:00 -0700
Subject: [PATCH] xen64: deal with extra words Xen pushes onto exception frames

Xen pushes two extra words containing the values of rcx and r11.  This
pvop hook copies the words back into their appropriate registers, and
cleans them off the stack.  This leaves the stack in native form, so
the normal handler can run unchanged.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c  |    2 +-
 arch/x86/xen/xen-asm_64.S |    5 +++++
 arch/x86/xen/xen-ops.h    |    2 ++
 3 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 5548e31..85b9764 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1112,7 +1112,7 @@ static const struct pv_irq_ops xen_irq_ops __initdata = {
 	.safe_halt = xen_safe_halt,
 	.halt = xen_halt,
 #ifdef CONFIG_X86_64
-	.adjust_exception_frame = paravirt_nop,
+	.adjust_exception_frame = xen_adjust_exception_frame,
 #endif
 };
 
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
index 4ec1082..b147b49 100644
--- a/arch/x86/xen/xen-asm_64.S
+++ b/arch/x86/xen/xen-asm_64.S
@@ -133,6 +133,11 @@ check_events:
 	ret
 #endif
 
+ENTRY(xen_adjust_exception_frame)
+	mov 8+0(%rsp),%rcx
+	mov 8+8(%rsp),%r11
+	ret $16
+
 ENTRY(xen_iret)
 	pushq $0
 	jmp hypercall_page + __HYPERVISOR_iret * 32
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index aca4a78..c4800a2 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -67,7 +67,9 @@ DECL_ASM(void, xen_irq_disable_direct, void);
 DECL_ASM(unsigned long, xen_save_fl_direct, void);
 DECL_ASM(void, xen_restore_fl_direct, unsigned long);
 
+/* These are not functions, and cannot be called normally */
 void xen_iret(void);
 void xen_sysexit(void);
+void xen_adjust_exception_frame(void);
 
 #endif /* XEN_OPS_H */
-- 
1.5.4.1


linux-2.6-xen-0049-xen64-add-pvop-for-swapgs.patch:

--- NEW FILE linux-2.6-xen-0049-xen64-add-pvop-for-swapgs.patch ---
>From fd186e3f585111d32730a9d36b0bdb25f9c0c44a Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:01 -0700
Subject: [PATCH] xen64: add pvop for swapgs

swapgs is a no-op under Xen, because the hypervisor makes sure the
right version of %gs is current when switching between user and kernel
modes.  This means that the swapgs "implementation" can be inlined and
used when the stack is unsafe (usermode).  Unfortunately, it means
that disabling patching will result in a non-booting kernel...

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 85b9764..8343c7f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1097,6 +1097,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 	.set_iopl_mask = xen_set_iopl_mask,
 	.io_delay = xen_io_delay,
 
+	/* Xen takes care of %gs when switching to usermode for us */
+	.swapgs = paravirt_nop,
+
 	.lazy_mode = {
 		.enter = paravirt_enter_lazy_cpu,
 		.leave = xen_leave_lazy,
-- 
1.5.4.1


linux-2.6-xen-0050-xen64-register-callbacks-in-arch-independent-way.patch:

--- NEW FILE linux-2.6-xen-0050-xen64-register-callbacks-in-arch-independent-way.patch ---
>From 869d8606691590a0dc49798dc9b00de387b45f85 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:02 -0700
Subject: [PATCH] xen64: register callbacks in arch-independent way

Use callback_op hypercall to register callbacks in a 32/64-bit
independent way (64-bit doesn't need a code segment, but that detail
is hidden in XEN_CALLBACK).

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/setup.c            |   27 +++++++++++++++++----------
 include/asm-x86/xen/hypercall.h |   12 ++++++++++++
 2 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index f52f385..bea3d4f 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -91,19 +91,25 @@ static void __init fiddle_vdso(void)
 	*mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
 }
 
-void xen_enable_sysenter(void)
+static __cpuinit int register_callback(unsigned type, const void *func)
 {
-	int cpu = smp_processor_id();
-	extern void xen_sysenter_target(void);
-	/* Mask events on entry, even though they get enabled immediately */
-	static struct callback_register sysenter = {
-		.type = CALLBACKTYPE_sysenter,
-		.address = XEN_CALLBACK(__KERNEL_CS, xen_sysenter_target),
+	struct callback_register callback = {
+		.type = type,
+		.address = XEN_CALLBACK(__KERNEL_CS, func),
 		.flags = CALLBACKF_mask_events,
 	};
 
+	return HYPERVISOR_callback_op(CALLBACKOP_register, &callback);
+}
+
+void __cpuinit xen_enable_sysenter(void)
+{
+	int cpu = smp_processor_id();
+	extern void xen_sysenter_target(void);
+
 	if (!boot_cpu_has(X86_FEATURE_SEP) ||
-	    HYPERVISOR_callback_op(CALLBACKOP_register, &sysenter) != 0) {
+	    register_callback(CALLBACKTYPE_sysenter,
+			      xen_sysenter_target) != 0) {
 		clear_cpu_cap(&cpu_data(cpu), X86_FEATURE_SEP);
 		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_SEP);
 	}
@@ -120,8 +126,9 @@ void __init xen_arch_setup(void)
 	if (!xen_feature(XENFEAT_auto_translated_physmap))
 		HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
 
-	HYPERVISOR_set_callbacks(__KERNEL_CS, (unsigned long)xen_hypervisor_callback,
-				 __KERNEL_CS, (unsigned long)xen_failsafe_callback);
+	if (register_callback(CALLBACKTYPE_event, xen_hypervisor_callback) ||
+	    register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback))
+		BUG();
 
 	xen_enable_sysenter();
 
diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index 8763b97..ecb8976 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -226,6 +226,7 @@ HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
 	return _hypercall2(int, stack_switch, ss, esp);
 }
 
+#ifdef CONFIG_X86_32
 static inline int
 HYPERVISOR_set_callbacks(unsigned long event_selector,
 			 unsigned long event_address,
@@ -236,6 +237,17 @@ HYPERVISOR_set_callbacks(unsigned long event_selector,
 			   event_selector, event_address,
 			   failsafe_selector, failsafe_address);
 }
+#else  /* CONFIG_X86_64 */
+static inline int
+HYPERVISOR_set_callbacks(unsigned long event_address,
+			unsigned long failsafe_address,
+			unsigned long syscall_address)
+{
+	return _hypercall3(int, set_callbacks,
+			   event_address, failsafe_address,
+			   syscall_address);
+}
+#endif  /* CONFIG_X86_{32,64} */
 
 static inline int
 HYPERVISOR_callback_op(int cmd, void *arg)
-- 
1.5.4.1


linux-2.6-xen-0051-xen64-add-identity-irq-vector-map.patch:

--- NEW FILE linux-2.6-xen-0051-xen64-add-identity-irq-vector-map.patch ---
>From 4124bac3780066f8ab050a599842a6fb1dbf6150 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:03 -0700
Subject: [PATCH] xen64: add identity irq->vector map

The x86_64 interrupt subsystem is oriented towards vectors, as opposed
to a flat irq space as it is in x86-32.  This patch adds a simple
identity irq->vector mapping so that we can continue to feed irqs into
do_IRQ() and get a good result.

Ideally x86_32 will unify with the 64-bit code and use vectors too.
At that point we can move to mapping event channels to vectors, which
will allow us to economise on irqs (so per-cpu event channels can
share irqs, rather than having to allocte one per cpu, for example).

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 8343c7f..dfebbff 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1106,8 +1106,25 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 	},
 };
 
+static void __init __xen_init_IRQ(void)
+{
+#ifdef CONFIG_X86_64
+	int i;
+
+	/* Create identity vector->irq map */
+	for(i = 0; i < NR_VECTORS; i++) {
+		int cpu;
+
+		for_each_possible_cpu(cpu)
+			per_cpu(vector_irq, cpu)[i] = i;
+	}
+#endif	/* CONFIG_X86_64 */
+
+	xen_init_IRQ();
+}
+
 static const struct pv_irq_ops xen_irq_ops __initdata = {
-	.init_IRQ = xen_init_IRQ,
+	.init_IRQ = __xen_init_IRQ,
 	.save_fl = xen_save_fl,
 	.restore_fl = xen_restore_fl,
 	.irq_disable = xen_irq_disable,
-- 
1.5.4.1


linux-2.6-xen-0052-Xen64-HYPERVISOR_set_segment_base-implementation.patch:

--- NEW FILE linux-2.6-xen-0052-Xen64-HYPERVISOR_set_segment_base-implementation.patch ---
>From c4b189a21aae0382116fe73cd33d1d74d6f9fbb2 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost at redhat.com>
Date: Tue, 8 Jul 2008 15:07:04 -0700
Subject: [PATCH] Xen64: HYPERVISOR_set_segment_base() implementation

Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 include/asm-x86/xen/hypercall.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index ecb8976..ca9f309 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -388,6 +388,14 @@ HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
 	return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
 }
 
+#ifdef CONFIG_X86_64
+static inline int
+HYPERVISOR_set_segment_base(int reg, unsigned long value)
+{
+	return _hypercall2(int, set_segment_base, reg, value);
+}
+#endif
+
 static inline int
 HYPERVISOR_suspend(unsigned long srec)
 {
-- 
1.5.4.1


linux-2.6-xen-0053-xen64-implement-xen_load_gs_index.patch:

--- NEW FILE linux-2.6-xen-0053-xen64-implement-xen_load_gs_index.patch ---
>From 4e277b2082caf46eec49f7974b2179d92ea20dca Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost at redhat.com>
Date: Tue, 8 Jul 2008 15:07:05 -0700
Subject: [PATCH] xen64: implement xen_load_gs_index()

xen-64: implement xen_load_gs_index()

Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index dfebbff..7eefbc8 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -403,6 +403,14 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
 		loadsegment(gs, 0);
 }
 
+#ifdef CONFIG_X86_64
+static void xen_load_gs_index(unsigned int idx)
+{
+	if (HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, idx))
+		BUG();
+}
+#endif
+
 static void xen_write_ldt_entry(struct desc_struct *dt, int entrynum,
 				const void *ptr)
 {
@@ -1084,6 +1092,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 	.load_gdt = xen_load_gdt,
 	.load_idt = xen_load_idt,
 	.load_tls = xen_load_tls,
+#ifdef CONFIG_X86_64
+	.load_gs_index = xen_load_gs_index,
+#endif
 
 	.store_gdt = native_store_gdt,
 	.store_idt = native_store_idt,
-- 
1.5.4.1


linux-2.6-xen-0054-xen-rework-pgd_walk-to-deal-with-32-64-bit.patch:

--- NEW FILE linux-2.6-xen-0054-xen-rework-pgd_walk-to-deal-with-32-64-bit.patch ---
>From c48ce41fc8845e64f633e00ceae63f079eff3ae6 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:06 -0700
Subject: [PATCH] xen: rework pgd_walk to deal with 32/64 bit

Rewrite pgd_walk to deal with 64-bit address spaces.  There are two
notible features of 64-bit workspaces:

 1. The physical address is only 48 bits wide, with the upper 16 bits
    being sign extension; kernel addresses are negative, and userspace is
    positive.

 2. The Xen hypervisor mapping is at the negative-most address, just above
    the sign-extension hole.

1. means that we can't easily use addresses when traversing the space,
since we must deal with sign extension.  This rewrite expresses
everything in terms of pgd/pud/pmd indices, which means we don't need
to worry about the exact configuration of the virtual memory space.
This approach works equally well in 32-bit.

To deal with 2, assume the hole is between the uppermost userspace
address and PAGE_OFFSET.  For 64-bit this skips the Xen mapping hole.
For 32-bit, the hole is zero-sized.

In all cases, the uppermost kernel address is FIXADDR_TOP.

A side-effect of this patch is that the upper boundary is actually
handled properly, exposing a long-standing bug in 32-bit, which failed
to pin kernel pmd page.  The kernel pmd is not shared, and so must be
explicitly pinned, even though the kernel ptes are shared and don't
need pinning.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/mmu.c |  115 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 75 insertions(+), 40 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index eb31ed2..046c1f2 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -44,6 +44,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
+#include <asm/fixmap.h>
 #include <asm/mmu_context.h>
 #include <asm/paravirt.h>
 #include <asm/linkage.h>
@@ -491,77 +492,103 @@ void xen_set_pgd(pgd_t *ptr, pgd_t val)
 #endif	/* PAGETABLE_LEVELS == 4 */
 
 /*
-  (Yet another) pagetable walker.  This one is intended for pinning a
-  pagetable.  This means that it walks a pagetable and calls the
-  callback function on each page it finds making up the page table,
-  at every level.  It walks the entire pagetable, but it only bothers
-  pinning pte pages which are below pte_limit.  In the normal case
-  this will be TASK_SIZE, but at boot we need to pin up to
-  FIXADDR_TOP.  But the important bit is that we don't pin beyond
-  there, because then we start getting into Xen's ptes.
-*/
-static int pgd_walk(pgd_t *pgd_base, int (*func)(struct page *, enum pt_level),
+ * (Yet another) pagetable walker.  This one is intended for pinning a
+ * pagetable.  This means that it walks a pagetable and calls the
+ * callback function on each page it finds making up the page table,
+ * at every level.  It walks the entire pagetable, but it only bothers
+ * pinning pte pages which are below limit.  In the normal case this
+ * will be STACK_TOP_MAX, but at boot we need to pin up to
+ * FIXADDR_TOP.
+ *
+ * For 32-bit the important bit is that we don't pin beyond there,
+ * because then we start getting into Xen's ptes.
+ *
+ * For 64-bit, we must skip the Xen hole in the middle of the address
+ * space, just after the big x86-64 virtual hole.
+ */
+static int pgd_walk(pgd_t *pgd, int (*func)(struct page *, enum pt_level),
 		    unsigned long limit)
 {
-	pgd_t *pgd = pgd_base;
 	int flush = 0;
-	unsigned long addr = 0;
-	unsigned long pgd_next;
+	unsigned hole_low, hole_high;
+	unsigned pgdidx_limit, pudidx_limit, pmdidx_limit;
+	unsigned pgdidx, pudidx, pmdidx;
 
-	BUG_ON(limit > FIXADDR_TOP);
+	/* The limit is the last byte to be touched */
+	limit--;
+	BUG_ON(limit >= FIXADDR_TOP);
 
 	if (xen_feature(XENFEAT_auto_translated_physmap))
 		return 0;
 
-	for (; addr != FIXADDR_TOP; pgd++, addr = pgd_next) {
+	/*
+	 * 64-bit has a great big hole in the middle of the address
+	 * space, which contains the Xen mappings.  On 32-bit these
+	 * will end up making a zero-sized hole and so is a no-op.
+	 */
+	hole_low = pgd_index(STACK_TOP_MAX + PGDIR_SIZE - 1);
+	hole_high = pgd_index(PAGE_OFFSET);
+
+	pgdidx_limit = pgd_index(limit);
+#if PTRS_PER_PUD > 1
+	pudidx_limit = pud_index(limit);
+#else
+	pudidx_limit = 0;
+#endif
+#if PTRS_PER_PMD > 1
+	pmdidx_limit = pmd_index(limit);
+#else
+	pmdidx_limit = 0;
+#endif
+
+	flush |= (*func)(virt_to_page(pgd), PT_PGD);
+
+	for (pgdidx = 0; pgdidx <= pgdidx_limit; pgdidx++) {
 		pud_t *pud;
-		unsigned long pud_limit, pud_next;
 
-		pgd_next = pud_limit = pgd_addr_end(addr, FIXADDR_TOP);
+		if (pgdidx >= hole_low && pgdidx < hole_high)
+			continue;
 
-		if (!pgd_val(*pgd))
+		if (!pgd_val(pgd[pgdidx]))
 			continue;
 
-		pud = pud_offset(pgd, 0);
+		pud = pud_offset(&pgd[pgdidx], 0);
 
 		if (PTRS_PER_PUD > 1) /* not folded */
 			flush |= (*func)(virt_to_page(pud), PT_PUD);
 
-		for (; addr != pud_limit; pud++, addr = pud_next) {
+		for (pudidx = 0; pudidx < PTRS_PER_PUD; pudidx++) {
 			pmd_t *pmd;
-			unsigned long pmd_limit;
 
-			pud_next = pud_addr_end(addr, pud_limit);
-
-			if (pud_next < limit)
-				pmd_limit = pud_next;
-			else
-				pmd_limit = limit;
+			if (pgdidx == pgdidx_limit &&
+			    pudidx > pudidx_limit)
+				goto out;
 
-			if (pud_none(*pud))
+			if (pud_none(pud[pudidx]))
 				continue;
 
-			pmd = pmd_offset(pud, 0);
+			pmd = pmd_offset(&pud[pudidx], 0);
 
 			if (PTRS_PER_PMD > 1) /* not folded */
 				flush |= (*func)(virt_to_page(pmd), PT_PMD);
 
-			for (; addr != pmd_limit; pmd++) {
-				addr += (PAGE_SIZE * PTRS_PER_PTE);
-				if ((pmd_limit-1) < (addr-1)) {
-					addr = pmd_limit;
-					break;
-				}
+			for (pmdidx = 0; pmdidx < PTRS_PER_PMD; pmdidx++) {
+				struct page *pte;
+
+				if (pgdidx == pgdidx_limit &&
+				    pudidx == pudidx_limit &&
+				    pmdidx > pmdidx_limit)
+					goto out;
 
-				if (pmd_none(*pmd))
+				if (pmd_none(pmd[pmdidx]))
 					continue;
 
-				flush |= (*func)(pmd_page(*pmd), PT_PTE);
+				pte = pmd_page(pmd[pmdidx]);
+				flush |= (*func)(pte, PT_PTE);
 			}
 		}
 	}
-
-	flush |= (*func)(virt_to_page(pgd_base), PT_PGD);
+out:
 
 	return flush;
 }
@@ -650,6 +677,11 @@ void xen_pgd_pin(pgd_t *pgd)
 		xen_mc_batch();
 	}
 
+#ifdef CONFIG_X86_PAE
+	/* Need to make sure unshared kernel PMD is pinnable */
+	pin_page(virt_to_page(pgd_page(pgd[pgd_index(TASK_SIZE)])), PT_PMD);
+#endif
+
 	xen_do_pin(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(pgd)));
 	xen_mc_issue(0);
 }
@@ -731,6 +763,10 @@ static void xen_pgd_unpin(pgd_t *pgd)
 
 	xen_do_pin(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
 
+#ifdef CONFIG_X86_PAE
+	/* Need to make sure unshared kernel PMD is unpinned */
+	pin_page(virt_to_page(pgd_page(pgd[pgd_index(TASK_SIZE)])), PT_PMD);
+#endif
 	pgd_walk(pgd, unpin_page, TASK_SIZE);
 
 	xen_mc_issue(0);
@@ -750,7 +786,6 @@ void xen_mm_unpin_all(void)
 	list_for_each_entry(page, &pgd_list, lru) {
 		if (PageSavePinned(page)) {
 			BUG_ON(!PagePinned(page));
-			printk("unpinning pinned %p\n", page_address(page));
 			xen_pgd_unpin((pgd_t *)page_address(page));
 			ClearPageSavePinned(page);
 		}
-- 
1.5.4.1


linux-2.6-xen-0055-xen-make-sure-the-kernel-command-line-is-right.patch:

--- NEW FILE linux-2.6-xen-0055-xen-make-sure-the-kernel-command-line-is-right.patch ---
>From 9cfe071a98b753686feb767a1f938b7c0d683800 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:07 -0700
Subject: [PATCH] xen: make sure the kernel command line is right

Point the boot params cmd_line_ptr to the domain-builder-provided
command line.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 7eefbc8..75ee8b1 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1608,6 +1608,7 @@ asmlinkage void __init xen_start_kernel(void)
 	boot_params.hdr.ramdisk_image = xen_start_info->mod_start
 		? __pa(xen_start_info->mod_start) : 0;
 	boot_params.hdr.ramdisk_size = xen_start_info->mod_len;
+	boot_params.hdr.cmd_line_ptr = __pa(xen_start_info->cmd_line);
 
 	if (!is_initial_xendomain()) {
 		add_preferred_console("xenboot", 0, NULL);
-- 
1.5.4.1


linux-2.6-xen-0056-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch:

--- NEW FILE linux-2.6-xen-0056-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch ---
>From 2093d74c2f1e62cd3fe55b0434af1ed0aab62d44 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:08 -0700
Subject: [PATCH] suspend, xen: enable PM_SLEEP for CONFIG_XEN

Xen save/restore requires PM_SLEEP to be set without requiring
SUSPEND or HIBERNATION.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 kernel/power/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index b45da40..1436c47 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -82,7 +82,7 @@ config PM_SLEEP_SMP
 
 config PM_SLEEP
 	bool
-	depends on SUSPEND || HIBERNATION
+	depends on SUSPEND || HIBERNATION || XEN
 	default y
 
 config SUSPEND
-- 
1.5.4.1


linux-2.6-xen-0057-xen64-implement-failsafe-callback.patch:

--- NEW FILE linux-2.6-xen-0057-xen64-implement-failsafe-callback.patch ---
>From 8e7712902cd3fbbfc717b29178a2320baefe5603 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:09 -0700
Subject: [PATCH] xen64: implement failsafe callback

Implement the failsafe callback, so that iret and segment register
load exceptions are reported to the kernel.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/entry_64.S |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 7cc2de7..6aa6932 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1365,10 +1365,8 @@ END(do_hypervisor_callback)
 # with its current contents: any discrepancy means we in category 1.
 */
 ENTRY(xen_failsafe_callback)
-#if 1
-	ud2a
-#else
-	_frame (RIP-0x30)
+	framesz = (RIP-0x30)	/* workaround buggy gas */
+	_frame framesz
 	CFI_REL_OFFSET rcx, 0
 	CFI_REL_OFFSET r11, 8
 	movw %ds,%cx
@@ -1391,8 +1389,13 @@ ENTRY(xen_failsafe_callback)
 	CFI_RESTORE r11
 	addq $0x30,%rsp
 	CFI_ADJUST_CFA_OFFSET -0x30
-	movq $11,%rdi	/* SIGSEGV */
-	jmp do_exit
+	pushq $0
+	CFI_ADJUST_CFA_OFFSET 8
+	pushq %r11
+	CFI_ADJUST_CFA_OFFSET 8
+	pushq %rcx
+	CFI_ADJUST_CFA_OFFSET 8
+	jmp general_protection
 	CFI_RESTORE_STATE
 1:	/* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */
 	movq (%rsp),%rcx
@@ -1406,7 +1409,6 @@ ENTRY(xen_failsafe_callback)
 	SAVE_ALL
 	jmp error_exit
 	CFI_ENDPROC
-#endif
 END(xen_failsafe_callback)
 
 #endif /* CONFIG_XEN */
-- 
1.5.4.1


linux-2.6-xen-0058-xen64-Clear-fs-on-xen_load_tls.patch:

--- NEW FILE linux-2.6-xen-0058-xen64-Clear-fs-on-xen_load_tls.patch ---
>From 05d1702a8a11c22f8fb5af10a42e11686ae3324f Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost at redhat.com>
Date: Tue, 8 Jul 2008 15:07:10 -0700
Subject: [PATCH] xen64: Clear %fs on xen_load_tls()

We need to do this, otherwise we can get a GPF on hypercall return
after TLS descriptor is cleared but %fs is still pointing to it.

Signed-off-by: Eduardo Habkost <ehabkost at redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 75ee8b1..c238c47 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -382,14 +382,6 @@ static void load_TLS_descriptor(struct thread_struct *t,
 
 static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
 {
-	xen_mc_batch();
-
-	load_TLS_descriptor(t, cpu, 0);
-	load_TLS_descriptor(t, cpu, 1);
-	load_TLS_descriptor(t, cpu, 2);
-
-	xen_mc_issue(PARAVIRT_LAZY_CPU);
-
 	/*
 	 * XXX sleazy hack: If we're being called in a lazy-cpu zone,
 	 * it means we're in a context switch, and %gs has just been
@@ -398,9 +390,30 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu)
 	 * Either way, it has been saved, and the new value will get
 	 * loaded properly.  This will go away as soon as Xen has been
 	 * modified to not save/restore %gs for normal hypercalls.
+	 *
+	 * On x86_64, this hack is not used for %gs, because gs points
+	 * to KERNEL_GS_BASE (and uses it for PDA references), so we
+	 * must not zero %gs on x86_64
+	 *
+	 * For x86_64, we need to zero %fs, otherwise we may get an
+	 * exception between the new %fs descriptor being loaded and
+	 * %fs being effectively cleared at __switch_to().
 	 */
-	if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)
+	if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU) {
+#ifdef CONFIG_X86_32
 		loadsegment(gs, 0);
+#else
+		loadsegment(fs, 0);
+#endif
+	}
+
+	xen_mc_batch();
+
+	load_TLS_descriptor(t, cpu, 0);
+	load_TLS_descriptor(t, cpu, 1);
+	load_TLS_descriptor(t, cpu, 2);
+
+	xen_mc_issue(PARAVIRT_LAZY_CPU);
 }
 
 #ifdef CONFIG_X86_64
-- 
1.5.4.1


linux-2.6-xen-0059-xen64-implement-64-bit-update_descriptor.patch:

--- NEW FILE linux-2.6-xen-0059-xen64-implement-64-bit-update_descriptor.patch ---
>From 74e3b8a1eb1e1c7fea9361aa7c20d241a95d0cc5 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:11 -0700
Subject: [PATCH] xen64: implement 64-bit update_descriptor

64-bit hypercall interface can pass a maddr in one argument rather
than splitting it.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 include/asm-x86/xen/hypercall.h |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index ca9f309..b3d7dde 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -466,10 +466,15 @@ MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
 			struct desc_struct desc)
 {
 	mcl->op = __HYPERVISOR_update_descriptor;
-	mcl->args[0] = maddr;
-	mcl->args[1] = maddr >> 32;
-	mcl->args[2] = desc.a;
-	mcl->args[3] = desc.b;
+	if (sizeof(maddr) == sizeof(long)) {
+		mcl->args[0] = maddr;
+		mcl->args[1] = *(unsigned long *)&desc;
+	} else {
+		mcl->args[0] = maddr;
+		mcl->args[1] = maddr >> 32;
+		mcl->args[2] = desc.a;
+		mcl->args[3] = desc.b;
+	}
 }
 
 static inline void
-- 
1.5.4.1


linux-2.6-xen-0060-xen64-save-lots-of-registers.patch:

--- NEW FILE linux-2.6-xen-0060-xen64-save-lots-of-registers.patch ---
>From 8b20747019121f5a14af22bc3e99ecb22dd0f6eb Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:12 -0700
Subject: [PATCH] xen64: save lots of registers

The Xen hypercall interface is allowed to trash any or all of the
argument registers, so we need to be careful that the kernel state
isn't damaged.  On 32-bit kernels, the hypercall parameter registers
same as a regparm function call, so we've got away without explicit
clobbering so far.  The 64-bit ABI defines lots of caller-save
registers, so save them all for safety.  We can trim this set later by
re-distributing the responsibility for saving all these registers.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 include/asm-x86/paravirt.h |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index fd2f7b5..747620d 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -1406,8 +1406,8 @@ extern struct paravirt_patch_site __parainstructions[],
  * caller saved registers but the argument parameter */
 #define PV_SAVE_REGS "pushq %%rdi;"
 #define PV_RESTORE_REGS "popq %%rdi;"
-#define PV_EXTRA_CLOBBERS EXTRA_CLOBBERS, "rcx" , "rdx"
-#define PV_VEXTRA_CLOBBERS EXTRA_CLOBBERS, "rdi", "rcx" , "rdx"
+#define PV_EXTRA_CLOBBERS EXTRA_CLOBBERS, "rcx" , "rdx", "rsi"
+#define PV_VEXTRA_CLOBBERS EXTRA_CLOBBERS, "rdi", "rcx" , "rdx", "rsi"
 #define PV_FLAGS_ARG "D"
 #endif
 
@@ -1499,8 +1499,26 @@ static inline unsigned long __raw_local_irq_save(void)
 
 
 #ifdef CONFIG_X86_64
-#define PV_SAVE_REGS   pushq %rax; pushq %rdi; pushq %rcx; pushq %rdx
-#define PV_RESTORE_REGS popq %rdx; popq %rcx; popq %rdi; popq %rax
+#define PV_SAVE_REGS				\
+	push %rax;				\
+	push %rcx;				\
+	push %rdx;				\
+	push %rsi;				\
+	push %rdi;				\
+	push %r8;				\
+	push %r9;				\
+	push %r10;				\
+	push %r11
+#define PV_RESTORE_REGS				\
+	pop %r11;				\
+	pop %r10;				\
+	pop %r9;				\
+	pop %r8;				\
+	pop %rdi;				\
+	pop %rsi;				\
+	pop %rdx;				\
+	pop %rcx;				\
+	pop %rax
 #define PARA_PATCH(struct, off)        ((PARAVIRT_PATCH_##struct + (off)) / 8)
 #define PARA_SITE(ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .quad, 8)
 #define PARA_INDIRECT(addr)	*addr(%rip)
-- 
1.5.4.1


linux-2.6-xen-0061-xen64-allocate-and-manage-user-pagetables.patch:

--- NEW FILE linux-2.6-xen-0061-xen64-allocate-and-manage-user-pagetables.patch ---
>From b245d4044a7a385e42c19343ae7a5ead8ff9def0 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:13 -0700
Subject: [PATCH] xen64: allocate and manage user pagetables

Because the x86_64 architecture does not enforce segment limits, Xen
cannot protect itself with them as it does in 32-bit mode.  Therefore,
to protect itself, it runs the guest kernel in ring 3.  Since it also
runs the guest userspace in ring3, the guest kernel must maintain a
second pagetable for its userspace, which does not map kernel space.
Naturally, the guest kernel pagetables map both kernel and userspace.

The userspace pagetable is attached to the corresponding kernel
pagetable via the pgd's page->private field.  It is allocated and
freed at the same time as the kernel pgd via the
paravirt_pgd_alloc/free hooks.

Fortunately, the user pagetable is almost entirely shared with the
kernel pagetable; the only difference is the pgd page itself.  set_pgd
will populate all entries in the kernel pagetable, and also set the
corresponding user pgd entry if the address is less than
STACK_TOP_MAX.

The user pagetable must be pinned and unpinned with the kernel one,
but because the pagetables are aliased, pgd_walk() only needs to be
called on the kernel pagetable.  The user pgd page is then
pinned/unpinned along with the kernel pgd page.

xen_write_cr3 must write both the kernel and user cr3s.

The init_mm.pgd pagetable never has a user pagetable allocated for it,
because it can never be used while running usermode.

One awkward area is that early in boot the page structures are not
available.  No user pagetable can exist at that point, but it
complicates the logic to avoid looking at the page structure.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   99 +++++++++++++++++++++++++++++++++++++++-------
 arch/x86/xen/mmu.c       |   91 ++++++++++++++++++++++++++++++++++++++----
 arch/x86/xen/mmu.h       |    2 +
 3 files changed, 168 insertions(+), 24 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c238c47..5322e5c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -46,7 +46,6 @@
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/reboot.h>
-#include <asm/pgalloc.h>
 
 #include "xen-ops.h"
 #include "mmu.h"
@@ -729,29 +728,57 @@ static void set_current_cr3(void *v)
 	x86_write_percpu(xen_current_cr3, (unsigned long)v);
 }
 
-static void xen_write_cr3(unsigned long cr3)
+static void __xen_write_cr3(bool kernel, unsigned long cr3)
 {
 	struct mmuext_op *op;
 	struct multicall_space mcs;
-	unsigned long mfn = pfn_to_mfn(PFN_DOWN(cr3));
+	unsigned long mfn;
 
-	BUG_ON(preemptible());
+	if (cr3)
+		mfn = pfn_to_mfn(PFN_DOWN(cr3));
+	else
+		mfn = 0;
 
-	mcs = xen_mc_entry(sizeof(*op));  /* disables interrupts */
+	WARN_ON(mfn == 0 && kernel);
 
-	/* Update while interrupts are disabled, so its atomic with
-	   respect to ipis */
-	x86_write_percpu(xen_cr3, cr3);
+	mcs = __xen_mc_entry(sizeof(*op));
 
 	op = mcs.args;
-	op->cmd = MMUEXT_NEW_BASEPTR;
+	op->cmd = kernel ? MMUEXT_NEW_BASEPTR : MMUEXT_NEW_USER_BASEPTR;
 	op->arg1.mfn = mfn;
 
 	MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
 
-	/* Update xen_update_cr3 once the batch has actually
-	   been submitted. */
-	xen_mc_callback(set_current_cr3, (void *)cr3);
+	if (kernel) {
+		x86_write_percpu(xen_cr3, cr3);
+
+		/* Update xen_current_cr3 once the batch has actually
+		   been submitted. */
+		xen_mc_callback(set_current_cr3, (void *)cr3);
+	}
+}
+
+static void xen_write_cr3(unsigned long cr3)
+{
+	BUG_ON(preemptible());
+
+	xen_mc_batch();  /* disables interrupts */
+
+	/* Update while interrupts are disabled, so its atomic with
+	   respect to ipis */
+	x86_write_percpu(xen_cr3, cr3);
+
+	__xen_write_cr3(true, cr3);
+
+#ifdef CONFIG_X86_64
+	{
+		pgd_t *user_pgd = xen_get_user_pgd(__va(cr3));
+		if (user_pgd)
+			__xen_write_cr3(false, __pa(user_pgd));
+		else
+			__xen_write_cr3(false, 0);
+	}
+#endif
 
 	xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
 }
@@ -812,6 +839,40 @@ static void xen_alloc_pmd(struct mm_struct *mm, u32 pfn)
 	xen_alloc_ptpage(mm, pfn, PT_PMD);
 }
 
+static int xen_pgd_alloc(struct mm_struct *mm)
+{
+	pgd_t *pgd = mm->pgd;
+	int ret = 0;
+
+	BUG_ON(PagePinned(virt_to_page(pgd)));
+
+#ifdef CONFIG_X86_64
+	{
+		struct page *page = virt_to_page(pgd);
+
+		BUG_ON(page->private != 0);
+
+		page->private = __get_free_page(GFP_KERNEL | __GFP_ZERO);
+		if (page->private == 0)
+			ret = -ENOMEM;
+
+		BUG_ON(PagePinned(virt_to_page(xen_get_user_pgd(pgd))));
+	}
+#endif
+
+	return ret;
+}
+
+static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)
+{
+#ifdef CONFIG_X86_64
+	pgd_t *user_pgd = xen_get_user_pgd(pgd);
+
+	if (user_pgd)
+		free_page((unsigned long)user_pgd);
+#endif
+}
+
 /* This should never happen until we're OK to use struct page */
 static void xen_release_ptpage(u32 pfn, unsigned level)
 {
@@ -1189,8 +1250,8 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 	.pte_update = paravirt_nop,
 	.pte_update_defer = paravirt_nop,
 
-	.pgd_alloc = __paravirt_pgd_alloc,
-	.pgd_free = paravirt_nop,
+	.pgd_alloc = xen_pgd_alloc,
+	.pgd_free = xen_pgd_free,
 
 	.alloc_pte = xen_alloc_pte_init,
 	.release_pte = xen_release_pte_init,
@@ -1501,7 +1562,15 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pf
 
 	/* Switch over */
 	pgd = init_level4_pgt;
-	xen_write_cr3(__pa(pgd));
+
+	/*
+	 * At this stage there can be no user pgd, and no page
+	 * structure to attach it to, so make sure we just set kernel
+	 * pgd.
+	 */
+	xen_mc_batch();
+	__xen_write_cr3(true, __pa(pgd));
+	xen_mc_issue(PARAVIRT_LAZY_CPU);
 
 	reserve_early(__pa(xen_start_info->pt_base),
 		      __pa(xen_start_info->pt_base +
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 046c1f2..a44d56e 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -58,6 +58,13 @@
 #include "multicalls.h"
 #include "mmu.h"
 
+/*
+ * Just beyond the highest usermode address.  STACK_TOP_MAX has a
+ * redzone above it, so round it up to a PGD boundary.
+ */
+#define USER_LIMIT	((STACK_TOP_MAX + PGDIR_SIZE - 1) & PGDIR_MASK)
+
+
 #define P2M_ENTRIES_PER_PAGE	(PAGE_SIZE / sizeof(unsigned long))
 #define TOP_ENTRIES		(MAX_DOMAIN_PAGES / P2M_ENTRIES_PER_PAGE)
 
@@ -461,17 +468,45 @@ pud_t xen_make_pud(pudval_t pud)
 	return native_make_pud(pud);
 }
 
-void xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
+pgd_t *xen_get_user_pgd(pgd_t *pgd)
 {
-	struct mmu_update u;
+	pgd_t *pgd_page = (pgd_t *)(((unsigned long)pgd) & PAGE_MASK);
+	unsigned offset = pgd - pgd_page;
+	pgd_t *user_ptr = NULL;
 
-	preempt_disable();
+	if (offset < pgd_index(USER_LIMIT)) {
+		struct page *page = virt_to_page(pgd_page);
+		user_ptr = (pgd_t *)page->private;
+		if (user_ptr)
+			user_ptr += offset;
+	}
 
-	xen_mc_batch();
+	return user_ptr;
+}
+
+static void __xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
+{
+	struct mmu_update u;
 
 	u.ptr = virt_to_machine(ptr).maddr;
 	u.val = pgd_val_ma(val);
 	extend_mmu_update(&u);
+}
+
+/*
+ * Raw hypercall-based set_pgd, intended for in early boot before
+ * there's a page structure.  This implies:
+ *  1. The only existing pagetable is the kernel's
+ *  2. It is always pinned
+ *  3. It has no user pagetable attached to it
+ */
+void __init xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
+{
+	preempt_disable();
+
+	xen_mc_batch();
+
+	__xen_set_pgd_hyper(ptr, val);
 
 	xen_mc_issue(PARAVIRT_LAZY_MMU);
 
@@ -480,14 +515,28 @@ void xen_set_pgd_hyper(pgd_t *ptr, pgd_t val)
 
 void xen_set_pgd(pgd_t *ptr, pgd_t val)
 {
+	pgd_t *user_ptr = xen_get_user_pgd(ptr);
+
 	/* If page is not pinned, we can just update the entry
 	   directly */
 	if (!page_pinned(ptr)) {
 		*ptr = val;
+		if (user_ptr) {
+			WARN_ON(page_pinned(user_ptr));
+			*user_ptr = val;
+		}
 		return;
 	}
 
-	xen_set_pgd_hyper(ptr, val);
+	/* If it's pinned, then we can at least batch the kernel and
+	   user updates together. */
+	xen_mc_batch();
+
+	__xen_set_pgd_hyper(ptr, val);
+	if (user_ptr)
+		__xen_set_pgd_hyper(user_ptr, val);
+
+	xen_mc_issue(PARAVIRT_LAZY_MMU);
 }
 #endif	/* PAGETABLE_LEVELS == 4 */
 
@@ -526,7 +575,7 @@ static int pgd_walk(pgd_t *pgd, int (*func)(struct page *, enum pt_level),
 	 * space, which contains the Xen mappings.  On 32-bit these
 	 * will end up making a zero-sized hole and so is a no-op.
 	 */
-	hole_low = pgd_index(STACK_TOP_MAX + PGDIR_SIZE - 1);
+	hole_low = pgd_index(USER_LIMIT);
 	hole_high = pgd_index(PAGE_OFFSET);
 
 	pgdidx_limit = pgd_index(limit);
@@ -670,19 +719,31 @@ void xen_pgd_pin(pgd_t *pgd)
 {
 	xen_mc_batch();
 
-	if (pgd_walk(pgd, pin_page, TASK_SIZE)) {
+	if (pgd_walk(pgd, pin_page, USER_LIMIT)) {
 		/* re-enable interrupts for kmap_flush_unused */
 		xen_mc_issue(0);
 		kmap_flush_unused();
 		xen_mc_batch();
 	}
 
+#ifdef CONFIG_X86_64
+	{
+		pgd_t *user_pgd = xen_get_user_pgd(pgd);
+
+		xen_do_pin(MMUEXT_PIN_L4_TABLE, PFN_DOWN(__pa(pgd)));
+
+		if (user_pgd) {
+			pin_page(virt_to_page(user_pgd), PT_PGD);
+			xen_do_pin(MMUEXT_PIN_L4_TABLE, PFN_DOWN(__pa(user_pgd)));
+		}
+	}
+#else /* CONFIG_X86_32 */
 #ifdef CONFIG_X86_PAE
 	/* Need to make sure unshared kernel PMD is pinnable */
 	pin_page(virt_to_page(pgd_page(pgd[pgd_index(TASK_SIZE)])), PT_PMD);
 #endif
-
 	xen_do_pin(MMUEXT_PIN_L3_TABLE, PFN_DOWN(__pa(pgd)));
+#endif /* CONFIG_X86_64 */
 	xen_mc_issue(0);
 }
 
@@ -763,11 +824,23 @@ static void xen_pgd_unpin(pgd_t *pgd)
 
 	xen_do_pin(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
 
+#ifdef CONFIG_X86_64
+	{
+		pgd_t *user_pgd = xen_get_user_pgd(pgd);
+
+		if (user_pgd) {
+			xen_do_pin(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(user_pgd)));
+			unpin_page(virt_to_page(user_pgd), PT_PGD);
+		}
+	}
+#endif
+
 #ifdef CONFIG_X86_PAE
 	/* Need to make sure unshared kernel PMD is unpinned */
 	pin_page(virt_to_page(pgd_page(pgd[pgd_index(TASK_SIZE)])), PT_PMD);
 #endif
-	pgd_walk(pgd, unpin_page, TASK_SIZE);
+
+	pgd_walk(pgd, unpin_page, USER_LIMIT);
 
 	xen_mc_issue(0);
 }
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index 19d544b..0f59bd0 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -51,6 +51,8 @@ void xen_set_pgd(pgd_t *pgdp, pgd_t pgd);
 void xen_set_pgd_hyper(pgd_t *pgdp, pgd_t pgd);
 #endif
 
+pgd_t *xen_get_user_pgd(pgd_t *pgd);
+
 pte_t xen_ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
 void  xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
 				  pte_t *ptep, pte_t pte);
-- 
1.5.4.1


linux-2.6-xen-0062-xen64-set-up-syscall-and-sysenter-entrypoints-for-6.patch:

--- NEW FILE linux-2.6-xen-0062-xen64-set-up-syscall-and-sysenter-entrypoints-for-6.patch ---
>From 5911a917933316c2473e40d3404ddbb5e0df95ff Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:14 -0700
Subject: [PATCH] xen64: set up syscall and sysenter entrypoints for 64-bit

We set up entrypoints for syscall and sysenter.  sysenter is only used
for 32-bit compat processes, whereas syscall can be used in by both 32
and 64-bit processes.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c  |    4 ++
 arch/x86/xen/setup.c      |   42 ++++++++++++++-
 arch/x86/xen/smp.c        |    1 +
 arch/x86/xen/xen-asm_64.S |  129 ++++++++++++++++++++++++++++++++++++++++++++-
 arch/x86/xen/xen-ops.h    |    3 +
 5 files changed, 174 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 5322e5c..abb1fa1 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1157,6 +1157,10 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 
 	.iret = xen_iret,
 	.irq_enable_sysexit = xen_sysexit,
+#ifdef CONFIG_X86_64
+	.usergs_sysret32 = xen_sysret32,
+	.usergs_sysret64 = xen_sysret64,
+#endif
 
 	.load_tr_desc = paravirt_nop,
 	.set_ldt = xen_set_ldt,
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index bea3d4f..9d7a144 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -86,9 +86,11 @@ static void xen_idle(void)
  */
 static void __init fiddle_vdso(void)
 {
+#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
 	extern const char vdso32_default_start;
 	u32 *mask = VDSO32_SYMBOL(&vdso32_default_start, NOTE_MASK);
 	*mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
+#endif
 }
 
 static __cpuinit int register_callback(unsigned type, const void *func)
@@ -106,15 +108,48 @@ void __cpuinit xen_enable_sysenter(void)
 {
 	int cpu = smp_processor_id();
 	extern void xen_sysenter_target(void);
+	int ret;
+
+#ifdef CONFIG_X86_32
+	if (!boot_cpu_has(X86_FEATURE_SEP)) {
+		return;
+	}
+#else
+	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL &&
+	    boot_cpu_data.x86_vendor != X86_VENDOR_CENTAUR) {
+		return;
+	}
+#endif
 
-	if (!boot_cpu_has(X86_FEATURE_SEP) ||
-	    register_callback(CALLBACKTYPE_sysenter,
-			      xen_sysenter_target) != 0) {
+	ret = register_callback(CALLBACKTYPE_sysenter, xen_sysenter_target);
+	if(ret != 0) {
 		clear_cpu_cap(&cpu_data(cpu), X86_FEATURE_SEP);
 		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_SEP);
 	}
 }
 
+void __cpuinit xen_enable_syscall(void)
+{
+#ifdef CONFIG_X86_64
+	int cpu = smp_processor_id();
+	int ret;
+	extern void xen_syscall_target(void);
+	extern void xen_syscall32_target(void);
+
+	ret = register_callback(CALLBACKTYPE_syscall, xen_syscall_target);
+	if (ret != 0) {
+		printk("failed to set syscall: %d\n", ret);
+		clear_cpu_cap(&cpu_data(cpu), X86_FEATURE_SYSCALL);
+		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_SYSCALL);
+	} else {
+		ret = register_callback(CALLBACKTYPE_syscall32,
+					xen_syscall32_target);
+		if (ret != 0)
+			printk("failed to set 32-bit syscall: %d\n", ret);
+	}
+#endif /* CONFIG_X86_64 */
+}
+
 void __init xen_arch_setup(void)
 {
 	struct physdev_set_iopl set_iopl;
@@ -131,6 +166,7 @@ void __init xen_arch_setup(void)
 		BUG();
 
 	xen_enable_sysenter();
+	xen_enable_syscall();
 
 	set_iopl.iopl = 1;
 	rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 8310ca0..f702199 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -69,6 +69,7 @@ static __cpuinit void cpu_bringup_and_idle(void)
 	preempt_disable();
 
 	xen_enable_sysenter();
+	xen_enable_syscall();
 
 	cpu = smp_processor_id();
 	smp_store_cpu_info(cpu);
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
index b147b49..4038cbf 100644
--- a/arch/x86/xen/xen-asm_64.S
+++ b/arch/x86/xen/xen-asm_64.S
@@ -15,6 +15,8 @@
 
 #include <asm/asm-offsets.h>
 #include <asm/processor-flags.h>
+#include <asm/errno.h>
+#include <asm/segment.h>
 
 #include <xen/interface/xen.h>
 
@@ -138,9 +140,132 @@ ENTRY(xen_adjust_exception_frame)
 	mov 8+8(%rsp),%r11
 	ret $16
 
+hypercall_iret = hypercall_page + __HYPERVISOR_iret * 32
+/*
+	Xen64 iret frame:
+
+	ss
+	rsp
+	rflags
+	cs
+	rip		<-- standard iret frame
+
+	flags
+
+	rcx		}
+	r11		}<-- pushed by hypercall page
+rsp ->	rax		}
+ */
 ENTRY(xen_iret)
 	pushq $0
-	jmp hypercall_page + __HYPERVISOR_iret * 32
+1:	jmp hypercall_iret
+ENDPATCH(xen_iret)
+RELOC(xen_iret, 1b+1)
 
+/*
+	sysexit is not used for 64-bit processes, so it's
+	only ever used to return to 32-bit compat userspace.
+ */
 ENTRY(xen_sysexit)
-	ud2a
+	pushq $__USER32_DS
+	pushq %rcx
+	pushq $X86_EFLAGS_IF
+	pushq $__USER32_CS
+	pushq %rdx
+
+	pushq $VGCF_in_syscall
+1:	jmp hypercall_iret
+ENDPATCH(xen_sysexit)
+RELOC(xen_sysexit, 1b+1)
+
+ENTRY(xen_sysret64)
+	/* We're already on the usermode stack at this point, but still
+	   with the kernel gs, so we can easily switch back */
+	movq %rsp, %gs:pda_oldrsp
+	movq %gs:pda_kernelstack,%rsp
+
+	pushq $__USER_DS
+	pushq %gs:pda_oldrsp
+	pushq %r11
+	pushq $__USER_CS
+	pushq %rcx
+
+	pushq $VGCF_in_syscall
+1:	jmp hypercall_iret
+ENDPATCH(xen_sysret64)
+RELOC(xen_sysret64, 1b+1)
+
+ENTRY(xen_sysret32)
+	/* We're already on the usermode stack at this point, but still
+	   with the kernel gs, so we can easily switch back */
+	movq %rsp, %gs:pda_oldrsp
+	movq %gs:pda_kernelstack, %rsp
+
+	pushq $__USER32_DS
+	pushq %gs:pda_oldrsp
+	pushq %r11
+	pushq $__USER32_CS
+	pushq %rcx
+
+	pushq $VGCF_in_syscall
+1:	jmp hypercall_iret
+ENDPATCH(xen_sysret32)
+RELOC(xen_sysret32, 1b+1)
+
+/*
+	Xen handles syscall callbacks much like ordinary exceptions,
+	which means we have:
+	 - kernel gs
+	 - kernel rsp
+	 - an iret-like stack frame on the stack (including rcx and r11):
+		ss
+		rsp
+		rflags
+		cs
+		rip
+		r11
+	rsp->	rcx
+
+	In all the entrypoints, we undo all that to make it look
+	like a CPU-generated syscall/sysenter and jump to the normal
+	entrypoint.
+ */
+
+.macro undo_xen_syscall
+	mov 0*8(%rsp),%rcx
+	mov 1*8(%rsp),%r11
+	mov 5*8(%rsp),%rsp
+.endm
+
+/* Normal 64-bit system call target */
+ENTRY(xen_syscall_target)
+	undo_xen_syscall
+	jmp system_call_after_swapgs
+ENDPROC(xen_syscall_target)
+
+#ifdef CONFIG_IA32_EMULATION
+
+/* 32-bit compat syscall target */
+ENTRY(xen_syscall32_target)
+	undo_xen_syscall
+	jmp ia32_cstar_target
+ENDPROC(xen_syscall32_target)
+
+/* 32-bit compat sysenter target */
+ENTRY(xen_sysenter_target)
+	undo_xen_syscall
+	jmp ia32_sysenter_target
+ENDPROC(xen_sysenter_target)
+
+#else /* !CONFIG_IA32_EMULATION */
+
+ENTRY(xen_syscall32_target)
+ENTRY(xen_sysenter_target)
+	lea 16(%rsp), %rsp	/* strip %rcx,%r11 */
+	mov $-ENOSYS, %rax
+	pushq $VGCF_in_syscall
+	jmp hypercall_iret
+ENDPROC(xen_syscall32_target)
+ENDPROC(xen_sysenter_target)
+
+#endif	/* CONFIG_IA32_EMULATION */
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index c4800a2..dd3c231 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -26,6 +26,7 @@ char * __init xen_memory_setup(void);
 void __init xen_arch_setup(void);
 void __init xen_init_IRQ(void);
 void xen_enable_sysenter(void);
+void xen_enable_syscall(void);
 void xen_vcpu_restore(void);
 
 void __init xen_build_dynamic_phys_to_machine(void);
@@ -70,6 +71,8 @@ DECL_ASM(void, xen_restore_fl_direct, unsigned long);
 /* These are not functions, and cannot be called normally */
 void xen_iret(void);
 void xen_sysexit(void);
+void xen_sysret32(void);
+void xen_sysret64(void);
 void xen_adjust_exception_frame(void);
 
 #endif /* XEN_OPS_H */
-- 
1.5.4.1


linux-2.6-xen-0063-xen64-set-up-userspace-syscall-patch.patch:

--- NEW FILE linux-2.6-xen-0063-xen64-set-up-userspace-syscall-patch.patch ---
>From 9aad04982467dfd00f081a8187fb290f9c10078f Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:15 -0700
Subject: [PATCH] xen64: set up userspace syscall patch

64-bit userspace expects the vdso to be mapped at a specific fixed
address, which happens to be in the middle of the kernel address
space.  Because we have split user and kernel pagetables, we need to
make special arrangements for the vsyscall mapping to appear in the
kernel part of the user pagetable.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   46 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index abb1fa1..19d985a 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -57,6 +57,18 @@ DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
 DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
 
 /*
+ * Identity map, in addition to plain kernel map.  This needs to be
+ * large enough to allocate page table pages to allocate the rest.
+ * Each page can map 2MB.
+ */
+static pte_t level1_ident_pgt[PTRS_PER_PTE * 4] __page_aligned_bss;
+
+#ifdef CONFIG_X86_64
+/* l3 pud for userspace vsyscall mapping */
+static pud_t level3_user_vsyscall[PTRS_PER_PUD] __page_aligned_bss;
+#endif /* CONFIG_X86_64 */
+
+/*
  * Note about cr3 (pagetable base) values:
  *
  * xen_cr3 contains the current logical cr3 value; it contains the
@@ -849,12 +861,20 @@ static int xen_pgd_alloc(struct mm_struct *mm)
 #ifdef CONFIG_X86_64
 	{
 		struct page *page = virt_to_page(pgd);
+		pgd_t *user_pgd;
 
 		BUG_ON(page->private != 0);
 
-		page->private = __get_free_page(GFP_KERNEL | __GFP_ZERO);
-		if (page->private == 0)
-			ret = -ENOMEM;
+		ret = -ENOMEM;
+
+		user_pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+		page->private = (unsigned long)user_pgd;
+
+		if (user_pgd != NULL) {
+			user_pgd[pgd_index(VSYSCALL_START)] =
+				__pgd(__pa(level3_user_vsyscall) | _PAGE_TABLE);
+			ret = 0;
+		}
 
 		BUG_ON(PagePinned(virt_to_page(xen_get_user_pgd(pgd))));
 	}
@@ -995,6 +1015,9 @@ static __init void xen_post_allocator_init(void)
 	pv_mmu_ops.release_pud = xen_release_pud;
 #endif
 
+#ifdef CONFIG_X86_64
+	SetPagePinned(virt_to_page(level3_user_vsyscall));
+#endif
 	xen_mark_init_mm_pinned();
 }
 
@@ -1106,6 +1129,15 @@ static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
 	}
 
 	__native_set_fixmap(idx, pte);
+
+#ifdef CONFIG_X86_64
+	/* Replicate changes to map the vsyscall page into the user
+	   pagetable vsyscall mapping. */
+	if (idx >= VSYSCALL_LAST_PAGE && idx <= VSYSCALL_FIRST_PAGE) {
+		unsigned long vaddr = __fix_to_virt(idx);
+		set_pte_vaddr_pud(level3_user_vsyscall, vaddr, pte);
+	}
+#endif
 }
 
 static const struct pv_info xen_info __initdata = {
@@ -1448,13 +1480,6 @@ static void set_page_prot(void *addr, pgprot_t prot)
 		BUG();
 }
 
-/*
- * Identity map, in addition to plain kernel map.  This needs to be
- * large enough to allocate page table pages to allocate the rest.
- * Each page can map 2MB.
- */
-static pte_t level1_ident_pgt[PTRS_PER_PTE * 4] __page_aligned_bss;
-
 static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
 {
 	unsigned pmdidx, pteidx;
@@ -1554,6 +1579,7 @@ static __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pf
 	set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);
+	set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO);
 	set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
 	set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
 
-- 
1.5.4.1


linux-2.6-xen-0064-xen-implement-Xen-write_msr-operation.patch:

--- NEW FILE linux-2.6-xen-0064-xen-implement-Xen-write_msr-operation.patch ---
>From c1cbecba9405124926b0b20a566fc0ddaf544953 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:16 -0700
Subject: [PATCH] xen: implement Xen write_msr operation

64-bit uses MSRs for important things like the base for fs and
gs-prefixed addresses.  It's more efficient to use a hypercall to
update these, rather than go via the trap and emulate path.

Other MSR writes are just passed through; in an unprivileged domain
they do nothing, but it might be useful later.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 19d985a..fe47993 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -41,6 +41,7 @@
 #include <asm/xen/hypervisor.h>
 #include <asm/fixmap.h>
 #include <asm/processor.h>
+#include <asm/msr-index.h>
 #include <asm/setup.h>
 #include <asm/desc.h>
 #include <asm/pgtable.h>
@@ -795,6 +796,34 @@ static void xen_write_cr3(unsigned long cr3)
 	xen_mc_issue(PARAVIRT_LAZY_CPU);  /* interrupts restored */
 }
 
+static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
+{
+	int ret;
+
+	ret = 0;
+
+	switch(msr) {
+#ifdef CONFIG_X86_64
+		unsigned which;
+		u64 base;
+
+	case MSR_FS_BASE:		which = SEGBASE_FS; goto set;
+	case MSR_KERNEL_GS_BASE:	which = SEGBASE_GS_USER; goto set;
+	case MSR_GS_BASE:		which = SEGBASE_GS_KERNEL; goto set;
+
+	set:
+		base = ((u64)high << 32) | low;
+		if (HYPERVISOR_set_segment_base(which, base) != 0)
+			ret = -EFAULT;
+		break;
+#endif
+	default:
+		ret = native_write_msr_safe(msr, low, high);
+	}
+
+	return ret;
+}
+
 /* Early in boot, while setting up the initial pagetable, assume
    everything is pinned. */
 static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn)
@@ -1183,7 +1212,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
 	.wbinvd = native_wbinvd,
 
 	.read_msr = native_read_msr_safe,
-	.write_msr = native_write_msr_safe,
+	.write_msr = xen_write_msr_safe,
 	.read_tsc = native_read_tsc,
 	.read_pmc = native_read_pmc,
 
-- 
1.5.4.1


linux-2.6-xen-0065-xen-update-Kconfig-to-allow-64-bit-Xen.patch:

--- NEW FILE linux-2.6-xen-0065-xen-update-Kconfig-to-allow-64-bit-Xen.patch ---
>From 62e417d990f6869daadceb2fe5c81db25d0f30e3 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 8 Jul 2008 15:07:17 -0700
Subject: [PATCH] xen: update Kconfig to allow 64-bit Xen

Allow Xen to be enabled on 64-bit.

Also extend domain size limit from 8 GB (on 32-bit) to 32 GB on 64-bit.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Stephen Tweedie <sct at redhat.com>
Cc: Eduardo Habkost <ehabkost at redhat.com>
Cc: Mark McLoughlin <markmc at redhat.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/Kconfig |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 2983253..37d1bcb 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -6,8 +6,8 @@ config XEN
 	bool "Xen guest support"
 	select PARAVIRT
 	select PARAVIRT_CLOCK
-	depends on X86_32
-	depends on X86_CMPXCHG && X86_TSC && X86_PAE && !(X86_VISWS || X86_VOYAGER)
+	depends on X86_64 || (X86_32 && X86_PAE && !(X86_VISWS || X86_VOYAGER))
+	depends on X86_CMPXCHG && X86_TSC
 	help
 	  This is the Linux Xen port.  Enabling this will allow the
 	  kernel to boot in a paravirtualized environment under the
@@ -15,7 +15,8 @@ config XEN
 
 config XEN_MAX_DOMAIN_MEMORY
        int "Maximum allowed size of a domain in gigabytes"
-       default 8
+       default 8 if X86_32
+       default 32 if X86_64
        depends on XEN
        help
          The pseudo-physical to machine address array is sized
-- 
1.5.4.1


linux-2.6-xen-0066-xen64-fix-HVC_XEN-build-dependency.patch:

--- NEW FILE linux-2.6-xen-0066-xen64-fix-HVC_XEN-build-dependency.patch ---
>From 78c9dbc8b5f7a3729f2248987311d83ad45d4b4e Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo at elte.hu>
Date: Wed, 9 Jul 2008 13:15:03 +0200
Subject: [PATCH] xen64: fix !HVC_XEN build dependency

fix:

arch/x86/xen/built-in.o: In function `set_page_prot':
enlighten.c:(.text+0x111d): undefined reference to `xen_raw_printk'
arch/x86/xen/built-in.o: In function `xen_start_kernel':
: undefined reference to `xen_raw_console_write'
arch/x86/xen/built-in.o: In function `xen_start_kernel':
: undefined reference to `xen_raw_console_write'

Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 include/xen/hvc-console.h |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/xen/hvc-console.h b/include/xen/hvc-console.h
index 98b79bc..c3adde3 100644
--- a/include/xen/hvc-console.h
+++ b/include/xen/hvc-console.h
@@ -5,11 +5,12 @@ extern struct console xenboot_console;
 
 #ifdef CONFIG_HVC_XEN
 void xen_console_resume(void);
+void xen_raw_console_write(const char *str);
+void xen_raw_printk(const char *fmt, ...);
 #else
 static inline void xen_console_resume(void) { }
+static inline void xen_raw_console_write(const char *str) { }
+static inline void xen_raw_printk(const char *fmt, ...) { }
 #endif
 
-void xen_raw_console_write(const char *str);
-void xen_raw_printk(const char *fmt, ...);
-
 #endif	/* XEN_HVC_CONSOLE_H */
-- 
1.5.4.1


linux-2.6-xen-0067-xen64-fix-build-error-on-32-bit-HIGHMEM.patch:

--- NEW FILE linux-2.6-xen-0067-xen64-fix-build-error-on-32-bit-HIGHMEM.patch ---
>From d6fe1ec37cb1c026951ce2f20f3989fb92cde341 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo at elte.hu>
Date: Wed, 9 Jul 2008 13:45:33 +0200
Subject: [PATCH] xen64: fix build error on 32-bit + !HIGHMEM

fix:

arch/x86/xen/enlighten.c: In function 'xen_set_fixmap':
arch/x86/xen/enlighten.c:1127: error: 'FIX_KMAP_BEGIN' undeclared (first use in this function)
arch/x86/xen/enlighten.c:1127: error: (Each undeclared identifier is reported only once
arch/x86/xen/enlighten.c:1127: error: for each function it appears in.)
arch/x86/xen/enlighten.c:1127: error: 'FIX_KMAP_END' undeclared (first use in this function)
make[1]: *** [arch/x86/xen/enlighten.o] Error 1
make: *** [arch/x86/xen/enlighten.o] Error 2

FIX_KMAP_BEGIN is only available on HIGHMEM.

Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/enlighten.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index fe47993..f4f7f16 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1142,7 +1142,9 @@ static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
 #ifdef CONFIG_X86_32
 	case FIX_WP_TEST:
 	case FIX_VDSO:
+# ifdef CONFIG_HIGHMEM
 	case FIX_KMAP_BEGIN ... FIX_KMAP_END:
+# endif
 #else
 	case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE:
 #endif
-- 
1.5.4.1


linux-2.6-xen-0068-Revert-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch:

--- NEW FILE linux-2.6-xen-0068-Revert-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch ---
>From 6c3302f201fef8d03986ec9becee9f4ee0c45883 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo at elte.hu>
Date: Wed, 9 Jul 2008 22:17:01 +0200
Subject: [PATCH] Revert "suspend, xen: enable PM_SLEEP for CONFIG_XEN"

This reverts commit 6fbbec428c8e7bb617da2e8a589af2e97bcf3bc4.

Rafael doesnt like it - it breaks various assumptions.

Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 kernel/power/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 1436c47..b45da40 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -82,7 +82,7 @@ config PM_SLEEP_SMP
 
 config PM_SLEEP
 	bool
-	depends on SUSPEND || HIBERNATION || XEN
+	depends on SUSPEND || HIBERNATION
 	default y
 
 config SUSPEND
-- 
1.5.4.1


linux-2.6-xen-0069-Revert-x86_64-there-s-no-need-to-preallocate-level.patch:

--- NEW FILE linux-2.6-xen-0069-Revert-x86_64-there-s-no-need-to-preallocate-level.patch ---
>From b1859451e075888332a6bb70a3e9a07570e99c6d Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo at elte.hu>
Date: Wed, 9 Jul 2008 22:32:33 +0200
Subject: [PATCH] Revert "x86_64: there's no need to preallocate level1_fixmap_pgt"

This reverts commit 033786969d1d1b5af12a32a19d3a760314d05329.

Suresh Siddha reported that this broke booting on his 2GB testbox.

Reported-by: Suresh Siddha <suresh.b.siddha at intel.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/kernel/head_64.S |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 2240f82..db3280a 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -362,6 +362,12 @@ NEXT_PAGE(level3_kernel_pgt)
 	.quad	level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
 
 NEXT_PAGE(level2_fixmap_pgt)
+	.fill	506,8,0
+	.quad	level1_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
+	/* 8MB reserved for vsyscalls + a 2MB hole = 4 + 1 entries */
+	.fill	5,8,0
+
+NEXT_PAGE(level1_fixmap_pgt)
 	.fill	512,8,0
 
 NEXT_PAGE(level2_ident_pgt)
-- 
1.5.4.1


linux-2.6-xen-0070-xen64-disable-32-bit-syscall-sysenter-if-not-suppor.patch:

--- NEW FILE linux-2.6-xen-0070-xen64-disable-32-bit-syscall-sysenter-if-not-suppor.patch ---
>From a62c6a09eaaffc74271515f63172a13a56b41c35 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Thu, 10 Jul 2008 16:24:08 -0700
Subject: [PATCH] xen64: disable 32-bit syscall/sysenter if not supported.

Old versions of Xen (3.1 and before) don't support sysenter or syscall
from 32-bit compat userspaces.  If we can't set the appropriate
syscall callback, then disable the corresponding feature bit, which
will cause the vdso32 setup to fall back appropriately.

Linux assumes that syscall is always available to 32-bit userspace,
and installs it by default if sysenter isn't available.  In that case,
we just disable vdso altogether, forcing userspace libc to fall back
to int $0x80.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/setup.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 9d7a144..9cce4a9 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -106,46 +106,46 @@ static __cpuinit int register_callback(unsigned type, const void *func)
 
 void __cpuinit xen_enable_sysenter(void)
 {
-	int cpu = smp_processor_id();
 	extern void xen_sysenter_target(void);
 	int ret;
+	unsigned sysenter_feature;
 
 #ifdef CONFIG_X86_32
-	if (!boot_cpu_has(X86_FEATURE_SEP)) {
-		return;
-	}
+	sysenter_feature = X86_FEATURE_SEP;
 #else
-	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL &&
-	    boot_cpu_data.x86_vendor != X86_VENDOR_CENTAUR) {
-		return;
-	}
+	sysenter_feature = X86_FEATURE_SYSENTER32;
 #endif
 
+	if (!boot_cpu_has(sysenter_feature))
+		return;
+
 	ret = register_callback(CALLBACKTYPE_sysenter, xen_sysenter_target);
-	if(ret != 0) {
-		clear_cpu_cap(&cpu_data(cpu), X86_FEATURE_SEP);
-		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_SEP);
-	}
+	if(ret != 0)
+		setup_clear_cpu_cap(sysenter_feature);
 }
 
 void __cpuinit xen_enable_syscall(void)
 {
 #ifdef CONFIG_X86_64
-	int cpu = smp_processor_id();
 	int ret;
 	extern void xen_syscall_target(void);
 	extern void xen_syscall32_target(void);
 
 	ret = register_callback(CALLBACKTYPE_syscall, xen_syscall_target);
 	if (ret != 0) {
-		printk("failed to set syscall: %d\n", ret);
-		clear_cpu_cap(&cpu_data(cpu), X86_FEATURE_SYSCALL);
-		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_SYSCALL);
-	} else {
+		printk(KERN_ERR "Failed to set syscall: %d\n", ret);
+		/* Pretty fatal; 64-bit userspace has no other
+		   mechanism for syscalls. */
+	}
+
+	if (boot_cpu_has(X86_FEATURE_SYSCALL32)) {
 		ret = register_callback(CALLBACKTYPE_syscall32,
 					xen_syscall32_target);
-		if (ret != 0)
-			printk("failed to set 32-bit syscall: %d\n", ret);
+		if (ret != 0) {
+			printk(KERN_INFO "Xen: 32-bit syscall not supported: disabling vdso\n");
+			setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
+			sysctl_vsyscall32 = 0;
+		}
 	}
 #endif /* CONFIG_X86_64 */
 }
-- 
1.5.4.1


linux-2.6-xen-0071-x86-xen-vdso-fix-build-error.patch:

--- NEW FILE linux-2.6-xen-0071-x86-xen-vdso-fix-build-error.patch ---
>From 1ff7f73a7d98957eaa89545cc0cb53f646c53e6f Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo at elte.hu>
Date: Fri, 11 Jul 2008 22:41:34 +0200
Subject: [PATCH] x86, xen, vdso: fix build error

fix:

   arch/x86/xen/built-in.o: In function `xen_enable_syscall':
   (.cpuinit.text+0xdb): undefined reference to `sysctl_vsyscall32'

Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/setup.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 9cce4a9..3e11779 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -144,7 +144,9 @@ void __cpuinit xen_enable_syscall(void)
 		if (ret != 0) {
 			printk(KERN_INFO "Xen: 32-bit syscall not supported: disabling vdso\n");
 			setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
+#ifdef CONFIG_COMPAT
 			sysctl_vsyscall32 = 0;
+#endif
 		}
 	}
 #endif /* CONFIG_X86_64 */
-- 
1.5.4.1


linux-2.6-xen-0072-x86_64-further-cleanup-of-32-bit-compat-syscall-mec.patch:

--- NEW FILE linux-2.6-xen-0072-x86_64-further-cleanup-of-32-bit-compat-syscall-mec.patch ---
>From 03180ed589a13b9ae8d6779c2178315e70c17e69 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Sat, 12 Jul 2008 02:22:00 -0700
Subject: [PATCH] x86_64: further cleanup of 32-bit compat syscall mechanisms

AMD only supports "syscall" from 32-bit compat usermode.
Intel and Centaur(?) only support "sysenter" from 32-bit compat usermode.

Set the X86 feature bits accordingly, and set up the vdso in
accordance with those bits.  On the offchance we run on in a 64-bit
environment which supports neither syscall nor sysenter from 32-bit
mode, then fall back to the int $0x80 vdso.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
 arch/x86/kernel/cpu/amd_64.c    |    2 ++
 arch/x86/kernel/cpu/common_64.c |    3 ---
 arch/x86/vdso/Makefile          |    2 +-
 arch/x86/vdso/vdso32-setup.c    |   19 +++++++++----------
 arch/x86/vdso/vdso32.S          |   13 ++++++++-----
 arch/x86/xen/setup.c            |   10 +++++++---
 include/asm-x86/vdso.h          |    8 ++++++++
 7 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd_64.c b/arch/x86/kernel/cpu/amd_64.c
index 7c36fb8..d1692b2 100644
--- a/arch/x86/kernel/cpu/amd_64.c
+++ b/arch/x86/kernel/cpu/amd_64.c
@@ -115,6 +115,8 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
 	/* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */
 	if (c->x86_power & (1<<8))
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
+
+	set_cpu_cap(c, X86_FEATURE_SYSCALL32);
 }
 
 static void __cpuinit init_amd(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c
index 15419cd..736f50f 100644
--- a/arch/x86/kernel/cpu/common_64.c
+++ b/arch/x86/kernel/cpu/common_64.c
@@ -317,9 +317,6 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
 		c->x86_phys_bits = eax & 0xff;
 	}
 
-	/* Assume all 64-bit CPUs support 32-bit syscall */
-	set_cpu_cap(c, X86_FEATURE_SYSCALL32);
-
 	if (c->x86_vendor != X86_VENDOR_UNKNOWN &&
 	    cpu_devs[c->x86_vendor]->c_early_init)
 		cpu_devs[c->x86_vendor]->c_early_init(c);
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index b7ad9f8..4d6ef0a 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -62,7 +62,7 @@ $(obj)/%-syms.lds: $(obj)/%.so.dbg FORCE
 # Build multiple 32-bit vDSO images to choose from at boot time.
 #
 obj-$(VDSO32-y)			+= vdso32-syms.lds
-vdso32.so-$(CONFIG_X86_32)	+= int80
+vdso32.so-$(VDSO32-y)		+= int80
 vdso32.so-$(CONFIG_COMPAT)	+= syscall
 vdso32.so-$(VDSO32-y)		+= sysenter
 
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index eba2527..2fb420a 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -193,17 +193,12 @@ static __init void relocate_vdso(Elf32_Ehdr *ehdr)
 	}
 }
 
-/*
- * These symbols are defined by vdso32.S to mark the bounds
- * of the ELF DSO images included therein.
- */
-extern const char vdso32_default_start, vdso32_default_end;
-extern const char vdso32_sysenter_start, vdso32_sysenter_end;
 static struct page *vdso32_pages[1];
 
 #ifdef CONFIG_X86_64
 
 #define	vdso32_sysenter()	(boot_cpu_has(X86_FEATURE_SYSENTER32))
+#define	vdso32_syscall()	(boot_cpu_has(X86_FEATURE_SYSCALL32))
 
 /* May not be __init: called during resume */
 void syscall32_cpu_init(void)
@@ -226,6 +221,7 @@ static inline void map_compat_vdso(int map)
 #else  /* CONFIG_X86_32 */
 
 #define vdso32_sysenter()	(boot_cpu_has(X86_FEATURE_SEP))
+#define vdso32_syscall()	(0)
 
 void enable_sep_cpu(void)
 {
@@ -296,12 +292,15 @@ int __init sysenter_setup(void)
 	gate_vma_init();
 #endif
 
-	if (!vdso32_sysenter()) {
-		vsyscall = &vdso32_default_start;
-		vsyscall_len = &vdso32_default_end - &vdso32_default_start;
-	} else {
+	if (vdso32_syscall()) {
+		vsyscall = &vdso32_syscall_start;
+		vsyscall_len = &vdso32_syscall_end - &vdso32_syscall_start;
+	} else if (vdso32_sysenter()){
 		vsyscall = &vdso32_sysenter_start;
 		vsyscall_len = &vdso32_sysenter_end - &vdso32_sysenter_start;
+	} else {
+		vsyscall = &vdso32_int80_start;
+		vsyscall_len = &vdso32_int80_end - &vdso32_int80_start;
 	}
 
 	memcpy(syscall_page, vsyscall, vsyscall_len);
diff --git a/arch/x86/vdso/vdso32.S b/arch/x86/vdso/vdso32.S
index 1e36f72..2ce5f82 100644
--- a/arch/x86/vdso/vdso32.S
+++ b/arch/x86/vdso/vdso32.S
@@ -2,14 +2,17 @@
 
 __INITDATA
 
-	.globl vdso32_default_start, vdso32_default_end
-vdso32_default_start:
-#ifdef CONFIG_X86_32
+	.globl vdso32_int80_start, vdso32_int80_end
+vdso32_int80_start:
 	.incbin "arch/x86/vdso/vdso32-int80.so"
-#else
+vdso32_int80_end:
+
+	.globl vdso32_syscall_start, vdso32_syscall_end
+vdso32_syscall_start:
+#ifdef CONFIG_COMPAT
 	.incbin "arch/x86/vdso/vdso32-syscall.so"
 #endif
-vdso32_default_end:
+vdso32_syscall_end:
 
 	.globl vdso32_sysenter_start, vdso32_sysenter_end
 vdso32_sysenter_start:
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 3e11779..e3648e6 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -83,12 +83,16 @@ static void xen_idle(void)
 
 /*
  * Set the bit indicating "nosegneg" library variants should be used.
+ * We only need to bother in pure 32-bit mode; compat 32-bit processes
+ * can have un-truncated segments, so wrapping around is allowed.
  */
 static void __init fiddle_vdso(void)
 {
-#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
-	extern const char vdso32_default_start;
-	u32 *mask = VDSO32_SYMBOL(&vdso32_default_start, NOTE_MASK);
+#ifdef CONFIG_X86_32
+	u32 *mask;
+	mask = VDSO32_SYMBOL(&vdso32_int80_start, NOTE_MASK);
+	*mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
+	mask = VDSO32_SYMBOL(&vdso32_sysenter_start, NOTE_MASK);
 	*mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
 #endif
 }
diff --git a/include/asm-x86/vdso.h b/include/asm-x86/vdso.h
index 86e085e..8e18fb8 100644
--- a/include/asm-x86/vdso.h
+++ b/include/asm-x86/vdso.h
@@ -36,4 +36,12 @@ extern const char VDSO32_PRELINK[];
 extern void __user __kernel_sigreturn;
 extern void __user __kernel_rt_sigreturn;
 
+/*
+ * These symbols are defined by vdso32.S to mark the bounds
+ * of the ELF DSO images included therein.
+ */
+extern const char vdso32_int80_start, vdso32_int80_end;
+extern const char vdso32_syscall_start, vdso32_syscall_end;
+extern const char vdso32_sysenter_start, vdso32_sysenter_end;
+
 #endif	/* asm-x86/vdso.h */
-- 
1.5.4.1


linux-2.6-xen-0073-x86-xen-no-need-to-disable-vdso32.patch:

--- NEW FILE linux-2.6-xen-0073-x86-xen-no-need-to-disable-vdso32.patch ---
>From 9a62aefe50431ed62922a226e93a0871970c86f1 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Sat, 12 Jul 2008 02:22:06 -0700
Subject: [PATCH] x86: xen: no need to disable vdso32

Now that the vdso32 code can cope with both syscall and sysenter
missing for 32-bit compat processes, just disable the features without
disabling vdso altogether.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
 arch/x86/xen/setup.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e3648e6..b6acc3a 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -137,7 +137,7 @@ void __cpuinit xen_enable_syscall(void)
 
 	ret = register_callback(CALLBACKTYPE_syscall, xen_syscall_target);
 	if (ret != 0) {
-		printk(KERN_ERR "Failed to set syscall: %d\n", ret);
+		printk(KERN_ERR "Failed to set syscall callback: %d\n", ret);
 		/* Pretty fatal; 64-bit userspace has no other
 		   mechanism for syscalls. */
 	}
@@ -145,13 +145,8 @@ void __cpuinit xen_enable_syscall(void)
 	if (boot_cpu_has(X86_FEATURE_SYSCALL32)) {
 		ret = register_callback(CALLBACKTYPE_syscall32,
 					xen_syscall32_target);
-		if (ret != 0) {
-			printk(KERN_INFO "Xen: 32-bit syscall not supported: disabling vdso\n");
+		if (ret != 0)
 			setup_clear_cpu_cap(X86_FEATURE_SYSCALL32);
-#ifdef CONFIG_COMPAT
-			sysctl_vsyscall32 = 0;
-#endif
-		}
 	}
 #endif /* CONFIG_X86_64 */
 }
-- 
1.5.4.1


linux-2.6-xen-0074-x86_64-adjust-exception-frame-on-paranoid-exception.patch:

--- NEW FILE linux-2.6-xen-0074-x86_64-adjust-exception-frame-on-paranoid-exception.patch ---
>From 0ee2b40760c097c3946d8c27f96ba688bc375869 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Sat, 12 Jul 2008 02:22:12 -0700
Subject: [PATCH] x86_64: adjust exception frame on paranoid exceptions

Exceptions using paranoidentry need to have their exception frames
adjusted explicitly.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
 arch/x86/kernel/entry_64.S |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 6aa6932..80d5663 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1189,6 +1189,7 @@ END(device_not_available)
 	/* runs on exception stack */
 KPROBE_ENTRY(debug)
  	INTR_FRAME
+	PARAVIRT_ADJUST_EXCEPTION_FRAME
 	pushq $0
 	CFI_ADJUST_CFA_OFFSET 8		
 	paranoidentry do_debug, DEBUG_STACK
@@ -1198,6 +1199,7 @@ KPROBE_END(debug)
 	/* runs on exception stack */	
 KPROBE_ENTRY(nmi)
 	INTR_FRAME
+	PARAVIRT_ADJUST_EXCEPTION_FRAME
 	pushq $-1
 	CFI_ADJUST_CFA_OFFSET 8
 	paranoidentry do_nmi, 0, 0
@@ -1211,6 +1213,7 @@ KPROBE_END(nmi)
 
 KPROBE_ENTRY(int3)
  	INTR_FRAME
+	PARAVIRT_ADJUST_EXCEPTION_FRAME
  	pushq $0
  	CFI_ADJUST_CFA_OFFSET 8
  	paranoidentry do_int3, DEBUG_STACK
@@ -1237,6 +1240,7 @@ END(coprocessor_segment_overrun)
 	/* runs on exception stack */
 ENTRY(double_fault)
 	XCPT_FRAME
+	PARAVIRT_ADJUST_EXCEPTION_FRAME
 	paranoidentry do_double_fault
 	jmp paranoid_exit1
 	CFI_ENDPROC
@@ -1253,6 +1257,7 @@ END(segment_not_present)
 	/* runs on exception stack */
 ENTRY(stack_segment)
 	XCPT_FRAME
+	PARAVIRT_ADJUST_EXCEPTION_FRAME
 	paranoidentry do_stack_segment
 	jmp paranoid_exit1
 	CFI_ENDPROC
@@ -1278,6 +1283,7 @@ END(spurious_interrupt_bug)
 	/* runs on exception stack */
 ENTRY(machine_check)
 	INTR_FRAME
+	PARAVIRT_ADJUST_EXCEPTION_FRAME
 	pushq $0
 	CFI_ADJUST_CFA_OFFSET 8	
 	paranoidentry do_machine_check
-- 
1.5.4.1


linux-2.6-xen-0075-x86-xen-power-fix-up-config-dependencies-on-PM.patch:

--- NEW FILE linux-2.6-xen-0075-x86-xen-power-fix-up-config-dependencies-on-PM.patch ---
>From 274e69003e56a7d488569429440428a700798de0 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy at goop.org>
Date: Tue, 15 Jul 2008 13:43:42 -0700
Subject: [PATCH] x86, xen, power: fix up config dependencies on PM

Xen save/restore needs bits of code enabled by PM_SLEEP, and PM_SLEEP
depends on PM.  So make XEN_SAVE_RESTORE depend on PM and PM_SLEEP
depend on XEN_SAVE_RESTORE.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Acked-by: Rafael J. Wysocki <rjw at sisk.pl>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 arch/x86/xen/Kconfig |    5 +++++
 kernel/power/Kconfig |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 37d1bcb..8585475 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -24,6 +24,11 @@ config XEN_MAX_DOMAIN_MEMORY
          domain.  This array uses 1 page per gigabyte, so there's no
          need to be too stingy here.
 
+config XEN_SAVE_RESTORE
+       bool
+       depends on PM
+       default y
+
 config XENCTRL
 	tristate "Xen's user space control interfaces"
 	depends on XEN && PROC_FS && SYSFS
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index b45da40..59dfdf1 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -82,7 +82,7 @@ config PM_SLEEP_SMP
 
 config PM_SLEEP
 	bool
-	depends on SUSPEND || HIBERNATION
+	depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE
 	default y
 
 config SUSPEND
-- 
1.5.4.1


linux-2.6-xen-0076-linux-next-pci-tree-build-failure.patch:

--- NEW FILE linux-2.6-xen-0076-linux-next-pci-tree-build-failure.patch ---
>From 8e2c4a66e3132aa5e5209906484f3a0ab50e7a44 Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <sfr at canb.auug.org.au>
Date: Thu, 17 Jul 2008 13:09:24 +1000
Subject: [PATCH] linux-next: pci tree build failure

Today's linux-next build (x86_64 allmodconfig) failed like this:

 drivers/xen/manage.c: In function 'xen_suspend':
 drivers/xen/manage.c:66: error: too few arguments to function 'device_power_up'
 drivers/xen/manage.c: In function 'do_suspend':
 drivers/xen/manage.c:117: error: too few arguments to function 'device_resume'

Caused by commit 1eede070a59e1cc73da51e1aaa00d9ab86572cfc ("Introduce new
top level suspend and hibernation callbacks") interacting with new
usages ...

Signed-off-by: Stephen Rothwell <sfr at canb.auug.org.au>
Cc: Jeremy Fitzhardinge <jeremy at goop.org>
Acked-by: Rafael J. Wysocki <rjw at sisk.pl>
Cc: Jesse Barnes <jbarnes at virtuousgeek.org>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 drivers/xen/manage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 2bb268e..a5bc91a 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -63,7 +63,7 @@ static int xen_suspend(void *data)
 	gnttab_resume();
 	xen_mm_unpin_all();
 
-	device_power_up();
+	device_power_up(PMSG_RESUME);
 
 	if (!*cancelled) {
 		xen_irq_resume();
@@ -114,7 +114,7 @@ static void do_suspend(void)
 	} else
 		xenbus_suspend_cancel();
 
-	device_resume();
+	device_resume(PMSG_RESUME);
 
 	/* Make sure timer events get retriggered on all CPUs */
 	clock_was_set();
-- 
1.5.4.1



--- NEW FILE linux-2.6.26.tar.bz2.sign ---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: See http://www.kernel.org/signature.html for info

iD8DBQBIeogDyGugalF9Dw4RAk4IAJ4g+RxY+bf8pYzXhWQ6ltKoM+Z3VQCfYFI6
wUkbvVqKn/rTx7kqTtudjVg=
=4xMU
-----END PGP SIGNATURE-----


--- NEW FILE patch-2.6.26-git6.bz2.sign ---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: See http://www.kernel.org/signature.html for info

iD8DBQBIf5d2yGugalF9Dw4RAn/bAJ9rP7PXt6TKJixwppG6TXsOa+DBfgCfVoaG
tK787YfT46Uj71hVle0RtEw=
=J90n
-----END PGP SIGNATURE-----




Index: .gitignore
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/.gitignore,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- .gitignore	16 Jun 2008 10:19:26 -0000	1.8
+++ .gitignore	18 Jul 2008 14:57:38 -0000	1.9
@@ -2,8 +2,7 @@
 GNUmakefile
 kernel-2.6.*.config
 temp-*
-kernel-2.6.25
-linux-2.6.25.tar.bz2
-patch-2.6.26-rc6.bz2
-patch-2.6.26-rc6-git2.bz2
+kernel-2.6.26
+linux-2.6.26.tar.bz2
+patch-2.6.26-git6.bz2
 xen-3.2.0.tar.gz


Index: Makefile
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/Makefile,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Makefile	16 Jun 2008 10:19:26 -0000	1.23
+++ Makefile	18 Jul 2008 14:57:39 -0000	1.24
@@ -48,7 +48,6 @@
 	@perl -pi -e 's/# CONFIG_DEBUG_SPINLOCK is not set/CONFIG_DEBUG_SPINLOCK=y/' config-nodebug
 	@perl -pi -e 's/# CONFIG_DEBUG_VM is not set/CONFIG_DEBUG_VM=y/' config-nodebug
 	@perl -pi -e 's/# CONFIG_DEBUG_SLEEP_IN_IRQ is not set/CONFIG_DEBUG_SLEEP_IN_IRQ=y/' config-nodebug
-	@perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug
 	@perl -pi -e 's/# CONFIG_FAULT_INJECTION is not set/CONFIG_FAULT_INJECTION=y/' config-nodebug
 	@perl -pi -e 's/# CONFIG_FAILSLAB is not set/CONFIG_FAILSLAB=y/' config-nodebug
 	@perl -pi -e 's/# CONFIG_FAIL_PAGE_ALLOC is not set/CONFIG_FAIL_PAGE_ALLOC=y/' config-nodebug
@@ -63,6 +62,9 @@
 	@perl -pi -e 's/# CONFIG_DEBUG_OBJECTS_TIMERS is not set/CONFIG_DEBUG_OBJECTS_TIMERS=y/' config-nodebug
 	@perl -pi -e 's/# CONFIG_X86_PTDUMP is not set/CONFIG_X86_PTDUMP=y/' config-nodebug
 	@perl -pi -e 's/# CONFIG_CAN_DEBUG_DEVICES is not set/CONFIG_CAN_DEBUG_DEVICES=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_SND_DEBUG_VERBOSE is not set/CONFIG_SND_DEBUG_VERBOSE=y/' config-nodebug
+	# just in case we're going from extremedebug -> debug
+	@perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug
 
 	@perl -pi -e 's/^%define debugbuildsenabled 1/%define debugbuildsenabled 0/' kernel.spec
 
@@ -95,13 +97,14 @@
 	@perl -pi -e 's/CONFIG_DEBUG_OBJECTS_TIMERS=y/# CONFIG_DEBUG_OBJECTS_TIMERS is not set/' config-nodebug
 	@perl -pi -e 's/CONFIG_X86_PTDUMP=y/# CONFIG_X86_PTDUMP is not set/' config-nodebug
 	@perl -pi -e 's/CONFIG_CAN_DEBUG_DEVICES=y/# CONFIG_CAN_DEBUG_DEVICES is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_SND_DEBUG_VERBOSE=y/# CONFIG_SND_DEBUG_VERBOSE is not set/' config-nodebug
 
 	@perl -pi -e 's/^%define debugbuildsenabled 0/%define debugbuildsenabled 1/' kernel.spec
 
 
 reconfig:
 	@rm -f kernel-*-config
-	@VERSION="2.6.26" make -f Makefile.config configs
+	@VERSION="2.6.27" make -f Makefile.config configs
 	@scripts/reconfig.sh
 
 # since i386 isn't a target...


Index: Makefile.config
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/Makefile.config,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Makefile.config	16 Jun 2008 10:19:26 -0000	1.23
+++ Makefile.config	18 Jul 2008 14:57:39 -0000	1.24
@@ -16,7 +16,7 @@
 	$(CFG)-i686-xen.config $(CFG)-x86_64-xen.config \
 	$(CFG)-ia64-xen.config
 
-PLATFORMS	= x86 x86_64 powerpc powerpc32 powerpc64 s390x ia64 sparc64 sparc
+PLATFORMS	= x86 x86_64 powerpc powerpc32 powerpc64 s390x ia64 sparc64
 TEMPFILES	= $(addprefix temp-, $(addsuffix -generic, $(PLATFORMS)))
 
 configs: $(CONFIGFILES)
@@ -46,9 +46,6 @@
 temp-x86_64-debug-generic: config-x86_64-generic temp-debug-generic
 	perl merge.pl $^  > $@
 
-temp-sparc-generic: config-sparc-generic temp-generic
-	perl merge.pl $^  > $@
-
 temp-sparc64-generic: config-sparc64-generic temp-generic
 	perl merge.pl $^  > $@
 
@@ -103,12 +100,9 @@
 kernel-$(VERSION)-sparc64-smp.config: config-sparc64-smp temp-sparc64-generic
 	perl merge.pl $^ sparc64 > $@
 
-kernel-$(VERSION)-sparc64.config: config-sparc64 temp-sparc64-generic
+kernel-$(VERSION)-sparc64.config: /dev/null temp-sparc64-generic
 	perl merge.pl $^ sparc64 > $@
 
-kernel-$(VERSION)-sparc.config: config-sparc temp-sparc-generic
-	perl merge.pl $^ sparc > $@
-
 kernel-$(VERSION)-ppc64.config: config-powerpc64 temp-powerpc-generic
 	perl merge.pl $^ powerpc > $@
 


Index: config-debug
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-debug,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- config-debug	16 Jun 2008 10:19:26 -0000	1.5
+++ config-debug	18 Jul 2008 14:57:39 -0000	1.6
@@ -1,6 +1,7 @@
 CONFIG_SND_VERBOSE_PRINTK=y
 CONFIG_SND_DEBUG=y
 CONFIG_SND_DEBUG_DETECT=y
+CONFIG_SND_DEBUG_VERBOSE=y
 CONFIG_SND_PCM_XRUN_DEBUG=y
 
 CONFIG_DEBUG_MUTEXES=y


Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-generic,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- config-generic	16 Jun 2008 10:19:26 -0000	1.9
+++ config-generic	18 Jul 2008 14:57:39 -0000	1.10
@@ -14,6 +14,7 @@
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
+
 #
 # General setup
 #
@@ -110,6 +111,8 @@
 CONFIG_MMC_BLOCK=m
 CONFIG_MMC_RICOH_MMC=m
 CONFIG_MMC_SDHCI=m
+CONFIG_MMC_SDHCI_PCI=m
+CONFIG_MMC_SDRICOH_CS=m
 CONFIG_MMC_TIFM_SD=m
 CONFIG_MMC_WBSD=m
 
@@ -148,6 +151,8 @@
 # Generic Driver Options
 #
 CONFIG_FW_LOADER=y
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_EXTRA_FIRMWARE=""
 
 # CONFIG_SPI is not set
 
@@ -289,6 +294,7 @@
 CONFIG_ISAPNP=y
 # CONFIG_PNPBIOS is not set
 
+CONFIG_ACPI_PCI_SLOT=m
 CONFIG_HOTPLUG_PCI_ACPI=m
 CONFIG_HOTPLUG_PCI_ACPI_IBM=m
 
@@ -342,6 +348,7 @@
 # CONFIG_BLK_DEV_IT8213 is not set
 # CONFIG_BLK_DEV_TC86C001 is not set
 CONFIG_BLK_DEV_BSG=y
+CONFIG_BLK_DEV_INTEGRITY=y
 
 
 #
@@ -426,15 +433,20 @@
 CONFIG_SCSI_SRP_ATTRS=m
 CONFIG_SCSI_TGT=m
 
+CONFIG_SCSI_DH=y
+CONFIG_SCSI_DH_RDAC=m
+CONFIG_SCSI_DH_HP_SW=m
+CONFIG_SCSI_DH_EMC=m
+
 #
 # SCSI support type (disk, tape, CD-ROM)
 #
-CONFIG_BLK_DEV_SD=m
+CONFIG_BLK_DEV_SD=y
 CONFIG_CHR_DEV_ST=m
 CONFIG_CHR_DEV_OSST=m
 CONFIG_BLK_DEV_SR=m
 CONFIG_BLK_DEV_SR_VENDOR=y
-CONFIG_CHR_DEV_SG=m
+CONFIG_CHR_DEV_SG=y
 CONFIG_CHR_DEV_SCH=m
 
 #
@@ -490,7 +502,7 @@
 CONFIG_MEGARAID_LEGACY=m
 CONFIG_MEGARAID_SAS=m
 
-CONFIG_ATA=m
+CONFIG_ATA=y
 CONFIG_ATA_SFF=y
 CONFIG_ATA_PIIX=m
 CONFIG_ATA_ACPI=y
@@ -1033,7 +1045,7 @@
 CONFIG_NET_PKTGEN=m
 # CONFIG_NET_TCPPROBE is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
+CONFIG_NETDEVICES_MULTIQUEUE=y
 
 #
 # ARCnet devices
@@ -1251,7 +1263,7 @@
 #
 # Wireless LAN
 #
-CONFIG_WLAN_PRE80211=y
+# CONFIG_WLAN_PRE80211 is not set
 # CONFIG_STRIP is not set
 # CONFIG_ARLAN is not set
 CONFIG_PCMCIA_WAVELAN=m
@@ -1260,6 +1272,7 @@
 # CONFIG_PCMCIA_RAYCS is not set
 
 CONFIG_MAC80211=m
+CONFIG_MAC80211_QOS=y
 CONFIG_MAC80211_RC_DEFAULT_PID=y
 # CONFIG_MAC80211_RC_DEFAULT_SIMPLE is not set
 CONFIG_MAC80211_RC_DEFAULT="pid"
@@ -1268,8 +1281,11 @@
 CONFIG_MAC80211_MESH=y
 CONFIG_MAC80211_LEDS=y
 CONFIG_MAC80211_DEBUGFS=y
+# CONFIG_MAC80211_DEBUG_MENU is not set
+# CONFIG_MAC80211_DEBUG is not set
 # CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
 # CONFIG_MAC80211_DEBUG is not set
+
 CONFIG_IEEE80211=m
 CONFIG_IEEE80211_DEBUG=y
 CONFIG_IEEE80211_CRYPT_WEP=m
@@ -1279,6 +1295,8 @@
 CONFIG_IEEE80211_SOFTMAC_DEBUG=y
 CONFIG_CFG80211=m
 CONFIG_NL80211=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
 
 CONFIG_ADM8211=m
 CONFIG_ATH5K=m
@@ -1329,9 +1347,11 @@
 CONFIG_IWL5000=y
 CONFIG_IWL5000_RUN_TIME_CALIB=y
 CONFIG_IWL3945=m
+CONFIG_IWL3945_RFKILL=y
 CONFIG_IWL3945_DEBUG=y
 CONFIG_IWL3945_SPECTRUM_MEASUREMENT=y
 CONFIG_IWL3945_LEDS=y
+CONFIG_MAC80211_HWSIM=m
 CONFIG_NORTEL_HERMES=m
 CONFIG_P54_COMMON=m
 CONFIG_P54_USB=m
@@ -1822,6 +1842,10 @@
 # CONFIG_I2C_ELEKTOR is not set
 # CONFIG_I2C_I801 is not set
 # CONFIG_I2C_I810 is not set
+# CONFIG_I2C_ISCH is not set
+# CONFIG_I2C_NFORCE2_S4985 is not set
+CONFIG_AT24=m
+
 CONFIG_I2C_NFORCE2=m
 # CONFIG_I2C_OCORES is not set
 CONFIG_I2C_PARPORT=m
@@ -1838,7 +1862,7 @@
 # CONFIG_I2C_SIS96X is not set
 CONFIG_I2C_SIMTEC=m
 CONFIG_I2C_STUB=m
-# CONFIG_I2C_TINY_USB is not set
+CONFIG_I2C_TINY_USB=m
 # CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
@@ -2172,6 +2196,7 @@
 CONFIG_TUNER_3036=m
 # CONFIG_TUNER_TEA5761 is not set
 
+CONFIG_USB_VIDEO_CLASS=m
 
 #
 # Radio Adapters
@@ -2425,6 +2450,8 @@
 CONFIG_SND_AC97_POWER_SAVE=y
 CONFIG_SND_AC97_POWER_SAVE_DEFAULT=5
 
+CONFIG_SND_DRIVERS=y
+
 #
 # ISA devices
 #
@@ -2434,6 +2461,7 @@
 #
 # PCI devices
 #
+CONFIG_SND_PCI=y
 CONFIG_SND_ADLIB=m
 CONFIG_SND_ALI5451=m
 CONFIG_SND_ALS300=m
@@ -2490,7 +2518,7 @@
 CONFIG_SND_NM256=m
 CONFIG_SND_OXYGEN=m
 CONFIG_SND_RME32=m
-# CONFIG_SND_PCSP is not set
+CONFIG_SND_PCSP=m
 CONFIG_SND_PCXHR=m
 CONFIG_SND_RIPTIDE=m
 CONFIG_SND_RME96=m
@@ -2510,6 +2538,7 @@
 #
 # ALSA USB devices
 #
+CONFIG_SND_USB=y
 CONFIG_SND_USB_AUDIO=m
 CONFIG_SND_USB_CAIAQ=m
 CONFIG_SND_USB_CAIAQ_INPUT=y
@@ -2518,6 +2547,7 @@
 #
 # PCMCIA devices
 #
+# CONFIG_SND_PCMCIA is not set
 # CONFIG_SND_VXPOCKET is not set
 
 #
@@ -2689,7 +2719,7 @@
 CONFIG_USB_SERIAL_EMPEG=m
 CONFIG_USB_SERIAL_FTDI_SIO=m
 CONFIG_USB_SERIAL_FUNSOFT=m
-CONFIG_USB_SERIAL_GARMIN=m
+# CONFIG_USB_SERIAL_GARMIN is not set
 CONFIG_USB_SERIAL_HP4X=m
 CONFIG_USB_SERIAL_IPAQ=m
 CONFIG_USB_SERIAL_IPW=m
@@ -2774,7 +2804,7 @@
 CONFIG_USB_PHIDGETMOTORCONTROL=m
 CONFIG_USB_PWC=m
 # CONFIG_USB_PWC_DEBUG is not set
-CONFIG_USB_RIO500=m
+# CONFIG_USB_RIO500 is not set
 CONFIG_USB_QUICKCAM_MESSENGER=m
 CONFIG_USB_SL811_HCD=m
 CONFIG_USB_SISUSBVGA=m
@@ -2972,6 +3002,7 @@
 # CONFIG_OCFS2_DEBUG_MASKLOG is not set
 CONFIG_OCFS2_FS_O2CB=m
 CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
+# CONFIG_OCFS2_FS_STATS is not set
 CONFIG_CONFIGFS_FS=m
 
 CONFIG_DLM=m
@@ -2980,6 +3011,11 @@
 CONFIG_GFS2_FS_LOCKING_NOLOCK=m
 CONFIG_GFS2_FS_LOCKING_DLM=m
 
+CONFIG_UBIFS_FS=m
+CONFIG_UBIFS_FS_XATTR=y
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+# CONFIG_UBIFS_FS_DEBUG is not set
+
 #
 # Partition Types
 #
@@ -3150,6 +3186,10 @@
 CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_NULL=m
 CONFIG_CRYPTO_PCBC=m
+CONFIG_CRYPTO_RMD128=m
+CONFIG_CRYPTO_RMD160=m
+CONFIG_CRYPTO_RMD256=m
+CONFIG_CRYPTO_RMD320=m
 CONFIG_CRYPTO_SALSA20=m
 CONFIG_CRYPTO_SALSA20_586=m
 CONFIG_CRYPTO_SEED=m
@@ -3169,6 +3209,9 @@
 CONFIG_CRYPTO_DEV_HIFN_795X=m
 CONFIG_CRYPTO_DEV_HIFN_795X_RNG=y
 
+# Random number generation
+CONFIG_CRYPTO_PRNG=m
+
 #
 # Library routines
 #
@@ -3176,6 +3219,7 @@
 CONFIG_CRC32=m
 CONFIG_CRC_CCITT=m
 CONFIG_CRC_ITU_T=m
+CONFIG_CRC_T10DIF=m
 
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
@@ -3207,6 +3251,7 @@
 CONFIG_GROUP_SCHED=y
 CONFIG_RT_GROUP_SCHED=y
 CONFIG_CGROUP_SCHED=y
+# NOTE: Before changing the below, take notice that page struct will grow past a cacheline on 32bit.
 # CONFIG_CGROUP_MEM_RES_CTLR is not set
 
 CONFIG_CPUSETS=y
@@ -3426,7 +3471,14 @@
 CONFIG_UNUSED_SYMBOLS=y
 
 CONFIG_UTRACE=y
-CONFIG_PTRACE=y
+CONFIG_UTRACE_PTRACE=y
+
+CONFIG_FTRACE=y
+CONFIG_IRQSOFF_TRACER=y
+CONFIG_SCHED_TRACER=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_DYNAMIC_FTRACE=y
+# CONFIG_FTRACE_STARTUP_TEST is not set
 
 CONFIG_KPROBES=y
 
@@ -3539,3 +3591,4 @@
 CONFIG_SOC_CAMERA_MT9V022=m
 # MT9V022_PCA9536_SWITCH is not set
 
+CONFIG_THERMAL_HWMON=y


Index: config-ia64
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-ia64,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- config-ia64	29 Oct 2007 17:29:06 -0000	1.2
+++ config-ia64	18 Jul 2008 14:57:39 -0000	1.3
@@ -1,3 +1,2 @@
 CONFIG_CRASH_DUMP=y
 CONFIG_PROC_VMCORE=y
-


Index: config-ia64-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-ia64-generic,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- config-ia64-generic	16 Jun 2008 10:19:26 -0000	1.4
+++ config-ia64-generic	18 Jul 2008 14:57:39 -0000	1.5
@@ -119,7 +119,7 @@
 # CONFIG_ACPI_BAY is not set
 # CONFIG_ACPI_BATTERY is not set
 CONFIG_ACPI_BLACKLIST_YEAR=0
-CONFIG_ACPI_BUTTON=m
+CONFIG_ACPI_BUTTON=y
 # CONFIG_ACPI_DOCK is not set
 CONFIG_ACPI_EC=y
 CONFIG_ACPI_FAN=y
@@ -201,3 +201,6 @@
 CONFIG_VIRTUALIZATION=y
 CONFIG_KVM=m
 CONFIG_KVM_INTEL=m
+
+CONFIG_UTRACE=n
+CONFIG_UTRACE_PTRACE=n


Index: config-nodebug
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-nodebug,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- config-nodebug	16 Jun 2008 10:19:26 -0000	1.6
+++ config-nodebug	18 Jul 2008 14:57:39 -0000	1.7
@@ -1,6 +1,7 @@
 CONFIG_SND_VERBOSE_PRINTK=y
 CONFIG_SND_DEBUG=y
 CONFIG_SND_DEBUG_DETECT=y
+CONFIG_SND_DEBUG_VERBOSE=y
 CONFIG_SND_PCM_XRUN_DEBUG=y
 
 CONFIG_DEBUG_MUTEXES=y


Index: config-powerpc-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-powerpc-generic,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- config-powerpc-generic	16 Jun 2008 10:19:26 -0000	1.5
+++ config-powerpc-generic	18 Jul 2008 14:57:39 -0000	1.6
@@ -211,6 +211,7 @@
 CONFIG_USB_EHCI_HCD_PPC_OF=y
 
 # CONFIG_MPC5121_ADS is not set
+# CONFIG_MPC5121_GENERIC is not set
 CONFIG_MTD_OF_PARTS=m
 # CONFIG_MTD_NAND_FSL_ELBC is not set
 CONFIG_THERMAL=y
@@ -219,3 +220,32 @@
 
 CONFIG_DMADEVICES=y
 # CONFIG_FSL_DMA is not set
+
+CONFIG_SND_PPC=y
+
+# BORKED.
+# arch/powerpc/platforms/82xx/ep8248e.c:129: undefined reference to `alloc_mdio_bitbang'
+# arch/powerpc/platforms/82xx/ep8248e.c:143: undefined reference to `mdiobus_register'
+# CONFIG_PPC_82xx is not set
+CONFIG_PPC_83xx=y
+CONFIG_PPC_86xx=y
+CONFIG_EXTRA_TARGETS=""
+# CONFIG_CODE_PATCHING_SELFTEST is not set
+# CONFIG_FTR_FIXUP_SELFTEST is not set
+
+# CONFIG_MATH_EMULATION is not set
+# CONFIG_RAPIDIO is not set
+# CONFIG_FS_ENET is not set
+# CONFIG_UCC_GETH is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_SERIAL_CPM is not set
+# CONFIG_SERIAL_QE is not set
+# CONFIG_I2C_CPM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_W1_MASTER_GPIO is not set
+# CONFIG_MT9M001_PCA9536_SWITCH is not set
+# CONFIG_MT9V022_PCA9536_SWITCH is not set
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_KGDB_CONSOLE is not set
+


Index: config-powerpc32-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-powerpc32-generic,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- config-powerpc32-generic	16 Jun 2008 10:19:26 -0000	1.5
+++ config-powerpc32-generic	18 Jul 2008 14:57:39 -0000	1.6
@@ -13,7 +13,29 @@
 CONFIG_PPC_PREP=y
 
 # CONFIG_PPC_MPC5200_SIMPLE is not set
+# CONFIG_SATA_PMP is not set
+# CONFIG_SATA_AHCI is not set
+# CONFIG_SATA_SIL24 is not set
 CONFIG_SATA_FSL=m
+# CONFIG_SATA_SVW is not set
+# CONFIG_SATA_MV is not set
+# CONFIG_SATA_NV is not set
+# CONFIG_SATA_QSTOR is not set
+# CONFIG_SATA_PROMISE is not set
+# CONFIG_SATA_SX4 is not set
+# CONFIG_SATA_SIL is not set
+# CONFIG_SATA_SIS is not set
+# CONFIG_SATA_ULI is not set
+# CONFIG_SATA_VIA is not set
+# CONFIG_SATA_VITESSE is not set
+# CONFIG_SATA_INIC162X is not set
+
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_MM is not set
+# CONFIG_MEGARAID_MAILBOX is not set
+# CONFIG_MEGARAID_LEGACY is not set
+# CONFIG_MEGARAID_SAS is not set
+
 CONFIG_GIANFAR=m
 CONFIG_GFAR_NAPI=y
 CONFIG_USB_EHCI_FSL=y
@@ -71,7 +93,44 @@
 # CONFIG_UDBG_RTAS_CONSOLE is not set
 CONFIG_BRIQ_PANEL=m
 
+# CONFIG_PATA_ALI is not set
+# CONFIG_PATA_AMD is not set
+# CONFIG_PATA_ARTOP is not set
+# CONFIG_PATA_ATIIXP is not set
+# CONFIG_PATA_CMD640_PCI is not set
+# CONFIG_PATA_CMD64X is not set
+# CONFIG_PATA_CS5520 is not set
+# CONFIG_PATA_CS5530 is not set
+# CONFIG_PATA_CYPRESS is not set
+# CONFIG_PATA_EFAR is not set
+CONFIG_ATA_GENERIC=m
+# CONFIG_PATA_HPT366 is not set
+# CONFIG_PATA_HPT37X is not set
+# CONFIG_PATA_HPT3X2N is not set
+# CONFIG_PATA_HPT3X3 is not set
+# CONFIG_PATA_IT821X is not set
+# CONFIG_PATA_IT8213 is not set
+# CONFIG_PATA_JMICRON is not set
+# CONFIG_PATA_TRIFLEX is not set
+# CONFIG_PATA_MARVELL is not set
 CONFIG_PATA_MPC52xx=m
+# CONFIG_PATA_MPIIX is not set
+# CONFIG_PATA_OLDPIIX is not set
+# CONFIG_PATA_NETCELL is not set
+# CONFIG_PATA_NINJA32 is not set
+# CONFIG_PATA_NS87410 is not set
+# CONFIG_PATA_NS87415 is not set
+# CONFIG_PATA_OPTI is not set
+# CONFIG_PATA_PCMCIA is not set
+# CONFIG_PATA_PDC_OLD is not set
+# CONFIG_PATA_QDI is not set
+# CONFIG_PATA_SERVERWORKS is not set
+# CONFIG_PATA_PDC2027X is not set
+# CONFIG_PATA_SIL680 is not set
+# CONFIG_PATA_SIS is not set
+# CONFIG_PATA_WINBOND is not set
+
+# CONFIG_TR is not set
 
 CONFIG_SERIAL_MPC52xx=y
 CONFIG_SERIAL_MPC52xx_CONSOLE=y
@@ -92,12 +151,23 @@
 CONFIG_HIGH_RES_TIMERS=y
 
 # CONFIG_BLK_DEV_PLATFORM is not set
+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_BLK_DEV_4DRIVES is not set
 # CONFIG_BLK_DEV_ALI14XX is not set
 # CONFIG_BLK_DEV_DTC2278 is not set
 # CONFIG_BLK_DEV_HT6560B is not set
 # CONFIG_BLK_DEV_QD65XX is not set
 # CONFIG_BLK_DEV_UMC8672 is not set
+# CONFIG_BLK_DEV_DELKIN is not set
+# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_SX8 is not set
+
+# CONFIG_PCMCIA_AHA152X is not set
+# CONFIG_PCMCIA_NINJA_SCSI is not set
+# CONFIG_PCMCIA_QLOGIC is not set
+# CONFIG_PCMCIA_SYM53C500 is not set
+
 # CONFIG_VIRQ_DEBUG is not set
 
 CONFIG_PPC_BESTCOMM_ATA=m
@@ -116,5 +186,118 @@
 # CONFIG_GPIO_PCF857X is not set
 # CONFIG_HTC_EGPIO is not set
 
+# CONFIG_PARIDE is not set
+# CONFIG_PARPORT_PC_PCMCIA is not set
+# CONFIG_MTD is not set
+# CONFIG_TIFM_CORE is not set
+
+# CONFIG_RFKILL is not set
+# CONFIG_DONGLE is not set
+# CONFIG_IP_VS is not set
+
+
+# CONFIG_BLK_CPQ_CISS_DA is not set
+# CONFIG_CISS_SCSI_TAPE is not set
+# CONFIG_ATA_OVER_ETH is not set
+
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_FC_TGT_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_QLA_FC is not set
+# CONFIG_SCSI_LPFC is not set
+# CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_ACARD is not set
+# CONFIG_SCSI_AHA152X is not set
+# CONFIG_SCSI_AACRAID is not set
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_AIC79XX is not set
+# CONFIG_SCSI_AIC94XX is not set
+# CONFIG_SCSI_ARCMSR is not set
+# CONFIG_SCSI_ARCMSR_AER is not set
+# CONFIG_SCSI_DC395x is not set
+# CONFIG_SCSI_HPTIOP is not set
+# CONFIG_SCSI_GDTH is not set
+# CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
+# CONFIG_SCSI_PPA is not set
+# CONFIG_SCSI_IMM is not set
+# CONFIG_SCSI_MVSAS is not set
+# CONFIG_SCSI_STEX is not set
+# CONFIG_SCSI_SYM53C8XX_2 is not set
+# CONFIG_SCSI_QLOGIC_1280 is not set
+# CONFIG_SCSI_QLA_ISCSI is not set
+
+# CONFIG_ISCSI_TCP is not set
+
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SAS_ATA is not set
+# CONFIG_SCSI_SAS_HOST_SMP is not set
+
+# CONFIG_FUSION is not set
+
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+
+# CONFIG_WLAN_80211 is not set
+
+# CONFIG_IWLWIFI is not set
+# CONFIG_IWLCORE is not set
+# CONFIG_IWL3945 is not set
+# CONFIG_IWL4965 is not set
+# CONFIG_ISDN is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_PCIPCWATCHDOG is not set
+# CONFIG_WDTPCI is not set
+# CONFIG_WDT_501_PCI is not set
+
+# CONFIG_I2C_NFORCE2 is not set
+
+# CONFIG_SND_ADLIB is not set
+# CONFIG_SND_CS4236 is not set
+# CONFIG_SND_SC6000 is not set
+# CONFIG_SND_OPL3SA2 is not set
+# CONFIG_SND_MIRO is not set
+# CONFIG_SND_SB16 is not set
+# CONFIG_SND_SBAWE is not set
+# CONFIG_SND_HDA_INTEL is not set
+# CONFIG_SND_YMFPCI is not set
+# CONFIG_SND_INTEL8X0 is not set
+# CONFIG_SND_INTEL8X0M is not set
+
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_INFINIBAND is not set
+
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_TCG_TPM is not set
+
 # PPC gets sad with debug alloc (bz 448598)
 # CONFIG_DEBUG_PAGEALLOC is not set
+
+CONFIG_SND_ISA=y
+CONFIG_CRYPTO_DEV_TALITOS=m
+
+CONFIG_FSL_EMB_PERFMON=y
+CONFIG_MPC8272_ADS=y
+CONFIG_PQ2FADS=y
+CONFIG_EP8248E=y
+CONFIG_MPC831x_RDB=y
+CONFIG_MPC832x_MDS=y
+CONFIG_MPC832x_RDB=y
+CONFIG_MPC834x_MDS=y
+CONFIG_MPC834x_ITX=y
+CONFIG_MPC836x_MDS=y
+CONFIG_MPC836x_RDK=y
+CONFIG_MPC837x_MDS=y
+CONFIG_MPC837x_RDB=y
+CONFIG_SBC834x=y
+CONFIG_ASP834x=y
+CONFIG_MPC8641_HPCN=y
+CONFIG_SBC8641D=y
+CONFIG_MPC8610_HPCD=y
+CONFIG_83xx_WDT=m
+


Index: config-powerpc64
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-powerpc64,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- config-powerpc64	16 Jun 2008 10:19:26 -0000	1.5
+++ config-powerpc64	18 Jul 2008 14:57:39 -0000	1.6
@@ -163,3 +163,9 @@
 CONFIG_BLK_DEV_HD_ONLY=y
 CONFIG_VIRTUALIZATION=y
 
+CONFIG_VSX=y
+
+CONFIG_SCSI_IBMVFC=m
+# CONFIG_SCSI_IBMVFC_TRACE is not set
+CONFIG_IBM_BSR=m
+


Index: config-s390x
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-s390x,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- config-s390x	16 Jun 2008 10:19:26 -0000	1.4
+++ config-s390x	18 Jul 2008 14:57:39 -0000	1.5
@@ -118,7 +118,6 @@
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_WIRELESS_EXT is not set
-# CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
@@ -209,3 +208,6 @@
 CONFIG_KVM=m
 CONFIG_S390_GUEST=y
 
+
+CONFIG_MEMORY_HOTPLUG=y
+CONFIG_CHSC_SCH=m


Index: config-sparc64-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-sparc64-generic,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- config-sparc64-generic	16 Jun 2008 10:19:26 -0000	1.5
+++ config-sparc64-generic	18 Jul 2008 14:57:39 -0000	1.6
@@ -1,3 +1,4 @@
+# CONFIG_SMP is not set
 CONFIG_SPARC=y
 CONFIG_SPARC64=y
 CONFIG_SECCOMP=y
@@ -188,3 +189,4 @@
 
 CONFIG_NUMA=y
 
+CONFIG_SND_SPARC=y


Index: config-sparc64-smp
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-sparc64-smp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- config-sparc64-smp	29 Oct 2007 17:29:06 -0000	1.2
+++ config-sparc64-smp	18 Jul 2008 14:57:39 -0000	1.3
@@ -0,0 +1 @@
+CONFIG_SMP=y


Index: config-x86-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-x86-generic,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- config-x86-generic	16 Jun 2008 10:19:26 -0000	1.5
+++ config-x86-generic	18 Jul 2008 14:57:39 -0000	1.6
@@ -133,7 +133,7 @@
 CONFIG_ACPI_BATTERY=m
 CONFIG_ACPI_BAY=m
 CONFIG_ACPI_BLACKLIST_YEAR=1999
-CONFIG_ACPI_BUTTON=m
+CONFIG_ACPI_BUTTON=y
 CONFIG_ACPI_CONTAINER=m
 CONFIG_ACPI_DOCK=y
 CONFIG_ACPI_EC=y
@@ -253,13 +253,16 @@
 CONFIG_I2C_AMD8111=m
 CONFIG_I2C_I801=m
 CONFIG_I2C_I810=m
+CONFIG_I2C_ISCH=m
 CONFIG_I2C_NFORCE2=m
+CONFIG_I2C_NFORCE2_S4985=m
 CONFIG_I2C_PIIX4=m
 CONFIG_I2C_PROSAVAGE=m
 CONFIG_I2C_SAVAGE4=m
 CONFIG_I2C_SIS5595=m
 CONFIG_I2C_SIS630=m
 CONFIG_I2C_SIS96X=m
+
 CONFIG_I2C_VIA=m
 CONFIG_I2C_VIAPRO=m
 CONFIG_I2C_VOODOO3=m
@@ -288,6 +291,7 @@
 
 CONFIG_SCHED_MC=y
 
+CONFIG_SND_ISA=y
 CONFIG_SND_ES18XX=m
 
 CONFIG_TCG_INFINEON=m
@@ -304,15 +308,18 @@
 # CONFIG_SGI_IOC4 is not set
 
 CONFIG_ASUS_LAPTOP=m
+CONFIG_COMPAL_LAPTOP=m
+CONFIG_EEEPC_LAPTOP=m
 CONFIG_FUJITSU_LAPTOP=m
+# CONFIG_FUJITSU_LAPTOP_DEBUG is not set
 CONFIG_MSI_LAPTOP=m
 CONFIG_SONY_LAPTOP=m
-CONFIG_EEEPC_LAPTOP=m
 
 # CONFIG_SMSC37B787_WDT is not set
 CONFIG_W83697HF_WDT=m
 
 CONFIG_PARAVIRT=y
+# CONFIG_PARAVIRT_DEBUG is not set
 
 CONFIG_RELOCATABLE=y
 CONFIG_PHYSICAL_ALIGN=0x400000
@@ -376,3 +383,14 @@
 
 CONFIG_NONPROMISC_DEVMEM=y
 
+# CONFIG_MEMTEST is not set
+# CONFIG_MAXSMP is not set
+CONFIG_MTRR_SANITIZER=y
+CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
+CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
+CONFIG_SYSPROF_TRACER=y
+
+# CONFIG_X86_VERBOSE_BOOTUP is not set
+# CONFIG_MMIOTRACE is not set
+
+# CONFIG_DEBUG_PER_CPU_MAPS is not set


Index: config-x86_64-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-x86_64-generic,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- config-x86_64-generic	16 Jun 2008 10:19:26 -0000	1.7
+++ config-x86_64-generic	18 Jul 2008 14:57:39 -0000	1.8
@@ -77,7 +77,7 @@
 CONFIG_ACPI_BATTERY=m
 CONFIG_ACPI_BAY=m
 CONFIG_ACPI_BLACKLIST_YEAR=0
-CONFIG_ACPI_BUTTON=m
+CONFIG_ACPI_BUTTON=y
 CONFIG_ACPI_CONTAINER=m
 CONFIG_ACPI_DOCK=y
 CONFIG_ACPI_EC=y
@@ -97,12 +97,15 @@
 CONFIG_ACPI_PROC_EVENT=y
 
 CONFIG_ASUS_LAPTOP=m
+CONFIG_COMPAL_LAPTOP=m
 CONFIG_FUJITSU_LAPTOP=m
+# CONFIG_FUJITSU_LAPTOP_DEBUG is not set
 CONFIG_MSI_LAPTOP=m
 CONFIG_SONY_LAPTOP=m
 CONFIG_SONYPI_COMPAT=y
 # CONFIG_EEEPC_LAPTOP is not set
 
+
 CONFIG_THINKPAD_ACPI=m
 # CONFIG_THINKPAD_ACPI_DEBUG is not set
 CONFIG_THINKPAD_ACPI_BAY=y
@@ -154,10 +157,13 @@
 CONFIG_I2C_AMD756_S4882=m
 CONFIG_I2C_AMD8111=m
 CONFIG_I2C_I801=m
+CONFIG_I2C_ISCH=m
 # CONFIG_I2C_I810 is not set
+CONFIG_I2C_NFORCE2_S4985=m
 CONFIG_I2C_PIIX4=m
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
+
 CONFIG_I2C_SIS96X=m
 CONFIG_I2C_VIA=m
 CONFIG_I2C_VIAPRO=m
@@ -254,7 +260,12 @@
 
 CONFIG_SENSORS_I5K_AMB=m
 
-# CONFIG_PARAVIRT_GUEST is not set
+CONFIG_PARAVIRT_GUEST=y
+CONFIG_KVM_CLOCK=y
+CONFIG_KVM_GUEST=y
+CONFIG_PARAVIRT=y
+# CONFIG_PARAVIRT_DEBUG is not set
+
 # CONFIG_COMPAT_VDSO is not set
 CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
 # CONFIG_DEBUG_PER_CPU_MAPS is not set
@@ -274,3 +285,14 @@
 
 CONFIG_DIRECT_GBPAGES=y
 
+# CONFIG_MEMTEST is not set
+CONFIG_AMD_IOMMU=y
+# CONFIG_MAXSMP is not set
+CONFIG_MTRR_SANITIZER=y
+CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
+CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1
+CONFIG_SYSPROF_TRACER=y
+# CONFIG_X86_VERBOSE_BOOTUP is not set
+# CONFIG_MMIOTRACE is not set
+
+CONFIG_X86_MPPARSE=y


Index: config-xen-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-xen-generic,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- config-xen-generic	16 Jun 2008 13:19:10 -0000	1.6
+++ config-xen-generic	18 Jul 2008 14:57:39 -0000	1.7
@@ -11,3 +11,4 @@
 CONFIG_XEN_KBDDEV_FRONTEND=y
 CONFIG_XEN_FBDEV_FRONTEND=y
 
+CONFIG_XEN_MAX_DOMAIN_MEMORY=8


Index: config-xen-x86_64
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-xen-x86_64,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- config-xen-x86_64	16 Jun 2008 13:19:10 -0000	1.7
+++ config-xen-x86_64	18 Jul 2008 14:57:40 -0000	1.8
@@ -1,15 +0,0 @@
-CONFIG_PARAVIRT=y
-CONFIG_PARAVIRT_GUEST=y
-
-# CONFIG_SMP is not set
-# CONFIG_NUMA is not set
-# CONFIG_NEED_MULTIPLE_NODES is not set
-
-# x86_64 breaks with a different CONFIG_PHYSICAL_START, currently
-CONFIG_PHYSICAL_START=0x200000
-
-# x86_64 breaks with CONFIG_SPARSEMEM_VMEMMAP, currently
-# CONFIG_SPARSEMEM_VMEMMAP is not set
-
-# CONFIG_KVM_GUEST is not set
-# CONFIG_KVM_CLOCK is not set


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/kernel.spec,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- kernel.spec	16 Jun 2008 10:19:26 -0000	1.46
+++ kernel.spec	18 Jul 2008 14:57:40 -0000	1.47
@@ -1,4 +1,4 @@
-Summary: The Linux kernel (the core of the Linux operating system)
+Summary: The Linux kernel
 
 # For a stable, released kernel, released_kernel should be 1. For rawhide
 # and/or a kernel built from an rc or git snapshot, released_kernel should
@@ -20,18 +20,18 @@
 # kernel spec when the kernel is rebased, so fedora_build automatically
 # works out to the offset from the rebase, so it doesn't get too ginormous.
 #
-%define fedora_cvs_origin 45
+%define fedora_cvs_origin 46
 %define fedora_build %(R="$Revision$"; R="${R%% \$}"; R="${R##: 1.}"; expr $R - %{fedora_cvs_origin})
 
 # base_sublevel is the kernel version we're starting with and patching
 # on top of -- for example, 2.6.22-rc7-git1 starts with a 2.6.21 base,
 # which yields a base_sublevel of 21.
-%define base_sublevel 25
+%define base_sublevel 26
 
 ## If this is a released kernel ##
 %if 0%{?released_kernel}
 # Do we have a 2.6.21.y update to apply?
-%define stable_update 3
+%define stable_update 0
 # Set rpm version accordingly
 %if 0%{?stable_update}
 %define stablerev .%{stable_update}
@@ -43,9 +43,9 @@
 # The next upstream release sublevel (base_sublevel+1)
 %define upstream_sublevel %(expr %{base_sublevel} + 1)
 # The rc snapshot level
-%define rcrev 6
+%define rcrev 0
 # The git snapshot level
-%define gitrev 2
+%define gitrev 6
 # Set rpm version accordingly
 %define rpmversion 2.6.%{upstream_sublevel}
 %endif
@@ -76,11 +76,16 @@
 %define with_doc       %{?_without_doc:       0} %{?!_without_doc:       1}
 # kernel-headers
 %define with_headers   %{?_without_headers:   0} %{?!_without_headers:   1}
+# kernel-firmware
+%define with_firmware  %{?_without_firmware:  0} %{?!_without_firmware:  1}
 # kernel-debuginfo
 %define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1}
 # kernel-bootwrapper (for creating zImages from kernel + initrd)
 %define with_bootwrapper %{?_without_bootwrapper: 0} %{?!_without_bootwrapper: 1}
 
+# don't build the kernel-doc package
+%define with_doc 0
+
 # Additional options for user-friendly one-off kernel building:
 #
 # Only build the base kernel (--with baseonly):
@@ -251,6 +256,7 @@
 # only package docs noarch
 %ifnarch noarch
 %define with_doc 0
+%define with_firmware 0
 %endif
 
 # no need to build headers again for these arches,
@@ -418,11 +424,15 @@
 %define kernel_smp_obsoletes kernel-enterprise < 2.4.10
 %define kernel_PAE_obsoletes kernel-smp < 2.6.17
 
+# We moved the drm include files into kernel-headers, make sure there's
+# a recent enough libdrm-devel on the system that doesn't have those.
+%define kernel_headers_conflicts libdrm-devel < 2.4.0-0.15
+
 #
 # Packages that need to be installed before the kernel is, because the %post
 # scripts use them.
 #
-%define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1, mkinitrd >= 6.0.39-1
+%define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1, mkinitrd >= 6.0.39-1, kernel-firmware >= %{rpmversion}-%{pkg_release}
 
 #
 # This macro does requires, provides, conflicts, obsoletes for a kernel package.
@@ -537,8 +547,7 @@
 Source70: config-s390x
 
 Source90: config-sparc64-generic
-Source91: config-sparc64
-Source92: config-sparc64-smp
+Source91: config-sparc64-smp
 
 # Here should be only the patches up to the upstream canonical Linus tree.
 
@@ -567,8 +576,7 @@
 ### BRANCH PATCH ###
 %endif
 
-# stable release candidate
-# Patch03: patch-2.6.24.1-rc1.bz2
+Patch02: git-linus.diff
 
 # we always need nonintconfig, even for -vanilla kernels
 Patch06: linux-2.6-build-nonintconfig.patch
@@ -581,7 +589,9 @@
 
 Patch10: linux-2.6-hotfixes.patch
 
-Patch21: linux-2.6-utrace.patch
+Patch21: linux-2.6-ptrace-cleanup.patch
+Patch22: linux-2.6-tracehook.patch
+Patch23: linux-2.6-utrace.patch
 
 Patch41: linux-2.6-sysrq-c.patch
 Patch42: linux-2.6-x86-tune-generic.patch
@@ -593,7 +603,6 @@
 Patch143: linux-2.6-g5-therm-shutdown.patch
 Patch144: linux-2.6-vio-modalias.patch
 Patch147: linux-2.6-imac-transparent-bridge.patch
-Patch148: linux-2.6-powerpc-zImage-32MiB.patch
 Patch149: linux-2.6-efika-not-chrp.patch
 
 Patch160: linux-2.6-execshield.patch
@@ -602,20 +611,20 @@
 Patch270: linux-2.6-debug-taint-vm.patch
 Patch280: linux-2.6-debug-spinlock-taint.patch
 Patch340: linux-2.6-debug-vm-would-have-oomkilled.patch
+Patch350: linux-2.6-debug-list_debug_rcu.patch
 Patch370: linux-2.6-crash-driver.patch
 Patch380: linux-2.6-defaults-pci_no_msi.patch
+Patch390: linux-2.6-defaults-acpi-video.patch
 Patch400: linux-2.6-scsi-cpqarray-set-master.patch
 Patch402: linux-2.6-scsi-mpt-vmware-fix.patch
-Patch410: linux-2.6-alsa-kill-annoying-messages.patch
-Patch411: linux-2.6-hda-intel-fix-dma-position-inaccuracy.patch
 Patch420: linux-2.6-squashfs.patch
 Patch430: linux-2.6-net-silence-noisy-printks.patch
 Patch440: linux-2.6-net-8139-pio-modparam.patch
 Patch441: linux-2.6-net-8139-pio-oqo2.patch
+Patch442: linux-2.6-net-8139-pio-mmio-fallback.patch
 Patch450: linux-2.6-input-kill-stupid-messages.patch
 Patch460: linux-2.6-serial-460800.patch
 Patch510: linux-2.6-silence-noise.patch
-Patch520: linux-2.6-silence-x86-decompressor.patch
 Patch530: linux-2.6-silence-fbcon-logo.patch
 Patch570: linux-2.6-selinux-mprotect-checks.patch
 Patch580: linux-2.6-sparc-selinux-mprotect-checks.patch
@@ -629,19 +638,14 @@
 
 Patch700: linux-2.6-nfs-client-mounts-hang.patch
 
-# SELinux patches, will go upstream in .27
-Patch800: linux-2.6-selinux-deffered-context-mapping.patch
-Patch801: linux-2.6-selinux-deffered-context-mapping-no-sleep.patch
-Patch802: linux-2.6-selinux-generic-ioctl.patch
-Patch803: linux-2.6-selinux-new-proc-checks.patch
-Patch804: linux-2.6-selinux-get-invalid-xattrs.patch
-#
-
 Patch1101: linux-2.6-default-mmf_dump_elf_headers.patch
 Patch1400: linux-2.6-smarter-relatime.patch
 Patch1515: linux-2.6-lirc.patch
 
+Patch1600: linux-2.6-lockdep-uvc.patch
+
 # nouveau + drm fixes
+Patch1800: linux-2.6-export-shmem-bits-for-gem.patch
 Patch1801: linux-2.6-drm-git-mm.patch
 Patch1803: nouveau-drm.patch
 Patch1804: nouveau-drm-update.patch
@@ -665,177 +669,86 @@
 # Fix HID usage descriptor on MS wireless desktop receiver
 Patch2301: linux-2.6-ms-wireless-receiver.patch
 
-# usb video
-Patch2400: linux-2.6-uvcvideo.patch
-
-Patch2501: linux-2.6-ppc-use-libgcc.patch
-
 # get rid of imacfb and make efifb work everywhere it was used
 Patch2600: linux-2.6-merge-efifb-imacfb.patch
 
 # kernel-xen patches start
-Patch5000: linux-2.6-xen-0001-squashfs-Fix-build-without-CONFIG_SMP.patch
-Patch5001: linux-2.6-xen-0002-xen-execshield-Add-xen-specific-load_user_cs_desc.patch
-Patch5002: linux-2.6-xen-0003-xen-execshield-fix-endless-GPF-fault-loop.patch
-Patch5003: linux-2.6-xen-0004-xen-Enable-Xen-console-by-default-in-domU.patch
-Patch5004: linux-2.6-xen-0005-xen-Add-a-vmlinuz-target.patch
-Patch5005: linux-2.6-xen-0006-xen-Add-empty-xenctrl-module.patch
-Patch5006: linux-2.6-xen-0007-xen-Add-proc-xen-capabilities.patch
-Patch5007: linux-2.6-xen-0008-xen-Add-proc-xen-privcmd.patch
-Patch5008: linux-2.6-xen-0009-xen-Add-proc-xen-xenbus.patch
-Patch5009: linux-2.6-xen-0010-xen-Add-Xen-s-sys-hypervisor-interface.patch
-Patch5010: linux-2.6-xen-0011-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch
-Patch5011: linux-2.6-xen-0012-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch
-Patch5012: linux-2.6-xen-0013-xen-expose-set_pte_vaddr-and-make-xen-use-it.patch
-Patch5013: linux-2.6-xen-0014-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch
-Patch5014: linux-2.6-xen-0015-x86_64-Expose-set_pte_vaddr.patch
-Patch5015: linux-2.6-xen-0016-x86_64-Split-set_pte_vaddr.patch
-Patch5016: linux-2.6-xen-0017-x86_64-Add-clear_fixmap.patch
-Patch5017: linux-2.6-xen-0018-xen-x86_64-Make-set_fixmap-a-paravirt-op-on-64-bi.patch
-Patch5018: linux-2.6-xen-0019-xen-x86_64-Hack-to-set-vsyscall-pages-on-user-space.patch
-Patch5019: linux-2.6-xen-0020-Handle-VSYSCALL_FIRST_PAGE-on-xen_set_pte.patch
-Patch5020: linux-2.6-xen-0021-xen-x86_64-Remove-the-640K-1M-hole-and-disable-DMI.patch
-Patch5021: linux-2.6-xen-0022-xen-x86_64-Add-update_va_mapping-64-bit-code.patch
-Patch5022: linux-2.6-xen-0023-x86_64-Add-sync_cmpxchg.patch
-Patch5023: linux-2.6-xen-0024-xen-x86_64-Implement-HYPERVISOR-MULTI-_update_desc.patch
-Patch5024: linux-2.6-xen-0025-xen-x86_64-Add-hacky-64-bit-x86_-read-write-_percpu.patch
-Patch5025: linux-2.6-xen-0026-xen-x86_64-Use-x86_read_percpu-only-to-refer-to-a.patch
-Patch5026: linux-2.6-xen-0027-Add-FIX_PARAVIRT_BOOTAP-to-fixmap_64.h-too.patch
-Patch5027: linux-2.6-xen-0028-Add-gate_offset-and-gate_segment-macros.patch
-Patch5028: linux-2.6-xen-0029-xen_write_idt_entry-and-cvt_gate_to_trap.patch
-Patch5029: linux-2.6-xen-0030-typedefs-for-pte_val-and-friends.patch
-Patch5030: linux-2.6-xen-0031-x86_64-implementation-of-some-page.h-macros.patch
-Patch5031: linux-2.6-xen-0032-Chainsaw-style-ifdefs.patch
-Patch5032: linux-2.6-xen-0033-xen-Make-xen_pte_val-generic.patch
-Patch5033: linux-2.6-xen-0034-More-chainsaw-ifdefs.patch
-Patch5034: linux-2.6-xen-0035-Chainsaw-ifdefs-on-assembly-percpu-handling.patch
-Patch5035: linux-2.6-xen-0036-x86_64-percpu-assembly-macros.patch
-Patch5036: linux-2.6-xen-0037-Some-xen-asm.S-x86_64-code.patch
-Patch5037: linux-2.6-xen-0038-Chainsaw-party-SPLITME.patch
-Patch5038: linux-2.6-xen-0039-xen-asm.S-x86_64-notes.patch
-Patch5039: linux-2.6-xen-0040-xen-x86_64-Make-hypercall-assembly-code-work.patch
-Patch5040: linux-2.6-xen-0041-xen-x86_64-pda-initialization.patch
-Patch5041: linux-2.6-xen-0042-Disable-early_printk-by-default.patch
-Patch5042: linux-2.6-xen-0043-xen-Set-__HYPERVISOR_VIRT_START-for-x86_64.patch
-Patch5043: linux-2.6-xen-0044-Set-__PAGE_OFFSET-as-required-by-Xen.patch
-Patch5044: linux-2.6-xen-0045-DEBUG-Add-xprintk-to-log-directly-via-hypercall-fo.patch
-Patch5045: linux-2.6-xen-0046-DEBUG-Add-xprintk-debugging-printk-prototype-to-hvc.patch
-Patch5046: linux-2.6-xen-0047-Use-__pgd-on-mk_kernel_pgd.patch
-Patch5047: linux-2.6-xen-0048-Include-user-page-tables-on-head_64.S.patch
-Patch5048: linux-2.6-xen-0049-Avoid-using-mk_unsigned_long.patch
-Patch5049: linux-2.6-xen-0050-Lots-of-unrelated-changes.patch
-Patch5050: linux-2.6-xen-0051-Hack-disable-vsmp.patch
-Patch5051: linux-2.6-xen-0052-Export-early_make_page_readonly.patch
-Patch5052: linux-2.6-xen-0053-Disable-multicalls.c-too-verbose-debugging.patch
-Patch5053: linux-2.6-xen-0054-Xen-64-bit-ready-MMU-operations.patch
-Patch5054: linux-2.6-xen-0055-Some-xen-mmu-pv-ops-implemented.patch
-Patch5055: linux-2.6-xen-0056-Trying-to-make-the-pagetable-initialization-code-wor.patch
-Patch5056: linux-2.6-xen-0057-Xen-specific-find_early_table_space-FIXME.patch
-Patch5057: linux-2.6-xen-0058-Xen-call-e820_print_map-when-setting-up-memory.patch
-Patch5058: linux-2.6-xen-0059-Comment-debugging-msgs.patch
-Patch5059: linux-2.6-xen-0060-Try-to-make-pagetables-read-only.patch
-Patch5060: linux-2.6-xen-0061-Debug-dump-pgtables-on-make_page_readonly.patch
-Patch5061: linux-2.6-xen-0062-Disable-apic-at-compile-time-FIXME.patch
-Patch5062: linux-2.6-xen-0063-Parse-early-params-after-init_memory_mapping.patch
-Patch5063: linux-2.6-xen-0064-xen-Move-addr_to_page-to-init.h.patch
-Patch5064: linux-2.6-xen-0065-Make-xen_pxx_val-and-xen_make_pxx-handle-attr-bi.patch
-Patch5065: linux-2.6-xen-0066-Pull-xen_finish_init_mappin-from-XS-upstream.patch
-Patch5066: linux-2.6-xen-0067-Pull-spp_getpage-changes-from-XS-upstream-REVIEWM.patch
-Patch5067: linux-2.6-xen-0068-Pull-xen_extend_init_mapping-from-XS-upstream-FIX.patch
-Patch5068: linux-2.6-xen-0069-New-enum-fixed_addresses-values-REVIEWME.patch
-Patch5069: linux-2.6-xen-0070-Reserve-bootmem-areas-used-by-Xen-FIXME.patch
-Patch5070: linux-2.6-xen-0071-xen_convert_trap_info-use-sizeof-struct-gate_desc.patch
-Patch5071: linux-2.6-xen-0072-Call-paravirt_pagetable_setup_-start-done-REVIEW.patch
-Patch5072: linux-2.6-xen-0073-ifdef-CONFIG_X86_32-on-xen-enlighten.c-REVIEWME.patch
-Patch5073: linux-2.6-xen-0074-Handle-Xen-exception-stack-it-is-different-from-bar.patch
-Patch5074: linux-2.6-xen-0075-Implement-64-bit-version-of-HYPERVISOR_set_callbacks.patch
-Patch5075: linux-2.6-xen-0076-Make-arch_vcpu_info-be-of-the-right-size-on-both-32.patch
-Patch5076: linux-2.6-xen-0077-Implement-asm-xen_iret.patch
-Patch5077: linux-2.6-xen-0078-xen-64-xen_iret-use-iretq-directly-if-returning-t.patch
-Patch5078: linux-2.6-xen-0079-Implement-xen_irqenable_syscall_ret.patch
-Patch5079: linux-2.6-xen-0080-DEBUG-xen_iret-always-return-through-the-hyperviso.patch
-Patch5080: linux-2.6-xen-0081-Implement-some-xen-callbacks-on-xen-entry_64.S.patch
-Patch5081: linux-2.6-xen-0082-Xen-specific-ifdef-hacks-on-kernel-entry_64.S-FIXM.patch
-Patch5082: linux-2.6-xen-0083-Disable-syscall32-code-temporarily-FIXME.patch
-Patch5083: linux-2.6-xen-0084-Use-__KERNEL_DS-as-SS-when-returning-to-a-kernel-thr.patch
-Patch5084: linux-2.6-xen-0085-Use-apic_xen-on-genapic-by-default-FIXME.patch
-Patch5085: linux-2.6-xen-0086-irq-vector-ifdef-chainsaw-FIXME.patch
-Patch5086: linux-2.6-xen-0087-ifdef-chainsaw-on-syscall_init-FIXME.patch
-Patch5087: linux-2.6-xen-0088-Pull-xen-genapic-implementation-from-upstream-Xen.patch
-Patch5088: linux-2.6-xen-0089-Debugging-printk-s.patch
-Patch5089: linux-2.6-xen-0090-Leave-lazy_cpu_mode-on-__switch_to.patch
-Patch5090: linux-2.6-xen-0091-xen-64-Handle-fs-and-gs-on-xen_load_tls-properl.patch
-Patch5091: linux-2.6-xen-0092-Disable-vcpu_info_placement-temporarily-FIXME.patch
-Patch5092: linux-2.6-xen-0093-Fix-typo-on-ifdef-again.patch
-Patch5093: linux-2.6-xen-0094-DEBUG-Don-t-try-to-actually-read-the-page-on-show_.patch
-Patch5094: linux-2.6-xen-0095-Make-load_gs_index-a-paravirt-operation.patch
-Patch5095: linux-2.6-xen-0096-xen-pgd_walk-use-limit-argument-instead-of-FIXADD.patch
-Patch5096: linux-2.6-xen-0097-xen-pgd_walk-Eliminate-BUG_ON-limit-FIXADDR_TOP.patch
-Patch5097: linux-2.6-xen-0098-xen-pgd_walk-accept-start-parameter.patch
-Patch5098: linux-2.6-xen-0099-xen-64-reserve_bootmem-xen_start_info-area.patch
-Patch5099: linux-2.6-xen-0100-pvops-64-call-paravirt_post_allocator_init-on-set.patch
-Patch5100: linux-2.6-xen-0101-use-write_gdt_entry-on-vsyscall_set_cpu-CLEANME.patch
-Patch5101: linux-2.6-xen-0102-xen-64-implement-xen_load_gs_index.patch
-Patch5102: linux-2.6-xen-0103-Make-xen_pgd_unpin-non-static-REVIEWME.patch
-Patch5103: linux-2.6-xen-0104-Xen-64-pgd-allocation-hack-FIXME.patch
-Patch5104: linux-2.6-xen-0105-Set-both-kernel-and-user-PGDs-on-pgd_populate-FI.patch
-Patch5105: linux-2.6-xen-0106-Multi-pagetable-write_cr3-implementation-FIXME.patch
-Patch5106: linux-2.6-xen-0107-Disable-the-weird-count-loop-on-kcons_write_dom0.patch
-Patch5107: linux-2.6-xen-0108-Make-xen_start_info-read-only.patch
-Patch5108: linux-2.6-xen-0109-Hack-to-implement-return-to-userspace-without-SWAPGS.patch
-Patch5109: linux-2.6-xen-0110-Xen-SEGBASE_-defines.patch
-Patch5110: linux-2.6-xen-0111-Xen-HYPERVISOR_set_segment_base-implementation.patch
-Patch5111: linux-2.6-xen-0112-Change-signature-of-paravirt_alloc_-pt-pd-REVIEWME.patch
-Patch5112: linux-2.6-xen-0113-Comment-e820_print_map-call-TEMPORARY.patch
-Patch5113: linux-2.6-xen-0114-Xen-missing-includes.patch
-Patch5114: linux-2.6-xen-0115-asm-x86-pgtable_64.h-include-linux-spinlock.h.patch
-Patch5115: linux-2.6-xen-0116-asm-x86-pgtable.h-include-asm-page.h.patch
-Patch5116: linux-2.6-xen-0117-fix-pxxval_t-usage-on-mm-init_64.c.patch
-Patch5117: linux-2.6-xen-0118-Missing-Xen-include.patch
-Patch5118: linux-2.6-xen-0119-un-static-ipi_to_irq.patch
-Patch5119: linux-2.6-xen-0120-Don-t-use-_PAGE_GLOBAL-bit-under-Xen-FIXME.patch
-Patch5120: linux-2.6-xen-0121-Trying-to-organize-the-xen-bootmem-allocation-mess.patch
-Patch5121: linux-2.6-xen-0122-Xen-reserve_bootmem-xenstore-and-console-interfac.patch
-Patch5122: linux-2.6-xen-0123-pvops-64-call-paravirt_activate_mm-on-activate_mm.patch
-Patch5123: linux-2.6-xen-0124-Xen-64-bit-support-on-xen_pgd_pin.patch
-Patch5124: linux-2.6-xen-0125-Xen-64-pin-user-PGD-on-activate_mm-and-dup_mmap.patch
-Patch5125: linux-2.6-xen-0126-Hack-pgd_walk-to-walk-to-TASK_SIZE-PAGE_SIZE-on-x8.patch
-Patch5126: linux-2.6-xen-0127-Xen-64-Unpin-user-pagetable-on-xen_pgd_unpin.patch
-Patch5127: linux-2.6-xen-0128-Use-un-pin_page-when-un-pinning-pgd.patch
-Patch5128: linux-2.6-xen-0129-Allow-enabling-Xen-on-x86_64.patch
-Patch5129: linux-2.6-xen-0130-Add-include-linux-spinlock_types.h-to-asm-x86-pgt.patch
-Patch5130: linux-2.6-xen-0131-Restore-some-sanity-on-the-initial-pagetable-bootmem.patch
-Patch5131: linux-2.6-xen-0132-Xen-Use-system_call_after_swapgs-as-the-syscall-c.patch
-Patch5132: linux-2.6-xen-0133-Add-a-system_call_after_saveargs-label-to-entry_64.S.patch
-Patch5133: linux-2.6-xen-0134-Create-xen-specific-syscall-entry.patch
-Patch5134: linux-2.6-xen-0135-syscall-related-Xen-ifdefs-FIXME.patch
-Patch5135: linux-2.6-xen-0136-Point-set_pte-to-xen_set_pte-since-the-beginning.patch
-Patch5136: linux-2.6-xen-0137-DEBUG-slab-debugging.patch
-Patch5137: linux-2.6-xen-0138-pvops-64-Include-rsi-on-the-register-clobber-list.patch
-Patch5138: linux-2.6-xen-0139-Xen-64-quick-ugly-hack-to-fix-pgd_clear-pagetabl.patch
-Patch5139: linux-2.6-xen-0140-Add-missing-acpi-include-to-xen-setup.c.patch
-Patch5140: linux-2.6-xen-0141-Don-t-use-FIX_VDSO-on-64-bit.patch
-Patch5141: linux-2.6-xen-0142-Mark-init-pages-read-write-again-on-free_init_pages.patch
-Patch5142: linux-2.6-xen-0143-reserve_early-kernel-text-and-data-segments.patch
-Patch5143: linux-2.6-xen-0144-Xen-Clear-__START_KERNEL_map-PTEs-on-free_init_page.patch
-Patch5144: linux-2.6-xen-0145-Set-pvops-machine_ops-for-Xen-on-x86_64-also-MERGE.patch
-Patch5145: linux-2.6-xen-0146-Pull-xen_failsafe_callback-implementation-from-XenSo.patch
-Patch5146: linux-2.6-xen-0147-Save-fs-and-gs-before-load_TLS-and-arch_leave_la.patch
-Patch5147: linux-2.6-xen-0148-xen-64-Clear-fs-on-xen_load_tls.patch
-Patch5148: linux-2.6-xen-0149-ia32entry.S-Replace-cli-sti-cases-with-DISABLE_INTE.patch
-Patch5149: linux-2.6-xen-0150-Introduce-xen_ia32_syscall.patch
-Patch5150: linux-2.6-xen-0151-Use-xen_ia32_syscall-if-CONFIG_XEN-is-enabled-FIX.patch
-Patch5151: linux-2.6-xen-0152-Make-the-int80-and-syscall-vdso32-implementations-se.patch
-Patch5152: linux-2.6-xen-0153-Use-vdso32-int80-by-default-if-Xen-is-enabled-FIXME.patch
-Patch5153: linux-2.6-xen-0154-xen_pgd_pin-use-TASK_SIZE64-on-x86_64.patch
-Patch5154: linux-2.6-xen-0155-paravirt-ops-64-Save-rdi-also-on-asm-version-of-PV.patch
-Patch5155: linux-2.6-xen-0156-X86_VSMP-make-not-depend-on-XEN-REVIEWME.patch
-Patch5156: linux-2.6-xen-0157-Add-do_IRQ-prototype-to-asm-x86-irq_64.h.patch
-Patch5157: linux-2.6-xen-0158-Disable-sysenter-on-x86_64-temporarily-REVIEWME.patch
-Patch5158: linux-2.6-xen-0159-Add-xen_-alloc-release-_pud-functions-for-x86_64-x.patch
-Patch5159: linux-2.6-xen-0160-Extract-reserve_initrd-from-x86_64_start_kernel.patch
-Patch5160: linux-2.6-xen-0161-Make-reserve_initrd-non-static.patch
-Patch5161: linux-2.6-xen-0162-xen-64-Reserve-initrd-on-xen_start_kernel-also.patch
+Patch5000: linux-2.6-xen-0001-xen-execshield-Add-xen-specific-load_user_cs_desc.patch
+Patch5001: linux-2.6-xen-0002-xen-execshield-fix-endless-GPF-fault-loop.patch
+Patch5002: linux-2.6-xen-0003-xen-Add-a-vmlinuz-target.patch
+Patch5003: linux-2.6-xen-0004-xen-Add-empty-xenctrl-module.patch
+Patch5004: linux-2.6-xen-0005-xen-Add-proc-xen-capabilities.patch
+Patch5005: linux-2.6-xen-0006-xen-Add-proc-xen-privcmd.patch
+Patch5006: linux-2.6-xen-0007-xen-Add-proc-xen-xenbus.patch
+Patch5007: linux-2.6-xen-0008-xen-Add-Xen-s-sys-hypervisor-interface.patch
+Patch5008: linux-2.6-xen-0009-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch
+Patch5009: linux-2.6-xen-0010-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch
+Patch5010: linux-2.6-xen-0011-x86-paravirt-call-paravirt_pagetable_setup_-start.patch
+Patch5011: linux-2.6-xen-0012-pvops-64-call-paravirt_post_allocator_init-on-set.patch
+Patch5012: linux-2.6-xen-0013-x86_64-there-s-no-need-to-preallocate-level1_fixmap.patch
+Patch5013: linux-2.6-xen-0014-x86-clean-up-formatting-of-__switch_to.patch
+Patch5014: linux-2.6-xen-0015-x86-use-__page_aligned_data-bss.patch
+Patch5015: linux-2.6-xen-0016-x86_64-adjust-exception-frame-in-ia32entry.patch
+Patch5016: linux-2.6-xen-0017-x86_64-unstatic-get_local_pda.patch
+Patch5017: linux-2.6-xen-0018-xen-print-backtrace-on-multicall-failure.patch
+Patch5018: linux-2.6-xen-0019-xen-netfront-fix-xennet_release_tx_bufs.patch
+Patch5019: linux-2.6-xen-0020-xen-add-xen_arch_resume-xen_timer_resume-hook-for.patch
+Patch5020: linux-2.6-xen-0021-xen-define-set_pte-from-the-outset.patch
+Patch5021: linux-2.6-xen-0022-xen64-define-asm-xen-interface-for-64-bit.patch
+Patch5022: linux-2.6-xen-0023-xen-make-ELF-notes-work-for-32-and-64-bit.patch
+Patch5023: linux-2.6-xen-0024-xen-fix-64-bit-hypercall-variants.patch
+Patch5024: linux-2.6-xen-0025-xen64-fix-calls-into-hypercall-page.patch
+Patch5025: linux-2.6-xen-0026-xen64-add-extra-pv_mmu_ops.patch
+Patch5026: linux-2.6-xen-0027-xen64-random-ifdefs-to-mask-out-32-bit-only-code.patch
+Patch5027: linux-2.6-xen-0028-xen64-get-active_mm-from-the-pda.patch
+Patch5028: linux-2.6-xen-0029-xen-move-smp-setup-into-smp.c.patch
+Patch5029: linux-2.6-xen-0030-x86_64-add-workaround-for-no-gs-based-percpu.patch
+Patch5030: linux-2.6-xen-0031-xen64-smp.c-compile-hacking.patch
+Patch5031: linux-2.6-xen-0032-xen64-add-xen-head-code-to-head_64.S.patch
+Patch5032: linux-2.6-xen-0033-xen64-add-asm-offsets.patch
+Patch5033: linux-2.6-xen-0034-xen64-add-64-bit-assembler.patch
+Patch5034: linux-2.6-xen-0035-xen64-use-set_fixmap-for-shared_info-structure.patch
+Patch5035: linux-2.6-xen-0036-xen-cpu_detect-is-32-bit-only.patch
+Patch5036: linux-2.6-xen-0037-xen64-add-hypervisor-callbacks-for-events-etc.patch
+Patch5037: linux-2.6-xen-0038-xen64-early-mapping-setup.patch
+Patch5038: linux-2.6-xen-0039-xen64-64-bit-starts-using-set_pte-from-very-early.patch
+Patch5039: linux-2.6-xen-0040-xen64-map-an-initial-chunk-of-physical-memory.patch
+Patch5040: linux-2.6-xen-0041-xen32-create-initial-mappings-like-64-bit.patch
+Patch5041: linux-2.6-xen-0042-xen-fix-truncation-of-machine-address.patch
+Patch5042: linux-2.6-xen-0043-xen64-use-arbitrary_virt_to_machine-for-xen_set_pmd.patch
+Patch5043: linux-2.6-xen-0044-xen-set-num_processors.patch
+Patch5044: linux-2.6-xen-0045-xen64-defer-setting-pagetable-alloc-release-ops.patch
+Patch5045: linux-2.6-xen-0046-xen-use-set_pte_vaddr.patch
+Patch5046: linux-2.6-xen-0047-xen64-xen_write_idt_entry-and-cvt_gate_to_trap.patch
+Patch5047: linux-2.6-xen-0048-xen64-deal-with-extra-words-Xen-pushes-onto-excepti.patch
+Patch5048: linux-2.6-xen-0049-xen64-add-pvop-for-swapgs.patch
+Patch5049: linux-2.6-xen-0050-xen64-register-callbacks-in-arch-independent-way.patch
+Patch5050: linux-2.6-xen-0051-xen64-add-identity-irq-vector-map.patch
+Patch5051: linux-2.6-xen-0052-Xen64-HYPERVISOR_set_segment_base-implementation.patch
+Patch5052: linux-2.6-xen-0053-xen64-implement-xen_load_gs_index.patch
+Patch5053: linux-2.6-xen-0054-xen-rework-pgd_walk-to-deal-with-32-64-bit.patch
+Patch5054: linux-2.6-xen-0055-xen-make-sure-the-kernel-command-line-is-right.patch
+Patch5055: linux-2.6-xen-0056-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch
+Patch5056: linux-2.6-xen-0057-xen64-implement-failsafe-callback.patch
+Patch5057: linux-2.6-xen-0058-xen64-Clear-fs-on-xen_load_tls.patch
+Patch5058: linux-2.6-xen-0059-xen64-implement-64-bit-update_descriptor.patch
+Patch5059: linux-2.6-xen-0060-xen64-save-lots-of-registers.patch
+Patch5060: linux-2.6-xen-0061-xen64-allocate-and-manage-user-pagetables.patch
+Patch5061: linux-2.6-xen-0062-xen64-set-up-syscall-and-sysenter-entrypoints-for-6.patch
+Patch5062: linux-2.6-xen-0063-xen64-set-up-userspace-syscall-patch.patch
+Patch5063: linux-2.6-xen-0064-xen-implement-Xen-write_msr-operation.patch
+Patch5064: linux-2.6-xen-0065-xen-update-Kconfig-to-allow-64-bit-Xen.patch
+Patch5065: linux-2.6-xen-0066-xen64-fix-HVC_XEN-build-dependency.patch
+Patch5066: linux-2.6-xen-0067-xen64-fix-build-error-on-32-bit-HIGHMEM.patch
+Patch5067: linux-2.6-xen-0068-Revert-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch
+Patch5068: linux-2.6-xen-0069-Revert-x86_64-there-s-no-need-to-preallocate-level.patch
+Patch5069: linux-2.6-xen-0070-xen64-disable-32-bit-syscall-sysenter-if-not-suppor.patch
+Patch5070: linux-2.6-xen-0071-x86-xen-vdso-fix-build-error.patch
+Patch5071: linux-2.6-xen-0072-x86_64-further-cleanup-of-32-bit-compat-syscall-mec.patch
+Patch5072: linux-2.6-xen-0073-x86-xen-no-need-to-disable-vdso32.patch
+Patch5073: linux-2.6-xen-0074-x86_64-adjust-exception-frame-on-paranoid-exception.patch
+Patch5074: linux-2.6-xen-0075-x86-xen-power-fix-up-config-dependencies-on-PM.patch
+Patch5075: linux-2.6-xen-0076-linux-next-pci-tree-build-failure.patch
 # kernel-xen patches end
 
 # Xen hypervisor patches (20000+)
@@ -884,6 +797,14 @@
 building most standard programs and are also needed for rebuilding the
 glibc package.
 
+%package firmware
+Summary: Firmware files used by the Linux kernel
+Group: Development/System
+License: Redistributable
+%description firmware
+Kernel-firmware includes firmware files required for some devices to
+operate.
+
 %package bootwrapper
 Summary: Boot wrapper files for generating combined kernel + initrd images
 Group: Development/System
@@ -1178,8 +1099,7 @@
   done
 %endif
 
-# stable release candidate
-# ApplyPatch patch-2.6.24.1-rc1.bz2
+#ApplyPatch git-linus.diff
 
 # This patch adds a "make nonint_oldconfig" which is non-interactive and
 # also gives a list of missing options at the end. Useful for automated
@@ -1202,9 +1122,9 @@
 ApplyPatch linux-2.6-hotfixes.patch
 
 # Roland's utrace ptrace replacement.
-%ifnarch ia64
+#ApplyPatch linux-2.6-ptrace-cleanup.patch
+#ApplyPatch linux-2.6-tracehook.patch
 #ApplyPatch linux-2.6-utrace.patch
-%endif
 
 # enable sysrq-c on all kernels, not only kexec
 ApplyPatch linux-2.6-sysrq-c.patch
@@ -1234,8 +1154,6 @@
 ApplyPatch linux-2.6-vio-modalias.patch
 # Work around PCIe bridge setup on iSight
 ApplyPatch linux-2.6-imac-transparent-bridge.patch
-# Link zImage at 32MiB (for POWER machines, Efika)
-ApplyPatch linux-2.6-powerpc-zImage-32MiB.patch
 # Don't show 'CHRP' in /proc/cpuinfo on Efika
 #ApplyPatch linux-2.6-efika-not-chrp.patch
 
@@ -1263,6 +1181,7 @@
 ApplyPatch linux-2.6-debug-taint-vm.patch
 ApplyPatch linux-2.6-debug-spinlock-taint.patch
 ApplyPatch linux-2.6-debug-vm-would-have-oomkilled.patch
+#ApplyPatch linux-2.6-debug-list_debug_rcu.patch
 
 #
 # /dev/crash driver for the crashdump analysis tool
@@ -1284,12 +1203,6 @@
 #ApplyPatch linux-2.6-scsi-mpt-vmware-fix.patch
 
 # ALSA
-#
-ApplyPatch linux-2.6-alsa-kill-annoying-messages.patch
-# In upstream alsa. Resolves issues with glitch-free pulseaudio on hda-intel.
-# See: https://tango.0pointer.de/pipermail/pulseaudio-discuss/2008-May/001837.html
-#      http://mailman.alsa-project.org/pipermail/alsa-devel/2008-May/007856.html
-ApplyPatch linux-2.6-hda-intel-fix-dma-position-inaccuracy.patch
 
 # Filesystem patches.
 # Squashfs
@@ -1302,6 +1215,8 @@
 ApplyPatch linux-2.6-net-8139-pio-modparam.patch
 # OQO2 needs PIO
 ApplyPatch linux-2.6-net-8139-pio-oqo2.patch
+# PIO fallback
+ApplyPatch linux-2.6-net-8139-pio-mmio-fallback.patch
 
 # Misc fixes
 # The input layer spews crap no-one cares about.
@@ -1312,16 +1227,13 @@
 # Silence some useless messages that still get printed with 'quiet'
 ApplyPatch linux-2.6-silence-noise.patch
 
-# Make the real mode boot decompressor understand and honor 'quiet'
-ApplyPatch linux-2.6-silence-x86-decompressor.patch
-
 # Make fbcon not show the penguins with 'quiet'
 ApplyPatch linux-2.6-silence-fbcon-logo.patch
 
 # Fix the SELinux mprotect checks on executable mappings
-ApplyPatch linux-2.6-selinux-mprotect-checks.patch
+#ApplyPatch linux-2.6-selinux-mprotect-checks.patch
 # Fix SELinux for sparc
-ApplyPatch linux-2.6-sparc-selinux-mprotect-checks.patch
+#ApplyPatch linux-2.6-sparc-selinux-mprotect-checks.patch
 
 # Changes to upstream defaults.
 # Use UTF-8 by default on VFAT.
@@ -1332,15 +1244,8 @@
 # wake up links that have been put to sleep by BIOS (#436099)
 ApplyPatch linux-2.6-libata-force-hardreset-in-sleep-mode.patch
 
-# Allow selinux to defer validation of contexts, aka: rpm can write illegal labels
-ApplyPatch linux-2.6-selinux-deffered-context-mapping.patch
-ApplyPatch linux-2.6-selinux-deffered-context-mapping-no-sleep.patch
-ApplyPatch linux-2.6-selinux-generic-ioctl.patch
-ApplyPatch linux-2.6-selinux-new-proc-checks.patch
-ApplyPatch linux-2.6-selinux-get-invalid-xattrs.patch
-
 # wireless patches headed for 2.6.26
-ApplyPatch linux-2.6-wireless.patch
+#ApplyPatch linux-2.6-wireless.patch
 # wireless patches headed for 2.6.27
 ApplyPatch linux-2.6-wireless-pending.patch
 
@@ -1365,7 +1270,11 @@
 
 #ApplyPatch linux-2.6-netdev-atl2.patch
 
+ApplyPatch linux-2.6-lockdep-uvc.patch
+
 # Nouveau DRM + drm fixes
+ApplyPatch linux-2.6-export-shmem-bits-for-gem.patch
+
 #ApplyPatch linux-2.6-drm-git-mm.patch
 #ApplyPatch nouveau-drm.patch
 #ApplyPatch nouveau-drm-update.patch
@@ -1375,190 +1284,94 @@
 #ApplyPatch linux-2.6-drm-modesetting-oops-fixes.patch
 #ApplyPatch linux-2.6-drm-fix-master-perm.patch
 
-# ext4dev stable patch queue, slated for 2.6.25
-#ApplyPatch linux-2.6-ext4-stable-queue.patch
-
 # linux1394 git patches
 #C=$(wc -l $RPM_SOURCE_DIR/linux-2.6-firewire-git-pending.patch | awk '{print $1}')
 #if [ "$C" -gt 10 ]; then
 #ApplyPatch linux-2.6-firewire-git-pending.patch
 #fi
 
-# usb video
-#ApplyPatch linux-2.6-uvcvideo.patch
-
-ApplyPatch linux-2.6-ppc-use-libgcc.patch
-
 # get rid of imacfb and make efifb work everywhere it was used
-#ApplyPatch linux-2.6-merge-efifb-imacfb.patch
+ApplyPatch linux-2.6-merge-efifb-imacfb.patch
 
 # ---------- below all scheduled for 2.6.24 -----------------
 
 # kernel-xen apply start
-ApplyPatch linux-2.6-xen-0001-squashfs-Fix-build-without-CONFIG_SMP.patch
-ApplyPatch linux-2.6-xen-0002-xen-execshield-Add-xen-specific-load_user_cs_desc.patch
-ApplyPatch linux-2.6-xen-0003-xen-execshield-fix-endless-GPF-fault-loop.patch
-ApplyPatch linux-2.6-xen-0004-xen-Enable-Xen-console-by-default-in-domU.patch
-ApplyPatch linux-2.6-xen-0005-xen-Add-a-vmlinuz-target.patch
-ApplyPatch linux-2.6-xen-0006-xen-Add-empty-xenctrl-module.patch
-ApplyPatch linux-2.6-xen-0007-xen-Add-proc-xen-capabilities.patch
-ApplyPatch linux-2.6-xen-0008-xen-Add-proc-xen-privcmd.patch
-ApplyPatch linux-2.6-xen-0009-xen-Add-proc-xen-xenbus.patch
-ApplyPatch linux-2.6-xen-0010-xen-Add-Xen-s-sys-hypervisor-interface.patch
-ApplyPatch linux-2.6-xen-0011-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch
-ApplyPatch linux-2.6-xen-0012-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch
-%ifarch x86_64
-ApplyPatch linux-2.6-xen-0013-xen-expose-set_pte_vaddr-and-make-xen-use-it.patch
-ApplyPatch linux-2.6-xen-0014-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch
-ApplyPatch linux-2.6-xen-0015-x86_64-Expose-set_pte_vaddr.patch
-ApplyPatch linux-2.6-xen-0016-x86_64-Split-set_pte_vaddr.patch
-ApplyPatch linux-2.6-xen-0017-x86_64-Add-clear_fixmap.patch
-ApplyPatch linux-2.6-xen-0018-xen-x86_64-Make-set_fixmap-a-paravirt-op-on-64-bi.patch
-ApplyPatch linux-2.6-xen-0019-xen-x86_64-Hack-to-set-vsyscall-pages-on-user-space.patch
-ApplyPatch linux-2.6-xen-0020-Handle-VSYSCALL_FIRST_PAGE-on-xen_set_pte.patch
-ApplyPatch linux-2.6-xen-0021-xen-x86_64-Remove-the-640K-1M-hole-and-disable-DMI.patch
-ApplyPatch linux-2.6-xen-0022-xen-x86_64-Add-update_va_mapping-64-bit-code.patch
-ApplyPatch linux-2.6-xen-0023-x86_64-Add-sync_cmpxchg.patch
-ApplyPatch linux-2.6-xen-0024-xen-x86_64-Implement-HYPERVISOR-MULTI-_update_desc.patch
-ApplyPatch linux-2.6-xen-0025-xen-x86_64-Add-hacky-64-bit-x86_-read-write-_percpu.patch
-ApplyPatch linux-2.6-xen-0026-xen-x86_64-Use-x86_read_percpu-only-to-refer-to-a.patch
-ApplyPatch linux-2.6-xen-0027-Add-FIX_PARAVIRT_BOOTAP-to-fixmap_64.h-too.patch
-ApplyPatch linux-2.6-xen-0028-Add-gate_offset-and-gate_segment-macros.patch
-ApplyPatch linux-2.6-xen-0029-xen_write_idt_entry-and-cvt_gate_to_trap.patch
-ApplyPatch linux-2.6-xen-0030-typedefs-for-pte_val-and-friends.patch
-ApplyPatch linux-2.6-xen-0031-x86_64-implementation-of-some-page.h-macros.patch
-ApplyPatch linux-2.6-xen-0032-Chainsaw-style-ifdefs.patch
-ApplyPatch linux-2.6-xen-0033-xen-Make-xen_pte_val-generic.patch
-ApplyPatch linux-2.6-xen-0034-More-chainsaw-ifdefs.patch
-ApplyPatch linux-2.6-xen-0035-Chainsaw-ifdefs-on-assembly-percpu-handling.patch
-ApplyPatch linux-2.6-xen-0036-x86_64-percpu-assembly-macros.patch
-ApplyPatch linux-2.6-xen-0037-Some-xen-asm.S-x86_64-code.patch
-ApplyPatch linux-2.6-xen-0038-Chainsaw-party-SPLITME.patch
-ApplyPatch linux-2.6-xen-0039-xen-asm.S-x86_64-notes.patch
-ApplyPatch linux-2.6-xen-0040-xen-x86_64-Make-hypercall-assembly-code-work.patch
-ApplyPatch linux-2.6-xen-0041-xen-x86_64-pda-initialization.patch
-ApplyPatch linux-2.6-xen-0042-Disable-early_printk-by-default.patch
-ApplyPatch linux-2.6-xen-0043-xen-Set-__HYPERVISOR_VIRT_START-for-x86_64.patch
-ApplyPatch linux-2.6-xen-0044-Set-__PAGE_OFFSET-as-required-by-Xen.patch
-ApplyPatch linux-2.6-xen-0045-DEBUG-Add-xprintk-to-log-directly-via-hypercall-fo.patch
-ApplyPatch linux-2.6-xen-0046-DEBUG-Add-xprintk-debugging-printk-prototype-to-hvc.patch
-ApplyPatch linux-2.6-xen-0047-Use-__pgd-on-mk_kernel_pgd.patch
-ApplyPatch linux-2.6-xen-0048-Include-user-page-tables-on-head_64.S.patch
-ApplyPatch linux-2.6-xen-0049-Avoid-using-mk_unsigned_long.patch
-ApplyPatch linux-2.6-xen-0050-Lots-of-unrelated-changes.patch
-ApplyPatch linux-2.6-xen-0051-Hack-disable-vsmp.patch
-ApplyPatch linux-2.6-xen-0052-Export-early_make_page_readonly.patch
-ApplyPatch linux-2.6-xen-0053-Disable-multicalls.c-too-verbose-debugging.patch
-ApplyPatch linux-2.6-xen-0054-Xen-64-bit-ready-MMU-operations.patch
-ApplyPatch linux-2.6-xen-0055-Some-xen-mmu-pv-ops-implemented.patch
-ApplyPatch linux-2.6-xen-0056-Trying-to-make-the-pagetable-initialization-code-wor.patch
-ApplyPatch linux-2.6-xen-0057-Xen-specific-find_early_table_space-FIXME.patch
-ApplyPatch linux-2.6-xen-0058-Xen-call-e820_print_map-when-setting-up-memory.patch
-ApplyPatch linux-2.6-xen-0059-Comment-debugging-msgs.patch
-ApplyPatch linux-2.6-xen-0060-Try-to-make-pagetables-read-only.patch
-ApplyPatch linux-2.6-xen-0061-Debug-dump-pgtables-on-make_page_readonly.patch
-ApplyPatch linux-2.6-xen-0062-Disable-apic-at-compile-time-FIXME.patch
-ApplyPatch linux-2.6-xen-0063-Parse-early-params-after-init_memory_mapping.patch
-ApplyPatch linux-2.6-xen-0064-xen-Move-addr_to_page-to-init.h.patch
-ApplyPatch linux-2.6-xen-0065-Make-xen_pxx_val-and-xen_make_pxx-handle-attr-bi.patch
-ApplyPatch linux-2.6-xen-0066-Pull-xen_finish_init_mappin-from-XS-upstream.patch
-ApplyPatch linux-2.6-xen-0067-Pull-spp_getpage-changes-from-XS-upstream-REVIEWM.patch
-ApplyPatch linux-2.6-xen-0068-Pull-xen_extend_init_mapping-from-XS-upstream-FIX.patch
-ApplyPatch linux-2.6-xen-0069-New-enum-fixed_addresses-values-REVIEWME.patch
-ApplyPatch linux-2.6-xen-0070-Reserve-bootmem-areas-used-by-Xen-FIXME.patch
-ApplyPatch linux-2.6-xen-0071-xen_convert_trap_info-use-sizeof-struct-gate_desc.patch
-ApplyPatch linux-2.6-xen-0072-Call-paravirt_pagetable_setup_-start-done-REVIEW.patch
-ApplyPatch linux-2.6-xen-0073-ifdef-CONFIG_X86_32-on-xen-enlighten.c-REVIEWME.patch
-ApplyPatch linux-2.6-xen-0074-Handle-Xen-exception-stack-it-is-different-from-bar.patch
-ApplyPatch linux-2.6-xen-0075-Implement-64-bit-version-of-HYPERVISOR_set_callbacks.patch
-ApplyPatch linux-2.6-xen-0076-Make-arch_vcpu_info-be-of-the-right-size-on-both-32.patch
-ApplyPatch linux-2.6-xen-0077-Implement-asm-xen_iret.patch
-ApplyPatch linux-2.6-xen-0078-xen-64-xen_iret-use-iretq-directly-if-returning-t.patch
-ApplyPatch linux-2.6-xen-0079-Implement-xen_irqenable_syscall_ret.patch
-ApplyPatch linux-2.6-xen-0080-DEBUG-xen_iret-always-return-through-the-hyperviso.patch
-ApplyPatch linux-2.6-xen-0081-Implement-some-xen-callbacks-on-xen-entry_64.S.patch
-ApplyPatch linux-2.6-xen-0082-Xen-specific-ifdef-hacks-on-kernel-entry_64.S-FIXM.patch
-ApplyPatch linux-2.6-xen-0083-Disable-syscall32-code-temporarily-FIXME.patch
-ApplyPatch linux-2.6-xen-0084-Use-__KERNEL_DS-as-SS-when-returning-to-a-kernel-thr.patch
-ApplyPatch linux-2.6-xen-0085-Use-apic_xen-on-genapic-by-default-FIXME.patch
-ApplyPatch linux-2.6-xen-0086-irq-vector-ifdef-chainsaw-FIXME.patch
-ApplyPatch linux-2.6-xen-0087-ifdef-chainsaw-on-syscall_init-FIXME.patch
-ApplyPatch linux-2.6-xen-0088-Pull-xen-genapic-implementation-from-upstream-Xen.patch
-ApplyPatch linux-2.6-xen-0089-Debugging-printk-s.patch
-ApplyPatch linux-2.6-xen-0090-Leave-lazy_cpu_mode-on-__switch_to.patch
-ApplyPatch linux-2.6-xen-0091-xen-64-Handle-fs-and-gs-on-xen_load_tls-properl.patch
-ApplyPatch linux-2.6-xen-0092-Disable-vcpu_info_placement-temporarily-FIXME.patch
-ApplyPatch linux-2.6-xen-0093-Fix-typo-on-ifdef-again.patch
-ApplyPatch linux-2.6-xen-0094-DEBUG-Don-t-try-to-actually-read-the-page-on-show_.patch
-ApplyPatch linux-2.6-xen-0095-Make-load_gs_index-a-paravirt-operation.patch
-ApplyPatch linux-2.6-xen-0096-xen-pgd_walk-use-limit-argument-instead-of-FIXADD.patch
-ApplyPatch linux-2.6-xen-0097-xen-pgd_walk-Eliminate-BUG_ON-limit-FIXADDR_TOP.patch
-ApplyPatch linux-2.6-xen-0098-xen-pgd_walk-accept-start-parameter.patch
-ApplyPatch linux-2.6-xen-0099-xen-64-reserve_bootmem-xen_start_info-area.patch
-ApplyPatch linux-2.6-xen-0100-pvops-64-call-paravirt_post_allocator_init-on-set.patch
-ApplyPatch linux-2.6-xen-0101-use-write_gdt_entry-on-vsyscall_set_cpu-CLEANME.patch
-ApplyPatch linux-2.6-xen-0102-xen-64-implement-xen_load_gs_index.patch
-ApplyPatch linux-2.6-xen-0103-Make-xen_pgd_unpin-non-static-REVIEWME.patch
-ApplyPatch linux-2.6-xen-0104-Xen-64-pgd-allocation-hack-FIXME.patch
-ApplyPatch linux-2.6-xen-0105-Set-both-kernel-and-user-PGDs-on-pgd_populate-FI.patch
-ApplyPatch linux-2.6-xen-0106-Multi-pagetable-write_cr3-implementation-FIXME.patch
-ApplyPatch linux-2.6-xen-0107-Disable-the-weird-count-loop-on-kcons_write_dom0.patch
-ApplyPatch linux-2.6-xen-0108-Make-xen_start_info-read-only.patch
-ApplyPatch linux-2.6-xen-0109-Hack-to-implement-return-to-userspace-without-SWAPGS.patch
-ApplyPatch linux-2.6-xen-0110-Xen-SEGBASE_-defines.patch
-ApplyPatch linux-2.6-xen-0111-Xen-HYPERVISOR_set_segment_base-implementation.patch
-ApplyPatch linux-2.6-xen-0112-Change-signature-of-paravirt_alloc_-pt-pd-REVIEWME.patch
-ApplyPatch linux-2.6-xen-0113-Comment-e820_print_map-call-TEMPORARY.patch
-ApplyPatch linux-2.6-xen-0114-Xen-missing-includes.patch
-ApplyPatch linux-2.6-xen-0115-asm-x86-pgtable_64.h-include-linux-spinlock.h.patch
-ApplyPatch linux-2.6-xen-0116-asm-x86-pgtable.h-include-asm-page.h.patch
-ApplyPatch linux-2.6-xen-0117-fix-pxxval_t-usage-on-mm-init_64.c.patch
-ApplyPatch linux-2.6-xen-0118-Missing-Xen-include.patch
-ApplyPatch linux-2.6-xen-0119-un-static-ipi_to_irq.patch
-ApplyPatch linux-2.6-xen-0120-Don-t-use-_PAGE_GLOBAL-bit-under-Xen-FIXME.patch
-ApplyPatch linux-2.6-xen-0121-Trying-to-organize-the-xen-bootmem-allocation-mess.patch
-ApplyPatch linux-2.6-xen-0122-Xen-reserve_bootmem-xenstore-and-console-interfac.patch
-ApplyPatch linux-2.6-xen-0123-pvops-64-call-paravirt_activate_mm-on-activate_mm.patch
-ApplyPatch linux-2.6-xen-0124-Xen-64-bit-support-on-xen_pgd_pin.patch
-ApplyPatch linux-2.6-xen-0125-Xen-64-pin-user-PGD-on-activate_mm-and-dup_mmap.patch
-ApplyPatch linux-2.6-xen-0126-Hack-pgd_walk-to-walk-to-TASK_SIZE-PAGE_SIZE-on-x8.patch
-ApplyPatch linux-2.6-xen-0127-Xen-64-Unpin-user-pagetable-on-xen_pgd_unpin.patch
-ApplyPatch linux-2.6-xen-0128-Use-un-pin_page-when-un-pinning-pgd.patch
-ApplyPatch linux-2.6-xen-0129-Allow-enabling-Xen-on-x86_64.patch
-ApplyPatch linux-2.6-xen-0130-Add-include-linux-spinlock_types.h-to-asm-x86-pgt.patch
-ApplyPatch linux-2.6-xen-0131-Restore-some-sanity-on-the-initial-pagetable-bootmem.patch
-ApplyPatch linux-2.6-xen-0132-Xen-Use-system_call_after_swapgs-as-the-syscall-c.patch
-ApplyPatch linux-2.6-xen-0133-Add-a-system_call_after_saveargs-label-to-entry_64.S.patch
-ApplyPatch linux-2.6-xen-0134-Create-xen-specific-syscall-entry.patch
-ApplyPatch linux-2.6-xen-0135-syscall-related-Xen-ifdefs-FIXME.patch
-ApplyPatch linux-2.6-xen-0136-Point-set_pte-to-xen_set_pte-since-the-beginning.patch
-ApplyPatch linux-2.6-xen-0137-DEBUG-slab-debugging.patch
-ApplyPatch linux-2.6-xen-0138-pvops-64-Include-rsi-on-the-register-clobber-list.patch
-ApplyPatch linux-2.6-xen-0139-Xen-64-quick-ugly-hack-to-fix-pgd_clear-pagetabl.patch
-ApplyPatch linux-2.6-xen-0140-Add-missing-acpi-include-to-xen-setup.c.patch
-ApplyPatch linux-2.6-xen-0141-Don-t-use-FIX_VDSO-on-64-bit.patch
-ApplyPatch linux-2.6-xen-0142-Mark-init-pages-read-write-again-on-free_init_pages.patch
-ApplyPatch linux-2.6-xen-0143-reserve_early-kernel-text-and-data-segments.patch
-ApplyPatch linux-2.6-xen-0144-Xen-Clear-__START_KERNEL_map-PTEs-on-free_init_page.patch
-ApplyPatch linux-2.6-xen-0145-Set-pvops-machine_ops-for-Xen-on-x86_64-also-MERGE.patch
-ApplyPatch linux-2.6-xen-0146-Pull-xen_failsafe_callback-implementation-from-XenSo.patch
-ApplyPatch linux-2.6-xen-0147-Save-fs-and-gs-before-load_TLS-and-arch_leave_la.patch
-ApplyPatch linux-2.6-xen-0148-xen-64-Clear-fs-on-xen_load_tls.patch
-ApplyPatch linux-2.6-xen-0149-ia32entry.S-Replace-cli-sti-cases-with-DISABLE_INTE.patch
-ApplyPatch linux-2.6-xen-0150-Introduce-xen_ia32_syscall.patch
-ApplyPatch linux-2.6-xen-0151-Use-xen_ia32_syscall-if-CONFIG_XEN-is-enabled-FIX.patch
-ApplyPatch linux-2.6-xen-0152-Make-the-int80-and-syscall-vdso32-implementations-se.patch
-ApplyPatch linux-2.6-xen-0153-Use-vdso32-int80-by-default-if-Xen-is-enabled-FIXME.patch
-ApplyPatch linux-2.6-xen-0154-xen_pgd_pin-use-TASK_SIZE64-on-x86_64.patch
-ApplyPatch linux-2.6-xen-0155-paravirt-ops-64-Save-rdi-also-on-asm-version-of-PV.patch
-ApplyPatch linux-2.6-xen-0156-X86_VSMP-make-not-depend-on-XEN-REVIEWME.patch
-ApplyPatch linux-2.6-xen-0157-Add-do_IRQ-prototype-to-asm-x86-irq_64.h.patch
-ApplyPatch linux-2.6-xen-0158-Disable-sysenter-on-x86_64-temporarily-REVIEWME.patch
-ApplyPatch linux-2.6-xen-0159-Add-xen_-alloc-release-_pud-functions-for-x86_64-x.patch
-ApplyPatch linux-2.6-xen-0160-Extract-reserve_initrd-from-x86_64_start_kernel.patch
-ApplyPatch linux-2.6-xen-0161-Make-reserve_initrd-non-static.patch
-ApplyPatch linux-2.6-xen-0162-xen-64-Reserve-initrd-on-xen_start_kernel-also.patch
-%endif
+ApplyPatch linux-2.6-xen-0001-xen-execshield-Add-xen-specific-load_user_cs_desc.patch
+ApplyPatch linux-2.6-xen-0002-xen-execshield-fix-endless-GPF-fault-loop.patch
+ApplyPatch linux-2.6-xen-0003-xen-Add-a-vmlinuz-target.patch
+ApplyPatch linux-2.6-xen-0004-xen-Add-empty-xenctrl-module.patch
+ApplyPatch linux-2.6-xen-0005-xen-Add-proc-xen-capabilities.patch
+ApplyPatch linux-2.6-xen-0006-xen-Add-proc-xen-privcmd.patch
+ApplyPatch linux-2.6-xen-0007-xen-Add-proc-xen-xenbus.patch
+ApplyPatch linux-2.6-xen-0008-xen-Add-Xen-s-sys-hypervisor-interface.patch
+ApplyPatch linux-2.6-xen-0009-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch
+ApplyPatch linux-2.6-xen-0010-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch
+ApplyPatch linux-2.6-xen-0011-x86-paravirt-call-paravirt_pagetable_setup_-start.patch
+ApplyPatch linux-2.6-xen-0012-pvops-64-call-paravirt_post_allocator_init-on-set.patch
+ApplyPatch linux-2.6-xen-0013-x86_64-there-s-no-need-to-preallocate-level1_fixmap.patch
+ApplyPatch linux-2.6-xen-0014-x86-clean-up-formatting-of-__switch_to.patch
+ApplyPatch linux-2.6-xen-0015-x86-use-__page_aligned_data-bss.patch
+ApplyPatch linux-2.6-xen-0016-x86_64-adjust-exception-frame-in-ia32entry.patch
+ApplyPatch linux-2.6-xen-0017-x86_64-unstatic-get_local_pda.patch
+ApplyPatch linux-2.6-xen-0018-xen-print-backtrace-on-multicall-failure.patch
+ApplyPatch linux-2.6-xen-0019-xen-netfront-fix-xennet_release_tx_bufs.patch
+ApplyPatch linux-2.6-xen-0020-xen-add-xen_arch_resume-xen_timer_resume-hook-for.patch
+ApplyPatch linux-2.6-xen-0021-xen-define-set_pte-from-the-outset.patch
+ApplyPatch linux-2.6-xen-0022-xen64-define-asm-xen-interface-for-64-bit.patch
+ApplyPatch linux-2.6-xen-0023-xen-make-ELF-notes-work-for-32-and-64-bit.patch
+ApplyPatch linux-2.6-xen-0024-xen-fix-64-bit-hypercall-variants.patch
+ApplyPatch linux-2.6-xen-0025-xen64-fix-calls-into-hypercall-page.patch
+ApplyPatch linux-2.6-xen-0026-xen64-add-extra-pv_mmu_ops.patch
+ApplyPatch linux-2.6-xen-0027-xen64-random-ifdefs-to-mask-out-32-bit-only-code.patch
+ApplyPatch linux-2.6-xen-0028-xen64-get-active_mm-from-the-pda.patch
+ApplyPatch linux-2.6-xen-0029-xen-move-smp-setup-into-smp.c.patch
+ApplyPatch linux-2.6-xen-0030-x86_64-add-workaround-for-no-gs-based-percpu.patch
+ApplyPatch linux-2.6-xen-0031-xen64-smp.c-compile-hacking.patch
+ApplyPatch linux-2.6-xen-0032-xen64-add-xen-head-code-to-head_64.S.patch
+ApplyPatch linux-2.6-xen-0033-xen64-add-asm-offsets.patch
+ApplyPatch linux-2.6-xen-0034-xen64-add-64-bit-assembler.patch
+ApplyPatch linux-2.6-xen-0035-xen64-use-set_fixmap-for-shared_info-structure.patch
+ApplyPatch linux-2.6-xen-0036-xen-cpu_detect-is-32-bit-only.patch
+ApplyPatch linux-2.6-xen-0037-xen64-add-hypervisor-callbacks-for-events-etc.patch
+ApplyPatch linux-2.6-xen-0038-xen64-early-mapping-setup.patch
+ApplyPatch linux-2.6-xen-0039-xen64-64-bit-starts-using-set_pte-from-very-early.patch
+ApplyPatch linux-2.6-xen-0040-xen64-map-an-initial-chunk-of-physical-memory.patch
+ApplyPatch linux-2.6-xen-0041-xen32-create-initial-mappings-like-64-bit.patch
+ApplyPatch linux-2.6-xen-0042-xen-fix-truncation-of-machine-address.patch
+ApplyPatch linux-2.6-xen-0043-xen64-use-arbitrary_virt_to_machine-for-xen_set_pmd.patch
+ApplyPatch linux-2.6-xen-0044-xen-set-num_processors.patch
+ApplyPatch linux-2.6-xen-0045-xen64-defer-setting-pagetable-alloc-release-ops.patch
+ApplyPatch linux-2.6-xen-0046-xen-use-set_pte_vaddr.patch
+ApplyPatch linux-2.6-xen-0047-xen64-xen_write_idt_entry-and-cvt_gate_to_trap.patch
+ApplyPatch linux-2.6-xen-0048-xen64-deal-with-extra-words-Xen-pushes-onto-excepti.patch
+ApplyPatch linux-2.6-xen-0049-xen64-add-pvop-for-swapgs.patch
+ApplyPatch linux-2.6-xen-0050-xen64-register-callbacks-in-arch-independent-way.patch
+ApplyPatch linux-2.6-xen-0051-xen64-add-identity-irq-vector-map.patch
+ApplyPatch linux-2.6-xen-0052-Xen64-HYPERVISOR_set_segment_base-implementation.patch
+ApplyPatch linux-2.6-xen-0053-xen64-implement-xen_load_gs_index.patch
+ApplyPatch linux-2.6-xen-0054-xen-rework-pgd_walk-to-deal-with-32-64-bit.patch
+ApplyPatch linux-2.6-xen-0055-xen-make-sure-the-kernel-command-line-is-right.patch
+ApplyPatch linux-2.6-xen-0056-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch
+ApplyPatch linux-2.6-xen-0057-xen64-implement-failsafe-callback.patch
+ApplyPatch linux-2.6-xen-0058-xen64-Clear-fs-on-xen_load_tls.patch
+ApplyPatch linux-2.6-xen-0059-xen64-implement-64-bit-update_descriptor.patch
+ApplyPatch linux-2.6-xen-0060-xen64-save-lots-of-registers.patch
+ApplyPatch linux-2.6-xen-0061-xen64-allocate-and-manage-user-pagetables.patch
+ApplyPatch linux-2.6-xen-0062-xen64-set-up-syscall-and-sysenter-entrypoints-for-6.patch
+ApplyPatch linux-2.6-xen-0063-xen64-set-up-userspace-syscall-patch.patch
+ApplyPatch linux-2.6-xen-0064-xen-implement-Xen-write_msr-operation.patch
+ApplyPatch linux-2.6-xen-0065-xen-update-Kconfig-to-allow-64-bit-Xen.patch
+ApplyPatch linux-2.6-xen-0066-xen64-fix-HVC_XEN-build-dependency.patch
+ApplyPatch linux-2.6-xen-0067-xen64-fix-build-error-on-32-bit-HIGHMEM.patch
+ApplyPatch linux-2.6-xen-0068-Revert-suspend-xen-enable-PM_SLEEP-for-CONFIG_XEN.patch
+ApplyPatch linux-2.6-xen-0069-Revert-x86_64-there-s-no-need-to-preallocate-level.patch
+ApplyPatch linux-2.6-xen-0070-xen64-disable-32-bit-syscall-sysenter-if-not-suppor.patch
+ApplyPatch linux-2.6-xen-0071-x86-xen-vdso-fix-build-error.patch
+ApplyPatch linux-2.6-xen-0072-x86_64-further-cleanup-of-32-bit-compat-syscall-mec.patch
+ApplyPatch linux-2.6-xen-0073-x86-xen-no-need-to-disable-vdso32.patch
+ApplyPatch linux-2.6-xen-0074-x86_64-adjust-exception-frame-on-paranoid-exception.patch
+ApplyPatch linux-2.6-xen-0075-x86-xen-power-fix-up-config-dependencies-on-PM.patch
+ApplyPatch linux-2.6-xen-0076-linux-next-pci-tree-build-failure.patch
 # kernel-xen apply end
 
 # END OF PATCH APPLICATIONS
@@ -1707,7 +1520,9 @@
     chmod 755 $RPM_BUILD_ROOT/%{image_install_path}/$InstallName-$KernelVer
 
     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
-    make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer
+    # Override $(mod-fw) because we don't want it to install any firmware
+    # We'll do that ourselves with 'make firmware_install'
+    make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer mod-fw=
 %ifarch %{vdso_arches}
     make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer
 %endif
@@ -1750,7 +1565,7 @@
     rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts/*/*.o
     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
     cd include
-    cp -a acpi config keys linux math-emu media mtd net pcmcia rdma rxrpc scsi sound video asm asm-generic $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
+    cp -a acpi config keys linux math-emu media mtd net pcmcia rdma rxrpc scsi sound video drm asm asm-generic $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
     cp -a `readlink asm` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
     # While arch/powerpc/include/asm is still a symlink to the old
     # include/asm-ppc{64,} directory, include that in kernel-devel too.
@@ -1962,6 +1777,10 @@
 rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
 %endif
 
+%if %{with_firmware}
+make INSTALL_FW_PATH=$RPM_BUILD_ROOT/lib/firmware firmware_install
+%endif
+
 %if %{with_bootwrapper}
 make DESTDIR=$RPM_BUILD_ROOT bootwrapper_install WRAPPER_OBJDIR=%{_libdir}/kernel-wrapper WRAPPER_DTSDIR=%{_libdir}/kernel-wrapper/dts
 %endif
@@ -2083,6 +1902,13 @@
 /usr/include/*
 %endif
 
+%if %{with_firmware}
+%files firmware
+%defattr(-,root,root)
+/lib/firmware/*
+%doc linux-%{kversion}.%{_target_cpu}/firmware/WHENCE
+%endif
+
 %if %{with_bootwrapper}
 %files bootwrapper
 %defattr(-,root,root)
@@ -2167,6 +1993,11 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Fri Jun 18 2008 Mark McLoughlin <markmc at redhat.com>
+- Rebase to kernel-2_6_27-0_159_rc0_git6_fc10
+- Drop Eduardo's 64bit tree and switch to Jeremy's x86.git tree
+- Re-enable SMP etc.
+
 * Mon Jun 16 2008 Mark McLoughlin <markmc at redhat.com>
 - Rebase to kernel-2_6_26-0_72_rc6_git2_fc10
 

linux-2.6-debug-nmi-timeout.patch:

Index: linux-2.6-debug-nmi-timeout.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-debug-nmi-timeout.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6-debug-nmi-timeout.patch	6 Mar 2008 13:59:25 -0000	1.3
+++ linux-2.6-debug-nmi-timeout.patch	18 Jul 2008 14:57:40 -0000	1.4
@@ -1,25 +1,14 @@
---- linux-2.6.20.noarch/arch/x86/kernel/nmi_32.c~	2007-04-13 15:52:37.000000000 -0400
-+++ linux-2.6.20.noarch/arch/x86/kernel/nmi_32.c	2007-04-13 15:53:06.000000000 -0400
-@@ -1044,7 +1044,7 @@ __kprobes int nmi_watchdog_tick(struct p
+--- linux-2.6.26.noarch/arch/x86/kernel/nmi.c~	2008-07-14 20:31:14.000000000 -0400
++++ linux-2.6.26.noarch/arch/x86/kernel/nmi.c	2008-07-14 20:31:38.000000000 -0400
+@@ -416,7 +416,7 @@ nmi_watchdog_tick(struct pt_regs *regs, 
  		 * wait a few IRQs (5 seconds) before doing the oops ...
  		 */
- 		alert_counter[cpu]++;
--		if (alert_counter[cpu] == 5*nmi_hz)
-+		if (alert_counter[cpu] == CONFIG_DEBUG_NMI_TIMEOUT*nmi_hz)
+ 		local_inc(&__get_cpu_var(alert_counter));
+-		if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz)
++		if (local_read(&__get_cpu_var(alert_counter)) == CONFIG_DEBUG_NMI_TIMEOUT * nmi_hz)
  			/*
  			 * die_nmi will return ONLY if NOTIFY_STOP happens..
  			 */
---- linux-2.6.20.noarch/arch/x86/kernel/nmi_64.c~	2007-04-13 15:53:09.000000000 -0400
-+++ linux-2.6.20.noarch/arch/x86/kernel/nmi_64.c	2007-04-13 15:53:29.000000000 -0400
-@@ -923,7 +923,7 @@ int __kprobes nmi_watchdog_tick(struct p
- 		 * wait a few IRQs (5 seconds) before doing the oops ...
- 		 */
- 		local_inc(&__get_cpu_var(alert_counter));
--		if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz)
-+		if (local_read(&__get_cpu_var(alert_counter)) == CONFIG_DEBUG_NMI_TIMEOUT*nmi_hz)
- 			die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs,
- 				panic_on_timeout);
- 	} else {
 --- linux-2.6.21.noarch/lib/Kconfig.debug~	2007-07-06 17:05:46.000000000 -0400
 +++ linux-2.6.21.noarch/lib/Kconfig.debug	2007-07-06 17:06:07.000000000 -0400
 @@ -126,6 +126,14 @@ config SCHEDSTATS

linux-2.6-execshield.patch:

Index: linux-2.6-execshield.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-execshield.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- linux-2.6-execshield.patch	16 Jun 2008 10:19:26 -0000	1.5
+++ linux-2.6-execshield.patch	18 Jul 2008 14:57:40 -0000	1.6
@@ -99,11 +99,11 @@
  
  	if (!cpu_isset(cpu, flush_cpumask))
  		goto out;
---- linux-2.6.25.noarch/arch/x86/kernel/traps_32.c~	2008-05-16 13:43:36.000000000 -0400
-+++ linux-2.6.25.noarch/arch/x86/kernel/traps_32.c	2008-05-16 13:48:08.000000000 -0400
-@@ -602,13 +602,97 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", inv
- DO_ERROR(11, SIGBUS,  "segment not present", segment_not_present)
- DO_ERROR(12, SIGBUS,  "stack segment", stack_segment)
+--- linux-2.6.26.noarch/arch/x86/kernel/traps_32.c~	2008-07-14 20:20:15.000000000 -0400
++++ linux-2.6.26.noarch/arch/x86/kernel/traps_32.c	2008-07-14 20:26:18.000000000 -0400
+@@ -596,7 +596,90 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", inv
+ DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
+ DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
  DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0)
 -DO_ERROR_INFO(32, SIGILL, "iret exception", iret_error, ILL_BADSTK, 0, 1)
 +
@@ -191,8 +191,9 @@
 +	}
 +}
  
- void __kprobes do_general_protection(struct pt_regs *regs, long error_code)
- {
+ void __kprobes
+ do_general_protection(struct pt_regs *regs, long error_code)
+@@ -605,6 +688,7 @@ do_general_protection(struct pt_regs *re
  	struct thread_struct *thread;
  	struct tss_struct *tss;
  	int cpu;
@@ -200,15 +201,7 @@
  
  	cpu = get_cpu();
  	tss = &per_cpu(init_tss, cpu);
-@@ -641,7 +725,6 @@ void __kprobes do_general_protection(str
- 
- 		return;
- 	}
--	put_cpu();
- 
- 	if (regs->flags & X86_VM_MASK)
- 		goto gp_in_vm86;
-@@ -634,6 +718,22 @@ void __kprobes do_general_protection(struct pt_regs * regs,
+@@ -645,6 +729,23 @@ do_general_protection(struct pt_regs *re
  	if (!user_mode(regs))
  		goto gp_in_kernel;
  
@@ -228,10 +221,11 @@
 +			current->mm->context.user_cs.b);
 +	}
 +
- 	current->thread.error_code = error_code;
- 	current->thread.trap_no = 13;
- 	if (show_unhandled_signals && unhandled_signal(current, SIGSEGV) &&
-@@ -650,11 +750,13 @@ void __kprobes do_general_protection(struct pt_regs * regs,
++
+ 	tsk->thread.error_code = error_code;
+ 	tsk->thread.trap_no = 13;
+ 
+@@ -662,11 +763,13 @@ do_general_protection(struct pt_regs *re
  	return;
  
  gp_in_vm86:
@@ -242,9 +236,9 @@
  
  gp_in_kernel:
 +	put_cpu();
- 	if (!fixup_exception(regs)) {
- 		current->thread.error_code = error_code;
- 		current->thread.trap_no = 13;
+ 	if (fixup_exception(regs))
+ 		return;
+ 
 diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
 index 8106bba..23932be 100644
 --- a/arch/x86/mm/init_32.c
@@ -279,17 +273,16 @@
  
  	return 0;
  }
-@@ -527,6 +525,10 @@ void __init paging_init(void)
+@@ -782,6 +782,9 @@ unsigned long __init_refok init_memory_m
  	if (nx_enabled)
  		printk(KERN_INFO "NX (Execute Disable) protection: active\n");
  #endif
 +	if (exec_shield)
 +		printk(KERN_INFO "Using x86 segment limits to approximate "
 +			"NX protection\n");
-+
- 	pagetable_init();
  
- 	load_cr3(swapper_pg_dir);
+ 	/* Enable PSE if available */
+ 	if (cpu_has_pse)
 diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
 index 56fe712..ec932ae 100644
 --- a/arch/x86/mm/mmap.c
@@ -433,21 +426,6 @@
  #ifdef CONFIG_PPC64
  #include <asm/pgalloc-64.h>
  #else
-diff --git a/include/asm-ppc/pgalloc.h b/include/asm-ppc/pgalloc.h
-index fd4d1d7..de55ad5 100644
---- a/include/asm-ppc/pgalloc.h
-+++ b/include/asm-ppc/pgalloc.h
-@@ -41,5 +41,10 @@ extern void pte_free(struct mm_struct *mm, pgtable_t pte);
- 
- #define check_pgt_cache()	do { } while (0)
- 
-+#define arch_add_exec_range(mm, limit)         do { ; } while (0)
-+#define arch_flush_exec_range(mm)              do { ; } while (0)
-+#define arch_remove_exec_range(mm, limit)      do { ; } while (0)
-+
-+
- #endif /* _PPC_PGALLOC_H */
- #endif /* __KERNEL__ */
 diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
 index f5b2bf3..a43f0ec 100644
 --- a/include/asm-s390/pgalloc.h
@@ -648,10 +626,11 @@
 index d41ef6b..5304704 100644
 --- a/kernel/sysctl.c
 +++ b/kernel/sysctl.c
-@@ -83,6 +83,27 @@ extern int sysctl_stat_interval;
+@@ -83,6 +83,26 @@ extern int maps_protect;
+ extern int sysctl_stat_interval;
  extern int latencytop_enabled;
  extern int sysctl_nr_open_min, sysctl_nr_open_max;
- 
++
 +int exec_shield = (1<<0);
 +/* exec_shield is a bitmask:
 + * 0: off; vdso at STACK_TOP, 1 page below TASK_SIZE
@@ -669,13 +648,11 @@
 +
 +	return 1;
 +}
-+
 +__setup("exec-shield=", setup_exec_shield);
 +
-+
- /* Constants used for minimum and  maximum */
- #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
- static int one = 1;
+ #ifdef CONFIG_RCU_TORTURE_TEST
+ extern int rcutorture_runnable;
+ #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
 @@ -383,6 +403,14 @@ static struct ctl_table kern_table[] = {
  		.proc_handler	= &proc_dointvec,
  	},
@@ -767,7 +744,7 @@
  }
 +EXPORT_SYMBOL(get_unmapped_area_prot);
 +
-+#define SHLIB_BASE             0x00110000
++#define SHLIB_BASE	0x00110000
 +
 +unsigned long arch_get_unmapped_exec_area(struct file *filp, unsigned long addr0,
 +		unsigned long len0, unsigned long pgoff, unsigned long flags)

linux-2.6-merge-efifb-imacfb.patch:

Index: linux-2.6-merge-efifb-imacfb.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-merge-efifb-imacfb.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-merge-efifb-imacfb.patch	14 Apr 2008 16:06:53 -0000	1.2
+++ linux-2.6-merge-efifb-imacfb.patch	18 Jul 2008 14:57:40 -0000	1.3
@@ -9,7 +9,7 @@
 index 1bd5fb3..474c375 100644
 --- a/drivers/video/Kconfig
 +++ b/drivers/video/Kconfig
-@@ -656,23 +656,14 @@ config FB_VESA
+@@ -689,23 +689,14 @@ config FB_VESA
  
  config FB_EFI
  	bool "EFI-based Framebuffer Support"
@@ -34,8 +34,8 @@
 +	  your platform is EFI 1.10 or UEFI 2.0, select Y to add support for
 +	  using the EFI framebuffer as your console.
  
- config FB_HECUBA
-        tristate "Hecuba board support"
+ config FB_N411
+        tristate "N411 Apollo/Hecuba devkit support"
 diff --git a/drivers/video/Makefile b/drivers/video/Makefile
 index 11c0e5e..c789b01 100644
 --- a/drivers/video/Makefile

linux-2.6-net-8139-pio-modparam.patch:

Index: linux-2.6-net-8139-pio-modparam.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-net-8139-pio-modparam.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-net-8139-pio-modparam.patch	16 Jun 2008 10:19:26 -0000	1.1
+++ linux-2.6-net-8139-pio-modparam.patch	18 Jul 2008 14:57:40 -0000	1.2
@@ -1,15 +1,26 @@
-Make PIO/MMIO a runtime thing via a module parameter.
-This is needed to support devices that only work with PIO
-without penalising devices that work fine with MMIO in
-distro kernels.
+From: Dave Jones <davej at redhat.com>
+To: netdev at vger.kernel.org
+Subject: [1/3] 8139too: Make PIO/MMIO a runtime decision through a module parameter.
+
+This is needed to support devices that only work with PIO without penalising devices
+that work fine with MMIO in distro kernels.   It also allows us to eventually
+use PIO as a fallback when setting up MMIO fails.
 
 Signed-off-by: Dave Jones <davej at redhat.com>
 
 diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
-index 53bd903..09ace39 100644
+index 53bd903..b620317 100644
 --- a/drivers/net/8139too.c
 +++ b/drivers/net/8139too.c
-@@ -120,11 +120,6 @@
+@@ -98,7 +98,6 @@
+ #include <linux/compiler.h>
+ #include <linux/pci.h>
+ #include <linux/init.h>
+-#include <linux/ioport.h>
+ #include <linux/netdevice.h>
+ #include <linux/etherdevice.h>
+ #include <linux/rtnetlink.h>
+@@ -120,11 +119,6 @@
                                   NETIF_MSG_LINK)
  
  
@@ -21,25 +32,30 @@
  /* define to 1, 2 or 3 to enable copious debugging info */
  #define RTL8139_DEBUG 0
  
-@@ -156,6 +151,9 @@
+@@ -156,6 +150,13 @@
  static int media[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
  static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
  
 +/* Whether to use MMIO or PIO. Default to MMIO. */
-+static int use_pio;
++#ifdef CONFIG_8139TOO_PIO
++static int use_io = 1;
++#else
++static int use_io = 0;
++#endif
 +
  /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
     The RTL chips use a 64 element hash table based on the Ethernet CRC.  */
  static int multicast_filter_limit = 32;
-@@ -615,6 +613,7 @@ MODULE_DESCRIPTION ("RealTek RTL-8139 Fast Ethernet driver");
+@@ -615,6 +612,8 @@ MODULE_DESCRIPTION ("RealTek RTL-8139 Fast Ethernet driver");
  MODULE_LICENSE("GPL");
  MODULE_VERSION(DRV_VERSION);
  
-+module_param(use_pio, int, 0);
++module_param(use_io, int, 0);
++MODULE_PARM_DESC(use_io, "Force use of I/O access mode. 0=MMIO 1=PIO");
  module_param(multicast_filter_limit, int, 0);
  module_param_array(media, int, NULL, 0);
  module_param_array(full_duplex, int, NULL, 0);
-@@ -710,14 +709,13 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
+@@ -710,13 +708,8 @@ static void __rtl8139_cleanup_dev (struct net_device *dev)
  	assert (tp->pci_dev != NULL);
  	pdev = tp->pci_dev;
  
@@ -47,21 +63,13 @@
 -	if (tp->mmio_addr)
 -		ioport_unmap (tp->mmio_addr);
 -#else
--	if (tp->mmio_addr)
--		pci_iounmap (pdev, tp->mmio_addr);
+ 	if (tp->mmio_addr)
+ 		pci_iounmap (pdev, tp->mmio_addr);
 -#endif /* USE_IO_OPS */
--
-+	if (use_pio) {
-+		if (tp->mmio_addr)
-+			ioport_unmap (tp->mmio_addr);
-+	} else {
-+		if (tp->mmio_addr)
-+			pci_iounmap (pdev, tp->mmio_addr);
-+	}
+ 
  	/* it's ok to call this even if we have no regions to free */
  	pci_release_regions (pdev);
- 
-@@ -791,32 +789,32 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
+@@ -791,32 +784,32 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
  	DPRINTK("PIO region size == 0x%02X\n", pio_len);
  	DPRINTK("MMIO region size == 0x%02lX\n", mmio_len);
  
@@ -89,7 +97,7 @@
 -		dev_err(&pdev->dev, "Invalid PCI mem region size(s), aborting\n");
 -		rc = -ENODEV;
 -		goto err_out;
-+	if (use_pio) {
++	if (use_io) {
 +		/* make sure PCI base addr 0 is PIO */
 +		if (!(pio_flags & IORESOURCE_IO)) {
 +			dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n");
@@ -119,7 +127,7 @@
  
  	rc = pci_request_regions (pdev, DRV_NAME);
  	if (rc)
-@@ -826,28 +824,28 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
+@@ -826,28 +819,27 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
  	/* enable PCI bus-mastering */
  	pci_set_master (pdev);
  
@@ -140,15 +148,14 @@
 -		dev_err(&pdev->dev, "cannot remap MMIO, aborting\n");
 -		rc = -EIO;
 -		goto err_out;
-+	if (use_pio) {
-+		ioaddr = ioport_map(pio_start, pio_len);
++	if (use_io) {
++		ioaddr = pci_iomap(pdev, 0, 0);
 +		if (!ioaddr) {
 +			dev_err(&pdev->dev, "cannot map PIO, aborting\n");
 +			rc = -EIO;
 +			goto err_out;
 +		}
 +		dev->base_addr = pio_start;
-+		tp->mmio_addr = ioaddr;
 +		tp->regs_len = pio_len;
 +	} else {
 +		/* ioremap MMIO region */
@@ -159,17 +166,16 @@
 +			goto err_out;
 +		}
 +		dev->base_addr = (long) ioaddr;
-+		tp->mmio_addr = ioaddr;
 +		tp->regs_len = mmio_len;
  	}
 -	dev->base_addr = (long) ioaddr;
--	tp->mmio_addr = ioaddr;
+ 	tp->mmio_addr = ioaddr;
 -	tp->regs_len = mmio_len;
 -#endif /* USE_IO_OPS */
  
  	/* Bring old chips out of low-power mode. */
  	RTL_W8 (HltClk, 'R');
-@@ -2383,20 +2381,24 @@ static void rtl8139_set_msglevel(struct net_device *dev, u32 datum)
+@@ -2383,20 +2375,24 @@ static void rtl8139_set_msglevel(struct net_device *dev, u32 datum)
  	np->msg_enable = datum;
  }
  
@@ -183,7 +189,7 @@
 -	struct rtl8139_private *np = netdev_priv(dev);
 +	struct rtl8139_private *np;
 +	/* TODO: we are too slack to do reg dumping for pio, for now */
-+	if (use_pio)
++	if (use_io)
 +		return 0;
 +	np = netdev_priv(dev);
  	return np->regs_len;
@@ -195,13 +201,13 @@
 +	struct rtl8139_private *np;
 +
 +	/* TODO: we are too slack to do reg dumping for pio, for now */
-+	if (use_pio)
++	if (use_io)
 +		return;
 +	np = netdev_priv(dev);
  
  	regs->version = RTL_REGS_VER;
  
-@@ -2404,7 +2406,6 @@ static void rtl8139_get_regs(struct net_device *dev, struct ethtool_regs *regs,
+@@ -2404,7 +2400,6 @@ static void rtl8139_get_regs(struct net_device *dev, struct ethtool_regs *regs,
  	memcpy_fromio(regbuf, np->mmio_addr, regs->len);
  	spin_unlock_irq(&np->lock);
  }
@@ -209,15 +215,3 @@
  
  static int rtl8139_get_sset_count(struct net_device *dev, int sset)
  {
-@@ -2610,6 +2611,11 @@ static int __init rtl8139_init_module (void)
- 	printk (KERN_INFO RTL8139_DRIVER_NAME "\n");
- #endif
- 
-+	/* enable PIO instead of MMIO, if CONFIG_8139TOO_PIO is selected */
-+#ifdef CONFIG_8139TOO_PIO
-+	use_pio = 1;
-+#endif
-+
- 	return pci_register_driver(&rtl8139_pci_driver);
- }
- 

linux-2.6-net-8139-pio-oqo2.patch:

Index: linux-2.6-net-8139-pio-oqo2.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-net-8139-pio-oqo2.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-net-8139-pio-oqo2.patch	16 Jun 2008 10:19:26 -0000	1.1
+++ linux-2.6-net-8139-pio-oqo2.patch	18 Jul 2008 14:57:40 -0000	1.2
@@ -1,4 +1,10 @@
+From: Dave Jones <davej at redhat.com>
+To: netdev at vger.kernel.org
+Subject: [2/3] 8139too: Force usage of PIO on OQO2
+
 The OQO model 2 has an RTL8139 from Atheros that doesn't like MMIO.
+It fails on modprobe, with a 'PCI Bus error' message.
+
 Force it to always use polled IO.
 
 Signed-off-by: Dave Jones <davej at redhat.com>
@@ -14,7 +20,7 @@
 +	    pdev->subsystem_vendor == PCI_VENDOR_ID_ATHEROS &&
 +	    pdev->subsystem_device == PCI_DEVICE_ID_REALTEK_8139) {
 +		printk(KERN_INFO "8139too: OQO Model 2 detected. Forcing PIO\n");
-+		use_pio = 1;
++		use_io = 1;
 +	}
 +
  	i = rtl8139_init_board (pdev, &dev);

linux-2.6-silence-noise.patch:

Index: linux-2.6-silence-noise.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-silence-noise.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- linux-2.6-silence-noise.patch	16 Jun 2008 10:19:26 -0000	1.6
+++ linux-2.6-silence-noise.patch	18 Jul 2008 14:57:40 -0000	1.7
@@ -1,37 +1,3 @@
---- linux-2.6.18.noarch/arch/x86/mm/init_64.c~	2006-10-16 17:09:56.000000000 -0400
-+++ linux-2.6.18.noarch/arch/x86/mm/init_64.c	2006-10-16 17:10:09.000000000 -0400
-@@ -337,10 +337,6 @@ static void __init find_early_table_spac
- 
- 	table_start >>= PAGE_SHIFT;
- 	table_end = table_start;
--
--	early_printk("kernel direct mapping tables up to %lx @ %lx-%lx\n",
--		end, table_start << PAGE_SHIFT,
--		(table_start << PAGE_SHIFT) + tables);
- }
- 
- /* Setup the direct mapping of the physical memory at PAGE_OFFSET.
- 
---- linux-2.6.18.noarch/drivers/pci/setup-res.c~	2006-10-17 17:15:34.000000000 -0400
-+++ linux-2.6.18.noarch/drivers/pci/setup-res.c	2006-10-17 17:15:56.000000000 -0400
-@@ -148,7 +148,7 @@ int pci_assign_resource(struct pci_dev *
- 	}
- 
- 	if (ret) {
--		printk(KERN_ERR "PCI: Failed to allocate %s resource "
-+		printk(KERN_DEBUG "PCI: Failed to allocate %s resource "
- 			"#%d:%llx@%llx for %s\n",
- 			res->flags & IORESOURCE_IO ? "I/O" : "mem",
- 			resno, (unsigned long long)size,
-@@ -186,7 +186,7 @@ int pci_assign_resource_fixed(struct pci
- 	}
- 
- 	if (ret) {
--		printk(KERN_ERR "PCI: Failed to allocate %s resource "
-+		printk(KERN_DEBUG "PCI: Failed to allocate %s resource "
- 				"#%d:%llx@%llx for %s\n",
- 			res->flags & IORESOURCE_IO ? "I/O" : "mem",
- 			resno, (unsigned long long)(res->end - res->start + 1),
 --- linux-2.6.19.noarch/arch/x86/pci/i386.c~	2006-12-04 11:21:32.000000000 -0500
 +++ linux-2.6.19.noarch/arch/x86/pci/i386.c	2006-12-04 11:22:10.000000000 -0500
 @@ -112,7 +112,7 @@ static void __init pcibios_allocate_bus_
@@ -53,32 +19,9 @@
  						"of device %s\n",
  						idx, pci_name(dev));
 
-Remove noisy PM printk.
-This has served its purpose.
-
-Signed-off-by: Dave Jones <davej at redhat.com>
-
---- linux-2.6.20.noarch/drivers/pci/pci.c~	2007-04-16 18:14:14.000000000 -0400
-+++ linux-2.6.20.noarch/drivers/pci/pci.c	2007-04-16 18:14:33.000000000 -0400
-@@ -664,14 +664,9 @@ pci_restore_state(struct pci_dev *dev)
- 	 */
- 	for (i = 15; i >= 0; i--) {
- 		pci_read_config_dword(dev, i * 4, &val);
--		if (val != dev->saved_config_space[i]) {
--			printk(KERN_DEBUG "PM: Writing back config space on "
--				"device %s at offset %x (was %x, writing %x)\n",
--				pci_name(dev), i,
--				val, (int)dev->saved_config_space[i]);
-+		if (val != dev->saved_config_space[i])
- 			pci_write_config_dword(dev,i * 4,
- 				dev->saved_config_space[i]);
--		}
- 	}
- 	pci_restore_pcix_state(dev);
- 	pci_restore_msi_state(dev);
---- linux-2.6.25.noarch/drivers/base/power/main.c~	2008-05-16 10:26:38.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/base/power/main.c	2008-05-16 10:26:59.000000000 -0400
-@@ -64,9 +64,6 @@ int device_pm_add(struct device *dev)
+--- linux-2.6.26.noarch/drivers/base/power/main.c~	2008-07-17 13:12:20.000000000 -0400
++++ linux-2.6.26.noarch/drivers/base/power/main.c	2008-07-17 13:12:44.000000000 -0400
+@@ -71,9 +71,6 @@ int device_pm_add(struct device *dev)
  {
  	int error;
  
@@ -86,5 +29,5 @@
 -		 dev->bus ? dev->bus->name : "No Bus",
 -		 kobject_name(&dev->kobj));
  	mutex_lock(&dpm_list_mtx);
- 	if ((dev->parent && dev->parent->power.sleeping) || all_sleeping) {
- 		if (dev->parent->power.sleeping)
+ 	if (dev->parent) {
+ 		if (dev->parent->power.status >= DPM_SUSPENDING) {

linux-2.6-utrace.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.5 -r 1.6 linux-2.6-utrace.patch
Index: linux-2.6-utrace.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- linux-2.6-utrace.patch	16 Jun 2008 10:19:26 -0000	1.5
+++ linux-2.6-utrace.patch	18 Jul 2008 14:57:40 -0000	1.6
@@ -1,88 +1,20 @@
- Documentation/DocBook/Makefile      |    2 +-
- Documentation/DocBook/utrace.tmpl   |   23 +
- Documentation/utrace.txt            |  579 +++++++++
- arch/alpha/kernel/ptrace.c          |   15 +-
- arch/arm/kernel/ptrace.c            |    5 +-
- arch/avr32/kernel/ptrace.c          |    5 +-
- arch/blackfin/kernel/ptrace.c       |    5 +-
- arch/frv/kernel/ptrace.c            |    3 +-
- arch/h8300/kernel/ptrace.c          |    3 +-
- arch/ia64/kernel/process.c          |    2 +-
- arch/ia64/kernel/ptrace.c           |   17 +-
- arch/m32r/kernel/ptrace.c           |    7 +-
- arch/m68k/kernel/ptrace.c           |    5 +-
- arch/m68knommu/kernel/ptrace.c      |    3 +-
- arch/mips/kernel/irixelf.c          |    2 -
- arch/mips/kernel/ptrace.c           |    5 +-
- arch/mn10300/kernel/ptrace.c        |    3 +-
- arch/parisc/kernel/ptrace.c         |    7 +-
- arch/powerpc/kernel/entry_32.S      |    4 +-
- arch/powerpc/kernel/process.c       |    5 -
- arch/powerpc/kernel/ptrace.c        |   38 +-
- arch/powerpc/kernel/ptrace32.c      |    8 +-
- arch/powerpc/kernel/signal.c        |   20 +-
- arch/powerpc/kernel/signal_32.c     |   21 +-
- arch/powerpc/kernel/sys_ppc32.c     |    5 -
- arch/s390/kernel/entry.S            |   14 +-
- arch/s390/kernel/entry64.S          |   12 +-
- arch/sh/kernel/ptrace_32.c          |    5 +-
- arch/sh/kernel/ptrace_64.c          |    5 +-
- arch/sparc/kernel/ptrace.c          |    5 +-
- arch/sparc64/kernel/binfmt_aout32.c |    2 -
- arch/sparc64/kernel/ptrace.c        |   35 +-
- arch/um/kernel/ptrace.c             |    3 +-
- arch/v850/kernel/ptrace.c           |    3 +-
- arch/x86/ia32/ia32_aout.c           |    6 -
- arch/x86/ia32/ia32_signal.c         |   12 +-
- arch/x86/ia32/ia32entry.S           |   14 +-
- arch/x86/ia32/sys_ia32.c            |    5 -
- arch/x86/kernel/entry_64.S          |    8 +-
- arch/x86/kernel/ptrace.c            |  159 +--
- arch/x86/kernel/signal_32.c         |   56 +-
- arch/x86/kernel/signal_64.c         |   49 +-
- arch/x86/kernel/step.c              |   22 +-
- arch/x86/kernel/vm86_32.c           |    9 +-
- arch/xtensa/kernel/ptrace.c         |    6 +-
- fs/binfmt_aout.c                    |    6 -
- fs/binfmt_elf.c                     |    6 -
- fs/binfmt_elf_fdpic.c               |    7 -
- fs/binfmt_flat.c                    |    3 -
- fs/binfmt_som.c                     |    2 -
- fs/compat.c                         |   14 +-
- fs/eventpoll.c                      |    7 +-
- fs/exec.c                           |   12 +-
- fs/proc/array.c                     |    9 +-
- fs/proc/base.c                      |   43 +-
- fs/select.c                         |   12 +-
- include/asm-ia64/thread_info.h      |    5 +-
- include/asm-powerpc/thread_info.h   |   17 +-
- include/asm-s390/thread_info.h      |    2 +-
- include/asm-x86/ptrace.h            |    2 +
- include/asm-x86/thread_info_32.h    |   13 +-
- include/asm-x86/thread_info_64.h    |   13 +-
- include/linux/compat.h              |    5 +-
- include/linux/init_task.h           |    3 -
- include/linux/ptrace.h              |   70 +-
- include/linux/sched.h               |   38 +-
- include/linux/thread_info.h         |   27 +-
- include/linux/tracehook.h           |  507 ++++++++
- include/linux/utrace.h              |  544 ++++++++
- init/Kconfig                        |   29 +
- kernel/Makefile                     |    1 +
- kernel/compat.c                     |    3 +-
- kernel/exit.c                       |  403 +++----
- kernel/fork.c                       |   72 +-
- kernel/ptrace.c                     | 2129 +++++++++++++++++++++++++-------
- kernel/signal.c                     |  285 +----
- kernel/sys_ni.c                     |    4 +
- kernel/utrace.c                     | 2377 +++++++++++++++++++++++++++++++++++
- mm/nommu.c                          |    4 +-
- security/selinux/hooks.c            |   59 +-
- security/selinux/include/objsec.h   |    1 -
- 81 files changed, 6535 insertions(+), 1421 deletions(-)
+ Documentation/DocBook/Makefile    |    2 +-
+ Documentation/DocBook/utrace.tmpl |   21 +
+ Documentation/utrace.txt          |  579 ++++++++++
+ fs/proc/array.c                   |    3 +
+ include/linux/ptrace.h            |   15 +
+ include/linux/sched.h             |    6 +
+ include/linux/tracehook.h         |   60 +
+ include/linux/utrace.h            |  534 +++++++++
+ init/Kconfig                      |   28 +
+ kernel/Makefile                   |    1 +
+ kernel/ptrace.c                   |  542 +++++++++-
+ kernel/signal.c                   |   14 +-
+ kernel/utrace.c                   | 2211 +++++++++++++++++++++++++++++++++++++
+ 13 files changed, 4012 insertions(+), 4 deletions(-)
 
 diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
-index 300e170..7cf3afc 100644  
+index 0eb0d02..49a78b7 100644  
 --- a/Documentation/DocBook/Makefile
 +++ b/Documentation/DocBook/Makefile
 @@ -7,7 +7,7 @@
@@ -92,14 +24,14 @@
 -	    kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
 +	    kernel-hacking.xml kernel-locking.xml deviceiobook.xml utrace.xml \
  	    procfs-guide.xml writing_usb_driver.xml networking.xml \
- 	    kernel-api.xml filesystems.xml lsm.xml usb.xml \
+ 	    kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
  	    gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
 diff --git a/Documentation/DocBook/utrace.tmpl b/Documentation/DocBook/utrace.tmpl
 new file mode 100644
-index ...f185043 100644  
+index ...8dfaa91 100644  
 --- /dev/null
 +++ b/Documentation/DocBook/utrace.tmpl
-@@ -0,0 +1,23 @@
+@@ -0,0 +1,21 @@
 +<?xml version="1.0" encoding="UTF-8"?>
 +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
 +	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
@@ -117,9 +49,7 @@
 +    </chapter>
 +
 +<chapter><title>Machine state access via utrace</title>
-+!Finclude/linux/regset.h struct user_regset
-+!Finclude/linux/regset.h struct user_regset_view
-+!Finclude/linux/regset.h task_user_regset_view
++!Finclude/linux/regset.h
 +    </chapter>
 +
 +</book>
@@ -708,2509 +638,308 @@
 +sure which event callbacks it will or won't see after utrace_set_flags
 +has returned.  By checking for errors, it can know whether to clean up
 +its data structures immediately or to let its callbacks do the work.
-diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
-index 1e9ad52..7dc30f5 100644  
---- a/arch/alpha/kernel/ptrace.c
-+++ b/arch/alpha/kernel/ptrace.c
-@@ -260,11 +260,12 @@ void ptrace_disable(struct task_struct *
- 	ptrace_cancel_bpt(child);
- }
- 
--long arch_ptrace(struct task_struct *child, long request, long addr, long data)
-+int arch_ptrace(struct task_struct *child, long request, long addr, long data,
-+		long *retval)
- {
- 	unsigned long tmp;
- 	size_t copied;
--	long ret;
-+	int ret;
- 
- 	switch (request) {
- 	/* When I and D space are separate, these will need to be fixed.  */
-@@ -275,14 +276,14 @@ long arch_ptrace(struct task_struct *chi
- 		if (copied != sizeof(tmp))
- 			break;
- 		
--		force_successful_syscall_return();
--		ret = tmp;
-+		ret = 0;
-+		*retval = tmp;
- 		break;
- 
- 	/* Read register number ADDR. */
- 	case PTRACE_PEEKUSR:
--		force_successful_syscall_return();
--		ret = get_reg(child, addr);
-+		ret = 0;
-+		*retval = get_reg(child, addr);
- 		DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret));
- 		break;
- 
-@@ -343,7 +344,7 @@ long arch_ptrace(struct task_struct *chi
- 		break;
- 
- 	default:
--		ret = ptrace_request(child, request, addr, data);
-+		ret = 1;
- 		break;
- 	}
- 	return ret;
-diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
-index 4b05dc5..938be29 100644  
---- a/arch/arm/kernel/ptrace.c
-+++ b/arch/arm/kernel/ptrace.c
-@@ -655,7 +655,8 @@ static int ptrace_setcrunchregs(struct t
- }
- #endif
- 
[...11988 lines suppressed...]
 +{
-+	struct utrace *utrace = tsk->utrace;
-+	struct list_head *pos, *next;
-+	struct utrace_attached_engine *engine;
++	struct utrace *utrace = task->utrace;
++	struct utrace_attached_engine *engine, *next;
 +	const struct utrace_engine_ops *ops;
 +	int unsafe = 0;
 +
-+	/* XXX must change for sharing */
-+	list_for_each_safe_rcu(pos, next, &utrace->engines) {
-+		engine = list_entry(pos, struct utrace_attached_engine, entry);
++	list_for_each_entry_safe(engine, next, &utrace->engines, entry) {
 +		ops = rcu_dereference(engine->ops);
 +		if (ops->unsafe_exec)
-+			unsafe |= (*ops->unsafe_exec)(engine, tsk);
++			unsafe |= (*ops->unsafe_exec)(engine, task);
 +	}
 +
 +	return unsafe;
 +}
-diff --git a/mm/nommu.c b/mm/nommu.c
-index 5d8ae08..515beac 100644  
---- a/mm/nommu.c
-+++ b/mm/nommu.c
-@@ -22,7 +22,7 @@
- #include <linux/pagemap.h>
- #include <linux/slab.h>
- #include <linux/vmalloc.h>
--#include <linux/ptrace.h>
-+#include <linux/tracehook.h>
- #include <linux/blkdev.h>
- #include <linux/backing-dev.h>
- #include <linux/mount.h>
-@@ -734,7 +734,7 @@ static unsigned long determine_vm_flags(
- 	 * it's being traced - otherwise breakpoints set in it may interfere
- 	 * with another untraced process
- 	 */
--	if ((flags & MAP_PRIVATE) && (current->ptrace & PT_PTRACED))
-+	if ((flags & MAP_PRIVATE) && tracehook_expect_breakpoints(current))
- 		vm_flags &= ~VM_MAYSHARE;
- 
- 	return vm_flags;
-diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
-index d39b59c..43cb7c3 100644  
---- a/security/selinux/hooks.c
-+++ b/security/selinux/hooks.c
-@@ -24,7 +24,7 @@
- 
- #include <linux/init.h>
- #include <linux/kernel.h>
--#include <linux/ptrace.h>
-+#include <linux/tracehook.h>
- #include <linux/errno.h>
- #include <linux/sched.h>
- #include <linux/security.h>
-@@ -162,7 +162,7 @@ static int task_alloc_security(struct ta
- 		return -ENOMEM;
- 
- 	tsec->task = task;
--	tsec->osid = tsec->sid = tsec->ptrace_sid = SECINITSID_UNLABELED;
-+	tsec->osid = tsec->sid = SECINITSID_UNLABELED;
- 	task->security = tsec;
- 
- 	return 0;
-@@ -1645,19 +1645,13 @@ static inline u32 file_to_av(struct file
- 
- static int selinux_ptrace(struct task_struct *parent, struct task_struct *child)
- {
--	struct task_security_struct *psec = parent->security;
--	struct task_security_struct *csec = child->security;
- 	int rc;
- 
- 	rc = secondary_ops->ptrace(parent,child);
- 	if (rc)
- 		return rc;
- 
--	rc = task_has_perm(parent, child, PROCESS__PTRACE);
--	/* Save the SID of the tracing process for later use in apply_creds. */
--	if (!(child->ptrace & PT_PTRACED) && !rc)
--		csec->ptrace_sid = psec->sid;
--	return rc;
-+	return task_has_perm(parent, child, PROCESS__PTRACE);
- }
- 
- static int selinux_capget(struct task_struct *target, kernel_cap_t *effective,
-@@ -2126,12 +2120,25 @@ static void selinux_bprm_apply_creds(str
- 		/* Check for ptracing, and update the task SID if ok.
- 		   Otherwise, leave SID unchanged and kill. */
- 		if (unsafe & (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
--			rc = avc_has_perm(tsec->ptrace_sid, sid,
--					  SECCLASS_PROCESS, PROCESS__PTRACE,
--					  NULL);
--			if (rc) {
--				bsec->unsafe = 1;
--				return;
-+			struct task_struct *tracer;
-+			struct task_security_struct *sec;
-+			u32 ptsid = 0;
-+
-+			rcu_read_lock();
-+			tracer = tracehook_tracer_task(current);
-+			if (likely(tracer != NULL)) {
-+				sec = tracer->security;
-+				ptsid = sec->sid;
-+			}
-+			rcu_read_unlock();
 +
-+			if (ptsid != 0) {
-+				rc = avc_has_perm(ptsid, sid, SECCLASS_PROCESS,
-+						  PROCESS__PTRACE, NULL);
-+				if (rc) {
-+					bsec->unsafe = 1;
-+					return;
-+				}
- 			}
- 		}
- 		tsec->sid = sid;
-@@ -2214,7 +2221,7 @@ static void selinux_bprm_post_apply_cred
- 
- 	/* Wake up the parent if it is waiting so that it can
- 	   recheck wait permission to the new task SID. */
--	wake_up_interruptible(&current->parent->signal->wait_chldexit);
-+	wake_up_interruptible(&current->real_parent->signal->wait_chldexit);
- }
- 
- /* superblock security operations */
-@@ -3087,11 +3094,6 @@ static int selinux_task_alloc_security(s
- 	tsec2->keycreate_sid = tsec1->keycreate_sid;
- 	tsec2->sockcreate_sid = tsec1->sockcreate_sid;
- 
--	/* Retain ptracer SID across fork, if any.
--	   This will be reset by the ptrace hook upon any
--	   subsequent ptrace_attach operations. */
--	tsec2->ptrace_sid = tsec1->ptrace_sid;
--
- 	return 0;
- }
- 
-@@ -5057,6 +5059,7 @@ static int selinux_setprocattr(struct ta
- 			       char *name, void *value, size_t size)
- {
- 	struct task_security_struct *tsec;
-+	struct task_struct *tracer;
- 	u32 sid = 0;
- 	int error;
- 	char *str = value;
-@@ -5145,18 +5148,24 @@ static int selinux_setprocattr(struct ta
- 		/* Check for ptracing, and update the task SID if ok.
- 		   Otherwise, leave SID unchanged and fail. */
- 		task_lock(p);
--		if (p->ptrace & PT_PTRACED) {
--			error = avc_has_perm_noaudit(tsec->ptrace_sid, sid,
-+		rcu_read_lock();
-+		tracer = tracehook_tracer_task(p);
-+		if (tracer != NULL) {
-+			struct task_security_struct *ptsec = tracer->security;
-+			u32 ptsid = ptsec->sid;
-+			rcu_read_unlock();
-+			error = avc_has_perm_noaudit(ptsid, sid,
- 						     SECCLASS_PROCESS,
- 						     PROCESS__PTRACE, 0, &avd);
- 			if (!error)
- 				tsec->sid = sid;
- 			task_unlock(p);
--			avc_audit(tsec->ptrace_sid, sid, SECCLASS_PROCESS,
-+			avc_audit(ptsid, sid, SECCLASS_PROCESS,
- 				  PROCESS__PTRACE, &avd, error, NULL);
- 			if (error)
- 				return error;
- 		} else {
-+			rcu_read_unlock();
- 			tsec->sid = sid;
- 			task_unlock(p);
- 		}
-diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
-index c6c2bb4..1db31c2 100644  
---- a/security/selinux/include/objsec.h
-+++ b/security/selinux/include/objsec.h
-@@ -35,7 +35,6 @@ struct task_security_struct {
- 	u32 create_sid;      /* fscreate SID */
- 	u32 keycreate_sid;   /* keycreate SID */
- 	u32 sockcreate_sid;  /* fscreate SID */
--	u32 ptrace_sid;      /* SID of ptrace parent */
- };
- 
- struct inode_security_struct {
++/*
++ * Called with rcu_read_lock() held.
++ */
++void task_utrace_proc_status(struct seq_file *m, struct task_struct *p)
++{
++	struct utrace *utrace = rcu_dereference(p->utrace);
++	if (unlikely(utrace))
++		seq_printf(m, "Utrace: %lx%s%s%s\n",
++			   p->utrace_flags,
++			   utrace->stopped ? " (stopped)" : "",
++			   utrace->report ? " (report)" : "",
++			   utrace->interrupt ? " (interrupt)" : "");
++}

linux-2.6-wireless-pending.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.8 -r 1.9 linux-2.6-wireless-pending.patch
Index: linux-2.6-wireless-pending.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-wireless-pending.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-wireless-pending.patch	16 Jun 2008 10:19:26 -0000	1.8
+++ linux-2.6-wireless-pending.patch	18 Jul 2008 14:57:41 -0000	1.9
@@ -1,3984 +1,9038 @@
-commit 78cf07472f0ede8394bacc4bc02354505080cfe1
-Author: Holger Schurig <hs4233 at mail.mn-solutions.de>
-Date:   Mon Jun 2 09:25:05 2008 +0200
-
-    libertas: unify various CF-related defines
-    
-    Signed-off-by: Holger Schurig <hs4233 at mail.mn-solutions.de>
-    Signed-off-by: John W. Linville <linville at tuxdriver.com>
-
-commit 2d892986e82306b8ad96285fb54b9999523331e0
-Author: Tomas Winkler <tomas.winkler at intel.com>
-Date:   Mon Jun 2 20:31:57 2008 +0300
+commit 4c9adafff7d910f142fe44fae37ed12c6b99f20f
+Author: Ivo van Doorn <ivdoorn at gmail.com>
+Date:   Sun Jul 13 10:07:48 2008 +0200
 
-    mac80211: removing shadowed sband
+    rt2x00: Reset LED assoc status after firmware update
     
-    This patch removes doubly defined sband variable
+    According to the legacy drivers the LED association status
+    must be reset after the firmware has been uploaded to the
+    hardware.
     
-    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
-    Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
+    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit b97e77e0446f0702de7fa0f5d2c52acf42d0289f
-Author: Tomas Winkler <tomas.winkler at intel.com>
-Date:   Mon Jun 2 20:31:56 2008 +0300
+commit 3eb2011a67b044859069359948579b942993c416
+Author: Abhijeet Kolekar <abhijeet.kolekar at intel.com>
+Date:   Fri Jul 11 11:53:42 2008 +0800
 
-    mac80211: fix unbalanced locking in ieee80211_get_buffered_bc
+    iwlwifi: make index unsigned int for iwl_send_led_cmd
     
-    This patch fixes unbalanced locking in ieee80211_get_buffered_bc
+    This is a small fix to change the idx type from int to unsigned.
     
-    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
-    Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
+    Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar at intel.com>
+    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 2b2121417eff64125bdb7f322d3b533e06d73dae
-Author: Pavel Roskin <proski at gnu.org>
-Date:   Mon Jun 2 07:54:50 2008 -0400
+commit 9a9ad0cda72a651fc6b99fa9ec040a5d41005a88
+Author: Abhijeet Kolekar <abhijeet.kolekar at intel.com>
+Date:   Fri Jul 11 11:53:41 2008 +0800
 
-    mac80211: fix panic when using hardware WEP
+    iwlwifi: Fix LEDs for 3945
     
-    e039fa4a4195ac4ee895e6f3d1334beed63256fe ("mac80211: move TX info into
-    skb->cb") misplaced code for setting hardware WEP keys.  Move it back.
-    This fixes kernel panic in b43 if WEP is used and hardware encryption
-    is enabled.
+    The patch fixes LEDs problem for 3945.
     
-    Signed-off-by: Pavel Roskin <proski at gnu.org>
-    Acked-by: Johannes Berg <johannes at sipsolutions.net>
+    Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar at intel.com>
+    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 5854a32e6cb672d182ce378c69f0f7470137a062
-Author: Johannes Berg <johannes at sipsolutions.net>
-Date:   Mon Jun 2 09:38:04 2008 +0200
+commit 36da7d70e307f8650db1b1c7350d2161ca3829ef
+Author: Zhu Yi <yi.zhu at intel.com>
+Date:   Fri Jul 11 11:53:40 2008 +0800
 
-    mac80211: fix rate control initialisation
-    
-    In commit 2e92e6f2c50b4baf85cca968f0e6f1b5c0df7d39 ("mac80211: use rate
-    index in TX control") I forgot to initialise a few new variables to -1 which
-    means that the rate control algorithm is never triggered and 0 is used as
-    the only rate index, effectively fixing the transmit bitrate at the lowest
-    supported.
+    iwlwifi: send TXPOWER command after a new RXON command
     
-    This patch adds the missing initialisation.
+    The patch fixes the problem that TXPOWER command is not sent
+    after we issue a new RXON command which requires a tune. Otherwise
+    we won't be able to Tx any frames.
     
-    Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
-    Bisected-by: Sitsofe Wheeler <sitsofe at yahoo.com>
+    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 7fd871edf437362b62ddd807542638cbda8d8a39
-Author: Masakazu Mokuno <mokuno at sm.sony.co.jp>
-Date:   Mon Jun 2 12:49:16 2008 +0900
+commit fe905f1d5a8404f45fa0df26e6a870bf1e3b5983
+Author: Tomas Winkler <tomas.winkler at intel.com>
+Date:   Fri Jul 11 11:53:39 2008 +0800
 
-    PS3: gelic: Add support for ESSID scan
+    iwlwifi: enable active scanning
     
-    This adds the support for ESSID scanning
+    This patch enables active scan on active channels.
     
-    Signed-off-by: Masakazu Mokuno <mokuno at sm.sony.co.jp>
+    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
+    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 552fe53f48ef2fd54b031b37d304211cee893ba0
-Author: Johannes Berg <johannes at sipsolutions.net>
-Date:   Fri May 30 21:07:15 2008 +0200
+commit d16dc48a2ea14af9980d0ea79d041f4b53e47b62
+Author: Tomas Winkler <tomas.winkler at intel.com>
+Date:   Fri Jul 11 11:53:38 2008 +0800
 
-    p54: fix skb->cb tx info conversion
+    iwlwifi: unify 4965 and 5000 scanning code
     
-    When I moved the TX info into skb->cb apparently I forgot to change a
-    few places to put the p54-internal data into info->driver_data rather
-    than skb->cb. This should fix it.
+    This patch unifies 4965 and 5000 scanning code.
     
-    Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
+    We increases the version number to 1.3.27. Since new uCode
+    iwlwifi-4965-2.ucode is required for 4965 cards.
+    
+    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
+    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit f409e348005693016281bf29535c9d0a91b21f77
-Author: Masakazu Mokuno <mokuno at sm.sony.co.jp>
-Date:   Fri May 30 16:52:55 2008 +0900
+commit ec1a746042ea4c1c93065185897d6e8d3e7de894
+Author: Tomas Winkler <tomas.winkler at intel.com>
+Date:   Fri Jul 11 11:53:37 2008 +0800
 
-    PS3: gelic: Deprecate the private ioctls in the gelic driver
+    iwlwifi: LED use correctly blink table
     
-    As the driver has the standard way to handle PSK, deprecate the old
-    interface.
+    This patch makes correct usage of the LED blink table.
     
-    Signed-off-by: Masakazu Mokuno <mokuno at sm.sony.co.jp>
+    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
+    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 04b2046c856e36c3c9cf382adb2c0bc8ba780cf7
-Author: Masakazu Mokuno <mokuno at sm.sony.co.jp>
-Date:   Fri May 30 16:52:44 2008 +0900
+commit 0eee612731e133604023bfa8d20047e98160845e
+Author: Tomas Winkler <tomas.winkler at intel.com>
+Date:   Fri Jul 11 11:53:36 2008 +0800
 
-    PS3: gelic: Use the new PMK interface in the gelic driver
+    iwlwifi: fix LED stall
     
-    With the new WEXT flags, the PS3 wireless driver can tell the user space that
-    it would do handle 4-way handshake by itself and needs the PSK without private
-    ioctls.
+    This patch fixes LED stall. last_blink_time was updated only if LED command
+    was sent, causing wrong computation of the througput.
+    Some code cleanup comes with this patch as well
     
-    Signed-off-by: Masakazu Mokuno <mokuno at sm.sony.co.jp>
+    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
+    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit ba569b4c68f11906da2996ee252bcff0df61cb90
-Author: Masakazu Mokuno <mokuno at sm.sony.co.jp>
-Date:   Fri May 30 16:52:23 2008 +0900
+commit 9f17b318a1e2335b45cf35ad6509b90e972c0e6b
+Author: Tomas Winkler <tomas.winkler at intel.com>
+Date:   Fri Jul 11 11:53:35 2008 +0800
 
-    WEXT: Add support for passing PMK and capability flags to WEXT
+    iwlwifi: differentiate 4965 and 5000 hw ampdu queues number
     
-    This defines the flags for setting the PMK to the driver and the
-    capability flag for this so that the user space program can figure out
-    whether the target driver wants to do 4-way hand shake by itself and
[...97305 lines suppressed...]
++				  wext_ioctl_func private)
+ {
++	struct iwreq *iwr = (struct iwreq *) ifr;
+ 	struct net_device *dev;
+ 	iw_handler	handler;
+ 
+@@ -1019,12 +1034,12 @@ static int wireless_process_ioctl(struct
+ 	 * Note that 'cmd' is already filtered in dev_ioctl() with
+ 	 * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */
+ 	if (cmd == SIOCGIWSTATS)
+-		return ioctl_standard_call(dev, ifr, cmd,
+-					   &iw_handler_get_iwstats);
++		return standard(dev, iwr, cmd, info,
++				&iw_handler_get_iwstats);
+ 
+ 	if (cmd == SIOCGIWPRIV && dev->wireless_handlers)
+-		return ioctl_standard_call(dev, ifr, cmd,
+-					   &iw_handler_get_private);
++		return standard(dev, iwr, cmd, info,
++				&iw_handler_get_private);
+ 
+ 	/* Basic check */
+ 	if (!netif_device_present(dev))
+@@ -1035,9 +1050,9 @@ static int wireless_process_ioctl(struct
+ 	if (handler) {
+ 		/* Standard and private are not the same */
+ 		if (cmd < SIOCIWFIRSTPRIV)
+-			return ioctl_standard_call(dev, ifr, cmd, handler);
++			return standard(dev, iwr, cmd, info, handler);
+ 		else
+-			return ioctl_private_call(dev, ifr, cmd, handler);
++			return private(dev, iwr, cmd, info, handler);
+ 	}
+ 	/* Old driver API : call driver ioctl handler */
+ 	if (dev->do_ioctl)
+@@ -1045,27 +1060,154 @@ static int wireless_process_ioctl(struct
+ 	return -EOPNOTSUPP;
+ }
+ 
+-/* entry point from dev ioctl */
+-int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
+-		      void __user *arg)
++/* If command is `set a parameter', or `get the encoding parameters',
++ * check if the user has the right to do it.
++ */
++static int wext_permission_check(unsigned int cmd)
+ {
+-	int ret;
+-
+-	/* If command is `set a parameter', or
+-	 * `get the encoding parameters', check if
+-	 * the user has the right to do it */
+ 	if ((IW_IS_SET(cmd) || cmd == SIOCGIWENCODE || cmd == SIOCGIWENCODEEXT)
+ 	    && !capable(CAP_NET_ADMIN))
+ 		return -EPERM;
+ 
++	return 0;
++}
++
++/* entry point from dev ioctl */
++static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr,
++			       unsigned int cmd, struct iw_request_info *info,
++			       wext_ioctl_func standard,
++			       wext_ioctl_func private)
++{
++	int ret = wext_permission_check(cmd);
++
++	if (ret)
++		return ret;
++
+ 	dev_load(net, ifr->ifr_name);
+ 	rtnl_lock();
+-	ret = wireless_process_ioctl(net, ifr, cmd);
++	ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private);
+ 	rtnl_unlock();
+-	if (IW_IS_GET(cmd) && copy_to_user(arg, ifr, sizeof(struct iwreq)))
++
++	return ret;
++}
++
++int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
++		      void __user *arg)
++{
++	struct iw_request_info info = { .cmd = cmd, .flags = 0 };
++	int ret;
++
++	ret = wext_ioctl_dispatch(net, ifr, cmd, &info,
++				  ioctl_standard_call,
++				  ioctl_private_call);
++	if (ret >= 0 &&
++	    IW_IS_GET(cmd) &&
++	    copy_to_user(arg, ifr, sizeof(struct iwreq)))
++		return -EFAULT;
++
++	return ret;
++}
++
++#ifdef CONFIG_COMPAT
++static int compat_standard_call(struct net_device	*dev,
++				struct iwreq		*iwr,
++				unsigned int		cmd,
++				struct iw_request_info	*info,
++				iw_handler		handler)
++{
++	const struct iw_ioctl_description *descr;
++	struct compat_iw_point *iwp_compat;
++	struct iw_point iwp;
++	int err;
++
++	descr = standard_ioctl + (cmd - SIOCIWFIRST);
++
++	if (descr->header_type != IW_HEADER_TYPE_POINT)
++		return ioctl_standard_call(dev, iwr, cmd, info, handler);
++
++	iwp_compat = (struct compat_iw_point *) &iwr->u.data;
++	iwp.pointer = compat_ptr(iwp_compat->pointer);
++	iwp.length = iwp_compat->length;
++	iwp.flags = iwp_compat->flags;
++
++	err = ioctl_standard_iw_point(&iwp, cmd, descr, handler, dev, info);
++
++	iwp_compat->pointer = ptr_to_compat(iwp.pointer);
++	iwp_compat->length = iwp.length;
++	iwp_compat->flags = iwp.flags;
++
++	return err;
++}
++
++static int compat_private_call(struct net_device *dev, struct iwreq *iwr,
++			       unsigned int cmd, struct iw_request_info *info,
++			       iw_handler handler)
++{
++	const struct iw_priv_args *descr;
++	int ret, extra_size;
++
++	extra_size = get_priv_descr_and_size(dev, cmd, &descr);
++
++	/* Check if we have a pointer to user space data or not. */
++	if (extra_size == 0) {
++		/* No extra arguments. Trivial to handle */
++		ret = handler(dev, info, &(iwr->u), (char *) &(iwr->u));
++	} else {
++		struct compat_iw_point *iwp_compat;
++		struct iw_point iwp;
++
++		iwp_compat = (struct compat_iw_point *) &iwr->u.data;
++		iwp.pointer = compat_ptr(iwp_compat->pointer);
++		iwp.length = iwp_compat->length;
++		iwp.flags = iwp_compat->flags;
++
++		ret = ioctl_private_iw_point(&iwp, cmd, descr,
++					     handler, dev, info, extra_size);
++
++		iwp_compat->pointer = ptr_to_compat(iwp.pointer);
++		iwp_compat->length = iwp.length;
++		iwp_compat->flags = iwp.flags;
++	}
++
++	/* Call commit handler if needed and defined */
++	if (ret == -EIWCOMMIT)
++		ret = call_commit_handler(dev);
++
++	return ret;
++}
++
++int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
++			     unsigned long arg)
++{
++	void __user *argp = (void __user *)arg;
++	struct iw_request_info info;
++	struct iwreq iwr;
++	char *colon;
++	int ret;
++
++	if (copy_from_user(&iwr, argp, sizeof(struct iwreq)))
++		return -EFAULT;
++
++	iwr.ifr_name[IFNAMSIZ-1] = 0;
++	colon = strchr(iwr.ifr_name, ':');
++	if (colon)
++		*colon = 0;
++
++	info.cmd = cmd;
++	info.flags = IW_REQUEST_FLAG_COMPAT;
++
++	ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info,
++				  compat_standard_call,
++				  compat_private_call);
++
++	if (ret >= 0 &&
++	    IW_IS_GET(cmd) &&
++	    copy_to_user(argp, &iwr, sizeof(struct iwreq)))
+ 		return -EFAULT;
++
+ 	return ret;
+ }
++#endif
+ 
+ /************************* EVENT PROCESSING *************************/
+ /*

linux-2.6-wireless.patch:

Index: linux-2.6-wireless.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-wireless.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-wireless.patch	16 Jun 2008 10:19:26 -0000	1.8
+++ linux-2.6-wireless.patch	18 Jul 2008 14:57:42 -0000	1.9
@@ -1,540 +1,521 @@
-commit cb62eccd7d946f7fb92b8beb79988726ec92c227
-Author: Ivo van Doorn <ivdoorn at gmail.com>
-Date:   Thu Jun 12 20:47:17 2008 +0200
+commit 814feefa859a736d29d0700d49debf13904b429f
+Author: Ihar Hrachyshka <ihar.hrachyshka at promwad.com>
+Date:   Wed Jul 9 09:29:58 2008 +0300
 
-    rt2x00: Add D-link DWA111 support
+    libertas: fix memory alignment problems on the blackfin
     
-    Add new rt73usb USB ID for D-Link DWA111
+    Fixing unaligned memory access on the blackfin architecture.
     
-    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
+    Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka at promwad.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 995ad6c5a415c9389d094d246ca1b305c1e31813
-Author: Tomas Winkler <tomas.winkler at intel.com>
-Date:   Thu Jun 12 20:08:19 2008 +0300
+commit 86229f0c7b4e065f51b5572a8a61801e281740a0
+Author: Luis Carlos Cobo <luisca at cozybit.com>
+Date:   Tue Jul 8 16:19:21 2008 +0200
+
+    zd1211rw: stop beacons on remove_interface
+    
+    If a mesh or ad-hoc interface is brought up and later it is replaced
+    by managed interface, the managed interface will keep transmitting
+    the beacons that were configured for the former interface. This patch
+    fixes that behaviour.
+    
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-    mac80211: add missing new line in debug print HT_DEBUG
+commit 1f90916264049a7d9e6106fd60d289c9a775d24f
+Author: Ivo van Doorn <ivdoorn at gmail.com>
+Date:   Tue Jul 8 13:45:20 2008 +0200
+
+    rt2x00: Disable synchronization during initialization
     
-    This patch adds '\n' in debug printk (wme.c HT DEBUG)
+    As soon as init_registers() was called, the rt2400/rt2500
+    would start raising beacondone interrupts. Since this is highly
+    premature since no beacons were provided yet, we should
+    initialize the synchronization register to 0.
+    
+    This will make all drivers initialize it to 0 regardless
+    if they are raising beacondone interrupts or not, since it only
+    makes sense to have it completely disabled.
     
-    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
+    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit adeed48090fc370afa0db8d007748ee72a40b578
+Author: Mattias Nissler <mattias.nissler at gmx.de>
+Date:   Mon Jul 7 23:08:19 2008 +0200
+
+    rc80211_pid: Fix fast_start parameter handling
+    
+    This removes the fast_start parameter from the rc_pid parameters
+    information and instead uses the parameter macro when initializing
+    the rc_pid state. Since the parameter is only used on initialization,
+    there is no point of making exporting it via debugfs. This also fixes
+    uninitialized memory references to the fast_start and norm_offset
+    parameters detected by the kmemcheck utility.  Thanks to Vegard Nossum
+    for reporting the bug.
+    
+    Signed-off-by: Mattias Nissler <mattias.nissler at gmx.de>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 5c5f9664d5284d8542062fed39e1f19b80db7aa5
-Author: Abhijeet Kolekar <abhijeet.kolekar at intel.com>
-Date:   Thu Jun 12 09:47:16 2008 +0800
+commit 6e43829bb69bf1d584a592075f1357590eb49b1a
+Author: Vladimir Koutny <vlado at work.ksp.sk>
+Date:   Mon Jul 7 14:23:01 2008 +0200
 
-    mac80211 : fix for iwconfig in ad-hoc mode
+    mac80211: don't report selected IBSS when not found
     
-    The patch checks interface status, if it is in IBSS_JOINED mode
-    show cell id it is associated with.
+    Don't report a 'selected' IBSS in sta_find_ibss when none was found.
     
-    Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar at intel.com>
-    Signed-off-by: Zhu Yi <yi.zhu at intel.com>
+    Signed-off-by: Vladimir Koutny <vlado at ksp.sk>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit e6340361f9c70e84312caed98c6e058ac6234e9b
+commit 9e095a687b3561972272063260e14ab1bc21de08
 Author: Michael Buesch <mb at bu3sch.de>
-Date:   Thu Jun 12 15:33:13 2008 +0200
+Date:   Fri Jul 4 23:44:37 2008 +0200
 
-    ssb: Fix coherent DMA mask for PCI devices
+    ssb-pcicore: Fix IRQ-vector init on embedded devices
     
-    This fixes setting the coherent DMA mask for PCI devices.
+    On embedded devices we must not route the interrupts through
+    the PCI core, if our host-bus is not PCI.
     
+    Reported-by: Steve Brown <sbrown at cortland.com>
     Signed-off-by: Michael Buesch <mb at bu3sch.de>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 6847aa5cce6e22c3625a243b02909ac46aafa110
-Author: Randy Dunlap <randy.dunlap at oracle.com>
-Date:   Wed Jun 11 13:32:22 2008 -0700
-
-    rt2x00: LEDS build failure
-    
-    Config symbols that select LEDS_CLASS need to depend on NEW_LEDS so that
-    undefined symbols are not used in the build.
-    
-    The alternative is to select NEW_LEDS, which some drivers do.
-    
-    This patch fixes the led_* symbols build errors.
-    
-    (.text+0x174cdc): undefined reference to `input_unregister_device'
-    (.text+0x174d9f): undefined reference to `input_allocate_device'
-    (.text+0x174e2d): undefined reference to `input_register_device'
-    (.text+0x174e53): undefined reference to `input_free_device'
-    rt2x00rfkill.c:(.text+0x176dc4): undefined reference to `input_allocate_polled_device'
-    rt2x00rfkill.c:(.text+0x176e8b): undefined reference to `input_event'
-    rt2x00rfkill.c:(.text+0x176e9f): undefined reference to `input_event'
-    (.text+0x176eca): undefined reference to `input_unregister_polled_device'
-    (.text+0x176efc): undefined reference to `input_free_polled_device'
-    (.text+0x176f37): undefined reference to `input_free_polled_device'
-    (.text+0x176fd8): undefined reference to `input_register_polled_device'
-    (.text+0x1772c0): undefined reference to `led_classdev_resume'
-    (.text+0x1772d4): undefined reference to `led_classdev_resume'
-    (.text+0x1772e8): undefined reference to `led_classdev_resume'
-    (.text+0x17730a): undefined reference to `led_classdev_suspend'
-    (.text+0x17731e): undefined reference to `led_classdev_suspend'
-    (.text+0x17732f): undefined reference to `led_classdev_suspend'
-    rt2x00leds.c:(.text+0x177348): undefined reference to `led_classdev_unregister'
-    rt2x00leds.c:(.text+0x1773c0): undefined reference to `led_classdev_register'
-    rfkill-input.c:(.text+0x209e4c): undefined reference to `input_close_device'
-    rfkill-input.c:(.text+0x209e53): undefined reference to `input_unregister_handle'
-    rfkill-input.c:(.text+0x209ea1): undefined reference to `input_register_handle'
-    rfkill-input.c:(.text+0x209eae): undefined reference to `input_open_device'
-    rfkill-input.c:(.text+0x209ebb): undefined reference to `input_unregister_handle'
-    rfkill-input.c:(.init.text+0x17405): undefined reference to `input_register_handler'
-    rfkill-input.c:(.exit.text+0x194f): undefined reference to `input_unregister_handler'
-    make[1]: *** [vmlinux] Error 1
-    
-    Signed-off-by: Randy Dunlap <randy.dunlap at oracle.com>
-    Acked-by: Ivo van Doorn <IvDoorn at gmail.com>
-    Signed-off-by: John W. Linville <linville at tuxdriver.com>
-
-commit e76328e4a8260707fbc29c99773fb5ba4627096c
-Author: Randy Dunlap <randy.dunlap at oracle.com>
-Date:   Wed Jun 11 12:57:58 2008 -0700
-
-    rt2x00: INPUT build failure
-    
-    Config symbols that select RFKILL need to depend on INPUT so that
-    undefined symbols are not used in the build.
-    
-    This patch fixes the input_* symbols build errors.
-    
-    (.text+0x174cdc): undefined reference to `input_unregister_device'
-    (.text+0x174d9f): undefined reference to `input_allocate_device'
-    (.text+0x174e2d): undefined reference to `input_register_device'
-    (.text+0x174e53): undefined reference to `input_free_device'
-    rt2x00rfkill.c:(.text+0x176dc4): undefined reference to `input_allocate_polled_device'
-    rt2x00rfkill.c:(.text+0x176e8b): undefined reference to `input_event'
-    rt2x00rfkill.c:(.text+0x176e9f): undefined reference to `input_event'
-    (.text+0x176eca): undefined reference to `input_unregister_polled_device'
-    (.text+0x176efc): undefined reference to `input_free_polled_device'
-    (.text+0x176f37): undefined reference to `input_free_polled_device'
-    (.text+0x176fd8): undefined reference to `input_register_polled_device'
-    (.text+0x1772c0): undefined reference to `led_classdev_resume'
-    (.text+0x1772d4): undefined reference to `led_classdev_resume'
-    (.text+0x1772e8): undefined reference to `led_classdev_resume'
-    (.text+0x17730a): undefined reference to `led_classdev_suspend'
-    (.text+0x17731e): undefined reference to `led_classdev_suspend'
-    (.text+0x17732f): undefined reference to `led_classdev_suspend'
-    rt2x00leds.c:(.text+0x177348): undefined reference to `led_classdev_unregister'
-    rt2x00leds.c:(.text+0x1773c0): undefined reference to `led_classdev_register'
-    rfkill-input.c:(.text+0x209e4c): undefined reference to `input_close_device'
-    rfkill-input.c:(.text+0x209e53): undefined reference to `input_unregister_handle'
-    rfkill-input.c:(.text+0x209ea1): undefined reference to `input_register_handle'
-    rfkill-input.c:(.text+0x209eae): undefined reference to `input_open_device'
-    rfkill-input.c:(.text+0x209ebb): undefined reference to `input_unregister_handle'
-    rfkill-input.c:(.init.text+0x17405): undefined reference to `input_register_handler'
-    rfkill-input.c:(.exit.text+0x194f): undefined reference to `input_unregister_handler'
-    make[1]: *** [vmlinux] Error 1
+commit 9dfd55008e3863dcd93219c74bf05b09e5c549e2
+Author: Firat Birlik <firat at airties.com>
+Date:   Fri Jul 4 04:31:50 2008 +0100
+
+    zd1211rw: add ID for AirTies WUS-201
     
-    Signed-off-by: Randy Dunlap <randy.dunlap at oracle.com>
-    Acked-by: Ivo van Doorn <IvDoorn at gmail.com>
+    I would like to inform you of our zd1211 based usb wifi adapter (AirTies
+    WUS-201), which works with the zd1211rw driver with the following device
+    id definition.
+    
+    Signed-off-by: Daniel Drake <dsd at gentoo.org>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 98a3b2fe435ae76170936c14f5c9e6a87548e3ef
-Author: Michael Buesch <mb at bu3sch.de>
-Date:   Thu Jun 12 12:36:29 2008 +0200
+commit ea0c925370b33baf168bb33782c613468c1aa119
+Author: Ivo van Doorn <ivdoorn at gmail.com>
+Date:   Thu Jul 3 19:02:44 2008 +0200
 
-    b43: Fix noise calculation WARN_ON
-    
-    This removes a WARN_ON that is responsible for the following koops:
-    http://www.kerneloops.org/searchweek.php?search=b43_generate_noise_sample
+    mac80211: Only flush workqueue when last interface was removed
     
-    The comment in the patch describes why it's safe to simply remove
-    the check.
+    Currently the ieee80211_hw->workqueue is flushed each time
+    an interface is being removed. However most scheduled work
+    is not interface specific but device specific, for example things like
+    periodic work for link tuners.
+    
+    This patch will move the flush_workqueue() call to directly behind
+    the call to ops->stop() to make sure the workqueue is only flushed
+    when all interfaces are gone and there really shouldn't be any scheduled
+    work in the drivers left.
     
-    Signed-off-by: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
+    Acked-by: Johannes Berg <johannes at sipsolutions.net>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 028118a5f09a9c807e6b43e2231efdff9f224c74
-Author: Michael Buesch <mb at bu3sch.de>
-Date:   Thu Jun 12 11:58:56 2008 +0200
+commit 8db9369ff92b1cd93566baadd8bd2992f025fdd0
+Author: Guy Cohen <guy.cohen at intel.com>
+Date:   Thu Jul 3 19:56:13 2008 +0300
 
-    b43: Fix possible NULL pointer dereference in DMA code
-    
-    This fixes a possible NULL pointer dereference in an error path of the
-    DMA allocation error checking code. This is also necessary for a future
-    DMA API change that is on its way into the mainline kernel that adds
-    an additional dev parameter to dma_mapping_error().
+    mac80211: move netif_carrier_on to after ieee80211_bss_info_change_notify
     
-    This patch moves the whole struct b43_dmaring struct initialization
-    right before any DMA allocation operation.
+    Putting netif_carrier_on before configuring the driver/device with the
+    new association state may cause a race (tx frames may be sent before
+    configuration is done)
     
-    Reported-by: Miles Lane <miles.lane at gmail.com>
-    Signed-off-by: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: Guy Cohen <guy.cohen at intel.com>
+    Signed-off-by: Tomas Winkler <tomas.winkler at intel.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit 051c256f672efa356a4cda1841132dbc86541090
-Author: Gertjan van Wingerde <gwingerde at kpnplanet.nl>
-Date:   Tue Jun 3 20:29:47 2008 +0200
+commit 0ff1cca0e272045b9c11a2ff94bd3e6893c9308c
+Author: Darren Jenkins <darrenrjenkins at gmail.com>
+Date:   Thu Jul 3 09:41:38 2008 +1000
 
-    rt2x00: Restrict DMA to 32-bit addresses.
+    drivers/net/wireless/iwlwifi/iwl-3945.c Fix type issue on 64bit
     
-    None of the rt2x00 PCI devices support 64-bit DMA addresses (they all
-    only accept 32-bit buffer addresses). Hence it makes no sense to try to
-    enable 64-bit DMA addresses. Only try to enable 32-bit DMA addresses.
+    Coverity CID: 2265 NEGATIVE_RETURNS
     
-    Signed-off-by: Gertjan van Wingerde <gwingerde at kpnplanet.nl>
-    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
+    "rate" is of an unsigned type, and the code requires a signed type.
+    The following patch makes it so.
+    
+    Signed-off-by: Darren Jenkins <darrenrjenkins at gmailcom>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-commit edfa78b2ba651782d70be6d1fef214e21a26d8cb
-Author: Ivo van Doorn <IvDoorn at gmail.com>
-Date:   Tue Jun 3 20:29:50 2008 +0200
-
-    rt2x00: Don't kill guardian_urb when it wasn't created
-    
-    This fixes a "BUG: unable to handle kernel paging request"
-    bug in rt73usb which was caused by killing the guardian_urb
-    while it had never been allocated for rt73usb.
+commit fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757
+Author: John W. Linville <linville at tuxdriver.com>
+Date:   Wed Jul 2 11:04:24 2008 -0400
+
+    hostap_cs: correct poor NULL checks in suspend/resume routines
+    
+    This corrects this kernel.org bug:
+    
+    	http://bugzilla.kernel.org/show_bug.cgi?id=9701
     
-    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
     Signed-off-by: John W. Linville <linville at tuxdriver.com>
 
-diff -up linux-2.6.25.noarch/drivers/net/wireless/b43/b43.h.orig linux-2.6.25.noarch/drivers/net/wireless/b43/b43.h
---- linux-2.6.25.noarch/drivers/net/wireless/b43/b43.h.orig	2008-06-13 17:37:04.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/net/wireless/b43/b43.h	2008-06-13 17:37:35.000000000 -0400
-@@ -630,7 +630,6 @@ struct b43_pio {
- 
- /* Context information for a noise calculation (Link Quality). */
- struct b43_noise_calculation {
--	u8 channel_at_start;
- 	bool calculation_running;
- 	u8 nr_samples;
- 	s8 samples[8][4];
-diff -up linux-2.6.25.noarch/drivers/net/wireless/b43/dma.c.orig linux-2.6.25.noarch/drivers/net/wireless/b43/dma.c
---- linux-2.6.25.noarch/drivers/net/wireless/b43/dma.c.orig	2008-06-13 17:37:04.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/net/wireless/b43/dma.c	2008-06-13 17:37:35.000000000 -0400
-@@ -795,24 +795,49 @@ struct b43_dmaring *b43_setup_dmaring(st
- {
- 	struct b43_dmaring *ring;
- 	int err;
--	int nr_slots;
- 	dma_addr_t dma_test;
+diff -up linux-2.6.25.noarch/drivers/net/wireless/hostap/hostap_cs.c.orig linux-2.6.25.noarch/drivers/net/wireless/hostap/hostap_cs.c
+--- linux-2.6.25.noarch/drivers/net/wireless/hostap/hostap_cs.c.orig	2008-07-10 10:52:58.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/hostap/hostap_cs.c	2008-07-10 10:53:04.000000000 -0400
+@@ -777,8 +777,10 @@ static int hostap_cs_suspend(struct pcmc
+ 	int dev_open = 0;
+ 	struct hostap_interface *iface = NULL;
+ 
+-	if (dev)
+-		iface = netdev_priv(dev);
++	if (!dev)
++		return -ENODEV;
++
++	iface = netdev_priv(dev);
  
- 	ring = kzalloc(sizeof(*ring), GFP_KERNEL);
- 	if (!ring)
- 		goto out;
--	ring->type = type;
+ 	PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
+ 	if (iface && iface->local)
+@@ -798,8 +800,10 @@ static int hostap_cs_resume(struct pcmci
+ 	int dev_open = 0;
+ 	struct hostap_interface *iface = NULL;
+ 
+-	if (dev)
+-		iface = netdev_priv(dev);
++	if (!dev)
++		return -ENODEV;
++
++	iface = netdev_priv(dev);
+ 
+ 	PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
+ 
+diff -up linux-2.6.25.noarch/drivers/net/wireless/iwlwifi/iwl-3945.c.orig linux-2.6.25.noarch/drivers/net/wireless/iwlwifi/iwl-3945.c
+--- linux-2.6.25.noarch/drivers/net/wireless/iwlwifi/iwl-3945.c.orig	2008-07-10 10:52:58.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/iwlwifi/iwl-3945.c	2008-07-10 10:53:04.000000000 -0400
+@@ -449,7 +449,7 @@ static void iwl3945_dbg_report_frame(str
+ 
+ 	if (print_summary) {
+ 		char *title;
+-		u32 rate;
++		int rate;
+ 
+ 		if (hundred)
+ 			title = "100Frames";
+@@ -487,7 +487,7 @@ static void iwl3945_dbg_report_frame(str
+ 		 *    but you can hack it to show more, if you'd like to. */
+ 		if (dataframe)
+ 			IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, "
+-				     "len=%u, rssi=%d, chnl=%d, rate=%u, \n",
++				     "len=%u, rssi=%d, chnl=%d, rate=%d, \n",
+ 				     title, fc, header->addr1[5],
+ 				     length, rssi, channel, rate);
+ 		else {
+diff -up linux-2.6.25.noarch/drivers/net/wireless/libertas/scan.c.orig linux-2.6.25.noarch/drivers/net/wireless/libertas/scan.c
+--- linux-2.6.25.noarch/drivers/net/wireless/libertas/scan.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/libertas/scan.c	2008-07-10 10:53:45.000000000 -0400
+@@ -567,11 +567,11 @@ static int lbs_process_bss(struct bss_de
+ 	pos += 8;
+ 
+ 	/* beacon interval is 2 bytes long */
+-	bss->beaconperiod = le16_to_cpup((void *) pos);
++	bss->beaconperiod = get_unaligned_le16(pos);
+ 	pos += 2;
+ 
+ 	/* capability information is 2 bytes long */
+-	bss->capability = le16_to_cpup((void *) pos);
++	bss->capability = get_unaligned_le16(pos);
+ 	lbs_deb_scan("process_bss: capabilities 0x%04x\n", bss->capability);
+ 	pos += 2;
+ 
+diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2400pci.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2400pci.c
+--- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2400pci.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2400pci.c	2008-07-10 10:53:45.000000000 -0400
+@@ -731,6 +731,17 @@ static int rt2400pci_init_registers(stru
+ 			   (rt2x00dev->rx->data_size / 128));
+ 	rt2x00pci_register_write(rt2x00dev, CSR9, reg);
+ 
++	rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
++	rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
++	rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 0);
++	rt2x00_set_field32(&reg, CSR14_TBCN, 0);
++	rt2x00_set_field32(&reg, CSR14_TCFP, 0);
++	rt2x00_set_field32(&reg, CSR14_TATIMW, 0);
++	rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
++	rt2x00_set_field32(&reg, CSR14_CFP_COUNT_PRELOAD, 0);
++	rt2x00_set_field32(&reg, CSR14_TBCM_PRELOAD, 0);
++	rt2x00pci_register_write(rt2x00dev, CSR14, reg);
++
+ 	rt2x00pci_register_write(rt2x00dev, CNT3, 0x3f080000);
  
--	nr_slots = B43_RXRING_SLOTS;
-+	ring->nr_slots = B43_RXRING_SLOTS;
- 	if (for_tx)
--		nr_slots = B43_TXRING_SLOTS;
-+		ring->nr_slots = B43_TXRING_SLOTS;
- 
--	ring->meta = kcalloc(nr_slots, sizeof(struct b43_dmadesc_meta),
-+	ring->meta = kcalloc(ring->nr_slots, sizeof(struct b43_dmadesc_meta),
- 			     GFP_KERNEL);
- 	if (!ring->meta)
- 		goto err_kfree_ring;
-+
-+	ring->type = type;
-+	ring->dev = dev;
-+	ring->mmio_base = b43_dmacontroller_base(type, controller_index);
-+	ring->index = controller_index;
-+	if (type == B43_DMA_64BIT)
-+		ring->ops = &dma64_ops;
-+	else
-+		ring->ops = &dma32_ops;
- 	if (for_tx) {
--		ring->txhdr_cache = kcalloc(nr_slots,
-+		ring->tx = 1;
-+		ring->current_slot = -1;
-+	} else {
-+		if (ring->index == 0) {
-+			ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE;
-+			ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET;
-+		} else if (ring->index == 3) {
-+			ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE;
-+			ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET;
-+		} else
-+			B43_WARN_ON(1);
+ 	rt2x00pci_register_read(rt2x00dev, ARCSR0, &reg);
+diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500pci.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500pci.c
+--- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500pci.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500pci.c	2008-07-10 10:53:45.000000000 -0400
+@@ -824,6 +824,17 @@ static int rt2500pci_init_registers(stru
+ 	rt2x00_set_field32(&reg, CSR11_CW_SELECT, 0);
+ 	rt2x00pci_register_write(rt2x00dev, CSR11, reg);
+ 
++	rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
++	rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
++	rt2x00_set_field32(&reg, CSR14_TSF_SYNC, 0);
++	rt2x00_set_field32(&reg, CSR14_TBCN, 0);
++	rt2x00_set_field32(&reg, CSR14_TCFP, 0);
++	rt2x00_set_field32(&reg, CSR14_TATIMW, 0);
++	rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
++	rt2x00_set_field32(&reg, CSR14_CFP_COUNT_PRELOAD, 0);
++	rt2x00_set_field32(&reg, CSR14_TBCM_PRELOAD, 0);
++	rt2x00pci_register_write(rt2x00dev, CSR14, reg);
++
+ 	rt2x00pci_register_write(rt2x00dev, CNT3, 0);
+ 
+ 	rt2x00pci_register_read(rt2x00dev, TXCSR8, &reg);
+diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500usb.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500usb.c
+--- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500usb.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2500usb.c	2008-07-10 10:53:45.000000000 -0400
+@@ -801,6 +801,13 @@ static int rt2500usb_init_registers(stru
+ 	rt2x00_set_field16(&reg, TXRX_CSR8_BBP_ID1_VALID, 0);
+ 	rt2500usb_register_write(rt2x00dev, TXRX_CSR8, reg);
+ 
++	rt2500usb_register_read(rt2x00dev, TXRX_CSR19, &reg);
++	rt2x00_set_field16(&reg, TXRX_CSR19_TSF_COUNT, 0);
++	rt2x00_set_field16(&reg, TXRX_CSR19_TSF_SYNC, 0);
++	rt2x00_set_field16(&reg, TXRX_CSR19_TBCN, 0);
++	rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0);
++	rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
++
+ 	rt2500usb_register_write(rt2x00dev, TXRX_CSR21, 0xe78f);
+ 	rt2500usb_register_write(rt2x00dev, MAC_CSR9, 0xff1d);
+ 
+diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt61pci.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt61pci.c
+--- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt61pci.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt61pci.c	2008-07-10 10:53:45.000000000 -0400
+@@ -1201,6 +1201,15 @@ static int rt61pci_init_registers(struct
+ 	rt2x00_set_field32(&reg, TXRX_CSR8_ACK_CTS_54MBS, 42);
+ 	rt2x00pci_register_write(rt2x00dev, TXRX_CSR8, reg);
+ 
++	rt2x00pci_register_read(rt2x00dev, TXRX_CSR9, &reg);
++	rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_INTERVAL, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TIMESTAMP_COMPENSATE, 0);
++	rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
++
+ 	rt2x00pci_register_write(rt2x00dev, TXRX_CSR15, 0x0000000f);
+ 
+ 	rt2x00pci_register_write(rt2x00dev, MAC_CSR6, 0x00000fff);
+diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c
+--- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c	2008-07-10 10:53:45.000000000 -0400
+@@ -1006,6 +1006,15 @@ static int rt73usb_init_registers(struct
+ 	rt2x00_set_field32(&reg, TXRX_CSR8_ACK_CTS_54MBS, 42);
+ 	rt73usb_register_write(rt2x00dev, TXRX_CSR8, reg);
+ 
++	rt73usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
++	rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_INTERVAL, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TSF_SYNC, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
++	rt2x00_set_field32(&reg, TXRX_CSR9_TIMESTAMP_COMPENSATE, 0);
++	rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg);
++
+ 	rt73usb_register_write(rt2x00dev, TXRX_CSR15, 0x0000000f);
+ 
+ 	rt73usb_register_read(rt2x00dev, MAC_CSR6, &reg);
+diff -up linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_mac.c.orig linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_mac.c
+--- linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_mac.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_mac.c	2008-07-10 10:53:45.000000000 -0400
+@@ -765,6 +765,7 @@ static void zd_op_remove_interface(struc
+ {
+ 	struct zd_mac *mac = zd_hw_mac(hw);
+ 	mac->type = IEEE80211_IF_TYPE_INVALID;
++	zd_set_beacon_interval(&mac->chip, 0);
+ 	zd_write_mac_addr(&mac->chip, NULL);
+ }
+ 
+diff -up linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_usb.c.orig linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_usb.c
+--- linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_usb.c.orig	2008-07-10 10:52:58.000000000 -0400
++++ linux-2.6.25.noarch/drivers/net/wireless/zd1211rw/zd_usb.c	2008-07-10 10:53:04.000000000 -0400
+@@ -64,6 +64,7 @@ static struct usb_device_id usb_ids[] = 
+ 	{ USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B },
+ 	{ USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B },
+ 	{ USB_DEVICE(0x050d, 0x705c), .driver_info = DEVICE_ZD1211B },
++	{ USB_DEVICE(0x083a, 0xe506), .driver_info = DEVICE_ZD1211B },
+ 	{ USB_DEVICE(0x083a, 0x4505), .driver_info = DEVICE_ZD1211B },
+ 	{ USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B },
+ 	{ USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B },
+diff -up linux-2.6.25.noarch/drivers/ssb/driver_pcicore.c.orig linux-2.6.25.noarch/drivers/ssb/driver_pcicore.c
+--- linux-2.6.25.noarch/drivers/ssb/driver_pcicore.c.orig	2008-07-10 10:52:58.000000000 -0400
++++ linux-2.6.25.noarch/drivers/ssb/driver_pcicore.c	2008-07-10 10:53:04.000000000 -0400
+@@ -537,6 +537,13 @@ int ssb_pcicore_dev_irqvecs_enable(struc
+ 	int err = 0;
+ 	u32 tmp;
+ 
++	if (dev->bus->bustype != SSB_BUSTYPE_PCI) {
++		/* This SSB device is not on a PCI host-bus. So the IRQs are
++		 * not routed through the PCI core.
++		 * So we must not enable routing through the PCI core. */
++		goto out;
 +	}
-+	spin_lock_init(&ring->lock);
-+#ifdef CONFIG_B43_DEBUG
-+	ring->last_injected_overflow = jiffies;
-+#endif
-+
-+	if (for_tx) {
-+		ring->txhdr_cache = kcalloc(ring->nr_slots,
- 					    b43_txhdr_size(dev),
- 					    GFP_KERNEL);
- 		if (!ring->txhdr_cache)
-@@ -828,7 +853,7 @@ struct b43_dmaring *b43_setup_dmaring(st
- 					  b43_txhdr_size(dev), 1)) {
- 			/* ugh realloc */
- 			kfree(ring->txhdr_cache);
--			ring->txhdr_cache = kcalloc(nr_slots,
-+			ring->txhdr_cache = kcalloc(ring->nr_slots,
- 						    b43_txhdr_size(dev),
- 						    GFP_KERNEL | GFP_DMA);
- 			if (!ring->txhdr_cache)
-@@ -853,32 +878,6 @@ struct b43_dmaring *b43_setup_dmaring(st
- 				 DMA_TO_DEVICE);
- 	}
++
+ 	if (!pdev)
+ 		goto out;
+ 	bus = pdev->bus;
+diff -up linux-2.6.25.noarch/net/mac80211/main.c.orig linux-2.6.25.noarch/net/mac80211/main.c
+--- linux-2.6.25.noarch/net/mac80211/main.c.orig	2008-07-10 10:52:58.000000000 -0400
++++ linux-2.6.25.noarch/net/mac80211/main.c	2008-07-10 10:53:04.000000000 -0400
+@@ -530,8 +530,6 @@ static int ieee80211_stop(struct net_dev
+ 				local->sta_hw_scanning = 0;
+ 		}
  
--	ring->dev = dev;
--	ring->nr_slots = nr_slots;
--	ring->mmio_base = b43_dmacontroller_base(type, controller_index);
--	ring->index = controller_index;
--	if (type == B43_DMA_64BIT)
--		ring->ops = &dma64_ops;
--	else
--		ring->ops = &dma32_ops;
--	if (for_tx) {
--		ring->tx = 1;
--		ring->current_slot = -1;
--	} else {
--		if (ring->index == 0) {
--			ring->rx_buffersize = B43_DMA0_RX_BUFFERSIZE;
--			ring->frameoffset = B43_DMA0_RX_FRAMEOFFSET;
--		} else if (ring->index == 3) {
--			ring->rx_buffersize = B43_DMA3_RX_BUFFERSIZE;
--			ring->frameoffset = B43_DMA3_RX_FRAMEOFFSET;
--		} else
--			B43_WARN_ON(1);
--	}
--	spin_lock_init(&ring->lock);
--#ifdef CONFIG_B43_DEBUG
--	ring->last_injected_overflow = jiffies;
--#endif
+-		flush_workqueue(local->hw.workqueue);
 -
- 	err = alloc_ringmemory(ring);
- 	if (err)
- 		goto err_kfree_txhdr_cache;
-diff -up linux-2.6.25.noarch/drivers/net/wireless/b43/main.c.orig linux-2.6.25.noarch/drivers/net/wireless/b43/main.c
---- linux-2.6.25.noarch/drivers/net/wireless/b43/main.c.orig	2008-06-13 17:37:04.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/net/wireless/b43/main.c	2008-06-13 17:37:35.000000000 -0400
-@@ -1145,7 +1145,6 @@ static void b43_generate_noise_sample(st
- 	b43_jssi_write(dev, 0x7F7F7F7F);
- 	b43_write32(dev, B43_MMIO_MACCMD,
- 		    b43_read32(dev, B43_MMIO_MACCMD) | B43_MACCMD_BGNOISE);
--	B43_WARN_ON(dev->noisecalc.channel_at_start != dev->phy.channel);
- }
+ 		sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
+ 		kfree(sdata->u.sta.extra_ie);
+ 		sdata->u.sta.extra_ie = NULL;
+@@ -555,6 +553,8 @@ static int ieee80211_stop(struct net_dev
  
- static void b43_calculate_link_quality(struct b43_wldev *dev)
-@@ -1154,7 +1153,6 @@ static void b43_calculate_link_quality(s
+ 		ieee80211_led_radio(local, 0);
  
- 	if (dev->noisecalc.calculation_running)
- 		return;
--	dev->noisecalc.channel_at_start = dev->phy.channel;
- 	dev->noisecalc.calculation_running = 1;
- 	dev->noisecalc.nr_samples = 0;
- 
-@@ -1171,9 +1169,16 @@ static void handle_irq_noise(struct b43_
- 
- 	/* Bottom half of Link Quality calculation. */
- 
-+	/* Possible race condition: It might be possible that the user
-+	 * changed to a different channel in the meantime since we
-+	 * started the calculation. We ignore that fact, since it's
-+	 * not really that much of a problem. The background noise is
-+	 * an estimation only anyway. Slightly wrong results will get damped
-+	 * by the averaging of the 8 sample rounds. Additionally the
-+	 * value is shortlived. So it will be replaced by the next noise
-+	 * calculation round soon. */
-+
- 	B43_WARN_ON(!dev->noisecalc.calculation_running);
--	if (dev->noisecalc.channel_at_start != phy->channel)
--		goto drop_calculation;
- 	*((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev));
- 	if (noise[0] == 0x7F || noise[1] == 0x7F ||
- 	    noise[2] == 0x7F || noise[3] == 0x7F)
-@@ -1214,11 +1219,10 @@ static void handle_irq_noise(struct b43_
- 			average -= 48;
- 
- 		dev->stats.link_noise = average;
--	      drop_calculation:
- 		dev->noisecalc.calculation_running = 0;
- 		return;
++		flush_workqueue(local->hw.workqueue);
++
+ 		tasklet_disable(&local->tx_pending_tasklet);
+ 		tasklet_disable(&local->tasklet);
  	}
--      generate_new:
-+generate_new:
- 	b43_generate_noise_sample(dev);
+diff -up linux-2.6.25.noarch/net/mac80211/mlme.c.orig linux-2.6.25.noarch/net/mac80211/mlme.c
+--- linux-2.6.25.noarch/net/mac80211/mlme.c.orig	2008-07-10 10:52:58.000000000 -0400
++++ linux-2.6.25.noarch/net/mac80211/mlme.c	2008-07-10 10:53:04.000000000 -0400
+@@ -547,15 +547,14 @@ static void ieee80211_set_associated(str
+ 			sdata->bss_conf.ht_bss_conf = &conf->ht_bss_conf;
+ 		}
+ 
+-		netif_carrier_on(dev);
+ 		ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
+ 		memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN);
+ 		memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN);
+ 		ieee80211_sta_send_associnfo(dev, ifsta);
+ 	} else {
++		netif_carrier_off(dev);
+ 		ieee80211_sta_tear_down_BA_sessions(dev, ifsta->bssid);
+ 		ifsta->flags &= ~IEEE80211_STA_ASSOCIATED;
+-		netif_carrier_off(dev);
+ 		ieee80211_reset_erp_info(dev);
+ 
+ 		sdata->bss_conf.assoc_ht = 0;
+@@ -569,6 +568,10 @@ static void ieee80211_set_associated(str
+ 
+ 	sdata->bss_conf.assoc = assoc;
+ 	ieee80211_bss_info_change_notify(sdata, changed);
++
++	if (assoc)
++		netif_carrier_on(dev);
++
+ 	wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+ 	wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
  }
+@@ -3611,8 +3614,10 @@ static int ieee80211_sta_find_ibss(struc
+ 	spin_unlock_bh(&local->sta_bss_lock);
  
-diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/Kconfig.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/Kconfig
---- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/Kconfig.orig	2008-06-13 17:37:05.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/Kconfig	2008-06-13 17:37:35.000000000 -0400
-@@ -32,12 +32,13 @@ config RT2X00_LIB_FIRMWARE
- config RT2X00_LIB_RFKILL
- 	boolean
- 	depends on RT2X00_LIB
-+	depends on INPUT
- 	select RFKILL
- 	select INPUT_POLLDEV
- 
- config RT2X00_LIB_LEDS
- 	boolean
--	depends on RT2X00_LIB
-+	depends on RT2X00_LIB && NEW_LEDS
- 
- config RT2400PCI
- 	tristate "Ralink rt2400 pci/pcmcia support"
-@@ -51,7 +52,7 @@ config RT2400PCI
- 
- config RT2400PCI_RFKILL
- 	bool "RT2400 rfkill support"
--	depends on RT2400PCI
-+	depends on RT2400PCI && INPUT
- 	select RT2X00_LIB_RFKILL
- 	---help---
- 	  This adds support for integrated rt2400 devices that feature a
-@@ -60,7 +61,7 @@ config RT2400PCI_RFKILL
- 
- config RT2400PCI_LEDS
- 	bool "RT2400 leds support"
--	depends on RT2400PCI
-+	depends on RT2400PCI && NEW_LEDS
- 	select LEDS_CLASS
- 	select RT2X00_LIB_LEDS
- 	---help---
-@@ -78,7 +79,7 @@ config RT2500PCI
- 
- config RT2500PCI_RFKILL
- 	bool "RT2500 rfkill support"
--	depends on RT2500PCI
-+	depends on RT2500PCI && INPUT
- 	select RT2X00_LIB_RFKILL
- 	---help---
- 	  This adds support for integrated rt2500 devices that feature a
-@@ -87,7 +88,7 @@ config RT2500PCI_RFKILL
- 
- config RT2500PCI_LEDS
- 	bool "RT2500 leds support"
--	depends on RT2500PCI
-+	depends on RT2500PCI && NEW_LEDS
- 	select LEDS_CLASS
- 	select RT2X00_LIB_LEDS
- 	---help---
-@@ -107,7 +108,7 @@ config RT61PCI
- 
- config RT61PCI_RFKILL
- 	bool "RT61 rfkill support"
--	depends on RT61PCI
-+	depends on RT61PCI && INPUT
- 	select RT2X00_LIB_RFKILL
- 	---help---
- 	  This adds support for integrated rt61 devices that feature a
-@@ -116,7 +117,7 @@ config RT61PCI_RFKILL
- 
- config RT61PCI_LEDS
- 	bool "RT61 leds support"
--	depends on RT61PCI
-+	depends on RT61PCI && NEW_LEDS
- 	select LEDS_CLASS
- 	select RT2X00_LIB_LEDS
- 	---help---
-@@ -133,7 +134,7 @@ config RT2500USB
- 
- config RT2500USB_LEDS
- 	bool "RT2500 leds support"
--	depends on RT2500USB
-+	depends on RT2500USB && NEW_LEDS
- 	select LEDS_CLASS
- 	select RT2X00_LIB_LEDS
- 	---help---
-@@ -152,7 +153,7 @@ config RT73USB
- 
- config RT73USB_LEDS
- 	bool "RT73 leds support"
--	depends on RT73USB
-+	depends on RT73USB && NEW_LEDS
- 	select LEDS_CLASS
- 	select RT2X00_LIB_LEDS
- 	---help---
-diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00pci.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00pci.c
---- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00pci.c.orig	2008-06-13 17:37:05.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00pci.c	2008-06-13 17:37:35.000000000 -0400
-@@ -412,8 +412,7 @@ int rt2x00pci_probe(struct pci_dev *pci_
- 	if (pci_set_mwi(pci_dev))
- 		ERROR_PROBE("MWI not available.\n");
- 
--	if (pci_set_dma_mask(pci_dev, DMA_64BIT_MASK) &&
--	    pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
-+	if (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
- 		ERROR_PROBE("PCI DMA not supported.\n");
- 		retval = -EIO;
- 		goto exit_disable_device;
-diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00usb.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00usb.c
---- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00usb.c.orig	2008-06-13 17:37:05.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt2x00usb.c	2008-06-13 17:37:35.000000000 -0400
-@@ -362,6 +362,12 @@ void rt2x00usb_disable_radio(struct rt2x
- 		}
+ #ifdef CONFIG_MAC80211_IBSS_DEBUG
+-	printk(KERN_DEBUG "   sta_find_ibss: selected %s current "
+-	       "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid));
++	if (found)
++		printk(KERN_DEBUG "   sta_find_ibss: selected %s current "
++		       "%s\n", print_mac(mac, bssid),
++		       print_mac(mac2, ifsta->bssid));
+ #endif /* CONFIG_MAC80211_IBSS_DEBUG */
+ 	if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
+ 	    (bss = ieee80211_rx_bss_get(dev, bssid,
+diff -up linux-2.6.25.noarch/net/mac80211/rc80211_pid_algo.c.orig linux-2.6.25.noarch/net/mac80211/rc80211_pid_algo.c
+--- linux-2.6.25.noarch/net/mac80211/rc80211_pid_algo.c.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/net/mac80211/rc80211_pid_algo.c	2008-07-10 10:53:45.000000000 -0400
+@@ -398,13 +398,25 @@ static void *rate_control_pid_alloc(stru
+ 		return NULL;
  	}
  
-+	/*
-+	 * Kill guardian urb (if required by driver).
-+	 */
-+	if (!test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))
-+		return;
-+
- 	for (i = 0; i < rt2x00dev->bcn->limit; i++) {
- 		priv_bcn = rt2x00dev->bcn->entries[i].priv_data;
- 		usb_kill_urb(priv_bcn->urb);
-diff -up linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c.orig linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c
---- linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c.orig	2008-06-13 17:37:05.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/net/wireless/rt2x00/rt73usb.c	2008-06-13 17:37:35.000000000 -0400
-@@ -2131,6 +2131,7 @@ static struct usb_device_id rt73usb_devi
- 	/* D-Link */
- 	{ USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) },
- 	{ USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) },
-+	{ USB_DEVICE(0x07d1, 0x3c06), USB_DEVICE_DATA(&rt73usb_ops) },
- 	{ USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) },
- 	/* Gemtek */
- 	{ USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
-diff -up linux-2.6.25.noarch/drivers/ssb/main.c.orig linux-2.6.25.noarch/drivers/ssb/main.c
---- linux-2.6.25.noarch/drivers/ssb/main.c.orig	2008-06-13 17:33:42.000000000 -0400
-+++ linux-2.6.25.noarch/drivers/ssb/main.c	2008-06-13 17:37:35.000000000 -0400
-@@ -1168,15 +1168,21 @@ EXPORT_SYMBOL(ssb_dma_translation);
- int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask)
- {
- 	struct device *dma_dev = ssb_dev->dma_dev;
-+	int err = 0;
++	pinfo->target = RC_PID_TARGET_PF;
++	pinfo->sampling_period = RC_PID_INTERVAL;
++	pinfo->coeff_p = RC_PID_COEFF_P;
++	pinfo->coeff_i = RC_PID_COEFF_I;
++	pinfo->coeff_d = RC_PID_COEFF_D;
++	pinfo->smoothing_shift = RC_PID_SMOOTHING_SHIFT;
++	pinfo->sharpen_factor = RC_PID_SHARPENING_FACTOR;
++	pinfo->sharpen_duration = RC_PID_SHARPENING_DURATION;
++	pinfo->norm_offset = RC_PID_NORM_OFFSET;
++	pinfo->rinfo = rinfo;
++	pinfo->oldrate = 0;
++
+ 	/* Sort the rates. This is optimized for the most common case (i.e.
+ 	 * almost-sorted CCK+OFDM rates). Kind of bubble-sort with reversed
+ 	 * mapping too. */
+ 	for (i = 0; i < sband->n_bitrates; i++) {
+ 		rinfo[i].index = i;
+ 		rinfo[i].rev_index = i;
+-		if (pinfo->fast_start)
++		if (RC_PID_FAST_START)
+ 			rinfo[i].diff = 0;
+ 		else
+ 			rinfo[i].diff = i * pinfo->norm_offset;
+@@ -425,19 +437,6 @@ static void *rate_control_pid_alloc(stru
+ 			break;
+ 	}
  
- #ifdef CONFIG_SSB_PCIHOST
--	if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI)
--		return dma_set_mask(dma_dev, mask);
-+	if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) {
-+		err = pci_set_dma_mask(ssb_dev->bus->host_pci, mask);
-+		if (err)
-+			return err;
-+		err = pci_set_consistent_dma_mask(ssb_dev->bus->host_pci, mask);
-+		return err;
-+	}
+-	pinfo->target = RC_PID_TARGET_PF;
+-	pinfo->sampling_period = RC_PID_INTERVAL;
+-	pinfo->coeff_p = RC_PID_COEFF_P;
+-	pinfo->coeff_i = RC_PID_COEFF_I;
+-	pinfo->coeff_d = RC_PID_COEFF_D;
+-	pinfo->smoothing_shift = RC_PID_SMOOTHING_SHIFT;
+-	pinfo->sharpen_factor = RC_PID_SHARPENING_FACTOR;
+-	pinfo->sharpen_duration = RC_PID_SHARPENING_DURATION;
+-	pinfo->norm_offset = RC_PID_NORM_OFFSET;
+-	pinfo->fast_start = RC_PID_FAST_START;
+-	pinfo->rinfo = rinfo;
+-	pinfo->oldrate = 0;
+-
+ #ifdef CONFIG_MAC80211_DEBUGFS
+ 	de = &pinfo->dentries;
+ 	de->dir = debugfs_create_dir("rc80211_pid",
+@@ -465,9 +464,6 @@ static void *rate_control_pid_alloc(stru
+ 	de->norm_offset = debugfs_create_u32("norm_offset",
+ 					     S_IRUSR | S_IWUSR, de->dir,
+ 					     &pinfo->norm_offset);
+-	de->fast_start = debugfs_create_bool("fast_start",
+-					     S_IRUSR | S_IWUSR, de->dir,
+-					     &pinfo->fast_start);
  #endif
- 	dma_dev->coherent_dma_mask = mask;
- 	dma_dev->dma_mask = &dma_dev->coherent_dma_mask;
  
--	return 0;
-+	return err;
- }
- EXPORT_SYMBOL(ssb_dma_set_mask);
+ 	return pinfo;
+@@ -479,7 +475,6 @@ static void rate_control_pid_free(void *
+ #ifdef CONFIG_MAC80211_DEBUGFS
+ 	struct rc_pid_debugfs_entries *de = &pinfo->dentries;
+ 
+-	debugfs_remove(de->fast_start);
+ 	debugfs_remove(de->norm_offset);
+ 	debugfs_remove(de->sharpen_duration);
+ 	debugfs_remove(de->sharpen_factor);
+diff -up linux-2.6.25.noarch/net/mac80211/rc80211_pid.h.orig linux-2.6.25.noarch/net/mac80211/rc80211_pid.h
+--- linux-2.6.25.noarch/net/mac80211/rc80211_pid.h.orig	2008-07-10 10:52:54.000000000 -0400
++++ linux-2.6.25.noarch/net/mac80211/rc80211_pid.h	2008-07-10 10:53:45.000000000 -0400
+@@ -141,7 +141,6 @@ struct rc_pid_events_file_info {
+  *	rate behaviour values (lower means we should trust more what we learnt
+  *	about behaviour of rates, higher means we should trust more the natural
+  *	ordering of rates)
+- * @fast_start: if Y, push high rates right after initialization
+  */
+ struct rc_pid_debugfs_entries {
+ 	struct dentry *dir;
+@@ -154,7 +153,6 @@ struct rc_pid_debugfs_entries {
+ 	struct dentry *sharpen_factor;
+ 	struct dentry *sharpen_duration;
+ 	struct dentry *norm_offset;
+-	struct dentry *fast_start;
+ };
+ 
+ void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf,
+@@ -267,9 +265,6 @@ struct rc_pid_info {
+ 	/* Normalization offset. */
+ 	unsigned int norm_offset;
+ 
+-	/* Fast starst parameter. */
+-	unsigned int fast_start;
+-
+ 	/* Rates information. */
+ 	struct rc_pid_rateinfo *rinfo;
  
-diff -up linux-2.6.25.noarch/net/mac80211/wext.c.orig linux-2.6.25.noarch/net/mac80211/wext.c
---- linux-2.6.25.noarch/net/mac80211/wext.c.orig	2008-06-13 17:37:05.000000000 -0400
-+++ linux-2.6.25.noarch/net/mac80211/wext.c	2008-06-13 17:37:35.000000000 -0400
-@@ -496,7 +496,8 @@ static int ieee80211_ioctl_giwap(struct 
- 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- 	if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
- 	    sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
--		if (sdata->u.sta.state == IEEE80211_ASSOCIATED) {
-+		if (sdata->u.sta.state == IEEE80211_ASSOCIATED ||
-+		    sdata->u.sta.state == IEEE80211_IBSS_JOINED) {
- 			ap_addr->sa_family = ARPHRD_ETHER;
- 			memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
- 			return 0;
-diff -up linux-2.6.25.noarch/net/mac80211/wme.c.orig linux-2.6.25.noarch/net/mac80211/wme.c
---- linux-2.6.25.noarch/net/mac80211/wme.c.orig	2008-06-13 17:37:05.000000000 -0400
-+++ linux-2.6.25.noarch/net/mac80211/wme.c	2008-06-13 17:37:35.000000000 -0400
-@@ -673,7 +673,7 @@ int ieee80211_ht_agg_queue_add(struct ie
- #ifdef CONFIG_MAC80211_HT_DEBUG
- 			if (net_ratelimit())
- 				printk(KERN_DEBUG "allocated aggregation queue"
--					" %d tid %d addr %s pool=0x%lX",
-+					" %d tid %d addr %s pool=0x%lX\n",
- 					i, tid, print_mac(mac, sta->addr),
- 					q->qdisc_pool[0]);
- #endif /* CONFIG_MAC80211_HT_DEBUG */


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/sources,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- sources	16 Jun 2008 10:19:27 -0000	1.18
+++ sources	18 Jul 2008 14:57:43 -0000	1.19
@@ -1,4 +1,3 @@
-db95a49a656a3247d4995a797d333153  linux-2.6.25.tar.bz2
-ec4864dc8a70490d883c6dd85e2bc076  patch-2.6.26-rc6.bz2
-6bdd7a956260030aee287b2822fdf6bc  patch-2.6.26-rc6-git2.bz2
+5169d01c405bc3f866c59338e217968c  linux-2.6.26.tar.bz2
+571f35f1e9c7d351c7da2bc39611e6e0  patch-2.6.26-git6.bz2
 4aa57328d0802a063fa67dfc063da30e  xen-3.2.0.tar.gz


Index: upstream
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/upstream,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- upstream	16 Jun 2008 10:19:27 -0000	1.8
+++ upstream	18 Jul 2008 14:57:43 -0000	1.9
@@ -1,4 +1,2 @@
-linux-2.6.25.tar.bz2
-patch-2.6.26-rc6.bz2
-patch-2.6.26-rc6-git2.bz2
-
+linux-2.6.26.tar.bz2
+patch-2.6.26-git6.bz2


--- config-sparc DELETED ---


--- config-sparc-generic DELETED ---


--- config-sparc-smp DELETED ---


--- config-sparc64 DELETED ---


--- linux-2.6-alsa-kill-annoying-messages.patch DELETED ---


--- linux-2.6-hda-intel-fix-dma-position-inaccuracy.patch DELETED ---


--- linux-2.6-powerpc-zImage-32MiB.patch DELETED ---


--- linux-2.6-ppc-use-libgcc.patch DELETED ---


--- linux-2.6-selinux-deffered-context-mapping-no-sleep.patch DELETED ---


--- linux-2.6-selinux-deffered-context-mapping.patch DELETED ---


--- linux-2.6-selinux-generic-ioctl.patch DELETED ---


--- linux-2.6-selinux-get-invalid-xattrs.patch DELETED ---


--- linux-2.6-selinux-new-proc-checks.patch DELETED ---


--- linux-2.6-silence-x86-decompressor.patch DELETED ---


--- linux-2.6-uvcvideo.patch DELETED ---


--- linux-2.6-xen-0001-squashfs-Fix-build-without-CONFIG_SMP.patch DELETED ---


--- linux-2.6-xen-0002-xen-execshield-Add-xen-specific-load_user_cs_desc.patch DELETED ---


--- linux-2.6-xen-0003-xen-execshield-fix-endless-GPF-fault-loop.patch DELETED ---


--- linux-2.6-xen-0004-xen-Enable-Xen-console-by-default-in-domU.patch DELETED ---


--- linux-2.6-xen-0005-xen-Add-a-vmlinuz-target.patch DELETED ---


--- linux-2.6-xen-0006-xen-Add-empty-xenctrl-module.patch DELETED ---


--- linux-2.6-xen-0007-xen-Add-proc-xen-capabilities.patch DELETED ---


--- linux-2.6-xen-0008-xen-Add-proc-xen-privcmd.patch DELETED ---


--- linux-2.6-xen-0009-xen-Add-proc-xen-xenbus.patch DELETED ---


--- linux-2.6-xen-0010-xen-Add-Xen-s-sys-hypervisor-interface.patch DELETED ---


--- linux-2.6-xen-0011-xen-x86_64-Add-64-bit-version-of-privcmd_hypercall.patch DELETED ---


--- linux-2.6-xen-0012-xen-x86_64-Only-define-load_user_cs_desc-on-32-bi.patch DELETED ---


--- linux-2.6-xen-0013-xen-expose-set_pte_vaddr-and-make-xen-use-it.patch DELETED ---


--- linux-2.6-xen-0014-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch DELETED ---


--- linux-2.6-xen-0015-x86_64-Expose-set_pte_vaddr.patch DELETED ---


--- linux-2.6-xen-0016-x86_64-Split-set_pte_vaddr.patch DELETED ---


--- linux-2.6-xen-0017-x86_64-Add-clear_fixmap.patch DELETED ---


--- linux-2.6-xen-0018-xen-x86_64-Make-set_fixmap-a-paravirt-op-on-64-bi.patch DELETED ---


--- linux-2.6-xen-0019-xen-x86_64-Hack-to-set-vsyscall-pages-on-user-space.patch DELETED ---


--- linux-2.6-xen-0020-Handle-VSYSCALL_FIRST_PAGE-on-xen_set_pte.patch DELETED ---


--- linux-2.6-xen-0021-xen-x86_64-Remove-the-640K-1M-hole-and-disable-DMI.patch DELETED ---


--- linux-2.6-xen-0022-xen-x86_64-Add-update_va_mapping-64-bit-code.patch DELETED ---


--- linux-2.6-xen-0023-x86_64-Add-sync_cmpxchg.patch DELETED ---


--- linux-2.6-xen-0024-xen-x86_64-Implement-HYPERVISOR-MULTI-_update_desc.patch DELETED ---


--- linux-2.6-xen-0025-xen-x86_64-Add-hacky-64-bit-x86_-read-write-_percpu.patch DELETED ---


--- linux-2.6-xen-0026-xen-x86_64-Use-x86_read_percpu-only-to-refer-to-a.patch DELETED ---


--- linux-2.6-xen-0027-Add-FIX_PARAVIRT_BOOTAP-to-fixmap_64.h-too.patch DELETED ---


--- linux-2.6-xen-0028-Add-gate_offset-and-gate_segment-macros.patch DELETED ---


--- linux-2.6-xen-0029-xen_write_idt_entry-and-cvt_gate_to_trap.patch DELETED ---


--- linux-2.6-xen-0030-typedefs-for-pte_val-and-friends.patch DELETED ---


--- linux-2.6-xen-0031-x86_64-implementation-of-some-page.h-macros.patch DELETED ---


--- linux-2.6-xen-0032-Chainsaw-style-ifdefs.patch DELETED ---


--- linux-2.6-xen-0033-xen-Make-xen_pte_val-generic.patch DELETED ---


--- linux-2.6-xen-0034-More-chainsaw-ifdefs.patch DELETED ---


--- linux-2.6-xen-0035-Chainsaw-ifdefs-on-assembly-percpu-handling.patch DELETED ---


--- linux-2.6-xen-0036-x86_64-percpu-assembly-macros.patch DELETED ---


--- linux-2.6-xen-0037-Some-xen-asm.S-x86_64-code.patch DELETED ---


--- linux-2.6-xen-0038-Chainsaw-party-SPLITME.patch DELETED ---


--- linux-2.6-xen-0039-xen-asm.S-x86_64-notes.patch DELETED ---


--- linux-2.6-xen-0040-xen-x86_64-Make-hypercall-assembly-code-work.patch DELETED ---


--- linux-2.6-xen-0041-xen-x86_64-pda-initialization.patch DELETED ---


--- linux-2.6-xen-0042-Disable-early_printk-by-default.patch DELETED ---


--- linux-2.6-xen-0043-xen-Set-__HYPERVISOR_VIRT_START-for-x86_64.patch DELETED ---


--- linux-2.6-xen-0044-Set-__PAGE_OFFSET-as-required-by-Xen.patch DELETED ---


--- linux-2.6-xen-0045-DEBUG-Add-xprintk-to-log-directly-via-hypercall-fo.patch DELETED ---


--- linux-2.6-xen-0046-DEBUG-Add-xprintk-debugging-printk-prototype-to-hvc.patch DELETED ---


--- linux-2.6-xen-0047-Use-__pgd-on-mk_kernel_pgd.patch DELETED ---


--- linux-2.6-xen-0048-Include-user-page-tables-on-head_64.S.patch DELETED ---


--- linux-2.6-xen-0049-Avoid-using-mk_unsigned_long.patch DELETED ---


--- linux-2.6-xen-0050-Lots-of-unrelated-changes.patch DELETED ---


--- linux-2.6-xen-0051-Hack-disable-vsmp.patch DELETED ---


--- linux-2.6-xen-0052-Export-early_make_page_readonly.patch DELETED ---


--- linux-2.6-xen-0053-Disable-multicalls.c-too-verbose-debugging.patch DELETED ---


--- linux-2.6-xen-0054-Xen-64-bit-ready-MMU-operations.patch DELETED ---


--- linux-2.6-xen-0055-Some-xen-mmu-pv-ops-implemented.patch DELETED ---


--- linux-2.6-xen-0056-Trying-to-make-the-pagetable-initialization-code-wor.patch DELETED ---


--- linux-2.6-xen-0057-Xen-specific-find_early_table_space-FIXME.patch DELETED ---


--- linux-2.6-xen-0058-Xen-call-e820_print_map-when-setting-up-memory.patch DELETED ---


--- linux-2.6-xen-0059-Comment-debugging-msgs.patch DELETED ---


--- linux-2.6-xen-0060-Try-to-make-pagetables-read-only.patch DELETED ---


--- linux-2.6-xen-0061-Debug-dump-pgtables-on-make_page_readonly.patch DELETED ---


--- linux-2.6-xen-0062-Disable-apic-at-compile-time-FIXME.patch DELETED ---


--- linux-2.6-xen-0063-Parse-early-params-after-init_memory_mapping.patch DELETED ---


--- linux-2.6-xen-0064-xen-Move-addr_to_page-to-init.h.patch DELETED ---


--- linux-2.6-xen-0065-Make-xen_pxx_val-and-xen_make_pxx-handle-attr-bi.patch DELETED ---


--- linux-2.6-xen-0066-Pull-xen_finish_init_mappin-from-XS-upstream.patch DELETED ---


--- linux-2.6-xen-0067-Pull-spp_getpage-changes-from-XS-upstream-REVIEWM.patch DELETED ---


--- linux-2.6-xen-0068-Pull-xen_extend_init_mapping-from-XS-upstream-FIX.patch DELETED ---


--- linux-2.6-xen-0069-New-enum-fixed_addresses-values-REVIEWME.patch DELETED ---


--- linux-2.6-xen-0070-Reserve-bootmem-areas-used-by-Xen-FIXME.patch DELETED ---


--- linux-2.6-xen-0071-xen_convert_trap_info-use-sizeof-struct-gate_desc.patch DELETED ---


--- linux-2.6-xen-0072-Call-paravirt_pagetable_setup_-start-done-REVIEW.patch DELETED ---


--- linux-2.6-xen-0073-ifdef-CONFIG_X86_32-on-xen-enlighten.c-REVIEWME.patch DELETED ---


--- linux-2.6-xen-0074-Handle-Xen-exception-stack-it-is-different-from-bar.patch DELETED ---


--- linux-2.6-xen-0075-Implement-64-bit-version-of-HYPERVISOR_set_callbacks.patch DELETED ---


--- linux-2.6-xen-0076-Make-arch_vcpu_info-be-of-the-right-size-on-both-32.patch DELETED ---


--- linux-2.6-xen-0077-Implement-asm-xen_iret.patch DELETED ---


--- linux-2.6-xen-0078-xen-64-xen_iret-use-iretq-directly-if-returning-t.patch DELETED ---


--- linux-2.6-xen-0079-Implement-xen_irqenable_syscall_ret.patch DELETED ---


--- linux-2.6-xen-0080-DEBUG-xen_iret-always-return-through-the-hyperviso.patch DELETED ---


--- linux-2.6-xen-0081-Implement-some-xen-callbacks-on-xen-entry_64.S.patch DELETED ---


--- linux-2.6-xen-0082-Xen-specific-ifdef-hacks-on-kernel-entry_64.S-FIXM.patch DELETED ---


--- linux-2.6-xen-0083-Disable-syscall32-code-temporarily-FIXME.patch DELETED ---


--- linux-2.6-xen-0084-Use-__KERNEL_DS-as-SS-when-returning-to-a-kernel-thr.patch DELETED ---


--- linux-2.6-xen-0085-Use-apic_xen-on-genapic-by-default-FIXME.patch DELETED ---


--- linux-2.6-xen-0086-irq-vector-ifdef-chainsaw-FIXME.patch DELETED ---


--- linux-2.6-xen-0087-ifdef-chainsaw-on-syscall_init-FIXME.patch DELETED ---


--- linux-2.6-xen-0088-Pull-xen-genapic-implementation-from-upstream-Xen.patch DELETED ---


--- linux-2.6-xen-0089-Debugging-printk-s.patch DELETED ---


--- linux-2.6-xen-0090-Leave-lazy_cpu_mode-on-__switch_to.patch DELETED ---


--- linux-2.6-xen-0091-xen-64-Handle-fs-and-gs-on-xen_load_tls-properl.patch DELETED ---


--- linux-2.6-xen-0092-Disable-vcpu_info_placement-temporarily-FIXME.patch DELETED ---


--- linux-2.6-xen-0093-Fix-typo-on-ifdef-again.patch DELETED ---


--- linux-2.6-xen-0094-DEBUG-Don-t-try-to-actually-read-the-page-on-show_.patch DELETED ---


--- linux-2.6-xen-0095-Make-load_gs_index-a-paravirt-operation.patch DELETED ---


--- linux-2.6-xen-0096-xen-pgd_walk-use-limit-argument-instead-of-FIXADD.patch DELETED ---


--- linux-2.6-xen-0097-xen-pgd_walk-Eliminate-BUG_ON-limit-FIXADDR_TOP.patch DELETED ---


--- linux-2.6-xen-0098-xen-pgd_walk-accept-start-parameter.patch DELETED ---


--- linux-2.6-xen-0099-xen-64-reserve_bootmem-xen_start_info-area.patch DELETED ---


--- linux-2.6-xen-0100-pvops-64-call-paravirt_post_allocator_init-on-set.patch DELETED ---


--- linux-2.6-xen-0101-use-write_gdt_entry-on-vsyscall_set_cpu-CLEANME.patch DELETED ---


--- linux-2.6-xen-0102-xen-64-implement-xen_load_gs_index.patch DELETED ---


--- linux-2.6-xen-0103-Make-xen_pgd_unpin-non-static-REVIEWME.patch DELETED ---


--- linux-2.6-xen-0104-Xen-64-pgd-allocation-hack-FIXME.patch DELETED ---


--- linux-2.6-xen-0105-Set-both-kernel-and-user-PGDs-on-pgd_populate-FI.patch DELETED ---


--- linux-2.6-xen-0106-Multi-pagetable-write_cr3-implementation-FIXME.patch DELETED ---


--- linux-2.6-xen-0107-Disable-the-weird-count-loop-on-kcons_write_dom0.patch DELETED ---


--- linux-2.6-xen-0108-Make-xen_start_info-read-only.patch DELETED ---


--- linux-2.6-xen-0109-Hack-to-implement-return-to-userspace-without-SWAPGS.patch DELETED ---


--- linux-2.6-xen-0110-Xen-SEGBASE_-defines.patch DELETED ---


--- linux-2.6-xen-0111-Xen-HYPERVISOR_set_segment_base-implementation.patch DELETED ---


--- linux-2.6-xen-0112-Change-signature-of-paravirt_alloc_-pt-pd-REVIEWME.patch DELETED ---


--- linux-2.6-xen-0113-Comment-e820_print_map-call-TEMPORARY.patch DELETED ---


--- linux-2.6-xen-0114-Xen-missing-includes.patch DELETED ---


--- linux-2.6-xen-0115-asm-x86-pgtable_64.h-include-linux-spinlock.h.patch DELETED ---


--- linux-2.6-xen-0116-asm-x86-pgtable.h-include-asm-page.h.patch DELETED ---


--- linux-2.6-xen-0117-fix-pxxval_t-usage-on-mm-init_64.c.patch DELETED ---


--- linux-2.6-xen-0118-Missing-Xen-include.patch DELETED ---


--- linux-2.6-xen-0119-un-static-ipi_to_irq.patch DELETED ---


--- linux-2.6-xen-0120-Don-t-use-_PAGE_GLOBAL-bit-under-Xen-FIXME.patch DELETED ---


--- linux-2.6-xen-0121-Trying-to-organize-the-xen-bootmem-allocation-mess.patch DELETED ---


--- linux-2.6-xen-0122-Xen-reserve_bootmem-xenstore-and-console-interfac.patch DELETED ---


--- linux-2.6-xen-0123-pvops-64-call-paravirt_activate_mm-on-activate_mm.patch DELETED ---


--- linux-2.6-xen-0124-Xen-64-bit-support-on-xen_pgd_pin.patch DELETED ---


--- linux-2.6-xen-0125-Xen-64-pin-user-PGD-on-activate_mm-and-dup_mmap.patch DELETED ---


--- linux-2.6-xen-0126-Hack-pgd_walk-to-walk-to-TASK_SIZE-PAGE_SIZE-on-x8.patch DELETED ---


--- linux-2.6-xen-0127-Xen-64-Unpin-user-pagetable-on-xen_pgd_unpin.patch DELETED ---


--- linux-2.6-xen-0128-Use-un-pin_page-when-un-pinning-pgd.patch DELETED ---


--- linux-2.6-xen-0129-Allow-enabling-Xen-on-x86_64.patch DELETED ---


--- linux-2.6-xen-0130-Add-include-linux-spinlock_types.h-to-asm-x86-pgt.patch DELETED ---


--- linux-2.6-xen-0131-Restore-some-sanity-on-the-initial-pagetable-bootmem.patch DELETED ---


--- linux-2.6-xen-0132-Xen-Use-system_call_after_swapgs-as-the-syscall-c.patch DELETED ---


--- linux-2.6-xen-0133-Add-a-system_call_after_saveargs-label-to-entry_64.S.patch DELETED ---


--- linux-2.6-xen-0134-Create-xen-specific-syscall-entry.patch DELETED ---


--- linux-2.6-xen-0135-syscall-related-Xen-ifdefs-FIXME.patch DELETED ---


--- linux-2.6-xen-0136-Point-set_pte-to-xen_set_pte-since-the-beginning.patch DELETED ---


--- linux-2.6-xen-0137-DEBUG-slab-debugging.patch DELETED ---


--- linux-2.6-xen-0138-pvops-64-Include-rsi-on-the-register-clobber-list.patch DELETED ---


--- linux-2.6-xen-0139-Xen-64-quick-ugly-hack-to-fix-pgd_clear-pagetabl.patch DELETED ---


--- linux-2.6-xen-0140-Add-missing-acpi-include-to-xen-setup.c.patch DELETED ---


--- linux-2.6-xen-0141-Don-t-use-FIX_VDSO-on-64-bit.patch DELETED ---


--- linux-2.6-xen-0142-Mark-init-pages-read-write-again-on-free_init_pages.patch DELETED ---


--- linux-2.6-xen-0143-reserve_early-kernel-text-and-data-segments.patch DELETED ---


--- linux-2.6-xen-0144-Xen-Clear-__START_KERNEL_map-PTEs-on-free_init_page.patch DELETED ---


--- linux-2.6-xen-0145-Set-pvops-machine_ops-for-Xen-on-x86_64-also-MERGE.patch DELETED ---


--- linux-2.6-xen-0146-Pull-xen_failsafe_callback-implementation-from-XenSo.patch DELETED ---


--- linux-2.6-xen-0147-Save-fs-and-gs-before-load_TLS-and-arch_leave_la.patch DELETED ---


--- linux-2.6-xen-0148-xen-64-Clear-fs-on-xen_load_tls.patch DELETED ---


--- linux-2.6-xen-0149-ia32entry.S-Replace-cli-sti-cases-with-DISABLE_INTE.patch DELETED ---


--- linux-2.6-xen-0150-Introduce-xen_ia32_syscall.patch DELETED ---


--- linux-2.6-xen-0151-Use-xen_ia32_syscall-if-CONFIG_XEN-is-enabled-FIX.patch DELETED ---


--- linux-2.6-xen-0152-Make-the-int80-and-syscall-vdso32-implementations-se.patch DELETED ---


--- linux-2.6-xen-0153-Use-vdso32-int80-by-default-if-Xen-is-enabled-FIXME.patch DELETED ---


--- linux-2.6-xen-0154-xen_pgd_pin-use-TASK_SIZE64-on-x86_64.patch DELETED ---


--- linux-2.6-xen-0155-paravirt-ops-64-Save-rdi-also-on-asm-version-of-PV.patch DELETED ---


--- linux-2.6-xen-0156-X86_VSMP-make-not-depend-on-XEN-REVIEWME.patch DELETED ---


--- linux-2.6-xen-0157-Add-do_IRQ-prototype-to-asm-x86-irq_64.h.patch DELETED ---


--- linux-2.6-xen-0158-Disable-sysenter-on-x86_64-temporarily-REVIEWME.patch DELETED ---


--- linux-2.6-xen-0159-Add-xen_-alloc-release-_pud-functions-for-x86_64-x.patch DELETED ---


--- linux-2.6-xen-0160-Extract-reserve_initrd-from-x86_64_start_kernel.patch DELETED ---


--- linux-2.6-xen-0161-Make-reserve_initrd-non-static.patch DELETED ---


--- linux-2.6-xen-0162-xen-64-Reserve-initrd-on-xen_start_kernel-also.patch DELETED ---


--- linux-2.6.25.tar.bz2.sign DELETED ---


--- patch-2.6.26-rc6-git2.bz2.sign DELETED ---


--- patch-2.6.26-rc6.bz2.sign DELETED ---




More information about the fedora-extras-commits mailing list