rpms/kernel-xen-2.6/devel .gitignore, NONE, 1.1.2.1 gen-patches, NONE, 1.1.2.1 linux-2.6-0001-xen-debug-Add-xprintk-to-log-directly-via-hypercall.patch, NONE, 1.1.2.1 linux-2.6-0002-xen-dom0-Make-hvc_xen-console-work-for-dom0.patch, NONE, 1.1.2.1 linux-2.6-0003-xen-dom0-Initialize-xenbus-for-dom0.patch, NONE, 1.1.2.1 linux-2.6-0004-xen-dom0-Set-up-basic-IO-permissions-for-dom0.patch, NONE, 1.1.2.1 linux-2.6-0005-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch, NONE, 1.1.2.1 linux-2.6-0006-xen-dom0-Add-support-for-the-platform_ops-hypercall.patch, NONE, 1.1.2.1 linux-2.6-0007-xen-acpi-Enable-early-access-to-ACPI-tables.patch, NONE, 1.1.2.1 linux-2.6-0008-xen-dom0-Add-paravirt_ops-ioremap_page_range-for.patch, NONE, 1.1.2.1 linux-2.6-0009-MTRR-use-cpu_callout_map-instead-of-cpu_online_map.patch, NONE, 1.1.2.1 linux-2.6-0010-xen-mtrr-Add-mtrr_ops-support-for-Xen-mtrr.patch, NONE, 1.1.2.1 linux-2.6-0011-xen-mtrr-Don-t-enable-xen-mtrr-on-bare-metal.patch, NONE, 1.1.2.1 linux-2.6-0012-xen-mtrr-set-cpu-in-cpu_callout_map.patch, NONE, 1.1.2.1 linux-2.6-0013-xen-mtrr-Clean-up-the-num_var_ranges-CPU_UNKOWN-hac.patch, NONE, 1.1.2.1 linux-2.6-0014-xen-mtrr-Use-specific-cpu_has_foo-macros-instead-of.patch, NONE, 1.1.2.1 linux-2.6-0015-xen-mtrr-Kill-some-unneccessary-includes.patch, NONE, 1.1.2.1 linux-2.6-0016-xen-mtrr-No-need-to-explicitly-set-use_intel_if-0.patch, NONE, 1.1.2.1 linux-2.6-0017-xen-mtrr-Use-generic_validate_add_page.patch, NONE, 1.1.2.1 linux-2.6-0018-xen-mtrr-Implement-xen_get_free_region.patch, NONE, 1.1.2.1 linux-2.6-0019-xen-mtrr-Add-xen_-get-set-_mtrr-implementations.patch, NONE, 1.1.2.1 linux-2.6-0020-irq2.diff-from-Juan-Quintela.patch, NONE, 1.1.2.1 linux-2.6-0021-xen-dom0-Obvious-cpuid-fix-to-domU-handling.patch, NONE, 1.1.2.1 linux-2.6-0022-xen-debug-Diagnose-bind_virq_to_irq-errors.patch, NONE, 1.1.2.1 linux-2.6-0023-xen-traps-Revert-Juan-s-traps_32.c-changes-to-debug.patch, NONE, 1.1.2.1 linux-2.6-0024-xen-debug-Move-init_apic_mappings-after-trap-init.patch, NONE, 1.1.2.1 linux-2.6-0025-xen-debug-Trace-progress-in-trap_init-around-init.patch, NONE, 1.1.2.1 linux-2.6-0026-xen-apic-Disable-init_apic_mappings-when-under-CO.patch, NONE, 1.1.2.1 linux-2.6-0027-xen-debug-Log-entry-into-virtual-console-s-xen_init.patch, NONE, 1.1.2.1 linux-2.6-0028-xen-debug-Log-bind_virq_to_irq-events.patch, NONE, 1.1.2.1 linux-2.6-0029-xen-debug-Work-around-USB-issue-triggered-by-Xen-de.patch, NONE, 1.1.2.1 linux-2.6-0030-Remove-duplicated-dma_alloc-free_noncoherent-define.patch, NONE, 1.1.2.1 linux-2.6-0031-xem-dom0-Add-hypervisor-memory_exchange-descriptor.patch, NONE, 1.1.2.1 linux-2.6-0032-xen-dom0-add-virt_to_pfn-macro.patch, NONE, 1.1.2.1 linux-2.6-0033-xen-dom0-use-virt_to_pfn-where-appropriate.patch, NONE, 1.1.2.1 linux-2.6-0034-xen-dom0-Add-contiguous-region-support.patch, NONE, 1.1.2.1 linux-2.6-0035-xen-dom0-Don-t-mask-off-PCD-bits-from-pte-entries.patch, NONE, 1.1.2.1 linux-2.6-0036-xen-dom0-Remove-duplicate-xen_store_interface-assig.patch, NONE, 1.1.2.1 linux-2.6-0037-xen-dom0-Slightly-re-arrange-xenbus_probe_init-er.patch, NONE, 1.1.2.1 linux-2.6-0038-xen-dom0-Use-max_low_pfn-declaration-from-linux-boo.patch, NONE, 1.1.2.1 linux-2.6-0039-xen-dma-Add-dma_mapping_ops-indirection-for-32-bit.patch, NONE, 1.1.2.1 linux-2.6-0040-xen-dma-Remove-unused-32-bit-dma_ops-map_simple-me.patch, NONE, 1.1.2.1 linux-2.6-0041-xen-dma-Initial-commit-of-pci-xen.c-dma-mapping-fun.patch, NONE, 1.1.2.1 linux-2.6-0042-xen-dma-Add-calls-to-dma_ops-alloc-free_coherent-ho.patch, NONE, 1.1.2.1 linux-2.6-0043-xen-dma-Add-xen_alloc-free_coherent.patch, NONE, 1.1.2.1 linux-2.6-0044-xen-dma-Don-t-merge-bios-on-xen-pvops.patch, NONE, 1.1.2.1 linux-2.6-0045-xen-dom0-Minor-coding-style-issue-in-ISA-mapping-co.patch, NONE, 1.1.2.1 linux-2.6-0046-xen-dom0-Use-i-PAGE_SHIFT-instead-of-PAGE_DOWN-i.patch, NONE, 1.1.2.1 linux-2.6-0047-xen-dom0-Match-up-set_pte_mfn-prototype-with-the.patch, NONE, 1.1.2.1 linux-2.6-0048-xen-dom0-Reserve-ISA-address-space-earlier.patch, NONE, 1.1.2.1 linux-2.6-0049-xen-Add-empty-xenctrl-module.patch, NONE, 1.1.2.1 linux-2.6-0050-xen-dom0-Add-proc-xen-capabilities.patch, NONE, 1.1.2.1 linux-2.6-0051-xen-Add-proc-xen-privcmd.patch, NONE, 1.1.2.1 linux-2.6-0052-xen-dom0-Add-proc-xen-xsd_-port-kva.patch, NONE, 1.1.2.1 linux-2.6-0053-xen-Add-proc-xen-xenbus.patch, NONE, 1.1.2.1 linux-2.6-0054-xen-Add-dev-xen-evtchn.patch, NONE, 1.1.2.1 linux-2.6-0055-xen-Add-__init-__exit-notations-to-xenctrl-function.patch, NONE, 1.1.2.1 linux-2.6-0056-xen-Add-Xen-s-sys-hypervisor-interface.patch, NONE, 1.1.2.1 linux-2.6-0057-xen-dom0-Add-basic-proc-xen-balloon.patch, NONE, 1.1.2.1 linux-2.6-0058-xen-dom0-Re-work-privcmd_ioctl-a-little.patch, NONE, 1.1.2.1 linux-2.6-0059-xen-dom0-Add-IOCTL_PRIVCMD_MMAP.patch, NONE, 1.1.2.1 linux-2.6-acpi-eeepc-hotkey.patch, NONE, 1.1.2.1 linux-2.6-agp-mm.patch, NONE, 1.1.2.1 linux-2.6-alsa-rc4-mm1.patch, NONE, 1.1.2.1 linux-2.6-alsa-support-sis7019.patch, NONE, 1.1.2.1 linux-2.6-at76.patch, NONE, 1.1.2.1 linux-2.6-ath5k-use-soft-wep.patch, NONE, 1.1.2.1 linux-2.6-compile-fix-gcc-43.patch, NONE, 1.1.2.1 linux-2.6-compile-fixes.patch, NONE, 1.3.2.1 linux-2.6-dcdbas-autoload.patch, NONE, 1.1.2.1 linux-2.6-debug-acpi-os-write-port.patch, NONE, 1.1.2.1 linux-2.6-default-mmf_dump_elf_headers.patch, NONE, 1.1.2.1 linux-2.6-drm-add-i915-radeon-mdt.patch, NONE, 1.1.2.1 linux-2.6-drm-mm.patch, NONE, 1.1.2.1 linux-2.6-drm-radeon-update.patch, NONE, 1.1.2.1 linux-2.6-e1000-corrupt-eeprom-checksum.patch, NONE, 1.1.2.1 linux-2.6-epoll-lockdep-annotation.patch, NONE, 1.1.2.1 linux-2.6-ext4-linus-git.patch, NONE, 1.1.2.1 linux-2.6-ext4-stable-queue.patch, NONE, 1.1.2.1 linux-2.6-firewire-git-pending.patch, NONE, 1.1.2.1 linux-2.6-firewire-git-update.patch, NONE, 1.1.2.1 linux-2.6-gelic-fixups.patch, NONE, 1.1.2.1 linux-2.6-gelic-wireless-fix.patch, NONE, 1.1.2.1 linux-2.6-gelic-wireless-v2.patch, NONE, 1.1.2.1 linux-2.6-git-initial-r500-drm.patch, NONE, 1.1.2.1 linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch, NONE, 1.1.2.1 linux-2.6-lirc.patch, NONE, 1.1.2.1 linux-2.6-netdev-atl2.patch, NONE, 1.1.2.1 linux-2.6-netdev-bonding-fix-null-deref.patch, NONE, 1.1.2.1 linux-2.6-netdev-e1000-disable-alpm.patch, NONE, 1.1.2.1 linux-2.6-pasemi-for-2.6.25.patch, NONE, 1.1.2.1 linux-2.6-pasemi-reserve-i2c.patch, NONE, 1.1.2.1 linux-2.6-powerpc-bootwrapper.patch, NONE, 1.1.2.1 linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch, NONE, 1.1.2.1 linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch, NONE, 1.1.2.1 linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch, NONE, 1.1.2.1 linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch, NONE, 1.1.2.1 linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch, NONE, 1.1.2.1 linux-2.6-ppc-rtc.patch, NONE, 1.1.2.1 linux-2.6-ps3-legacy-bootloader-hack.patch, NONE, 1.1.2.1 linux-2.6-ps3-storage-alias.patch, NONE, 1.1.2.1 linux-2.6-rndis_wlan.patch, NONE, 1.1.2.1 linux-2.6-scsi-mpt-vmware-fix.patch, NONE, 1.1.2.1 linux-2.6-selinux-strip-leading-slashes.patch, NONE, 1.1.2.1 linux-2.6-smarter-relatime.patch, NONE, 1.1.2.1 linux-2.6-usb-ehci-hcd-respect-nousb.patch, NONE, 1.1.2.1 linux-2.6-utrace-ptrace-compat-avr32.patch, NONE, 1.1.2.1 linux-2.6-utrace-regset-avr32.patch, NONE, 1.1.2.1 linux-2.6-utrace-tracehook-avr32.patch, NONE, 1.1.2.1 linux-2.6-uvcvideo.patch, NONE, 1.1.2.1 linux-2.6-wireless-pending.patch, NONE, 1.1.2.1 linux-2.6-x86-debug-boot.patch, NONE, 1.1.2.1 linux-2.6-xfs-optimize-away-realtime-tests.patch, NONE, 1.1.2.1 linux-2.6-xfs-setfattr-32bit-compat.patch, NONE, 1.1.2.1 linux-2.6-xfs-xfs_mount-refactor.patch, NONE, 1.1.2.1 linux-2.6.24.tar.bz2.sign, NONE, 1.1.2.1 mirrors, NONE, 1.1.2.1 upstream, NONE, 1.1.2.1 upstream-key.gpg, NONE, 1.1.2.1 .cvsignore, 1.11, 1.11.2.1 Makefile, 1.2, 1.2.6.1 Makefile.config, 1.2, 1.2.4.1 config-debug, 1.2, 1.2.4.1 config-generic, 1.2, 1.2.4.1 config-ia64-generic, 1.2, 1.2.4.1 config-nodebug, 1.2, 1.2.4.1 config-powerpc-generic, 1.2, 1.2.4.1 config-powerpc32-generic, 1.2, 1.2.4.1 config-powerpc64, 1.2, 1.2.4.1 config-s390x, 1.2, 1.2.4.1 config-sparc-generic, 1.2, 1.2.4.1 config-sparc64-generic, 1.2, 1.2.4.1 config-x86-generic, 1.2, 1.2.4.1 config-x86_64-generic, 1.2, 1.2.4.1 config-xen-generic, 1.2, 1.2.4.1 config-xen-ia64, 1.2, 1.2.4.1 config-xen-x86, 1.2, 1.2.4.1 config-xen-x86_64, 1.2, 1.2.4.1 kernel.spec, 1.11, 1.11.2.1 linux-2.6-ata-quirk.patch, 1.2, 1.2.8.1 linux-2.6-build-nonintconfig.patch, 1.1, 1.1.22.1 linux-2.6-crash-driver.patch, 1.2, 1.2.8.1 linux-2.6-debug-nmi-timeout.patch, 1.2, 1.2.8.1 linux-2.6-debug-spinlock-taint.patch, 1.1, 1.1.22.1 linux-2.6-debug-taint-vm.patch, 1.3, 1.3.8.1 linux-2.6-defaults-fat-utf8.patch, 1.1, 1.1.22.1 linux-2.6-devmem.patch, 1.3, 1.3.8.1 linux-2.6-execshield.patch, 1.3, 1.3.8.1 linux-2.6-input-kill-stupid-messages.patch, 1.1, 1.1.22.1 linux-2.6-net-silence-noisy-printks.patch, 1.2, 1.2.8.1 linux-2.6-ppc32-ucmpdi2.patch, 1.1, 1.1.22.1 linux-2.6-ps3-ehci-iso.patch, 1.2, 1.2.8.1 linux-2.6-selinux-mprotect-checks.patch, 1.1, 1.1.22.1 linux-2.6-serial-460800.patch, 1.1, 1.1.22.1 linux-2.6-silence-noise.patch, 1.3, 1.3.8.1 linux-2.6-squashfs.patch, 1.3, 1.3.8.1 linux-2.6-unexport-symbols.patch, 1.1, 1.1.22.1 linux-2.6-utrace-core.patch, 1.2, 1.2.8.1 linux-2.6-utrace-ptrace-compat-ia64.patch, 1.2, 1.2.8.1 linux-2.6-utrace-ptrace-compat-s390.patch, 1.2, 1.2.8.1 linux-2.6-utrace-ptrace-compat-sparc64.patch, 1.2, 1.2.8.1 linux-2.6-utrace-ptrace-compat.patch, 1.2, 1.2.8.1 linux-2.6-utrace-regset-ia64.patch, 1.2, 1.2.8.1 linux-2.6-utrace-regset-s390.patch, 1.2, 1.2.8.1 linux-2.6-utrace-regset-sparc64.patch, 1.2, 1.2.8.1 linux-2.6-utrace-regset.patch, 1.2, 1.2.8.1 linux-2.6-utrace-tracehook-ia64.patch, 1.2, 1.2.8.1 linux-2.6-utrace-tracehook-s390.patch, 1.2, 1.2.8.1 linux-2.6-utrace-tracehook-sparc64.patch, 1.2, 1.2.8.1 linux-2.6-utrace-tracehook-um.patch, 1.2, 1.2.8.1 linux-2.6-utrace-tracehook.patch, 1.2, 1.2.8.1 linux-2.6-wireless.patch, 1.2, 1.2.8.1 linux-2.6-x86-tune-generic.patch, 1.1, 1.1.22.1 nouveau-drm.patch, 1.2, 1.2.8.1 sources, 1.11, 1.11.2.1 xen-build-id.patch, 1.2, 1.2.4.1 xen-compile-fix.patch, 1.3, 1.3.8.1 xen-syms-build-id.patch, 1.2, 1.2.4.1 config-olpc-generic, 1.1, NONE git-wireless-dev.patch, 1.2, NONE kernel-2.6.21.7-i686-xen.config, 1.3, NONE kernel-2.6.21.7-x86_64-xen.config, 1.3, NONE linux-2.6-2110_scsi-sd-printing.patch, 1.2, NONE linux-2.6-2111_sd-start-stop.patch, 1.2, NONE linux-2.6-2112_libata-suspend.patch, 1.2, NONE linux-2.6-2113_libata-spindown-compat.patch, 1.2, NONE linux-2.6-2114_libata-shutdown-warning.patch, 1.2, NONE linux-2.6-2115_libata-spindown-status.patch, 1.2, NONE linux-2.6-2116_libata-remove-spindown-compat.patch, 1.2, NONE linux-2.6-2117_sata-via-suspend.patch, 1.2, NONE linux-2.6-2118_scsi-constants.patch, 1.2, NONE linux-2.6-3w-9xxx-mem_len.patch, 1.1, NONE linux-2.6-PT_LOAD-align.patch, 1.1, NONE linux-2.6-acpi-boot-regression.patch, 1.2, NONE linux-2.6-acpi-config_pm-poweroff.patch, 1.1, NONE linux-2.6-acpi-dock-oops.patch, 1.2, NONE linux-2.6-acpi-keep-tsc-stable-when-lapic-timer-c2-ok-is-set.patch, 1.2, NONE linux-2.6-acpi-preserve-ebx-in-acpi_copy_wakeup_routine.patch, 1.2, NONE linux-2.6-acpi-unblacklist-dell-gx240.patch, 1.2, NONE linux-2.6-amd-disabled-svm-detect-msr-1.patch, 1.2, NONE linux-2.6-amd-disabled-svm-detect.patch, 1.2, NONE linux-2.6-ata-call-check-dma-with-qc-prepared.patch, 1.2, NONE linux-2.6-ata-use-pio-for-non-16-byte-xfers.patch, 1.2, NONE linux-2.6-bcm43xx-pci-neuter.patch, 1.2, NONE linux-2.6-cell-spu-device-tree.patch, 1.2, NONE linux-2.6-cell-spufs-fixes.patch, 1.2, NONE linux-2.6-clockevents-fix-resume-logic.patch, 1.2, NONE linux-2.6-common-uevent.patch, 1.2, NONE linux-2.6-crap-sysfs-workaround.patch, 1.2, NONE linux-2.6-crash-driver-xen.patch, 1.2, NONE linux-2.6-cve-2008-0600.patch, 1.1, NONE linux-2.6-debug-boot-delay.patch, 1.2, NONE linux-2.6-debug-extra-warnings.patch, 1.2, NONE linux-2.6-debug-must_check.patch, 1.1, NONE linux-2.6-debug-slab-backtrace.patch, 1.1, NONE linux-2.6-debug-sysfs-crash-debugging-xen.patch, 1.2, NONE linux-2.6-debug-sysfs-crash-debugging.patch, 1.2, NONE linux-2.6-defaults-nonmi.patch, 1.1, NONE linux-2.6-defaults-pci_no_msi_mmconf.patch, 1.2, NONE linux-2.6-defaults-unicode-vt.patch, 1.1, NONE linux-2.6-devmem-xen.patch, 1.2, NONE linux-2.6-disable-netback-checksum.patch, 1.3, NONE linux-2.6-dvb-spinlock.patch, 1.2, NONE linux-2.6-execshield-xen.patch, 1.2, NONE linux-2.6-firewire-be32-fix.patch, 1.2, NONE linux-2.6-firewire.patch, 1.2, NONE linux-2.6-fix-pmops-1.patch, 1.2, NONE linux-2.6-fix-pmops-2.patch, 1.2, NONE linux-2.6-fix-pmops-3.patch, 1.2, NONE linux-2.6-fix-pmops-4.patch, 1.2, NONE linux-2.6-gfs2-update.patch, 1.2, NONE linux-2.6-i82875-edac-pci-setup.patch, 1.2, NONE linux-2.6-i965gm-support.patch, 1.2, NONE linux-2.6-ibmvscsi-schizo.patch, 1.1, NONE linux-2.6-kvm-19.patch, 1.2, NONE linux-2.6-kvm-reinit-real-mode-tss.patch, 1.2, NONE linux-2.6-libata-atiixp-ids.patch, 1.2, NONE linux-2.6-libata-hpa.patch, 1.2, NONE linux-2.6-libata-ich8m-add-pciid.patch, 1.2, NONE linux-2.6-libata-ncq-blacklist-2.6.22-rc7.patch, 1.2, NONE linux-2.6-libata-pata-hpt3x2n-correct-revision-boundary.patch, 1.2, NONE linux-2.6-libata-pata-pcmcia-new-ident.patch, 1.2, NONE linux-2.6-libata-pata-sis-fix-timing.patch, 1.2, NONE linux-2.6-libata-pata_dma-param.patch, 1.2, NONE linux-2.6-libata-pata_it821x-partly-fix-dma.patch, 1.2, NONE linux-2.6-libata-sata_nv-adma.patch, 1.2, NONE linux-2.6-libata-sata_nv-wildcard-removal.patch, 1.2, NONE linux-2.6-libata-setxfer.patch, 1.2, NONE linux-2.6-libata_ali_max_dma_speed.patch, 1.2, NONE linux-2.6-libertas.diff, 1.2, NONE linux-2.6-mm-udf-fixes.patch, 1.2, NONE linux-2.6-modsign-core.patch, 1.3, NONE linux-2.6-modsign-crypto.patch, 1.3, NONE linux-2.6-modsign-include.patch, 1.3, NONE linux-2.6-modsign-ksign.patch, 1.3, NONE linux-2.6-modsign-mpilib.patch, 1.3, NONE linux-2.6-modsign-script.patch, 1.3, NONE linux-2.6-modsign-verify.patch, 1.1, NONE linux-2.6-module_version.patch, 1.2, NONE linux-2.6-mpc52xx-fec.patch, 1.2, NONE linux-2.6-mpc52xx-sdma.patch, 1.2, NONE linux-2.6-net-e1000-no-msi-warning.patch, 1.2, NONE linux-2.6-netdev-e1000e-01.patch, 1.1, NONE linux-2.6-netdev-e1000e-02.patch, 1.1, NONE linux-2.6-netdev-e1000e-03.patch, 1.1, NONE linux-2.6-netdev-e1000e-04.patch, 1.1, NONE linux-2.6-netdev-e1000e-05.patch, 1.1, NONE linux-2.6-netdev-e1000e-06.patch, 1.1, NONE linux-2.6-netdev-e1000e-07.patch, 1.1, NONE linux-2.6-netdev-e1000e-08.patch, 1.1, NONE linux-2.6-netdev-e1000e-09.patch, 1.1, NONE linux-2.6-netdev-e1000e-10.patch, 1.1, NONE linux-2.6-netdev-e1000e-backport.patch, 1.1, NONE linux-2.6-nfs-missing-braces.patch, 1.2, NONE linux-2.6-nfs-noreaddirplus.patch, 1.2, NONE linux-2.6-olpc-touchpad.diff, 1.2, NONE linux-2.6-ondemand-timer.patch, 1.2, NONE linux-2.6-oprofile-0.9.3.patch, 1.1, NONE linux-2.6-optimise-spinlock-debug.patch, 1.1, NONE linux-2.6-pmac-zilog.patch, 1.2, NONE linux-2.6-powermac-generic-suspend-1.patch, 1.2, NONE linux-2.6-powermac-generic-suspend-2.patch, 1.2, NONE linux-2.6-powermac-generic-suspend-3.patch, 1.2, NONE linux-2.6-powermac-generic-suspend-4.patch, 1.2, NONE linux-2.6-powerpc-reserve-initrd-1.patch, 1.2, NONE linux-2.6-powerpc-reserve-initrd-2.patch, 1.2, NONE linux-2.6-powerpc-slabalign.patch, 1.2, NONE linux-2.6-ppc-data-exception.patch, 1.2, NONE linux-2.6-proc-self-maps-fix.patch, 1.2, NONE linux-2.6-ps3-clear-spu-irq.patch, 1.2, NONE linux-2.6-ps3-device-init.patch, 1.2, NONE linux-2.6-ps3-ethernet-autoload.patch, 1.2, NONE linux-2.6-ps3-ethernet-modular.patch, 1.2, NONE linux-2.6-ps3-gelic-wireless.patch, 1.2, NONE linux-2.6-ps3-gelic.patch, 1.2, NONE linux-2.6-ps3-kexec.patch, 1.2, NONE linux-2.6-ps3-legacy-ioport.patch, 1.2, NONE linux-2.6-ps3-memory-probe.patch, 1.2, NONE linux-2.6-ps3-smp-boot.patch, 1.2, NONE linux-2.6-ps3-sound-autoload.patch, 1.2, NONE linux-2.6-ps3-sound.patch, 1.2, NONE linux-2.6-ps3-stable-patches.patch, 1.2, NONE linux-2.6-ps3-storage.patch, 1.2, NONE linux-2.6-ps3-system-bus-rework-2.patch, 1.2, NONE linux-2.6-ps3-system-bus-rework.patch, 1.2, NONE linux-2.6-ps3-usb-autoload.patch, 1.2, NONE linux-2.6-ps3-wrap-spu-runctl.patch, 1.2, NONE linux-2.6-ps3av-export-header.patch, 1.2, NONE linux-2.6-ps3fb-panic.patch, 1.2, NONE linux-2.6-raid-autorun.patch, 1.1, NONE linux-2.6-scsi-bounce-isa.patch, 1.2, NONE linux-2.6-sha_alignment.patch, 1.1, NONE linux-2.6-softirq-printout-irq-trace-events.patch, 1.2, NONE linux-2.6-softlockup-disable.patch, 1.2, NONE linux-2.6-sumversion-limits-dot-h.patch, 1.1, NONE linux-2.6-suspend-ordering.patch, 1.2, NONE linux-2.6-sysfs-inode-allocator-oops.patch, 1.2, NONE linux-2.6-udf-2.6.22-rc2-1-udf_data_corruption.patch, 1.2, NONE linux-2.6-udf-2.6.22-rc4-1-udf_block_leak.patch, 1.2, NONE linux-2.6-uevent-ebus.patch, 1.1, NONE linux-2.6-uevent-macio.patch, 1.1, NONE linux-2.6-uevent-of_platform.patch, 1.1, NONE linux-2.6-usb-autosuspend-default-disable.patch, 1.2, NONE linux-2.6-use-build-id-ld-option.patch, 1.2, NONE linux-2.6-utrace-ptrace-compat-xen.patch, 1.2, NONE linux-2.6-utrace-recalc_sigpending_and_wake.patch, 1.2, NONE linux-2.6-utrace-sig_kernel-macros.patch, 1.2, NONE linux-2.6-utrace-tracehook-xen.patch, 1.2, NONE linux-2.6-vm-invalidate_mapping_pages-cond-resched.patch, 1.2, NONE linux-2.6-vm-silence-atomic-alloc-failures.patch, 1.1, NONE linux-2.6-wakeups-hdaps.patch, 1.2, NONE linux-2.6-x86-64-edac-support.patch, 1.1, NONE linux-2.6-x86-64_pmtrace.patch, 1.2, NONE linux-2.6-x86-dell-hpet.patch, 1.2, NONE linux-2.6-x86-dont-delete-cpu_devs-data.patch, 1.2, NONE linux-2.6-x86-fsc-interrupt-controller-quirk.patch, 1.2, NONE linux-2.6-x86-vga-vidfail.patch, 1.1, NONE linux-2.6-x86_64-silence-up-apic-errors-xen.patch, 1.2, NONE linux-2.6-x86_64-silence-up-apic-errors.patch, 1.1, NONE linux-2.6-xen-backwards-time.patch, 1.1, NONE linux-2.6-xen-blkfront-wait-add.patch, 1.3, NONE linux-2.6-xen-fix-irq-warn-mismerge.patch, 1.1, NONE linux-2.6-xen-irq_vector-uninitialize.patch, 1.1, NONE linux-2.6-xen-paravirt-nographics-pvfb-fix.patch, 1.2, NONE linux-2.6-xen-privcmd-use-nopfn.patch, 1.1, NONE linux-2.6-xen-sleazy-fpu-i386.patch, 1.1, NONE linux-2.6-xen-sleazy-fpu-x86_64.patch, 1.1, NONE linux-2.6.20.tar.bz2.sign, 1.1, NONE

Mark McLoughlin (markmc) fedora-extras-commits at redhat.com
Mon Feb 18 16:56:24 UTC 2008


Author: markmc

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

Modified Files:
      Tag: private-markmc-pv-ops-branch
	.cvsignore Makefile Makefile.config config-debug 
	config-generic config-ia64-generic config-nodebug 
	config-powerpc-generic config-powerpc32-generic 
	config-powerpc64 config-s390x config-sparc-generic 
	config-sparc64-generic config-x86-generic 
	config-x86_64-generic config-xen-generic config-xen-ia64 
	config-xen-x86 config-xen-x86_64 kernel.spec 
	linux-2.6-ata-quirk.patch linux-2.6-build-nonintconfig.patch 
	linux-2.6-crash-driver.patch linux-2.6-debug-nmi-timeout.patch 
	linux-2.6-debug-spinlock-taint.patch 
	linux-2.6-debug-taint-vm.patch 
	linux-2.6-defaults-fat-utf8.patch linux-2.6-devmem.patch 
	linux-2.6-execshield.patch 
	linux-2.6-input-kill-stupid-messages.patch 
	linux-2.6-net-silence-noisy-printks.patch 
	linux-2.6-ppc32-ucmpdi2.patch linux-2.6-ps3-ehci-iso.patch 
	linux-2.6-selinux-mprotect-checks.patch 
	linux-2.6-serial-460800.patch linux-2.6-silence-noise.patch 
	linux-2.6-squashfs.patch linux-2.6-unexport-symbols.patch 
	linux-2.6-utrace-core.patch 
	linux-2.6-utrace-ptrace-compat-ia64.patch 
	linux-2.6-utrace-ptrace-compat-s390.patch 
	linux-2.6-utrace-ptrace-compat-sparc64.patch 
	linux-2.6-utrace-ptrace-compat.patch 
	linux-2.6-utrace-regset-ia64.patch 
	linux-2.6-utrace-regset-s390.patch 
	linux-2.6-utrace-regset-sparc64.patch 
	linux-2.6-utrace-regset.patch 
	linux-2.6-utrace-tracehook-ia64.patch 
	linux-2.6-utrace-tracehook-s390.patch 
	linux-2.6-utrace-tracehook-sparc64.patch 
	linux-2.6-utrace-tracehook-um.patch 
	linux-2.6-utrace-tracehook.patch linux-2.6-wireless.patch 
	linux-2.6-x86-tune-generic.patch nouveau-drm.patch sources 
	xen-build-id.patch xen-compile-fix.patch 
	xen-syms-build-id.patch 
Added Files:
      Tag: private-markmc-pv-ops-branch
	.gitignore gen-patches 
	linux-2.6-0001-xen-debug-Add-xprintk-to-log-directly-via-hypercall.patch 
	linux-2.6-0002-xen-dom0-Make-hvc_xen-console-work-for-dom0.patch 
	linux-2.6-0003-xen-dom0-Initialize-xenbus-for-dom0.patch 
	linux-2.6-0004-xen-dom0-Set-up-basic-IO-permissions-for-dom0.patch 
	linux-2.6-0005-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch 
	linux-2.6-0006-xen-dom0-Add-support-for-the-platform_ops-hypercall.patch 
	linux-2.6-0007-xen-acpi-Enable-early-access-to-ACPI-tables.patch 
	linux-2.6-0008-xen-dom0-Add-paravirt_ops-ioremap_page_range-for.patch 
	linux-2.6-0009-MTRR-use-cpu_callout_map-instead-of-cpu_online_map.patch 
	linux-2.6-0010-xen-mtrr-Add-mtrr_ops-support-for-Xen-mtrr.patch 
	linux-2.6-0011-xen-mtrr-Don-t-enable-xen-mtrr-on-bare-metal.patch 
	linux-2.6-0012-xen-mtrr-set-cpu-in-cpu_callout_map.patch 
	linux-2.6-0013-xen-mtrr-Clean-up-the-num_var_ranges-CPU_UNKOWN-hac.patch 
	linux-2.6-0014-xen-mtrr-Use-specific-cpu_has_foo-macros-instead-of.patch 
	linux-2.6-0015-xen-mtrr-Kill-some-unneccessary-includes.patch 
	linux-2.6-0016-xen-mtrr-No-need-to-explicitly-set-use_intel_if-0.patch 
	linux-2.6-0017-xen-mtrr-Use-generic_validate_add_page.patch 
	linux-2.6-0018-xen-mtrr-Implement-xen_get_free_region.patch 
	linux-2.6-0019-xen-mtrr-Add-xen_-get-set-_mtrr-implementations.patch 
	linux-2.6-0020-irq2.diff-from-Juan-Quintela.patch 
	linux-2.6-0021-xen-dom0-Obvious-cpuid-fix-to-domU-handling.patch 
	linux-2.6-0022-xen-debug-Diagnose-bind_virq_to_irq-errors.patch 
	linux-2.6-0023-xen-traps-Revert-Juan-s-traps_32.c-changes-to-debug.patch 
	linux-2.6-0024-xen-debug-Move-init_apic_mappings-after-trap-init.patch 
	linux-2.6-0025-xen-debug-Trace-progress-in-trap_init-around-init.patch 
	linux-2.6-0026-xen-apic-Disable-init_apic_mappings-when-under-CO.patch 
	linux-2.6-0027-xen-debug-Log-entry-into-virtual-console-s-xen_init.patch 
	linux-2.6-0028-xen-debug-Log-bind_virq_to_irq-events.patch 
	linux-2.6-0029-xen-debug-Work-around-USB-issue-triggered-by-Xen-de.patch 
	linux-2.6-0030-Remove-duplicated-dma_alloc-free_noncoherent-define.patch 
	linux-2.6-0031-xem-dom0-Add-hypervisor-memory_exchange-descriptor.patch 
	linux-2.6-0032-xen-dom0-add-virt_to_pfn-macro.patch 
	linux-2.6-0033-xen-dom0-use-virt_to_pfn-where-appropriate.patch 
	linux-2.6-0034-xen-dom0-Add-contiguous-region-support.patch 
	linux-2.6-0035-xen-dom0-Don-t-mask-off-PCD-bits-from-pte-entries.patch 
	linux-2.6-0036-xen-dom0-Remove-duplicate-xen_store_interface-assig.patch 
	linux-2.6-0037-xen-dom0-Slightly-re-arrange-xenbus_probe_init-er.patch 
	linux-2.6-0038-xen-dom0-Use-max_low_pfn-declaration-from-linux-boo.patch 
	linux-2.6-0039-xen-dma-Add-dma_mapping_ops-indirection-for-32-bit.patch 
	linux-2.6-0040-xen-dma-Remove-unused-32-bit-dma_ops-map_simple-me.patch 
	linux-2.6-0041-xen-dma-Initial-commit-of-pci-xen.c-dma-mapping-fun.patch 
	linux-2.6-0042-xen-dma-Add-calls-to-dma_ops-alloc-free_coherent-ho.patch 
	linux-2.6-0043-xen-dma-Add-xen_alloc-free_coherent.patch 
	linux-2.6-0044-xen-dma-Don-t-merge-bios-on-xen-pvops.patch 
	linux-2.6-0045-xen-dom0-Minor-coding-style-issue-in-ISA-mapping-co.patch 
	linux-2.6-0046-xen-dom0-Use-i-PAGE_SHIFT-instead-of-PAGE_DOWN-i.patch 
	linux-2.6-0047-xen-dom0-Match-up-set_pte_mfn-prototype-with-the.patch 
	linux-2.6-0048-xen-dom0-Reserve-ISA-address-space-earlier.patch 
	linux-2.6-0049-xen-Add-empty-xenctrl-module.patch 
	linux-2.6-0050-xen-dom0-Add-proc-xen-capabilities.patch 
	linux-2.6-0051-xen-Add-proc-xen-privcmd.patch 
	linux-2.6-0052-xen-dom0-Add-proc-xen-xsd_-port-kva.patch 
	linux-2.6-0053-xen-Add-proc-xen-xenbus.patch 
	linux-2.6-0054-xen-Add-dev-xen-evtchn.patch 
	linux-2.6-0055-xen-Add-__init-__exit-notations-to-xenctrl-function.patch 
	linux-2.6-0056-xen-Add-Xen-s-sys-hypervisor-interface.patch 
	linux-2.6-0057-xen-dom0-Add-basic-proc-xen-balloon.patch 
	linux-2.6-0058-xen-dom0-Re-work-privcmd_ioctl-a-little.patch 
	linux-2.6-0059-xen-dom0-Add-IOCTL_PRIVCMD_MMAP.patch 
	linux-2.6-acpi-eeepc-hotkey.patch linux-2.6-agp-mm.patch 
	linux-2.6-alsa-rc4-mm1.patch 
	linux-2.6-alsa-support-sis7019.patch linux-2.6-at76.patch 
	linux-2.6-ath5k-use-soft-wep.patch 
	linux-2.6-compile-fix-gcc-43.patch 
	linux-2.6-compile-fixes.patch linux-2.6-dcdbas-autoload.patch 
	linux-2.6-debug-acpi-os-write-port.patch 
	linux-2.6-default-mmf_dump_elf_headers.patch 
	linux-2.6-drm-add-i915-radeon-mdt.patch linux-2.6-drm-mm.patch 
	linux-2.6-drm-radeon-update.patch 
	linux-2.6-e1000-corrupt-eeprom-checksum.patch 
	linux-2.6-epoll-lockdep-annotation.patch 
	linux-2.6-ext4-linus-git.patch 
	linux-2.6-ext4-stable-queue.patch 
	linux-2.6-firewire-git-pending.patch 
	linux-2.6-firewire-git-update.patch 
	linux-2.6-gelic-fixups.patch 
	linux-2.6-gelic-wireless-fix.patch 
	linux-2.6-gelic-wireless-v2.patch 
	linux-2.6-git-initial-r500-drm.patch 
	linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch 
	linux-2.6-lirc.patch linux-2.6-netdev-atl2.patch 
	linux-2.6-netdev-bonding-fix-null-deref.patch 
	linux-2.6-netdev-e1000-disable-alpm.patch 
	linux-2.6-pasemi-for-2.6.25.patch 
	linux-2.6-pasemi-reserve-i2c.patch 
	linux-2.6-powerpc-bootwrapper.patch 
	linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch 
	linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch 
	linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch 
	linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch 
	linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch 
	linux-2.6-ppc-rtc.patch 
	linux-2.6-ps3-legacy-bootloader-hack.patch 
	linux-2.6-ps3-storage-alias.patch linux-2.6-rndis_wlan.patch 
	linux-2.6-scsi-mpt-vmware-fix.patch 
	linux-2.6-selinux-strip-leading-slashes.patch 
	linux-2.6-smarter-relatime.patch 
	linux-2.6-usb-ehci-hcd-respect-nousb.patch 
	linux-2.6-utrace-ptrace-compat-avr32.patch 
	linux-2.6-utrace-regset-avr32.patch 
	linux-2.6-utrace-tracehook-avr32.patch 
	linux-2.6-uvcvideo.patch linux-2.6-wireless-pending.patch 
	linux-2.6-x86-debug-boot.patch 
	linux-2.6-xfs-optimize-away-realtime-tests.patch 
	linux-2.6-xfs-setfattr-32bit-compat.patch 
	linux-2.6-xfs-xfs_mount-refactor.patch 
	linux-2.6.24.tar.bz2.sign mirrors upstream upstream-key.gpg 
Removed Files:
      Tag: private-markmc-pv-ops-branch
	config-olpc-generic git-wireless-dev.patch 
	kernel-2.6.21.7-i686-xen.config 
	kernel-2.6.21.7-x86_64-xen.config 
	linux-2.6-2110_scsi-sd-printing.patch 
	linux-2.6-2111_sd-start-stop.patch 
	linux-2.6-2112_libata-suspend.patch 
	linux-2.6-2113_libata-spindown-compat.patch 
	linux-2.6-2114_libata-shutdown-warning.patch 
	linux-2.6-2115_libata-spindown-status.patch 
	linux-2.6-2116_libata-remove-spindown-compat.patch 
	linux-2.6-2117_sata-via-suspend.patch 
	linux-2.6-2118_scsi-constants.patch 
	linux-2.6-3w-9xxx-mem_len.patch linux-2.6-PT_LOAD-align.patch 
	linux-2.6-acpi-boot-regression.patch 
	linux-2.6-acpi-config_pm-poweroff.patch 
	linux-2.6-acpi-dock-oops.patch 
	linux-2.6-acpi-keep-tsc-stable-when-lapic-timer-c2-ok-is-set.patch 
	linux-2.6-acpi-preserve-ebx-in-acpi_copy_wakeup_routine.patch 
	linux-2.6-acpi-unblacklist-dell-gx240.patch 
	linux-2.6-amd-disabled-svm-detect-msr-1.patch 
	linux-2.6-amd-disabled-svm-detect.patch 
	linux-2.6-ata-call-check-dma-with-qc-prepared.patch 
	linux-2.6-ata-use-pio-for-non-16-byte-xfers.patch 
	linux-2.6-bcm43xx-pci-neuter.patch 
	linux-2.6-cell-spu-device-tree.patch 
	linux-2.6-cell-spufs-fixes.patch 
	linux-2.6-clockevents-fix-resume-logic.patch 
	linux-2.6-common-uevent.patch 
	linux-2.6-crap-sysfs-workaround.patch 
	linux-2.6-crash-driver-xen.patch linux-2.6-cve-2008-0600.patch 
	linux-2.6-debug-boot-delay.patch 
	linux-2.6-debug-extra-warnings.patch 
	linux-2.6-debug-must_check.patch 
	linux-2.6-debug-slab-backtrace.patch 
	linux-2.6-debug-sysfs-crash-debugging-xen.patch 
	linux-2.6-debug-sysfs-crash-debugging.patch 
	linux-2.6-defaults-nonmi.patch 
	linux-2.6-defaults-pci_no_msi_mmconf.patch 
	linux-2.6-defaults-unicode-vt.patch linux-2.6-devmem-xen.patch 
	linux-2.6-disable-netback-checksum.patch 
	linux-2.6-dvb-spinlock.patch linux-2.6-execshield-xen.patch 
	linux-2.6-firewire-be32-fix.patch linux-2.6-firewire.patch 
	linux-2.6-fix-pmops-1.patch linux-2.6-fix-pmops-2.patch 
	linux-2.6-fix-pmops-3.patch linux-2.6-fix-pmops-4.patch 
	linux-2.6-gfs2-update.patch 
	linux-2.6-i82875-edac-pci-setup.patch 
	linux-2.6-i965gm-support.patch linux-2.6-ibmvscsi-schizo.patch 
	linux-2.6-kvm-19.patch 
	linux-2.6-kvm-reinit-real-mode-tss.patch 
	linux-2.6-libata-atiixp-ids.patch linux-2.6-libata-hpa.patch 
	linux-2.6-libata-ich8m-add-pciid.patch 
	linux-2.6-libata-ncq-blacklist-2.6.22-rc7.patch 
	linux-2.6-libata-pata-hpt3x2n-correct-revision-boundary.patch 
	linux-2.6-libata-pata-pcmcia-new-ident.patch 
	linux-2.6-libata-pata-sis-fix-timing.patch 
	linux-2.6-libata-pata_dma-param.patch 
	linux-2.6-libata-pata_it821x-partly-fix-dma.patch 
	linux-2.6-libata-sata_nv-adma.patch 
	linux-2.6-libata-sata_nv-wildcard-removal.patch 
	linux-2.6-libata-setxfer.patch 
	linux-2.6-libata_ali_max_dma_speed.patch 
	linux-2.6-libertas.diff linux-2.6-mm-udf-fixes.patch 
	linux-2.6-modsign-core.patch linux-2.6-modsign-crypto.patch 
	linux-2.6-modsign-include.patch linux-2.6-modsign-ksign.patch 
	linux-2.6-modsign-mpilib.patch linux-2.6-modsign-script.patch 
	linux-2.6-modsign-verify.patch linux-2.6-module_version.patch 
	linux-2.6-mpc52xx-fec.patch linux-2.6-mpc52xx-sdma.patch 
	linux-2.6-net-e1000-no-msi-warning.patch 
	linux-2.6-netdev-e1000e-01.patch 
	linux-2.6-netdev-e1000e-02.patch 
	linux-2.6-netdev-e1000e-03.patch 
	linux-2.6-netdev-e1000e-04.patch 
	linux-2.6-netdev-e1000e-05.patch 
	linux-2.6-netdev-e1000e-06.patch 
	linux-2.6-netdev-e1000e-07.patch 
	linux-2.6-netdev-e1000e-08.patch 
	linux-2.6-netdev-e1000e-09.patch 
	linux-2.6-netdev-e1000e-10.patch 
	linux-2.6-netdev-e1000e-backport.patch 
	linux-2.6-nfs-missing-braces.patch 
	linux-2.6-nfs-noreaddirplus.patch linux-2.6-olpc-touchpad.diff 
	linux-2.6-ondemand-timer.patch linux-2.6-oprofile-0.9.3.patch 
	linux-2.6-optimise-spinlock-debug.patch 
	linux-2.6-pmac-zilog.patch 
	linux-2.6-powermac-generic-suspend-1.patch 
	linux-2.6-powermac-generic-suspend-2.patch 
	linux-2.6-powermac-generic-suspend-3.patch 
	linux-2.6-powermac-generic-suspend-4.patch 
	linux-2.6-powerpc-reserve-initrd-1.patch 
	linux-2.6-powerpc-reserve-initrd-2.patch 
	linux-2.6-powerpc-slabalign.patch 
	linux-2.6-ppc-data-exception.patch 
	linux-2.6-proc-self-maps-fix.patch 
	linux-2.6-ps3-clear-spu-irq.patch 
	linux-2.6-ps3-device-init.patch 
	linux-2.6-ps3-ethernet-autoload.patch 
	linux-2.6-ps3-ethernet-modular.patch 
	linux-2.6-ps3-gelic-wireless.patch linux-2.6-ps3-gelic.patch 
	linux-2.6-ps3-kexec.patch linux-2.6-ps3-legacy-ioport.patch 
	linux-2.6-ps3-memory-probe.patch linux-2.6-ps3-smp-boot.patch 
	linux-2.6-ps3-sound-autoload.patch linux-2.6-ps3-sound.patch 
	linux-2.6-ps3-stable-patches.patch linux-2.6-ps3-storage.patch 
	linux-2.6-ps3-system-bus-rework-2.patch 
	linux-2.6-ps3-system-bus-rework.patch 
	linux-2.6-ps3-usb-autoload.patch 
	linux-2.6-ps3-wrap-spu-runctl.patch 
	linux-2.6-ps3av-export-header.patch 
	linux-2.6-ps3fb-panic.patch linux-2.6-raid-autorun.patch 
	linux-2.6-scsi-bounce-isa.patch linux-2.6-sha_alignment.patch 
	linux-2.6-softirq-printout-irq-trace-events.patch 
	linux-2.6-softlockup-disable.patch 
	linux-2.6-sumversion-limits-dot-h.patch 
	linux-2.6-suspend-ordering.patch 
	linux-2.6-sysfs-inode-allocator-oops.patch 
	linux-2.6-udf-2.6.22-rc2-1-udf_data_corruption.patch 
	linux-2.6-udf-2.6.22-rc4-1-udf_block_leak.patch 
	linux-2.6-uevent-ebus.patch linux-2.6-uevent-macio.patch 
	linux-2.6-uevent-of_platform.patch 
	linux-2.6-usb-autosuspend-default-disable.patch 
	linux-2.6-use-build-id-ld-option.patch 
	linux-2.6-utrace-ptrace-compat-xen.patch 
	linux-2.6-utrace-recalc_sigpending_and_wake.patch 
	linux-2.6-utrace-sig_kernel-macros.patch 
	linux-2.6-utrace-tracehook-xen.patch 
	linux-2.6-vm-invalidate_mapping_pages-cond-resched.patch 
	linux-2.6-vm-silence-atomic-alloc-failures.patch 
	linux-2.6-wakeups-hdaps.patch 
	linux-2.6-x86-64-edac-support.patch 
	linux-2.6-x86-64_pmtrace.patch linux-2.6-x86-dell-hpet.patch 
	linux-2.6-x86-dont-delete-cpu_devs-data.patch 
	linux-2.6-x86-fsc-interrupt-controller-quirk.patch 
	linux-2.6-x86-vga-vidfail.patch 
	linux-2.6-x86_64-silence-up-apic-errors-xen.patch 
	linux-2.6-x86_64-silence-up-apic-errors.patch 
	linux-2.6-xen-backwards-time.patch 
	linux-2.6-xen-blkfront-wait-add.patch 
	linux-2.6-xen-fix-irq-warn-mismerge.patch 
	linux-2.6-xen-irq_vector-uninitialize.patch 
	linux-2.6-xen-paravirt-nographics-pvfb-fix.patch 
	linux-2.6-xen-privcmd-use-nopfn.patch 
	linux-2.6-xen-sleazy-fpu-i386.patch 
	linux-2.6-xen-sleazy-fpu-x86_64.patch 
	linux-2.6.20.tar.bz2.sign 
Log Message:
Sync to kernel-2_6_24-23_fc9 tag of rpms/kernel/devel and
add first round of Xen pv_ops Dom0 support



--- NEW FILE .gitignore ---
clog
GNUmakefile
kernel-2.6.*.config
temp-*
kernel-2.6.24
linux-2.6.24.tar.bz2
xen-3.2.0.tar.gz


--- NEW FILE gen-patches ---
#!/bin/bash
#
# This script goes with the Makefile hacks for git/branch builds.
#

nopatches=1
if [ "x$1" = "x--fedora" ]; then
  nopatches=0
  shift
  patchcomment="plus Fedora patches"
else
  patchcomment="no Fedora patches"
fi

name=
if [ "x$1" = "x--name" ]; then
  shift
  name="$1"
  shift
fi

if [ $# -lt 2 ]; then
  echo >&2 "Usage: GIT_DIR=REPO $0 [--fedora] [--name NAME]\
 TARBALL-TAG [PATCH-TAG...] BRANCH..."
  exit 2
fi

base=$1
shift
base_rev=`git-rev-parse "$base"` || exit

patchbase=10
nextpatch=$patchbase
usepatch()
{
  patches[$nextpatch]=$1
  nextpatch=$(($nextpatch + 1))
}

lasturl=:
loglines="- Experimental build from git sources ($patchcomment)\\
"
log()
{
  local logrev=$1
  local logbranch=$3
  local ref
  ref=`git-symbolic-ref -q $logbranch` && logbranch=$ref
  case $logbranch in
  refs/remotes/*)
    logbranch=${logbranch#refs/remotes/}
    local remote=${logbranch%%/*}
    logbranch=${logbranch#*/}
    logbranch=${logbranch//\//-}
    local url
    url=`git-config "remote.${remote}.url"` || {
      echo >&2 "Cannot find URL for remote $remote"
      exit 2
    }
    if [ "$url" != "$lasturl" ]; then
      lasturl="$url"
      loglines="${loglines}- $url\\
"
    fi
    logtext="$(printf %12s "remote: ")$logbranch"
    ;;
  *)
    lasturl=:
    logtext="$(printf %-12s "git $2:")$logbranch"
    ;;
  esac
  loglines="${loglines}- $(printf %-35s "$logtext") ${logrev}\\
"
}

patch_headers()
{
  p=$patchbase
  while [ $p -lt $nextpatch ]; do
    echo "Patch$p: ${patches[$p]}\\"
    p=$(($p + 1))
  done
}

patch_apply()
{
  p=$patchbase
  while [ $p -lt $nextpatch ]; do
#    echo "%patch$p -p1\\"
    echo "ApplyPatch ${patches[$p]}\\"
    p=$(($p + 1))
  done
}

base_rev()
{
  local base=$1
  tag_rev=`git-rev-parse --revs-only --verify "$base^{}" 2> /dev/null` &&
  [ "`git-describe --tags $tag_rev`" = "$base" ] && return 0
  case "$1" in
  v*-git*)
    local id=patch-${1#v}.id
    if [ ! -r $id ]; then
      make download UPSTREAM_FILES=$id UPSTREAM_CHECKS=-- > /dev/null 2>&1
    fi
    [ -r $id ] && tag_rev=`cat $id` && return 0
    ;;
  v2*)
    echo >&2 "Cannot find tag $base"
    exit 2
    ;;
  esac
  return 1
}

log $base_rev base $base
while base_rev $1; do
  base=$1
  base_rev=$tag_rev
  shift
  patchfile=patch-${base#v}.bz2
  fgrep -q $patchfile sources || usepatch $patchfile
  log $tag_rev tag $base
done
version=${base#v}

now="`date +'%Y-%m-%d %H:%M %Z'`"

GIT_DIFF_OPTS=-pu
export GIT_DIFF_OPTS

i=0
last_base=$base
last_base_rev=$base_rev
for branch; do
  branch_rev=`git-rev-parse "$branch^{}"` || exit 2
  merge_base=`git-merge-base $last_base_rev $branch_rev` || {
    echo >&2 "No common ancestor for $last_base and $branch"
    exit 2
  }
  if ((i > 0)) && [ "x$merge_base" = "x${merge_rev[$(($i - 1))]}" ]; then
    echo >&2 "$last_base is not an ancestor of $branch"
    exit 2
  fi
  merge_rev[$i]=$merge_base
  ((i++))
  last_base=$branch
  last_base_rev=$branch_rev
done
merge_rev[$i]=$last_base_rev

test "x${merge_rev[0]}" = "x$base_rev" || {
  echo >&2 "$base is not an ancestor of $branch"
  exit 2
}

i=1
for branch; do

  branch_rev=${merge_rev[$i]}
  ((i++))

  case "$branch" in
  refs/remotes/*/master)
    branch_name=${branch#refs/remotes/}
    branch_name=${branch_name%/master}
    ;;
  refs/remotes/*)
    branch_name=${branch#refs/remotes/}
    branch_name=${branch_name//\//-}
    ;;
  */*)
    branch_name=${branch_name//\//-}
    ;;
  *)
    branch_name=$branch
    ;;
  esac

  file=linux-${version}-${branch_name}.patch
  git diff --no-renames --patch-with-stat \
	   -r "${base_rev}" -r "${branch_rev}" > $file || exit
  if [ ! -s $file ]; then
    rm -f $file
    continue
  fi

  usepatch $file
  log $branch_rev branch $branch

  base_rev="$branch_rev"
done
name=`echo ${name:-${branch}} | sed s/-/_/g`

#upstream_branch=`date -u -d "$now" +${branch}.%Y%m%dT%H%M | sed s/-/_/g`
upstream_branch=$name
branch_rev=`git describe $base_rev | sed 's/-g[0-9a-f]*$//;s/^[^-]*//;s/-/./g'`

logdate=`date -d "$now" +'%a %b %d %Y'`

sed "/%define nopatches/c\\
%define nopatches ${nopatches}\\
%define upstream_branch ${name}\\
%define upstream_branch_tag ${branch_rev}
/^### BRANCH PATCH/a\\
`patch_headers`
###
/^### BRANCH APPLY/a\\
`patch_apply`
###
/^%changelog/a\\
* ${logdate} ${GIT_AUTHOR_NAME} <${GIT_AUTHOR_EMAIL}>\\
$loglines

"

linux-2.6-0001-xen-debug-Add-xprintk-to-log-directly-via-hypercall.patch:

--- NEW FILE linux-2.6-0001-xen-debug-Add-xprintk-to-log-directly-via-hypercall.patch ---
>From cbdf50a0e23b958ec393b044a8414ac24117558e Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Wed, 21 Nov 2007 18:40:31 +0000
Subject: [PATCH] xen debug: Add xprintk to log directly via hypercall

For early debugging, it is useful to have a way of doing debugging output
direct to the hypervisor without having to rely on console being fully
initialised.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/xen/enlighten.c  |   32 ++++++++++++++++++++++++++++++++
 include/xen/hvc-console.h |    1 +
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 79ad152..84f46e2 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -32,6 +32,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>
@@ -141,6 +142,37 @@ static void __init xen_banner(void)
 	printk(KERN_INFO "Hypervisor signature: %s\n", xen_start_info->magic);
 }
 
+static void kcons_write_dom0(const char *s, unsigned int count)
+{
+       int rc;
+
+       while ((count > 0) &&
+              ((rc = HYPERVISOR_console_io(
+                       CONSOLEIO_write, count, (char *)s)) > 0)) {
+               count -= rc;
+               s += rc;
+       }
+}
+
+
+/*** Useful function for console debugging -- goes straight to Xen. ***/
+asmlinkage int xprintk(const char *fmt, ...)
+{
+       va_list args;
+       int printk_len;
+       static char printk_buf[1024];
+
+       /* Emit the output into the temporary buffer */
+       va_start(args, fmt);
+       printk_len = vsnprintf(printk_buf, sizeof(printk_buf), fmt, args);
+       va_end(args);
+
+       /* Send the processed output directly to Xen. */
+       kcons_write_dom0(printk_buf, printk_len);
+
+       return 0;
+}
+
 static void xen_cpuid(unsigned int *eax, unsigned int *ebx,
 		      unsigned int *ecx, unsigned int *edx)
 {
diff --git a/include/xen/hvc-console.h b/include/xen/hvc-console.h
index 21c0ecf..cb7a3c9 100644
--- a/include/xen/hvc-console.h
+++ b/include/xen/hvc-console.h
@@ -2,5 +2,6 @@
 #define XEN_HVC_CONSOLE_H
 
 extern struct console xenboot_console;
+extern asmlinkage int xprintk(const char *fmt, ...);
 
 #endif	/* XEN_HVC_CONSOLE_H */
-- 
1.5.4.1


linux-2.6-0002-xen-dom0-Make-hvc_xen-console-work-for-dom0.patch:

--- NEW FILE linux-2.6-0002-xen-dom0-Make-hvc_xen-console-work-for-dom0.patch ---
>From f66e3b5781df65ae5b42eaaa97a5487c45620c6a Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela at redhat.com>
Date: Mon, 26 Nov 2007 07:38:29 +0100
Subject: [PATCH] xen dom0: Make hvc_xen console work for dom0.

Signed-off-by: Jeremy Fitzhardinge <jeremy at xensource.com>
Signed-off-by: Juan Quintela <quintela at redhat.com>
Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/xen/events.c  |    2 +-
 drivers/char/hvc_xen.c |   61 +++++++++++++++++++++++++++++++++++++++++------
 include/xen/events.h   |    2 +
 3 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/arch/x86/xen/events.c b/arch/x86/xen/events.c
index 6d1da58..2bf9731 100644
--- a/arch/x86/xen/events.c
+++ b/arch/x86/xen/events.c
@@ -311,7 +311,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
 }
 
 
-static int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
+int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
 {
 	struct evtchn_bind_virq bind_virq;
 	int evtchn, irq;
diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c
index dd68f85..6e85664 100644
--- a/drivers/char/hvc_xen.c
+++ b/drivers/char/hvc_xen.c
@@ -50,7 +50,7 @@ static inline void notify_daemon(void)
 	notify_remote_via_evtchn(xen_start_info->console.domU.evtchn);
 }
 
-static int write_console(uint32_t vtermno, const char *data, int len)
+static int domU_write_console(uint32_t vtermno, const char *data, int len)
 {
 	struct xencons_interface *intf = xencons_interface();
 	XENCONS_RING_IDX cons, prod;
@@ -71,7 +71,28 @@ static int write_console(uint32_t vtermno, const char *data, int len)
 	return sent;
 }
 
-static int read_console(uint32_t vtermno, char *buf, int len)
+static int dom0_write_console(uint32_t vtermno, const char *data, int len)
+{
+	int ret;
+
+	ret = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)data);
+
+	return ret < 0 ? 0 : len;
+}
+
+static int write_console(uint32_t vtermno, const char *data, int len)
+{
+	int ret;
+
+	if (is_initial_xendomain())
+		ret = dom0_write_console(vtermno, data, len);
+	else
+		ret = domU_write_console(vtermno, data, len);
+
+	return ret;
+}
+
+static int domU_read_console(uint32_t vtermno, char *buf, int len)
 {
 	struct xencons_interface *intf = xencons_interface();
 	XENCONS_RING_IDX cons, prod;
@@ -92,22 +113,40 @@ static int read_console(uint32_t vtermno, char *buf, int len)
 	return recv;
 }
 
-static struct hv_ops hvc_ops = {
-	.get_chars = read_console,
-	.put_chars = write_console,
+static int dom0_read_console(uint32_t vtermno, char *buf, int len)
+{
+	return HYPERVISOR_console_io(CONSOLEIO_read, len, buf);
+}
+
+static struct hv_ops domU_hvc_ops = {
+	.get_chars = domU_read_console,
+	.put_chars = domU_write_console,
+};
+
+static struct hv_ops dom0_hvc_ops = {
+	.get_chars = dom0_read_console,
+	.put_chars = dom0_write_console,
 };
 
 static int __init xen_init(void)
 {
 	struct hvc_struct *hp;
+	struct hv_ops *ops;
 
 	if (!is_running_on_xen())
 		return 0;
 
-	xencons_irq = bind_evtchn_to_irq(xen_start_info->console.domU.evtchn);
+	if (is_initial_xendomain()) {
+		ops = &dom0_hvc_ops;
+		xencons_irq = bind_virq_to_irq(VIRQ_CONSOLE, 0);
+	} else {
+		ops = &domU_hvc_ops;
+		xencons_irq = bind_evtchn_to_irq(xen_start_info->console.domU.evtchn);
+	}
+
 	if (xencons_irq < 0)
 		xencons_irq = 0 /* NO_IRQ */;
-	hp = hvc_alloc(HVC_COOKIE, xencons_irq, &hvc_ops, 256);
+	hp = hvc_alloc(HVC_COOKIE, xencons_irq, ops, 256);
 	if (IS_ERR(hp))
 		return PTR_ERR(hp);
 
@@ -123,10 +162,16 @@ static void __exit xen_fini(void)
 
 static int xen_cons_init(void)
 {
+	struct hv_ops *ops;
+
 	if (!is_running_on_xen())
 		return 0;
 
-	hvc_instantiate(HVC_COOKIE, 0, &hvc_ops);
+	ops = &domU_hvc_ops;
+	if (is_initial_xendomain())
+		ops = &dom0_hvc_ops;
+
+	hvc_instantiate(HVC_COOKIE, 0, ops);
 	return 0;
 }
 
diff --git a/include/xen/events.h b/include/xen/events.h
index 2bde54d..0436486 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -18,6 +18,8 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn,
 			      irq_handler_t handler,
 			      unsigned long irqflags, const char *devname,
 			      void *dev_id);
+int bind_virq_to_irq(unsigned int virq, unsigned int cpu);
+
 int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
 			    irq_handler_t handler,
 			    unsigned long irqflags, const char *devname,
-- 
1.5.4.1


linux-2.6-0003-xen-dom0-Initialize-xenbus-for-dom0.patch:

--- NEW FILE linux-2.6-0003-xen-dom0-Initialize-xenbus-for-dom0.patch ---
>From a7ff3dba9663a740f85d5bcb71492eb58c03ce4c Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela at redhat.com>
Date: Mon, 26 Nov 2007 08:35:10 +0100
Subject: [PATCH] xen dom0: Initialize xenbus for dom0.

Signed-off-by: Jeremy Fitzhardinge <jeremy at xensource.com>
Signed-off-by: Juan Quintela <quintela at redhat.com>
---
 drivers/xen/xenbus/xenbus_probe.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 4750de3..298c4c8 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -787,6 +787,7 @@ void xenbus_probe(struct work_struct *unused)
 static int __init xenbus_probe_init(void)
 {
 	int err = 0;
+	unsigned long page = 0;
 
 	DPRINTK("");
 
@@ -807,7 +808,31 @@ static int __init xenbus_probe_init(void)
 	 * Domain0 doesn't have a store_evtchn or store_mfn yet.
 	 */
 	if (is_initial_xendomain()) {
-		/* dom0 not yet supported */
+		struct evtchn_alloc_unbound alloc_unbound;
+
+		/* Allocate page. */
+		page = get_zeroed_page(GFP_KERNEL);
+		if (!page)
+			return -ENOMEM;
+
+		xen_store_mfn = xen_start_info->store_mfn =
+			pfn_to_mfn(virt_to_phys((void *)page) >>
+				   PAGE_SHIFT);
+
+		/* Next allocate a local port which xenstored can bind to */
+		alloc_unbound.dom        = DOMID_SELF;
+		alloc_unbound.remote_dom = 0;
+
+		err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
+						  &alloc_unbound);
+		if (err == -ENOSYS)
+			goto out_unreg_front;
+
+		BUG_ON(err);
+		xen_store_evtchn = xen_start_info->store_evtchn =
+			alloc_unbound.port;
+
+		xen_store_interface = mfn_to_virt(xen_store_mfn);
 	} else {
 		xenstored_ready = 1;
 		xen_store_evtchn = xen_start_info->store_evtchn;
@@ -835,6 +860,9 @@ static int __init xenbus_probe_init(void)
 	bus_unregister(&xenbus_frontend.bus);
 
   out_error:
+	if (page != 0)
+		free_page(page);
+
 	return err;
 }
 
-- 
1.5.4.1


linux-2.6-0004-xen-dom0-Set-up-basic-IO-permissions-for-dom0.patch:

--- NEW FILE linux-2.6-0004-xen-dom0-Set-up-basic-IO-permissions-for-dom0.patch ---
>From d60e2added25bfb050c8b0bb8b23a2eed234f284 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela at redhat.com>
Date: Mon, 26 Nov 2007 08:53:42 +0100
Subject: [PATCH] xen dom0: Set up basic IO permissions for dom0.

Add the direct mapping area for ISA bus access, and enable IO space
access for the guest when running as dom0.

Signed-off-by: Jeremy Fitzhardinge <jeremy at xensource.com>
Signed-off-by: Juan Quintela <quintela at redhat.com>
---
 arch/x86/mm/ioremap_32.c |    3 ---
 arch/x86/xen/enlighten.c |   21 +++++++++++++++++++++
 arch/x86/xen/setup.c     |    3 ++-
 include/asm-x86/io_32.h  |    4 ++++
 4 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c
index 0b27831..63a301a 100644
--- a/arch/x86/mm/ioremap_32.c
+++ b/arch/x86/mm/ioremap_32.c
@@ -18,9 +18,6 @@
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
 
-#define ISA_START_ADDRESS	0xa0000
-#define ISA_END_ADDRESS		0x100000
-
 /*
  * Generic mapping function (not visible outside):
  */
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 84f46e2..69a73f0 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -45,6 +45,7 @@
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/reboot.h>
+#include <asm/io.h>
 
 #include "xen-ops.h"
 #include "mmu.h"
@@ -860,6 +861,20 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 
 		pin_pagetable_pfn(level, PFN_DOWN(__pa(base)));
 	}
+
+	/*
+	 * If we're dom0, then 1:1 map the ISA machine addresses into
+	 * the kernel's address space.
+	 */
+	if (is_initial_xendomain()) {
+		unsigned i;
+
+		for(i = ISA_START_ADDRESS; i < ISA_END_ADDRESS; i += PAGE_SIZE)
+			set_pte_mfn(PAGE_OFFSET + i, PFN_DOWN(i), PAGE_KERNEL);
+
+		reserve_bootmem(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS);
+		printk(KERN_INFO "Xen: setup ISA identity maps\n");
+	}
 }
 
 /* This is called once we have the cpu_possible_map */
@@ -1211,6 +1226,12 @@ asmlinkage void __init xen_start_kernel(void)
 	if (xen_feature(XENFEAT_supervisor_mode_kernel))
 		pv_info.kernel_rpl = 0;
 
+	if (is_initial_xendomain()) {
+		struct physdev_set_iopl set_iopl;
+		set_iopl.iopl = 1;
+		HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
+	}
+
 	/* set the limit of our address space */
 	xen_reserve_top();
 
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index f84e772..3c84287 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -105,7 +105,8 @@ void __init xen_arch_setup(void)
 	xen_fill_possible_map();
 #endif
 
-	paravirt_disable_iospace();
+	if (!is_initial_xendomain())
+		paravirt_disable_iospace();
 
 	fiddle_vdso();
 }
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h
index fe881cd..e2b916e 100644
--- a/include/asm-x86/io_32.h
+++ b/include/asm-x86/io_32.h
@@ -139,6 +139,10 @@ extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
 #define dmi_iounmap bt_iounmap
 #define dmi_alloc alloc_bootmem
 
+
+#define ISA_START_ADDRESS	0xa0000
+#define ISA_END_ADDRESS		0x100000
+
 /*
  * ISA I/O bus memory addresses are 1:1 with the physical address.
  */
-- 
1.5.4.1


linux-2.6-0005-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch:

--- NEW FILE linux-2.6-0005-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch ---
>From 75eea581acc135d53cdc0985ab8c834259f5474d Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela at redhat.com>
Date: Tue, 27 Nov 2007 06:44:53 +0100
Subject: [PATCH] xen dom0: Add set_fixmap pv_mmu_ops.

Adds the logic necessary to map by mfn rather than pfn when we set up
fixmaps to point to IO space.

Signed-off-by: Jeremy Fitzhardinge <jeremy at xensource.com>
Signed-off-by: Juan Quintela <quintela at redhat.com>
---
 arch/x86/kernel/paravirt_32.c |    2 ++
 arch/x86/mm/pgtable_32.c      |   15 ++++++++++-----
 arch/x86/xen/enlighten.c      |   38 ++++++++++++++++++++++++++++++++++----
 arch/x86/xen/mmu.c            |   30 +-----------------------------
 include/asm-x86/fixmap_32.h   |   13 +++++++++++--
 include/asm-x86/paravirt.h    |   13 +++++++++++++
 include/asm-x86/pgtable_32.h  |    3 +++
 7 files changed, 74 insertions(+), 40 deletions(-)

diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index f500079..9fc62c2 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -462,6 +462,8 @@ struct pv_mmu_ops pv_mmu_ops = {
 		.enter = paravirt_nop,
 		.leave = paravirt_nop,
 	},
+
+	.set_fixmap = native_set_fixmap,
 };
 
 EXPORT_SYMBOL_GPL(pv_time_ops);
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index be61a1d..8892aad 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -76,7 +76,7 @@ void show_mem(void)
  * Associate a virtual page frame with a given physical page frame 
  * and protection flags for that frame.
  */ 
-static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
+void set_pte_vaddr(unsigned long vaddr, pte_t pteval)
 {
 	pgd_t *pgd;
 	pud_t *pud;
@@ -99,8 +99,8 @@ static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
 		return;
 	}
 	pte = pte_offset_kernel(pmd, vaddr);
-	if (pgprot_val(flags))
-		set_pte_present(&init_mm, vaddr, pte, pfn_pte(pfn, flags));
+	if (pte_val(pteval))
+		set_pte_present(&init_mm, vaddr, pte, pteval);
 	else
 		pte_clear(&init_mm, vaddr, pte);
 
@@ -150,7 +150,7 @@ static int fixmaps;
 unsigned long __FIXADDR_TOP = 0xfffff000;
 EXPORT_SYMBOL(__FIXADDR_TOP);
 
-void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
+void __native_set_fixmap(enum fixed_addresses idx, pte_t pte)
 {
 	unsigned long address = __fix_to_virt(idx);
 
@@ -158,10 +158,15 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
 		BUG();
 		return;
 	}
-	set_pte_pfn(address, phys >> PAGE_SHIFT, flags);
+	set_pte_vaddr(address, pte);
 	fixmaps++;
 }
 
+void native_set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
+{
+	__native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags));
+}
+
 /**
  * reserve_top_address - reserves a hole in the top of kernel address space
  * @reserve - size of hole to reserve
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 69a73f0..7240969 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -183,10 +183,12 @@ static void xen_cpuid(unsigned int *eax, unsigned int *ebx,
 	 * Mask out inconvenient features, to try and disable as many
 	 * unsupported kernel subsystems as possible.
 	 */
-	if (*eax == 1)
-		maskedx = ~((1 << X86_FEATURE_APIC) |  /* disable APIC */
-			    (1 << X86_FEATURE_ACPI) |  /* disable ACPI */
-			    (1 << X86_FEATURE_ACC));   /* thermal monitoring */
+	if (*eax == 1) {
+		maskedx = ~(1 << X86_FEATURE_APIC);  /* disable local APIC */
+		if (!is_initial_xendomain())
+			maskedx &= ~((1 << X86_FEATURE_ACPI) |  /* disable ACPI */
+				     (1 << X86_FEATURE_ACC));   /* thermal monitoring */
+	}
 
 	asm(XEN_EMULATE_PREFIX "cpuid"
 		: "=a" (*eax),
@@ -952,6 +954,32 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
 	return ret;
 }
 
+static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
+{
+	pte_t pte;
+
+	phys >>= PAGE_SHIFT;
+
+	switch (idx) {
+#ifdef CONFIG_X86_F00F_BUG
+	case FIX_F00F_IDT:
+#endif
+	case FIX_WP_TEST:
+	case FIX_VDSO:
+#ifdef CONFIG_X86_LOCAL_APIC
+	case FIX_APIC_BASE:	/* maps dummy local APIC */
+#endif
+		pte = pfn_pte(phys, prot);
+		break;
+
+	default:
+		pte = mfn_pte(phys, prot);
+		break;
+	}
+
+	__native_set_fixmap(idx, pte);
+}
+
 static const struct pv_info xen_info __initdata = {
 	.paravirt_enabled = 1,
 	.shared_kernel_pmd = 0,
@@ -1104,6 +1132,8 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 		.enter = paravirt_enter_lazy_mmu,
 		.leave = xen_leave_lazy,
 	},
+
+	.set_fixmap = xen_set_fixmap,
 };
 
 #ifdef CONFIG_SMP
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 0ac6c5d..2e28104 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -119,35 +119,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,
diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h
index 249e753..9ed0e25 100644
--- a/include/asm-x86/fixmap_32.h
+++ b/include/asm-x86/fixmap_32.h
@@ -98,8 +98,17 @@ enum fixed_addresses {
 	__end_of_fixed_addresses
 };
 
-extern void __set_fixmap (enum fixed_addresses idx,
-					unsigned long phys, pgprot_t flags);
+void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
+void native_set_fixmap(enum fixed_addresses idx,
+		       unsigned long phys, pgprot_t flags);
+
+#ifndef CONFIG_PARAVIRT
+static inline void __set_fixmap(enum fixed_addresses idx,
+				unsigned long phys, pgprot_t flags)
+{
+	native_set_fixmap(idx, phys, flags);
+}
+#endif
 extern void reserve_top_address(unsigned long reserve);
 
 #define set_fixmap(idx, phys) \
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index f59d370..3b9d5b7 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -240,6 +240,13 @@ struct pv_mmu_ops {
 #endif
 
 	struct pv_lazy_ops lazy_mode;
+
+	/* dom0 ops */
+
+	/* Sometimes the physical address is a pfn, and sometimes its
+	   an mfn.  We can tell which is which from the index. */
+	void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
+			   unsigned long phys, pgprot_t flags);
 };
 
 /* This contains all the paravirt structures: we get a convenient
@@ -1000,6 +1007,12 @@ static inline void arch_flush_lazy_mmu_mode(void)
 	}
 }
 
+static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
+				unsigned long phys, pgprot_t flags)
+{
+	pv_mmu_ops.set_fixmap(idx, phys, flags);
+}
+
 void _paravirt_nop(void);
 #define paravirt_nop	((void *)_paravirt_nop)
 
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index ed3e70d..6d3687d 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -483,6 +483,9 @@ do {									\
 void native_pagetable_setup_start(pgd_t *base);
 void native_pagetable_setup_done(pgd_t *base);
 
+/* Install a pte for a particular vaddr in kernel space. */
+void set_pte_vaddr(unsigned long vaddr, pte_t pte);
+
 #ifndef CONFIG_PARAVIRT
 static inline void paravirt_pagetable_setup_start(pgd_t *base)
 {
-- 
1.5.4.1


linux-2.6-0006-xen-dom0-Add-support-for-the-platform_ops-hypercall.patch:

--- NEW FILE linux-2.6-0006-xen-dom0-Add-support-for-the-platform_ops-hypercall.patch ---
>From f8db032de9275f8fd65ede35d066e07a1aa0f562 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Fri, 30 Nov 2007 15:06:30 +0000
Subject: [PATCH] xen dom0: Add support for the platform_ops hypercall

Minimal changes to get platform ops (renamed dom0_ops on pv_ops) working
on pv_ops builds.  Pulls in upstream linux-2.6.18-xen.hg's platform.h

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 include/asm-x86/xen/hypercall.h  |    9 ++
 include/xen/interface/platform.h |  232 ++++++++++++++++++++++++++++++++++++++
 include/xen/interface/xen.h      |    2 +
 3 files changed, 243 insertions(+), 0 deletions(-)
 create mode 100644 include/xen/interface/platform.h

diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index bc0ee7d..0802755 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -39,6 +39,7 @@
 #include <xen/interface/xen.h>
 #include <xen/interface/sched.h>
 #include <xen/interface/physdev.h>
+#include <xen/interface/platform.h>
 
 extern struct { char _entry[32]; } hypercall_page[];
 
@@ -184,6 +185,14 @@ HYPERVISOR_set_timer_op(u64 timeout)
 }
 
 static inline int
+HYPERVISOR_dom0_op(
+	struct xen_platform_op *platform_op)
+{
+	platform_op->interface_version = XENPF_INTERFACE_VERSION;
+	return _hypercall1(int, dom0_op, platform_op);
+}
+
+static inline int
 HYPERVISOR_set_debugreg(int reg, unsigned long value)
 {
 	return _hypercall2(int, set_debugreg, reg, value);
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
new file mode 100644
index 0000000..0e80c53
--- /dev/null
+++ b/include/xen/interface/platform.h
@@ -0,0 +1,232 @@
+/******************************************************************************
+ * platform.h
+ * 
+ * Hardware platform operations. Intended for use by domain-0 kernel.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (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.
+ *
+ * Copyright (c) 2002-2006, K Fraser
+ */
+
+#ifndef __XEN_PUBLIC_PLATFORM_H__
+#define __XEN_PUBLIC_PLATFORM_H__
+
+#include "xen.h"
+
+#define XENPF_INTERFACE_VERSION 0x03000001
+
+/*
+ * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
+ * 1 January, 1970 if the current system time was <system_time>.
+ */
+#define XENPF_settime             17
+struct xenpf_settime {
+    /* IN variables. */
+    uint32_t secs;
+    uint32_t nsecs;
+    uint64_t system_time;
+};
+typedef struct xenpf_settime xenpf_settime_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime_t);
+
+/*
+ * Request memory range (@mfn, @mfn+ at nr_mfns-1) to have type @type.
+ * On x86, @type is an architecture-defined MTRR memory type.
+ * On success, returns the MTRR that was used (@reg) and a handle that can
+ * be passed to XENPF_DEL_MEMTYPE to accurately tear down the new setting.
+ * (x86-specific).
+ */
+#define XENPF_add_memtype         31
+struct xenpf_add_memtype {
+    /* IN variables. */
+    unsigned long mfn;
+    uint64_t nr_mfns;
+    uint32_t type;
+    /* OUT variables. */
+    uint32_t handle;
+    uint32_t reg;
+};
+typedef struct xenpf_add_memtype xenpf_add_memtype_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_add_memtype_t);
+
+/*
+ * Tear down an existing memory-range type. If @handle is remembered then it
+ * should be passed in to accurately tear down the correct setting (in case
+ * of overlapping memory regions with differing types). If it is not known
+ * then @handle should be set to zero. In all cases @reg must be set.
+ * (x86-specific).
+ */
+#define XENPF_del_memtype         32
+struct xenpf_del_memtype {
+    /* IN variables. */
+    uint32_t handle;
+    uint32_t reg;
+};
+typedef struct xenpf_del_memtype xenpf_del_memtype_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_del_memtype_t);
+
+/* Read current type of an MTRR (x86-specific). */
+#define XENPF_read_memtype        33
+struct xenpf_read_memtype {
+    /* IN variables. */
+    uint32_t reg;
+    /* OUT variables. */
+    unsigned long mfn;
+    uint64_t nr_mfns;
+    uint32_t type;
+};
+typedef struct xenpf_read_memtype xenpf_read_memtype_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_read_memtype_t);
+
+#define XENPF_microcode_update    35
+struct xenpf_microcode_update {
+    /* IN variables. */
+    GUEST_HANDLE(void) data;          /* Pointer to microcode data */
+    uint32_t length;                  /* Length of microcode data. */
+};
+typedef struct xenpf_microcode_update xenpf_microcode_update_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_microcode_update_t);
+
+#define XENPF_platform_quirk      39
+#define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
+#define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
+#define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
+struct xenpf_platform_quirk {
+    /* IN variables. */
+    uint32_t quirk_id;
+};
+typedef struct xenpf_platform_quirk xenpf_platform_quirk_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
+
+#define XENPF_firmware_info       50
+#define XEN_FW_DISK_INFO          1 /* from int 13 AH=08/41/48 */
+#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
+#define XEN_FW_VBEDDC_INFO        3 /* from int 10 AX=4f15 */
+struct xenpf_firmware_info {
+    /* IN variables. */
+    uint32_t type;
+    uint32_t index;
+    /* OUT variables. */
+    union {
+        struct {
+            /* Int13, Fn48: Check Extensions Present. */
+            uint8_t device;                   /* %dl: bios device number */
+            uint8_t version;                  /* %ah: major version      */
+            uint16_t interface_support;       /* %cx: support bitmap     */
+            /* Int13, Fn08: Legacy Get Device Parameters. */
+            uint16_t legacy_max_cylinder;     /* %cl[7:6]:%ch: max cyl # */
+            uint8_t legacy_max_head;          /* %dh: max head #         */
+            uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector #  */
+            /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
+            /* NB. First uint16_t of buffer must be set to buffer size.      */
+            GUEST_HANDLE(void) edd_params;
+        } disk_info; /* XEN_FW_DISK_INFO */
+        struct {
+            uint8_t device;                   /* bios device number  */
+            uint32_t mbr_signature;           /* offset 0x1b8 in mbr */
+        } disk_mbr_signature; /* XEN_FW_DISK_MBR_SIGNATURE */
+        struct {
+            /* Int10, AX=4F15: Get EDID info. */
+            uint8_t capabilities;
+            uint8_t edid_transfer_time;
+            /* must refer to 128-byte buffer */
+            GUEST_HANDLE(uchar) edid;
+        } vbeddc_info; /* XEN_FW_VBEDDC_INFO */
+    } u;
+};
+typedef struct xenpf_firmware_info xenpf_firmware_info_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
+
+#define XENPF_enter_acpi_sleep    51
+struct xenpf_enter_acpi_sleep {
+    /* IN variables */
+    uint16_t pm1a_cnt_val;      /* PM1a control value. */
+    uint16_t pm1b_cnt_val;      /* PM1b control value. */
+    uint32_t sleep_state;       /* Which state to enter (Sn). */
+    uint32_t flags;             /* Must be zero. */
+};
+typedef struct xenpf_enter_acpi_sleep xenpf_enter_acpi_sleep_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
+
+#define XENPF_change_freq         52
+struct xenpf_change_freq {
+    /* IN variables */
+    uint32_t flags; /* Must be zero. */
+    uint32_t cpu;   /* Physical cpu. */
+    uint64_t freq;  /* New frequency (Hz). */
+};
+typedef struct xenpf_change_freq xenpf_change_freq_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_change_freq_t);
+
+/*
+ * Get idle times (nanoseconds since boot) for physical CPUs specified in the
+ * @cpumap_bitmap with range [0.. at cpumap_nr_cpus-1]. The @idletime array is
+ * indexed by CPU number; only entries with the corresponding @cpumap_bitmap
+ * bit set are written to. On return, @cpumap_bitmap is modified so that any
+ * non-existent CPUs are cleared. Such CPUs have their @idletime array entry
+ * cleared.
+ */
+#define XENPF_getidletime         53
+struct xenpf_getidletime {
+    /* IN/OUT variables */
+    /* IN: CPUs to interrogate; OUT: subset of IN which are present */
+    GUEST_HANDLE(uchar) cpumap_bitmap;
+    /* IN variables */
+    /* Size of cpumap bitmap. */
+    uint32_t cpumap_nr_cpus;
+    /* Must be indexable for every cpu in cpumap_bitmap. */
+    GUEST_HANDLE(uint64_t) idletime;
+    /* OUT variables */
+    /* System time when the idletime snapshots were taken. */
+    uint64_t now;
+};
+typedef struct xenpf_getidletime xenpf_getidletime_t;
+DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t);
+
+struct xen_platform_op {
+    uint32_t cmd;
+    uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
+    union {
+        struct xenpf_settime           settime;
+        struct xenpf_add_memtype       add_memtype;
+        struct xenpf_del_memtype       del_memtype;
+        struct xenpf_read_memtype      read_memtype;
+        struct xenpf_microcode_update  microcode;
+        struct xenpf_platform_quirk    platform_quirk;
+        struct xenpf_firmware_info     firmware_info;
+        struct xenpf_enter_acpi_sleep  enter_acpi_sleep;
+        struct xenpf_change_freq       change_freq;
+        struct xenpf_getidletime       getidletime;
+        uint8_t                        pad[128];
+    } u;
+};
+typedef struct xen_platform_op xen_platform_op_t;
+DEFINE_GUEST_HANDLE_STRUCT(xen_platform_op_t);
+
+#endif /* __XEN_PUBLIC_PLATFORM_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 518a5bf..5f12e21 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -437,6 +437,8 @@ typedef uint8_t xen_domain_handle_t[16];
 #define __mk_unsigned_long(x) x ## UL
 #define mk_unsigned_long(x) __mk_unsigned_long(x)
 
+DEFINE_GUEST_HANDLE(uint64_t);
+
 #else /* __ASSEMBLY__ */
 
 /* In assembly code we cannot use C numeric constant suffixes. */
-- 
1.5.4.1


linux-2.6-0007-xen-acpi-Enable-early-access-to-ACPI-tables.patch:

--- NEW FILE linux-2.6-0007-xen-acpi-Enable-early-access-to-ACPI-tables.patch ---
>From db0d4ab042b1c3585f5e788a4355309d364e634f Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Fri, 7 Dec 2007 11:39:27 +0000
Subject: [PATCH] xen acpi: Enable early access to ACPI tables.

Always use the fixmap remapping to remap ACPI tables during boot in
__acpi_map_table.  Tables which are identity-mapped on baremetal may
not be on Xen.

Add xen-specific logic to detect when ioremap is being called on local
RAM.

Use isa_bus_to_virt on ISA regions for consistency with the fixmap code
Use is_local_lowmem() to test for local non-highmem pages in a Xen-
compatible way.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/acpi/boot.c |   34 +++++++++++++++-------------------
 arch/x86/mm/ioremap_32.c    |   34 ++++++++++++++++++++++++++--------
 2 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 0ca27c7..e59bda5 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -40,6 +40,8 @@
 #include <asm/io.h>
 #include <asm/mpspec.h>
 
+#include <asm/xen/hypervisor.h>
+
 static int __initdata acpi_force = 0;
 
 #ifdef	CONFIG_ACPI
@@ -103,22 +105,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
  */
 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
 
-#ifdef	CONFIG_X86_64
-
-/* rely on all ACPI tables being in the direct mapping */
-char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
-{
-	if (!phys_addr || !size)
-		return NULL;
-
-	if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE)
-		return __va(phys_addr);
-
-	return NULL;
-}
-
-#else
-
 /*
  * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
  * to map the target physical address. The problem is that set_fixmap()
@@ -136,8 +122,19 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
 	unsigned long base, offset, mapped_size;
 	int idx;
 
-	if (phys + size < 8 * 1024 * 1024)
-		return __va(phys);
+	if (!phys || !size)
+		return NULL;
+
+	if (!is_running_on_xen()) {
+#ifdef	CONFIG_X86_64
+		/* rely on all ACPI tables being in the direct mapping */
+		if (phys+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE)
+			return __va(phys);
+#else
+		if (phys + size < 8 * 1024 * 1024)
+			return __va(phys);
+#endif
+	}
 
 	offset = phys & (PAGE_SIZE - 1);
 	mapped_size = PAGE_SIZE - offset;
@@ -158,7 +155,6 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
 
 	return ((unsigned char *)base + offset);
 }
-#endif
 
 #ifdef CONFIG_PCI_MMCONFIG
 /* The physical address of the MMCONFIG aperture.  Set from ACPI tables. */
diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c
index 63a301a..b4e71f4 100644
--- a/arch/x86/mm/ioremap_32.c
+++ b/arch/x86/mm/ioremap_32.c
@@ -18,6 +18,9 @@
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
 
+#include <asm/xen/hypervisor.h>
+#include <xen/page.h>
+
 /*
  * Generic mapping function (not visible outside):
  */
@@ -31,6 +34,21 @@
  * have to convert them into an offset in a page-aligned mapping, but the
  * caller shouldn't need to know that small detail.
  */
+/*
+ * Does @address reside within a non-highmem page that is local to this virtual
+ * machine (i.e., not an I/O page, nor a memory page belonging to another VM).
+ * See the comment that accompanies mfn_to_local_pfn() in page.h to understand
+ * why this works.
+ */
+static inline int is_local_lowmem(unsigned long address)
+{
+	extern unsigned long max_low_pfn;
+	if (is_running_on_xen())
+		return (mfn_to_local_pfn(address >> PAGE_SHIFT) < max_low_pfn);
+	else
+		return (address <= virt_to_phys(high_memory - 1));
+}
+
 void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
 {
 	void __iomem * addr;
@@ -47,12 +65,12 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
 	 * Don't remap the low PCI/ISA area, it's always mapped..
 	 */
 	if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
-		return (void __iomem *) phys_to_virt(phys_addr);
+		return (void __iomem *) isa_bus_to_virt(phys_addr);
 
 	/*
 	 * Don't allow anybody to remap normal RAM that we're using..
 	 */
-	if (phys_addr <= virt_to_phys(high_memory - 1)) {
+	if (is_local_lowmem(phys_addr)) {
 		char *t_addr, *t_end;
 		struct page *page;
 
@@ -123,8 +141,8 @@ void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
 	/* Guaranteed to be > phys_addr, as per __ioremap() */
 	last_addr = phys_addr + size - 1;
 
-	if (last_addr < virt_to_phys(high_memory) - 1) {
-		struct page *ppage = virt_to_page(__va(phys_addr));		
+	if (is_local_lowmem(last_addr)) {
+		struct page *ppage = virt_to_page(bus_to_virt(phys_addr));
 		unsigned long npages;
 
 		phys_addr &= PAGE_MASK;
@@ -166,8 +184,8 @@ void iounmap(volatile void __iomem *addr)
 	 * vm_area and by simply returning an address into the kernel mapping
 	 * of ISA space.   So handle that here.
 	 */
-	if (addr >= phys_to_virt(ISA_START_ADDRESS) &&
-			addr < phys_to_virt(ISA_END_ADDRESS))
+	if (addr >= isa_bus_to_virt(ISA_START_ADDRESS) &&
+			addr < isa_bus_to_virt(ISA_END_ADDRESS))
 		return;
 
 	addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr);
@@ -191,8 +209,8 @@ void iounmap(volatile void __iomem *addr)
 	}
 
 	/* Reset the direct mapping. Can block */
-	if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) {
-		change_page_attr(virt_to_page(__va(p->phys_addr)),
+	if ((p->flags >> 20) && is_local_lowmem(p->phys_addr)) {
+		change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)),
 				 get_vm_area_size(p) >> PAGE_SHIFT,
 				 PAGE_KERNEL);
 		global_flush_tlb();
-- 
1.5.4.1


linux-2.6-0008-xen-dom0-Add-paravirt_ops-ioremap_page_range-for.patch:

--- NEW FILE linux-2.6-0008-xen-dom0-Add-paravirt_ops-ioremap_page_range-for.patch ---
>From 13d626b80c3668757421f6206f2006e0f49ac7fe Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Fri, 7 Dec 2007 15:27:21 +0000
Subject: [PATCH] xen dom0: Add paravirt_ops ioremap_page_range() for Xen.

Adds a new pv_mmu_ops field for ioremap_page_range, and the necessary
pv-ops plumbing to connect to lib/ioremap.c's default implementation on
baremetal while still getting xen's hypercall-based implementation when
necessary.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/paravirt_32.c |    1 +
 arch/x86/mm/pgtable_32.c      |    7 ++
 arch/x86/xen/Makefile         |    2 +-
 arch/x86/xen/enlighten.c      |    1 +
 arch/x86/xen/ioremap.c        |  147 +++++++++++++++++++++++++++++++++++++++++
 arch/x86/xen/mmu.h            |    3 +
 include/asm-x86/fixmap_32.h   |    2 +
 include/asm-x86/paravirt.h    |   10 +++
 include/linux/io.h            |   12 ++-
 lib/ioremap.c                 |    4 +-
 10 files changed, 182 insertions(+), 7 deletions(-)
 create mode 100644 arch/x86/xen/ioremap.c

diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index 9fc62c2..e578f14 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -464,6 +464,7 @@ struct pv_mmu_ops pv_mmu_ops = {
 	},
 
 	.set_fixmap = native_set_fixmap,
+	.ioremap_page_range = native_ioremap_page_range,
 };
 
 EXPORT_SYMBOL_GPL(pv_time_ops);
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 8892aad..d1ca199 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -15,6 +15,7 @@
 #include <linux/spinlock.h>
 #include <linux/module.h>
 #include <linux/quicklist.h>
+#include <linux/io.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -167,6 +168,12 @@ void native_set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t fl
 	__native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags));
 }
 
+int native_ioremap_page_range(unsigned long addr, unsigned long end,
+			       unsigned long phys_addr, pgprot_t prot)
+{
+	return __ioremap_page_range(addr, end, phys_addr, prot);
+}
+
 /**
  * reserve_top_address - reserves a hole in the top of kernel address space
  * @reserve - size of hole to reserve
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 343df24..7ef9e01 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -1,4 +1,4 @@
 obj-y		:= enlighten.o setup.o features.o multicalls.o mmu.o \
-			events.o time.o manage.o xen-asm.o
+			events.o time.o manage.o xen-asm.o ioremap.o
 
 obj-$(CONFIG_SMP)	+= smp.o
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 7240969..b84f57b 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1134,6 +1134,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
 	},
 
 	.set_fixmap = xen_set_fixmap,
+	.ioremap_page_range = xen_ioremap_page_range,
 };
 
 #ifdef CONFIG_SMP
diff --git a/arch/x86/xen/ioremap.c b/arch/x86/xen/ioremap.c
new file mode 100644
index 0000000..4cbbca2
--- /dev/null
+++ b/arch/x86/xen/ioremap.c
@@ -0,0 +1,147 @@
+/*
+ * arch/x86/xen/ioremap.c
+ *
+ * Xen-specific paravirt-ops routines to support re-mapping IO memory
+ * to kernel address space so that we can access it within a Xen privileged
+ * domain.
+ *
+ * (C) Copyright 1995 1996 Linus Torvalds
+ */
+
+#include <linux/vmalloc.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/io.h>
+
+#include <asm/fixmap.h>
+#include <asm/cacheflush.h>
+#include <asm/tlbflush.h>
+#include <asm/pgtable.h>
+#include <asm/pgalloc.h>
+
+#include <asm/xen/hypercall.h>
+#include <xen/page.h>
+
+static int direct_remap_area_pte_fn(pte_t *pte, 
+				    struct page *pmd_page,
+				    unsigned long address, 
+				    void *data)
+{
+	struct mmu_update **v = (struct mmu_update **)data;
+
+	BUG_ON(!pte_none(*pte));
+
+	(*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pmd_page)) <<
+		     PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK);
+	(*v)++;
+
+	return 0;
+}
+
+static int __direct_remap_pfn_range(struct mm_struct *mm,
+				    unsigned long address, 
+				    unsigned long mfn,
+				    unsigned long size, 
+				    pgprot_t prot,
+				    domid_t  domid)
+{
+	int rc;
+	unsigned long i, start_address;
+	struct mmu_update *u, *v, *w;
+
+	u = v = w = (struct mmu_update *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
+	if (u == NULL)
+		return -ENOMEM;
+
+	start_address = address;
+
+	flush_cache_all();
+
+	for (i = 0; i < size; i += PAGE_SIZE) {
+		if ((v - u) == (PAGE_SIZE / sizeof(struct mmu_update))) {
+			/* Flush a full batch after filling in the PTE ptrs. */
+			rc = apply_to_page_range(mm, start_address, 
+						 address - start_address,
+						 direct_remap_area_pte_fn, &w);
+			if (rc)
+				goto out;
+			rc = -EFAULT;
+			if (HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0)
+				goto out;
+			v = w = u;
+			start_address = address;
+		}
+
+		/*
+		 * Fill in the machine address: PTE ptr is done later by
+		 * apply_to_page_range(). 
+		 */
+		v->val = pte_val_ma(mfn_pte(mfn, prot));
+
+		mfn++;
+		address += PAGE_SIZE; 
+		v++;
+	}
+
+	if (v != u) {
+		/* Final batch. */
+		rc = apply_to_page_range(mm, start_address,
+					 address - start_address,
+					 direct_remap_area_pte_fn, &w);
+		if (rc)
+			goto out;
+		rc = -EFAULT;
+		if (unlikely(HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0))
+			goto out;
+	}
+
+	rc = 0;
+
+ out:
+	flush_tlb_all();
+
+	free_page((unsigned long)u);
+
+	return rc;
+}
+
+/*
+ * Does @address reside within a non-highmem page that is local to this virtual
+ * machine (i.e., not an I/O page, nor a memory page belonging to another VM).
+ * See the comment that accompanies mfn_to_local_pfn() in page.h to understand
+ * why this works.
+ */
+static inline int is_local_lowmem(unsigned long address)
+{
+	extern unsigned long max_low_pfn;
+	return (mfn_to_local_pfn(address >> PAGE_SHIFT) < max_low_pfn);
+}
+
+/*
+ * Remap an arbitrary physical address space into the kernel virtual
+ * address space. Needed when the kernel wants to access high addresses
+ * directly.
+ *
+ * NOTE! We need to allow non-page-aligned mappings too: we will obviously
+ * have to convert them into an offset in a page-aligned mapping, but the
+ * caller shouldn't need to know that small detail.
+ */
+int xen_ioremap_page_range(unsigned long addr, unsigned long end,
+			   unsigned long phys_addr, pgprot_t prot)
+{
+	domid_t domid = DOMID_IO;
+	int rc;
+
+	if (is_local_lowmem(phys_addr))
+		domid = DOMID_SELF;
+
+	rc = __direct_remap_pfn_range(&init_mm, (unsigned long)addr,
+				      phys_addr>>PAGE_SHIFT,
+				      end-addr, prot, domid);
+	
+	if (rc)
+		vunmap((void __force *) addr);
+	return rc;
+}
+
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index c9ff27f..8594c92 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -57,4 +57,7 @@ pmd_t xen_make_pmd(unsigned long);
 pgd_t xen_make_pgd(unsigned long);
 #endif
 
+extern int xen_ioremap_page_range(unsigned long addr, unsigned long end,
+				  unsigned long phys_addr, pgprot_t prot);
+
 #endif	/* _XEN_MMU_H */
diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h
index 9ed0e25..4517c72 100644
--- a/include/asm-x86/fixmap_32.h
+++ b/include/asm-x86/fixmap_32.h
@@ -101,6 +101,8 @@ enum fixed_addresses {
 void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
 void native_set_fixmap(enum fixed_addresses idx,
 		       unsigned long phys, pgprot_t flags);
+int native_ioremap_page_range(unsigned long addr, unsigned long end,
+			      unsigned long phys_addr, pgprot_t prot);
 
 #ifndef CONFIG_PARAVIRT
 static inline void __set_fixmap(enum fixed_addresses idx,
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 3b9d5b7..fd17cf4 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -247,6 +247,9 @@ struct pv_mmu_ops {
 	   an mfn.  We can tell which is which from the index. */
 	void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
 			   unsigned long phys, pgprot_t flags);
+	int (*ioremap_page_range)(unsigned long addr, unsigned long end, 
+				  unsigned long phys_addr, pgprot_t prot);
+	
 };
 
 /* This contains all the paravirt structures: we get a convenient
@@ -1013,6 +1016,13 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
 	pv_mmu_ops.set_fixmap(idx, phys, flags);
 }
 
+#define  __HAVE_ARCH_IOREMAP_PAGE_RANGE
+static inline int ioremap_page_range(unsigned long addr, unsigned long end, 
+				     unsigned long phys_addr, pgprot_t prot)
+{
+	return pv_mmu_ops.ioremap_page_range(addr, end, phys_addr, prot);
+}
+
 void _paravirt_nop(void);
 #define paravirt_nop	((void *)_paravirt_nop)
 
diff --git a/include/linux/io.h b/include/linux/io.h
index e3b2dda..b8abe3d 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -28,16 +28,20 @@ void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
 void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
 
 #ifdef CONFIG_MMU
-int ioremap_page_range(unsigned long addr, unsigned long end,
-		       unsigned long phys_addr, pgprot_t prot);
+int __ioremap_page_range(unsigned long addr, unsigned long end,
+			 unsigned long phys_addr, pgprot_t prot);
 #else
-static inline int ioremap_page_range(unsigned long addr, unsigned long end,
-				     unsigned long phys_addr, pgprot_t prot)
+static inline int __ioremap_page_range(unsigned long addr, unsigned long end,
+				       unsigned long phys_addr, pgprot_t prot)
 {
 	return 0;
 }
 #endif
 
+#ifndef __HAVE_ARCH_IOREMAP_PAGE_RANGE
+#define ioremap_page_range __ioremap_page_range
+#endif
+
 /*
  * Managed iomap interface
  */
diff --git a/lib/ioremap.c b/lib/ioremap.c
index 14c6078..4106cb0 100644
--- a/lib/ioremap.c
+++ b/lib/ioremap.c
@@ -66,8 +66,8 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
 	return 0;
 }
 
-int ioremap_page_range(unsigned long addr,
-		       unsigned long end, unsigned long phys_addr, pgprot_t prot)
+int __ioremap_page_range(unsigned long addr, unsigned long end, 
+			 unsigned long phys_addr, pgprot_t prot)
 {
 	pgd_t *pgd;
 	unsigned long start;
-- 
1.5.4.1


linux-2.6-0009-MTRR-use-cpu_callout_map-instead-of-cpu_online_map.patch:

--- NEW FILE linux-2.6-0009-MTRR-use-cpu_callout_map-instead-of-cpu_online_map.patch ---
>From aa1ebf6fb1281589541682a4dbaafcf048695141 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Wed, 30 Jan 2008 13:25:36 +0000
Subject: [PATCH] MTRR: use cpu_callout_map instead of cpu_online_map

During mtrr_restore() only the BP is set in cpu_online_map,
so we need to use cpu_callout_map as a map of CPUs on which
to restore the MTRRs.

The code already uses num_booting_cpus() for this reason, but
it then sends IPIs to the CPUs in cpu_online_map rather than
cpu_callout_map.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 3b20613..4662ba3 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -232,7 +232,7 @@ static void set_mtrr(unsigned int reg, unsigned long base,
 	atomic_set(&data.gate,0);
 
 	/*  Start the ball rolling on other CPUs  */
-	if (smp_call_function(ipi_handler, &data, 1, 0) != 0)
+	if (smp_call_function_mask(cpu_callout_map, ipi_handler, &data, 0) != 0)
 		panic("mtrr: timed out waiting for other CPUs\n");
 
 	local_irq_save(flags);
-- 
1.5.4.1


linux-2.6-0010-xen-mtrr-Add-mtrr_ops-support-for-Xen-mtrr.patch:

--- NEW FILE linux-2.6-0010-xen-mtrr-Add-mtrr_ops-support-for-Xen-mtrr.patch ---
>From 75ca621fd427a007e4b9117e3e3bd3dc89f23567 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 10 Dec 2007 11:32:15 +0000
Subject: [PATCH] xen mtrr: Add mtrr_ops support for Xen mtrr

Add a Xen mtrr type, and reorganise mtrr initialisation slightly to allow the
mtrr driver to set up num_var_ranges (Xen needs to do this by querying the
hypervisor itself.)

Only the boot path is handled for now: we set up a xen-specific mtrr_if
and set up the mtrr tables based on hypervisor information, but we don't
yet handle mtrr entry add/delete.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/Makefile |    1 +
 arch/x86/kernel/cpu/mtrr/main.c   |   30 ++++++++++++++++---
 arch/x86/kernel/cpu/mtrr/xen.c    |   57 +++++++++++++++++++++++++++++++++++++
 3 files changed, 83 insertions(+), 5 deletions(-)
 create mode 100644 arch/x86/kernel/cpu/mtrr/xen.c

diff --git a/arch/x86/kernel/cpu/mtrr/Makefile b/arch/x86/kernel/cpu/mtrr/Makefile
index 191fc05..81db513 100644
--- a/arch/x86/kernel/cpu/mtrr/Makefile
+++ b/arch/x86/kernel/cpu/mtrr/Makefile
@@ -1,3 +1,4 @@
 obj-y		:= main.o if.o generic.o state.o
 obj-$(CONFIG_X86_32) += amd.o cyrix.o centaur.o
+obj-$(CONFIG_XEN) += xen.o
 
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 4662ba3..c5e0578 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -572,6 +572,7 @@ EXPORT_SYMBOL(mtrr_del);
 extern void amd_init_mtrr(void);
 extern void cyrix_init_mtrr(void);
 extern void centaur_init_mtrr(void);
+extern void xen_init_mtrr(void);
 
 static void __init init_ifs(void)
 {
@@ -580,6 +581,9 @@ static void __init init_ifs(void)
 	cyrix_init_mtrr();
 	centaur_init_mtrr();
 #endif
+#ifdef CONFIG_XEN
+	xen_init_mtrr();
+#endif
 }
 
 /* The suspend/resume methods are only for CPU without MTRR. CPU using generic
@@ -635,16 +639,14 @@ static struct sysdev_driver mtrr_sysdev_driver = {
 
 
 /**
- * mtrr_bp_init - initialize mtrrs on the boot CPU
+ * mtrr_bp_detect - detect mtrr hardware on the boot CPU
  *
  * This needs to be called early; before any of the other CPUs are 
  * initialized (i.e. before smp_init()).
  * 
  */
-void __init mtrr_bp_init(void)
+static void __init mtrr_bp_detect(void)
 {
-	init_ifs();
-
 	if (cpu_has_mtrr) {
 		mtrr_if = &generic_mtrr_ops;
 		size_or_mask = 0xff000000;	/* 36 bits */
@@ -701,9 +703,27 @@ void __init mtrr_bp_init(void)
 			break;
 		}
 	}
+}
+
+/**
+ * mtrr_bp_init - initialize mtrrs on the boot CPU
+ *
+ * This needs to be called early; before any of the other CPUs are 
+ * initialized (i.e. before smp_init()).
+ * 
+ */
+void __init mtrr_bp_init(void)
+{
+	init_ifs();
+
+	if (!mtrr_if)
+		mtrr_bp_detect();
 
 	if (mtrr_if) {
-		set_num_var_ranges();
+		/* Xen pv_ops will set the mtrr CPU to unknown, but will
+		 * also initialise the num_var_ranges for us */
+		if (!is_cpu(UNKNOWN))
+			set_num_var_ranges();
 		init_table();
 		if (use_intel())
 			get_mtrr_state();
diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
new file mode 100644
index 0000000..7011195
--- /dev/null
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -0,0 +1,57 @@
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/ctype.h>
+#include <linux/module.h>
+#include <linux/seq_file.h>
+#include <asm/uaccess.h>
+#include <linux/mutex.h>
+
+#include <asm/mtrr.h>
+#include "mtrr.h"
+
+#include <xen/interface/platform.h>
+#include <asm/xen/hypervisor.h>
+#include <asm/xen/hypercall.h>
+
+/* DOM0 TODO: Need to fill in the remaining mtrr methods to have full
+ * working userland mtrr support. */
+static struct mtrr_ops xen_mtrr_ops = {
+	.vendor            = X86_VENDOR_UNKNOWN,
+//	.set               = xen_set_mtrr,
+//	.get               = xen_get_mtrr,
+	.get_free_region   = generic_get_free_region,
+//	.validate_add_page = xen_validate_add_page,
+	.have_wrcomb       = positive_have_wrcomb,
+	.use_intel_if	   = 0
+};
+
+static int __init xen_num_var_ranges(void)
+{
+	int ranges;
+	struct xen_platform_op op;
+
+	for (ranges = 0; ; ranges++) {
+		op.cmd = XENPF_read_memtype;
+		op.u.read_memtype.reg = ranges;
+		if (HYPERVISOR_dom0_op(&op) != 0)
+			break;
+	}
+	return ranges;
+}
+
+void __init xen_init_mtrr(void)
+{
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+
+	if (!is_initial_xendomain())
+		return;
+
+	if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
+	    (!cpu_has(c, X86_FEATURE_K6_MTRR)) &&
+	    (!cpu_has(c, X86_FEATURE_CYRIX_ARR)) &&
+	    (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
+		return;
+
+	mtrr_if = &xen_mtrr_ops;
+	num_var_ranges = xen_num_var_ranges();
+}
-- 
1.5.4.1


linux-2.6-0011-xen-mtrr-Don-t-enable-xen-mtrr-on-bare-metal.patch:

--- NEW FILE linux-2.6-0011-xen-mtrr-Don-t-enable-xen-mtrr-on-bare-metal.patch ---
>From 514160c53a50854b774ade0621c03693dbbee961 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Wed, 12 Dec 2007 14:31:16 +0000
Subject: [PATCH] xen mtrr: Don't enable xen mtrr on bare metal

is_initial_xendomain() doesn't return valid results unless we're running
on Xen, so it's not a sufficient test for a Xen dom0 on its own: we need
to test separately for is_running_on_xen() first.  Without that, we end
up setting xen mtrr behaviour on baremetal systems.

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

diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
index 7011195..4ee9a0f 100644
--- a/arch/x86/kernel/cpu/mtrr/xen.c
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -43,7 +43,7 @@ void __init xen_init_mtrr(void)
 {
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
-	if (!is_initial_xendomain())
+	if (!is_running_on_xen() || !is_initial_xendomain())
 		return;
 
 	if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
-- 
1.5.4.1


linux-2.6-0012-xen-mtrr-set-cpu-in-cpu_callout_map.patch:

--- NEW FILE linux-2.6-0012-xen-mtrr-set-cpu-in-cpu_callout_map.patch ---
>From 2117cdc21eebec01e0aaa592136a8845886d31f8 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Wed, 30 Jan 2008 13:18:23 +0000
Subject: [PATCH] xen mtrr: set cpu in cpu_callout_map

The MTRR code uses num_booting_cpus() so make Xen
update cpu_callout_map as it brings cpus up.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/smp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index c1b131b..e731309 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -198,6 +198,7 @@ void __init xen_smp_prepare_cpus(unsigned int max_cpus)
 		if (IS_ERR(idle))
 			panic("failed fork for CPU %d", cpu);
 
+		cpu_set(cpu, cpu_callout_map);
 		cpu_set(cpu, cpu_present_map);
 	}
 
-- 
1.5.4.1


linux-2.6-0013-xen-mtrr-Clean-up-the-num_var_ranges-CPU_UNKOWN-hac.patch:

--- NEW FILE linux-2.6-0013-xen-mtrr-Clean-up-the-num_var_ranges-CPU_UNKOWN-hac.patch ---
>From d79941eb28132b96b50cd3e7d37c38e667551878 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 28 Jan 2008 18:55:06 +0000
Subject: [PATCH] xen mtrr: Clean up the num_var_ranges/CPU_UNKOWN hack

Move the CPU_UNKNOWN hack into set_var_num_ranges()
and only enable it with CONFIG_XEN

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/main.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index c5e0578..3ac6ed8 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -107,6 +107,14 @@ static void __init set_num_var_ranges(void)
 {
 	unsigned long config = 0, dummy;
 
+#ifdef CONFIG_XEN
+	/* Xen pv_ops will set the mtrr CPU to unknown, but will
+	 * also initialise the num_var_ranges for us
+	 */
+	if (is_cpu(UNKNOWN))
+		return;
+#endif
+
 	if (use_intel()) {
 		rdmsr(MTRRcap_MSR, config, dummy);
 	} else if (is_cpu(AMD))
@@ -720,10 +728,7 @@ void __init mtrr_bp_init(void)
 		mtrr_bp_detect();
 
 	if (mtrr_if) {
-		/* Xen pv_ops will set the mtrr CPU to unknown, but will
-		 * also initialise the num_var_ranges for us */
-		if (!is_cpu(UNKNOWN))
-			set_num_var_ranges();
+		set_num_var_ranges();
 		init_table();
 		if (use_intel())
 			get_mtrr_state();
-- 
1.5.4.1


linux-2.6-0014-xen-mtrr-Use-specific-cpu_has_foo-macros-instead-of.patch:

--- NEW FILE linux-2.6-0014-xen-mtrr-Use-specific-cpu_has_foo-macros-instead-of.patch ---
>From a658c6d3c92f86e2789d2ac0ce9197ad76879cb7 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 28 Jan 2008 18:40:06 +0000
Subject: [PATCH] xen mtrr: Use specific cpu_has_foo macros instead of generic cpu_has()

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/xen.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
index 4ee9a0f..a693a63 100644
--- a/arch/x86/kernel/cpu/mtrr/xen.c
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -41,15 +41,13 @@ static int __init xen_num_var_ranges(void)
 
 void __init xen_init_mtrr(void)
 {
-	struct cpuinfo_x86 *c = &boot_cpu_data;
-
 	if (!is_running_on_xen() || !is_initial_xendomain())
 		return;
 
-	if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
-	    (!cpu_has(c, X86_FEATURE_K6_MTRR)) &&
-	    (!cpu_has(c, X86_FEATURE_CYRIX_ARR)) &&
-	    (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
+	if (!cpu_has_mtrr &&
+	    !cpu_has_k6_mtrr &&
+	    !cpu_has_cyrix_arr &&
+	    !cpu_has_centaur_mcr)
 		return;
 
 	mtrr_if = &xen_mtrr_ops;
-- 
1.5.4.1


linux-2.6-0015-xen-mtrr-Kill-some-unneccessary-includes.patch:

--- NEW FILE linux-2.6-0015-xen-mtrr-Kill-some-unneccessary-includes.patch ---
>From 7f0aef7d0e4883c19002ca52f1766df4713de1f4 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 28 Jan 2008 19:05:11 +0000
Subject: [PATCH] xen mtrr: Kill some unneccessary includes

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/xen.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
index a693a63..d1197ff 100644
--- a/arch/x86/kernel/cpu/mtrr/xen.c
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -1,12 +1,6 @@
 #include <linux/init.h>
-#include <linux/proc_fs.h>
-#include <linux/ctype.h>
-#include <linux/module.h>
-#include <linux/seq_file.h>
-#include <asm/uaccess.h>
-#include <linux/mutex.h>
-
-#include <asm/mtrr.h>
+#include <linux/mm.h>
+
 #include "mtrr.h"
 
 #include <xen/interface/platform.h>
-- 
1.5.4.1


linux-2.6-0016-xen-mtrr-No-need-to-explicitly-set-use_intel_if-0.patch:

--- NEW FILE linux-2.6-0016-xen-mtrr-No-need-to-explicitly-set-use_intel_if-0.patch ---
>From acaa2ebcc82e41a5e7adb9ec6223aa96f6d7a246 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 28 Jan 2008 18:39:29 +0000
Subject: [PATCH] xen mtrr: No need to explicitly set use_intel_if = 0

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/xen.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
index d1197ff..726d6ac 100644
--- a/arch/x86/kernel/cpu/mtrr/xen.c
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -16,7 +16,6 @@ static struct mtrr_ops xen_mtrr_ops = {
 	.get_free_region   = generic_get_free_region,
 //	.validate_add_page = xen_validate_add_page,
 	.have_wrcomb       = positive_have_wrcomb,
-	.use_intel_if	   = 0
 };
 
 static int __init xen_num_var_ranges(void)
-- 
1.5.4.1


linux-2.6-0017-xen-mtrr-Use-generic_validate_add_page.patch:

--- NEW FILE linux-2.6-0017-xen-mtrr-Use-generic_validate_add_page.patch ---
>From 80001f5436ec01d4e0291c2e2bc499c7a92a0608 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Tue, 29 Jan 2008 17:43:25 +0000
Subject: [PATCH] xen mtrr: Use generic_validate_add_page()

The hypervisor already performs the same validation, but
better to do it early before getting to the range combining
code.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/xen.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
index 726d6ac..eff6fd7 100644
--- a/arch/x86/kernel/cpu/mtrr/xen.c
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -14,7 +14,7 @@ static struct mtrr_ops xen_mtrr_ops = {
 //	.set               = xen_set_mtrr,
 //	.get               = xen_get_mtrr,
 	.get_free_region   = generic_get_free_region,
-//	.validate_add_page = xen_validate_add_page,
+	.validate_add_page = generic_validate_add_page,
 	.have_wrcomb       = positive_have_wrcomb,
 };
 
-- 
1.5.4.1


linux-2.6-0018-xen-mtrr-Implement-xen_get_free_region.patch:

--- NEW FILE linux-2.6-0018-xen-mtrr-Implement-xen_get_free_region.patch ---
>From 8f789415ce84a9619dc6c0193217b1a659ac19f7 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Wed, 30 Jan 2008 09:40:33 +0000
Subject: [PATCH] xen mtrr: Implement xen_get_free_region()

When an already set MTRR is being changed, we need to
first unset, since Xen also maintains a usage count.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/xen.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
index eff6fd7..6998e00 100644
--- a/arch/x86/kernel/cpu/mtrr/xen.c
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -7,13 +7,38 @@
 #include <asm/xen/hypervisor.h>
 #include <asm/xen/hypercall.h>
 
+static int xen_get_free_region(unsigned long base, unsigned long size, int replace_reg)
+{
+	struct xen_platform_op op;
+	int error;
+
+	if (replace_reg < 0)
+		return generic_get_free_region(base, size, -1);
+
+	/* If we're replacing the contents of a register,
+	 * we need to first unset it since Xen also keeps
+	 * a usage count.
+	 */
+	op.cmd = XENPF_del_memtype;
+	op.u.del_memtype.handle = 0;
+	op.u.del_memtype.reg    = replace_reg;
+
+	error = HYPERVISOR_dom0_op(&op);
+	if (error) {
+		BUG_ON(error > 0);
+		return error;
+	}
+
+	return replace_reg;
+}
+
 /* DOM0 TODO: Need to fill in the remaining mtrr methods to have full
  * working userland mtrr support. */
 static struct mtrr_ops xen_mtrr_ops = {
 	.vendor            = X86_VENDOR_UNKNOWN,
 //	.set               = xen_set_mtrr,
 //	.get               = xen_get_mtrr,
-	.get_free_region   = generic_get_free_region,
+	.get_free_region   = xen_get_free_region,
 	.validate_add_page = generic_validate_add_page,
 	.have_wrcomb       = positive_have_wrcomb,
 };
-- 
1.5.4.1


linux-2.6-0019-xen-mtrr-Add-xen_-get-set-_mtrr-implementations.patch:

--- NEW FILE linux-2.6-0019-xen-mtrr-Add-xen_-get-set-_mtrr-implementations.patch ---
>From bad9371466c166f7339a6813ecc9a4619fe720ea Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Tue, 29 Jan 2008 18:29:46 +0000
Subject: [PATCH] xen mtrr: Add xen_{get,set}_mtrr() implementations

Straightforward apart from the hack to turn mtrr_ops->set()
into a no-op on all but one CPU.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/kernel/cpu/mtrr/xen.c |   52 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/xen.c b/arch/x86/kernel/cpu/mtrr/xen.c
index 6998e00..35b1246 100644
--- a/arch/x86/kernel/cpu/mtrr/xen.c
+++ b/arch/x86/kernel/cpu/mtrr/xen.c
@@ -7,6 +7,52 @@
 #include <asm/xen/hypervisor.h>
 #include <asm/xen/hypercall.h>
 
+static void xen_set_mtrr(unsigned int reg, unsigned long base,
+			 unsigned long size, mtrr_type type)
+{
+	struct xen_platform_op op;
+	int error;
+
+	/* mtrr_ops->set() is called once per CPU,
+	 * but Xen's ops apply to all CPUs.
+	 */
+	if (smp_processor_id())
+		return;
+
+	if (size == 0) {
+		op.cmd = XENPF_del_memtype;
+		op.u.del_memtype.handle = 0;
+		op.u.del_memtype.reg    = reg;
+	} else {
+		op.cmd = XENPF_add_memtype;
+		op.u.add_memtype.mfn     = base;
+		op.u.add_memtype.nr_mfns = size;
+		op.u.add_memtype.type    = type;
+	}
+
+	error = HYPERVISOR_dom0_op(&op);
+	BUG_ON(error != 0);
+}
+
+static void xen_get_mtrr(unsigned int reg, unsigned long *base,
+			 unsigned long *size, mtrr_type *type)
+{
+	struct xen_platform_op op;
+
+	op.cmd = XENPF_read_memtype;
+	op.u.read_memtype.reg = reg;
+	if (HYPERVISOR_dom0_op(&op) != 0) {
+		*base = 0;
+		*size = 0;
+		*type = 0;
+		return;
+	}
+
+	*size = op.u.read_memtype.nr_mfns;
+	*base = op.u.read_memtype.mfn;
+	*type = op.u.read_memtype.type;
+}
+
 static int xen_get_free_region(unsigned long base, unsigned long size, int replace_reg)
 {
 	struct xen_platform_op op;
@@ -32,12 +78,10 @@ static int xen_get_free_region(unsigned long base, unsigned long size, int repla
 	return replace_reg;
 }
 
-/* DOM0 TODO: Need to fill in the remaining mtrr methods to have full
- * working userland mtrr support. */
 static struct mtrr_ops xen_mtrr_ops = {
 	.vendor            = X86_VENDOR_UNKNOWN,
-//	.set               = xen_set_mtrr,
-//	.get               = xen_get_mtrr,
+	.set               = xen_set_mtrr,
+	.get               = xen_get_mtrr,
 	.get_free_region   = xen_get_free_region,
 	.validate_add_page = generic_validate_add_page,
 	.have_wrcomb       = positive_have_wrcomb,
-- 
1.5.4.1


linux-2.6-0020-irq2.diff-from-Juan-Quintela.patch:

--- NEW FILE linux-2.6-0020-irq2.diff-from-Juan-Quintela.patch ---
>From 53cb817e322173d6936f92cef04752792e87d7b6 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Thu, 13 Dec 2007 17:55:34 +0000
Subject: [PATCH] irq2.diff from Juan Quintela.

Some verbose tracing removed.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/acpi/boot.c                       |   77 ++++++++---
 arch/x86/kernel/apic_32.c                         |   11 ++
 arch/x86/kernel/io_apic_32.c                      |  100 +++++++++++---
 arch/x86/kernel/mpparse_32.c                      |   15 ++-
 arch/x86/kernel/setup_32.c                        |   17 ++-
 arch/x86/kernel/traps_32.c                        |   41 +++++-
 arch/x86/xen/enlighten.c                          |    2 +-
 arch/x86/xen/events.c                             |  157 ++++++++++++++++++++-
 drivers/acpi/tables.c                             |   14 ++-
 include/asm-x86/mach-default/irq_vectors_limits.h |   13 ++
 init/main.c                                       |   30 ++++-
 11 files changed, 426 insertions(+), 51 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index e59bda5..6fdda10 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -41,6 +41,7 @@
 #include <asm/mpspec.h>
 
 #include <asm/xen/hypervisor.h>
+#include <xen/hvc-console.h>
 
 static int __initdata acpi_force = 0;
 
@@ -301,16 +302,17 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
 {
 	struct acpi_madt_io_apic *ioapic = NULL;
 
+	xprintk("ap_ioapic 1\n");
 	ioapic = (struct acpi_madt_io_apic *)header;
-
+	xprintk("ap_ioapic 2\n");
 	if (BAD_MADT_ENTRY(ioapic, end))
 		return -EINVAL;
-
+	xprintk("ap_ioapic 3\n");
 	acpi_table_print_madt_entry(header);
-
+	xprintk("ap_ioapic 4\n");
 	mp_register_ioapic(ioapic->id,
 			   ioapic->address, ioapic->global_irq_base);
-
+	xprintk("ap_ioapic 5\n");
 	return 0;
 }
 
@@ -588,7 +590,13 @@ acpi_scan_rsdp(unsigned long start, unsigned long length)
 	 * RSDP signature.
 	 */
 	for (offset = 0; offset < length; offset += 16) {
+#ifdef CONFIG_XEN
+		unsigned long vstart = (unsigned long)isa_bus_to_virt(start);
+
+		if (strncmp((char *)(vstart + offset), "RSD PTR ", sig_len))
+#else
 		if (strncmp((char *)(phys_to_virt(start) + offset), "RSD PTR ", sig_len))
+#endif
 			continue;
 		return (start + offset);
 	}
@@ -711,7 +719,7 @@ late_initcall(hpet_insert_resource);
 static int __init acpi_parse_fadt(struct acpi_table_header *table)
 {
 
-#ifdef CONFIG_X86_PM_TIMER
+#if 0
 	/* detect the location of the ACPI PM Timer */
 	if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) {
 		/* FADT rev. 2 */
@@ -819,6 +827,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
 {
 	int count;
 
+	xprintk("apm_ioapic_entries 1\n");
 	/*
 	 * ACPI interpreter is required to complete interrupt setup,
 	 * so if it is off, don't enumerate the io-apics with ACPI.
@@ -828,59 +837,67 @@ static int __init acpi_parse_madt_ioapic_entries(void)
 	if (acpi_disabled || acpi_noirq) {
 		return -ENODEV;
 	}
-
+	xprintk("apm_ioapic_entries 2\n");
 	if (!cpu_has_apic)
 		return -ENODEV;
-
+	xprintk("apm_ioapic_entries 3\n");
 	/*
 	 * if "noapic" boot option, don't look for IO-APICs
 	 */
 	if (skip_ioapic_setup) {
+		xprintk("apm_ioapic_entries 4\n");
 		printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
 		       "due to 'noapic' option.\n");
 		return -ENODEV;
 	}
-
+	xprintk("apm_ioapic_entries 5\n");
 	count =
 	    acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic,
 				  MAX_IO_APICS);
+	xprintk("apm_ioapic_entries 6\n");
 	if (!count) {
+		xprintk("apm_ioapic_entries 7\n");
 		printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
 		return -ENODEV;
 	} else if (count < 0) {
+		xprintk("apm_ioapic_entries 8\n");
 		printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
 		return count;
 	}
-
+	xprintk("apm_ioapic_entries 9\n");
 	count =
 	    acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
 				  NR_IRQ_VECTORS);
+	xprintk("apm_ioapic_entries 10\n");
 	if (count < 0) {
+		xprintk("apm_ioapic_entries 11\n");
 		printk(KERN_ERR PREFIX
 		       "Error parsing interrupt source overrides entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
 		return count;
 	}
-
+	xprintk("apm_ioapic_entries 12\n");
 	/*
 	 * If BIOS did not supply an INT_SRC_OVR for the SCI
 	 * pretend we got one so we can set the SCI flags.
 	 */
 	if (!acpi_sci_override_gsi)
 		acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0);
-
+	xprintk("apm_ioapic_entries 13\n");
 	/* Fill in identity legacy mapings where no override */
 	mp_config_acpi_legacy_irqs();
-
+	xprintk("apm_ioapic_entries 14\n");
 	count =
 	    acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src,
 				  NR_IRQ_VECTORS);
+	xprintk("apm_ioapic_entries 15\n");
 	if (count < 0) {
+		xprintk("apm_ioapic_entries 16\n");
 		printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
 		/* TBD: Cleanup to allow fallback to MPS */
 		return count;
 	}
-
+	xprintk("apm_ioapic_entries 17\n");
 	return 0;
 }
 #else
@@ -895,38 +912,50 @@ static void __init acpi_process_madt(void)
 #ifdef CONFIG_X86_LOCAL_APIC
 	int error;
 
+	xprintk("acpi_process_madt 1\n");
 	if (!acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
-
+		xprintk("acpi_process_madt 2\n");
 		/*
 		 * Parse MADT LAPIC entries
 		 */
 		error = acpi_parse_madt_lapic_entries();
+		xprintk("acpi_process_madt 3\n");
 		if (!error) {
+			xprintk("acpi_process_madt 4\n");
 			acpi_lapic = 1;
 
 #ifdef CONFIG_X86_GENERICARCH
 			generic_bigsmp_probe();
+			xprintk("acpi_process_madt 5\n");
 #endif
 			/*
 			 * Parse MADT IO-APIC entries
 			 */
 			error = acpi_parse_madt_ioapic_entries();
+			xprintk("acpi_process_madt 6\n");
 			if (!error) {
+				xprintk("acpi_process_madt 7\n");
 				acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
 				acpi_irq_balance_set(NULL);
+				xprintk("acpi_process_madt 8\n");
 				acpi_ioapic = 1;
 
 				smp_found_config = 1;
 				setup_apic_routing();
+				xprintk("acpi_process_madt 9\n");
 			}
+			xprintk("acpi_process_madt 10\n");
 		}
+		xprintk("acpi_process_madt 11\n");
 		if (error == -EINVAL) {
+				xprintk("acpi_process_madt 12\n");
 			/*
 			 * Dell Precision Workstation 410, 610 come here.
 			 */
 			printk(KERN_ERR PREFIX
 			       "Invalid BIOS MADT, disabling ACPI\n");
 			disable_acpi();
+			xprintk("acpi_process_madt 13\n");
 		}
 	}
 #endif
@@ -1183,6 +1212,7 @@ int __init acpi_boot_table_init(void)
 {
 	int error;
 
+	xprintk("acpi_boot_table_init 1\n");
 #ifdef __i386__
 	dmi_check_system(acpi_dmi_table);
 #endif
@@ -1193,23 +1223,32 @@ int __init acpi_boot_table_init(void)
 	 */
 	if (acpi_disabled && !acpi_ht)
 		return 1;
+	xprintk("acpi_boot_table_init 2\n");
 
 	/*
 	 * Initialize the ACPI boot-time table parser.
 	 */
 	error = acpi_table_init();
+	xprintk("acpi_boot_table_init 3\n");
 	if (error) {
+	xprintk("acpi_boot_table_init 4\n");
 		disable_acpi();
 		return error;
 	}
 
 	acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
+	xprintk("acpi_boot_table_init 5\n");
 
 	/*
 	 * blacklist may disable ACPI entirely
 	 */
+	xprintk("acpi_boot_table_init 6\n");
 	error = acpi_blacklisted();
+	xprintk("acpi_boot_table_init 7\n");
+
 	if (error) {
+		xprintk("acpi_boot_table_init 8\n");
+
 		if (acpi_force) {
 			printk(KERN_WARNING PREFIX "acpi=force override\n");
 		} else {
@@ -1218,6 +1257,7 @@ int __init acpi_boot_table_init(void)
 			return error;
 		}
 	}
+	xprintk("acpi_boot_table_init 9\n");
 
 	return 0;
 }
@@ -1228,22 +1268,25 @@ int __init acpi_boot_init(void)
 	 * If acpi_disabled, bail out
 	 * One exception: acpi=ht continues far enough to enumerate LAPICs
 	 */
+	xprintk("acpi_boot_init 1\n");
 	if (acpi_disabled && !acpi_ht)
 		return 1;
-
+	xprintk("acpi_boot_init 2\n");
 	acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
 
 	/*
 	 * set sci_int and PM timer address
 	 */
+	xprintk("acpi_boot_init 3\n");
 	acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt);
-
 	/*
 	 * Process the Multiple APIC Description Table (MADT), if present
 	 */
+	xprintk("acpi_boot_init 4\n");
 	acpi_process_madt();
-
+	xprintk("acpi_boot_init 5\n");
 	acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
+	xprintk("acpi_boot_init 6\n");
 
 	return 0;
 }
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index edb5108..06b8860 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -45,6 +45,8 @@
 
 #include "io_ports.h"
 
+#include <asm/xen/hypervisor.h>
+
 /*
  * Sanity check
  */
@@ -122,11 +124,15 @@ static inline int lapic_is_integrated(void)
  */
 static int modern_apic(void)
 {
+#ifndef CONFIG_XEN
 	/* AMD systems use old APIC versions, so check the CPU */
 	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
 	    boot_cpu_data.x86 >= 0xf)
 		return 1;
 	return lapic_get_version() >= 0x14;
+#else
+	return 1;
+#endif
 }
 
 void apic_wait_icr_idle(void)
@@ -1166,6 +1172,7 @@ fake_ioapic_page:
  */
 int __init APIC_init_uniprocessor (void)
 {
+#ifndef CONFIG_XEN
 	if (enable_local_apic < 0)
 		clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
 
@@ -1198,13 +1205,16 @@ int __init APIC_init_uniprocessor (void)
 	phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
 
 	setup_local_APIC();
+#endif
 
 #ifdef CONFIG_X86_IO_APIC
 	if (smp_found_config)
 		if (!skip_ioapic_setup && nr_ioapics)
 			setup_IO_APIC();
 #endif
+#ifndef CONFIG_XEN
 	setup_boot_clock();
+#endif
 
 	return 0;
 }
@@ -1565,3 +1575,4 @@ device_initcall(init_lapic_sysfs);
 static void apic_pm_activate(void) { }
 
 #endif	/* CONFIG_PM */
+
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index a6b1490..fc24cdf 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -50,6 +50,43 @@
 
 #include "io_ports.h"
 
+#include <xen/interface/xen.h>
+#include <xen/interface/physdev.h>
+#include <asm/xen/hypercall.h>
+#include <asm/xen/hypervisor.h>
+
+/* Fake i8259 */
+#define make_8259A_irq(_irq)     (io_apic_irqs &= ~(1UL<<(_irq)))
+#define disable_8259A_irq(_irq)  ((void)0)
+#define i8259A_irq_pending(_irq) (0)
+
+static inline unsigned int xen_io_apic_read(unsigned int apic, unsigned int reg)
+{
+	struct physdev_apic apic_op;
+	int ret;
+
+	apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
+	apic_op.reg = reg;
+	ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
+	if (ret)
+		return ret;
+	return apic_op.value;
+}
+
+static inline void xen_io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
+{
+	struct physdev_apic apic_op;
+
+	apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
+	apic_op.reg = reg;
+	apic_op.value = value;
+	HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
+}
+
+#define io_apic_read(a,r)    xen_io_apic_read(a,r)
+#define io_apic_write(a,r,v) xen_io_apic_write(a,r,v)
+#define io_apic_modify(a,r,v) xen_io_apic_write(a,r,v)
+
 int (*ioapic_renumber_irq)(int ioapic, int irq);
 atomic_t irq_mis_count;
 
@@ -92,6 +129,7 @@ static struct irq_pin_list {
 	int apic, pin, next;
 } irq_2_pin[PIN_MAP_SIZE];
 
+#ifndef CONFIG_XEN 
 struct io_apic {
 	unsigned int index;
 	unsigned int unused[3];
@@ -131,6 +169,7 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned
 		writel(reg, &io_apic->index);
 	writel(value, &io_apic->data);
 }
+#endif /* CONFIG_XEN */
 
 union entry_union {
 	struct { u32 w1, w2; };
@@ -306,6 +345,9 @@ static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
 	ioapic_mask_entry(apic, pin);
 }
 
+#ifdef CONFIG_XEN
+#define clear_IO_APIC() ((void)0)
+#else
 static void clear_IO_APIC (void)
 {
 	int apic, pin;
@@ -314,6 +356,7 @@ static void clear_IO_APIC (void)
 		for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
 			clear_IO_APIC_pin(apic, pin);
 }
+#endif
 
 #ifdef CONFIG_SMP
 static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
@@ -729,6 +772,7 @@ late_initcall(balanced_irq_init);
 #ifndef CONFIG_SMP
 void fastcall send_IPI_self(int vector)
 {
+#ifndef CONFIG_XEN
 	unsigned int cfg;
 
 	/*
@@ -740,6 +784,7 @@ void fastcall send_IPI_self(int vector)
 	 * Send the IPI. The write to APIC_ICR fires this off.
 	 */
 	apic_write_around(APIC_ICR, cfg);
+#endif
 }
 #endif /* !CONFIG_SMP */
 
@@ -1197,29 +1242,19 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }
 
 static int __assign_irq_vector(int irq)
 {
-	static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
-	int vector, offset;
+	int vector;
+	struct physdev_irq irq_op;
 
 	BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
 
 	if (irq_vector[irq] > 0)
 		return irq_vector[irq];
 
-	vector = current_vector;
-	offset = current_offset;
-next:
-	vector += 8;
-	if (vector >= FIRST_SYSTEM_VECTOR) {
-		offset = (offset + 1) % 8;
-		vector = FIRST_DEVICE_VECTOR + offset;
-	}
-	if (vector == current_vector)
+	irq_op.irq = irq;
+	if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
 		return -ENOSPC;
-	if (test_and_set_bit(vector, used_vectors))
-		goto next;
 
-	current_vector = vector;
-	current_offset = offset;
+	vector = irq_op.vector;
 	irq_vector[irq] = vector;
 
 	return vector;
@@ -1236,12 +1271,17 @@ static int assign_irq_vector(int irq)
 
 	return vector;
 }
+
+
 static struct irq_chip ioapic_chip;
 
 #define IOAPIC_AUTO	-1
 #define IOAPIC_EDGE	0
 #define IOAPIC_LEVEL	1
 
+#ifdef CONFIG_XEN
+#define ioapic_register_intr(_irq,_vector,_trigger) ((void)0)
+#else
 static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 {
 	if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
@@ -1256,6 +1296,7 @@ static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 	}
 	set_intr_gate(vector, interrupt[irq]);
 }
+#endif
 
 static void __init setup_IO_APIC_irqs(void)
 {
@@ -1316,7 +1357,7 @@ static void __init setup_IO_APIC_irqs(void)
 		else
 			add_pin_to_irq(irq, apic, pin);
 
-		if (!apic && !IO_APIC_IRQ(irq))
+		if (/* !apic &&*/ !IO_APIC_IRQ(irq))
 			continue;
 
 		if (IO_APIC_IRQ(irq)) {
@@ -1378,6 +1419,9 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
 	enable_8259A_irq(0);
 }
 
+#ifdef CONFIG_XEN
+void __init print_IO_APIC(void) { }
+#else
 void __init print_IO_APIC(void)
 {
 	int apic, i;
@@ -1492,6 +1536,7 @@ void __init print_IO_APIC(void)
 
 	return;
 }
+#endif /* !CONFIG_XEN */
 
 #if 0
 
@@ -1717,6 +1762,7 @@ void disable_IO_APIC(void)
 	 */
 	clear_IO_APIC();
 
+#ifndef CONFIG_XEN
 	/*
 	 * If the i8259 is routed through an IOAPIC
 	 * Put that IOAPIC in virtual wire mode
@@ -1743,6 +1789,7 @@ void disable_IO_APIC(void)
 		ioapic_write_entry(ioapic_i8259.apic, ioapic_i8259.pin, entry);
 	}
 	disconnect_bsp_APIC(ioapic_i8259.pin != -1);
+#endif
 }
 
 /*
@@ -1752,7 +1799,7 @@ void disable_IO_APIC(void)
  * by Matt Domsch <Matt_Domsch at dell.com>  Tue Dec 21 12:25:05 CST 1999
  */
 
-#ifndef CONFIG_X86_NUMAQ
+#if !defined(CONFIG_XEN) && !defined(CONFIG_X86_NUMAQ)
 static void __init setup_ioapic_ids_from_mpc(void)
 {
 	union IO_APIC_reg_00 reg_00;
@@ -2015,7 +2062,6 @@ static struct irq_chip ioapic_chip __read_mostly = {
 	.retrigger	= ioapic_retrigger_irq,
 };
 
-
 static inline void init_IO_APIC_traps(void)
 {
 	int irq;
@@ -2041,9 +2087,11 @@ static inline void init_IO_APIC_traps(void)
 			 */
 			if (irq < 16)
 				make_8259A_irq(irq);
+#ifndef CONFIG_XEN
 			else
 				/* Strange. Oh, well.. */
 				irq_desc[irq].chip = &no_irq_chip;
+#endif
 		}
 	}
 }
@@ -2159,6 +2207,7 @@ static inline void unlock_ExtINT_logic(void)
 
 int timer_uses_ioapic_pin_0;
 
+#ifndef CONFIG_XEN
 /*
  * This code may look a bit paranoid, but it's supposed to cooperate with
  * a wide range of boards and BIOS bugs.  Fortunately only the timer IRQ
@@ -2288,6 +2337,9 @@ static inline void __init check_timer(void)
 out:
 	local_irq_restore(flags);
 }
+#else
+#define check_timer() ((void)0)
+#endif /* CONFIG_XEN */
 
 /*
  *
@@ -2320,7 +2372,9 @@ void __init setup_IO_APIC(void)
 	 */
 	if (!acpi_ioapic)
 		setup_ioapic_ids_from_mpc();
+#ifndef CONFIG_XEN
 	sync_Arb_IDs();
+#endif
 	setup_IO_APIC_irqs();
 	init_IO_APIC_traps();
 	check_timer();
@@ -2351,6 +2405,12 @@ static int __init io_apic_bug_finalize(void)
 {
 	if(sis_apic_bug == -1)
 		sis_apic_bug = 0;
+	if (is_initial_xendomain()) {
+		struct xen_platform_op op = { .cmd = XENPF_platform_quirk };
+		op.u.platform_quirk.quirk_id = sis_apic_bug ?
+			QUIRK_IOAPIC_BAD_REGSEL : QUIRK_IOAPIC_GOOD_REGSEL;
+		HYPERVISOR_dom0_op(&op);
+	}
 	return 0;
 }
 
@@ -2465,7 +2525,9 @@ int create_irq(void)
 	spin_unlock_irqrestore(&vector_lock, flags);
 
 	if (irq >= 0) {
+#ifndef CONFIG_XEN
 		set_intr_gate(vector, interrupt[irq]);
+#endif
 		dynamic_irq_init(irq);
 	}
 	return irq;
@@ -2688,6 +2750,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
 
 int __init io_apic_get_unique_id (int ioapic, int apic_id)
 {
+#ifndef CONFIG_XEN
 	union IO_APIC_reg_00 reg_00;
 	static physid_mask_t apic_id_map = PHYSID_MASK_NONE;
 	physid_mask_t tmp;
@@ -2756,6 +2819,7 @@ int __init io_apic_get_unique_id (int ioapic, int apic_id)
 
 	apic_printk(APIC_VERBOSE, KERN_INFO
 			"IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
+#endif
 
 	return apic_id;
 }
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c
index 7a05a7f..289041d 100644
--- a/arch/x86/kernel/mpparse_32.c
+++ b/arch/x86/kernel/mpparse_32.c
@@ -105,6 +105,7 @@ static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __cpuinit
 
 static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
 {
+#ifndef CONFIG_XEN
  	int ver, apicid;
 	physid_mask_t phys_cpu;
  	
@@ -195,6 +196,7 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
 	}
 
 	cpu_set(num_processors, cpu_possible_map);
+#endif
 	num_processors++;
 
 	/*
@@ -204,6 +206,7 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
 	 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
 	 *       - Ashok Raj <ashok.raj at intel.com>
 	 */
+#ifndef CONFIG_XEN
 	if (num_processors > 8) {
 		switch (boot_cpu_data.x86_vendor) {
 		case X86_VENDOR_INTEL:
@@ -217,6 +220,7 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
 		}
 	}
 	bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
+#endif
 }
 
 static void __init MP_bus_info (struct mpc_config_bus *m)
@@ -683,7 +687,11 @@ void __init get_smp_config (void)
 		 * Read the physical hardware table.  Anything here will
 		 * override the defaults.
 		 */
+#ifdef CONFIG_XEN
+		if (!smp_read_mpc(isa_bus_to_virt(mpf->mpf_physptr))) {
+#else
 		if (!smp_read_mpc(phys_to_virt(mpf->mpf_physptr))) {
+#endif
 			smp_found_config = 0;
 			printk(KERN_ERR "BIOS bug, MP table errors detected!...\n");
 			printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n");
@@ -811,6 +819,7 @@ int es7000_plat;
 
 void __init mp_register_lapic_address(u64 address)
 {
+#ifndef CONFIG_XEN
 	mp_lapic_addr = (unsigned long) address;
 
 	set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
@@ -819,6 +828,7 @@ void __init mp_register_lapic_address(u64 address)
 		boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
 
 	Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid);
+#endif
 }
 
 void __cpuinit mp_register_lapic (u8 id, u8 enabled)
@@ -835,6 +845,7 @@ void __cpuinit mp_register_lapic (u8 id, u8 enabled)
 	if (id == boot_cpu_physical_apicid)
 		boot_cpu = 1;
 
+#ifndef CONFIG_XEN
 	processor.mpc_type = MP_PROCESSOR;
 	processor.mpc_apicid = id;
 	processor.mpc_apicver = GET_APIC_VERSION(apic_read(APIC_LVR));
@@ -845,7 +856,7 @@ void __cpuinit mp_register_lapic (u8 id, u8 enabled)
 	processor.mpc_featureflag = boot_cpu_data.x86_capability[0];
 	processor.mpc_reserved[0] = 0;
 	processor.mpc_reserved[1] = 0;
-
+#endif
 	MP_processor_info(&processor);
 }
 
@@ -899,7 +910,9 @@ void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
 	mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE;
 	mp_ioapics[idx].mpc_apicaddr = address;
 
+#ifndef CONFIG_XEN
 	set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
+#endif
 	if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
 		&& !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
 		tmpid = io_apic_get_unique_id(idx, id);
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index a441deb..5d9edab 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -62,6 +62,8 @@
 #include <bios_ebda.h>
 #include <asm/cacheflush.h>
 
+#include <xen/hvc-console.h>
+
 /* This value is set up by the early boot code to point to the value
    immediately after the boot time page tables.  It contains a *physical*
    address, and must not be in the .bss segment! */
@@ -546,10 +548,13 @@ void __init setup_arch(char **cmdline_p)
 {
 	unsigned long max_low_pfn;
 
+	xprintk("setup_arch 1\n");
 	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
+	xprintk("setup_arch 2\n");
 	pre_setup_arch_hook();
+	xprintk("setup_arch 3\n");
 	early_cpu_init();
-
+	xprintk("setup_arch 4\n");
 	/*
 	 * FIXME: This isn't an official loader_type right
 	 * now but does currently work with elilo.
@@ -564,6 +569,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
+	xprintk("setup_arch 5\n");
 	screen_info = boot_params.screen_info;
 	edid_info = boot_params.edid_info;
 	apm_info.bios = boot_params.apm_bios_info;
@@ -671,7 +677,7 @@ void __init setup_arch(char **cmdline_p)
 
 #ifdef CONFIG_ACPI
 	acpi_boot_init();
-
+	xprintk("setup_arch 10\n");
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
 	if (def_to_bigsmp)
 		printk(KERN_WARNING "More than 8 CPUs detected and "
@@ -679,14 +685,16 @@ void __init setup_arch(char **cmdline_p)
 			"CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
 #endif
 #endif
+	xprintk("setup_arch 11\n");
 #ifdef CONFIG_X86_LOCAL_APIC
 	if (smp_found_config)
 		get_smp_config();
 #endif
-
+	xprintk("setup_arch 12\n");
 	e820_register_memory();
+	xprintk("setup_arch 13\n");
 	e820_mark_nosave_regions();
-
+	xprintk("setup_arch 14\n");
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
 	if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
@@ -695,4 +703,5 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 #endif
+	xprintk("setup_arch 15\n");
 }
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 3b0ac7e..05bb721 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -59,6 +59,8 @@
 
 #include <linux/module.h>
 
+#include <asm/xen/hypercall.h>
+
 #include "mach_traps.h"
 
 int panic_on_unrecovered_nmi;
@@ -1232,10 +1234,42 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
 }
 
 
+/*
+ * NB. All these are "trap gates" (i.e. events_mask isn't set) except
+ * for those that specify <dpl>|4 in the second field.
+ */
+static struct trap_info trap_table[] = {
+	{  0, 0, __KERNEL_CS, (unsigned long)divide_error		},
+	{  1, 0|4, __KERNEL_CS, (unsigned long)debug			},
+	{  3, 3|4, __KERNEL_CS, (unsigned long)int3			},
+	{  4, 3, __KERNEL_CS, (unsigned long)overflow			},
+	{  5, 0, __KERNEL_CS, (unsigned long)bounds			},
+	{  6, 0, __KERNEL_CS, (unsigned long)invalid_op			},
+	{  7, 0|4, __KERNEL_CS, (unsigned long)device_not_available	},
+	{  9, 0, __KERNEL_CS, (unsigned long)coprocessor_segment_overrun },
+	{ 10, 0, __KERNEL_CS, (unsigned long)invalid_TSS		},
+	{ 11, 0, __KERNEL_CS, (unsigned long)segment_not_present	},
+	{ 12, 0, __KERNEL_CS, (unsigned long)stack_segment		},
+	{ 13, 0, __KERNEL_CS, (unsigned long)general_protection		},
+	{ 14, 0|4, __KERNEL_CS, (unsigned long)page_fault		},
+	{ 15, 0, __KERNEL_CS, (unsigned long)invalid_TSS		},
+	{ 16, 0, __KERNEL_CS, (unsigned long)coprocessor_error		},
+	{ 17, 0, __KERNEL_CS, (unsigned long)alignment_check		},
+#ifdef CONFIG_X86_MCE
+	{ 18, 0, __KERNEL_CS, (unsigned long)machine_check		},
+#endif
+	{ 19, 0, __KERNEL_CS, (unsigned long)simd_coprocessor_error	},
+	{ SYSCALL_VECTOR,  3, __KERNEL_CS, (unsigned long)system_call	},
+	{  0, 0,	   0, 0						}
+};
+
 void __init trap_init(void)
 {
 	int i;
 
+#ifdef CONFIG_XEN
+	HYPERVISOR_set_trap_table(trap_table);
+#else
 #ifdef CONFIG_EISA
 	void __iomem *p = ioremap(0x0FFFD9, 4);
 	if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) {
@@ -1270,6 +1304,7 @@ void __init trap_init(void)
 	set_trap_gate(18,&machine_check);
 #endif
 	set_trap_gate(19,&simd_coprocessor_error);
+#endif /* !CONFIG_XEN */
 
 	if (cpu_has_fxsr) {
 		/*
@@ -1293,8 +1328,9 @@ void __init trap_init(void)
 		printk("done.\n");
 	}
 
+#ifndef CONFIG_XEN
 	set_system_gate(SYSCALL_VECTOR,&system_call);
-
+#endif
 	/* Reserve all the builtin and the syscall vector. */
 	for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
 		set_bit(i, used_vectors);
@@ -1304,8 +1340,9 @@ void __init trap_init(void)
 	 * Should be a barrier for any external CPU state.
 	 */
 	cpu_init();
-
+#ifndef CONFIG_XEN
 	trap_init_hook();
+#endif
 }
 
 static int __init kstack_setup(char *s)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index b84f57b..2d438bb 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -184,8 +184,8 @@ static void xen_cpuid(unsigned int *eax, unsigned int *ebx,
 	 * unsupported kernel subsystems as possible.
 	 */
 	if (*eax == 1) {
-		maskedx = ~(1 << X86_FEATURE_APIC);  /* disable local APIC */
 		if (!is_initial_xendomain())
+			maskedx = ~(1 << X86_FEATURE_APIC);  /* disable local APIC */
 			maskedx &= ~((1 << X86_FEATURE_ACPI) |  /* disable ACPI */
 				     (1 << X86_FEATURE_ACC));   /* thermal monitoring */
 	}
diff --git a/arch/x86/xen/events.c b/arch/x86/xen/events.c
index 2bf9731..88edd7c 100644
--- a/arch/x86/xen/events.c
+++ b/arch/x86/xen/events.c
@@ -82,6 +82,9 @@ static u8 cpu_evtchn[NR_EVENT_CHANNELS];
 /* Reference counts for bindings to IRQs. */
 static int irq_bindcount[NR_IRQS];
 
+/* Bitmap indicating which PIRQs require Xen to be notified on unmask. */
+static DECLARE_BITMAP(pirq_needs_eoi, NR_PIRQS);
+
 /* Xen will never allocate port zero for any purpose. */
 #define VALID_EVTCHN(chn)	((chn) != 0)
 
@@ -96,6 +99,8 @@ void force_evtchn_callback(void)
 }
 EXPORT_SYMBOL_GPL(force_evtchn_callback);
 
+static DEFINE_PER_CPU(unsigned int, upcall_count) = { 0 };
+
 static struct irq_chip xen_dynamic_chip;
 
 /* Constructor for packed IRQ information. */
@@ -235,7 +240,7 @@ static int find_unbound_irq(void)
 	int irq;
 
 	/* Only allocate from dynirq range */
-	for (irq = 0; irq < NR_IRQS; irq++)
+	for (irq = DYNIRQ_BASE; irq < NR_IRQS; irq++)
 		if (irq_bindcount[irq] == 0)
 			break;
 
@@ -471,9 +476,15 @@ fastcall void xen_evtchn_do_upcall(struct pt_regs *regs)
 	struct shared_info *s = HYPERVISOR_shared_info;
 	struct vcpu_info *vcpu_info = __get_cpu_var(xen_vcpu);
 	unsigned long pending_words;
+	unsigned int count;
+
+	do {
 
 	vcpu_info->evtchn_upcall_pending = 0;
 
+	if (unlikely(per_cpu(upcall_count, cpu)++))
+		return;
+
 	/* NB. No need for a barrier here -- XCHG is a barrier on x86. */
 	pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
 	while (pending_words != 0) {
@@ -492,6 +503,10 @@ fastcall void xen_evtchn_do_upcall(struct pt_regs *regs)
 			}
 		}
 	}
+	/* If there were nested callbacks then we have more to do. */
+	count = per_cpu(upcall_count, cpu);
+	per_cpu(upcall_count, cpu) = 0;
+	} while (unlikely(count != 1));
 
 	put_cpu();
 }
@@ -573,6 +588,132 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
 	.retrigger	= retrigger_dynirq,
 };
 
+static inline void pirq_unmask_notify(int irq)
+{
+	struct physdev_eoi eoi = { .irq = irq };
+
+	if (unlikely(test_bit(irq, pirq_needs_eoi)))
+		(void)HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
+}
+
+static inline void pirq_query_unmask(int irq)
+{
+	struct physdev_irq_status_query irq_status;
+
+	irq_status.irq = irq;
+	(void)HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status);
+	clear_bit(irq, pirq_needs_eoi);
+	if (irq_status.flags & XENIRQSTAT_needs_eoi)
+		set_bit(irq, pirq_needs_eoi);
+}
+
+/*
+ * On startup, if there is no action associated with the IRQ then we are
+ * probing. In this case we should not share with others as it will confuse us.
+ */
+#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL)
+
+static unsigned int startup_pirq(unsigned int irq)
+{
+	struct evtchn_bind_pirq bind_pirq;
+	int evtchn = evtchn_from_irq(irq);
+
+	if (VALID_EVTCHN(evtchn))
+		goto out;
+	
+	bind_pirq.pirq  = irq;
+	/* NB. We are happy to share unless we are probing. */
+	bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE;
+	if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) {
+		if (!probing_irq(irq))
+			printk(KERN_INFO "Failed to obtain physical IRQ %d\n",
+			       irq);
+		return 0;
+	}
+	evtchn = bind_pirq.port;
+
+	pirq_query_unmask(irq);
+
+	evtchn_to_irq[evtchn] = irq;
+	bind_evtchn_to_cpu(evtchn, 0);
+	irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, evtchn);
+
+ out:
+	unmask_evtchn(evtchn);
+	pirq_unmask_notify(irq);
+
+	return 0;
+}
+
+static void unmask_pirq(unsigned int irq)
+{
+	int evtchn = evtchn_from_irq(irq);
+
+	if (VALID_EVTCHN(evtchn)) {
+		unmask_evtchn(evtchn);
+		pirq_unmask_notify(irq);
+	}
+}
+
+static void mask_pirq(unsigned int irq)
+{
+	int evtchn = evtchn_from_irq(irq);
+
+	if (VALID_EVTCHN(evtchn))
+		mask_evtchn(evtchn);
+}
+
+static void ack_pirq(unsigned int irq)
+{
+	int evtchn = evtchn_from_irq(irq);
+
+	move_native_irq(irq);
+
+	if (VALID_EVTCHN(evtchn)) {
+		mask_evtchn(evtchn);
+		clear_evtchn(evtchn);
+	}
+}
+
+static void eoi_pirq(unsigned int irq)
+{
+	int evtchn = evtchn_from_irq(irq);
+
+	if (VALID_EVTCHN(evtchn) && !(irq_desc[irq].status & IRQ_DISABLED)) {
+		unmask_evtchn(evtchn);
+		pirq_unmask_notify(irq);
+	}
+}
+
+static int retrigger_pirq(unsigned int irq)
+{
+	int evtchn = evtchn_from_irq(irq);
+	int ret = 0;
+
+	if (VALID_EVTCHN(evtchn)) {
+		struct shared_info *s = HYPERVISOR_shared_info;
+		int masked = sync_test_and_set_bit(evtchn, s->evtchn_mask);
+		set_evtchn(evtchn);
+
+		if (!masked)
+			unmask_evtchn(evtchn);
+		ret = 1;
+	}
+
+	return ret;
+}
+
+static struct irq_chip xen_physical_chip __read_mostly = {
+	.name		= "xen-phys",
+	.startup	= startup_pirq,
+	.mask		= mask_pirq,
+	.unmask		= unmask_pirq,
+	.ack		= ack_pirq,
+	.eoi		= eoi_pirq,
+	.set_affinity	= set_affinity_irq,
+	.retrigger	= retrigger_pirq,
+};
+
 void __init xen_init_IRQ(void)
 {
 	int i;
@@ -584,8 +725,20 @@ void __init xen_init_IRQ(void)
 		mask_evtchn(i);
 
 	/* Dynamic IRQ space is currently unbound. Zero the refcnts. */
-	for (i = 0; i < NR_IRQS; i++)
+	for (i = 0; i < NR_IRQS; i++) {
 		irq_bindcount[i] = 0;
+		irq_info[i] = IRQ_UNBOUND;
+	}
+
+	for (i = 0; i < NR_PIRQS; i++) {
+		irq_bindcount[i] = 1;
+		irq_desc[i].status = IRQ_DISABLED;
+		irq_desc[i].action = NULL;
+		irq_desc[i].depth = 1;
+		set_irq_chip_and_handler_name(i, &xen_physical_chip,
+					      handle_level_irq, "pirq");
+	}
+
 
 	irq_ctx_init(smp_processor_id());
 }
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index c341918..df800bf 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -33,6 +33,8 @@
 #include <linux/acpi.h>
 #include <linux/bootmem.h>
 
+#include <xen/hvc-console.h>
+
 #define PREFIX			"ACPI: "
 
 #define ACPI_MAX_TABLES		128
@@ -182,19 +184,21 @@ acpi_table_parse_entries(char *id,
 	unsigned int count = 0;
 	unsigned long table_end;
 
+	xprintk("atp_entries 1\n");
+
 	if (!handler)
 		return -EINVAL;
-
+	xprintk("atp_entries 2\n");
 	if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
 		acpi_get_table(id, acpi_apic_instance, &table_header);
 	else
 		acpi_get_table(id, 0, &table_header);
-
+	xprintk("atp_entries 3\n");
 	if (!table_header) {
 		printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
 		return -ENODEV;
 	}
-
+	xprintk("atp_entries 4\n");
 	table_end = (unsigned long)table_header + table_header->length;
 
 	/* Parse all entries looking for a match. */
@@ -204,6 +208,7 @@ acpi_table_parse_entries(char *id,
 
 	while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) <
 	       table_end) {
+		xprintk("atp_entries 5\n");
 		if (entry->type == entry_id
 		    && (!max_entries || count++ < max_entries))
 			if (handler(entry, table_end))
@@ -212,11 +217,12 @@ acpi_table_parse_entries(char *id,
 		entry = (struct acpi_subtable_header *)
 		    ((unsigned long)entry + entry->length);
 	}
+	xprintk("atp_entries 6\n");
 	if (max_entries && count > max_entries) {
 		printk(KERN_WARNING PREFIX "[%4.4s:0x%02x] ignored %i entries of "
 		       "%i found\n", id, entry_id, count - max_entries, count);
 	}
-
+	xprintk("atp_entries 7\n");
 	return count;
 }
 
diff --git a/include/asm-x86/mach-default/irq_vectors_limits.h b/include/asm-x86/mach-default/irq_vectors_limits.h
index a90c7a6..eb5e8a0 100644
--- a/include/asm-x86/mach-default/irq_vectors_limits.h
+++ b/include/asm-x86/mach-default/irq_vectors_limits.h
@@ -1,6 +1,18 @@
 #ifndef _ASM_IRQ_VECTORS_LIMITS_H
 #define _ASM_IRQ_VECTORS_LIMITS_H
 
+
+#ifdef CONFIG_XEN
+#define PIRQ_BASE		0
+#define NR_PIRQS		256
+
+#define DYNIRQ_BASE		(PIRQ_BASE + NR_PIRQS)
+#define NR_DYNIRQS		256
+
+#define NR_IRQS			(NR_PIRQS + NR_DYNIRQS)
+#define NR_IRQ_VECTORS		NR_IRQS
+
+#else
 #if defined(CONFIG_X86_IO_APIC) || defined(CONFIG_PARAVIRT)
 #define NR_IRQS 224
 # if (224 >= 32 * NR_CPUS)
@@ -12,5 +24,6 @@
 #define NR_IRQS 16
 #define NR_IRQ_VECTORS NR_IRQS
 #endif
+#endif /* CONFIG_XEN */
 
 #endif /* _ASM_IRQ_VECTORS_LIMITS_H */
diff --git a/init/main.c b/init/main.c
index eee7888..24ac4cd 100644
--- a/init/main.c
+++ b/init/main.c
@@ -68,6 +68,8 @@
 #include <asm/smp.h>
 #endif
 
+#include <xen/hvc-console.h>
+
 /*
  * This is one of the first .c files built. Error out early if we have compiler
  * trouble.
@@ -551,56 +553,80 @@ asmlinkage void __init start_kernel(void)
 	printk(KERN_NOTICE);
 	printk(linux_banner);
 	setup_arch(&command_line);
+	xprintk("start_kernel 9\n");
 	setup_command_line(command_line);
+	xprintk("start_kernel 10\n");
 	unwind_setup();
+	xprintk("start_kernel 11\n");
 	setup_per_cpu_areas();
+	xprintk("start_kernel 12\n");
 	smp_prepare_boot_cpu();	/* arch-specific boot-cpu hooks */
-
+	xprintk("start_kernel 13\n");
 	/*
 	 * Set up the scheduler prior starting any interrupts (such as the
 	 * timer interrupt). Full topology setup happens at smp_init()
 	 * time - but meanwhile we still have a functioning scheduler.
 	 */
+	xprintk("start_kernel 14\n");
 	sched_init();
 	/*
 	 * Disable preemption - early bootup scheduling is extremely
 	 * fragile until we cpu_idle() for the first time.
 	 */
+	xprintk("start_kernel 15\n");
 	preempt_disable();
+	xprintk("start_kernel 16\n");
 	build_all_zonelists();
+	xprintk("start_kernel 17\n");
 	page_alloc_init();
+	xprintk("start_kernel 18\n");
 	printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
 	parse_early_param();
+	xprintk("start_kernel 19\n");
 	parse_args("Booting kernel", static_command_line, __start___param,
 		   __stop___param - __start___param,
 		   &unknown_bootoption);
+	xprintk("start_kernel 20\n");
 	if (!irqs_disabled()) {
 		printk(KERN_WARNING "start_kernel(): bug: interrupts were "
 				"enabled *very* early, fixing it\n");
 		local_irq_disable();
 	}
+	xprintk("start_kernel 21\n");
 	sort_main_extable();
+	xprintk("start_kernel 22\n");
 	trap_init();
+	xprintk("start_kernel 23\n");
 	rcu_init();
+	xprintk("start_kernel 24\n");
 	init_IRQ();
+	xprintk("start_kernel 25\n");
 	pidhash_init();
+	xprintk("start_kernel 26\n");
 	init_timers();
+	xprintk("start_kernel 27\n");
 	hrtimers_init();
+	xprintk("start_kernel 28\n");
 	softirq_init();
+	xprintk("start_kernel 29\n");
 	timekeeping_init();
+	xprintk("start_kernel 30\n");
 	time_init();
 	profile_init();
+	xprintk("start_kernel 31\n");
 	if (!irqs_disabled())
 		printk("start_kernel(): bug: interrupts were enabled early\n");
 	early_boot_irqs_on();
+	xprintk("start_kernel 32\n");
 	local_irq_enable();
-
+	xprintk("start_kernel 33\n");
 	/*
 	 * HACK ALERT! This is early. We're enabling the console before
 	 * we've done PCI setups etc, and console_init() must be aware of
 	 * this. But we do want output early, in case something goes wrong.
 	 */
 	console_init();
+	xprintk("start_kernel 34\n");
 	if (panic_later)
 		panic(panic_later, panic_param);
 
-- 
1.5.4.1


linux-2.6-0021-xen-dom0-Obvious-cpuid-fix-to-domU-handling.patch:

--- NEW FILE linux-2.6-0021-xen-dom0-Obvious-cpuid-fix-to-domU-handling.patch ---
>From fb801e12400762fb8cab80beedaa4be854bf0e96 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Thu, 13 Dec 2007 18:00:17 +0000
Subject: [PATCH] xen dom0: Obvious cpuid fix to domU handling.

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

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2d438bb..806d739 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -184,10 +184,11 @@ static void xen_cpuid(unsigned int *eax, unsigned int *ebx,
 	 * unsupported kernel subsystems as possible.
 	 */
 	if (*eax == 1) {
-		if (!is_initial_xendomain())
+		if (!is_initial_xendomain()) {
 			maskedx = ~(1 << X86_FEATURE_APIC);  /* disable local APIC */
 			maskedx &= ~((1 << X86_FEATURE_ACPI) |  /* disable ACPI */
 				     (1 << X86_FEATURE_ACC));   /* thermal monitoring */
+		}
 	}
 
 	asm(XEN_EMULATE_PREFIX "cpuid"
-- 
1.5.4.1


linux-2.6-0022-xen-debug-Diagnose-bind_virq_to_irq-errors.patch:

--- NEW FILE linux-2.6-0022-xen-debug-Diagnose-bind_virq_to_irq-errors.patch ---
>From 2d1568fdd5f24f8794370e75284903122096ea55 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 7 Jan 2008 20:39:20 +0000
Subject: [PATCH] xen debug: Diagnose bind_virq_to_irq errors

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/xen/events.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/events.c b/arch/x86/xen/events.c
index 88edd7c..1014809 100644
--- a/arch/x86/xen/events.c
+++ b/arch/x86/xen/events.c
@@ -329,8 +329,11 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
 		bind_virq.virq = virq;
 		bind_virq.vcpu = cpu;
 		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
-						&bind_virq) != 0)
+						&bind_virq) != 0) {
+			printk(KERN_ERR "%s: failed on virq %u, vcpu %u\n",
+			       __FUNCTION__, virq, cpu);
 			BUG();
+		}
 		evtchn = bind_virq.port;
 
 		irq = find_unbound_irq();
-- 
1.5.4.1


linux-2.6-0023-xen-traps-Revert-Juan-s-traps_32.c-changes-to-debug.patch:

--- NEW FILE linux-2.6-0023-xen-traps-Revert-Juan-s-traps_32.c-changes-to-debug.patch ---
>From b017ec4d76818b8336e405bbbac1bc62f2444338 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 7 Jan 2008 20:39:51 +0000
Subject: [PATCH] xen traps: Revert Juan's traps_32.c changes to debug why they are needed.

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

diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 05bb721..3b0ac7e 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -59,8 +59,6 @@
 
 #include <linux/module.h>
 
-#include <asm/xen/hypercall.h>
-
 #include "mach_traps.h"
 
 int panic_on_unrecovered_nmi;
@@ -1234,42 +1232,10 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
 }
 
 
-/*
- * NB. All these are "trap gates" (i.e. events_mask isn't set) except
- * for those that specify <dpl>|4 in the second field.
- */
-static struct trap_info trap_table[] = {
-	{  0, 0, __KERNEL_CS, (unsigned long)divide_error		},
-	{  1, 0|4, __KERNEL_CS, (unsigned long)debug			},
-	{  3, 3|4, __KERNEL_CS, (unsigned long)int3			},
-	{  4, 3, __KERNEL_CS, (unsigned long)overflow			},
-	{  5, 0, __KERNEL_CS, (unsigned long)bounds			},
-	{  6, 0, __KERNEL_CS, (unsigned long)invalid_op			},
-	{  7, 0|4, __KERNEL_CS, (unsigned long)device_not_available	},
-	{  9, 0, __KERNEL_CS, (unsigned long)coprocessor_segment_overrun },
-	{ 10, 0, __KERNEL_CS, (unsigned long)invalid_TSS		},
-	{ 11, 0, __KERNEL_CS, (unsigned long)segment_not_present	},
-	{ 12, 0, __KERNEL_CS, (unsigned long)stack_segment		},
-	{ 13, 0, __KERNEL_CS, (unsigned long)general_protection		},
-	{ 14, 0|4, __KERNEL_CS, (unsigned long)page_fault		},
-	{ 15, 0, __KERNEL_CS, (unsigned long)invalid_TSS		},
-	{ 16, 0, __KERNEL_CS, (unsigned long)coprocessor_error		},
-	{ 17, 0, __KERNEL_CS, (unsigned long)alignment_check		},
-#ifdef CONFIG_X86_MCE
-	{ 18, 0, __KERNEL_CS, (unsigned long)machine_check		},
-#endif
-	{ 19, 0, __KERNEL_CS, (unsigned long)simd_coprocessor_error	},
-	{ SYSCALL_VECTOR,  3, __KERNEL_CS, (unsigned long)system_call	},
-	{  0, 0,	   0, 0						}
-};
-
 void __init trap_init(void)
 {
 	int i;
 
-#ifdef CONFIG_XEN
-	HYPERVISOR_set_trap_table(trap_table);
-#else
 #ifdef CONFIG_EISA
 	void __iomem *p = ioremap(0x0FFFD9, 4);
 	if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) {
@@ -1304,7 +1270,6 @@ void __init trap_init(void)
 	set_trap_gate(18,&machine_check);
 #endif
 	set_trap_gate(19,&simd_coprocessor_error);
-#endif /* !CONFIG_XEN */
 
 	if (cpu_has_fxsr) {
 		/*
@@ -1328,9 +1293,8 @@ void __init trap_init(void)
 		printk("done.\n");
 	}
 
-#ifndef CONFIG_XEN
 	set_system_gate(SYSCALL_VECTOR,&system_call);
-#endif
+
 	/* Reserve all the builtin and the syscall vector. */
 	for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
 		set_bit(i, used_vectors);
@@ -1340,9 +1304,8 @@ void __init trap_init(void)
 	 * Should be a barrier for any external CPU state.
 	 */
 	cpu_init();
-#ifndef CONFIG_XEN
+
 	trap_init_hook();
-#endif
 }
 
 static int __init kstack_setup(char *s)
-- 
1.5.4.1


linux-2.6-0024-xen-debug-Move-init_apic_mappings-after-trap-init.patch:

--- NEW FILE linux-2.6-0024-xen-debug-Move-init_apic_mappings-after-trap-init.patch ---
>From 5d9910acad1949a7754860667c4c02e786483f0e Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 8 Jan 2008 15:33:44 +0000
Subject: [PATCH] xen debug: Move init_apic_mappings() after trap initialisation.

Improves the chance of meaningful debug output if the apic init goes wrong.

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

diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 3b0ac7e..e7c3922 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -1244,10 +1244,6 @@ void __init trap_init(void)
 	iounmap(p);
 #endif
 
-#ifdef CONFIG_X86_LOCAL_APIC
-	init_apic_mappings();
-#endif
-
 	set_trap_gate(0,&divide_error);
 	set_intr_gate(1,&debug);
 	set_intr_gate(2,&nmi);
@@ -1271,6 +1267,10 @@ void __init trap_init(void)
 #endif
 	set_trap_gate(19,&simd_coprocessor_error);
 
+#ifdef CONFIG_X86_LOCAL_APIC
+	init_apic_mappings();
+#endif
+
 	if (cpu_has_fxsr) {
 		/*
 		 * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned.
-- 
1.5.4.1


linux-2.6-0025-xen-debug-Trace-progress-in-trap_init-around-init.patch:

--- NEW FILE linux-2.6-0025-xen-debug-Trace-progress-in-trap_init-around-init.patch ---
>From 508af97e08ab1aa90cb5a6f1b6396e4cbf3c9c8f Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 8 Jan 2008 15:54:05 +0000
Subject: [PATCH] xen debug: Trace progress in trap_init() around init_apic_mappings()

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

diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index e7c3922..8f299a8 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -61,6 +61,8 @@
 
 #include "mach_traps.h"
 
+#include <xen/hvc-console.h>
+
 int panic_on_unrecovered_nmi;
 
 DECLARE_BITMAP(used_vectors, NR_VECTORS);
@@ -1244,6 +1246,7 @@ void __init trap_init(void)
 	iounmap(p);
 #endif
 
+	xprintk("trap_init 0\n");
 	set_trap_gate(0,&divide_error);
 	set_intr_gate(1,&debug);
 	set_intr_gate(2,&nmi);
@@ -1268,7 +1271,9 @@ void __init trap_init(void)
 	set_trap_gate(19,&simd_coprocessor_error);
 
 #ifdef CONFIG_X86_LOCAL_APIC
+	xprintk("trap_init 1\n");
 	init_apic_mappings();
+	xprintk("trap_init 2\n");
 #endif
 
 	if (cpu_has_fxsr) {
-- 
1.5.4.1


linux-2.6-0026-xen-apic-Disable-init_apic_mappings-when-under-CO.patch:

--- NEW FILE linux-2.6-0026-xen-apic-Disable-init_apic_mappings-when-under-CO.patch ---
>From 99c0cd927046606f7d078038525d787442f31643 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 8 Jan 2008 15:54:38 +0000
Subject: [PATCH] xen apic: Disable init_apic_mappings() when under CONFIG_XEN

Hack, needs to be a runtime switch.

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

diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 06b8860..637a735 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1110,6 +1110,7 @@ no_apic:
  */
 void __init init_apic_mappings(void)
 {
+#ifndef CONFIG_XEN
 	unsigned long apic_phys;
 
 	/*
@@ -1164,6 +1165,7 @@ fake_ioapic_page:
 		}
 	}
 #endif
+#endif
 }
 
 /*
-- 
1.5.4.1


linux-2.6-0027-xen-debug-Log-entry-into-virtual-console-s-xen_init.patch:

--- NEW FILE linux-2.6-0027-xen-debug-Log-entry-into-virtual-console-s-xen_init.patch ---
>From 3eebd4611b43778a7a59809cecd8b71c8ba4ab37 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 8 Jan 2008 18:42:32 +0000
Subject: [PATCH] xen debug: Log entry into virtual console's xen_init() function

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 drivers/char/hvc_xen.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c
index 6e85664..db5bff3 100644
--- a/drivers/char/hvc_xen.c
+++ b/drivers/char/hvc_xen.c
@@ -136,6 +136,9 @@ static int __init xen_init(void)
 	if (!is_running_on_xen())
 		return 0;
 
+	printk(KERN_INFO "%s: entered on cpu %d\n",
+	       __FUNCTION__, smp_processor_id());
+	
 	if (is_initial_xendomain()) {
 		ops = &dom0_hvc_ops;
 		xencons_irq = bind_virq_to_irq(VIRQ_CONSOLE, 0);
-- 
1.5.4.1


linux-2.6-0028-xen-debug-Log-bind_virq_to_irq-events.patch:

--- NEW FILE linux-2.6-0028-xen-debug-Log-bind_virq_to_irq-events.patch ---
>From 5a91a9915e7fb65becd43bbeac59d09fc4e523cf Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 8 Jan 2008 18:43:03 +0000
Subject: [PATCH] xen debug: Log bind_virq_to_irq events

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/xen/events.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/events.c b/arch/x86/xen/events.c
index 1014809..ca4912e 100644
--- a/arch/x86/xen/events.c
+++ b/arch/x86/xen/events.c
@@ -319,7 +319,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
 int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
 {
 	struct evtchn_bind_virq bind_virq;
-	int evtchn, irq;
+	int evtchn, irq, rc;
 
 	spin_lock(&irq_mapping_update_lock);
 
@@ -328,10 +328,10 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
 	if (irq == -1) {
 		bind_virq.virq = virq;
 		bind_virq.vcpu = cpu;
-		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
-						&bind_virq) != 0) {
-			printk(KERN_ERR "%s: failed on virq %u, vcpu %u\n",
-			       __FUNCTION__, virq, cpu);
+		if ((rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
+						      &bind_virq)) != 0) {
+			printk(KERN_ERR "%s: failed on virq %u, vcpu %u, err %d\n",
+			       __FUNCTION__, virq, cpu, rc);
 			BUG();
 		}
 		evtchn = bind_virq.port;
-- 
1.5.4.1


linux-2.6-0029-xen-debug-Work-around-USB-issue-triggered-by-Xen-de.patch:

--- NEW FILE linux-2.6-0029-xen-debug-Work-around-USB-issue-triggered-by-Xen-de.patch ---
>From 44f69ec851da845860369311087433ea6f7f750b Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 4 Feb 2008 22:10:55 +0000
Subject: [PATCH] xen debug: Work around USB issue triggered by Xen debugging.

It appears that having too much serial console output from Xen's
startup_pirq() is tripping up a race in the usb stack when usb
initialisation fails.  By the time usb_kick_khubd gets around to
poking the khubd, the driver has already been torn down, and we
get a null pointer deref.

Checking for that in usb_kick_khubd lets us get past that, but
we still need to work out why the usb init is failing in the
first place.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 drivers/usb/core/hub.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b04d232..5a335ee 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -345,7 +345,8 @@ static void kick_khubd(struct usb_hub *hub)
 void usb_kick_khubd(struct usb_device *hdev)
 {
 	/* FIXME: What if hdev isn't bound to the hub driver? */
-	kick_khubd(hdev_to_hub(hdev));
+	if (hdev && hdev->actconfig && hdev_to_hub(hdev))
+		kick_khubd(hdev_to_hub(hdev));
 }
 
 
-- 
1.5.4.1


linux-2.6-0030-Remove-duplicated-dma_alloc-free_noncoherent-define.patch:

--- NEW FILE linux-2.6-0030-Remove-duplicated-dma_alloc-free_noncoherent-define.patch ---
>From 986933e6605e1dfbe5b1dfdb1f5f406215efc5cf Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 21 Jan 2008 16:18:57 +0000
Subject: [PATCH] Remove duplicated dma_alloc/free_noncoherent #defines.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 include/asm-x86/dma-mapping_64.h |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/asm-x86/dma-mapping_64.h b/include/asm-x86/dma-mapping_64.h
index ecd0f61..d0e10b3 100644
--- a/include/asm-x86/dma-mapping_64.h
+++ b/include/asm-x86/dma-mapping_64.h
@@ -65,9 +65,6 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
 
-#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
-#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-
 extern void *dma_alloc_coherent(struct device *dev, size_t size,
 				dma_addr_t *dma_handle, gfp_t gfp);
 extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
-- 
1.5.4.1


linux-2.6-0031-xem-dom0-Add-hypervisor-memory_exchange-descriptor.patch:

--- NEW FILE linux-2.6-0031-xem-dom0-Add-hypervisor-memory_exchange-descriptor.patch ---
>From 0ea94cbcfba1217d99582a479b5e1683340f8087 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Thu, 31 Jan 2008 19:26:06 +0000
Subject: [PATCH] xem dom0: Add hypervisor memory_exchange descriptor

Adds the memory_exchange descriptors needed to allow dom0 to ask
the hypervisor to force regions of its memory to be machine-
contiguous.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 include/xen/interface/memory.h |   42 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index af36ead..1ad1d74 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -142,4 +142,46 @@ struct xen_translate_gpfn_list {
 };
 DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
 
+/*
+ * An atomic exchange of memory pages. If return code is zero then
+ * @out.extent_list provides GMFNs of the newly-allocated memory.
+ * Returns zero on complete success, otherwise a negative error code.
+ * On complete success then always @nr_exchanged == @in.nr_extents.
+ * On partial success @nr_exchanged indicates how much work was done.
+ */
+#define XENMEM_exchange             11
+struct xen_memory_exchange {
+    /*
+     * [IN] Details of memory extents to be exchanged (GMFN bases).
+     * Note that @in.address_bits is ignored and unused.
+     */
+    struct xen_memory_reservation in;
+
+    /*
+     * [IN/OUT] Details of new memory extents.
+     * We require that:
+     *  1. @in.domid == @out.domid
+     *  2. @in.nr_extents  << @in.extent_order == 
+     *     @out.nr_extents << @out.extent_order
+     *  3. @in.extent_start and @out.extent_start lists must not overlap
+     *  4. @out.extent_start lists GPFN bases to be populated
+     *  5. @out.extent_start is overwritten with allocated GMFN bases
+     */
+    struct xen_memory_reservation out;
+
+    /*
+     * [OUT] Number of input extents that were successfully exchanged:
+     *  1. The first @nr_exchanged input extents were successfully
+     *     deallocated.
+     *  2. The corresponding first entries in the output extent list correctly
+     *     indicate the GMFNs that were successfully exchanged.
+     *  3. All other input and output extents are untouched.
+     *  4. If not all input exents are exchanged then the return code of this
+     *     command will be non-zero.
+     *  5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
+     */
+    unsigned int nr_exchanged;
+};
+DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
+
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
-- 
1.5.4.1


linux-2.6-0032-xen-dom0-add-virt_to_pfn-macro.patch:

--- NEW FILE linux-2.6-0032-xen-dom0-add-virt_to_pfn-macro.patch ---
>From 9c8475bdd4f183f5523c9c023438634cb86df51f Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 4 Feb 2008 16:40:57 +0000
Subject: [PATCH] xen dom0: add virt_to_pfn() macro

The xen/mmu.c code is computing pfns manually via PFN_DOWN(__pa(v))
in various places.  Add a new virt_to_pfn macro to do that more
cleanly, complementing the existing virt_to_mfn in include/xen/page.h.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 include/xen/page.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/xen/page.h b/include/xen/page.h
index c0c8fcb..ce45a6b 100644
--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -134,7 +134,8 @@ static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
 
 /* VIRT <-> MACHINE conversion */
 #define virt_to_machine(v)	(phys_to_machine(XPADDR(__pa(v))))
-#define virt_to_mfn(v)		(pfn_to_mfn(PFN_DOWN(__pa(v))))
+#define virt_to_pfn(v)		(PFN_DOWN(__pa(v)))
+#define virt_to_mfn(v)		(pfn_to_mfn(virt_to_pfn(v)))
 #define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT))
 
 #ifdef CONFIG_X86_PAE
-- 
1.5.4.1


linux-2.6-0033-xen-dom0-use-virt_to_pfn-where-appropriate.patch:

--- NEW FILE linux-2.6-0033-xen-dom0-use-virt_to_pfn-where-appropriate.patch ---
>From 4930263799244e70071eff8810194d26c0bc2e61 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 4 Feb 2008 16:42:35 +0000
Subject: [PATCH] xen dom0: use virt_to_pfn() where appropriate

Simply cleans up the code to use avoid manually coding the virt-to-pfn
conversion all over the place.

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

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 2e28104..5bbdbb7 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -454,7 +454,7 @@ void xen_pgd_pin(pgd_t *pgd)
 	level = MMUEXT_PIN_L2_TABLE;
 #endif
 
-	xen_do_pin(level, PFN_DOWN(__pa(pgd)));
+	xen_do_pin(level, virt_to_pfn(pgd));
 
 	xen_mc_issue(0);
 }
@@ -509,7 +509,7 @@ static void xen_pgd_unpin(pgd_t *pgd)
 {
 	xen_mc_batch();
 
-	xen_do_pin(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd)));
+	xen_do_pin(MMUEXT_UNPIN_TABLE, virt_to_pfn(pgd));
 
 	pgd_walk(pgd, unpin_page, TASK_SIZE);
 
-- 
1.5.4.1


linux-2.6-0034-xen-dom0-Add-contiguous-region-support.patch:

--- NEW FILE linux-2.6-0034-xen-dom0-Add-contiguous-region-support.patch ---
>From 82e3dab7c67277c9986bd2d1020be5a8a122cedf Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Thu, 31 Jan 2008 11:47:28 +0000
Subject: [PATCH] xen dom0: Add contiguous region support.

Adds xen_(create|destroy)_contiguous_region, to force ranges of pfns
to be physically contiguous in machine ram, so that DMA can be
performed correctly from it.

Based on the code from linux-2.6.18-xen.hg, but updated to use
multicall batching for contig region pte updating, and refactored to
split out the common code for zapping/remapping ptes and performing
the memory exchange hypercall.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/xen/enlighten.c |   21 +++-
 arch/x86/xen/mmu.c       |  247 +++++++++++++++++++++++++++++++++++++++++++++-
 include/xen/page.h       |   17 +++
 3 files changed, 280 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 806d739..a11607a 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -865,18 +865,31 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 		pin_pagetable_pfn(level, PFN_DOWN(__pa(base)));
 	}
 
-	/*
-	 * If we're dom0, then 1:1 map the ISA machine addresses into
-	 * the kernel's address space.
-	 */
 	if (is_initial_xendomain()) {
 		unsigned i;
+		extern unsigned long *contiguous_bitmap;
 
+		/*
+		 * If we're dom0, then 1:1 map the ISA machine addresses
+		 * into the kernel's address space.
+		 */
 		for(i = ISA_START_ADDRESS; i < ISA_END_ADDRESS; i += PAGE_SIZE)
 			set_pte_mfn(PAGE_OFFSET + i, PFN_DOWN(i), PAGE_KERNEL);
 
 		reserve_bootmem(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS);
 		printk(KERN_INFO "Xen: setup ISA identity maps\n");
+
+		/*
+		 * Allocate a contiguous page bitmap, to mark dma
+		 * coherent regions.  This may eventually be needed for
+		 * domU too, if PCI front/back support is added, but for
+		 * now it is only required for dom0.
+		 */
+		contiguous_bitmap = alloc_bootmem_low_pages
+			((max_low_pfn + 2*BITS_PER_LONG) >> 3);
+		BUG_ON(!contiguous_bitmap);
+		memset(contiguous_bitmap, 0, (max_low_pfn + 2*BITS_PER_LONG) >> 3);
+
 	}
 }
 
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 5bbdbb7..54b6275 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -47,15 +47,17 @@
 #include <asm/mmu_context.h>
 #include <asm/paravirt.h>
 
-#include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
 
 #include <xen/page.h>
 #include <xen/interface/xen.h>
+#include <xen/interface/memory.h>
 
 #include "multicalls.h"
 #include "mmu.h"
 
+DEFINE_SPINLOCK(reservation_lock);
+
 xmaddr_t arbitrary_virt_to_machine(unsigned long address)
 {
 	pte_t *pte = lookup_address(address);
@@ -614,3 +616,246 @@ void xen_exit_mmap(struct mm_struct *mm)
 
 	spin_unlock(&mm->page_table_lock);
 }
+
+
+/*
+ * Bitmap is indexed by page number. If bit is set, the page is part of a
+ * xen_create_contiguous_region() area of memory.
+ */
+unsigned long *contiguous_bitmap;
+
+static void contiguous_bitmap_set(
+	unsigned long first_page, unsigned long nr_pages)
+{
+	unsigned long start_off, end_off, curr_idx, end_idx;
+
+	curr_idx  = first_page / BITS_PER_LONG;
+	start_off = first_page & (BITS_PER_LONG-1);
+	end_idx   = (first_page + nr_pages) / BITS_PER_LONG;
+	end_off   = (first_page + nr_pages) & (BITS_PER_LONG-1);
+
+	if (curr_idx == end_idx) {
+		contiguous_bitmap[curr_idx] |=
+			((1UL<<end_off)-1) & -(1UL<<start_off);
+	} else {
+		contiguous_bitmap[curr_idx] |= -(1UL<<start_off);
+		while ( ++curr_idx < end_idx )
+			contiguous_bitmap[curr_idx] = ~0UL;
+		contiguous_bitmap[curr_idx] |= (1UL<<end_off)-1;
+	}
+}
+
+static void contiguous_bitmap_clear(
+	unsigned long first_page, unsigned long nr_pages)
+{
+	unsigned long start_off, end_off, curr_idx, end_idx;
+
+	curr_idx  = first_page / BITS_PER_LONG;
+	start_off = first_page & (BITS_PER_LONG-1);
+	end_idx   = (first_page + nr_pages) / BITS_PER_LONG;
+	end_off   = (first_page + nr_pages) & (BITS_PER_LONG-1);
+
+	if (curr_idx == end_idx) {
+		contiguous_bitmap[curr_idx] &=
+			-(1UL<<end_off) | ((1UL<<start_off)-1);
+	} else {
+		contiguous_bitmap[curr_idx] &= (1UL<<start_off)-1;
+		while ( ++curr_idx != end_idx )
+			contiguous_bitmap[curr_idx] = 0;
+		contiguous_bitmap[curr_idx] &= -(1UL<<end_off);
+	}
+}
+
+/* Protected by balloon_lock. */
+#define MAX_CONTIG_ORDER 9 /* 2MB */
+static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER];
+
+/*
+ * Zap a range of ptes, recording the pfn and mfn numbers as required as
+ * we go
+ */
+#define VOID_PTE (mfn_pte(0, __pgprot(0)))
+static void xen_zap_pfn_range(unsigned long vaddr, int order,
+			      unsigned long *in_frames,
+			      unsigned long *out_frames)
+{
+	int i;
+	struct multicall_space mcs;
+
+	xen_mc_batch();
+	for (i = 0; i < (1UL<<order); i++, vaddr += PAGE_SIZE) {
+		mcs = __xen_mc_entry(0);
+
+		if (in_frames)
+			in_frames[i] = virt_to_mfn(vaddr);
+
+		MULTI_update_va_mapping(mcs.mc, vaddr, VOID_PTE, 0);
+		set_phys_to_machine(virt_to_pfn(vaddr), INVALID_P2M_ENTRY);
+
+		if (out_frames)
+			out_frames[i] = virt_to_pfn(vaddr);
+	}
+	xen_mc_issue(0);
+}
+
+/*
+ * Update the pfn-to-mfn mappings for a virtual address range, either to
+ * point to an array of mfns, or contiguously from a single starting
+ * mfn.
+ */
+static void xen_remap_exchanged_ptes(unsigned long vaddr, int order,
+				     unsigned long *mfns,
+				     unsigned long first_mfn)
+{
+	int i;
+	unsigned long mfn;
+	struct multicall_space mcs;
+
+	xen_mc_batch();
+	for (i = 0; i < (1UL<<order); i++, vaddr += PAGE_SIZE) {
+		mcs = __xen_mc_entry(0);
+
+		if (mfns) 
+			mfn = mfns[i];
+		else
+			mfn = first_mfn + i;
+		MULTI_update_va_mapping(mcs.mc, vaddr, 
+					mfn_pte(mfn, PAGE_KERNEL), 0);
+		set_phys_to_machine(virt_to_pfn(vaddr), mfn);
+	}
+
+	mcs.mc->args[MULTI_UVMFLAGS_INDEX] = order ? UVMF_TLB_FLUSH|UVMF_ALL
+						   : UVMF_INVLPG|UVMF_ALL;
+
+	xen_mc_issue(0);
+}
+
+/*
+ * Perform the hypercall to exchange a region of our pfns to point to
+ * memory with the required contiguous alignment.  Takes the pfns as
+ * input, and populates mfns as output.  
+ *
+ * Returns a success code indicating whether the hypervisor was able to
+ * satisfy the request or not.
+ */
+int xen_exchange_memory(unsigned long extents_in, unsigned int order_in,
+			unsigned long *pfns_in,
+			unsigned long extents_out, unsigned int order_out,
+			unsigned long *mfns_out,
+			unsigned int address_bits)
+{
+	long rc;
+	int success;
+	
+	struct xen_memory_exchange exchange = {
+		.in = {
+			.nr_extents   = extents_in,
+			.extent_order = order_in,
+			.extent_start = pfns_in,
+			.domid        = DOMID_SELF
+		},
+		.out = {
+			.nr_extents   = extents_out,
+			.extent_order = order_out,
+			.extent_start = mfns_out,
+			.address_bits = address_bits,
+			.domid        = DOMID_SELF
+		}
+	};
+	
+	BUG_ON (extents_in << order_in != extents_out << order_out);
+	
+	rc = HYPERVISOR_memory_op(XENMEM_exchange, &exchange);
+	success = (exchange.nr_exchanged == (extents_in << order_in));
+
+	BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0)));
+	BUG_ON(success && (rc != 0));
+
+	return success;
+}
+
+
+int xen_create_contiguous_region(
+	unsigned long vstart, unsigned int order, unsigned int address_bits)
+{
+	unsigned long *in_frames = discontig_frames, out_frame;
+	unsigned long  flags;
+	int            success;
+	/*
+	 * Currently an auto-translated guest will not perform I/O, nor will
+	 * it require PAE page directories below 4GB. Therefore any calls to
+	 * this function are redundant and can be ignored.
+	 */
+	if (xen_feature(XENFEAT_auto_translated_physmap))
+		return 0;
+
+	if (unlikely(order > MAX_CONTIG_ORDER))
+		return -ENOMEM;
+
+	memset((void *) vstart, 0, PAGE_SIZE << order);
+
+	reservation_lock(flags);
+
+	/* 1. Zap current PTEs, remembering MFNs. */
+	xen_zap_pfn_range(vstart, order, in_frames, NULL);
+
+	/* 2. Get a new contiguous memory extent. */
+	out_frame = virt_to_pfn(vstart);
+	success = xen_exchange_memory(1UL << order, 0, in_frames,
+				      1, order, &out_frame,
+				      0);
+
+	/* 3. Map the new extent in place of old pages. */
+	if (success)
+		xen_remap_exchanged_ptes(vstart, order, NULL, out_frame);
+	else
+		xen_remap_exchanged_ptes(vstart, order, in_frames, 0);
+
+	if (success)
+		contiguous_bitmap_set(virt_to_pfn(vstart), 1UL << order);
+
+	reservation_unlock(flags);
+
+	return success ? 0 : -ENOMEM;
+}
+EXPORT_SYMBOL_GPL(xen_create_contiguous_region);
+
+void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
+{
+	unsigned long *out_frames = discontig_frames, in_frame;
+	unsigned long  flags;
+	int            success;
+
+	if (xen_feature(XENFEAT_auto_translated_physmap) ||
+	    !test_bit(virt_to_pfn(vstart), contiguous_bitmap))
+		return;
+
+	if (unlikely(order > MAX_CONTIG_ORDER))
+		return;
+
+	memset((void *) vstart, 0, PAGE_SIZE << order);
+
+	reservation_lock(flags);
+
+	contiguous_bitmap_clear(virt_to_pfn(vstart), 1UL << order);
+
+	/* 1. Find start MFN of contiguous extent. */
+	in_frame = virt_to_mfn(vstart);
+
+	/* 2. Zap current PTEs. */
+	xen_zap_pfn_range(vstart, order, NULL, out_frames);
+
+	/* 3. Do the exchange for non-contiguous MFNs. */
+	success = xen_exchange_memory(1, order, &in_frame,
+				      1UL << order, 0, out_frames,
+				      0);
+
+	/* 4. Map new pages in place of old pages. */
+	if (success)
+		xen_remap_exchanged_ptes(vstart, order, out_frames, 0);
+	else
+		xen_remap_exchanged_ptes(vstart, order, NULL, in_frame);
+
+	reservation_unlock(flags);
+}
+EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
diff --git a/include/xen/page.h b/include/xen/page.h
index ce45a6b..b453913 100644
--- a/include/xen/page.h
+++ b/include/xen/page.h
@@ -178,4 +178,21 @@ xmaddr_t arbitrary_virt_to_machine(unsigned long address);
 void make_lowmem_page_readonly(void *vaddr);
 void make_lowmem_page_readwrite(void *vaddr);
 
+int xen_create_contiguous_region(unsigned long vstart, unsigned int order, 
+				 unsigned int address_bits);
+void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
+
+/*
+ * Lock the memory reservations of the domain.  Can be used to (for
+ * example) prevent a balloon driver from changing the memory
+ * reservation during a driver critical region, but is also used to lock
+ * memory exchanges when changing the page reservations, for example
+ * when creating or destroying contiguous regions.
+ */
+extern spinlock_t reservation_lock;
+#define reservation_lock(__flags)   \
+	spin_lock_irqsave(&reservation_lock, (__flags))
+#define reservation_unlock(__flags) \
+	spin_unlock_irqrestore(&reservation_lock, (__flags))
+
 #endif /* __XEN_PAGE_H */
-- 
1.5.4.1


linux-2.6-0035-xen-dom0-Don-t-mask-off-PCD-bits-from-pte-entries.patch:

--- NEW FILE linux-2.6-0035-xen-dom0-Don-t-mask-off-PCD-bits-from-pte-entries.patch ---
>From 7ddc4ba1a0a61549236cba6d84abc8306382822b Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 29 Jan 2008 16:53:30 +0000
Subject: [PATCH] xen dom0: Don't mask off PCD bits from pte entries.

With pv_ops, Xen is preventing the PAGE_PCD don't-cache pte flag
from being set in any pte.  That might be reasonable for domU, but
is certainly not for dom0 --- device drivers genuinely need this
for ioremap_nocache().

If this exposes problems in domU, we'll need to address those
separately.

Suggested by Jeremy Fitzhardinge.
Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/xen/mmu.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 54b6275..bc08a86 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -218,8 +218,6 @@ pte_t xen_make_pte(unsigned long long pte)
 	if (pte & 1)
 		pte = phys_to_machine(XPADDR(pte)).maddr;
 
-	pte &= ~_PAGE_PCD;
-
 	return (pte_t){ pte, pte >> 32 };
 }
 
@@ -267,8 +265,6 @@ pte_t xen_make_pte(unsigned long pte)
 	if (pte & _PAGE_PRESENT)
 		pte = phys_to_machine(XPADDR(pte)).maddr;
 
-	pte &= ~_PAGE_PCD;
-
 	return (pte_t){ pte };
 }
 
-- 
1.5.4.1


linux-2.6-0036-xen-dom0-Remove-duplicate-xen_store_interface-assig.patch:

--- NEW FILE linux-2.6-0036-xen-dom0-Remove-duplicate-xen_store_interface-assig.patch ---
>From 1b8b253b758a9dddf00bf18dbf28e519f83d7a84 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 28 Jan 2008 09:32:31 +0000
Subject: [PATCH] xen dom0: Remove duplicate xen_store_interface assignment

Remove a duplicate line that assigns to xen_store_interface
the same way twice.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenbus/xenbus_probe.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 298c4c8..17e2657 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -831,8 +831,6 @@ static int __init xenbus_probe_init(void)
 		BUG_ON(err);
 		xen_store_evtchn = xen_start_info->store_evtchn =
 			alloc_unbound.port;
-
-		xen_store_interface = mfn_to_virt(xen_store_mfn);
 	} else {
 		xenstored_ready = 1;
 		xen_store_evtchn = xen_start_info->store_evtchn;
-- 
1.5.4.1


linux-2.6-0037-xen-dom0-Slightly-re-arrange-xenbus_probe_init-er.patch:

--- NEW FILE linux-2.6-0037-xen-dom0-Slightly-re-arrange-xenbus_probe_init-er.patch ---
>From 6bbb3766d2f1d4ec8f030010ea81e8f390f4c9d6 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 28 Jan 2008 09:44:46 +0000
Subject: [PATCH] xen dom0: Slightly re-arrange xenbus_probe_init() error handling

The dom0 xenstore page should never be allocated at
the out_error label, so only try and free it at
out_unreg_front.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenbus/xenbus_probe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 17e2657..1531adf 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -857,10 +857,10 @@ static int __init xenbus_probe_init(void)
   out_unreg_front:
 	bus_unregister(&xenbus_frontend.bus);
 
-  out_error:
 	if (page != 0)
 		free_page(page);
 
+  out_error:
 	return err;
 }
 
-- 
1.5.4.1


linux-2.6-0038-xen-dom0-Use-max_low_pfn-declaration-from-linux-boo.patch:

--- NEW FILE linux-2.6-0038-xen-dom0-Use-max_low_pfn-declaration-from-linux-boo.patch ---
>From 905c016ae31e9898831629dd752bfe5f95161a54 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 28 Jan 2008 16:42:05 +0000
Subject: [PATCH] xen dom0: Use max_low_pfn declaration from linux/bootmem.h

is_local_lowmem() currently declares max_low_pfn itself,
rather than using the declaration in linux/bootmem.h.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/mm/ioremap_32.c |    2 +-
 arch/x86/xen/ioremap.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c
index b4e71f4..3d3810f 100644
--- a/arch/x86/mm/ioremap_32.c
+++ b/arch/x86/mm/ioremap_32.c
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/io.h>
+#include <linux/bootmem.h>
 #include <asm/fixmap.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
@@ -42,7 +43,6 @@
  */
 static inline int is_local_lowmem(unsigned long address)
 {
-	extern unsigned long max_low_pfn;
 	if (is_running_on_xen())
 		return (mfn_to_local_pfn(address >> PAGE_SHIFT) < max_low_pfn);
 	else
diff --git a/arch/x86/xen/ioremap.c b/arch/x86/xen/ioremap.c
index 4cbbca2..70f77bd 100644
--- a/arch/x86/xen/ioremap.c
+++ b/arch/x86/xen/ioremap.c
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/io.h>
+#include <linux/bootmem.h>
 
 #include <asm/fixmap.h>
 #include <asm/cacheflush.h>
@@ -114,7 +115,6 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
  */
 static inline int is_local_lowmem(unsigned long address)
 {
-	extern unsigned long max_low_pfn;
 	return (mfn_to_local_pfn(address >> PAGE_SHIFT) < max_low_pfn);
 }
 
-- 
1.5.4.1


linux-2.6-0039-xen-dma-Add-dma_mapping_ops-indirection-for-32-bit.patch:

--- NEW FILE linux-2.6-0039-xen-dma-Add-dma_mapping_ops-indirection-for-32-bit.patch ---
>From facec1f45c47be4a882c25d8dd34dffd7b87b8f9 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 21 Jan 2008 19:03:54 +0000
Subject: [PATCH] xen dma: Add dma_mapping_ops indirection for 32-bit dma mappings

Uses the same dma_mapping_ops indirections as 64-bit x86, but using
the existing 32-bit implementation underneath.  This will provide a
framework into which the Xen swiotlb operations can more cleanly be
hooked at run-time.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/Makefile_32      |    3 +-
 arch/x86/kernel/pci-dma_32.c     |   32 +++++++++
 arch/x86/kernel/pci-nommu_32.c   |   72 ++++++++++++++++++++
 arch/x86/mm/init_32.c            |    4 +
 include/asm-x86/dma-mapping_32.h |  136 ++++++++++++++++++++++----------------
 include/asm-x86/pci_32.h         |   23 ++++---
 6 files changed, 202 insertions(+), 68 deletions(-)
 create mode 100644 arch/x86/kernel/pci-nommu_32.c

diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index 879ed77..e545b89 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -8,7 +8,8 @@ CPPFLAGS_vmlinux.lds += -Ui386
 obj-y	:= process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
 		ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
 		pci-dma_32.o i386_ksyms_32.o i387_32.o bootflag.o e820_32.o\
-		quirks.o i8237.o topology.o alternative.o i8253.o tsc_32.o
+		quirks.o i8237.o topology.o alternative.o i8253.o tsc_32.o \
+		pci-nommu_32.o
 
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-y				+= cpu/
diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c
index 5133032..04a95c9 100644
--- a/arch/x86/kernel/pci-dma_32.c
+++ b/arch/x86/kernel/pci-dma_32.c
@@ -156,6 +156,38 @@ EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
 int forbid_dac;
 EXPORT_SYMBOL(forbid_dac);
 
+int dma_supported(struct device *dev, u64 mask)
+{
+        /*
+         * we fall back to GFP_DMA when the mask isn't all 1s,
+         * so we can't guarantee allocations that must be
+         * within a tighter range than GFP_DMA..
+         */
+        if(mask < 0x00ffffff)
+                return 0;
+
+	/* Work around chipset bugs */
+	if (forbid_dac > 0 && mask > 0xffffffffULL)
+		return 0;
+
+	if (dma_ops->dma_supported)
+		return dma_ops->dma_supported(dev, mask);
+
+	return 1;
+}
+EXPORT_SYMBOL(dma_supported);
+
+int dma_set_mask(struct device *dev, u64 mask)
+{
+	if(!dev->dma_mask || !dma_supported(dev, mask))
+		return -EIO;
+
+	*dev->dma_mask = mask;
+
+	return 0;
+}
+EXPORT_SYMBOL(dma_set_mask);
+
 static __devinit void via_no_dac(struct pci_dev *dev)
 {
 	if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
diff --git a/arch/x86/kernel/pci-nommu_32.c b/arch/x86/kernel/pci-nommu_32.c
new file mode 100644
index 0000000..6a8e3ba
--- /dev/null
+++ b/arch/x86/kernel/pci-nommu_32.c
@@ -0,0 +1,72 @@
+/* Fallback functions when the main IOMMU code is not compiled in. This
+   code is roughly equivalent to i386. */
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/string.h>
+#include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
+
+#include <asm/processor.h>
+#include <asm/dma.h>
+
+static dma_addr_t
+nommu_map_single(struct device *dev, void *ptr, size_t size,
+	       enum dma_data_direction direction)
+{
+	WARN_ON(size == 0);
+	flush_write_buffers();
+	return virt_to_phys(ptr);
+}
+
+static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
+			enum dma_data_direction direction)
+{
+}
+
+static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
+	       int nents, enum dma_data_direction direction)
+{
+	struct scatterlist *s;
+	int i;
+
+	for_each_sg(sg, s, nents, i) {
+		BUG_ON(!sg_page(s));
+
+		s->dma_address = sg_phys(s);
+	}
+
+	flush_write_buffers();
+	return nents;
+}
+
+/* Unmap a set of streaming mode DMA translations.
+ * Again, cpu read rules concerning calls here are the same as for
+ * pci_unmap_single() above.
+ */
+static void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
+		  int nents, enum dma_data_direction direction)
+{
+}
+
+
+const struct dma_mapping_ops nommu_dma_ops = {
+	.map_single = nommu_map_single,
+	.unmap_single = nommu_unmap_single,
+	.map_sg = nommu_map_sg,
+	.unmap_sg = nommu_unmap_sg,
+	.is_phys = 1,
+};
+
+int __init no_iommu_init(void)
+{
+	if (dma_ops)
+		return 0;
+
+	dma_ops = &nommu_dma_ops;
+	return 0;
+}
+
+
+/* Must execute after PCI subsystem */
+fs_initcall(no_iommu_init);
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 7287ae4..fcf1be6 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -31,6 +31,7 @@
 #include <linux/memory_hotplug.h>
 #include <linux/initrd.h>
 #include <linux/cpumask.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -45,6 +46,9 @@
 #include <asm/sections.h>
 #include <asm/paravirt.h>
 
+const struct dma_mapping_ops* dma_ops;
+EXPORT_SYMBOL(dma_ops);
+
 unsigned int __VMALLOC_RESERVE = 128 << 20;
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
diff --git a/include/asm-x86/dma-mapping_32.h b/include/asm-x86/dma-mapping_32.h
index 55f01bd..b14e296 100644
--- a/include/asm-x86/dma-mapping_32.h
+++ b/include/asm-x86/dma-mapping_32.h
@@ -8,6 +8,48 @@
 #include <asm/io.h>
 #include <asm/bug.h>
 
+struct dma_mapping_ops {
+	int             (*mapping_error)(dma_addr_t dma_addr);
+	void*           (*alloc_coherent)(struct device *dev, size_t size,
+                                dma_addr_t *dma_handle, gfp_t gfp);
+	void            (*free_coherent)(struct device *dev, size_t size,
+                                void *vaddr, dma_addr_t dma_handle);
+	dma_addr_t      (*map_single)(struct device *hwdev, void *ptr,
+                                size_t size, enum dma_data_direction);
+	/* like map_single, but doesn't check the device mask */
+	dma_addr_t      (*map_simple)(struct device *hwdev, char *ptr,
+                                size_t size, enum dma_data_direction);
+	void            (*unmap_single)(struct device *dev, dma_addr_t addr,
+		                size_t size, enum dma_data_direction);
+	void            (*sync_single_for_cpu)(struct device *hwdev,
+		                dma_addr_t dma_handle, size_t size,
+				enum dma_data_direction);
+	void            (*sync_single_for_device)(struct device *hwdev,
+                                dma_addr_t dma_handle, size_t size,
+				enum dma_data_direction);
+	void            (*sync_single_range_for_cpu)(struct device *hwdev,
+                                dma_addr_t dma_handle, unsigned long offset,
+		                size_t size, enum dma_data_direction);
+	void            (*sync_single_range_for_device)(struct device *hwdev,
+				dma_addr_t dma_handle, unsigned long offset,
+		                size_t size, enum dma_data_direction);
+	void            (*sync_sg_for_cpu)(struct device *hwdev,
+                                struct scatterlist *sg, int nelems,
+				enum dma_data_direction);
+	void            (*sync_sg_for_device)(struct device *hwdev,
+				struct scatterlist *sg, int nelems,
+				enum dma_data_direction);
+	int             (*map_sg)(struct device *hwdev, struct scatterlist *sg,
+		                int nents, enum dma_data_direction);
+	void            (*unmap_sg)(struct device *hwdev,
+				struct scatterlist *sg, int nents,
+				enum dma_data_direction);
+	int             (*dma_supported)(struct device *hwdev, u64 mask);
+	int		is_phys;
+};
+
+extern const struct dma_mapping_ops* dma_ops;
+
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
 
@@ -24,7 +66,7 @@ dma_map_single(struct device *dev, void *ptr, size_t size,
 	BUG_ON(!valid_dma_direction(direction));
 	WARN_ON(size == 0);
 	flush_write_buffers();
-	return virt_to_phys(ptr);
+	return dma_ops->map_single(dev, ptr, size, direction);
 }
 
 static inline void
@@ -32,61 +74,49 @@ dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
 		 enum dma_data_direction direction)
 {
 	BUG_ON(!valid_dma_direction(direction));
+	dma_ops->unmap_single(dev, dma_addr, size, direction);
 }
 
+#define dma_map_page(dev,page,offset,size,dir) \
+	dma_map_single((dev), page_address(page)+(offset), (size), (dir))
+
+#define dma_unmap_page dma_unmap_single
+
 static inline int
 dma_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
 	   enum dma_data_direction direction)
 {
-	struct scatterlist *sg;
-	int i;
-
 	BUG_ON(!valid_dma_direction(direction));
 	WARN_ON(nents == 0 || sglist[0].length == 0);
-
-	for_each_sg(sglist, sg, nents, i) {
-		BUG_ON(!sg_page(sg));
-
-		sg->dma_address = sg_phys(sg);
-	}
-
-	flush_write_buffers();
-	return nents;
-}
-
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page, unsigned long offset,
-	     size_t size, enum dma_data_direction direction)
-{
-	BUG_ON(!valid_dma_direction(direction));
-	return page_to_phys(page) + offset;
+	return dma_ops->map_sg(dev, sglist, nents, direction);
 }
 
 static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-	       enum dma_data_direction direction)
-{
-	BUG_ON(!valid_dma_direction(direction));
-}
-
-
-static inline void
 dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
 	     enum dma_data_direction direction)
 {
 	BUG_ON(!valid_dma_direction(direction));
+	dma_ops->unmap_sg(dev, sg, nhwentries, direction);
 }
 
 static inline void
 dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
 			enum dma_data_direction direction)
 {
+	BUG_ON(!valid_dma_direction(direction));
+	if (dma_ops->sync_single_for_cpu)
+		dma_ops->sync_single_for_cpu(dev, dma_handle, size,
+					     direction);
 }
 
 static inline void
 dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
 			enum dma_data_direction direction)
 {
+	BUG_ON(!valid_dma_direction(direction));
+	if (dma_ops->sync_single_for_device)
+		dma_ops->sync_single_for_device(dev, dma_handle, size,
+						direction);
 	flush_write_buffers();
 }
 
@@ -95,6 +125,10 @@ dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
 			      unsigned long offset, size_t size,
 			      enum dma_data_direction direction)
 {
+	BUG_ON(!valid_dma_direction(direction));
+	if (dma_ops->sync_single_range_for_cpu)
+		dma_ops->sync_single_range_for_cpu(dev, dma_handle,
+						   offset, size, direction);
 }
 
 static inline void
@@ -102,6 +136,10 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
 				 unsigned long offset, size_t size,
 				 enum dma_data_direction direction)
 {
+	BUG_ON(!valid_dma_direction(direction));
+	if (dma_ops->sync_single_range_for_device)
+		dma_ops->sync_single_range_for_device(dev, dma_handle,
+						      offset, size, direction);
 	flush_write_buffers();
 }
 
@@ -109,51 +147,33 @@ static inline void
 dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
 		    enum dma_data_direction direction)
 {
+	BUG_ON(!valid_dma_direction(direction));
+	if (dma_ops->sync_sg_for_cpu)
+		dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction);
 }
 
 static inline void
 dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
 		    enum dma_data_direction direction)
 {
+	BUG_ON(!valid_dma_direction(direction));
+	if (dma_ops->sync_sg_for_cpu)
+		dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction);
 	flush_write_buffers();
 }
 
 static inline int
 dma_mapping_error(dma_addr_t dma_addr)
 {
-	return 0;
-}
+	if (dma_ops->mapping_error)
+		return dma_ops->mapping_error(dma_addr);
 
-extern int forbid_dac;
-
-static inline int
-dma_supported(struct device *dev, u64 mask)
-{
-        /*
-         * we fall back to GFP_DMA when the mask isn't all 1s,
-         * so we can't guarantee allocations that must be
-         * within a tighter range than GFP_DMA..
-         */
-        if(mask < 0x00ffffff)
-                return 0;
-
-	/* Work around chipset bugs */
-	if (forbid_dac > 0 && mask > 0xffffffffULL)
-		return 0;
-
-	return 1;
+	return 0;
 }
 
-static inline int
-dma_set_mask(struct device *dev, u64 mask)
-{
-	if(!dev->dma_mask || !dma_supported(dev, mask))
-		return -EIO;
-
-	*dev->dma_mask = mask;
+extern int dma_supported(struct device *hwdev, u64 mask);
 
-	return 0;
-}
+extern int dma_set_mask(struct device *dev, u64 mask);
 
 static inline int
 dma_get_cache_alignment(void)
diff --git a/include/asm-x86/pci_32.h b/include/asm-x86/pci_32.h
index 8c4c3a0..612f63e 100644
--- a/include/asm-x86/pci_32.h
+++ b/include/asm-x86/pci_32.h
@@ -15,15 +15,20 @@ struct pci_dev;
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions.
  */
-#define PCI_DMA_BUS_IS_PHYS	(1)
-
-/* pci_unmap_{page,single} is a nop so... */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME)		(0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)	do { } while (0)
-#define pci_unmap_len(PTR, LEN_NAME)		(0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL)	do { } while (0)
+#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
+
+#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)	\
+	dma_addr_t ADDR_NAME;
+#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)		\
+	__u32 LEN_NAME;
+#define pci_unmap_addr(PTR, ADDR_NAME)			\
+	((PTR)->ADDR_NAME)
+#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)		\
+	(((PTR)->ADDR_NAME) = (VAL))
+#define pci_unmap_len(PTR, LEN_NAME)			\
+	((PTR)->LEN_NAME)
+#define pci_unmap_len_set(PTR, LEN_NAME, VAL)		\
+	(((PTR)->LEN_NAME) = (VAL))
 
 
 #endif /* __KERNEL__ */
-- 
1.5.4.1


linux-2.6-0040-xen-dma-Remove-unused-32-bit-dma_ops-map_simple-me.patch:

--- NEW FILE linux-2.6-0040-xen-dma-Remove-unused-32-bit-dma_ops-map_simple-me.patch ---
>From 213e0e2c49eeaf47fa466eaf55bdf067d7e4b320 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Mon, 21 Jan 2008 22:51:56 +0000
Subject: [PATCH] xen dma: Remove unused 32-bit dma_ops->map_simple method

On 64-bit, dma_ops->map_simple is only used in the gart iommu handling.
It's not needed by the 32-bit pci code, so remove it.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 include/asm-x86/dma-mapping_32.h |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/include/asm-x86/dma-mapping_32.h b/include/asm-x86/dma-mapping_32.h
index b14e296..db5f2e0 100644
--- a/include/asm-x86/dma-mapping_32.h
+++ b/include/asm-x86/dma-mapping_32.h
@@ -16,9 +16,6 @@ struct dma_mapping_ops {
                                 void *vaddr, dma_addr_t dma_handle);
 	dma_addr_t      (*map_single)(struct device *hwdev, void *ptr,
                                 size_t size, enum dma_data_direction);
-	/* like map_single, but doesn't check the device mask */
-	dma_addr_t      (*map_simple)(struct device *hwdev, char *ptr,
-                                size_t size, enum dma_data_direction);
 	void            (*unmap_single)(struct device *dev, dma_addr_t addr,
 		                size_t size, enum dma_data_direction);
 	void            (*sync_single_for_cpu)(struct device *hwdev,
-- 
1.5.4.1


linux-2.6-0041-xen-dma-Initial-commit-of-pci-xen.c-dma-mapping-fun.patch:

--- NEW FILE linux-2.6-0041-xen-dma-Initial-commit-of-pci-xen.c-dma-mapping-fun.patch ---
>From 15257ab609ca909111c424377a331d95e8739c65 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Tue, 22 Jan 2008 17:01:48 +0000
Subject: [PATCH] xen dma: Initial commit of pci-xen.c dma mapping functions.

Adds pci-xen.c, detectable at runtime, for the Xen DMA mapping
functions.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/Makefile_32    |    2 +
 arch/x86/kernel/pci-dma_32.c   |   13 +++
 arch/x86/kernel/pci-nommu_32.c |    4 -
 arch/x86/kernel/pci-xen.c      |  162 ++++++++++++++++++++++++++++++++++++++++
 include/asm-x86/iommu.h        |   30 +-------
 include/asm-x86/iommu_32.h     |    9 ++
 include/asm-x86/iommu_64.h     |   29 +++++++
 7 files changed, 218 insertions(+), 31 deletions(-)
 create mode 100644 arch/x86/kernel/pci-xen.c
 create mode 100644 include/asm-x86/iommu_32.h
 create mode 100644 include/asm-x86/iommu_64.h

diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index e545b89..ab491bb 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -50,6 +50,8 @@ obj-y				+= pcspeaker.o
 
 obj-$(CONFIG_SCx200)		+= scx200_32.o
 
+obj-$(CONFIG_XEN)		+= pci-xen.o
+
 # vsyscall_32.o contains the vsyscall DSO images as __initdata.
 # We must build both images before we can assemble it.
 # Note: kbuild does not track this dependency due to usage of .incbin
diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c
index 04a95c9..6df2e1a 100644
--- a/arch/x86/kernel/pci-dma_32.c
+++ b/arch/x86/kernel/pci-dma_32.c
@@ -13,6 +13,7 @@
 #include <linux/pci.h>
 #include <linux/module.h>
 #include <asm/io.h>
+#include <asm/iommu.h>
 
 struct dma_coherent_mem {
 	void		*virt_base;
@@ -150,6 +151,16 @@ void *dma_mark_declared_memory_occupied(struct device *dev,
 }
 EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
 
+static int __init pci_iommu_init(void)
+{
+#ifdef CONFIG_XEN
+	xen_iommu_init();
+#endif
+
+	no_iommu_init();
+	return 0;
+}
+
 #ifdef CONFIG_PCI
 /* Many VIA bridges seem to corrupt data for DAC. Disable it here */
 
@@ -207,3 +218,5 @@ static int check_iommu(char *s)
 }
 __setup("iommu=", check_iommu);
 #endif
+/* Must execute after PCI subsystem */
+fs_initcall(pci_iommu_init);
diff --git a/arch/x86/kernel/pci-nommu_32.c b/arch/x86/kernel/pci-nommu_32.c
index 6a8e3ba..ed7f5af 100644
--- a/arch/x86/kernel/pci-nommu_32.c
+++ b/arch/x86/kernel/pci-nommu_32.c
@@ -66,7 +66,3 @@ int __init no_iommu_init(void)
 	dma_ops = &nommu_dma_ops;
 	return 0;
 }
-
-
-/* Must execute after PCI subsystem */
-fs_initcall(no_iommu_init);
diff --git a/arch/x86/kernel/pci-xen.c b/arch/x86/kernel/pci-xen.c
new file mode 100644
index 0000000..6967a33
--- /dev/null
+++ b/arch/x86/kernel/pci-xen.c
@@ -0,0 +1,162 @@
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/string.h>
+#include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
+
+#include <asm/processor.h>
+#include <asm/dma.h>
+#include <asm/xen/hypervisor.h>
+
+#include <xen/page.h>
+
+#define IOMMU_BUG_ON(test)				\
+do {							\
+	if (unlikely(test)) {				\
+		printk(KERN_ALERT "Fatal DMA error! "	\
+		       "Please use 'swiotlb=force' "	\
+		       "once we implement it.\n");	\
+		BUG();					\
+	}						\
+} while (0)
+
+static inline int
+address_needs_mapping(struct device *hwdev, dma_addr_t addr)
+{
+	dma_addr_t mask = 0xffffffff;
+	/* If the device has a mask, use it, otherwise default to 32 bits */
+	if (hwdev && hwdev->dma_mask)
+		mask = *hwdev->dma_mask;
+	return (addr & ~mask) != 0;
+}
+
+static int
+range_straddles_page_boundary(struct page *page, unsigned int offset, 
+			      size_t size)
+{
+	unsigned long pfn;
+	xpaddr_t phys;
+	extern unsigned long *contiguous_bitmap;
+	extern unsigned long max_low_pfn;
+	
+	phys = XPADDR(page_to_phys(page));
+	if (((phys.paddr & ~PAGE_MASK) + size) <= PAGE_SIZE)
+		return 0;
+
+	pfn = page_to_pfn(page);
+	if (pfn < max_low_pfn && test_bit(pfn, contiguous_bitmap))
+		return 0;
+
+	printk(KERN_WARNING "DMA range crosses page boundary: "
+	       "0x%016Lx+0x%04x\n", phys.paddr, size);
+	return 1;
+}
+
+static inline dma_addr_t xen_dma_map_page(struct page *page)
+{
+	/* Xen TODO: 2.6.18 xen calls __gnttab_dma_map_page here to deal
+	 * with foreign pages.  We'll need similar logic here at some
+	 * point. */
+	return ((dma_addr_t)pfn_to_mfn(page_to_pfn(page))) << PAGE_SHIFT;
+}
+
+static inline void xen_dma_unmap_page(dma_addr_t p)
+{
+	/* Xen TODO: 2.6.18 xen calls __gnttab_dma_unmap_page_page here
+	 * to deal with foreign pages.  We'll need similar logic here at
+	 * some point. */
+}
+
+static dma_addr_t
+xen_map_single(struct device *dev, void *ptr, size_t size,
+	       enum dma_data_direction direction)
+{
+	dma_addr_t dma;
+	struct page *page = virt_to_page(ptr);
+	xpaddr_t phys = XPADDR(virt_to_phys(ptr));
+	
+	BUG_ON(ptr == NULL);
+	WARN_ON(size == 0);
+
+	flush_write_buffers();
+
+	dma = xen_dma_map_page(page) + offset_in_page(ptr);
+	IOMMU_BUG_ON(range_straddles_page_boundary(
+		     page, phys.paddr & ~PAGE_MASK, size));
+	IOMMU_BUG_ON(address_needs_mapping(dev, dma));
+
+	return dma;
+}
+
+static void xen_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
+			enum dma_data_direction direction)
+{
+	xen_dma_unmap_page(addr);
+}
+
+static int xen_map_sg(struct device *dev, struct scatterlist *sg,
+	       int nents, enum dma_data_direction direction)
+{
+	struct scatterlist *s;
+	int i;
+
+	if (direction == DMA_NONE)
+		BUG();
+
+	for_each_sg(sg, s, nents, i) {
+		struct page *page = sg_page(s);
+		
+		BUG_ON(!page);
+
+		/* Xen TODO: Why does 2.6.18 xen also set s->dma_length
+		 * here?  And do we still need to? */
+		
+		s->dma_address = xen_dma_map_page(page) + s->offset;
+
+		IOMMU_BUG_ON(address_needs_mapping(
+			     dev, s->dma_address));
+		IOMMU_BUG_ON(range_straddles_page_boundary(
+			     page, s->offset, s->length));
+	}
+
+	flush_write_buffers();
+	return nents;
+}
+
+static void xen_unmap_sg(struct device *dev, struct scatterlist *sg,
+		  int nents, enum dma_data_direction direction)
+{
+	struct scatterlist *s;
+	int i;
+
+	if (direction == DMA_NONE)
+		BUG();
+
+	for_each_sg(sg, s, nents, i)
+		xen_dma_unmap_page(s->dma_address);
+}
+
+
+const struct dma_mapping_ops xen_dma_ops = {
+	.map_single = xen_map_single,
+	.unmap_single = xen_unmap_single,
+	.map_sg = xen_map_sg,
+	.unmap_sg = xen_unmap_sg,
+	/* Xen TODO: Is this right even if we have no swiotlb
+	 * installed? */
+	.is_phys = 0,
+};
+
+int __init xen_iommu_init(void)
+{
+	if (!is_running_on_xen())
+		return 0;
+	if (!is_initial_xendomain())
+		return 0;
+	
+	BUG_ON(dma_ops);
+	dma_ops = &xen_dma_ops;
+	printk(KERN_INFO "Installed Xen dma mapping ops (no swiotlb)\n");
+	return 0;
+}
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
index 07862fd..9f8a9ef 100644
--- a/include/asm-x86/iommu.h
+++ b/include/asm-x86/iommu.h
@@ -1,29 +1,5 @@
-#ifndef _ASM_X8664_GART_H
-#define _ASM_X8664_GART_H 1
-
-extern void pci_iommu_shutdown(void);
-extern void no_iommu_init(void);
-extern int force_iommu, no_iommu;
-extern int iommu_detected;
-#ifdef CONFIG_IOMMU
-extern void gart_iommu_init(void);
-extern void gart_iommu_shutdown(void);
-extern void __init gart_parse_options(char *);
-extern void iommu_hole_init(void);
-extern int fallback_aper_order;
-extern int fallback_aper_force;
-extern int iommu_aperture;
-extern int iommu_aperture_allowed;
-extern int iommu_aperture_disabled;
-extern int fix_aperture;
+#ifdef CONFIG_X86_32
+# include "iommu_32.h"
 #else
-#define iommu_aperture 0
-#define iommu_aperture_allowed 0
-
-static inline void gart_iommu_shutdown(void)
-{
-}
-
-#endif
-
+# include "iommu_64.h"
 #endif
diff --git a/include/asm-x86/iommu_32.h b/include/asm-x86/iommu_32.h
new file mode 100644
index 0000000..4bc3e8a
--- /dev/null
+++ b/include/asm-x86/iommu_32.h
@@ -0,0 +1,9 @@
+#ifndef _ASM_X86_IOMMU_H
+#define _ASM_X86_IOMMU_H 1
+
+extern void no_iommu_init(void);
+#ifdef CONFIG_XEN
+extern void xen_iommu_init(void);
+#endif
+
+#endif
diff --git a/include/asm-x86/iommu_64.h b/include/asm-x86/iommu_64.h
new file mode 100644
index 0000000..07862fd
--- /dev/null
+++ b/include/asm-x86/iommu_64.h
@@ -0,0 +1,29 @@
+#ifndef _ASM_X8664_GART_H
+#define _ASM_X8664_GART_H 1
+
+extern void pci_iommu_shutdown(void);
+extern void no_iommu_init(void);
+extern int force_iommu, no_iommu;
+extern int iommu_detected;
+#ifdef CONFIG_IOMMU
+extern void gart_iommu_init(void);
+extern void gart_iommu_shutdown(void);
+extern void __init gart_parse_options(char *);
+extern void iommu_hole_init(void);
+extern int fallback_aper_order;
+extern int fallback_aper_force;
+extern int iommu_aperture;
+extern int iommu_aperture_allowed;
+extern int iommu_aperture_disabled;
+extern int fix_aperture;
+#else
+#define iommu_aperture 0
+#define iommu_aperture_allowed 0
+
+static inline void gart_iommu_shutdown(void)
+{
+}
+
+#endif
+
+#endif
-- 
1.5.4.1


linux-2.6-0042-xen-dma-Add-calls-to-dma_ops-alloc-free_coherent-ho.patch:

--- NEW FILE linux-2.6-0042-xen-dma-Add-calls-to-dma_ops-alloc-free_coherent-ho.patch ---
>From 0f4965d087c23fa5d3c351724003aecb5881e037 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Wed, 30 Jan 2008 21:53:48 +0000
Subject: [PATCH] xen dma: Add calls to dma_ops alloc/free_coherent hooks.

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

diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c
index 6df2e1a..b983dc0 100644
--- a/arch/x86/kernel/pci-dma_32.c
+++ b/arch/x86/kernel/pci-dma_32.c
@@ -48,6 +48,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
 	if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
 		gfp |= GFP_DMA;
 
+	if (dma_ops->alloc_coherent)
+		return dma_ops->alloc_coherent(dev, size, dma_handle, gfp);
+
 	ret = (void *)__get_free_pages(gfp, order);
 
 	if (ret != NULL) {
@@ -69,8 +72,12 @@ void dma_free_coherent(struct device *dev, size_t size,
 		int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
 
 		bitmap_release_region(mem->bitmap, page, order);
-	} else
-		free_pages((unsigned long)vaddr, order);
+	} else {
+		if (dma_ops->free_coherent)
+			dma_ops->free_coherent(dev, size, vaddr, dma_handle);
+		else
+			free_pages((unsigned long)vaddr, order);
+	}
 }
 EXPORT_SYMBOL(dma_free_coherent);
 
-- 
1.5.4.1


linux-2.6-0043-xen-dma-Add-xen_alloc-free_coherent.patch:

--- NEW FILE linux-2.6-0043-xen-dma-Add-xen_alloc-free_coherent.patch ---
>From f33c0f237ea698a756b4c04926c09c407a731705 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Thu, 31 Jan 2008 11:49:04 +0000
Subject: [PATCH] xen dma: Add xen_alloc/free_coherent

Add dma_ops-based xen-specific dma_alloc/free_coherent functions,
using the xen contiguous region calls to obtain DMA-capable
memory.

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

diff --git a/arch/x86/kernel/pci-xen.c b/arch/x86/kernel/pci-xen.c
index 6967a33..2f92422 100644
--- a/arch/x86/kernel/pci-xen.c
+++ b/arch/x86/kernel/pci-xen.c
@@ -137,8 +137,50 @@ static void xen_unmap_sg(struct device *dev, struct scatterlist *sg,
 		xen_dma_unmap_page(s->dma_address);
 }
 
+static void *xen_alloc_coherent(struct device *dev, size_t size,
+				dma_addr_t *dma_handle, gfp_t gfp)
+{
+	unsigned int order = get_order(size);
+	unsigned long vstart;
+	dma_addr_t mask;
+	void *ret;
+	
+	vstart = __get_free_pages(gfp, order);
+	ret = (void *)vstart;
+
+	if (ret == NULL)
+		return NULL;
+	
+	if (dev != NULL && dev->coherent_dma_mask)
+		mask = dev->coherent_dma_mask;
+	else
+		mask = 0xffffffff;
+
+	if (xen_create_contiguous_region(vstart, order,
+					 fls64(mask)) != 0) {
+		free_pages(vstart, order);
+		return NULL;
+	}
+
+	memset(ret, 0, size);
+	*dma_handle = virt_to_machine(ret).maddr;
+
+	return ret;
+}
+
+static void xen_free_coherent(struct device *dev, size_t size,
+			      void *vaddr, dma_addr_t dma_handle)
+{
+	int order = get_order(size);
+
+	xen_destroy_contiguous_region((unsigned long)vaddr, order);
+	free_pages((unsigned long)vaddr, order);
+}
+
 
 const struct dma_mapping_ops xen_dma_ops = {
+	.alloc_coherent = xen_alloc_coherent,
+	.free_coherent = xen_free_coherent,
 	.map_single = xen_map_single,
 	.unmap_single = xen_unmap_single,
 	.map_sg = xen_map_sg,
-- 
1.5.4.1


linux-2.6-0044-xen-dma-Don-t-merge-bios-on-xen-pvops.patch:

--- NEW FILE linux-2.6-0044-xen-dma-Don-t-merge-bios-on-xen-pvops.patch ---
>From ac9db3990366b613147e45bd0e7ceb4cc4501854 Mon Sep 17 00:00:00 2001
From: Stephen Tweedie <sct at redhat.com>
Date: Fri, 1 Feb 2008 18:04:53 +0000
Subject: [PATCH] xen dma: Don't merge bios on xen pvops.

On Xen, pages which are pseudophysically contiguous may not be
machine-contiguous.  So the normal bio rules for merging adjacent
bios do not apply.  And if Xen is running with no swiotlb, then
it has no mechanism for unpicking such merged bio segments.

Add a switch to turn of such merging, so that pvops xen can prevent
it.

We add the switch in the form of a simple extern variable, in
order to prevent the whole paravirt-ops infrastructure from being
pulled into io.h.

We might consider changing this to have an arch-supplied bio merge
function, so that xen can determine whether any two bios are in
fact machine-contiguous.

Signed-off-by: Stephen Tweedie <sct at redhat.com>
---
 arch/x86/kernel/pci-dma_32.c |    9 +++++++++
 arch/x86/kernel/pci-xen.c    |    1 +
 include/asm-x86/io_32.h      |   12 ++++++++++++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c
index b983dc0..ce05946 100644
--- a/arch/x86/kernel/pci-dma_32.c
+++ b/arch/x86/kernel/pci-dma_32.c
@@ -15,6 +15,15 @@
 #include <asm/io.h>
 #include <asm/iommu.h>
 
+/*
+ * Determine whether the bio layer is permitted to merge sg entries 
+ * across physically-contiguous pages.
+ *
+ * True unless a specific dma driver tells us otherwise.
+ */
+int __biovec_phys_mergeable = 1;
+EXPORT_SYMBOL(__biovec_phys_mergeable);
+
 struct dma_coherent_mem {
 	void		*virt_base;
 	u32		device_base;
diff --git a/arch/x86/kernel/pci-xen.c b/arch/x86/kernel/pci-xen.c
index 2f92422..73f27d4 100644
--- a/arch/x86/kernel/pci-xen.c
+++ b/arch/x86/kernel/pci-xen.c
@@ -199,6 +199,7 @@ int __init xen_iommu_init(void)
 	
 	BUG_ON(dma_ops);
 	dma_ops = &xen_dma_ops;
+	__biovec_phys_mergeable = 0;
 	printk(KERN_INFO "Installed Xen dma mapping ops (no swiotlb)\n");
 	return 0;
 }
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h
index e2b916e..6344856 100644
--- a/include/asm-x86/io_32.h
+++ b/include/asm-x86/io_32.h
@@ -95,6 +95,18 @@ static inline void * phys_to_virt(unsigned long address)
 	return __va(address);
 }
 
+struct bio_vec;
+
+/*
+ * Allow for paravirt drivers to determine physical bio mergeability for
+ * themselves, as virtualised environments may not necessary allow for
+ * dma across contiguous pfns.
+ */
+extern int __biovec_phys_mergeable;
+#define BIOVEC_PHYS_MERGEABLE(vec1, vec2)	\
+	(((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) && \
+	 (__biovec_phys_mergeable != 0))
+
 /*
  * Change "struct page" to physical address.
  */
-- 
1.5.4.1


linux-2.6-0045-xen-dom0-Minor-coding-style-issue-in-ISA-mapping-co.patch:

--- NEW FILE linux-2.6-0045-xen-dom0-Minor-coding-style-issue-in-ISA-mapping-co.patch ---
>From f834f38a5c22552015cc00dbc64139cada2c2610 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Fri, 1 Feb 2008 10:15:18 +0000
Subject: [PATCH] xen dom0: Minor coding style issue in ISA mapping code

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/enlighten.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index a11607a..5719b8f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -873,7 +873,7 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 		 * If we're dom0, then 1:1 map the ISA machine addresses
 		 * into the kernel's address space.
 		 */
-		for(i = ISA_START_ADDRESS; i < ISA_END_ADDRESS; i += PAGE_SIZE)
+		for (i = ISA_START_ADDRESS; i < ISA_END_ADDRESS; i += PAGE_SIZE)
 			set_pte_mfn(PAGE_OFFSET + i, PFN_DOWN(i), PAGE_KERNEL);
 
 		reserve_bootmem(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS);
-- 
1.5.4.1


linux-2.6-0046-xen-dom0-Use-i-PAGE_SHIFT-instead-of-PAGE_DOWN-i.patch:

--- NEW FILE linux-2.6-0046-xen-dom0-Use-i-PAGE_SHIFT-instead-of-PAGE_DOWN-i.patch ---
>From 93ffa1eae323db8e86c4277bb627f993ea7c84bd Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Fri, 1 Feb 2008 10:17:05 +0000
Subject: [PATCH] xen dom0: Use i >> PAGE_SHIFT instead of PAGE_DOWN(i)

It's the same thing, but when dealing with page aligned
addresses, it looks like it's more usual to not use
the macro. Also, it's a tiny bit more obvious what's
going on.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/enlighten.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 5719b8f..363a4f5 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -874,7 +874,7 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 		 * into the kernel's address space.
 		 */
 		for (i = ISA_START_ADDRESS; i < ISA_END_ADDRESS; i += PAGE_SIZE)
-			set_pte_mfn(PAGE_OFFSET + i, PFN_DOWN(i), PAGE_KERNEL);
+			set_pte_mfn(PAGE_OFFSET + i, i >> PAGE_SHIFT, PAGE_KERNEL);
 
 		reserve_bootmem(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS);
 		printk(KERN_INFO "Xen: setup ISA identity maps\n");
-- 
1.5.4.1


linux-2.6-0047-xen-dom0-Match-up-set_pte_mfn-prototype-with-the.patch:

--- NEW FILE linux-2.6-0047-xen-dom0-Match-up-set_pte_mfn-prototype-with-the.patch ---
>From 2db238704dd7015ef03bc6d070da5b73b4c64cec Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Fri, 1 Feb 2008 10:19:02 +0000
Subject: [PATCH] xen dom0: Match up set_pte_mfn() prototype with the impl

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/mmu.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index 8594c92..34b1757 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -16,7 +16,7 @@
 #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);
+void set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags);
 
 void xen_set_pte(pte_t *ptep, pte_t pteval);
 void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
-- 
1.5.4.1


linux-2.6-0048-xen-dom0-Reserve-ISA-address-space-earlier.patch:

--- NEW FILE linux-2.6-0048-xen-dom0-Reserve-ISA-address-space-earlier.patch ---
>From 34721eeb0f38e7fe8567a47bc9aa0f3328b55d52 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Fri, 1 Feb 2008 15:08:26 +0000
Subject: [PATCH] xen dom0: Reserve ISA address space earlier

Reserve the ISA address space earlier so as to prevent
pmd/pte pages from being allocated there. Otherwise
we run the risk of some page tables being blown away
later when we remap that region.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/enlighten.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 363a4f5..0866c20 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -794,6 +794,13 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
 	 */
 	memcpy(base, xen_pgd, PTRS_PER_PGD * sizeof(pgd_t));
 
+	/*
+	 * If we're dom0, then reserve the ISA address space
+	 * so that pmd/pte pages don't get allocated there.
+	 */
+	if (is_initial_xendomain())
+		reserve_bootmem(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS);
+
 	if (PTRS_PER_PMD > 1) {
 		int i;
 		/*
@@ -876,7 +883,6 @@ static __init void xen_pagetable_setup_done(pgd_t *base)
 		for (i = ISA_START_ADDRESS; i < ISA_END_ADDRESS; i += PAGE_SIZE)
 			set_pte_mfn(PAGE_OFFSET + i, i >> PAGE_SHIFT, PAGE_KERNEL);
 
-		reserve_bootmem(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS);
 		printk(KERN_INFO "Xen: setup ISA identity maps\n");
 
 		/*
-- 
1.5.4.1


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

--- NEW FILE linux-2.6-0049-xen-Add-empty-xenctrl-module.patch ---
>From 8a2b660e6a45e4f441cbf163df2501b0bd8ecb63 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         |   11 +++++++
 drivers/xen/Makefile         |    2 +
 drivers/xen/xenctrl/Makefile |    4 +++
 drivers/xen/xenctrl/main.c   |   62 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 79 insertions(+), 0 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 fbfa55c..7f01d14 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -10,3 +10,14 @@ config XEN
 	  This is the Linux Xen port.  Enabling this will allow the
 	  kernel to boot in a paravirtualized environment under the
 	  Xen hypervisor.
+
+config XENCTRL
+	tristate "Xen's user space control interfaces"
+	depends on XEN && PROC_FS
+	default m if XEN
+	help
+	  This is the /proc/xen and /dev/evtchn interfaces used by
+	  Xen's libxc and xenstored.
+
+	  Enable this if you wish to use this kernel to boot a
+	  privileged (i.e. Dom0) Xen guest.
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index 56592f0..6737463 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -1,2 +1,4 @@
 obj-y	+= grant-table.o
 obj-y	+= xenbus/
+
+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-0050-xen-dom0-Add-proc-xen-capabilities.patch:

--- NEW FILE linux-2.6-0050-xen-dom0-Add-proc-xen-capabilities.patch ---
>From ff8d1ce07961633c01846fc746c863bca53550df 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 dom0: 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      |   37 +++++++++++++++++++
 4 files changed, 117 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..66443fb
--- /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 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 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..e90e588
--- /dev/null
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.
+ */
+
+/*
+ * capabilities.c
+ */
+int capabilities_create_proc_entry(void);
+void capabilities_remove_proc_entry(void);
-- 
1.5.4.1


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

--- NEW FILE linux-2.6-0051-xen-Add-proc-xen-privcmd.patch ---
>From 2148d579f8673c6cb4cd66110d0105543c22157d 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   |   88 +++++++++++++++++++++++++++++++++++++++
 drivers/xen/xenctrl/xenctrl.h   |    6 +++
 include/asm-x86/xen/hypercall.h |   28 ++++++++++++
 include/xen/sys/privcmd.h       |   79 +++++++++++++++++++++++++++++++++++
 6 files changed, 208 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..1746a17
--- /dev/null
+++ b/drivers/xen/xenctrl/privcmd.c
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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)
+{
+	int ret = -ENOSYS;
+
+	switch (cmd) {
+	case IOCTL_PRIVCMD_HYPERCALL: {
+		privcmd_hypercall_t hypercall;
+  
+		if (copy_from_user(&hypercall, (void __user *)arg,
+				   sizeof(hypercall)))
+			return -EFAULT;
+
+		ret = privcmd_hypercall(&hypercall);
+		break;
+	}
+
+	case IOCTL_PRIVCMD_MMAP:
+	case IOCTL_PRIVCMD_MMAPBATCH:
+		printk(KERN_WARNING "IOCTL_PRIVCMD_MMAP ioctl not yet implemented\n");
+	default:
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
+}
+
+static const struct file_operations privcmd_file_ops = {
+	.unlocked_ioctl = privcmd_ioctl,
+};
+
+int 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 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 e90e588..e88ada5 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -35,3 +35,9 @@
  */
 int capabilities_create_proc_entry(void);
 void capabilities_remove_proc_entry(void);
+
+/*
+ * privcmd.c
+ */
+int privcmd_create_proc_entry(void);
+void privcmd_remove_proc_entry(void);
diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
index 0802755..47b61f8 100644
--- a/include/asm-x86/xen/hypercall.h
+++ b/include/asm-x86/xen/hypercall.h
@@ -419,4 +419,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-0052-xen-dom0-Add-proc-xen-xsd_-port-kva.patch:

--- NEW FILE linux-2.6-0052-xen-dom0-Add-proc-xen-xsd_-port-kva.patch ---
>From 859171fe39c21fbff963c9fb9afa1996e9dcc942 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 4 Feb 2008 10:29:28 +0000
Subject: [PATCH] xen dom0: Add /proc/xen/xsd_{port,kva}

These two /proc interfaces allows xenstored to make
itself available to the Dom0 kernel by mapping the
"interface" page, and connecting to the event
channel, allocated by the kernel.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenbus/xenbus_comms.h |    2 -
 drivers/xen/xenbus/xenbus_probe.c |    5 +-
 drivers/xen/xenctrl/Makefile      |    1 +
 drivers/xen/xenctrl/main.c        |    6 ++
 drivers/xen/xenctrl/xenctrl.h     |    6 ++
 drivers/xen/xenctrl/xenstore.c    |  118 +++++++++++++++++++++++++++++++++++++
 include/xen/xenbus.h              |    4 +
 7 files changed, 139 insertions(+), 3 deletions(-)
 create mode 100644 drivers/xen/xenctrl/xenstore.c

diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
index c21db75..cb5324f 100644
--- a/drivers/xen/xenbus/xenbus_comms.h
+++ b/drivers/xen/xenbus/xenbus_comms.h
@@ -40,7 +40,5 @@ int xb_read(void *data, unsigned len);
 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 1531adf..290e993 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -56,8 +56,11 @@
 #include "xenbus_probe.h"
 
 int xen_store_evtchn;
+EXPORT_SYMBOL_GPL(xen_store_evtchn);
+unsigned long xen_store_mfn;
+EXPORT_SYMBOL_GPL(xen_store_mfn);
 struct xenstore_domain_interface *xen_store_interface;
-static unsigned long xen_store_mfn;
+EXPORT_SYMBOL_GPL(xen_store_interface);
 
 static BLOCKING_NOTIFIER_HEAD(xenstore_chain);
 
diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index 8a706cb..4416174 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 += xenstore.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index d1fe6ef..2ebf85a 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 = xsd_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)
 {
+	xsd_remove_proc_entry();
 	privcmd_remove_proc_entry();
 	capabilities_remove_proc_entry();
 	remove_proc_entry("xen", NULL);
diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h
index e88ada5..0e8f8cf 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -41,3 +41,9 @@ void capabilities_remove_proc_entry(void);
  */
 int privcmd_create_proc_entry(void);
 void privcmd_remove_proc_entry(void);
+
+/*
+ * xenstore.c
+ */
+int xsd_create_proc_entry(void);
+void xsd_remove_proc_entry(void);
diff --git a/drivers/xen/xenctrl/xenstore.c b/drivers/xen/xenctrl/xenstore.c
new file mode 100644
index 0000000..4b38ff5
--- /dev/null
+++ b/drivers/xen/xenctrl/xenstore.c
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * xenstore.c
+ *
+ * /proc/xen/xsd_{port,kva}
+ *
+ * Copyright (C) 2005 Rusty Russell, IBM Corporation
+ * Copyright (C) 2005 Mike Wray, Hewlett-Packard
+ * Copyright (C) 2005, 2006 XenSource Ltd
+ * Copyright (C) 2007 Solarflare Communications, Inc.
+ * 
+ * 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/seq_file.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <asm/xen/hypervisor.h>
+#include <xen/page.h>
+#include <xen/xenbus.h>
+
+static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
+{
+	size_t size = vma->vm_end - vma->vm_start;
+
+	if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
+		return -EINVAL;
+
+	if (remap_pfn_range(vma, vma->vm_start, mfn_to_pfn(xen_store_mfn),
+			    size, vma->vm_page_prot))
+		return -EAGAIN;
+
+	return 0;
+}
+
+static int xsd_kva_show(struct seq_file *m, void *v)
+{
+	seq_printf(m, "0x%p\n", xen_store_interface);
+	return 0;
+}
+
+static int xsd_kva_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, xsd_kva_show, NULL);
+}
+
+static const struct file_operations xsd_kva_fops = {
+	.open		= xsd_kva_open,
+	.mmap		= xsd_kva_mmap,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
+static int xsd_port_read(char *page, char **start, off_t off,
+			 int count, int *eof, void *data)
+{
+	int len;
+
+	len  = sprintf(page, "%d\n", xen_store_evtchn);
+	*eof = 1;
+	return len;
+}
+
+int xsd_create_proc_entry(void)
+{
+	struct proc_dir_entry *entry;
+
+	if (!is_initial_xendomain())
+		return 0;
+
+	entry = create_proc_entry("xen/xsd_kva", 0600, NULL);
+	if (!entry)
+		return -ENOMEM;
+
+	entry->owner = THIS_MODULE;
+	entry->proc_fops = &xsd_kva_fops;
+
+	entry = create_proc_entry("xen/xsd_port", 0400, NULL);
+	if (!entry)
+		goto fail;
+
+	entry->owner = THIS_MODULE;
+	entry->read_proc = xsd_port_read;
+
+	return 0;
+
+ fail:  remove_proc_entry("xen/xsd_kva", NULL);
+	return - ENOMEM;
+}
+
+void xsd_remove_proc_entry(void)
+{
+	remove_proc_entry("xen/xsd_port", NULL);
+	remove_proc_entry("xen/xsd_kva", NULL);
+}
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 6f7c290..40e0083 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -231,4 +231,8 @@ 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;
+extern unsigned long xen_store_mfn;
+extern struct xenstore_domain_interface *xen_store_interface;
+
 #endif /* _XEN_XENBUS_H */
-- 
1.5.4.1


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

--- NEW FILE linux-2.6-0053-xen-Add-proc-xen-xenbus.patch ---
>From 3d5825ae92d8c5b59448a51d818c4b049b414e4f 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_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 +
 5 files changed, 412 insertions(+), 0 deletions(-)
 create mode 100644 drivers/xen/xenctrl/xenbus.c

diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 227d53b..810e24a 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 4416174..959b0eb 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 += xenstore.o
+xenctrl-objs += xenbus.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index 2ebf85a..95e1b3b 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 = xenbus_create_proc_entry();
+	if (ret)
+		goto fail4;
+
 	return 0;
 
+ fail4: xsd_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)
 {
+	xenbus_remove_proc_entry();
 	xsd_remove_proc_entry();
 	privcmd_remove_proc_entry();
 	capabilities_remove_proc_entry();
diff --git a/drivers/xen/xenctrl/xenbus.c b/drivers/xen/xenctrl/xenbus.c
new file mode 100644
index 0000000..8127dc8
--- /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 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 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 0e8f8cf..5990be5 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -47,3 +47,9 @@ void privcmd_remove_proc_entry(void);
  */
 int xsd_create_proc_entry(void);
 void xsd_remove_proc_entry(void);
+
+/*
+ * xenbus.c
+ */
+int xenbus_create_proc_entry(void);
+void xenbus_remove_proc_entry(void);
-- 
1.5.4.1


linux-2.6-0054-xen-Add-dev-xen-evtchn.patch:

--- NEW FILE linux-2.6-0054-xen-Add-dev-xen-evtchn.patch ---
>From 6c6205cc795e06cbfc9bad5d54ce4dbb3984de95 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 4 Feb 2008 08:25:31 +0000
Subject: [PATCH] xen: Add /dev/xen/evtchn

This device driver allows userspace programs to allocate
event channels, bind to existing channels, poll for
pending events etc.

An additional kernel interface is provided to allow the
driver to register a handler for event upcalls.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/events.c         |   31 ++-
 drivers/xen/xenctrl/Makefile  |    1 +
 drivers/xen/xenctrl/evtchn.c  |  552 +++++++++++++++++++++++++++++++++++++++++
 drivers/xen/xenctrl/main.c    |    6 +
 drivers/xen/xenctrl/xenctrl.h |    6 +
 include/xen/events.h          |   11 +
 include/xen/sys/evtchn.h      |   88 +++++++
 7 files changed, 691 insertions(+), 4 deletions(-)
 create mode 100644 drivers/xen/xenctrl/evtchn.c
 create mode 100644 include/xen/sys/evtchn.h

diff --git a/arch/x86/xen/events.c b/arch/x86/xen/events.c
index ca4912e..abce636 100644
--- a/arch/x86/xen/events.c
+++ b/arch/x86/xen/events.c
@@ -169,11 +169,12 @@ static inline unsigned int cpu_from_evtchn(unsigned int evtchn)
 	return cpu_evtchn[evtchn];
 }
 
-static inline void clear_evtchn(int port)
+void clear_evtchn(int port)
 {
 	struct shared_info *s = HYPERVISOR_shared_info;
 	sync_clear_bit(port, &s->evtchn_pending[0]);
 }
+EXPORT_SYMBOL_GPL(clear_evtchn);
 
 static inline void set_evtchn(int port)
 {
@@ -199,13 +200,14 @@ void notify_remote_via_irq(int irq)
 }
 EXPORT_SYMBOL_GPL(notify_remote_via_irq);
 
-static void mask_evtchn(int port)
+void mask_evtchn(int port)
 {
 	struct shared_info *s = HYPERVISOR_shared_info;
 	sync_set_bit(port, &s->evtchn_mask[0]);
 }
+EXPORT_SYMBOL_GPL(mask_evtchn);
 
-static void unmask_evtchn(int port)
+void unmask_evtchn(int port)
 {
 	struct shared_info *s = HYPERVISOR_shared_info;
 	unsigned int cpu = get_cpu();
@@ -234,6 +236,7 @@ static void unmask_evtchn(int port)
 
 	put_cpu();
 }
+EXPORT_SYMBOL_GPL(unmask_evtchn);
 
 static int find_unbound_irq(void)
 {
@@ -463,6 +466,22 @@ void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector)
 	notify_remote_via_irq(irq);
 }
 
+/*
+ * Notifier list for event channels not bound to an irq
+ */
+static ATOMIC_NOTIFIER_HEAD(evtchn_upcall_notifier);
+
+int register_evtchn_upcall_notifier(struct notifier_block *n)
+{
+	return atomic_notifier_chain_register(&evtchn_upcall_notifier, n);
+}
+EXPORT_SYMBOL(register_evtchn_upcall_notifier);
+
+int unregister_evtchn_upcall_notifier(struct notifier_block *n)
+{
+	return atomic_notifier_chain_unregister(&evtchn_upcall_notifier, n);
+}
+EXPORT_SYMBOL(unregister_evtchn_upcall_notifier);
 
 /*
  * Search the CPUs pending events bitmasks.  For each one found, map
@@ -503,6 +522,9 @@ fastcall void xen_evtchn_do_upcall(struct pt_regs *regs)
 			if (irq != -1) {
 				regs->orig_eax = ~irq;
 				do_IRQ(regs);
+			} else {
+				atomic_notifier_call_chain(&evtchn_upcall_notifier,
+							   port, NULL);
 			}
 		}
 	}
@@ -515,7 +537,7 @@ fastcall void xen_evtchn_do_upcall(struct pt_regs *regs)
 }
 
 /* Rebind an evtchn so that it gets delivered to a specific cpu */
-static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
+void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 {
 	struct evtchn_bind_vcpu bind_vcpu;
 	int evtchn = evtchn_from_irq(irq);
@@ -535,6 +557,7 @@ static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 	if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0)
 		bind_evtchn_to_cpu(evtchn, tcpu);
 }
+EXPORT_SYMBOL_GPL(rebind_irq_to_cpu);
 
 
 static void set_affinity_irq(unsigned irq, cpumask_t dest)
diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index 959b0eb..efc12c2 100644
--- a/drivers/xen/xenctrl/Makefile
+++ b/drivers/xen/xenctrl/Makefile
@@ -6,3 +6,4 @@ xenctrl-objs += capabilities.o
 xenctrl-objs += privcmd.o
 xenctrl-objs += xenstore.o
 xenctrl-objs += xenbus.o
+xenctrl-objs += evtchn.o
diff --git a/drivers/xen/xenctrl/evtchn.c b/drivers/xen/xenctrl/evtchn.c
new file mode 100644
index 0000000..22fabe2
--- /dev/null
+++ b/drivers/xen/xenctrl/evtchn.c
@@ -0,0 +1,552 @@
+/******************************************************************************
+ * evtchn.c
+ * 
+ * Driver for receiving and demuxing event-channel signals.
+ * 
+ * Copyright (c) 2004-2005, K A Fraser
+ * Multi-process extensions Copyright (c) 2004, Steven Smith
+ * 
+ * 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/fs.h>
+#include <linux/uaccess.h>
+#include <linux/poll.h>
+#include <linux/module.h>
+#include <linux/miscdevice.h>
+#include <linux/cpu.h>
+#include <asm/xen/hypervisor.h>
+#include <xen/events.h>
+#include <xen/sys/evtchn.h>
+
+struct per_user_data {
+	/* Notification ring, accessed via /dev/xen/evtchn. */
+#define EVTCHN_RING_SIZE     (PAGE_SIZE / sizeof(evtchn_port_t))
+#define EVTCHN_RING_MASK(_i) ((_i)&(EVTCHN_RING_SIZE-1))
+	evtchn_port_t *ring;
+	unsigned int ring_cons, ring_prod, ring_overflow;
+	struct mutex ring_cons_mutex; /* protect against concurrent readers */
+
+	/* Processes wait on this queue when ring is empty. */
+	wait_queue_head_t evtchn_wait;
+	struct fasync_struct *evtchn_async_queue;
+
+	int bind_cpu;
+	int nr_event_wrong_delivery;
+};
+
+/* Who's bound to each port? */
+static struct per_user_data *port_user[NR_EVENT_CHANNELS];
+static spinlock_t port_user_lock;
+
+static int evtchn_upcall_callback(struct notifier_block *nb,
+				  unsigned long port, void *v)
+{
+	struct per_user_data *u;
+	int ret = NOTIFY_OK;
+
+	spin_lock(&port_user_lock);
+
+	if (!(u = port_user[port]))
+		goto out;
+
+	ret = NOTIFY_STOP;
+
+	mask_evtchn(port);
+	clear_evtchn(port);
+
+	if ((u->ring_prod - u->ring_cons) >= EVTCHN_RING_SIZE) {
+		u->ring_overflow = 1;
+		goto out;
+	}
+
+	u->ring[EVTCHN_RING_MASK(u->ring_prod)] = port;
+	if (u->ring_cons != u->ring_prod++)
+		goto out;
+
+	wake_up_interruptible(&u->evtchn_wait);
+	kill_fasync(&u->evtchn_async_queue, SIGIO, POLL_IN);
+ out:
+	spin_unlock(&port_user_lock);
+	return ret;
+}
+
+static struct notifier_block evtchn_upcall_nfb = {
+        .notifier_call = evtchn_upcall_callback
+};
+
+static void evtchn_check_wrong_delivery(struct per_user_data *u)
+{
+	evtchn_port_t port;
+	unsigned int current_cpu = smp_processor_id();
+
+	/* Delivered to correct CPU? All is good. */
+	if (u->bind_cpu == current_cpu) {
+		u->nr_event_wrong_delivery = 0;
+		return;
+	}
+
+	/* Tolerate up to 100 consecutive misdeliveries. */
+	if (++u->nr_event_wrong_delivery < 100)
+		return;
+
+	spin_lock_irq(&port_user_lock);
+
+	for (port = 0; port < NR_EVENT_CHANNELS; port++)
+		if (port_user[port] == u)
+			rebind_irq_to_cpu(port, current_cpu);
+
+	u->bind_cpu = current_cpu;
+	u->nr_event_wrong_delivery = 0;
+
+	spin_unlock_irq(&port_user_lock);
+}
+
+static ssize_t evtchn_read(struct file *file, char __user *buf,
+			   size_t count, loff_t *ppos)
+{
+	int rc;
+	unsigned int c, p, bytes1 = 0, bytes2 = 0;
+	struct per_user_data *u = file->private_data;
+
+	/* Whole number of ports. */
+	count &= ~(sizeof(evtchn_port_t)-1);
+
+	if (count == 0)
+		return 0;
+
+	if (count > PAGE_SIZE)
+		count = PAGE_SIZE;
+
+	for (;;) {
+		mutex_lock(&u->ring_cons_mutex);
+
+		rc = -EFBIG;
+		if (u->ring_overflow)
+			goto unlock_out;
+
+		if ((c = u->ring_cons) != (p = u->ring_prod))
+			break;
+
+		mutex_unlock(&u->ring_cons_mutex);
+
+		if (file->f_flags & O_NONBLOCK)
+			return -EAGAIN;
+
+		rc = wait_event_interruptible(
+			u->evtchn_wait, u->ring_cons != u->ring_prod);
+		if (rc)
+			return rc;
+	}
+
+	/* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */
+	if (((c ^ p) & EVTCHN_RING_SIZE) != 0) {
+		bytes1 = (EVTCHN_RING_SIZE - EVTCHN_RING_MASK(c)) *
+			sizeof(evtchn_port_t);
+		bytes2 = EVTCHN_RING_MASK(p) * sizeof(evtchn_port_t);
+	} else {
+		bytes1 = (p - c) * sizeof(evtchn_port_t);
+		bytes2 = 0;
+	}
+
+	/* Truncate chunks according to caller's maximum byte count. */
+	if (bytes1 > count) {
+		bytes1 = count;
+		bytes2 = 0;
+	} else if ((bytes1 + bytes2) > count) {
+		bytes2 = count - bytes1;
+	}
+
+	rc = -EFAULT;
+	if (copy_to_user(buf, &u->ring[EVTCHN_RING_MASK(c)], bytes1) ||
+	    ((bytes2 != 0) &&
+	     copy_to_user(&buf[bytes1], &u->ring[0], bytes2)))
+		goto unlock_out;
+	
+	evtchn_check_wrong_delivery(u);
+
+	u->ring_cons += (bytes1 + bytes2) / sizeof(evtchn_port_t);
+	rc = bytes1 + bytes2;
+
+ unlock_out:
+	mutex_unlock(&u->ring_cons_mutex);
+	return rc;
+}
+
+static ssize_t evtchn_write(struct file *file, const char __user *buf,
+			    size_t count, loff_t *ppos)
+{
+	int rc, i;
+	evtchn_port_t *kbuf = (evtchn_port_t *)__get_free_page(GFP_KERNEL);
+	struct per_user_data *u = file->private_data;
+
+	if (kbuf == NULL)
+		return -ENOMEM;
+
+	/* Whole number of ports. */
+	count &= ~(sizeof(evtchn_port_t)-1);
+
+	rc = 0;
+	if (count == 0)
+		goto out;
+
+	if (count > PAGE_SIZE)
+		count = PAGE_SIZE;
+
+	rc = -EFAULT;
+	if (copy_from_user(kbuf, buf, count) != 0)
+		goto out;
+
+	spin_lock_irq(&port_user_lock);
+	for (i = 0; i < (count/sizeof(evtchn_port_t)); i++)
+		if ((kbuf[i] < NR_EVENT_CHANNELS) && (port_user[kbuf[i]] == u))
+			unmask_evtchn(kbuf[i]);
+	spin_unlock_irq(&port_user_lock);
+
+	rc = count;
+
+ out:
+	free_page((unsigned long)kbuf);
+	return rc;
+}
+
+static unsigned int next_bind_cpu(cpumask_t map)
+{
+	static unsigned int bind_cpu;
+	bind_cpu = next_cpu(bind_cpu, map);
+	if (bind_cpu >= NR_CPUS)
+		bind_cpu = first_cpu(map);
+	return bind_cpu;
+}
+
+static void evtchn_bind_to_user(struct per_user_data *u, int port)
+{
+	spin_lock_irq(&port_user_lock);
+
+	BUG_ON(port_user[port] != NULL);
+	port_user[port] = u;
+
+	if (u->bind_cpu == -1)
+		u->bind_cpu = next_bind_cpu(cpu_online_map);
+
+	rebind_irq_to_cpu(port, u->bind_cpu);
+
+	unmask_evtchn(port);
+
+	spin_unlock_irq(&port_user_lock);
+}
+
+static long evtchn_ioctl(struct file *file,
+			 unsigned int cmd, unsigned long arg)
+{
+	int rc;
+	struct per_user_data *u = file->private_data;
+	void __user *uarg = (void __user *) arg;
+
+	switch (cmd) {
+	case IOCTL_EVTCHN_BIND_VIRQ: {
+		struct ioctl_evtchn_bind_virq bind;
+		struct evtchn_bind_virq bind_virq;
+
+		rc = -EFAULT;
+		if (copy_from_user(&bind, uarg, sizeof(bind)))
+			break;
+
+		bind_virq.virq = bind.virq;
+		bind_virq.vcpu = 0;
+		rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
+						 &bind_virq);
+		if (rc != 0)
+			break;
+
+		rc = bind_virq.port;
+		evtchn_bind_to_user(u, rc);
+		break;
+	}
+
+	case IOCTL_EVTCHN_BIND_INTERDOMAIN: {
+		struct ioctl_evtchn_bind_interdomain bind;
+		struct evtchn_bind_interdomain bind_interdomain;
+
+		rc = -EFAULT;
+		if (copy_from_user(&bind, uarg, sizeof(bind)))
+			break;
+
+		bind_interdomain.remote_dom  = bind.remote_domain;
+		bind_interdomain.remote_port = bind.remote_port;
+		rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
+						 &bind_interdomain);
+		if (rc != 0)
+			break;
+
+		rc = bind_interdomain.local_port;
+		evtchn_bind_to_user(u, rc);
+		break;
+	}
+
+	case IOCTL_EVTCHN_BIND_UNBOUND_PORT: {
+		struct ioctl_evtchn_bind_unbound_port bind;
+		struct evtchn_alloc_unbound alloc_unbound;
+
+		rc = -EFAULT;
+		if (copy_from_user(&bind, uarg, sizeof(bind)))
+			break;
+
+		alloc_unbound.dom        = DOMID_SELF;
+		alloc_unbound.remote_dom = bind.remote_domain;
+		rc = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
+						 &alloc_unbound);
+		if (rc != 0)
+			break;
+
+		rc = alloc_unbound.port;
+		evtchn_bind_to_user(u, rc);
+		break;
+	}
+
+	case IOCTL_EVTCHN_UNBIND: {
+		struct ioctl_evtchn_unbind unbind;
+		struct evtchn_close close;
+		int ret;
+
+		rc = -EFAULT;
+		if (copy_from_user(&unbind, uarg, sizeof(unbind)))
+			break;
+
+		rc = -EINVAL;
+		if (unbind.port >= NR_EVENT_CHANNELS)
+			break;
+
+		spin_lock_irq(&port_user_lock);
+    
+		rc = -ENOTCONN;
+		if (port_user[unbind.port] != u) {
+			spin_unlock_irq(&port_user_lock);
+			break;
+		}
+
+		port_user[unbind.port] = NULL;
+		mask_evtchn(unbind.port);
+
+		spin_unlock_irq(&port_user_lock);
+
+		close.port = unbind.port;
+		ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
+		BUG_ON(ret);
+
+		rc = 0;
+		break;
+	}
+
+	case IOCTL_EVTCHN_NOTIFY: {
+		struct ioctl_evtchn_notify notify;
+
+		rc = -EFAULT;
+		if (copy_from_user(&notify, uarg, sizeof(notify)))
+			break;
+
+		if (notify.port >= NR_EVENT_CHANNELS) {
+			rc = -EINVAL;
+		} else if (port_user[notify.port] != u) {
+			rc = -ENOTCONN;
+		} else {
+			notify_remote_via_evtchn(notify.port);
+			rc = 0;
+		}
+		break;
+	}
+
+	case IOCTL_EVTCHN_RESET: {
+		/* Initialise the ring to empty. Clear errors. */
+		mutex_lock(&u->ring_cons_mutex);
+		spin_lock_irq(&port_user_lock);
+		u->ring_cons = u->ring_prod = u->ring_overflow = 0;
+		spin_unlock_irq(&port_user_lock);
+		mutex_unlock(&u->ring_cons_mutex);
+		rc = 0;
+		break;
+	}
+
+	default:
+		rc = -ENOSYS;
+		break;
+	}
+
+	return rc;
+}
+
+static unsigned int evtchn_poll(struct file *file, poll_table *wait)
+{
+	unsigned int mask = POLLOUT | POLLWRNORM;
+	struct per_user_data *u = file->private_data;
+
+	poll_wait(file, &u->evtchn_wait, wait);
+	if (u->ring_cons != u->ring_prod)
+		mask |= POLLIN | POLLRDNORM;
+	if (u->ring_overflow)
+		mask = POLLERR;
+	return mask;
+}
+
+static int evtchn_fasync(int fd, struct file *filp, int on)
+{
+	struct per_user_data *u = filp->private_data;
+	return fasync_helper(fd, filp, on, &u->evtchn_async_queue);
+}
+
+static int evtchn_open(struct inode *inode, struct file *filp)
+{
+	struct per_user_data *u;
+
+	if ((u = kmalloc(sizeof(*u), GFP_KERNEL)) == NULL)
+		return -ENOMEM;
+
+	memset(u, 0, sizeof(*u));
+	init_waitqueue_head(&u->evtchn_wait);
+
+	u->ring = (evtchn_port_t *)__get_free_page(GFP_KERNEL);
+	if (u->ring == NULL) {
+		kfree(u);
+		return -ENOMEM;
+	}
+
+	mutex_init(&u->ring_cons_mutex);
+
+	filp->private_data = u;
+
+	u->bind_cpu = -1;
+
+	return 0;
+}
+
+static int evtchn_release(struct inode *inode, struct file *filp)
+{
+	int i;
+	struct per_user_data *u = filp->private_data;
+	struct evtchn_close close;
+
+	spin_lock_irq(&port_user_lock);
+
+	free_page((unsigned long)u->ring);
+
+	for (i = 0; i < NR_EVENT_CHANNELS; i++) {
+		int ret;
+		if (port_user[i] != u)
+			continue;
+
+		port_user[i] = NULL;
+		mask_evtchn(i);
+
+		close.port = i;
+		ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
+		BUG_ON(ret);
+	}
+
+	spin_unlock_irq(&port_user_lock);
+
+	kfree(u);
+
+	return 0;
+}
+
+static const struct file_operations evtchn_fops = {
+	.owner   = THIS_MODULE,
+	.read    = evtchn_read,
+	.write   = evtchn_write,
+	.unlocked_ioctl = evtchn_ioctl,
+	.poll    = evtchn_poll,
+	.fasync  = evtchn_fasync,
+	.open    = evtchn_open,
+	.release = evtchn_release,
+};
+
+static struct miscdevice evtchn_miscdev = {
+	.minor        = MISC_DYNAMIC_MINOR,
+	.name         = "evtchn",
+	.fops         = &evtchn_fops,
+};
+
+static int __cpuinit evtchn_cpu_notify(struct notifier_block *nfb,
+			unsigned long action, void *hcpu)
+{
+	int hotcpu = (unsigned long)hcpu;
+	cpumask_t map = cpu_online_map;
+	int port, newcpu;
+	struct per_user_data *u;
+
+	switch (action) {
+	case CPU_DOWN_PREPARE:
+		cpu_clear(hotcpu, map);
+		spin_lock_irq(&port_user_lock);
+		for (port = 0; port < NR_EVENT_CHANNELS; port++) {
+			if ((u = port_user[port]) != NULL && 
+			    u->bind_cpu == hotcpu &&
+			    (newcpu = next_bind_cpu(map)) < NR_CPUS) {
+				rebind_irq_to_cpu(port, newcpu);
+				u->bind_cpu = newcpu;
+			}
+		}
+		spin_unlock_irq(&port_user_lock);
+		break;
+	default:
+		return NOTIFY_DONE;
+	}
+	return NOTIFY_OK;
+}
+
+static struct notifier_block __cpuinitdata evtchn_cpu_nfb = {
+	.notifier_call = evtchn_cpu_notify
+};
+
+int evtchn_init(void)
+{
+	int err;
+
+	spin_lock_init(&port_user_lock);
+	memset(port_user, 0, sizeof(port_user));
+
+	register_evtchn_upcall_notifier(&evtchn_upcall_nfb);
+	register_cpu_notifier(&evtchn_cpu_nfb);
+
+	err = misc_register(&evtchn_miscdev);
+	if (err != 0) {
+		printk(KERN_ALERT "Could not register /dev/xen/evtchn\n");
+		goto fail;
+	}
+
+	return 0;
+
+ fail:
+	unregister_cpu_notifier(&evtchn_cpu_nfb);
+	unregister_evtchn_upcall_notifier(&evtchn_upcall_nfb);
+	return err;
+}
+
+void evtchn_exit(void)
+{
+	misc_deregister(&evtchn_miscdev);
+	unregister_cpu_notifier(&evtchn_cpu_nfb);
+	unregister_evtchn_upcall_notifier(&evtchn_upcall_nfb);
+}
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index 95e1b3b..a2d5ca3 100644
--- a/drivers/xen/xenctrl/main.c
+++ b/drivers/xen/xenctrl/main.c
@@ -67,8 +67,13 @@ static int __init xenctrl_init(void)
 	if (ret)
 		goto fail4;
 
+	ret = evtchn_init();
+	if (ret)
+		goto fail5;
+
 	return 0;
 
+ fail5: xenbus_remove_proc_entry();
  fail4: xsd_remove_proc_entry();
  fail3: privcmd_remove_proc_entry();
  fail2: capabilities_remove_proc_entry();
@@ -78,6 +83,7 @@ static int __init xenctrl_init(void)
 
 static void __exit xenctrl_exit(void)
 {
+	evtchn_exit();
 	xenbus_remove_proc_entry();
 	xsd_remove_proc_entry();
 	privcmd_remove_proc_entry();
diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h
index 5990be5..63117bd 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -53,3 +53,9 @@ void xsd_remove_proc_entry(void);
  */
 int xenbus_create_proc_entry(void);
 void xenbus_remove_proc_entry(void);
+
+/*
+ * evtchn.c
+ */
+int evtchn_init(void);
+void evtchn_exit(void);
diff --git a/include/xen/events.h b/include/xen/events.h
index 0436486..7b3ee9e 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -2,6 +2,7 @@
 #define _XEN_EVENTS_H
 
 #include <linux/interrupt.h>
+#include <linux/notifier.h>
 
 #include <xen/interface/event_channel.h>
 #include <asm/xen/hypercall.h>
@@ -38,6 +39,12 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
  */
 void unbind_from_irqhandler(unsigned int irq, void *dev_id);
 
+void mask_evtchn(int port);
+void unmask_evtchn(int port);
+void clear_evtchn(int port);
+
+void rebind_irq_to_cpu(unsigned irq, unsigned tcpu);
+
 void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
 
 static inline void notify_remote_via_evtchn(int port)
@@ -47,4 +54,8 @@ static inline void notify_remote_via_evtchn(int port)
 }
 
 extern void notify_remote_via_irq(int irq);
+
+int register_evtchn_upcall_notifier(struct notifier_block *n);
+int unregister_evtchn_upcall_notifier(struct notifier_block *n);
+
 #endif	/* _XEN_EVENTS_H */
diff --git a/include/xen/sys/evtchn.h b/include/xen/sys/evtchn.h
new file mode 100644
index 0000000..938d4da
--- /dev/null
+++ b/include/xen/sys/evtchn.h
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * evtchn.h
+ * 
+ * Interface to /dev/xen/evtchn.
+ * 
+ * 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_EVTCHN_H__
+#define __LINUX_PUBLIC_EVTCHN_H__
+
+/*
+ * Bind a fresh port to VIRQ @virq.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_VIRQ				\
+	_IOC(_IOC_NONE, 'E', 0, sizeof(struct ioctl_evtchn_bind_virq))
+struct ioctl_evtchn_bind_virq {
+	unsigned int virq;
+};
+
+/*
+ * Bind a fresh port to remote <@remote_domain, @remote_port>.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_INTERDOMAIN			\
+	_IOC(_IOC_NONE, 'E', 1, sizeof(struct ioctl_evtchn_bind_interdomain))
+struct ioctl_evtchn_bind_interdomain {
+	unsigned int remote_domain, remote_port;
+};
+
+/*
+ * Allocate a fresh port for binding to @remote_domain.
+ * Return allocated port.
+ */
+#define IOCTL_EVTCHN_BIND_UNBOUND_PORT			\
+	_IOC(_IOC_NONE, 'E', 2, sizeof(struct ioctl_evtchn_bind_unbound_port))
+struct ioctl_evtchn_bind_unbound_port {
+	unsigned int remote_domain;
+};
+
+/*
+ * Unbind previously allocated @port.
+ */
+#define IOCTL_EVTCHN_UNBIND				\
+	_IOC(_IOC_NONE, 'E', 3, sizeof(struct ioctl_evtchn_unbind))
+struct ioctl_evtchn_unbind {
+	unsigned int port;
+};
+
+/*
+ * Unbind previously allocated @port.
+ */
+#define IOCTL_EVTCHN_NOTIFY				\
+	_IOC(_IOC_NONE, 'E', 4, sizeof(struct ioctl_evtchn_notify))
+struct ioctl_evtchn_notify {
+	unsigned int port;
+};
+
+/* Clear and reinitialise the event buffer. Clear error condition. */
+#define IOCTL_EVTCHN_RESET				\
+	_IOC(_IOC_NONE, 'E', 5, 0)
+
+#endif /* __LINUX_PUBLIC_EVTCHN_H__ */
-- 
1.5.4.1


linux-2.6-0055-xen-Add-__init-__exit-notations-to-xenctrl-function.patch:

--- NEW FILE linux-2.6-0055-xen-Add-__init-__exit-notations-to-xenctrl-function.patch ---
>From ad1aeb74ebf2d336685a7d2f0ffb623ca174ebc5 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Thu, 7 Feb 2008 15:37:30 +0000
Subject: [PATCH] xen: Add __init/__exit notations to xenctrl function

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenctrl/capabilities.c |    4 ++--
 drivers/xen/xenctrl/evtchn.c       |    4 ++--
 drivers/xen/xenctrl/privcmd.c      |    4 ++--
 drivers/xen/xenctrl/xenbus.c       |    4 ++--
 drivers/xen/xenctrl/xenctrl.h      |   22 ++++++++++++----------
 drivers/xen/xenctrl/xenstore.c     |    4 ++--
 6 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/xen/xenctrl/capabilities.c b/drivers/xen/xenctrl/capabilities.c
index 66443fb..1ff078a 100644
--- a/drivers/xen/xenctrl/capabilities.c
+++ b/drivers/xen/xenctrl/capabilities.c
@@ -48,7 +48,7 @@ static int capabilities_read(char *page, char **start, off_t off,
 	return len;
 }
 
-int capabilities_create_proc_entry(void)
+int __init capabilities_create_proc_entry(void)
 {
 	struct proc_dir_entry *entry;
 
@@ -62,7 +62,7 @@ int capabilities_create_proc_entry(void)
 	return 0;
 }
 
-void capabilities_remove_proc_entry(void)
+void __exit capabilities_remove_proc_entry(void)
 {
 	remove_proc_entry("xen/capabilities", NULL);
 }
diff --git a/drivers/xen/xenctrl/evtchn.c b/drivers/xen/xenctrl/evtchn.c
index 22fabe2..d894632 100644
--- a/drivers/xen/xenctrl/evtchn.c
+++ b/drivers/xen/xenctrl/evtchn.c
@@ -520,7 +520,7 @@ static struct notifier_block __cpuinitdata evtchn_cpu_nfb = {
 	.notifier_call = evtchn_cpu_notify
 };
 
-int evtchn_init(void)
+int __init evtchn_init(void)
 {
 	int err;
 
@@ -544,7 +544,7 @@ int evtchn_init(void)
 	return err;
 }
 
-void evtchn_exit(void)
+void __exit evtchn_exit(void)
 {
 	misc_deregister(&evtchn_miscdev);
 	unregister_cpu_notifier(&evtchn_cpu_nfb);
diff --git a/drivers/xen/xenctrl/privcmd.c b/drivers/xen/xenctrl/privcmd.c
index 1746a17..cf74948 100644
--- a/drivers/xen/xenctrl/privcmd.c
+++ b/drivers/xen/xenctrl/privcmd.c
@@ -68,7 +68,7 @@ static const struct file_operations privcmd_file_ops = {
 	.unlocked_ioctl = privcmd_ioctl,
 };
 
-int privcmd_create_proc_entry(void)
+int __init privcmd_create_proc_entry(void)
 {
 	static struct proc_dir_entry *entry;
 
@@ -82,7 +82,7 @@ int privcmd_create_proc_entry(void)
 	return 0;
 }
 
-void privcmd_remove_proc_entry(void)
+void __exit privcmd_remove_proc_entry(void)
 {
 	remove_proc_entry("xen/privcmd", NULL);
 }
diff --git a/drivers/xen/xenctrl/xenbus.c b/drivers/xen/xenctrl/xenbus.c
index 8127dc8..57d5501 100644
--- a/drivers/xen/xenctrl/xenbus.c
+++ b/drivers/xen/xenctrl/xenbus.c
@@ -378,7 +378,7 @@ static const struct file_operations xenbus_dev_file_ops = {
 	.poll = xenbus_dev_poll,
 };
 
-int xenbus_create_proc_entry(void)
+int __init xenbus_create_proc_entry(void)
 {
 	struct proc_dir_entry *entry;
 
@@ -392,7 +392,7 @@ int xenbus_create_proc_entry(void)
 	return 0;
 }
 
-void xenbus_remove_proc_entry(void)
+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 63117bd..9ca6b1f 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -30,32 +30,34 @@
  * IN THE SOFTWARE.
  */
 
+#include <linux/init.h>
+
 /*
  * capabilities.c
  */
-int capabilities_create_proc_entry(void);
-void capabilities_remove_proc_entry(void);
+int capabilities_create_proc_entry(void) __init;
+void capabilities_remove_proc_entry(void) __exit;
 
 /*
  * privcmd.c
  */
-int privcmd_create_proc_entry(void);
-void privcmd_remove_proc_entry(void);
+int privcmd_create_proc_entry(void) __init;
+void privcmd_remove_proc_entry(void) __exit;
 
 /*
  * xenstore.c
  */
-int xsd_create_proc_entry(void);
-void xsd_remove_proc_entry(void);
+int xsd_create_proc_entry(void) __init;
+void xsd_remove_proc_entry(void) __exit;
 
 /*
  * xenbus.c
  */
-int xenbus_create_proc_entry(void);
-void xenbus_remove_proc_entry(void);
+int xenbus_create_proc_entry(void) __init;
+void xenbus_remove_proc_entry(void) __exit;
 
 /*
  * evtchn.c
  */
-int evtchn_init(void);
-void evtchn_exit(void);
+int evtchn_init(void) __init;
+void evtchn_exit(void) __exit;
diff --git a/drivers/xen/xenctrl/xenstore.c b/drivers/xen/xenctrl/xenstore.c
index 4b38ff5..9b16e82 100644
--- a/drivers/xen/xenctrl/xenstore.c
+++ b/drivers/xen/xenctrl/xenstore.c
@@ -84,7 +84,7 @@ static int xsd_port_read(char *page, char **start, off_t off,
 	return len;
 }
 
-int xsd_create_proc_entry(void)
+int __init xsd_create_proc_entry(void)
 {
 	struct proc_dir_entry *entry;
 
@@ -111,7 +111,7 @@ int xsd_create_proc_entry(void)
 	return - ENOMEM;
 }
 
-void xsd_remove_proc_entry(void)
+void __exit xsd_remove_proc_entry(void)
 {
 	remove_proc_entry("xen/xsd_port", NULL);
 	remove_proc_entry("xen/xsd_kva", NULL);
-- 
1.5.4.1


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

--- NEW FILE linux-2.6-0056-xen-Add-Xen-s-sys-hypervisor-interface.patch ---
>From 4cb49c6a7650381ba772fe3ee401d55cf934601c 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 7f01d14..f2974af 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -13,8 +13,9 @@ config XEN
 
 config XENCTRL
 	tristate "Xen's user space control interfaces"
-	depends on XEN && PROC_FS
+	depends on XEN && PROC_FS && SYSFS
 	default m if XEN
+	select SYS_HYPERVISOR
 	help
 	  This is the /proc/xen and /dev/evtchn interfaces used by
 	  Xen's libxc and xenstored.
diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index efc12c2..b14836e 100644
--- a/drivers/xen/xenctrl/Makefile
+++ b/drivers/xen/xenctrl/Makefile
@@ -7,3 +7,4 @@ xenctrl-objs += privcmd.o
 xenctrl-objs += xenstore.o
 xenctrl-objs += xenbus.o
 xenctrl-objs += evtchn.o
+xenctrl-objs += sysfs.o
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index a2d5ca3..f6c715d 100644
--- a/drivers/xen/xenctrl/main.c
+++ b/drivers/xen/xenctrl/main.c
@@ -71,8 +71,13 @@ static int __init xenctrl_init(void)
 	if (ret)
 		goto fail5;
 
+	ret = sys_hypervisor_init();
+	if (ret)
+		goto fail6;
+
 	return 0;
 
+ fail6: sys_hypervisor_exit();
  fail5: xenbus_remove_proc_entry();
  fail4: xsd_remove_proc_entry();
  fail3: privcmd_remove_proc_entry();
@@ -83,6 +88,7 @@ static int __init xenctrl_init(void)
 
 static void __exit xenctrl_exit(void)
 {
+	sys_hypervisor_exit();
 	evtchn_exit();
 	xenbus_remove_proc_entry();
 	xsd_remove_proc_entry();
diff --git a/drivers/xen/xenctrl/sysfs.c b/drivers/xen/xenctrl/sysfs.c
new file mode 100644
index 0000000..3b38aaf
--- /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 subsys_attribute _name##_attr = __ATTR_RO(_name)
+
+#define HYPERVISOR_ATTR_RW(_name) \
+static struct subsys_attribute _name##_attr = \
+	__ATTR(_name, 0644, _name##_show, _name##_store)
+
+static ssize_t type_show(struct kset *kset, char *buffer)
+{
+	return sprintf(buffer, "xen\n");
+}
+
+HYPERVISOR_ATTR_RO(type);
+
+static int __init xen_sysfs_type_init(void)
+{
+	return sysfs_create_file(&hypervisor_subsys.kobj, &type_attr.attr);
+}
+
+static void xen_sysfs_type_destroy(void)
+{
+	sysfs_remove_file(&hypervisor_subsys.kobj, &type_attr.attr);
+}
+
+static ssize_t major_show(struct kset *kset, 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 kset *kset, 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 kset *kset, 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_subsys.kobj, &version_group);
+}
+
+static void xen_sysfs_version_destroy(void)
+{
+	sysfs_remove_group(&hypervisor_subsys.kobj, &version_group);
+}
+
+static ssize_t uuid_show(struct kset *kset, 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_subsys.kobj, &uuid_attr.attr);
+}
+
+static void xen_sysfs_uuid_destroy(void)
+{
+	sysfs_remove_file(&hypervisor_subsys.kobj, &uuid_attr.attr);
+}
+
+static ssize_t compiler_show(struct kset *kset, 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 kset *kset, 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 kset *kset, 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_subsys.kobj,
+				  &xen_compilation_group);
+}
+
+static void xen_compilation_destroy(void)
+{
+	sysfs_remove_group(&hypervisor_subsys.kobj,
+			   &xen_compilation_group);
+}
+
+static ssize_t capabilities_show(struct kset *kset, 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 kset *kset, 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 kset *kset, 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 kset *kset, 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 kset *kset, 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_subsys.kobj,
+				  &xen_properties_group);
+}
+
+static void xen_properties_destroy(void)
+{
+	sysfs_remove_group(&hypervisor_subsys.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 9ca6b1f..5c6d899 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -61,3 +61,9 @@ void xenbus_remove_proc_entry(void) __exit;
  */
 int evtchn_init(void) __init;
 void evtchn_exit(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-0057-xen-dom0-Add-basic-proc-xen-balloon.patch:

--- NEW FILE linux-2.6-0057-xen-dom0-Add-basic-proc-xen-balloon.patch ---
>From a5c0567769e088973ab955040d407834f51bcb2a Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Thu, 7 Feb 2008 19:11:54 +0000
Subject: [PATCH] xen dom0: Add basic /proc/xen/balloon

Userspace querys Dom0's current memory allocation using
/proc/xen/balloon. This implements that basic functionality,
leaving out the rest of the fields usually reported by
this interface.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenctrl/Makefile  |    1 +
 drivers/xen/xenctrl/balloon.c |   68 +++++++++++++++++++++++++++++++++++++++++
 drivers/xen/xenctrl/main.c    |   12 +++++--
 drivers/xen/xenctrl/xenctrl.h |    6 +++
 4 files changed, 84 insertions(+), 3 deletions(-)
 create mode 100644 drivers/xen/xenctrl/balloon.c

diff --git a/drivers/xen/xenctrl/Makefile b/drivers/xen/xenctrl/Makefile
index b14836e..823bb16 100644
--- a/drivers/xen/xenctrl/Makefile
+++ b/drivers/xen/xenctrl/Makefile
@@ -6,5 +6,6 @@ xenctrl-objs += capabilities.o
 xenctrl-objs += privcmd.o
 xenctrl-objs += xenstore.o
 xenctrl-objs += xenbus.o
+xenctrl-objs += balloon.o
 xenctrl-objs += evtchn.o
 xenctrl-objs += sysfs.o
diff --git a/drivers/xen/xenctrl/balloon.c b/drivers/xen/xenctrl/balloon.c
new file mode 100644
index 0000000..c8c1c13
--- /dev/null
+++ b/drivers/xen/xenctrl/balloon.c
@@ -0,0 +1,68 @@
+/******************************************************************************
+ *
+ * balloon.c
+ *
+ * /proc/xen/balloon
+ *
+ * Copyright (c) 2003, B Dragovic
+ * Copyright (c) 2003-2004, M Williamson, K Fraser
+ * Copyright (c) 2005 Dan M. Smith, 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/bootmem.h>
+#include <asm/xen/hypervisor.h>
+
+#define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
+
+static int balloon_read(char *page, char **start, off_t off,
+			int count, int *eof, void *data)
+{
+	*eof = 1;
+	return sprintf(page, "Current allocation: %8lu kB\n",
+		       PAGES2KB(xen_start_info->nr_pages));
+}
+
+int __init balloon_create_proc_entry(void)
+{
+	struct proc_dir_entry *entry;
+
+	entry = create_proc_entry("xen/balloon", 0644, NULL);
+	if (!entry)
+		return -ENOMEM;
+
+	entry->owner = THIS_MODULE;
+	entry->read_proc = balloon_read;
+
+	return 0;
+}
+
+void __exit balloon_remove_proc_entry(void)
+{
+	remove_proc_entry("xen/balloon", NULL);
+}
diff --git a/drivers/xen/xenctrl/main.c b/drivers/xen/xenctrl/main.c
index f6c715d..fe3e793 100644
--- a/drivers/xen/xenctrl/main.c
+++ b/drivers/xen/xenctrl/main.c
@@ -67,17 +67,22 @@ static int __init xenctrl_init(void)
 	if (ret)
 		goto fail4;
 
-	ret = evtchn_init();
+	ret = balloon_create_proc_entry();
 	if (ret)
 		goto fail5;
 
-	ret = sys_hypervisor_init();
+	ret = evtchn_init();
 	if (ret)
 		goto fail6;
 
+	ret = sys_hypervisor_init();
+	if (ret)
+		goto fail7;
+
 	return 0;
 
- fail6: sys_hypervisor_exit();
+ fail7: sys_hypervisor_exit();
+ fail6: balloon_remove_proc_entry();
  fail5: xenbus_remove_proc_entry();
  fail4: xsd_remove_proc_entry();
  fail3: privcmd_remove_proc_entry();
@@ -90,6 +95,7 @@ static void __exit xenctrl_exit(void)
 {
 	sys_hypervisor_exit();
 	evtchn_exit();
+	balloon_remove_proc_entry();
 	xenbus_remove_proc_entry();
 	xsd_remove_proc_entry();
 	privcmd_remove_proc_entry();
diff --git a/drivers/xen/xenctrl/xenctrl.h b/drivers/xen/xenctrl/xenctrl.h
index 5c6d899..105343f 100644
--- a/drivers/xen/xenctrl/xenctrl.h
+++ b/drivers/xen/xenctrl/xenctrl.h
@@ -57,6 +57,12 @@ int xenbus_create_proc_entry(void) __init;
 void xenbus_remove_proc_entry(void) __exit;
 
 /*
+ * balloon.c
+ */
+int balloon_create_proc_entry(void) __init;
+void balloon_remove_proc_entry(void) __exit;
+
+/*
  * evtchn.c
  */
 int evtchn_init(void) __init;
-- 
1.5.4.1


linux-2.6-0058-xen-dom0-Re-work-privcmd_ioctl-a-little.patch:

--- NEW FILE linux-2.6-0058-xen-dom0-Re-work-privcmd_ioctl-a-little.patch ---
>From 9ee1b3b4d416e0ab0b312df334460c84de42be9a Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Mon, 11 Feb 2008 11:23:54 +0000
Subject: [PATCH] xen dom0: Re-work privcmd_ioctl() a little

Re-organise the code in privcmd_ioctl() a little in
preparation for adding support for IOCTL_PRIVCMD_MMAP.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 drivers/xen/xenctrl/privcmd.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/xen/xenctrl/privcmd.c b/drivers/xen/xenctrl/privcmd.c
index cf74948..58c4b83 100644
--- a/drivers/xen/xenctrl/privcmd.c
+++ b/drivers/xen/xenctrl/privcmd.c
@@ -39,29 +39,22 @@
 static long privcmd_ioctl(struct file *file, unsigned int cmd,
 			  unsigned long arg)
 {
-	int ret = -ENOSYS;
-
 	switch (cmd) {
 	case IOCTL_PRIVCMD_HYPERCALL: {
-		privcmd_hypercall_t hypercall;
+		privcmd_hypercall_t cmd;
   
-		if (copy_from_user(&hypercall, (void __user *)arg,
-				   sizeof(hypercall)))
+		if (copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)))
 			return -EFAULT;
 
-		ret = privcmd_hypercall(&hypercall);
-		break;
+		return privcmd_hypercall(&cmd);
 	}
 
 	case IOCTL_PRIVCMD_MMAP:
 	case IOCTL_PRIVCMD_MMAPBATCH:
 		printk(KERN_WARNING "IOCTL_PRIVCMD_MMAP ioctl not yet implemented\n");
 	default:
-		ret = -EINVAL;
-		break;
+		return -EINVAL;
 	}
-
-	return ret;
 }
 
 static const struct file_operations privcmd_file_ops = {
-- 
1.5.4.1


linux-2.6-0059-xen-dom0-Add-IOCTL_PRIVCMD_MMAP.patch:

--- NEW FILE linux-2.6-0059-xen-dom0-Add-IOCTL_PRIVCMD_MMAP.patch ---
>From c647aacea518e0a0b0358a04576a33aca697683b Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Thu, 7 Feb 2008 19:05:10 +0000
Subject: [PATCH] xen dom0: Add IOCTL_PRIVCMD_MMAP

IOCTL_PRIVCMD_MMAP is used by Dom0 userspace (via
libxc's xc_map_foreign_range() function) to map
pages from a foreign domain without requiring a
grant and without adding the page to Dom0's
p2m map.

Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 arch/x86/xen/ioremap.c           |   30 +++++++
 drivers/xen/xenctrl/privcmd.c    |  176 +++++++++++++++++++++++++++++++++++++-
 include/asm-x86/xen/hypervisor.h |    4 +
 3 files changed, 207 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/ioremap.c b/arch/x86/xen/ioremap.c
index 70f77bd..e963ff9 100644
--- a/arch/x86/xen/ioremap.c
+++ b/arch/x86/xen/ioremap.c
@@ -145,3 +145,33 @@ int xen_ioremap_page_range(unsigned long addr, unsigned long end,
 	return rc;
 }
 
+int xen_map_foreign_range(struct vm_area_struct *vma, unsigned long addr,
+			  unsigned long mfn, unsigned long size,
+			  pgprot_t prot, domid_t domid)
+{
+	if (xen_feature(XENFEAT_auto_translated_physmap))
+		return remap_pfn_range(vma, addr, mfn, size, prot);
+
+	if (domid == DOMID_SELF)
+		return -EINVAL;
+
+	vma->vm_flags |= VM_IO | VM_RESERVED;
+
+#if 0
+	/* FIXME:
+	 * has_foreign_mappings is needed to avoid a race
+	 * condition whereby pages are freed by the unpin
+	 * in arch_exit_mmap() and then allocated to the
+	 * domain before the PTE is destroyed, leading to
+	 * an erroneous reference count update. See:
+	 * 
+	 * http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00014.html
+	 * http://xenbits.xensource.com/xen-unstable.hg?rev/e351aace191e
+	 */
+	vma->vm_mm->context.has_foreign_mappings = 1;
+#endif
+
+	return __direct_remap_pfn_range(vma->vm_mm, addr, mfn,
+					size, prot, domid);
+}
+EXPORT_SYMBOL(xen_map_foreign_range);
diff --git a/drivers/xen/xenctrl/privcmd.c b/drivers/xen/xenctrl/privcmd.c
index 58c4b83..5622e87 100644
--- a/drivers/xen/xenctrl/privcmd.c
+++ b/drivers/xen/xenctrl/privcmd.c
@@ -33,8 +33,156 @@
 #include <linux/proc_fs.h>
 #include <linux/module.h>
 #include <linux/uaccess.h>
+#include <linux/mm.h>
 #include <asm/xen/hypervisor.h>
 #include <xen/sys/privcmd.h>
+#include <xen/features.h>
+
+static struct page *privcmd_nopage(struct vm_area_struct *vma,
+				   unsigned long address, int *type)
+{
+	return NOPAGE_SIGBUS;
+}
+
+static struct vm_operations_struct privcmd_vm_ops = {
+	.nopage = privcmd_nopage
+};
+
+static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
+{
+	/* Unsupported for auto-translate guests. */
+	if (xen_feature(XENFEAT_auto_translated_physmap))
+		return -ENOSYS;
+
+	/* FIXME:
+	 * the VM_PFNMAP here may be dubious. See:
+	 *
+	 *   http://lists.xensource.com/archives/html/xen-devel/2007-12/msg00207.html
+	 *
+	 * Note, in recent kernels it is also needed to
+	 * avoid the mapping being dropped to VM_PRIVATE
+	 * by vma_wants_writenotify()
+	 */
+
+	/* DONTCOPY is essential for Xen as copy_page_range is broken. */
+	vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP;
+	vma->vm_ops = &privcmd_vm_ops;
+	vma->vm_private_data = NULL;
+
+	return 0;
+}
+
+static struct vm_area_struct *
+privcmd_verify_mapping(struct mm_struct *mm, unsigned long addr)
+{
+	struct vm_area_struct *vma;
+
+	vma = find_vma(mm, addr);
+	if (!vma || vma->vm_start != addr)
+		return NULL;
+
+	/* Disallow multiple mappings */
+	return xchg(&vma->vm_private_data, (void *)1) ? NULL : vma;
+}
+
+static int privcmd_mmap_cmd(privcmd_mmap_t *cmd)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	privcmd_mmap_entry_t __user *p;
+	unsigned long va;
+	int i, ret = 0;
+
+	down_write(&mm->mmap_sem);
+
+	for (i = 0, p = cmd->entry, vma = NULL; i < cmd->num; i++, p++) {
+		privcmd_mmap_entry_t entry;
+		unsigned long end;
+
+		if (copy_from_user(&entry, p, sizeof(entry))) {
+			ret = -EFAULT;
+			break;
+		}
+
+		ret = -EINVAL;
+
+		if (!vma) {
+			vma = privcmd_verify_mapping(mm, entry.va);
+			if (!vma)
+				break;
+			va = vma->vm_start;
+		}
+
+		/* Do not allow range to wrap the address space. */
+		if (entry.npages > (LONG_MAX >> PAGE_SHIFT) ||
+		    (unsigned long)(entry.npages << PAGE_SHIFT) >= -va)
+			break;
+
+		end = entry.va + (entry.npages << PAGE_SHIFT);
+
+		/* Range chunks must be contiguous in va space. */
+		if (entry.va != va || end > vma->vm_end)
+			break;
+
+		ret = xen_map_foreign_range(vma,
+					    entry.va & PAGE_MASK,
+					    entry.mfn,
+					    entry.npages << PAGE_SHIFT,
+					    vma->vm_page_prot,
+					    cmd->dom);
+		if (ret < 0)
+			break;
+
+		va = end;
+	}
+
+	up_write(&mm->mmap_sem);
+
+	return ret;
+}
+
+static int privcmd_mmap_batch_cmd(privcmd_mmapbatch_t *cmd)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	int i;
+
+	if (cmd->num <= 0 || cmd->num > (LONG_MAX >> PAGE_SHIFT))
+		return -EINVAL;
+
+	down_write(&mm->mmap_sem);
+
+	vma = privcmd_verify_mapping(mm, cmd->addr);
+	if (!vma ||
+	    cmd->addr + (cmd->num << PAGE_SHIFT) != vma->vm_end) {
+		up_write(&mm->mmap_sem);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < cmd->num; i++) {
+		unsigned long __user *p;
+		unsigned long addr, mfn;
+		int ret;
+
+		p = cmd->arr + i;
+
+		if (get_user(mfn, p)) {
+			up_write(&mm->mmap_sem);
+			return -EFAULT;
+		}
+
+		addr = (cmd->addr & PAGE_MASK) + (i << PAGE_SHIFT);
+
+		ret = xen_map_foreign_range(vma, addr, mfn, PAGE_SIZE,
+					    vma->vm_page_prot, cmd->dom);
+		if (ret < 0)
+			put_user(0xF0000000 | mfn, p);
+	}
+
+	up_write(&mm->mmap_sem);
+
+	return 0;
+}
 
 static long privcmd_ioctl(struct file *file, unsigned int cmd,
 			  unsigned long arg)
@@ -49,9 +197,30 @@ static long privcmd_ioctl(struct file *file, unsigned int cmd,
 		return privcmd_hypercall(&cmd);
 	}
 
-	case IOCTL_PRIVCMD_MMAP:
-	case IOCTL_PRIVCMD_MMAPBATCH:
-		printk(KERN_WARNING "IOCTL_PRIVCMD_MMAP ioctl not yet implemented\n");
+	case IOCTL_PRIVCMD_MMAP: {
+		privcmd_mmap_t cmd;
+
+		if (!is_initial_xendomain())
+			return -EPERM;
+
+		if (copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)))
+			return -EFAULT;
+
+		return privcmd_mmap_cmd(&cmd);
+	}
+
+	case IOCTL_PRIVCMD_MMAPBATCH: {
+		privcmd_mmapbatch_t cmd;
+
+		if (!is_initial_xendomain())
+			return -EPERM;
+
+		if (copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)))
+			return -EFAULT;
+
+		return privcmd_mmap_batch_cmd(&cmd);
+	}
+
 	default:
 		return -EINVAL;
 	}
@@ -59,6 +228,7 @@ static long privcmd_ioctl(struct file *file, unsigned int cmd,
 
 static const struct file_operations privcmd_file_ops = {
 	.unlocked_ioctl = privcmd_ioctl,
+	.mmap = privcmd_mmap,
 };
 
 int __init privcmd_create_proc_entry(void)
diff --git a/include/asm-x86/xen/hypervisor.h b/include/asm-x86/xen/hypervisor.h
index 8e15dd2..a266f4f 100644
--- a/include/asm-x86/xen/hypervisor.h
+++ b/include/asm-x86/xen/hypervisor.h
@@ -70,4 +70,8 @@ u64 jiffies_to_st(unsigned long jiffies);
 
 #define is_running_on_xen()	(xen_start_info ? 1 : 0)
 
+int xen_map_foreign_range(struct vm_area_struct *vma, unsigned long addr,
+			  unsigned long mfn, unsigned long size,
+			  pgprot_t prot, domid_t domid);
+
 #endif /* __HYPERVISOR_H__ */
-- 
1.5.4.1


linux-2.6-acpi-eeepc-hotkey.patch:

--- NEW FILE linux-2.6-acpi-eeepc-hotkey.patch ---
Signed-off-by: Eric Cooper <ecc at cmu.edu>

---
 drivers/misc/Kconfig  |   10 +
 drivers/misc/Makefile |    1 +
 drivers/misc/eeepc.c  |  447 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 458 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/eeepc.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index b1f9a40..8fd1ccb 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -251,4 +251,14 @@ config ATMEL_SSC
 
 	  If unsure, say N.
 
+config EEEPC
+        tristate "Eee PC Hotkey Driver (EXPERIMENTAL)"
+        depends on X86
+        depends on ACPI
+	depends on EXPERIMENTAL && !ACPI_ASUS
+        ---help---
+	  This driver supports the Fn-Fx keys on Eee PC laptops.
+
+	  If you have an Eee PC laptop, say Y or M here.
+
 endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 87f2685..699b35c 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SONY_LAPTOP)	+= sony-laptop.o
 obj-$(CONFIG_THINKPAD_ACPI)	+= thinkpad_acpi.o
 obj-$(CONFIG_FUJITSU_LAPTOP)	+= fujitsu-laptop.o
 obj-$(CONFIG_EEPROM_93CX6)	+= eeprom_93cx6.o
+obj-$(CONFIG_EEEPC)		+= eeepc.o
diff --git a/drivers/misc/eeepc.c b/drivers/misc/eeepc.c
new file mode 100644
index 0000000..2e33117
--- /dev/null
+++ b/drivers/misc/eeepc.c
@@ -0,0 +1,447 @@
+/*
+ *  eepc_acpi.c - Asus Eee PC hotkey driver
+ *
+ *  Copyright (C) 2008 Eric Cooper <ecc at cmu.edu>
+ *
+ *  Based on asus_acpi.c as patched for the Eee PC by Asus:
+ *  ftp://ftp.asus.com/pub/ASUS/EeePC/701/ASUS_ACPI_071126.rar
+ *
+ *  Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/platform_device.h>
+#include <acpi/acpi_drivers.h>
+#include <acpi/acpi_bus.h>
+#include <asm/uaccess.h>
+
+#define EEEPC_HOTK_NAME          "Eee PC Hotkey Driver"
+#define EEEPC_HOTK_FILE          "eeepc"
+#define EEEPC_HOTK_CLASS         "hotkey"
+#define EEEPC_HOTK_DEVICE_NAME   "Hotkey"
+#define EEEPC_HOTK_HID           "ASUS010"
+
+#define EEEPC_LOG	EEEPC_HOTK_FILE ": "
+#define EEEPC_ERR	KERN_ERR EEEPC_LOG
+#define EEEPC_WARNING	KERN_WARNING EEEPC_LOG
+#define EEEPC_NOTICE	KERN_NOTICE EEEPC_LOG
+#define EEEPC_INFO	KERN_INFO EEEPC_LOG
+
+/*
+ * Definitions for Asus EeePC
+ */
+
+#define	NOTIFY_WLAN_ON	0x10
+
+enum {
+	DISABLE_ASL_WLAN = 0x0001,
+	DISABLE_ASL_BLUETOOTH = 0x0002,
+	DISABLE_ASL_IRDA = 0x0004,
+	DISABLE_ASL_CAMERA = 0x0008,
+	DISABLE_ASL_TV = 0x0010,
+	DISABLE_ASL_GPS = 0x0020,
+	DISABLE_ASL_DISPLAYSWITCH = 0x0040,
+	DISABLE_ASL_MODEM = 0x0080,
+	DISABLE_ASL_CARDREADER = 0x0100
+};
+
+enum {
+	CM_ASL_WLAN = 0,
+	CM_ASL_BLUETOOTH,
+	CM_ASL_IRDA,
+	CM_ASL_1394,
+	CM_ASL_CAMERA,
+	CM_ASL_TV,
+	CM_ASL_GPS,
+	CM_ASL_DVDROM,
+	CM_ASL_DISPLAYSWITCH,
+	CM_ASL_PANELBRIGHT,
+	CM_ASL_BIOSFLASH,
+	CM_ASL_ACPIFLASH,
+	CM_ASL_CPUFV,
+	CM_ASL_CPUTEMPERATURE,
+	CM_ASL_FANCPU,
+	CM_ASL_FANCHASSIS,
+	CM_ASL_USBPORT1,
+	CM_ASL_USBPORT2,
+	CM_ASL_USBPORT3,
+	CM_ASL_MODEM,
+	CM_ASL_CARDREADER,
+	CM_ASL_LID
+};
+
+const char *cm_getv[] = {
+	"WLDG", NULL, NULL, NULL,
+	"CAMG", NULL, NULL, NULL,
+	NULL, "PBLG", NULL, NULL,
+	"CFVG", NULL, NULL, NULL,
+	"USBG", NULL, NULL, "MODG",
+	"CRDG", "LIDG"
+};
+
+const char *cm_setv[] = {
+	"WLDS", NULL, NULL, NULL,
+	"CAMS", NULL, NULL, NULL,
+	"SDSP", "PBLS", "HDPS", NULL,
+	"CFVS", NULL, NULL, NULL,
+	"USBG", NULL, NULL, "MODS",
+	"CRDS", NULL
+};
+
+static unsigned int init_flag;
+
+/*
+ * This is the main structure, we can use it to store useful information
+ * about the hotk device
+ */
+struct eeepc_hotk {
+	struct acpi_device *device;	/* the device we are in */
+	acpi_handle handle;		/* the handle of the hotk device */
+	u32 cm_supported;		/* the control methods supported
+					   by this BIOS */
+	u16 event_count[128];		/* count for each event */
+};
+
+/* The actual device the driver binds to */
+static struct eeepc_hotk *ehotk;
+
+/*
+ * The hotkey driver declaration
+ */
+static int eeepc_hotk_add(struct acpi_device *device);
+static int eeepc_hotk_remove(struct acpi_device *device, int type);
+
+static const struct acpi_device_id eee_device_ids[] = {
+	{EEEPC_HOTK_HID, 0},
+	{"", 0},
+};
+
+static struct acpi_driver eeepc_hotk_driver = {
+	.name = EEEPC_HOTK_NAME,
+	.class = EEEPC_HOTK_CLASS,
+	.ids = eee_device_ids,
+	.ops = {
+		.add = eeepc_hotk_add,
+		.remove = eeepc_hotk_remove,
+	},
+};
+
+MODULE_AUTHOR("Julien Lerouge, Karol Kozimor, Eric Cooper");
+MODULE_DESCRIPTION(EEEPC_HOTK_NAME);
+MODULE_LICENSE("GPL");
+
+/*
+ * returns 1 if write is successful, otherwise 0.
+ */
+static int write_acpi_int(acpi_handle handle, const char *method, int val,
+			  struct acpi_buffer *output)
+{
+	struct acpi_object_list params;
+	union acpi_object in_obj;
+	acpi_status status;
+
+	params.count = 1;
+	params.pointer = &in_obj;
+	in_obj.type = ACPI_TYPE_INTEGER;
+	in_obj.integer.value = val;
+
+	status = acpi_evaluate_object(handle, (char *)method, &params, output);
+	return (status == AE_OK);
+}
+
+static int read_acpi_int(acpi_handle handle, const char *method, int *val)
+{
+	struct acpi_buffer output;
+	union acpi_object out_obj;
+	acpi_status status;
+
+	output.length = sizeof(out_obj);
+	output.pointer = &out_obj;
+	status = acpi_evaluate_object(handle, (char *) method, NULL, &output);
+	*val = out_obj.integer.value;
+	return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER);
+}
+
+static int parse_arg(const char *buf, unsigned long count, int *val)
+{
+	if (!count)
+		return 0;
+	if (count > 31)
+		return -EINVAL;
+	if (sscanf(buf, "%i", val) != 1)
+		return -EINVAL;
+	return count;
+}
+
+static ssize_t store_proc(int cm, const char *buf, size_t count)
+{
+	int rv, value;
+
+	rv = parse_arg(buf, count, &value);
+	if (rv > 0 && (ehotk->cm_supported & (0x1 << cm))) {
+		const char *method = cm_setv[cm];
+		if (method == NULL)
+			return 0;
+		if (!write_acpi_int(ehotk->handle, method, value, NULL))
+			printk(EEEPC_WARNING "Error writing %s\n", method);
+	}
+	return rv;
+}
+
+static ssize_t show_proc(int cm, char *buf)
+{
+	int value = -1;
+
+	if ((ehotk->cm_supported & (0x1 << cm))) {
+		const char *method = cm_getv[cm];
+		if (method == NULL)
+			return 0;
+		if (!read_acpi_int(ehotk->handle, method, &value))
+			printk(EEEPC_WARNING "Error reading %s\n", method);
+	}
+	return sprintf(buf, "%d\n", value);
+}
+
+static ssize_t real_store_init(struct device *dev,
+			       struct device_attribute *attr,
+			       const char *buf, size_t count)
+{
+	int rv, value;
+
+	rv = parse_arg(buf, count, &value);
+	if (!write_acpi_int(ehotk->handle, "INIT", value, NULL))
+		printk(EEEPC_ERR "Hotkey initialization failed\n");
+	else
+		printk(EEEPC_INFO "Reset init flag 0x%x\n", value);
+	return rv;
+}
+
+#define EEEPC_CREATE_DEVICE_ATTR(_name, _cm)				\
+	static ssize_t show_##_name(struct device *dev,			\
+				    struct device_attribute *attr,	\
+				    char *buf)				\
+	{								\
+		return show_proc(_cm, buf);				\
+	}								\
+	static ssize_t store_##_name(struct device *dev,		\
+				     struct device_attribute *attr,	\
+				     const char *buf, size_t count)	\
+	{								\
+		return store_proc(_cm, buf, count);			\
+	}								\
+	static struct device_attribute dev_attr_##_name = {		\
+		.attr = {						\
+			.name = __stringify(_name),			\
+			.mode = 0644 },					\
+		.show   = show_##_name,					\
+		.store  = store_##_name,				\
+	}
+
+EEEPC_CREATE_DEVICE_ATTR(brn, CM_ASL_PANELBRIGHT);
+EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA);
+EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER);
+EEEPC_CREATE_DEVICE_ATTR(cpufv, CM_ASL_CPUFV);
+EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH);
+EEEPC_CREATE_DEVICE_ATTR(hdps, CM_ASL_BIOSFLASH);
+EEEPC_CREATE_DEVICE_ATTR(init, -1);	/* fixed up in eeepc_hotk_add() */
+EEEPC_CREATE_DEVICE_ATTR(lid, CM_ASL_LID);
+EEEPC_CREATE_DEVICE_ATTR(wlan, CM_ASL_WLAN);
+
+static struct attribute *platform_attributes[] = {
+	&dev_attr_brn.attr,
+	&dev_attr_camera.attr,
+	&dev_attr_cardr.attr,
+	&dev_attr_cpufv.attr,
+	&dev_attr_disp.attr,
+	&dev_attr_hdps.attr,
+	&dev_attr_init.attr,
+	&dev_attr_lid.attr,
+	&dev_attr_wlan.attr,
+	NULL
+};
+
+static struct attribute_group platform_attribute_group = {
+	.attrs = platform_attributes
+};
+
+static int eeepc_hotk_check(void)
+{
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	int result;
+
+	result = acpi_bus_get_status(ehotk->device);
+	if (result)
+		return result;
+	if (ehotk->device->status.present) {
+		if (!write_acpi_int(ehotk->handle, "INIT", init_flag,
+				    &buffer)) {
+			printk(EEEPC_ERR "Hotkey initialization failed\n");
+			return -ENODEV;
+		} else {
+			printk(EEEPC_NOTICE "Hotkey init flags 0x%x\n",
+			       init_flag);
+		}
+		/* get control methods supported */
+		if (!read_acpi_int(ehotk->handle, "CMSG"
+				   , &ehotk->cm_supported)) {
+			printk(EEEPC_ERR
+			       "Get control methods supported failed\n");
+			return -ENODEV;
+		} else {
+			printk(EEEPC_INFO
+			       "Get control methods supported: 0x%x\n",
+			       ehotk->cm_supported);
+		}
+		ehotk->cm_supported |= (0x1 << CM_ASL_LID);
+	} else {
+		printk(EEEPC_ERR "Hotkey device not present, aborting\n");
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
+{
+	if (!ehotk)
+		return;
+	/* if DISABLE_ASL_WLAN is set, the notify code for fn+f2
+	   will always be 0x10 */
+	if (event == NOTIFY_WLAN_ON && (DISABLE_ASL_WLAN & init_flag)) {
+		int value;
+		if (ehotk->cm_supported & (0x1 << CM_ASL_WLAN)) {
+			const char *method = cm_getv[CM_ASL_WLAN];
+			if (!read_acpi_int(ehotk->handle, method, &value))
+				printk(EEEPC_WARNING "Error reading %s\n",
+				       method);
+			else if (value == 1)
+				event = 0x11;
+		}
+	}
+	acpi_bus_generate_proc_event(ehotk->device, event,
+				     ehotk->event_count[event % 128]++);
+}
+
+static int ehotk_found;
+
+static int eeepc_hotk_add(struct acpi_device *device)
+{
+	acpi_status status = AE_OK;
+	int result;
+
+	if (!device)
+		 return -EINVAL;
+	printk(EEEPC_NOTICE EEEPC_HOTK_NAME "\n");
+	ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL);
+	if (!ehotk)
+		return -ENOMEM;
+	ehotk->handle = device->handle;
+	strcpy(acpi_device_name(device), EEEPC_HOTK_DEVICE_NAME);
+	strcpy(acpi_device_class(device), EEEPC_HOTK_CLASS);
+	acpi_driver_data(device) = ehotk;
+	ehotk->device = device;
+	result = eeepc_hotk_check();
+	if (result)
+		goto end;
+	dev_attr_init.show = NULL;
+	dev_attr_init.store = real_store_init;
+	status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
+					     eeepc_hotk_notify, ehotk);
+	if (ACPI_FAILURE(status))
+		printk(EEEPC_ERR "Error installing notify handler\n");
+	ehotk_found = 1;
+ end:
+	if (result)
+		kfree(ehotk);
+	return result;
+}
+
+static int eeepc_hotk_remove(struct acpi_device *device, int type)
+{
+	acpi_status status = 0;
+
+	if (!device || !acpi_driver_data(device))
+		 return -EINVAL;
+	status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
+					    eeepc_hotk_notify);
+	if (ACPI_FAILURE(status))
+		printk(EEEPC_ERR "Error removing notify handler\n");
+	kfree(ehotk);
+	return 0;
+}
+
+static struct platform_driver platform_driver = {
+	.driver = {
+		.name = EEEPC_HOTK_FILE,
+		.owner = THIS_MODULE,
+	}
+};
+
+static struct platform_device *platform_device;
+
+static void __exit eeepc_hotk_exit(void)
+{
+	acpi_bus_unregister_driver(&eeepc_hotk_driver);
+	sysfs_remove_group(&platform_device->dev.kobj,
+			   &platform_attribute_group);
+	platform_device_unregister(platform_device);
+	platform_driver_unregister(&platform_driver);
+}
+
+static int __init eeepc_hotk_init(void)
+{
+	struct device *dev;
+	int result;
+
+	if (acpi_disabled)
+		return -ENODEV;
+	init_flag = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH;
+	result = acpi_bus_register_driver(&eeepc_hotk_driver);
+	if (result < 0)
+		return result;
+	if (!ehotk_found) {
+		acpi_bus_unregister_driver(&eeepc_hotk_driver);
+		return -ENODEV;
+	}
+	dev = acpi_get_physical_device(ehotk->device->handle);
+	/* Register platform stuff */
+	result = platform_driver_register(&platform_driver);
+	if (result)
+		goto fail_platform_driver;
+	platform_device = platform_device_alloc(EEEPC_HOTK_FILE, -1);
+	if (!platform_device) {
+		result = -ENOMEM;
+		goto fail_platform_device1;
+	}
+	result = platform_device_add(platform_device);
+	if (result)
+		goto fail_platform_device2;
+	result = sysfs_create_group(&platform_device->dev.kobj,
+				    &platform_attribute_group);
+	if (result)
+		goto fail_sysfs;
+	return 0;
+ fail_sysfs:
+	platform_device_del(platform_device);
+ fail_platform_device2:
+	platform_device_put(platform_device);
+ fail_platform_device1:
+	platform_driver_unregister(&platform_driver);
+ fail_platform_driver:
+	return result;
+}
+
+module_init(eeepc_hotk_init);
+module_exit(eeepc_hotk_exit);

linux-2.6-agp-mm.patch:

--- NEW FILE linux-2.6-agp-mm.patch ---
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 42ba0e2..103b9df 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -72,7 +72,7 @@ pcibios_align_resource(void *data, struct resource *res,
 		}
 	}
 }
-
+EXPORT_SYMBOL(pcibios_align_resource);
 
 /*
  *  Handle resources of PCI devices.  If the world were perfect, we could
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index b83824c..9ec9374 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -117,7 +117,8 @@ struct agp_bridge_driver {
 	void (*free_by_type)(struct agp_memory *);
 	void *(*agp_alloc_page)(struct agp_bridge_data *);
 	void (*agp_destroy_page)(void *, int flags);
-        int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
+	int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
+	void (*chipset_flush)(struct agp_bridge_data *);
 };
 
 struct agp_bridge_data {
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 832ded2..f9c180c 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -43,7 +43,7 @@
  * fix some real stupidity. It's only by chance we can bump
  * past 0.99 at all due to some boolean logic error. */
 #define AGPGART_VERSION_MAJOR 0
-#define AGPGART_VERSION_MINOR 102
+#define AGPGART_VERSION_MINOR 103
 static const struct agp_version agp_current_version =
 {
 	.major = AGPGART_VERSION_MAJOR,
diff --git a/drivers/char/agp/compat_ioctl.c b/drivers/char/agp/compat_ioctl.c
index ecd4248..3927579 100644
--- a/drivers/char/agp/compat_ioctl.c
+++ b/drivers/char/agp/compat_ioctl.c
@@ -273,6 +273,10 @@ long compat_agp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case AGPIOC_UNBIND32:
 		ret_val = compat_agpioc_unbind_wrap(curr_priv, (void __user *) arg);
 		break;
+
+	case AGPIOC_CHIPSET_FLUSH32:
+		ret_val = agpioc_chipset_flush_wrap(curr_priv);
+		break;
 	}
 
 ioctl_out:
diff --git a/drivers/char/agp/compat_ioctl.h b/drivers/char/agp/compat_ioctl.h
index 71939d6..0c9678a 100644
--- a/drivers/char/agp/compat_ioctl.h
+++ b/drivers/char/agp/compat_ioctl.h
@@ -39,6 +39,7 @@
 #define AGPIOC_DEALLOCATE32 _IOW (AGPIOC_BASE, 7, compat_int_t)
 #define AGPIOC_BIND32       _IOW (AGPIOC_BASE, 8, compat_uptr_t)
 #define AGPIOC_UNBIND32     _IOW (AGPIOC_BASE, 9, compat_uptr_t)
+#define AGPIOC_CHIPSET_FLUSH32 _IO (AGPIOC_BASE, 10)
 
 struct agp_info32 {
 	struct agp_version version;	/* version of the driver        */
@@ -101,5 +102,6 @@ void agp_free_memory_wrap(struct agp_memory *memory);
 struct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type);
 struct agp_memory *agp_find_mem_by_key(int key);
 struct agp_client *agp_find_client_by_pid(pid_t id);
+int agpioc_chipset_flush_wrap(struct agp_file_private *priv);
 
 #endif /* _AGP_COMPAT_H */
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 7791e98..9bd5a95 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -960,6 +960,13 @@ static int agpioc_unbind_wrap(struct agp_file_private *priv, void __user *arg)
 	return agp_unbind_memory(memory);
 }
 
+int agpioc_chipset_flush_wrap(struct agp_file_private *priv)
+{
+	DBG("");
+	agp_flush_chipset(agp_bridge);
+	return 0;
+}
+
 static int agp_ioctl(struct inode *inode, struct file *file,
 		     unsigned int cmd, unsigned long arg)
 {
@@ -1033,6 +1040,10 @@ static int agp_ioctl(struct inode *inode, struct file *file,
 	case AGPIOC_UNBIND:
 		ret_val = agpioc_unbind_wrap(curr_priv, (void __user *) arg);
 		break;
+	       
+	case AGPIOC_CHIPSET_FLUSH:
+		ret_val = agpioc_chipset_flush_wrap(curr_priv);
+		break;
 	}
 
 ioctl_out:
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 64b2f6d..8c67b4f 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -80,6 +80,13 @@ static int agp_get_key(void)
 	return -1;
 }
 
+void agp_flush_chipset(struct agp_bridge_data *bridge)
+{
+	if (bridge->driver->chipset_flush)
+		bridge->driver->chipset_flush(bridge);
+}
+EXPORT_SYMBOL(agp_flush_chipset);
+
 /*
  * Use kmalloc if possible for the page list. Otherwise fall back to
  * vmalloc. This speeds things up and also saves memory for small AGP
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index d879619..f161d15 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -69,9 +69,11 @@ extern int agp_memory_reserved;
 #define I915_GMCH_GMS_STOLEN_64M	(0x7 << 4)
 #define G33_GMCH_GMS_STOLEN_128M       (0x8 << 4)
 #define G33_GMCH_GMS_STOLEN_256M       (0x9 << 4)
+#define I915_IFPADDR    0x60
 
 /* Intel 965G registers */
 #define I965_MSAC 0x62
+#define I965_IFPADDR    0x70
 
 /* Intel 7505 registers */
 #define INTEL_I7505_APSIZE	0x74
@@ -113,6 +115,12 @@ static struct _intel_private {
 	 * popup and for the GTT.
 	 */
 	int gtt_entries;			/* i830+ */
+	union {
+		void __iomem *i9xx_flush_page;
+		void *i8xx_flush_page;
+	};
+	struct page *i8xx_page;
+	struct resource ifp_resource;
 } intel_private;
 
 static int intel_i810_fetch_size(void)
@@ -576,6 +584,44 @@ static void intel_i830_init_gtt_entries(void)
 	intel_private.gtt_entries = gtt_entries;
 }
 
+static void intel_i830_fini_flush(void)
+{
+	kunmap(intel_private.i8xx_page);
+	intel_private.i8xx_flush_page = NULL;
+	unmap_page_from_agp(intel_private.i8xx_page);
+	flush_agp_mappings();
+
+	__free_page(intel_private.i8xx_page);
+}
+
+static void intel_i830_setup_flush(void)
+{
+
+	intel_private.i8xx_page = alloc_page(GFP_KERNEL | __GFP_ZERO | GFP_DMA32);
+	if (!intel_private.i8xx_page) {
+		return;
+	}
+
+	/* make page uncached */
+	map_page_into_agp(intel_private.i8xx_page);
+	flush_agp_mappings();
+
+	intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page);
+	if (!intel_private.i8xx_flush_page)
+		intel_i830_fini_flush();
+}
+
+static void intel_i830_chipset_flush(struct agp_bridge_data *bridge)
+{
+	unsigned int *pg = intel_private.i8xx_flush_page;
+	int i;
+
+	for (i = 0; i < 256; i+=2)
+		*(pg + i) = i;
+	
+	wmb();
+}
+
 /* The intel i830 automatically initializes the agp aperture during POST.
  * Use the memory already set aside for in the GTT.
  */
@@ -676,6 +722,8 @@ static int intel_i830_configure(void)
 	}
 
 	global_cache_flush();
+
+	intel_i830_setup_flush();
 	return 0;
 }
 
@@ -769,6 +817,90 @@ static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type)
 	return NULL;
 }
 
+static int intel_alloc_chipset_flush_resource(void)
+{
+	int ret;
+	ret = pci_bus_alloc_resource(agp_bridge->dev->bus, &intel_private.ifp_resource, PAGE_SIZE,
+				     PAGE_SIZE, PCIBIOS_MIN_MEM, 0,
+				     pcibios_align_resource, agp_bridge->dev);
+
+	return ret;
+}
+
+static void intel_i915_setup_chipset_flush(void)
+{
+	int ret;
+	u32 temp;
+
+	pci_read_config_dword(agp_bridge->dev, I915_IFPADDR, &temp);
+	if (!(temp & 0x1)) {
+		intel_alloc_chipset_flush_resource();
+
+		pci_write_config_dword(agp_bridge->dev, I915_IFPADDR, (intel_private.ifp_resource.start & 0xffffffff) | 0x1);
+	} else {
+		temp &= ~1;
+
+		intel_private.ifp_resource.start = temp;
+		intel_private.ifp_resource.end = temp + PAGE_SIZE;
+		ret = request_resource(&iomem_resource, &intel_private.ifp_resource);
+		if (ret) {
+			intel_private.ifp_resource.start = 0;
+			printk("Failed inserting resource into tree\n");
+		}
+	}
+}
+
+static void intel_i965_g33_setup_chipset_flush(void)
+{
+	u32 temp_hi, temp_lo;
+	int ret;
+
+	pci_read_config_dword(agp_bridge->dev, I965_IFPADDR + 4, &temp_hi);
+	pci_read_config_dword(agp_bridge->dev, I965_IFPADDR, &temp_lo);
+
+	if (!(temp_lo & 0x1)) {
+
+		intel_alloc_chipset_flush_resource();
+
+		pci_write_config_dword(agp_bridge->dev, I965_IFPADDR + 4, (intel_private.ifp_resource.start >> 32));
+		pci_write_config_dword(agp_bridge->dev, I965_IFPADDR, (intel_private.ifp_resource.start & 0xffffffff) | 0x1);
+	} else {
+		u64 l64;
+		
+		temp_lo &= ~0x1;
+		l64 = ((u64)temp_hi << 32) | temp_lo;
+
+		intel_private.ifp_resource.start = l64;
+		intel_private.ifp_resource.end = l64 + PAGE_SIZE;
+		ret = request_resource(&iomem_resource, &intel_private.ifp_resource);
+		if (!ret) {
+			printk("Failed inserting resource into tree - continuing\n");
+		}
+	}
+}
+
+static void intel_i9xx_setup_flush(void)
+{
+	/* setup a resource for this object */
+	memset(&intel_private.ifp_resource, 0, sizeof(intel_private.ifp_resource));
+
+	intel_private.ifp_resource.name = "Intel Flush Page";
+	intel_private.ifp_resource.flags = IORESOURCE_MEM;
+
+	/* Setup chipset flush for 915 */
+	if (IS_I965 || IS_G33) {
+		intel_i965_g33_setup_chipset_flush();
+	} else {
+		intel_i915_setup_chipset_flush();
+	}
+
+	if (intel_private.ifp_resource.start) {
+		intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE);
+		if (!intel_private.i9xx_flush_page)
+			printk("unable to ioremap flush  page - no chipset flushing");
+	}
+}
+
 static int intel_i915_configure(void)
 {
 	struct aper_size_info_fixed *current_size;
@@ -797,15 +929,26 @@ static int intel_i915_configure(void)
 	}
 
 	global_cache_flush();
+
+	intel_i9xx_setup_flush();
+	
 	return 0;
 }
 
 static void intel_i915_cleanup(void)
 {
+	if (intel_private.i9xx_flush_page)
+		iounmap(intel_private.i9xx_flush_page);
 	iounmap(intel_private.gtt);
 	iounmap(intel_private.registers);
 }
 
+static void intel_i915_chipset_flush(struct agp_bridge_data *bridge)
+{
+	if (intel_private.i9xx_flush_page)
+		writel(1, intel_private.i9xx_flush_page);
+}
+
 static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start,
 				int type)
 {
@@ -1297,6 +1440,8 @@ static int intel_845_configure(void)
 	pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1));
 	/* clear any possible error conditions */
 	pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c);
+
+	intel_i830_setup_flush();
 	return 0;
 }
 
@@ -1553,6 +1698,7 @@ static const struct agp_bridge_driver intel_830_driver = {
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
 	.agp_type_to_mask_type  = intel_i830_type_to_mask_type,
+	.chipset_flush		= intel_i830_chipset_flush,
 };
 
 static const struct agp_bridge_driver intel_820_driver = {
@@ -1649,6 +1795,7 @@ static const struct agp_bridge_driver intel_845_driver = {
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
 	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
+	.chipset_flush		= intel_i830_chipset_flush,
 };
 
 static const struct agp_bridge_driver intel_850_driver = {
@@ -1722,6 +1869,7 @@ static const struct agp_bridge_driver intel_915_driver = {
 	.agp_alloc_page		= agp_generic_alloc_page,
 	.agp_destroy_page	= agp_generic_destroy_page,
 	.agp_type_to_mask_type  = intel_i830_type_to_mask_type,
+	.chipset_flush		= intel_i915_chipset_flush,
 };
 
 static const struct agp_bridge_driver intel_i965_driver = {
@@ -1747,6 +1895,7 @@ static const struct agp_bridge_driver intel_i965_driver = {
        .agp_alloc_page         = agp_generic_alloc_page,
        .agp_destroy_page       = agp_generic_destroy_page,
        .agp_type_to_mask_type  = intel_i830_type_to_mask_type,
+	.chipset_flush		= intel_i915_chipset_flush,
 };
 
 static const struct agp_bridge_driver intel_7505_driver = {
@@ -1796,6 +1945,7 @@ static const struct agp_bridge_driver intel_g33_driver = {
 	.agp_alloc_page         = agp_generic_alloc_page,
 	.agp_destroy_page       = agp_generic_destroy_page,
 	.agp_type_to_mask_type  = intel_i830_type_to_mask_type,
+	.chipset_flush		= intel_i915_chipset_flush,
 };
 
 static int find_gmch(u16 device)
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index abc521c..03e3454 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -109,6 +109,7 @@ extern int agp_unbind_memory(struct agp_memory *);
 extern void agp_enable(struct agp_bridge_data *, u32);
 extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
 extern void agp_backend_release(struct agp_bridge_data *);
+extern void agp_flush_chipset(struct agp_bridge_data *);
 
 #endif				/* __KERNEL__ */
 #endif				/* _AGP_BACKEND_H */
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index 09fbf7e..62aef58 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -38,6 +38,7 @@
 #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
 #define AGPIOC_BIND       _IOW (AGPIOC_BASE, 8, struct agp_bind*)
 #define AGPIOC_UNBIND     _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
+#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
 
 #define AGP_DEVICE      "/dev/agpgart"
 

linux-2.6-alsa-rc4-mm1.patch:

--- NEW FILE linux-2.6-alsa-rc4-mm1.patch ---
GIT a7789dbc42abf8efbfdd46b99ffa39b4404f7184 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/perex/alsa.git#mm

commit 
Author: Takashi Iwai <tiwai at suse.de>
Date:   Mon Dec 3 17:08:40 2007 +0100

    [ALSA] echoaudio - convert from semaphore to mutex
    
    Converted from semaphore to mutex.
    
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 78c3ffce0da390847c18daabfe49d4d457b2149f
Author: Andy Shevchenko <andy at smile.org.ua>
Date:   Mon Dec 3 16:50:58 2007 +0100

    [ALSA] hda-codec - Fix typo in the ALC883 initial code
    
    The attached patch should fix typo in auto initialization verbs for ALC883
    codec.
    
    Signed-off-by: Andy Shevchenko <andy at smile.org.ua>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 91f02c16c74a1c151682ce4a33f9548e3227e4d0
Author: Pavel Hofman <dustin at seznam.cz>
Date:   Mon Dec 3 12:44:28 2007 +0100

    [ALSA] switching rate in STAC9460 codec of Prodigy192
    
    * support for switching rate in STAC9460 - using set_rate_val of the akm
    infrastructure
    * listing all STAC9460 registers in proc
    * disabling mpu401 device for Prodigy192 - otherwise the currently
      flawed mpu401 code hangs kernel when opening the midi device
    * removing old unused commented-out code
    
    Signed-off-by: Pavel Hofman <dustin at seznam.cz>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 35b3a3c38a2a18c00e8e8f99fc1cb2dadf9eebd1
Author: Pavel Hofman <dustin at seznam.cz>
Date:   Mon Dec 3 12:37:17 2007 +0100

    [ALSA] I2C fix for ice1724
    
    adding i2c busy wait before sending device address to prevent reading
    bogus data.
    
    Signed-off-by: Pavel Hofman <dustin at seznam.cz>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit f9129a53abcdfd700eef783d8179c4ce39dc0482
Author: Rene Herman <rene.herman at gmail.com>
Date:   Fri Nov 30 17:59:25 2007 +0100

    [ALSA] sound/isa: kill pnp_resource_change
    
    This removes the pnp_resource_change use from the ALSA ISAPnP drivers. In
    2.4 these were useful in providing an easy path to setting the resources,
    but in 2.6 they retain function as a layering violation only.
    This makes for a nice cleanup (-550 lines) of ALSA but moreover, ALSA is the
    only remaining user of pnp_init_resource_table(), pnp_resource_change() and
    pnp_manual_config_dev() (and, in fact, of 'struct pnp_resource_table') in
    the tree outide of drivers/pnp itself meaning it makes for more cleanup
    potential inside the PnP layer.
    Thomas Renninger acked their removal from that side, you did from the ALSA
    side (CC list just copied from that thread).
    Against current alsa-kernel HG. Many more potential cleanups in there, but
    this _only_ removes the pnp_resource_change code. Compile tested against
    current alsa-kernel HG and compile- and use-tested against 2.6.23.x (few
    offsets).
    Cc: Thomas Renninger <trenn at suse.de>
    
    Signed-off-by: Rene Herman <rene.herman at gmail.com>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit da1cd2b5d7168e630972565308fd4207440ad3e6
Author: Julia Lawall <julia at diku.dk>
Date:   Wed Nov 28 11:58:56 2007 +0100

    [ALSA] sound/core/memalloc.c: Add missing pci_dev_put
    
    There should be a pci_dev_put when breaking out of a loop that iterates
    over calls to pci_get_device and similar functions.
    In this case, the return under the initial if needs a pci_dev_put in the
    same way that the return under the subsequent for loop has a pci_dev_put.
    This was fixed using the following semantic patch.
    // <smpl>
    @@
    type T;
    identifier d;
    expression e;
    @@
    T *d;
    ...
    while ((d = \(pci_get_device\|pci_get_device_reverse\|pci_get_subsys\|pci_get_class\)(..., d)) != NULL)
      {... when != pci_dev_put(d)
           when != e = d
    (
        return d;
    |
    +  pci_dev_put(d);
    ?  return ...;
    )
    ...}
    // </smpl>
    
    Signed-off-by: Julia Lawall <julia at diku.dk>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 43ee07cf0d4e3fe542626a5347e9c6161beb7f2c
Author: Takashi Iwai <tiwai at suse.de>
Date:   Tue Nov 27 15:27:17 2007 +0100

    [ALSA] ice1712 - Fix word clock status control on Delta 1010LT
    
    The 'Word Clock Status' control on Delta 1010LT checks the CS8427
    error register too strictly and almost always returns 1 (unlocked).
    It should check only the lock status bit.
    
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 3e534c100d03b4abad7848508cab8daab29824fe
Author: Daniel Mack <daniel at caiaq.de>
Date:   Mon Nov 26 09:00:56 2007 +0100

    [ALSA] usb-caiaq - add support for Kore controller 2
    
    Added support for Native Instrument's Kore controller 2. This device has
    no audio but MIDI, input devices and ALSA controllers only.
    
    Signed-off-by: Daniel Mack <daniel at caiaq.de>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 82982081f1b2412d6d8e7a8869436809cf2c4e18
Author: Ville Syrjala <syrjala at sci.fi>
Date:   Mon Nov 26 08:58:24 2007 +0100

    [ALSA] soc/wm8731: Fix stereo mixer controls
    
    Disable the simultaneous load feature for the line in and headphone
    out volume registers. This allows left and right volume levels to
    be controlled separately.
    
    Signed-off-by: Ville Syrjala <syrjala at sci.fi>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 8e43d0d0c58a8705cb7c8fb5b5ec03efef8643f7
Author: Takashi Iwai <tiwai at suse.de>
Date:   Mon Nov 26 08:58:48 2007 +0100

    [ALSA] drivers - Add missing snd_card_set_dev()
    
    Added the missing call of snd_card_set_dev() in drivers/*
    
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 8478fa3c825e1522cb516823090b1acc2c406af1
Author: Joe Perches <joe at perches.com>
Date:   Mon Nov 26 08:44:15 2007 +0100

    [ALSA] sound/isa: Add missing 'space'
    
    
    Signed-off-by: Joe Perches <joe at perches.com>
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit 27ab27100d74f0f5073fc8d50dea6aefffe20dda
Author: Takashi Iwai <tiwai at suse.de>
Date:   Mon Nov 26 08:45:43 2007 +0100

    [ALSA] emu10k1x - Add missing snd_card_set_dev call
    
    Added the missing snd_card_set_dev() call.  This will fix the incomplete
    sysfs entry for this card.
    
    Signed-off-by: Takashi Iwai <tiwai at suse.de>
    Signed-off-by: Jaroslav Kysela <perex at perex.cz>

commit ca23210387b188bd6cbce13e644822cdbd148eac
Author: Takashi Iwai <tiwai at suse.de>
Date:   Fri Nov 23 15:41:44 2007 +0100

    [ALSA] aoa - fix compile warning
    
    Set a proper error code in the error path of i2sbus_attach_codec().
[...21552 lines suppressed...]
 		input->keycodemax = ARRAY_SIZE(keycode_rk2);
-		for (i=0; i<ARRAY_SIZE(keycode_rk2); i++)
-			set_bit(keycode_rk2[i], input->keybit);
-
 		input_set_abs_params(input, ABS_X, 0, 4096, 0, 10);
 		input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10);
 		input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10);
 		snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0);
 		break;
 	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
-		input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
-		input->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_Z);
-		input->keycode = keycode_rk3;
-		input->keycodesize = sizeof(char);
+		input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+		input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) |
+			BIT_MASK(ABS_Z);
+		BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_rk3));
+		memcpy(dev->keycode, keycode_rk3, sizeof(keycode_rk3));
 		input->keycodemax = ARRAY_SIZE(keycode_rk3);
-		for (i=0; i<ARRAY_SIZE(keycode_rk3); i++)
-			set_bit(keycode_rk3[i], input->keybit);
-
 		input_set_abs_params(input, ABS_X, 0, 1024, 0, 10);
 		input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10);
 		input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10);
@@ -231,21 +299,50 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev)
 	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
 		input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
 		input->absbit[0] = BIT_MASK(ABS_X);
-		input->keycode = keycode_ak1;
-		input->keycodesize = sizeof(char);
+		BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_ak1));
+		memcpy(dev->keycode, keycode_ak1, sizeof(keycode_ak1));
 		input->keycodemax = ARRAY_SIZE(keycode_ak1);
-		for (i=0; i<ARRAY_SIZE(keycode_ak1); i++)
-			set_bit(keycode_ak1[i], input->keybit);
-
 		input_set_abs_params(input, ABS_X, 0, 999, 0, 10);
 		snd_usb_caiaq_set_auto_msg(dev, 1, 0, 5);
 		break;
+	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER):
+	case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2):
+		input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+		input->absbit[0] = BIT_MASK(ABS_HAT0X) | BIT_MASK(ABS_HAT0Y) |
+				   BIT_MASK(ABS_HAT1X) | BIT_MASK(ABS_HAT1Y) |
+				   BIT_MASK(ABS_HAT2X) | BIT_MASK(ABS_HAT2Y) |
+				   BIT_MASK(ABS_HAT3X) | BIT_MASK(ABS_HAT3Y) |
+				   BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) |
+				   BIT_MASK(ABS_Z);
+		input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC);
+		BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_kore));
+		memcpy(dev->keycode, keycode_kore, sizeof(keycode_kore));
+		input->keycodemax = ARRAY_SIZE(keycode_kore);
+		input_set_abs_params(input, ABS_HAT0X, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_HAT0Y, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_HAT1X, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_HAT1Y, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_HAT2X, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_HAT2Y, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_HAT3X, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_HAT3Y, 0, 999, 0, 10);
+		input_set_abs_params(input, ABS_X, 0, 4096, 0, 10);
+		input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10);
+		input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10);
+		input_set_abs_params(input, ABS_MISC, 0, 255, 0, 1);
+		snd_usb_caiaq_set_auto_msg(dev, 1, 10, 5);
+		break;
 	default:
 		/* no input methods supported on this device */
 		input_free_device(input);
 		return 0;
 	}
 
+	input->keycode = dev->keycode;
+	input->keycodesize = sizeof(unsigned short);
+	for (i = 0; i < input->keycodemax; i++)
+		__set_bit(dev->keycode[i], input->keybit);
+
 	ret = input_register_device(input);
 	if (ret < 0) {
 		input_free_device(input);
@@ -265,5 +362,3 @@ void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev)
 	dev->input_dev = NULL;
 }
 
-#endif /* CONFIG_SND_USB_CAIAQ_INPUT */
-
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 5e32969..1f1e91c 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -1703,6 +1703,11 @@ static void snd_usb_mixer_memory_change(struct usb_mixer_interface *mixer,
 	case 19: /* speaker out jacks */
 	case 20: /* headphones out jack */
 		break;
+	/* live24ext: 4 = line-in jack */
+	case 3:	/* hp-out jack (may actuate Mute) */
+		if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040))
+			snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id);
+		break;
 	default:
 		snd_printd(KERN_DEBUG "memory change in unknown unit %d\n", unitid);
 		break;
@@ -1951,6 +1956,9 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
 	int i, err;
 
 	for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) {
+		if (i > 1 &&  /* Live24ext has 2 LEDs only */
+			mixer->chip->usb_id == USB_ID(0x041e, 0x3040))
+			break; 
 		err = snd_ctl_add(mixer->chip->card,
 				  snd_ctl_new1(&snd_audigy2nx_controls[i], mixer));
 		if (err < 0)
@@ -1963,28 +1971,42 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
 static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
 				    struct snd_info_buffer *buffer)
 {
-	static const struct {
+	static const struct sb_jack {
 		int unitid;
 		const char *name;
-	} jacks[] = {
+	}  jacks_audigy2nx[] = {
 		{4,  "dig in "},
 		{7,  "line in"},
 		{19, "spk out"},
 		{20, "hph out"},
+		{-1, NULL}
+	}, jacks_live24ext[] = {
+		{4,  "line in"}, /* &1=Line, &2=Mic*/
+		{3,  "hph out"}, /* headphones */
+		{0,  "RC     "}, /* last command, 6 bytes see rc_config above */
+		{-1, NULL}
 	};
+	const struct sb_jack *jacks;
 	struct usb_mixer_interface *mixer = entry->private_data;
 	int i, err;
 	u8 buf[3];
 
 	snd_iprintf(buffer, "%s jacks\n\n", mixer->chip->card->shortname);
-	for (i = 0; i < ARRAY_SIZE(jacks); ++i) {
+	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020))
+		jacks = jacks_audigy2nx;
+	else if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040))
+		jacks = jacks_live24ext;
+	else
+		return;
+
+	for (i = 0; jacks[i].name; ++i) {
 		snd_iprintf(buffer, "%s: ", jacks[i].name);
 		err = snd_usb_ctl_msg(mixer->chip->dev,
 				      usb_rcvctrlpipe(mixer->chip->dev, 0),
 				      GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
 				      USB_RECIP_INTERFACE, 0,
 				      jacks[i].unitid << 8, buf, 3, 100);
-		if (err == 3 && buf[0] == 3)
+		if (err == 3 && (buf[0] == 3 || buf[0] == 6))
 			snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]);
 		else
 			snd_iprintf(buffer, "?\n");
@@ -2022,7 +2044,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif)
 	if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0)
 		goto _error;
 
-	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020)) {
+	if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) ||
+	    mixer->chip->usb_id == USB_ID(0x041e, 0x3040)) {
 		struct snd_info_entry *entry;
 
 		if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c
index 7c4dcb3..d755be0 100644
--- a/sound/usb/usbmixer_maps.c
+++ b/sound/usb/usbmixer_maps.c
@@ -187,6 +187,13 @@ static struct usbmix_selector_map audigy2nx_selectors[] = {
 	{ 0 } /* terminator */
 };
 
+/* Creative SoundBlaster Live! 24-bit External */
+static struct usbmix_name_map live24ext_map[] = {
+	/* 2: PCM Playback Volume */
+	{ 5, "Mic Capture" }, /* FU, default PCM Capture Volume */
+	{ 0 } /* terminator */
+};
+
 /* LineX FM Transmitter entry - needed to bypass controls bug */
 static struct usbmix_name_map linex_map[] = {
 	/* 1: IT pcm */
@@ -273,6 +280,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
 		.map = audigy2nx_map,
 		.selector_map = audigy2nx_selectors,
 	},
+ 	{
+		.id = USB_ID(0x041e, 0x3040),
+		.map = live24ext_map,
+	},
 	{
 		/* Hercules DJ Console (Windows Edition) */
 		.id = USB_ID(0x06f8, 0xb000),

linux-2.6-alsa-support-sis7019.patch:

--- NEW FILE linux-2.6-alsa-support-sis7019.patch ---
From: Dave Dillow <dave at thedillows.org>

Basic audio support for the SiS 7019 Audio Accelerator as found in the
SiS 55x SoC. There is currently no synth support at the moment, but
audio playback and capture with two periods per buffer has seen
extensive use. Arbitrary period and buffer sizes (with multiple periods
per buffer) have seen light testing, but are believed to be production
ready.

Signed-off-by: David Dillow <dave at thedillows.org>
---
This is against the alsa-kernel hg repo.

Changes since last posting:
 * Removed unnecessary locking
 * Added power management support
 * Reworked capture period timing to use dedicated silence buffer
 * Changed header location
 * Fixed muting of left stereo channel
 * Fixed XRUNs with non-integral periods per buffer
 * Better enforcement of hardware limits

 pci/sis7019.c   | 1466 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 pci/sis7019.h   |  342 +++++++++++++
 pci/Kconfig     |   10 
 pci/Makefile    |    2 
 4 files changed, 1820 insertions(+)

diff -r 17223a4918b4 pci/Kconfig
--- a/sound/pci/Kconfig	Tue Nov 27 15:27:17 2007 +0100
+++ b/sound/pci/Kconfig	Wed Nov 28 01:39:33 2007 -0500
@@ -802,6 +802,16 @@ config SND_RME9652
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-rme9652.
 
+config SND_SIS7019
+	tristate "SiS 7019 Audio Accelerator"
+	depends on SND
+	select SND_AC97_CODEC
+	help
+	  Say Y here to include support for the SiS 7019 Audio Accelerator.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called snd-sis7019.
+
 config SND_SONICVIBES
 	tristate "S3 SonicVibes"
 	depends on SND
diff -r 17223a4918b4 pci/Makefile
--- a/sound/pci/Makefile	Tue Nov 27 15:27:17 2007 +0100
+++ b/sound/pci/Makefile	Wed Nov 28 01:39:33 2007 -0500
@@ -23,6 +23,7 @@ snd-maestro3-objs := maestro3.o
 snd-maestro3-objs := maestro3.o
 snd-rme32-objs := rme32.o
 snd-rme96-objs := rme96.o
+snd-sis7019-objs := sis7019.o
 snd-sonicvibes-objs := sonicvibes.o
 snd-via82xx-objs := via82xx.o
 snd-via82xx-modem-objs := via82xx_modem.o
@@ -48,6 +49,7 @@ obj-$(CONFIG_SND_MAESTRO3) += snd-maestr
 obj-$(CONFIG_SND_MAESTRO3) += snd-maestro3.o
 obj-$(CONFIG_SND_RME32) += snd-rme32.o
 obj-$(CONFIG_SND_RME96) += snd-rme96.o
+obj-$(CONFIG_SND_SIS7019) += snd-sis7019.o
 obj-$(CONFIG_SND_SONICVIBES) += snd-sonicvibes.o
 obj-$(CONFIG_SND_VIA82XX) += snd-via82xx.o
 obj-$(CONFIG_SND_VIA82XX_MODEM) += snd-via82xx-modem.o
diff -r 17223a4918b4 pci/sis7019.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sound/pci/sis7019.c	Wed Nov 28 01:39:33 2007 -0500
@@ -0,0 +1,1466 @@
+/*
+ *  Driver for SiS7019 Audio Accelerator
+ *
+ *  Copyright (C) 2004-2007, David Dillow
+ *  Written by David Dillow <dave at thedillows.org>
+ *  Inspired by the Trident 4D-WaveDX/NX driver.
+ *
+ *  All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, version 2.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include <sound/driver.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/time.h>
+#include <linux/moduleparam.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <sound/core.h>
+#include <sound/ac97_codec.h>
+#include <sound/initval.h>
+#include "sis7019.h"
+
+MODULE_AUTHOR("David Dillow <dave at thedillows.org>");
+MODULE_DESCRIPTION("SiS 7019");
+MODULE_LICENSE("GPL");
+MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}");
+
+static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
+static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
+static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
+
+module_param_array(index, int, NULL, 0444);
+MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator.");
+module_param_array(id, charp, NULL, 0444);
+MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator.");
+module_param_array(enable, bool, NULL, 0444);
+MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator.");
+
+static struct pci_device_id snd_sis7019_ids[] = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) },
+	{ 0, }
+};
+
+MODULE_DEVICE_TABLE(pci, snd_sis7019_ids);
+
+/* There are three timing modes for the voices.
+ *
+ * For both playback and capture, when the buffer is one or two periods long,
+ * we use the hardware's built-in Mid-Loop Interrupt and End-Loop Interrupt
+ * to let us know when the periods have ended.
+ *
+ * When performing playback with more than two periods per buffer, we set
+ * the "Stop Sample Offset" and tell the hardware to interrupt us when we
+ * reach it. We then update the offset and continue on until we are
+ * interrupted for the next period.
+ *
+ * Capture channels do not have a SSO, so we allocate a playback channel to
+ * use as a timer for the capture periods. We use the SSO on the playback
+ * channel to clock out virtual periods, and adjust the virtual period length
+ * to maintain synchronization. This algorithm came from the Trident driver.
+ *
+ * FIXME: It'd be nice to make use of some of the synth features in the
+ * hardware, but a woeful lack of documentation is a significant roadblock.
+ */
+struct voice {
+	u16 flags;
+#define 	VOICE_IN_USE		1
+#define 	VOICE_CAPTURE		2
+#define 	VOICE_SSO_TIMING	4
+#define 	VOICE_SYNC_TIMING	8
+	u16 sync_cso;
+	u16 period_size;
+	u16 buffer_size;
+	u16 sync_period_size;
+	u16 sync_buffer_size;
+	u32 sso;
+	u32 vperiod;
+	struct snd_pcm_substream *substream;
+	struct voice *timing;
+	void __iomem *ctrl_base;
+	void __iomem *wave_base;
+	void __iomem *sync_base;
+	int num;
+};
+
+/* We need four pages to store our wave parameters during a suspend. If
+ * we're not doing power management, we still need to allocate a page
+ * for the silence buffer.
+ */
+#ifdef CONFIG_PM
+#define SIS_SUSPEND_PAGES	4
+#else
+#define SIS_SUSPEND_PAGES	1
+#endif
+
+struct sis7019 {
+	unsigned long ioport;
+	void __iomem *ioaddr;
+	int irq;
+	int codecs_present;
+
+	struct pci_dev *pci;
+	struct snd_pcm *pcm;
+	struct snd_card *card;
+	struct snd_ac97 *ac97[3];
+
+	/* Protect against more than one thread hitting the AC97
+	 * registers (in a more polite manner than pounding the hardware
+	 * semaphore)
+	 */
+	struct mutex ac97_mutex;
+
+	/* voice_lock protects allocation/freeing of the voice descriptions
+	 */
+	spinlock_t voice_lock;
+
+	struct voice voices[64];
+	struct voice capture_voice;
+
+	/* Allocate pages to store the internal wave state during
+	 * suspends. When we're operating, this can be used as a silence
+	 * buffer for a timing channel.
+	 */
+	void *suspend_state[SIS_SUSPEND_PAGES];
+
+	int silence_users;
+	dma_addr_t silence_dma_addr;
+};
+
+#define SIS_PRIMARY_CODEC_PRESENT	0x0001
+#define SIS_SECONDARY_CODEC_PRESENT	0x0002
+#define SIS_TERTIARY_CODEC_PRESENT	0x0004
+
+/* The HW has a limit in the loop end offset parameter of 0xfff8 samples,
+ * so our max buffer size is 0xfff8 samples * 2 channels * 2 bytes per sample.
+ * The minimum offset for LEO, SSO, and ESO is 9 samples, so that bounds our
+ * period. Given the two bounds, we get our maximum number of periods.
+ *
+ * We'll add a constraint upon open that limits the period and buffer sample
+ * size to values that are legal for the hardware.
+ */
+static struct snd_pcm_hardware sis_playback_hw_info = {
+	.info = (SNDRV_PCM_INFO_MMAP |
+		 SNDRV_PCM_INFO_MMAP_VALID |
+		 SNDRV_PCM_INFO_INTERLEAVED |
+		 SNDRV_PCM_INFO_BLOCK_TRANSFER |
+		 SNDRV_PCM_INFO_SYNC_START |
+		 SNDRV_PCM_INFO_RESUME),
+	.formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 |
+		    SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE),
+	.rates = SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_CONTINUOUS,
+	.rate_min = 4000,
+	.rate_max = 48000,
+	.channels_min = 1,
+	.channels_max = 2,
+	.buffer_bytes_max = (0xfff8 * 4),
+	.period_bytes_min = 9,
+	.period_bytes_max = (0xfff8 * 4),
+	.periods_min = 1,
+	.periods_max = (0xfff8 / 9),
+};
+
+static struct snd_pcm_hardware sis_capture_hw_info = {
+	.info = (SNDRV_PCM_INFO_MMAP |
+		 SNDRV_PCM_INFO_MMAP_VALID |
+		 SNDRV_PCM_INFO_INTERLEAVED |
+		 SNDRV_PCM_INFO_BLOCK_TRANSFER |
+		 SNDRV_PCM_INFO_SYNC_START |
+		 SNDRV_PCM_INFO_RESUME),
+	.formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 |
+		    SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE),
+	.rates = SNDRV_PCM_RATE_48000,
+	.rate_min = 4000,
+	.rate_max = 48000,
+	.channels_min = 1,
+	.channels_max = 2,
+	.buffer_bytes_max = (0xfff7 * 4),
+	.period_bytes_min = 9,
+	.period_bytes_max = (0xfff7 * 4),
+	.periods_min = 1,
+	.periods_max = (0xfff8 / 9),
+};
+
+static void sis_update_sso(struct voice *voice, u16 period)
+{
+	void __iomem *base = voice->ctrl_base;
+
+	voice->sso += period;
+	if (voice->sso >= voice->buffer_size)
+		voice->sso -= voice->buffer_size;
+
+	/* Enforce the hardware limit */
+	if (voice->sso < 8)
+		voice->sso = 8;
+
+	/* The SSO is in the upper 16 bits of the register. */
+	writew(voice->sso & 0xffff, base + SIS_PLAY_DMA_SSO_ESO + 2);
+}
+
+static void sis_update_voice(struct voice *voice)
+{
+	if (voice->flags & VOICE_SSO_TIMING) {
+		sis_update_sso(voice, voice->period_size);
+	} else if (voice->flags & VOICE_SYNC_TIMING) {
+		int sync;
+
+		/* If we've not hit the end of the virtual period, update
+		 * our records and keep going.
+		 */
+		if (voice->vperiod > voice->period_size) {
+			voice->vperiod -= voice->period_size;
+			if (voice->vperiod < voice->period_size)
+				sis_update_sso(voice, voice->vperiod); 
+			else
+				sis_update_sso(voice, voice->period_size); 
+			return;
+		}
+			
+		/* Calculate our relative offset between the target and
+		 * the actual CSO value. Since we're operating in a loop,
+		 * if the value is more than half way around, we can
+		 * consider ourselves wrapped.
+		 */
+		sync = voice->sync_cso;
+		sync -= readw(voice->sync_base + SIS_CAPTURE_DMA_FORMAT_CSO);
+		if (sync > (voice->sync_buffer_size / 2))
+			sync -= voice->sync_buffer_size;
+
+		/* If sync is positive, then we interrupted too early, and
+		 * we'll need to come back in a few samples and try again.
+		 * There's a minimum wait, as it takes some time for the DMA
+		 * engine to startup, etc...
+		 */
+		if (sync > 0) {
+			if (sync < 16)
+				sync = 16;
+			sis_update_sso(voice, sync);
+			return;
+		}
+
+		/* Ok, we interrupted right on time, or (hopefully) just
+		 * a bit late. We'll adjst our next waiting period based
+		 * on how close we got.
+		 *
+		 * We need to stay just behind the actual channel to ensure
+		 * it really is past a period when we get our interrupt --
+		 * otherwise we'll fall into the early code above and have
+		 * a minimum wait time, which makes us quite late here,
+		 * eating into the user's time to refresh the buffer, esp.
+		 * if using small periods.
+		 *
+		 * If we're less than 9 samples behind, we're on target.
+		 */
+		if (sync > -9)
+			voice->vperiod = voice->sync_period_size + 1;
+		else
+			voice->vperiod = voice->sync_period_size - 4;
+
+		if (voice->vperiod < voice->buffer_size) {
+			sis_update_sso(voice, voice->vperiod); 
+			voice->vperiod = 0;
+		} else
+			sis_update_sso(voice, voice->period_size); 
+
+		sync = voice->sync_cso + voice->sync_period_size;
+		if (sync >= voice->sync_buffer_size)
+			sync -= voice->sync_buffer_size;
+		voice->sync_cso = sync;
+	}
+
+	snd_pcm_period_elapsed(voice->substream);
+}
+
+static void sis_voice_irq(u32 status, struct voice *voice)
+{
+	int bit;
+
+	while (status) {
+		bit = __ffs(status);
+		status >>= bit + 1;
+		voice += bit;
+		sis_update_voice(voice);
+		voice++;
+	}
+}
+
+static irqreturn_t sis_interrupt(int irq, void *dev)
+{
+	struct sis7019 *sis = dev;
+	unsigned long io = sis->ioport;
+	struct voice *voice;
+	u32 intr, status;
+
+	/* We only use the DMA interrupts, and we don't enable any other
+	 * source of interrupts. But, it is possible to see an interupt
+	 * status that didn't actually interrupt us, so eliminate anything
+	 * we're not expecting to avoid falsely claiming an IRQ, and an
+	 * ensuing endless loop.
+	 */
+	intr = inl(io + SIS_GISR);
+	intr &= SIS_GISR_AUDIO_PLAY_DMA_IRQ_STATUS |
+		SIS_GISR_AUDIO_RECORD_DMA_IRQ_STATUS;
+	if (!intr)
+		return IRQ_NONE;
+
+	do {
+		status = inl(io + SIS_PISR_A);
+		if (status) {
+			sis_voice_irq(status, sis->voices);
+			outl(status, io + SIS_PISR_A);
+		}
+
+		status = inl(io + SIS_PISR_B);
+		if (status) {
+			sis_voice_irq(status, &sis->voices[32]);
+			outl(status, io + SIS_PISR_B);
+		}
+
+		status = inl(io + SIS_RISR);
+		if (status) {
+			voice = &sis->capture_voice;
+			if (!voice->timing)
+				snd_pcm_period_elapsed(voice->substream);
+
+			outl(status, io + SIS_RISR);
+		}
+
+		outl(intr, io + SIS_GISR);
+		intr = inl(io + SIS_GISR);
+		intr &= SIS_GISR_AUDIO_PLAY_DMA_IRQ_STATUS |
+			SIS_GISR_AUDIO_RECORD_DMA_IRQ_STATUS;
+	} while (intr);
+
+	return IRQ_HANDLED;
+}
+
+static u32 sis_rate_to_delta(unsigned int rate)
+{
+	u32 delta;
+
+	/* This was copied from the trident driver, but it seems its gotten
+	 * around a bit... nevertheless, it works well.
+	 *
+	 * We special case 44100 and 8000 since rounding with the equation
+	 * does not give us an accurate enough value. For 11025 and 22050
+	 * the equation gives us the best answer. All other frequencies will
+	 * also use the equation. JDW
+	 */
+	if (rate == 44100)
+		delta = 0xeb3;
+	else if (rate == 8000)
+		delta = 0x2ab;
+	else if (rate == 48000)
+		delta = 0x1000;
+	else
+		delta = (((rate << 12) + 24000) / 48000) & 0x0000ffff;
+	return delta;
+}
+
+static void __sis_map_silence(struct sis7019 *sis)
+{
+	/* Must hold the voice_lock on entry */
+	if (!sis->silence_users)
+		sis->silence_dma_addr = pci_map_single(sis->pci,
+						sis->suspend_state[0],
+						4096, PCI_DMA_TODEVICE);
+	sis->silence_users++;
+}
+
+static void __sis_unmap_silence(struct sis7019 *sis)
+{
+	/* Must hold the voice_lock on entry */
+	sis->silence_users--;
+	if (!sis->silence_users) 
+		pci_unmap_single(sis->pci, sis->silence_dma_addr, 4096,
+					PCI_DMA_TODEVICE);
+}
+
+static void sis_free_voice(struct sis7019 *sis, struct voice *voice)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&sis->voice_lock, flags);
+	if (voice->timing) {
+		__sis_unmap_silence(sis);
+		voice->timing->flags = ~(VOICE_IN_USE | VOICE_SSO_TIMING |
+						VOICE_SYNC_TIMING);
+		voice->timing = NULL;
+	}
+	voice->flags &= ~(VOICE_IN_USE | VOICE_SSO_TIMING | VOICE_SYNC_TIMING);
+	spin_unlock_irqrestore(&sis->voice_lock, flags);
+}
+
+static struct voice *__sis_alloc_playback_voice(struct sis7019 *sis)
+{
+	/* Must hold the voice_lock on entry */
+	struct voice *voice;
+	int i;
+
+	for (i = 0; i < 64; i++) {
+		voice = &sis->voices[i];
+		if (voice->flags & VOICE_IN_USE)
+			continue;
+		voice->flags |= VOICE_IN_USE;
+		goto found_one;
+	}
+	voice = NULL;
+
+found_one:
+	return voice;
+}
+
+static struct voice *sis_alloc_playback_voice(struct sis7019 *sis)
+{
+	struct voice *voice;
+	unsigned long flags;
+
+	spin_lock_irqsave(&sis->voice_lock, flags);
+	voice = __sis_alloc_playback_voice(sis);
+	spin_unlock_irqrestore(&sis->voice_lock, flags);
+
+	return voice;
+}
+
+static int sis_alloc_timing_voice(struct snd_pcm_substream *substream,
+					struct snd_pcm_hw_params *hw_params)
+{
+	struct sis7019 *sis = snd_pcm_substream_chip(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct voice *voice = runtime->private_data;
+	unsigned int period_size, buffer_size;
+	unsigned long flags;
+	int needed;
+
+	/* If there are one or two periods per buffer, we don't need a
+	 * timing voice, as we can use the capture channel's interrupts
+	 * to clock out the periods.
+	 */
+	period_size = params_period_size(hw_params);
+	buffer_size = params_buffer_size(hw_params);
+	needed = (period_size != buffer_size &&
+			period_size != (buffer_size / 2));
+
+	if (needed && !voice->timing) {
+		spin_lock_irqsave(&sis->voice_lock, flags);
+		voice->timing = __sis_alloc_playback_voice(sis);
+		if (voice->timing)
+			__sis_map_silence(sis);
+		spin_unlock_irqrestore(&sis->voice_lock, flags);
+		if (!voice->timing)
+			return -ENOMEM;
+		voice->timing->substream = substream;
+	} else if (!needed && voice->timing) {
+		sis_free_voice(sis, voice);
+		voice->timing = NULL;
+	}
+
+	return 0;
+}
+
+static int sis_playback_open(struct snd_pcm_substream *substream)
+{
+	struct sis7019 *sis = snd_pcm_substream_chip(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct voice *voice;
+
+	voice = sis_alloc_playback_voice(sis);
+	if (!voice)
+		return -EAGAIN;
+
+	voice->substream = substream;
+	runtime->private_data = voice;
+	runtime->hw = sis_playback_hw_info;
+	snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
+						9, 0xfff8);
+	snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
+						9, 0xfff8);
+	snd_pcm_set_sync(substream);
+	return 0;
+}
+
+static int sis_substream_close(struct snd_pcm_substream *substream)
+{
+	struct sis7019 *sis = snd_pcm_substream_chip(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct voice *voice = runtime->private_data;
+
+	sis_free_voice(sis, voice);
+	return 0;
+}
+
+static int sis_playback_hw_params(struct snd_pcm_substream *substream,
+					struct snd_pcm_hw_params *hw_params)
+{
+	return snd_pcm_lib_malloc_pages(substream,
+					params_buffer_bytes(hw_params));
+}
+
+static int sis_hw_free(struct snd_pcm_substream *substream)
+{
+	return snd_pcm_lib_free_pages(substream);
+}
+
+static int sis_pcm_playback_prepare(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct voice *voice = runtime->private_data;
+	void __iomem *ctrl_base = voice->ctrl_base;
+	void __iomem *wave_base = voice->wave_base;
+	u32 format, dma_addr, control, sso_eso, delta, reg;
+	u16 leo;
+
+	/* We rely on the PCM core to ensure that the parameters for this
+	 * substream do not change on us while we're programming the HW.
+	 */
+	format = 0;
+	if (snd_pcm_format_width(runtime->format) == 8)
+		format |= SIS_PLAY_DMA_FORMAT_8BIT;
+	if (!snd_pcm_format_signed(runtime->format))
+		format |= SIS_PLAY_DMA_FORMAT_UNSIGNED;
+	if (runtime->channels == 1)
+		format |= SIS_PLAY_DMA_FORMAT_MONO;
+
+	/* The baseline setup is for a single period per buffer, and
+	 * we add bells and whistles as needed from there.
+	 */
+	dma_addr = runtime->dma_addr;
+	leo = runtime->buffer_size - 1;
+	control = leo | SIS_PLAY_DMA_LOOP | SIS_PLAY_DMA_INTR_AT_LEO;
+	sso_eso = leo;
+
+	if (runtime->period_size == (runtime->buffer_size / 2)) {
+		control |= SIS_PLAY_DMA_INTR_AT_MLP;
+	} else if (runtime->period_size != runtime->buffer_size) {
+		voice->flags |= VOICE_SSO_TIMING;
+		voice->sso = runtime->period_size - 1;
+		voice->period_size = runtime->period_size;
+		voice->buffer_size = runtime->buffer_size;
+
+		control &= ~SIS_PLAY_DMA_INTR_AT_LEO;
+		control |= SIS_PLAY_DMA_INTR_AT_SSO;
+		sso_eso |= (runtime->period_size - 1) << 16;
+	}
+
+	delta = sis_rate_to_delta(runtime->rate);
+
+	/* Ok, we're ready to go, set up the channel.
+	 */
+	writel(format, ctrl_base + SIS_PLAY_DMA_FORMAT_CSO);
+	writel(dma_addr, ctrl_base + SIS_PLAY_DMA_BASE);
+	writel(control, ctrl_base + SIS_PLAY_DMA_CONTROL);
+	writel(sso_eso, ctrl_base + SIS_PLAY_DMA_SSO_ESO);
+
+	for (reg = 0; reg < SIS_WAVE_SIZE; reg += 4)
+		writel(0, wave_base + reg);
+
+	writel(SIS_WAVE_GENERAL_WAVE_VOLUME, wave_base + SIS_WAVE_GENERAL);
+	writel(delta << 16, wave_base + SIS_WAVE_GENERAL_ARTICULATION);
+	writel(SIS_WAVE_CHANNEL_CONTROL_FIRST_SAMPLE |
+			SIS_WAVE_CHANNEL_CONTROL_AMP_ENABLE |
+			SIS_WAVE_CHANNEL_CONTROL_INTERPOLATE_ENABLE,
+			wave_base + SIS_WAVE_CHANNEL_CONTROL);
+
+	/* Force PCI writes to post. */
+	readl(ctrl_base);
+
+	return 0;
+}
+
+static int sis_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+	struct sis7019 *sis = snd_pcm_substream_chip(substream);
+	unsigned long io = sis->ioport;
+	struct snd_pcm_substream *s;
+	struct voice *voice;
+	void *chip;
+	int starting;
+	u32 record = 0;
+	u32 play[2] = { 0, 0 };
+
+	/* No locks needed, as the PCM core will hold the locks on the
+	 * substreams, and the HW will only start/stop the indicated voices
+	 * without changing the state of the others.
+	 */
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_START:
+	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+	case SNDRV_PCM_TRIGGER_RESUME:
+		starting = 1;
+		break;
+	case SNDRV_PCM_TRIGGER_STOP:
+	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+	case SNDRV_PCM_TRIGGER_SUSPEND:
+		starting = 0;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	snd_pcm_group_for_each_entry(s, substream) {
+		/* Make sure it is for us... */
+		chip = snd_pcm_substream_chip(s);
+		if (chip != sis)
+			continue;
+
+		voice = s->runtime->private_data;
+		if (voice->flags & VOICE_CAPTURE) {
+			record |= 1 << voice->num;
+			voice = voice->timing;
+		}
+
+		/* voice could be NULL if this a recording stream, and it
+		 * doesn't have an external timing channel.
+		 */
+		if (voice)
+			play[voice->num / 32] |= 1 << (voice->num & 0x1f);
+
+		snd_pcm_trigger_done(s, substream);
+	}
+
+	if (starting) {
+		if (record)
+			outl(record, io + SIS_RECORD_START_REG);
+		if (play[0])
+			outl(play[0], io + SIS_PLAY_START_A_REG);
+		if (play[1])
+			outl(play[1], io + SIS_PLAY_START_B_REG);
+	} else {
+		if (record)
+			outl(record, io + SIS_RECORD_STOP_REG);
+		if (play[0])
+			outl(play[0], io + SIS_PLAY_STOP_A_REG);
+		if (play[1])
+			outl(play[1], io + SIS_PLAY_STOP_B_REG);
+	}
+	return 0;
+}
+
+static snd_pcm_uframes_t sis_pcm_pointer(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct voice *voice = runtime->private_data;
+	u32 cso;
+
+	cso = readl(voice->ctrl_base + SIS_PLAY_DMA_FORMAT_CSO);
+	cso &= 0xffff;
+	return cso;
+}
+
+static int sis_capture_open(struct snd_pcm_substream *substream)
+{
+	struct sis7019 *sis = snd_pcm_substream_chip(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct voice *voice = &sis->capture_voice;
+	unsigned long flags;
+
+	/* FIXME: The driver only supports recording from one channel
+	 * at the moment, but it could support more.
+	 */
+	spin_lock_irqsave(&sis->voice_lock, flags);
+	if (voice->flags & VOICE_IN_USE)
+		voice = NULL;
+	else
+		voice->flags |= VOICE_IN_USE;
+	spin_unlock_irqrestore(&sis->voice_lock, flags);
+
+	if (!voice)
+		return -EAGAIN;
+
+	voice->substream = substream;
+	runtime->private_data = voice;
+	runtime->hw = sis_capture_hw_info;
+	runtime->hw.rates = sis->ac97[0]->rates[AC97_RATES_ADC];
+	snd_pcm_limit_hw_rates(runtime);
+	snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
+						9, 0xfff8);
+	snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
+						9, 0xfff8);
+	snd_pcm_set_sync(substream);
+	return 0;
+}
+
+static int sis_capture_hw_params(struct snd_pcm_substream *substream,
+					struct snd_pcm_hw_params *hw_params)
+{
+	struct sis7019 *sis = snd_pcm_substream_chip(substream);
+	int rc;
+
+	rc = snd_ac97_set_rate(sis->ac97[0], AC97_PCM_LR_ADC_RATE,
+						params_rate(hw_params));
+	if (rc)
+		goto out;
+
+	rc = snd_pcm_lib_malloc_pages(substream,
+					params_buffer_bytes(hw_params));
+	if (rc < 0)
+		goto out;
+
+	rc = sis_alloc_timing_voice(substream, hw_params);
+
+out:
+	return rc;
+}
+
+static void sis_prepare_timing_voice(struct voice *timing, struct voice *cap,
+					struct snd_pcm_runtime *runtime)
+{
+	u16 buffer_size, period_size;
+	u32 vperiod, sso;
+
+	timing->flags |= VOICE_SYNC_TIMING;
+	timing->sync_base = cap->ctrl_base;
+	timing->sync_cso = runtime->period_size - 1;
+	timing->sync_period_size = runtime->period_size;
+	timing->sync_buffer_size = runtime->buffer_size;
+
+	/* Set our initial buffer and period as large as we can given a
+	 * single page of silence.
+	 */
+	buffer_size = 4096 / runtime->channels;
+	buffer_size /= snd_pcm_format_size(runtime->format, 1);
+	period_size = buffer_size;
+
+	/* Initially, we want to interrupt just a bit behind the end of
+	 * the period we're clocking out. 10 samples seems to give a good
+	 * delay.
+	 *
+	 * We want to spread our interrupts throughout the virtual period,
+	 * so that we don't end up with two interrupts back to back at the
+	 * end -- this helps minimize the effects of any jitter. Adjust our
+	 * clocking period size so that the last period is at least a fourth
+	 * of a full period.
+	 *
+	 * This is all moot if we don't need to use virtual periods.
+	 */
+	vperiod = runtime->period_size + 10;
+	if (vperiod > period_size) {
+		u16 tail = vperiod % period_size;
+		u16 quarter_period = period_size / 4;
+
+		if (tail && tail < quarter_period) {
+			u16 loops = vperiod / period_size;
+
+			tail = quarter_period - tail;
+			tail += loops - 1;
+			tail /= loops;
+			period_size -= tail;
+		}
+
+		sso = period_size - 1;
+	} else {
+		/* The initial period will fit inside the buffer, so we
+		 * don't need to use virtual periods -- disable them.
+		 */
+		period_size = runtime->period_size;
+		sso = vperiod - 1;
+		vperiod = 0;
+	}
+
+	timing->period_size = period_size;
+	timing->buffer_size = buffer_size;
+	timing->sso = sso;
+	timing->vperiod = vperiod;
+}
+
+static int sis_pcm_capture_prepare(struct snd_pcm_substream *substream)
+{
+	struct sis7019 *sis = snd_pcm_substream_chip(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct voice *voice = runtime->private_data;
+	struct voice *timing = voice->timing;
+	void __iomem *rec_base = voice->ctrl_base;
+	void __iomem *play_base = NULL;
+	void __iomem *wave_base = NULL;
+	u32 format, dma_addr, rec_ctrl;
+	u16 leo;
+
+	/* The following variables are only used if there is a timing channel.
+	 */
+	u32 uninitialized_var(timing_ctrl);
+	u32 uninitialized_var(sso_eso);
+	u32 uninitialized_var(delta);
+
+	/* We rely on the PCM core to ensure that the parameters for this
+	 * substream do not change on us while we're programming the HW.
+	 */
+	format = 0;
+	if (snd_pcm_format_width(runtime->format) == 8)
+		format = SIS_CAPTURE_DMA_FORMAT_8BIT;
+	if (!snd_pcm_format_signed(runtime->format))
+		format |= SIS_CAPTURE_DMA_FORMAT_UNSIGNED;
+	if (runtime->channels == 1)
+		format |= SIS_CAPTURE_DMA_FORMAT_MONO;
+
+	dma_addr = runtime->dma_addr;
+	leo = runtime->buffer_size - 1;
+	rec_ctrl = leo | SIS_CAPTURE_DMA_LOOP;
+	if (timing) {
+		/* We're using a timing voice, so the capture voice will
+		 * not need to generate interrupts.
+		 */
+		sis_prepare_timing_voice(timing, voice, runtime);
+
+		timing_ctrl = timing->buffer_size - 1;
+		timing_ctrl |= SIS_PLAY_DMA_LOOP | SIS_PLAY_DMA_INTR_AT_SSO;
+		sso_eso = timing->buffer_size - 1;;
+		sso_eso |= timing->sso << 16;
+
+		delta = sis_rate_to_delta(runtime->rate);
+
+		play_base = timing->ctrl_base;
+		wave_base = timing->wave_base;
+	} else {
+		/* We've just got one or two periods, so we can use the
+		 * capture voice's interrupt generation.
+		 */
+		rec_ctrl |= SIS_CAPTURE_DMA_INTR_AT_LEO;
+		if (runtime->period_size != runtime->buffer_size)
+			rec_ctrl |= SIS_CAPTURE_DMA_INTR_AT_MLP;
+	}
+
+	/* We're ready to program the channel(s)
+	 */
+	writel(format, rec_base + SIS_CAPTURE_DMA_FORMAT_CSO);
+	writel(dma_addr, rec_base + SIS_CAPTURE_DMA_BASE);
+	writel(rec_ctrl, rec_base + SIS_CAPTURE_DMA_CONTROL);
+
+	if (play_base) {
+		u32 reg;
+
+		writel(format, play_base + SIS_PLAY_DMA_FORMAT_CSO);
+		writel(sis->silence_dma_addr, play_base + SIS_PLAY_DMA_BASE);
+		writel(timing_ctrl, play_base + SIS_PLAY_DMA_CONTROL);
+		writel(sso_eso, play_base + SIS_PLAY_DMA_SSO_ESO);
+
+		for (reg = 0; reg < SIS_WAVE_SIZE; reg += 4)
+			writel(0, wave_base + reg);
+
+		writel(SIS_WAVE_GENERAL_WAVE_VOLUME,
+				wave_base + SIS_WAVE_GENERAL);
+		writel(delta << 16, wave_base + SIS_WAVE_GENERAL_ARTICULATION);
+		writel(SIS_WAVE_CHANNEL_CONTROL_FIRST_SAMPLE |
+				SIS_WAVE_CHANNEL_CONTROL_AMP_ENABLE |
+				SIS_WAVE_CHANNEL_CONTROL_INTERPOLATE_ENABLE,
+				wave_base + SIS_WAVE_CHANNEL_CONTROL);
+	}
+
+	/* Force the writes to post. */
+	readl(rec_base);
+
+	return 0;
+}
+
+static struct snd_pcm_ops sis_playback_ops = {
+	.open = sis_playback_open,
+	.close = sis_substream_close,
+	.ioctl = snd_pcm_lib_ioctl,
+	.hw_params = sis_playback_hw_params,
+	.hw_free = sis_hw_free,
+	.prepare = sis_pcm_playback_prepare,
+	.trigger = sis_pcm_trigger,
+	.pointer = sis_pcm_pointer,
+};
+
+static struct snd_pcm_ops sis_capture_ops = {
+	.open = sis_capture_open,
+	.close = sis_substream_close,
+	.ioctl = snd_pcm_lib_ioctl,
+	.hw_params = sis_capture_hw_params,
+	.hw_free = sis_hw_free,
+	.prepare = sis_pcm_capture_prepare,
+	.trigger = sis_pcm_trigger,
+	.pointer = sis_pcm_pointer,
+};
+
+static int __devinit sis_pcm_create(struct sis7019 *sis)
+{
+	struct snd_pcm *pcm;
+	int rc;
+
+	rc = snd_pcm_new(sis->card, "SiS 7019", 0, 40, 1, &pcm);
+	if (rc)
+		return rc;
+
+	pcm->private_data = sis;
+	strcpy(pcm->name, "SiS 7019");
+	sis->pcm = pcm;
+
+	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &sis_playback_ops);
+	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &sis_capture_ops);
+
+	/* Try to preallocate some memory, but it's not the end of the
+	 * world if this fails.
+	 */
+	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+				snd_dma_pci_data(sis->pci), 64*1024, 128*1024);
+
+	return 0;
+}
+
+static unsigned short sis_ac97_rw(struct sis7019 *sis, int codec, u32 cmd)
+{
+	unsigned long io = sis->ioport;
+	unsigned short val = 0xffff;
+	u16 status;
+	u16 rdy;
+	int count;
+	const static u16 codec_ready[3] = {
+		SIS_AC97_STATUS_CODEC_READY,
+		SIS_AC97_STATUS_CODEC2_READY,
+		SIS_AC97_STATUS_CODEC3_READY,
+	};
+
+	rdy = codec_ready[codec];
+
+
+	/* Get the AC97 semaphore -- software first, so we don't spin
+	 * pounding out IO reads on the hardware semaphore...
+	 */
+	mutex_lock(&sis->ac97_mutex);
+
+	count = 0xffff;
+	while ((inw(io + SIS_AC97_SEMA) & SIS_AC97_SEMA_BUSY) && --count)
+		udelay(1);
+
+	if (!count)
+		goto timeout;
+
+	/* ... and wait for any outstanding commands to complete ...
+	 */
+	count = 0xffff;
+	do {
+		status = inw(io + SIS_AC97_STATUS);
+		if ((status & rdy) && !(status & SIS_AC97_STATUS_BUSY))
+			break;
+
+		udelay(1);
+	} while (--count);
+
+	if (!count)
+		goto timeout_sema;
+
+	/* ... before sending our command and waiting for it to finish ...
+	 */
+	outl(cmd, io + SIS_AC97_CMD);
+	udelay(10);
+
+	count = 0xffff;
+	while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
+		udelay(1);
+
+	/* ... and reading the results (if any).
+	 */
+	val = inl(io + SIS_AC97_CMD) >> 16;
+
+timeout_sema:
+	outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA);
+timeout:
+	mutex_unlock(&sis->ac97_mutex);
+
+	if (!count) {
+		printk(KERN_ERR "sis7019: ac97 codec %d timeout cmd 0x%08x\n",
+					codec, cmd);
+	}
+
+	return val;
+}
+
+static void sis_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
+				unsigned short val)
+{
+	const static u32 cmd[3] = {
+		SIS_AC97_CMD_CODEC_WRITE,
+		SIS_AC97_CMD_CODEC2_WRITE,
+		SIS_AC97_CMD_CODEC3_WRITE,
+	};
+	sis_ac97_rw(ac97->private_data, ac97->num,
+			(val << 16) | (reg << 8) | cmd[ac97->num]);
+}
+
+static unsigned short sis_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
+{
+	const static u32 cmd[3] = {
+		SIS_AC97_CMD_CODEC_READ,
+		SIS_AC97_CMD_CODEC2_READ,
+		SIS_AC97_CMD_CODEC3_READ,
+	};
+	return sis_ac97_rw(ac97->private_data, ac97->num,
+					(reg << 8) | cmd[ac97->num]);
+}
+
+static int __devinit sis_mixer_create(struct sis7019 *sis)
+{
+	struct snd_ac97_bus *bus;
+	struct snd_ac97_template ac97;
+	static struct snd_ac97_bus_ops ops = {
+		.write = sis_ac97_write,
+		.read = sis_ac97_read,
+	};
+	int rc;
+
+	memset(&ac97, 0, sizeof(ac97));
+	ac97.private_data = sis;
+
+	rc = snd_ac97_bus(sis->card, 0, &ops, NULL, &bus);
+	if (!rc && sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT)
+		rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[0]);
+	ac97.num = 1;
+	if (!rc && (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT))
+		rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[1]);
+	ac97.num = 2;
+	if (!rc && (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT))
+		rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[2]);
+
+	/* If we return an error here, then snd_card_free() should
+	 * free up any ac97 codecs that got created, as well as the bus.
+	 */
+	return rc;
+}
+
+static void sis_free_suspend(struct sis7019 *sis)
+{
+	int i;
+
+	for (i = 0; i < SIS_SUSPEND_PAGES; i++)
+		kfree(sis->suspend_state[i]);
+}
+
+static int sis_chip_free(struct sis7019 *sis)
+{
+	/* Reset the chip, and disable all interrputs.
+	 */
+	outl(SIS_GCR_SOFTWARE_RESET, sis->ioport + SIS_GCR);
+	udelay(10);
+	outl(0, sis->ioport + SIS_GCR);
+	outl(0, sis->ioport + SIS_GIER);
+
+	/* Now, free everything we allocated.
+	 */
+	if (sis->irq >= 0)
+		free_irq(sis->irq, sis);
+
+	if (sis->ioaddr)
+		iounmap(sis->ioaddr);
+
+	pci_release_regions(sis->pci);
+	pci_disable_device(sis->pci);
+
+	sis_free_suspend(sis);
+	return 0;
+}
+
+static int sis_dev_free(struct snd_device *dev)
+{
+	struct sis7019 *sis = dev->device_data;
+	return sis_chip_free(sis);
+}
+
+static int sis_chip_init(struct sis7019 *sis)
+{
+	unsigned long io = sis->ioport;
+	void __iomem *ioaddr = sis->ioaddr;
+	u16 status;
+	int count;
+	int i;
+
+	/* Reset the audio controller
+	 */
+	outl(SIS_GCR_SOFTWARE_RESET, io + SIS_GCR);
+	udelay(10);
+	outl(0, io + SIS_GCR);
+
+	/* Get the AC-link semaphore, and reset the codecs
+	 */
+	count = 0xffff;
+	while ((inw(io + SIS_AC97_SEMA) & SIS_AC97_SEMA_BUSY) && --count)
+		udelay(1);
+
+	if (!count)
+		return -EIO;
+
+	outl(SIS_AC97_CMD_CODEC_COLD_RESET, io + SIS_AC97_CMD);
+	udelay(10);
+
+	count = 0xffff;
+	while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
+		udelay(1);
+
+	/* Now that we've finished the reset, find out what's attached.
+	 */
+	status = inl(io + SIS_AC97_STATUS);
+	if (status & SIS_AC97_STATUS_CODEC_READY)
+		sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT;
+	if (status & SIS_AC97_STATUS_CODEC2_READY)
+		sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT;
+	if (status & SIS_AC97_STATUS_CODEC3_READY)
+		sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT;
+
+	/* All done, let go of the semaphore, and check for errors
+	 */
+	outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA);
+	if (!sis->codecs_present || !count)
+		return -EIO;
+
+	/* Let the hardware know that the audio driver is alive,
+	 * and enable PCM slots on the AC-link for L/R playback (3 & 4) and
+	 * record channels. We're going to want to use Variable Rate Audio
+	 * for recording, to avoid needlessly resampling from 48kHZ.
+	 */
+	outl(SIS_AC97_CONF_AUDIO_ALIVE, io + SIS_AC97_CONF);
+	outl(SIS_AC97_CONF_AUDIO_ALIVE | SIS_AC97_CONF_PCM_LR_ENABLE |
+		SIS_AC97_CONF_PCM_CAP_MIC_ENABLE |
+		SIS_AC97_CONF_PCM_CAP_LR_ENABLE |
+		SIS_AC97_CONF_CODEC_VRA_ENABLE, io + SIS_AC97_CONF);
+
+	/* All AC97 PCM slots should be sourced from sub-mixer 0.
+	 */
+	outl(0, io + SIS_AC97_PSR);
+
+	/* There is only one valid DMA setup for a PCI environment.
+	 */
+	outl(SIS_DMA_CSR_PCI_SETTINGS, io + SIS_DMA_CSR);
+
+	/* Reset the syncronization groups for all of the channels
+	 * to be asyncronous. If we start doing SPDIF or 5.1 sound, etc.
+	 * we'll need to change how we handle these. Until then, we just
+	 * assign sub-mixer 0 to all playback channels, and avoid any
+	 * attenuation on the audio.
+	 */
+	outl(0, io + SIS_PLAY_SYNC_GROUP_A);
+	outl(0, io + SIS_PLAY_SYNC_GROUP_B);
+	outl(0, io + SIS_PLAY_SYNC_GROUP_C);
+	outl(0, io + SIS_PLAY_SYNC_GROUP_D);
+	outl(0, io + SIS_MIXER_SYNC_GROUP);
+
+	for (i = 0; i < 64; i++) {
+		writel(i, SIS_MIXER_START_ADDR(ioaddr, i));
+		writel(SIS_MIXER_RIGHT_NO_ATTEN | SIS_MIXER_LEFT_NO_ATTEN |
+				SIS_MIXER_DEST_0, SIS_MIXER_ADDR(ioaddr, i));
+	}
+
+	/* Don't attenuate any audio set for the wave amplifier.
+	 *
+	 * FIXME: Maximum attenuation is set for the music amp, which will
+	 * need to change if we start using the synth engine.
+	 */
+	outl(0xffff0000, io + SIS_WEVCR);
+
+	/* Ensure that the wave engine is in normal operating mode.
+	 */
+	outl(0, io + SIS_WECCR);
+
+	/* Go ahead and enable the DMA interrupts. They won't go live
+	 * until we start a channel.
+	 */
+	outl(SIS_GIER_AUDIO_PLAY_DMA_IRQ_ENABLE |
+		SIS_GIER_AUDIO_RECORD_DMA_IRQ_ENABLE, io + SIS_GIER);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int sis_suspend(struct pci_dev *pci, pm_message_t state)
+{
+	struct snd_card *card = pci_get_drvdata(pci);
+	struct sis7019 *sis = card->private_data;
+	void __iomem *ioaddr = sis->ioaddr;
+	int i;
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	snd_pcm_suspend_all(sis->pcm);
+	if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT)
+		snd_ac97_suspend(sis->ac97[0]);
+	if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT)
+		snd_ac97_suspend(sis->ac97[1]);
+	if (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT)
+		snd_ac97_suspend(sis->ac97[2]);
+
+	/* snd_pcm_suspend_all() stopped all channels, so we're quiescent.
+	 */
+	if (sis->irq >= 0) {
+		synchronize_irq(sis->irq);
+		free_irq(sis->irq, sis);
+		sis->irq = -1;
+	}
+
+	/* Save the internal state away
+	 */
+	for (i = 0; i < 4; i++ ) {
+		memcpy_fromio(sis->suspend_state[i], ioaddr, 4096);
+		ioaddr += 4096;
+	}
+	
+	pci_disable_device(pci);
+	pci_save_state(pci);
+	pci_set_power_state(pci, pci_choose_state(pci, state));
+	return 0;
+}
+
+static int sis_resume(struct pci_dev *pci)
+{
+	struct snd_card *card = pci_get_drvdata(pci);
+	struct sis7019 *sis = card->private_data;
+	void __iomem *ioaddr = sis->ioaddr;
+	int i;
+
+	pci_set_power_state(pci, PCI_D0);
+	pci_restore_state(pci);
+
+	if (pci_enable_device(pci) < 0) {
+		printk(KERN_ERR "sis7019: unable to re-enable device\n");
+		goto error;
+	}
+
+	if (sis_chip_init(sis)) {
+		printk(KERN_ERR "sis7019: unable to re-init controller\n");
+		goto error;
+	}
+
+	if (request_irq(pci->irq, sis_interrupt, IRQF_DISABLED|IRQF_SHARED,
+				card->shortname, sis)) {
+		printk(KERN_ERR "sis7019: unable to regain IRQ %d\n", pci->irq);
+		goto error;
+	}
+
+	/* Restore saved state, then clear out the page we use for the
+	 * silence buffer.
+	 */
+	for (i = 0; i < 4; i++ ) {
+		memcpy_toio(ioaddr, sis->suspend_state[i], 4096);
+		ioaddr += 4096;
+	}
+
+	memset(sis->suspend_state[0], 0, 4096);
+
+	sis->irq = pci->irq;
+	pci_set_master(pci);
+
+	if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT)
+		snd_ac97_resume(sis->ac97[0]);
+	if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT)
+		snd_ac97_resume(sis->ac97[1]);
+	if (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT)
+		snd_ac97_resume(sis->ac97[2]);
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	return 0;
+
+error:
+	snd_card_disconnect(card);
+	return -EIO;
+}
+#endif /* CONFIG_PM */
+
+static int sis_alloc_suspend(struct sis7019 *sis)
+{
+	int i;
+
+	/* We need 16K to store the internal wave engine state during a
+	 * suspend, but we don't need it to be contiguous, so play nice
+	 * with the memory system. We'll also use this area for a silence
+	 * buffer.
+	 */
+	for (i = 0; i < SIS_SUSPEND_PAGES; i++) {
+		sis->suspend_state[i] = kmalloc(4096, GFP_KERNEL);
+		if (!sis->suspend_state[i])
+			return -ENOMEM;
+	}
+	memset(sis->suspend_state[0], 0, 4096);
+
+	return 0;
+}
+
+static int __devinit sis_chip_create(struct snd_card *card,
+					struct pci_dev *pci)
+{
+	struct sis7019 *sis = card->private_data;
+	struct voice *voice;
+	static struct snd_device_ops ops = {
+		.dev_free = sis_dev_free,
+	};
+	int rc;
+	int i;
+
+	rc = pci_enable_device(pci);
+	if (rc)
+		goto error_out;
+
+	if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0) {
+		printk(KERN_ERR "sis7019: architecture does not support "
+					"30-bit PCI busmaster DMA");
+		goto error_out_enabled;
+	}
+
+	memset(sis, 0, sizeof(*sis));
+	mutex_init(&sis->ac97_mutex);
+	spin_lock_init(&sis->voice_lock);
+	sis->card = card;
+	sis->pci = pci;
+	sis->irq = -1;
+	sis->ioport = pci_resource_start(pci, 0);
+
+	rc = pci_request_regions(pci, "SiS 7019");
+	if (rc) {
+		printk(KERN_ERR "sis7019: unable request regions\n");
+		goto error_out_enabled;
+	}
+
+	rc = -EIO;
+	sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000);
+	if (!sis->ioaddr) {
+		printk(KERN_ERR "sis7019: unable to remap MMIO, aborting\n");
+		goto error_out_cleanup;
+	}
+
+	rc = sis_alloc_suspend(sis);
+	if (rc < 0) {
+		printk(KERN_ERR "sis7019: unable to allocate state storage\n");
+		goto error_out_cleanup;
+	}
+
+	rc = sis_chip_init(sis);
+	if (rc)
+		goto error_out_cleanup;
+
+	if (request_irq(pci->irq, sis_interrupt, IRQF_DISABLED|IRQF_SHARED,
+				card->shortname, sis)) {
+		printk(KERN_ERR "unable to allocate irq %d\n", sis->irq);
+		goto error_out_cleanup;
+	}
+
+	sis->irq = pci->irq;
+	pci_set_master(pci);
+
+	for (i = 0; i < 64; i++) {
+		voice = &sis->voices[i];
+		voice->num = i;
+		voice->ctrl_base = SIS_PLAY_DMA_ADDR(sis->ioaddr, i);
+		voice->wave_base = SIS_WAVE_ADDR(sis->ioaddr, i);
+	}
+
+	voice = &sis->capture_voice;
+	voice->flags = VOICE_CAPTURE;
+	voice->num = SIS_CAPTURE_CHAN_AC97_PCM_IN;
+	voice->ctrl_base = SIS_CAPTURE_DMA_ADDR(sis->ioaddr, voice->num);
+
+	rc = snd_device_new(card, SNDRV_DEV_LOWLEVEL, sis, &ops);
+	if (rc)
+		goto error_out_cleanup;
+
+	snd_card_set_dev(card, &pci->dev);
+
+	return 0;
+
+error_out_cleanup:
+	sis_chip_free(sis);
+
+error_out_enabled:
+	pci_disable_device(pci);
+
+error_out:
+	return rc;
+}
+
+static int __devinit snd_sis7019_probe(struct pci_dev *pci,
+					const struct pci_device_id *pci_id)
+{
+	struct snd_card *card;
+	struct sis7019 *sis;
+	static int dev;
+	int rc;
+
+	rc = -ENODEV;
+	if (dev >= SNDRV_CARDS)
+		goto error_out;
+
+	rc = -ENOENT;
+	if (!enable[dev]) {
+		dev++;
+		goto error_out;
+	}
+
+	rc = -ENOMEM;
+	card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(*sis));
+	if (!card)
+		goto error_out;
+
+	strcpy(card->driver, "SiS 7019");
+	strcpy(card->shortname, "SiS 7019");
+	rc = sis_chip_create(card, pci);
+	if (rc)
+		goto card_error_out;
+
+	sis = card->private_data;
+
+	rc = sis_mixer_create(sis);
+	if (rc)
+		goto card_error_out;
+
+	rc = sis_pcm_create(sis);
+	if (rc)
+		goto card_error_out;
+
+	snprintf(card->longname, sizeof(card->longname),
+			"%s Audio Accelerator with %s at 0x%lx, irq %d",
+			card->shortname, snd_ac97_get_short_name(sis->ac97[0]),
+			sis->ioport, sis->irq);
+
+	rc = snd_card_register(card);
+	if (rc)
+		goto card_error_out;
+
+	pci_set_drvdata(pci, card);
+	dev++;
+	return 0;
+
+card_error_out:
+	snd_card_free(card);
+
+error_out:
+	return rc;
+}
+
+static void __devexit snd_sis7019_remove(struct pci_dev *pci)
+{
+	snd_card_free(pci_get_drvdata(pci));
+	pci_set_drvdata(pci, NULL);
+}
+
+static struct pci_driver sis7019_driver = {
+	.name = "SiS7019",
+	.id_table = snd_sis7019_ids,
+	.probe = snd_sis7019_probe,
+	.remove = __devexit_p(snd_sis7019_remove),
+
+#ifdef CONFIG_PM
+	.suspend = sis_suspend,
+	.resume = sis_resume,
+#endif
+};
+
+static int __init sis7019_init(void)
+{
+	return pci_register_driver(&sis7019_driver);
+}
+
+static void __exit sis7019_exit(void)
+{
+	pci_unregister_driver(&sis7019_driver);
+}
+
+module_init(sis7019_init);
+module_exit(sis7019_exit);
diff -r 17223a4918b4 pci/sis7019.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sound/pci/sis7019.h	Wed Nov 28 01:39:33 2007 -0500
@@ -0,0 +1,342 @@
+#ifndef __sis7019_h__
+#define __sis7019_h__
+
+/*
+ *  Definitions for SiS7019 Audio Accelerator
+ *
+ *  Copyright (C) 2004-2007, David Dillow
+ *  Written by David Dillow <dave at thedillows.org>
+ *  Inspired by the Trident 4D-WaveDX/NX driver.
+ *
+ *  All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, version 2.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+
+/* General Control Register */
+#define SIS_GCR		0x00
+#define		SIS_GCR_MACRO_POWER_DOWN		0x80000000
+#define		SIS_GCR_MODEM_ENABLE			0x00010000
+#define		SIS_GCR_SOFTWARE_RESET			0x00000001
+
+/* General Interrupt Enable Register */
+#define SIS_GIER	0x04
+#define		SIS_GIER_MODEM_TIMER_IRQ_ENABLE		0x00100000
+#define		SIS_GIER_MODEM_RX_DMA_IRQ_ENABLE	0x00080000
+#define		SIS_GIER_MODEM_TX_DMA_IRQ_ENABLE	0x00040000
+#define		SIS_GIER_AC97_GPIO1_IRQ_ENABLE		0x00020000
+#define		SIS_GIER_AC97_GPIO0_IRQ_ENABLE		0x00010000
+#define		SIS_GIER_AC97_SAMPLE_TIMER_IRQ_ENABLE	0x00000010
+#define		SIS_GIER_AUDIO_GLOBAL_TIMER_IRQ_ENABLE	0x00000008
+#define		SIS_GIER_AUDIO_RECORD_DMA_IRQ_ENABLE	0x00000004
+#define		SIS_GIER_AUDIO_PLAY_DMA_IRQ_ENABLE	0x00000002
+#define		SIS_GIER_AUDIO_WAVE_ENGINE_IRQ_ENABLE	0x00000001
+
+/* General Interrupt Status Register */
+#define SIS_GISR	0x08
+#define		SIS_GISR_MODEM_TIMER_IRQ_STATUS		0x00100000
+#define		SIS_GISR_MODEM_RX_DMA_IRQ_STATUS	0x00080000
+#define		SIS_GISR_MODEM_TX_DMA_IRQ_STATUS	0x00040000
+#define		SIS_GISR_AC97_GPIO1_IRQ_STATUS		0x00020000
+#define		SIS_GISR_AC97_GPIO0_IRQ_STATUS		0x00010000
+#define		SIS_GISR_AC97_SAMPLE_TIMER_IRQ_STATUS	0x00000010
+#define		SIS_GISR_AUDIO_GLOBAL_TIMER_IRQ_STATUS	0x00000008
+#define		SIS_GISR_AUDIO_RECORD_DMA_IRQ_STATUS	0x00000004
+#define		SIS_GISR_AUDIO_PLAY_DMA_IRQ_STATUS	0x00000002
+#define		SIS_GISR_AUDIO_WAVE_ENGINE_IRQ_STATUS	0x00000001
+
+/* DMA Control Register */
+#define SIS_DMA_CSR	0x10
+#define		SIS_DMA_CSR_PCI_SETTINGS		0x0000001d
+#define		SIS_DMA_CSR_CONCURRENT_ENABLE		0x00000200
+#define		SIS_DMA_CSR_PIPELINE_ENABLE		0x00000100
+#define		SIS_DMA_CSR_RX_DRAIN_ENABLE		0x00000010
+#define		SIS_DMA_CSR_RX_FILL_ENABLE		0x00000008
+#define		SIS_DMA_CSR_TX_DRAIN_ENABLE		0x00000004
+#define		SIS_DMA_CSR_TX_LOWPRI_FILL_ENABLE	0x00000002
+#define		SIS_DMA_CSR_TX_HIPRI_FILL_ENABLE	0x00000001
+
+/* Playback Channel Start Registers */
+#define SIS_PLAY_START_A_REG	0x14
+#define SIS_PLAY_START_B_REG	0x18
+
+/* Playback Channel Stop Registers */
+#define SIS_PLAY_STOP_A_REG	0x1c
+#define SIS_PLAY_STOP_B_REG	0x20
+
+/* Recording Channel Start Register */
+#define SIS_RECORD_START_REG	0x24
+
+/* Recording Channel Stop Register */
+#define SIS_RECORD_STOP_REG	0x28
+
+/* Playback Interrupt Status Registers */
+#define SIS_PISR_A	0x2c
+#define SIS_PISR_B	0x30
+
+/* Recording Interrupt Status Register */
+#define SIS_RISR	0x34
+
+/* AC97 AC-link Playback Source Register */
+#define SIS_AC97_PSR	0x40
+#define		SIS_AC97_PSR_MODEM_HEADSET_SRC_MIXER	0x0f000000
+#define		SIS_AC97_PSR_MODEM_LINE2_SRC_MIXER	0x00f00000
+#define		SIS_AC97_PSR_MODEM_LINE1_SRC_MIXER	0x000f0000
+#define		SIS_AC97_PSR_PCM_LFR_SRC_MIXER		0x0000f000
+#define		SIS_AC97_PSR_PCM_SURROUND_SRC_MIXER	0x00000f00
+#define		SIS_AC97_PSR_PCM_CENTER_SRC_MIXER	0x000000f0
+#define		SIS_AC97_PSR_PCM_LR_SRC_MIXER		0x0000000f
+
+/* AC97 AC-link Command Register */
+#define SIS_AC97_CMD	0x50
+#define 	SIS_AC97_CMD_DATA_MASK			0xffff0000
+#define		SIS_AC97_CMD_REG_MASK			0x0000ff00
+#define		SIS_AC97_CMD_CODEC3_READ		0x0000000d
+#define		SIS_AC97_CMD_CODEC3_WRITE		0x0000000c
+#define		SIS_AC97_CMD_CODEC2_READ		0x0000000b
+#define		SIS_AC97_CMD_CODEC2_WRITE		0x0000000a
+#define		SIS_AC97_CMD_CODEC_READ			0x00000009
+#define		SIS_AC97_CMD_CODEC_WRITE		0x00000008
+#define		SIS_AC97_CMD_CODEC_WARM_RESET		0x00000005
+#define		SIS_AC97_CMD_CODEC_COLD_RESET		0x00000004
+#define		SIS_AC97_CMD_DONE			0x00000000
+
+/* AC97 AC-link Semaphore Register */
+#define SIS_AC97_SEMA	0x54
+#define		SIS_AC97_SEMA_BUSY			0x00000001
+#define		SIS_AC97_SEMA_RELEASE			0x00000000
+
+/* AC97 AC-link Status Register */
+#define SIS_AC97_STATUS	0x58
+#define		SIS_AC97_STATUS_AUDIO_D2_INACT_SECS	0x03f00000
+#define		SIS_AC97_STATUS_MODEM_ALIVE		0x00002000
+#define		SIS_AC97_STATUS_AUDIO_ALIVE		0x00001000
+#define		SIS_AC97_STATUS_CODEC3_READY		0x00000400
+#define		SIS_AC97_STATUS_CODEC2_READY		0x00000200
+#define		SIS_AC97_STATUS_CODEC_READY		0x00000100
+#define		SIS_AC97_STATUS_WARM_RESET		0x00000080
+#define		SIS_AC97_STATUS_COLD_RESET		0x00000040
+#define		SIS_AC97_STATUS_POWERED_DOWN		0x00000020
+#define		SIS_AC97_STATUS_NORMAL			0x00000010
+#define		SIS_AC97_STATUS_READ_EXPIRED		0x00000004
+#define		SIS_AC97_STATUS_SEMAPHORE		0x00000002
+#define		SIS_AC97_STATUS_BUSY			0x00000001
+
+/* AC97 AC-link Audio Configuration Register */
+#define SIS_AC97_CONF	0x5c
+#define		SIS_AC97_CONF_AUDIO_ALIVE		0x80000000
+#define		SIS_AC97_CONF_WARM_RESET_ENABLE		0x40000000
+#define		SIS_AC97_CONF_PR6_ENABLE		0x20000000
+#define		SIS_AC97_CONF_PR5_ENABLE		0x10000000
+#define		SIS_AC97_CONF_PR4_ENABLE		0x08000000
+#define		SIS_AC97_CONF_PR3_ENABLE		0x04000000
+#define		SIS_AC97_CONF_PR2_PR7_ENABLE		0x02000000
+#define		SIS_AC97_CONF_PR0_PR1_ENABLE		0x01000000
+#define		SIS_AC97_CONF_AUTO_PM_ENABLE		0x00800000
+#define		SIS_AC97_CONF_PCM_LFE_ENABLE		0x00080000
+#define		SIS_AC97_CONF_PCM_SURROUND_ENABLE	0x00040000
+#define		SIS_AC97_CONF_PCM_CENTER_ENABLE		0x00020000
+#define		SIS_AC97_CONF_PCM_LR_ENABLE		0x00010000
+#define		SIS_AC97_CONF_PCM_CAP_MIC_ENABLE	0x00002000
+#define		SIS_AC97_CONF_PCM_CAP_LR_ENABLE		0x00001000
+#define		SIS_AC97_CONF_PCM_CAP_MIC_FROM_CODEC3	0x00000200
+#define		SIS_AC97_CONF_PCM_CAP_LR_FROM_CODEC3	0x00000100
+#define		SIS_AC97_CONF_CODEC3_PM_VRM		0x00000080
+#define		SIS_AC97_CONF_CODEC_PM_VRM		0x00000040
+#define		SIS_AC97_CONF_CODEC3_VRA_ENABLE		0x00000020
+#define		SIS_AC97_CONF_CODEC_VRA_ENABLE		0x00000010
+#define		SIS_AC97_CONF_CODEC3_PM_EAC		0x00000008
+#define		SIS_AC97_CONF_CODEC_PM_EAC		0x00000004
+#define		SIS_AC97_CONF_CODEC3_EXISTS		0x00000002
+#define		SIS_AC97_CONF_CODEC_EXISTS		0x00000001
+
+/* Playback Channel Sync Group registers */
+#define SIS_PLAY_SYNC_GROUP_A	0x80
+#define SIS_PLAY_SYNC_GROUP_B	0x84
+#define SIS_PLAY_SYNC_GROUP_C	0x88
+#define SIS_PLAY_SYNC_GROUP_D	0x8c
+#define SIS_MIXER_SYNC_GROUP	0x90
+
+/* Wave Engine Config and Control Register */
+#define SIS_WECCR	0xa0
+#define		SIS_WECCR_TESTMODE_MASK			0x00300000
+#define			SIS_WECCR_TESTMODE_NORMAL		0x00000000
+#define			SIS_WECCR_TESTMODE_BYPASS_NSO_ALPHA	0x00100000
+#define			SIS_WECCR_TESTMODE_BYPASS_FC		0x00200000
+#define			SIS_WECCR_TESTMODE_BYPASS_WOL		0x00300000
+#define		SIS_WECCR_RESONANCE_DELAY_MASK		0x00060000
+#define			SIS_WECCR_RESONANCE_DELAY_NONE		0x00000000
+#define			SIS_WECCR_RESONANCE_DELAY_FC_1F00	0x00020000
+#define			SIS_WECCR_RESONANCE_DELAY_FC_1E00	0x00040000
+#define			SIS_WECCR_RESONANCE_DELAY_FC_1C00	0x00060000
+#define		SIS_WECCR_IGNORE_CHANNEL_PARMS		0x00010000
+#define		SIS_WECCR_COMMAND_CHANNEL_ID_MASK	0x0003ff00
+#define		SIS_WECCR_COMMAND_MASK			0x00000007
+#define			SIS_WECCR_COMMAND_NONE			0x00000000
+#define			SIS_WECCR_COMMAND_DONE			0x00000000
+#define			SIS_WECCR_COMMAND_PAUSE			0x00000001
+#define			SIS_WECCR_COMMAND_TOGGLE_VEG		0x00000002
+#define			SIS_WECCR_COMMAND_TOGGLE_MEG		0x00000003
+#define			SIS_WECCR_COMMAND_TOGGLE_VEG_MEG	0x00000004
+
+/* Wave Engine Volume Control Register */
+#define SIS_WEVCR	0xa4
+#define		SIS_WEVCR_LEFT_MUSIC_ATTENUATION_MASK	0xff000000
+#define		SIS_WEVCR_RIGHT_MUSIC_ATTENUATION_MASK	0x00ff0000
+#define		SIS_WEVCR_LEFT_WAVE_ATTENUATION_MASK	0x0000ff00
+#define		SIS_WEVCR_RIGHT_WAVE_ATTENUATION_MASK	0x000000ff
+
+/* Wave Engine Interrupt Status Registers */
+#define SIS_WEISR_A	0xa8
+#define SIS_WEISR_B	0xac
+
+
+/* Playback DMA parameters (paramter RAM) */
+#define SIS_PLAY_DMA_OFFSET	0x0000
+#define SIS_PLAY_DMA_SIZE	0x10
+#define SIS_PLAY_DMA_ADDR(addr, num) \
+	((num * SIS_PLAY_DMA_SIZE) + (addr) + SIS_PLAY_DMA_OFFSET)
+
+#define SIS_PLAY_DMA_FORMAT_CSO	0x00
+#define		SIS_PLAY_DMA_FORMAT_UNSIGNED	0x00080000
+#define		SIS_PLAY_DMA_FORMAT_8BIT	0x00040000
+#define		SIS_PLAY_DMA_FORMAT_MONO	0x00020000
+#define		SIS_PLAY_DMA_CSO_MASK		0x0000ffff
+#define SIS_PLAY_DMA_BASE	0x04
+#define SIS_PLAY_DMA_CONTROL	0x08
+#define		SIS_PLAY_DMA_STOP_AT_SSO	0x04000000
+#define		SIS_PLAY_DMA_RELEASE		0x02000000
+#define		SIS_PLAY_DMA_LOOP		0x01000000
+#define		SIS_PLAY_DMA_INTR_AT_SSO	0x00080000
+#define		SIS_PLAY_DMA_INTR_AT_ESO	0x00040000
+#define		SIS_PLAY_DMA_INTR_AT_LEO	0x00020000
+#define		SIS_PLAY_DMA_INTR_AT_MLP	0x00010000
+#define		SIS_PLAY_DMA_LEO_MASK		0x0000ffff
+#define SIS_PLAY_DMA_SSO_ESO	0x0c
+#define		SIS_PLAY_DMA_SSO_MASK		0xffff0000
+#define		SIS_PLAY_DMA_ESO_MASK		0x0000ffff
+
+/* Capture DMA parameters (paramter RAM) */
+#define SIS_CAPTURE_DMA_OFFSET	0x0800
+#define SIS_CAPTURE_DMA_SIZE	0x10
+#define SIS_CAPTURE_DMA_ADDR(addr, num) \
+	((num * SIS_CAPTURE_DMA_SIZE) + (addr) + SIS_CAPTURE_DMA_OFFSET)
+
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_0	0
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_1	1
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_2	2
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_3	3
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_4	4
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_5	5
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_6	6
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_7	7
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_8	8
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_9	9
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_10	10
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_11	11
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_12	12
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_13	13
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_14	14
+#define	SIS_CAPTURE_CHAN_MIXER_ROUTE_BACK_15	15
+#define	SIS_CAPTURE_CHAN_AC97_PCM_IN		16
+#define	SIS_CAPTURE_CHAN_AC97_MIC_IN		17
+#define	SIS_CAPTURE_CHAN_AC97_LINE1_IN		18
+#define	SIS_CAPTURE_CHAN_AC97_LINE2_IN		19
+#define	SIS_CAPTURE_CHAN_AC97_HANDSE_IN		20
+
+#define SIS_CAPTURE_DMA_FORMAT_CSO	0x00
+#define		SIS_CAPTURE_DMA_MONO_MODE_MASK	0xc0000000
+#define		SIS_CAPTURE_DMA_MONO_MODE_AVG	0x00000000
+#define		SIS_CAPTURE_DMA_MONO_MODE_LEFT	0x40000000
+#define		SIS_CAPTURE_DMA_MONO_MODE_RIGHT	0x80000000
+#define		SIS_CAPTURE_DMA_FORMAT_UNSIGNED	0x00080000
+#define		SIS_CAPTURE_DMA_FORMAT_8BIT	0x00040000
+#define		SIS_CAPTURE_DMA_FORMAT_MONO	0x00020000
+#define		SIS_CAPTURE_DMA_CSO_MASK		0x0000ffff
+#define SIS_CAPTURE_DMA_BASE		0x04
+#define SIS_CAPTURE_DMA_CONTROL		0x08
+#define		SIS_CAPTURE_DMA_STOP_AT_SSO	0x04000000
+#define		SIS_CAPTURE_DMA_RELEASE		0x02000000
+#define		SIS_CAPTURE_DMA_LOOP		0x01000000
+#define		SIS_CAPTURE_DMA_INTR_AT_LEO	0x00020000
+#define		SIS_CAPTURE_DMA_INTR_AT_MLP	0x00010000
+#define		SIS_CAPTURE_DMA_LEO_MASK		0x0000ffff
+#define SIS_CAPTURE_DMA_RESERVED	0x0c
+
+
+/* Mixer routing list start pointer (parameter RAM) */
+#define SIS_MIXER_START_OFFSET	0x1000
+#define SIS_MIXER_START_SIZE	0x04
+#define SIS_MIXER_START_ADDR(addr, num) \
+	((num * SIS_MIXER_START_SIZE) + (addr) + SIS_MIXER_START_OFFSET)
+
+#define SIS_MIXER_START_MASK	0x0000007f
+
+/* Mixer routing table (parameter RAM) */
+#define SIS_MIXER_OFFSET	0x1400
+#define SIS_MIXER_SIZE		0x04
+#define SIS_MIXER_ADDR(addr, num) \
+	((num * SIS_MIXER_SIZE) + (addr) + SIS_MIXER_OFFSET)
+
+#define SIS_MIXER_RIGHT_ATTENUTATION_MASK	0xff000000
+#define 	SIS_MIXER_RIGHT_NO_ATTEN		0xff000000
+#define SIS_MIXER_LEFT_ATTENUTATION_MASK	0x00ff0000
+#define 	SIS_MIXER_LEFT_NO_ATTEN			0x00ff0000
+#define SIS_MIXER_NEXT_ENTRY_MASK		0x00007f00
+#define 	SIS_MIXER_NEXT_ENTRY_NONE		0x00000000
+#define SIS_MIXER_DEST_MASK			0x0000007f
+#define 	SIS_MIXER_DEST_0			0x00000020
+#define 	SIS_MIXER_DEST_1			0x00000021
+#define 	SIS_MIXER_DEST_2			0x00000022
+#define 	SIS_MIXER_DEST_3			0x00000023
+#define 	SIS_MIXER_DEST_4			0x00000024
+#define 	SIS_MIXER_DEST_5			0x00000025
+#define 	SIS_MIXER_DEST_6			0x00000026
+#define 	SIS_MIXER_DEST_7			0x00000027
+#define 	SIS_MIXER_DEST_8			0x00000028
+#define 	SIS_MIXER_DEST_9			0x00000029
+#define 	SIS_MIXER_DEST_10			0x0000002a
+#define 	SIS_MIXER_DEST_11			0x0000002b
+#define 	SIS_MIXER_DEST_12			0x0000002c
+#define 	SIS_MIXER_DEST_13			0x0000002d
+#define 	SIS_MIXER_DEST_14			0x0000002e
+#define 	SIS_MIXER_DEST_15			0x0000002f
+
+/* Wave Engine Control Parameters (parameter RAM) */
+#define SIS_WAVE_OFFSET		0x2000
+#define SIS_WAVE_SIZE		0x40
+#define SIS_WAVE_ADDR(addr, num) \
+	((num * SIS_WAVE_SIZE) + (addr) + SIS_WAVE_OFFSET)
+
+#define SIS_WAVE_GENERAL		0x00
+#define		SIS_WAVE_GENERAL_WAVE_VOLUME			0x80000000
+#define		SIS_WAVE_GENERAL_MUSIC_VOLUME			0x00000000
+#define		SIS_WAVE_GENERAL_VOLUME_MASK			0x7f000000
+#define SIS_WAVE_GENERAL_ARTICULATION	0x04
+#define		SIS_WAVE_GENERAL_ARTICULATION_DELTA_MASK	0x3fff0000
+#define SIS_WAVE_ARTICULATION		0x08
+#define SIS_WAVE_TIMER			0x0c
+#define SIS_WAVE_GENERATOR		0x10
+#define SIS_WAVE_CHANNEL_CONTROL	0x14
+#define		SIS_WAVE_CHANNEL_CONTROL_FIRST_SAMPLE		0x80000000
+#define		SIS_WAVE_CHANNEL_CONTROL_AMP_ENABLE		0x40000000
+#define		SIS_WAVE_CHANNEL_CONTROL_FILTER_ENABLE		0x20000000
+#define		SIS_WAVE_CHANNEL_CONTROL_INTERPOLATE_ENABLE	0x10000000
+#define SIS_WAVE_LFO_EG_CONTROL		0x18
+#define SIS_WAVE_LFO_EG_CONTROL_2	0x1c
+#define SIS_WAVE_LFO_EG_CONTROL_3	0x20
+#define SIS_WAVE_LFO_EG_CONTROL_4	0x24
+
+#endif /* __sis7019_h__ */

linux-2.6-at76.patch:

--- NEW FILE linux-2.6-at76.patch ---
commit 38ec6fbd236318179e28c71bc1b3dc94166e4be2
Author: Pavel Roskin <proski at gnu.org>
Date:   Mon Feb 4 00:05:19 2008 -0500

    at76_usb: Add ID for Uniden PCW100
    
    Tested and reported by Lior Silberman.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 4ed58b00a2df9772cfa631f53af52c38207d78ac
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:41:25 2007 -0400

    [PATCH] at76_usb: Add ID for at76c503a based CNETUSB611
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 3a39b0c26c19b4f26ab90f8cd170e68da3c8fb91
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:41:18 2007 -0400

    [PATCH] at76_usb: Bump version to 0.17
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 69a965e9dde88c1dec49a0e840020bbdfc2263ad
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:41:12 2007 -0400

    [PATCH] at76_usb: Use ETH_P_802_2 in monitor mode
    
    It's used by most other wireless drivers, including mac80211.
    ETH_P_80211_RAW is obsolete.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit e007ed4c5328f857201d66c8564978bd4150a9a5
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:41:06 2007 -0400

    [PATCH] at76_usb: Be more verbose on startup
    
    Promote some debug messages from at76_dbg() to unconditional KERN_DEBUG.
    Use dev_printk() before the device is registered, as "wlan%d" doesn't
    identify the device uniquely.
    
    Print firmware name and version when it's loaded from file.  Print
    firmware version reported by the card.  Print USB address and network
    device name on the same line to help identifying the device.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 84d9a4914d2f678728b0b9a4c4b360e93b2e2efa
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:59 2007 -0400

    [PATCH] at76_usb: Use dev_printk() where possible
    
    dev_printk() prints the USB device name in addition to the driver name,
    which makes it easier to understand the diagnostics in case of multiple
    devices.
    
    Use &interface->dev, as it's more specific and includes the driver name,
    but use &udev->dev if interface is not available.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 46e958f2e0334bfeb1436d8066e1797804212178
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:53 2007 -0400

    [PATCH] at76_usb: Remove incorrect firmware version check
    
    The major version of the firmware reported by the device can mismatch
    the version of the originally loaded firmware, as it is the case for
    Belkin F5D6050.
    
    Remove this check and assume the firmware to be working as long that the
    external firmware download didn't fail and the firmware version could be
    read at all.
    
    Reported by Corey Pappas <pappascd at gmail.com>
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit cbf56decc3dd24be59bdcd7af14ae6b6fc1d7265
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:47 2007 -0400

    [PATCH] at76_usb: Revert to network device names starting with "wlan"
    
    The change to the default "eth" in 0.16 was unnecessary and broke some
    setups.  Reported by Mark Sansome <msansome at troodos.demon.co.uk>
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 73363e219953a6bcafa0087b415c0ce154a13940
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:40 2007 -0400

    [PATCH] at76_usb: Add ID for Corega Wireless LAN USB-11 mini and mini2
    
    Original patch by Weihua Yao <weihuayao at gmail.com>
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 65e5ad191757d5febb31e97a8a08dbd672d0662d
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:34 2007 -0400

    [PATCH] at76_usb: Avoid dealing with milliseconds when possible, use jiffies
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 8f3811adf092d19f14111166af05f10cb2efa651
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:27 2007 -0400

    [PATCH] at76_usb: Move some parts from at76_usb.h to at76_usb.c
    
    Don't include anything from at76_usb.h.  Keep DRIVER_NAME and
    DRIVER_VERSION together.  Define at76_dbg() after DRIVER_NAME.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 0048a3f2c0de2f6ba969731f51eaaa73b3e168e2
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:21 2007 -0400

    [PATCH] at76_usb: Remove unneeded memset() calls
    
    Use kzalloc for bss table entries.  priv is already zeroized, no need to
    do it again.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 20eab45fc567b85f8aaa131eceb8d53ac14d3fd6
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:15 2007 -0400

    [PATCH] at76_usb: Clean reserved tx area for mgmt frames like it's done for data
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit b96c9fd4b3770d5b731ed3d207644b2ffec80313
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:08 2007 -0400

    [PATCH] at76_usb: Make it clear that management frames are sent at 1Mbps
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 6abdf0d9679fb3cc0b2ed539e24cbba058f33043
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:40:02 2007 -0400

    [PATCH] at76_usb: Eliminate variables used only in at76_dbg()
    
    Make it possible to disable at76_dbg() at the compile time without
    introducing any warnings.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 53c4d65cd1f4455b6d0c6ce605a6853e9108c6ae
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:39:55 2007 -0400

    [PATCH] at76_usb: Use string precision to avoid line termination
    
    In particular, don't extend ESSID to 33 bytes.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 2a000a0fb3a21674791023759e24e1bdc3c197ef
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Sep 30 14:39:49 2007 -0400

    [PATCH] at76_usb: Stop worrying about line termination in ethtool info
    
    The driver's responsibility is not to overwrite the buffer and not to
    leak kernel data.  Line termination is the userspace responsibility.
    
[...6542 lines suppressed...]
+	free_netdev(priv->netdev);	/* priv is in netdev */
+
+	at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__);
+}
+
+static int at76_probe(struct usb_interface *interface,
+		      const struct usb_device_id *id)
+{
+	int ret;
+	struct at76_priv *priv;
+	struct fwentry *fwe;
+	struct usb_device *udev;
+	int op_mode;
+	int need_ext_fw = 0;
+	struct mib_fw_version fwv;
+	int board_type = (int)id->driver_info;
+
+	udev = usb_get_dev(interface_to_usbdev(interface));
+
+	/* Load firmware into kernel memory */
+	fwe = at76_load_firmware(udev, board_type);
+	if (!fwe) {
+		ret = -ENOENT;
+		goto error;
+	}
+
+	op_mode = at76_get_op_mode(udev);
+
+	at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
+
+	/* we get OPMODE_NONE with 2.4.23, SMC2662W-AR ???
+	   we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */
+
+	if (op_mode == OPMODE_HW_CONFIG_MODE) {
+		dev_printk(KERN_ERR, &interface->dev,
+			   "cannot handle a device in HW_CONFIG_MODE\n");
+		ret = -EBUSY;
+		goto error;
+	}
+
+	if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH
+	    && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
+		/* download internal firmware part */
+		dev_printk(KERN_DEBUG, &interface->dev,
+			   "downloading internal firmware\n");
+		ret = at76_load_internal_fw(udev, fwe);
+		if (ret < 0) {
+			dev_printk(KERN_ERR, &interface->dev,
+				   "error %d downloading internal firmware\n",
+				   ret);
+			goto error;
+		}
+		usb_put_dev(udev);
+		return ret;
+	}
+
+	/* Internal firmware already inside the device.  Get firmware
+	 * version to test if external firmware is loaded.
+	 * This works only for newer firmware, e.g. the Intersil 0.90.x
+	 * says "control timeout on ep0in" and subsequent
+	 * at76_get_op_mode() fail too :-( */
+
+	/* if version >= 0.100.x.y or device with built-in flash we can
+	 * query the device for the fw version */
+	if ((fwe->fw_version.major > 0 || fwe->fw_version.minor >= 100)
+	    || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) {
+		ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv));
+		if (ret < 0 || (fwv.major | fwv.minor) == 0)
+			need_ext_fw = 1;
+	} else
+		/* No way to check firmware version, reload to be sure */
+		need_ext_fw = 1;
+
+	if (need_ext_fw) {
+		dev_printk(KERN_DEBUG, &interface->dev,
+			   "downloading external firmware\n");
+
+		ret = at76_load_external_fw(udev, fwe);
+		if (ret)
+			goto error;
+
+		/* Re-check firmware version */
+		ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv));
+		if (ret < 0) {
+			dev_printk(KERN_ERR, &interface->dev,
+				   "error %d getting firmware version\n", ret);
+			goto error;
+		}
+	}
+
+	priv = at76_alloc_new_device(udev);
+	if (!priv) {
+		ret = -ENOMEM;
+		goto error;
+	}
+
+	SET_NETDEV_DEV(priv->netdev, &interface->dev);
+	usb_set_intfdata(interface, priv);
+
+	memcpy(&priv->fw_version, &fwv, sizeof(struct mib_fw_version));
+	priv->board_type = board_type;
+
+	ret = at76_init_new_device(priv, interface);
+	if (ret < 0)
+		at76_delete_device(priv);
+
+	return ret;
+
+error:
+	usb_put_dev(udev);
+	return ret;
+}
+
+static void at76_disconnect(struct usb_interface *interface)
+{
+	struct at76_priv *priv;
+
+	priv = usb_get_intfdata(interface);
+	usb_set_intfdata(interface, NULL);
+
+	/* Disconnect after loading internal firmware */
+	if (!priv)
+		return;
+
+	printk(KERN_INFO "%s: disconnecting\n", priv->netdev->name);
+	at76_delete_device(priv);
+	dev_printk(KERN_INFO, &interface->dev, "disconnected\n");
+}
+
+/* Structure for registering this driver with the USB subsystem */
+static struct usb_driver at76_driver = {
+	.name = DRIVER_NAME,
+	.probe = at76_probe,
+	.disconnect = at76_disconnect,
+	.id_table = dev_table,
+};
+
+static int __init at76_mod_init(void)
+{
+	int result;
+
+	printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION " loading\n");
+
+	mutex_init(&fw_mutex);
+
+	/* register this driver with the USB subsystem */
+	result = usb_register(&at76_driver);
+	if (result < 0)
+		printk(KERN_ERR DRIVER_NAME
+		       ": usb_register failed (status %d)\n", result);
+
+	led_trigger_register_simple("at76_usb-tx", &ledtrig_tx);
+	return result;
+}
+
+static void __exit at76_mod_exit(void)
+{
+	int i;
+
+	printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION " unloading\n");
+	usb_deregister(&at76_driver);
+	for (i = 0; i < ARRAY_SIZE(firmwares); i++) {
+		if (firmwares[i].fw)
+			release_firmware(firmwares[i].fw);
+	}
+	led_trigger_unregister_simple(ledtrig_tx);
+}
+
+module_param_named(debug, at76_debug, int, 0600);
+MODULE_PARM_DESC(debug, "Debugging level");
+
+module_init(at76_mod_init);
+module_exit(at76_mod_exit);
+
+MODULE_AUTHOR("Oliver Kurth <oku at masqmail.cx>");
+MODULE_AUTHOR("Joerg Albert <joerg.albert at gmx.de>");
+MODULE_AUTHOR("Alex <alex at foogod.com>");
+MODULE_AUTHOR("Nick Jones");
+MODULE_AUTHOR("Balint Seeber <n0_5p4m_p13453 at hotmail.com>");
+MODULE_AUTHOR("Pavel Roskin <proski at gnu.org>");
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
diff -up linux-2.6.24.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.24.noarch/drivers/net/wireless/Kconfig
--- linux-2.6.24.noarch/drivers/net/wireless/Kconfig.orig	2008-02-05 22:45:16.000000000 -0500
+++ linux-2.6.24.noarch/drivers/net/wireless/Kconfig	2008-02-05 22:46:17.000000000 -0500
@@ -451,6 +451,14 @@ config PCMCIA_ATMEL
 	  Enable support for PCMCIA cards containing the
 	  Atmel at76c502 and at76c504 chips.
 
+config USB_ATMEL
+	tristate "Atmel at76c503/at76c505/at76c505a USB cards"
+	depends on WLAN_80211 && USB
+	select FW_LOADER
+	---help---
+	  Enable support for USB Wireless devices using Atmel at76c503,
+	  at76c505 or at76c505a chips.
+
 config AIRO_CS
 	tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards"
 	depends on PCMCIA && (BROKEN || !M32R) && WLAN_80211

linux-2.6-ath5k-use-soft-wep.patch:

--- NEW FILE linux-2.6-ath5k-use-soft-wep.patch ---
diff -up linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.c.orig linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.c
--- linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.c.orig	2007-12-01 13:00:52.000000000 -0500
+++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.c	2007-12-01 13:01:04.000000000 -0500
@@ -2830,7 +2830,6 @@ ath5k_set_key(struct ieee80211_hw *hw, e
 
 	switch(key->alg) {
 	case ALG_WEP:
-		break;
 	case ALG_TKIP:
 	case ALG_CCMP:
 		return -EOPNOTSUPP;

linux-2.6-compile-fix-gcc-43.patch:

--- NEW FILE linux-2.6-compile-fix-gcc-43.patch ---
--- linux-2.6.24.noarch.orig/include/linux/time.h
+++ linux-2.6.24.noarch/include/linux/time.h
@@ -169,7 +169,7 @@ extern struct timeval ns_to_timeval(cons
  * @a:		pointer to timespec to be incremented
  * @ns:		unsigned nanoseconds value to be added
  */
-static inline void timespec_add_ns(struct timespec *a, u64 ns)
+static inline void timespec_add_ns(struct timespec *a, volatile u64 ns)
 {
 	ns += a->tv_nsec;
 	while(unlikely(ns >= NSEC_PER_SEC)) {
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -62,6 +62,15 @@ struct kparam_array
 	void *elem;
 };
 
+/* On some platforms relocations to global data cannot go into read-only
+   sections, so 'const' makes no sense and even causes compile failures
+   with some compilers. */
+#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define __moduleparam_const
+#else
+#define __moduleparam_const const
+#endif
+
 /* This is the fundamental function for registering boot/module
    parameters.  perm sets the visibility in sysfs: 000 means it's
    not there, read bits mean it's readable, write bits mean it's
@@ -71,7 +80,7 @@ struct kparam_array
 	static int __param_perm_check_##name __attribute__((unused)) =	\
 	BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2));	\
 	static const char __param_str_##name[] = prefix #name;		\
-	static struct kernel_param const __param_##name			\
+	static struct kernel_param __moduleparam_const __param_##name	\
 	__attribute_used__						\
     __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
 	= { __param_str_##name, perm, set, get, { arg } }
--- linux-2.6.24.noarch.orig/include/linux/module.h
+++ linux-2.6.24.noarch/include/linux/module.h
@@ -30,6 +30,15 @@
 
 #define MODULE_NAME_LEN (64 - sizeof(unsigned long))
 
+/* On some platforms relocations to global data cannot go into read-only
+   sections, so 'const' makes no sense and even causes compile failures
+   with some compilers. */
+#if defined(CONFIG_ALPHA) || defined(CONFIG_IA64) || defined(CONFIG_PPC64)
+#define __ksym_const
+#else
+#define __ksym_const const
+#endif
+
 struct kernel_symbol
 {
 	unsigned long value;
@@ -192,7 +201,7 @@ void *__symbol_get_gpl(const char *symbo
 	static const char __kstrtab_##sym[]			\
 	__attribute__((section("__ksymtab_strings")))		\
 	= MODULE_SYMBOL_PREFIX #sym;                    	\
-	static const struct kernel_symbol __ksymtab_##sym	\
+	static __ksym_const struct kernel_symbol __ksymtab_##sym	\
 	__attribute_used__					\
 	__attribute__((section("__ksymtab" sec), unused))	\
 	= { (unsigned long)&sym, __kstrtab_##sym }

linux-2.6-compile-fixes.patch:

--- NEW FILE linux-2.6-compile-fixes.patch ---
#
# Small compile fixes (For more involved fixes, please use a separate patch).
#
# Please add the errors from gcc before the diffs to save others having
# to do a compile to figure out what your diff is fixing. Thanks.
#


linux-2.6-dcdbas-autoload.patch:

--- NEW FILE linux-2.6-dcdbas-autoload.patch ---
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index 18cdcb3..1636806 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -658,4 +658,5 @@ MODULE_DESCRIPTION(DRIVER_DESCRIPTION " (version " DRIVER_VERSION ")");
 MODULE_VERSION(DRIVER_VERSION);
 MODULE_AUTHOR("Dell Inc.");
 MODULE_LICENSE("GPL");
-
+/* Any System or BIOS claiming to be by Dell */
+MODULE_ALIAS("dmi:*:[bs]vnD[Ee][Ll][Ll]*:*");

linux-2.6-debug-acpi-os-write-port.patch:

--- NEW FILE linux-2.6-debug-acpi-os-write-port.patch ---
---
 drivers/acpi/osl.c |    2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.22.noarch.orig/drivers/acpi/osl.c
+++ linux-2.6.22.noarch/drivers/acpi/osl.c
@@ -419,6 +419,8 @@ acpi_status acpi_os_write_port(acpi_io_a
 		*(u32 *) value = readl(virt_addr);
 		break;
 	default:
+		printk(KERN_ERR PREFIX
+		       "writing %d bits to %p\n", (int)width, virt_addr);
 		BUG();
 	}
 

linux-2.6-default-mmf_dump_elf_headers.patch:

--- NEW FILE linux-2.6-default-mmf_dump_elf_headers.patch ---
--- linux-2.6/include/linux/sched.h
+++ linux-2.6/include/linux/sched.h
@@ -373,7 +373,8 @@ extern int get_dumpable(struct mm_struct
 #define MMF_DUMP_FILTER_MASK \
 	(((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
 #define MMF_DUMP_FILTER_DEFAULT \
-	((1 << MMF_DUMP_ANON_PRIVATE) |	(1 << MMF_DUMP_ANON_SHARED))
+	((1 << MMF_DUMP_ANON_PRIVATE) |	(1 << MMF_DUMP_ANON_SHARED) | \
+	 (1 << MMF_DUMP_ELF_HEADERS))
 
 struct sighand_struct {
 	atomic_t		count;

linux-2.6-drm-add-i915-radeon-mdt.patch:

--- NEW FILE linux-2.6-drm-add-i915-radeon-mdt.patch ---
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 0f9c1f1..1be5795 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -37,6 +37,8 @@
 static struct pci_device_id pciidlist[] = {
 	i915_PCI_IDS
 };
+MODULE_DEVICE_TABLE(pci, pciidlist);
+
 static struct drm_fence_driver i915_fence_driver = {
 	.num_classes = 1,
 	.wrap_diff = (1U << (BREADCRUMB_BITS - 1)),
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index 349ac3d..1be40f5 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -56,6 +56,8 @@ static struct pci_device_id pciidlist[] = {
 	radeon_PCI_IDS
 };
 
+MODULE_DEVICE_TABLE(pci, pciidlist);
+
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |

linux-2.6-drm-mm.patch:

--- NEW FILE linux-2.6-drm-mm.patch ---
diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig
index ba3058d..610d6fd 100644
--- a/drivers/char/drm/Kconfig
+++ b/drivers/char/drm/Kconfig
@@ -38,7 +38,7 @@ config DRM_RADEON
 	  Choose this option if you have an ATI Radeon graphics card.  There
 	  are both PCI and AGP versions.  You don't need to choose this to
 	  run the Radeon in plain VGA mode.
-	  
+
 	  If M is selected, the module will be called radeon.
 
 config DRM_I810
@@ -71,9 +71,9 @@ config DRM_I915
 	  852GM, 855GM 865G or 915G integrated graphics.  If M is selected, the
 	  module will be called i915.  AGP support is required for this driver
 	  to work. This driver is used by the Intel driver in X.org 6.8 and
-	  XFree86 4.4 and above. If unsure, build this and i830 as modules and 
+	  XFree86 4.4 and above. If unsure, build this and i830 as modules and
 	  the X server will load the correct one.
-	
+
 endchoice
 
 config DRM_MGA
@@ -88,7 +88,7 @@ config DRM_SIS
 	tristate "SiS video cards"
 	depends on DRM && AGP
 	help
-	  Choose this option if you have a SiS 630 or compatible video 
+	  Choose this option if you have a SiS 630 or compatible video
           chipset. If M is selected the module will be called sis. AGP
           support is required for this driver to work.
 
@@ -105,4 +105,3 @@ config DRM_SAVAGE
 	help
 	  Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
 	  chipset. If M is selected the module will be called savage.
-
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index 6915a05..85c4f9e 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -6,14 +6,15 @@ drm-objs    :=	drm_auth.o drm_bufs.o drm_context.o drm_dma.o drm_drawable.o \
 		drm_drv.o drm_fops.o drm_ioctl.o drm_irq.o \
 		drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
 		drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
-		drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o
+		drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o drm_object.o \
+		drm_fence.o drm_ttm.o drm_bo.o drm_bo_move.o drm_bo_lock.o
 
 tdfx-objs   := tdfx_drv.o
 r128-objs   := r128_drv.o r128_cce.o r128_state.o r128_irq.o
 mga-objs    := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
 i810-objs   := i810_drv.o i810_dma.o
 i830-objs   := i830_drv.o i830_dma.o i830_irq.o
-i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
+i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o i915_fence.o i915_buffer.o
 radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
 sis-objs    := sis_drv.o sis_mm.o
 savage-objs := savage_drv.o savage_bci.o savage_state.o
@@ -38,5 +39,3 @@ obj-$(CONFIG_DRM_I915)  += i915.o
 obj-$(CONFIG_DRM_SIS)   += sis.o
 obj-$(CONFIG_DRM_SAVAGE)+= savage.o
 obj-$(CONFIG_DRM_VIA)	+=via.o
-
-
diff --git a/drivers/char/drm/README.drm b/drivers/char/drm/README.drm
index af74cd7..b5b3327 100644
--- a/drivers/char/drm/README.drm
+++ b/drivers/char/drm/README.drm
@@ -41,4 +41,3 @@ For specific information about kernel-level support, see:
 
     A Security Analysis of the Direct Rendering Infrastructure
     http://dri.sourceforge.net/doc/security_low_level.html
-
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 82fb3d0..c6686f1 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -190,6 +190,7 @@ enum drm_map_type {
 	_DRM_AGP = 3,		  /**< AGP/GART */
 	_DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
 	_DRM_CONSISTENT = 5,	  /**< Consistent memory for PCI DMA */
+	_DRM_TTM = 6
 };
 
 /**
@@ -202,7 +203,8 @@ enum drm_map_flags {
 	_DRM_KERNEL = 0x08,	     /**< kernel requires access */
 	_DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
 	_DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
-	_DRM_REMOVABLE = 0x40	     /**< Removable mapping */
+	_DRM_REMOVABLE = 0x40,	     /**< Removable mapping */
+	_DRM_DRIVER = 0x80	     /**< Managed by driver */
 };
 
 struct drm_ctx_priv_map {
@@ -470,6 +472,7 @@ struct drm_irq_busid {
 enum drm_vblank_seq_type {
 	_DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */
 	_DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */
+	_DRM_VBLANK_FLIP = 0x8000000,	/**< Scheduled buffer swap should flip */
 	_DRM_VBLANK_NEXTONMISS = 0x10000000,	/**< If missed, wait for next vblank */
 	_DRM_VBLANK_SECONDARY = 0x20000000,	/**< Secondary display controller */
 	_DRM_VBLANK_SIGNAL = 0x40000000	/**< Send signal instead of blocking */
@@ -572,6 +575,271 @@ struct drm_set_version {
 	int drm_dd_minor;
 };
 
+#define DRM_FENCE_FLAG_EMIT                0x00000001
+#define DRM_FENCE_FLAG_SHAREABLE           0x00000002
+#define DRM_FENCE_FLAG_WAIT_LAZY           0x00000004
+#define DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS 0x00000008
+#define DRM_FENCE_FLAG_NO_USER             0x00000010
+
+/* Reserved for driver use */
+#define DRM_FENCE_MASK_DRIVER              0xFF000000
+
+#define DRM_FENCE_TYPE_EXE                 0x00000001
+
+struct drm_fence_arg {
+	unsigned int handle;
+	unsigned int fence_class;
+	unsigned int type;
+	unsigned int flags;
+	unsigned int signaled;
+	unsigned int error;
+	unsigned int sequence;
+	unsigned int pad64;
+	uint64_t expand_pad[2]; /*Future expansion */
+};
+
+/* Buffer permissions, referring to how the GPU uses the buffers.
+ * these translate to fence types used for the buffers.
+ * Typically a texture buffer is read, A destination buffer is write and
+ *  a command (batch-) buffer is exe. Can be or-ed together.
+ */
+
+#define DRM_BO_FLAG_READ        (1ULL << 0)
+#define DRM_BO_FLAG_WRITE       (1ULL << 1)
+#define DRM_BO_FLAG_EXE         (1ULL << 2)
+
+/*
+ * Status flags. Can be read to determine the actual state of a buffer.
+ * Can also be set in the buffer mask before validation.
+ */
+
+/*
+ * Mask: Never evict this buffer. Not even with force.
+ * This type of buffer is only available to root and must be manually
+ * removed before buffer manager shutdown or lock.
+ * Flags: Acknowledge
+ */
+#define DRM_BO_FLAG_NO_EVICT    (1ULL << 4)
+
+/*
+ * Mask: Require that the buffer is placed in mappable memory when validated.
+ * If not set the buffer may or may not be in mappable memory when validated.
+ * Flags: If set, the buffer is in mappable memory.
+ */
+#define DRM_BO_FLAG_MAPPABLE    (1ULL << 5)
+
+/* Mask: The buffer should be shareable with other processes.
+ * Flags: The buffer is shareable with other processes.
+ */
+#define DRM_BO_FLAG_SHAREABLE   (1ULL << 6)
+
+/* Mask: If set, place the buffer in cache-coherent memory if available.
+ *       If clear, never place the buffer in cache coherent memory if validated.
+ * Flags: The buffer is currently in cache-coherent memory.
+ */
+#define DRM_BO_FLAG_CACHED      (1ULL << 7)
+
+/* Mask: Make sure that every time this buffer is validated,
+ *       it ends up on the same location provided that the memory mask
+ *       is the same.
+ *       The buffer will also not be evicted when claiming space for
+ *       other buffers. Basically a pinned buffer but it may be thrown out as
+ *       part of buffer manager shutdown or locking.
+ * Flags: Acknowledge.
+ */
+#define DRM_BO_FLAG_NO_MOVE     (1ULL << 8)
+
+/* Mask: Make sure the buffer is in cached memory when mapped
+ * Flags: Acknowledge.
+ * Buffers allocated with this flag should not be used for suballocators
+ * This type may have issues on CPUs with over-aggressive caching
+ * http://marc.info/?l=linux-kernel&m=102376926732464&w=2
+ */
+#define DRM_BO_FLAG_CACHED_MAPPED    (1ULL << 19)
+
+
+/* Mask: Force DRM_BO_FLAG_CACHED flag strictly also if it is set.
+ * Flags: Acknowledge.
+ */
+#define DRM_BO_FLAG_FORCE_CACHING  (1ULL << 13)
+
+/*
[...12635 lines suppressed...]
+	if (sync->engine >= VIA_NUM_BLIT_ENGINES)
 		return -EINVAL;
 
 	err = via_dmablit_sync(dev, sync->sync_handle, sync->engine);
@@ -796,15 +796,15 @@ via_dma_blit_sync( struct drm_device *dev, void *data, struct drm_file *file_pri
 
 	return err;
 }
-	
+
 
 /*
  * Queue a blit and hand back a handle to be used for sync. This IOCTL may be interrupted by a signal
- * while waiting for a free slot in the blit queue. In that case it returns with -EAGAIN and should 
+ * while waiting for a free slot in the blit queue. In that case it returns with -EAGAIN and should
  * be reissued. See the above IOCTL code.
  */
 
-int 
+int
 via_dma_blit( struct drm_device *dev, void *data, struct drm_file *file_priv )
 {
 	drm_via_dmablit_t *xfer = data;
diff --git a/drivers/char/drm/via_dmablit.h b/drivers/char/drm/via_dmablit.h
index 6f6a513..7408a54 100644
--- a/drivers/char/drm/via_dmablit.h
+++ b/drivers/char/drm/via_dmablit.h
@@ -1,5 +1,5 @@
 /* via_dmablit.h -- PCI DMA BitBlt support for the VIA Unichrome/Pro
- * 
+ *
  * Copyright 2005 Thomas Hellstrom.
  * All Rights Reserved.
  *
@@ -17,12 +17,12 @@
  * 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 NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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 
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
  *
- * Authors: 
+ * Authors:
  *    Thomas Hellstrom.
  *    Register info from Digeo Inc.
  */
@@ -67,7 +67,7 @@ typedef struct _drm_via_blitq {
 	unsigned cur;
 	unsigned num_free;
 	unsigned num_outstanding;
-	unsigned long end;  
+	unsigned long end;
         int aborting;
 	int is_active;
 	drm_via_sg_info_t *blits[VIA_NUM_BLIT_SLOTS];
@@ -77,46 +77,46 @@ typedef struct _drm_via_blitq {
 	struct work_struct wq;
 	struct timer_list poll_timer;
 } drm_via_blitq_t;
-	
 
-/* 
+
+/*
  *  PCI DMA Registers
  *  Channels 2 & 3 don't seem to be implemented in hardware.
  */
- 
-#define VIA_PCI_DMA_MAR0            0xE40   /* Memory Address Register of Channel 0 */ 
-#define VIA_PCI_DMA_DAR0            0xE44   /* Device Address Register of Channel 0 */ 
-#define VIA_PCI_DMA_BCR0            0xE48   /* Byte Count Register of Channel 0 */ 
-#define VIA_PCI_DMA_DPR0            0xE4C   /* Descriptor Pointer Register of Channel 0 */ 
-
-#define VIA_PCI_DMA_MAR1            0xE50   /* Memory Address Register of Channel 1 */ 
-#define VIA_PCI_DMA_DAR1            0xE54   /* Device Address Register of Channel 1 */ 
-#define VIA_PCI_DMA_BCR1            0xE58   /* Byte Count Register of Channel 1 */ 
-#define VIA_PCI_DMA_DPR1            0xE5C   /* Descriptor Pointer Register of Channel 1 */ 
-
-#define VIA_PCI_DMA_MAR2            0xE60   /* Memory Address Register of Channel 2 */ 
-#define VIA_PCI_DMA_DAR2            0xE64   /* Device Address Register of Channel 2 */ 
-#define VIA_PCI_DMA_BCR2            0xE68   /* Byte Count Register of Channel 2 */ 
-#define VIA_PCI_DMA_DPR2            0xE6C   /* Descriptor Pointer Register of Channel 2 */ 
-
-#define VIA_PCI_DMA_MAR3            0xE70   /* Memory Address Register of Channel 3 */ 
-#define VIA_PCI_DMA_DAR3            0xE74   /* Device Address Register of Channel 3 */ 
-#define VIA_PCI_DMA_BCR3            0xE78   /* Byte Count Register of Channel 3 */ 
-#define VIA_PCI_DMA_DPR3            0xE7C   /* Descriptor Pointer Register of Channel 3 */ 
-
-#define VIA_PCI_DMA_MR0             0xE80   /* Mode Register of Channel 0 */ 
-#define VIA_PCI_DMA_MR1             0xE84   /* Mode Register of Channel 1 */ 
-#define VIA_PCI_DMA_MR2             0xE88   /* Mode Register of Channel 2 */ 
-#define VIA_PCI_DMA_MR3             0xE8C   /* Mode Register of Channel 3 */ 
-
-#define VIA_PCI_DMA_CSR0            0xE90   /* Command/Status Register of Channel 0 */ 
-#define VIA_PCI_DMA_CSR1            0xE94   /* Command/Status Register of Channel 1 */ 
-#define VIA_PCI_DMA_CSR2            0xE98   /* Command/Status Register of Channel 2 */ 
-#define VIA_PCI_DMA_CSR3            0xE9C   /* Command/Status Register of Channel 3 */ 
-
-#define VIA_PCI_DMA_PTR             0xEA0   /* Priority Type Register */ 
-
-/* Define for DMA engine */ 
+
+#define VIA_PCI_DMA_MAR0            0xE40   /* Memory Address Register of Channel 0 */
+#define VIA_PCI_DMA_DAR0            0xE44   /* Device Address Register of Channel 0 */
+#define VIA_PCI_DMA_BCR0            0xE48   /* Byte Count Register of Channel 0 */
+#define VIA_PCI_DMA_DPR0            0xE4C   /* Descriptor Pointer Register of Channel 0 */
+
+#define VIA_PCI_DMA_MAR1            0xE50   /* Memory Address Register of Channel 1 */
+#define VIA_PCI_DMA_DAR1            0xE54   /* Device Address Register of Channel 1 */
+#define VIA_PCI_DMA_BCR1            0xE58   /* Byte Count Register of Channel 1 */
+#define VIA_PCI_DMA_DPR1            0xE5C   /* Descriptor Pointer Register of Channel 1 */
+
+#define VIA_PCI_DMA_MAR2            0xE60   /* Memory Address Register of Channel 2 */
+#define VIA_PCI_DMA_DAR2            0xE64   /* Device Address Register of Channel 2 */
+#define VIA_PCI_DMA_BCR2            0xE68   /* Byte Count Register of Channel 2 */
+#define VIA_PCI_DMA_DPR2            0xE6C   /* Descriptor Pointer Register of Channel 2 */
+
+#define VIA_PCI_DMA_MAR3            0xE70   /* Memory Address Register of Channel 3 */
+#define VIA_PCI_DMA_DAR3            0xE74   /* Device Address Register of Channel 3 */
+#define VIA_PCI_DMA_BCR3            0xE78   /* Byte Count Register of Channel 3 */
+#define VIA_PCI_DMA_DPR3            0xE7C   /* Descriptor Pointer Register of Channel 3 */
+
+#define VIA_PCI_DMA_MR0             0xE80   /* Mode Register of Channel 0 */
+#define VIA_PCI_DMA_MR1             0xE84   /* Mode Register of Channel 1 */
+#define VIA_PCI_DMA_MR2             0xE88   /* Mode Register of Channel 2 */
+#define VIA_PCI_DMA_MR3             0xE8C   /* Mode Register of Channel 3 */
+
+#define VIA_PCI_DMA_CSR0            0xE90   /* Command/Status Register of Channel 0 */
+#define VIA_PCI_DMA_CSR1            0xE94   /* Command/Status Register of Channel 1 */
+#define VIA_PCI_DMA_CSR2            0xE98   /* Command/Status Register of Channel 2 */
+#define VIA_PCI_DMA_CSR3            0xE9C   /* Command/Status Register of Channel 3 */
+
+#define VIA_PCI_DMA_PTR             0xEA0   /* Priority Type Register */
+
+/* Define for DMA engine */
 /* DPR */
 #define VIA_DMA_DPR_EC		(1<<1)	/* end of chain */
 #define VIA_DMA_DPR_DDIE	(1<<2)	/* descriptor done interrupt enable */
diff --git a/drivers/char/drm/via_drm.h b/drivers/char/drm/via_drm.h
index 8f53c76..a3b5c10 100644
--- a/drivers/char/drm/via_drm.h
+++ b/drivers/char/drm/via_drm.h
@@ -35,7 +35,7 @@
 #include "via_drmclient.h"
 #endif
 
-#define VIA_NR_SAREA_CLIPRECTS 		8
+#define VIA_NR_SAREA_CLIPRECTS		8
 #define VIA_NR_XVMC_PORTS               10
 #define VIA_NR_XVMC_LOCKS               5
 #define VIA_MAX_CACHELINE_SIZE          64
@@ -259,7 +259,7 @@ typedef struct drm_via_blitsync {
 typedef struct drm_via_dmablit {
 	uint32_t num_lines;
 	uint32_t line_length;
-	
+
 	uint32_t fb_addr;
 	uint32_t fb_stride;
 
diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c
index 2d4957a..80c01cd 100644
--- a/drivers/char/drm/via_drv.c
+++ b/drivers/char/drm/via_drv.c
@@ -71,7 +71,7 @@ static struct drm_driver driver = {
 		 .name = DRIVER_NAME,
 		 .id_table = pciidlist,
 	},
-	
+
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
 	.date = DRIVER_DATE,
diff --git a/drivers/char/drm/via_map.c b/drivers/char/drm/via_map.c
index 1009150..f6dcaaf 100644
--- a/drivers/char/drm/via_map.c
+++ b/drivers/char/drm/via_map.c
@@ -121,4 +121,3 @@ int via_driver_unload(struct drm_device *dev)
 
 	return 0;
 }
-
diff --git a/drivers/char/drm/via_mm.c b/drivers/char/drm/via_mm.c
index 3ffbf86..69f6558 100644
--- a/drivers/char/drm/via_mm.c
+++ b/drivers/char/drm/via_mm.c
@@ -113,7 +113,7 @@ void via_lastclose(struct drm_device *dev)
 	dev_priv->vram_initialized = 0;
 	dev_priv->agp_initialized = 0;
 	mutex_unlock(&dev->struct_mutex);
-}	
+}
 
 int via_mem_alloc(struct drm_device *dev, void *data,
 		  struct drm_file *file_priv)

linux-2.6-drm-radeon-update.patch:

--- NEW FILE linux-2.6-drm-radeon-update.patch ---
diff -up linux-2.6.23.noarch/drivers/char/drm/radeon_drm.h.da linux-2.6.23.noarch/drivers/char/drm/radeon_drm.h
--- linux-2.6.23.noarch/drivers/char/drm/radeon_drm.h.da	2007-10-10 06:31:38.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/radeon_drm.h	2007-12-12 11:43:08.000000000 +1000
@@ -656,6 +656,7 @@ typedef struct drm_radeon_indirect {
 #define RADEON_PARAM_SCRATCH_OFFSET        11
 #define RADEON_PARAM_CARD_TYPE             12
 #define RADEON_PARAM_VBLANK_CRTC           13   /* VBLANK CRTC */
+#define RADEON_PARAM_FB_LOCATION           14   /* FB location */
 
 typedef struct drm_radeon_getparam {
 	int param;
diff -up linux-2.6.23.noarch/drivers/char/drm/radeon_state.c.da linux-2.6.23.noarch/drivers/char/drm/radeon_state.c
--- linux-2.6.23.noarch/drivers/char/drm/radeon_state.c.da	2007-12-12 11:42:44.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/radeon_state.c	2007-12-12 11:43:21.000000000 +1000
@@ -3033,6 +3033,9 @@ static int radeon_cp_getparam(struct drm
 	case RADEON_PARAM_VBLANK_CRTC:
 		value = radeon_vblank_crtc_get(dev);
 		break;
+	case RADEON_PARAM_FB_LOCATION:
+		value = radeon_read_fb_location(dev_priv);
+		break;
 	default:
 		DRM_DEBUG("Invalid parameter %d\n", param->param);
 		return -EINVAL;
diff -up linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c.da linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c
--- linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c.da	2007-12-12 11:42:44.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c	2007-12-12 11:43:08.000000000 +1000
@@ -816,6 +816,21 @@ static const u32 R300_cp_microcode[][2] 
 	{0000000000, 0000000000},
 };
 
+u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
+{
+	return RADEON_READ(RADEON_MC_FB_LOCATION);
+}
+
+static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
+{
+	RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc);
+}
+
+static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc)
+{
+	RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
+}
+
 static int RADEON_READ_PLL(struct drm_device * dev, int addr)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -1134,14 +1149,14 @@ static void radeon_cp_init_ring_buffer(s
 	 * always appended to the fb which is not necessarily the case
 	 */
 	if (!dev_priv->new_memmap)
-		RADEON_WRITE(RADEON_MC_FB_LOCATION,
+		radeon_write_fb_location(dev_priv,
 			     ((dev_priv->gart_vm_start - 1) & 0xffff0000)
 			     | (dev_priv->fb_location >> 16));
 
 #if __OS_HAS_AGP
 	if (dev_priv->flags & RADEON_IS_AGP) {
 		RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base);
-		RADEON_WRITE(RADEON_MC_AGP_LOCATION,
+		radeon_write_agp_location(dev_priv,
 			     (((dev_priv->gart_vm_start - 1 +
 				dev_priv->gart_size) & 0xffff0000) |
 			      (dev_priv->gart_vm_start >> 16)));
@@ -1299,7 +1314,7 @@ static void radeon_set_igpgart(drm_radeo
 
 		RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start);
 		dev_priv->gart_size = 32*1024*1024;
-		RADEON_WRITE(RADEON_MC_AGP_LOCATION,
+		radeon_write_agp_location(dev_priv,
 			     (((dev_priv->gart_vm_start - 1 +
 			       dev_priv->gart_size) & 0xffff0000) |
 			     (dev_priv->gart_vm_start >> 16)));
@@ -1333,7 +1348,7 @@ static void radeon_set_pciegart(drm_rade
 				  dev_priv->gart_vm_start +
 				  dev_priv->gart_size - 1);
 
-		RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0);	/* ?? */
+		radeon_write_agp_location(dev_priv, 0xffffffc0); /* ?? */
 
 		RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_CNTL,
 				  RADEON_PCIE_TX_GART_EN);
@@ -1376,7 +1391,7 @@ static void radeon_set_pcigart(drm_radeo
 
 		/* Turn off AGP aperture -- is this required for PCI GART?
 		 */
-		RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0);	/* ?? */
+		radeon_write_agp_location(dev_priv, 0xffffffc0);
 		RADEON_WRITE(RADEON_AGP_COMMAND, 0);	/* clear AGP_COMMAND */
 	} else {
 		RADEON_WRITE(RADEON_AIC_CNTL,
@@ -1581,10 +1596,9 @@ static int radeon_do_init_cp(struct drm_
 			  dev->agp_buffer_map->handle);
 	}
 
-	dev_priv->fb_location = (RADEON_READ(RADEON_MC_FB_LOCATION)
-				 & 0xffff) << 16;
+	dev_priv->fb_location = (radeon_read_fb_location(dev_priv) & 0xffff) << 16;
 	dev_priv->fb_size =
-		((RADEON_READ(RADEON_MC_FB_LOCATION) & 0xffff0000u) + 0x10000)
+		((radeon_read_fb_location(dev_priv) & 0xffff0000u) + 0x10000)
 		- dev_priv->fb_location;
 
 	dev_priv->front_pitch_offset = (((dev_priv->front_pitch / 64) << 22) |
diff -up linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h.da linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h
--- linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h.da	2007-12-12 11:42:44.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h	2007-12-12 11:43:08.000000000 +1000
@@ -336,6 +336,7 @@ extern int radeon_cp_resume(struct drm_d
 extern int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv);
 extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv);
 extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv);
+extern u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv);
 
 extern void radeon_freelist_reset(struct drm_device * dev);
 extern struct drm_buf *radeon_freelist_get(struct drm_device * dev);

linux-2.6-e1000-corrupt-eeprom-checksum.patch:

--- NEW FILE linux-2.6-e1000-corrupt-eeprom-checksum.patch ---
diff -up linux-2.6.23.noarch/drivers/net/e1000/e1000_main.c.jx vanilla/drivers/net/e1000/e1000_main.c
--- linux-2.6.23.noarch/drivers/net/e1000/e1000_main.c.jx	2007-10-09 16:31:38.000000000 -0400
+++ linux-2.6.23.noarch/drivers/net/e1000/e1000_main.c	2007-10-22 16:33:01.000000000 -0400
@@ -255,6 +255,10 @@ static int debug = NETIF_MSG_DRV | NETIF
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
 
+static int eeprom_bad_csum_allow = 0;
+module_param(eeprom_bad_csum_allow, int, 0);
+MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums");
+
 /**
  * e1000_init_module - Driver Registration Routine
  *
@@ -1012,7 +1016,8 @@ e1000_probe(struct pci_dev *pdev,
 
 	if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) {
 		DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
-		goto err_eeprom;
+		if (!eeprom_bad_csum_allow)
+			goto err_eeprom;
 	}
 
 	/* copy the MAC address out of the EEPROM */
@@ -1024,7 +1029,8 @@ e1000_probe(struct pci_dev *pdev,
 
 	if (!is_valid_ether_addr(netdev->perm_addr)) {
 		DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
-		goto err_eeprom;
+		if (!eeprom_bad_csum_allow)
+			goto err_eeprom;
 	}
 
 	e1000_get_bus_info(&adapter->hw);

linux-2.6-epoll-lockdep-annotation.patch:

--- NEW FILE linux-2.6-epoll-lockdep-annotation.patch ---
Index: linux-2.6/fs/eventpoll.c
===================================================================
--- linux-2.6.orig/fs/eventpoll.c
+++ linux-2.6/fs/eventpoll.c
@@ -353,7 +353,7 @@ static void ep_poll_safewake(struct poll
 	spin_unlock_irqrestore(&psw->lock, flags);
 
 	/* Do really wake up now */
-	wake_up(wq);
+	wake_up_nested(wq, 1 + wake_nests);
 
 	/* Remove the current task from the list */
 	spin_lock_irqsave(&psw->lock, flags);
Index: linux-2.6/include/linux/wait.h
===================================================================
--- linux-2.6.orig/include/linux/wait.h
+++ linux-2.6/include/linux/wait.h
@@ -161,6 +161,22 @@ wait_queue_head_t *FASTCALL(bit_waitqueu
 #define	wake_up_locked(x)		__wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
 #define wake_up_interruptible_sync(x)   __wake_up_sync((x),TASK_INTERRUPTIBLE, 1)
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+/*
+ * macro to avoid include hell
+ */
+#define wake_up_nested(x, s)						\
+do {									\
+	unsigned long flags;						\
+									\
+	spin_lock_irqsave_nested(&(x)->lock, flags, (s));		\
+	wake_up_locked(x); 						\
+	spin_unlock_irqrestore(&(x)->lock, flags);			\
+} while (0)
+#else
+#define wake_up_nested(x, s)		wake_up(x)
+#endif
+
 #define __wait_event(wq, condition) 					\
 do {									\
 	DEFINE_WAIT(__wait);						\


linux-2.6-ext4-linus-git.patch:

--- NEW FILE linux-2.6-ext4-linus-git.patch ---
ext4/jbd2/support changes from 2.6.24-git13

--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -86,9 +86,21 @@ Alex is working on a new set of patches right now.
 When mounting an ext4 filesystem, the following option are accepted:
 (*) == default
 
-extents			ext4 will use extents to address file data.  The
+extents		(*)	ext4 will use extents to address file data.  The
 			file system will no longer be mountable by ext3.
 
+noextents		ext4 will not use extents for newly created files
+
+journal_checksum	Enable checksumming of the journal transactions.
+			This will allow the recovery code in e2fsck and the
+			kernel to detect corruption in the kernel.  It is a
+			compatible change and will be ignored by older kernels.
+
+journal_async_commit	Commit block can be written to disk without waiting
+			for descriptor blocks. If enabled older kernels cannot
+			mount the device. This will enable 'journal_checksum'
+			internally.
+
 journal=update		Update the ext4 file system's journal to the current
 			format.
 
@@ -196,6 +208,12 @@ nobh			(a) cache disk block mapping information
 			"nobh" option tries to avoid associating buffer
 			heads (supported only for "writeback" mode).
 
+mballoc		(*)	Use the multiple block allocator for block allocation
+nomballoc		disabled multiple block allocator for block allocation.
+stripe=n		Number of filesystem blocks that mballoc will try
+			to use for allocation size and alignment. For RAID5/6
+			systems this should be the number of data
+			disks *  RAID chunk size in file system blocks.
 
 Data Mode
 ---------
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -857,6 +857,45 @@ CPUs.
 The   "procs_blocked" line gives  the  number of  processes currently blocked,
 waiting for I/O to complete.
 
+1.9 Ext4 file system parameters
+------------------------------
+Ext4 file system have one directory per partition under /proc/fs/ext4/
+# ls /proc/fs/ext4/hdc/
+group_prealloc  max_to_scan  mb_groups  mb_history  min_to_scan  order2_req
+stats  stream_req
+
+mb_groups:
+This file gives the details of mutiblock allocator buddy cache of free blocks
+
+mb_history:
+Multiblock allocation history.
+
+stats:
+This file indicate whether the multiblock allocator should start collecting
+statistics. The statistics are shown during unmount
+
+group_prealloc:
+The multiblock allocator normalize the block allocation request to
+group_prealloc filesystem blocks if we don't have strip value set.
+The stripe value can be specified at mount time or during mke2fs.
+
+max_to_scan:
+How long multiblock allocator can look for a best extent (in found extents)
+
+min_to_scan:
+How long multiblock allocator  must look for a best extent
+
+order2_req:
+Multiblock allocator use  2^N search using buddies only for requests greater
+than or equal to order2_req. The request size is specfied in file system
+blocks. A value of 2 indicate only if the requests are greater than or equal
+to 4 blocks.
+
+stream_req:
+Files smaller than stream_req are served by the stream allocator, whose
+purpose is to pack requests as close each to other as possible to
+produce smooth I/O traffic. Avalue of 16 indicate that file smaller than 16
+filesystem block size will use group based preallocation.
 
 ------------------------------------------------------------------------------
 Summary
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -546,11 +546,11 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
 	dentry->d_op = &afs_fs_dentry_operations;
 
 	d_add(dentry, inode);
-	_leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%lu }",
+	_leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%llu }",
 	       fid.vnode,
 	       fid.unique,
 	       dentry->d_inode->i_ino,
-	       dentry->d_inode->i_version);
+	       (unsigned long long)dentry->d_inode->i_version);
 
 	return NULL;
 }
@@ -630,9 +630,10 @@ static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
 		 * been deleted and replaced, and the original vnode ID has
 		 * been reused */
 		if (fid.unique != vnode->fid.unique) {
-			_debug("%s: file deleted (uq %u -> %u I:%lu)",
+			_debug("%s: file deleted (uq %u -> %u I:%llu)",
 			       dentry->d_name.name, fid.unique,
-			       vnode->fid.unique, dentry->d_inode->i_version);
+			       vnode->fid.unique,
+			       (unsigned long long)dentry->d_inode->i_version);
 			spin_lock(&vnode->lock);
 			set_bit(AFS_VNODE_DELETED, &vnode->flags);
 			spin_unlock(&vnode->lock);
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3213,6 +3213,50 @@ static int buffer_cpu_notify(struct notifier_block *self,
 	return NOTIFY_OK;
 }
 
+/**
+ * bh_uptodate_or_lock: Test whether the buffer is uptodate
+ * @bh: struct buffer_head
+ *
+ * Return true if the buffer is up-to-date and false,
+ * with the buffer locked, if not.
+ */
+int bh_uptodate_or_lock(struct buffer_head *bh)
+{
+	if (!buffer_uptodate(bh)) {
+		lock_buffer(bh);
+		if (!buffer_uptodate(bh))
+			return 0;
+		unlock_buffer(bh);
+	}
+	return 1;
+}
+EXPORT_SYMBOL(bh_uptodate_or_lock);
+
+/**
+ * bh_submit_read: Submit a locked buffer for reading
+ * @bh: struct buffer_head
+ *
+ * Returns zero on success and -EIO on error.
+ */
+int bh_submit_read(struct buffer_head *bh)
+{
+	BUG_ON(!buffer_locked(bh));
+
+	if (buffer_uptodate(bh)) {
+		unlock_buffer(bh);
+		return 0;
+	}
+
+	get_bh(bh);
+	bh->b_end_io = end_buffer_read_sync;
+	submit_bh(READ, bh);
+	wait_on_buffer(bh);
+	if (buffer_uptodate(bh))
+		return 0;
+	return -EIO;
+}
+EXPORT_SYMBOL(bh_submit_read);
+
 void __init buffer_init(void)
 {
 	int nrpages;
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -29,7 +29,7 @@
  * Calculate the block group number and offset, given a block number
  */
 void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
-		unsigned long *blockgrpp, ext4_grpblk_t *offsetp)
+		ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp)
 {
 	struct ext4_super_block *es = EXT4_SB(sb)->s_es;
 	ext4_grpblk_t offset;
@@ -46,7 +46,7 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
 /* Initializes an uninitialized block bitmap if given, and returns the
  * number of blocks free in the group. */
 unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
-				int block_group, struct ext4_group_desc *gdp)
+		 ext4_group_t block_group, struct ext4_group_desc *gdp)
 {
 	unsigned long start;
 	int bit, bit_max;
@@ -60,7 +60,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
 		 * essentially implementing a per-group read-only flag. */
 		if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
 			ext4_error(sb, __FUNCTION__,
-				   "Checksum bad for group %u\n", block_group);
+				  "Checksum bad for group %lu\n", block_group);
 			gdp->bg_free_blocks_count = 0;
 			gdp->bg_free_inodes_count = 0;
 			gdp->bg_itable_unused = 0;
[...11186 lines suppressed...]
 #if defined(CONFIG_BUFFER_DEBUG)
 void buffer_assertion_failure(struct buffer_head *bh);
@@ -282,10 +298,6 @@ void buffer_assertion_failure(struct buffer_head *bh);
 #define J_ASSERT_JH(jh, expr)	J_ASSERT(expr)
 #endif
 
-#else
-#define J_ASSERT(assert)	do { } while (0)
-#endif		/* JBD2_ASSERTIONS */
-
 #if defined(JBD2_PARANOID_IOFAIL)
 #define J_EXPECT(expr, why...)		J_ASSERT(expr)
 #define J_EXPECT_BH(bh, expr, why...)	J_ASSERT_BH(bh, expr)
@@ -406,9 +418,23 @@ struct handle_s
 	unsigned int	h_sync:		1;	/* sync-on-close */
 	unsigned int	h_jdata:	1;	/* force data journaling */
 	unsigned int	h_aborted:	1;	/* fatal error on handle */
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+	struct lockdep_map	h_lockdep_map;
+#endif
 };
 
 
+/*
+ * Some stats for checkpoint phase
+ */
+struct transaction_chp_stats_s {
+	unsigned long		cs_chp_time;
+	unsigned long		cs_forced_to_close;
+	unsigned long		cs_written;
+	unsigned long		cs_dropped;
+};
+
 /* The transaction_t type is the guts of the journaling mechanism.  It
  * tracks a compound transaction through its various states:
  *
@@ -456,6 +482,8 @@ struct transaction_s
 	/*
 	 * Transaction's current state
 	 * [no locking - only kjournald2 alters this]
+	 * [j_list_lock] guards transition of a transaction into T_FINISHED
+	 * state and subsequent call of __jbd2_journal_drop_transaction()
 	 * FIXME: needs barriers
 	 * KLUDGE: [use j_state_lock]
 	 */
@@ -544,6 +572,21 @@ struct transaction_s
 	spinlock_t		t_handle_lock;
 
 	/*
+	 * Longest time some handle had to wait for running transaction
+	 */
+	unsigned long		t_max_wait;
+
+	/*
+	 * When transaction started
+	 */
+	unsigned long		t_start;
+
+	/*
+	 * Checkpointing stats [j_checkpoint_sem]
+	 */
+	struct transaction_chp_stats_s t_chp_stats;
+
+	/*
 	 * Number of outstanding updates running on this transaction
 	 * [t_handle_lock]
 	 */
@@ -574,6 +617,39 @@ struct transaction_s
 
 };
 
+struct transaction_run_stats_s {
+	unsigned long		rs_wait;
+	unsigned long		rs_running;
+	unsigned long		rs_locked;
+	unsigned long		rs_flushing;
+	unsigned long		rs_logging;
+
+	unsigned long		rs_handle_count;
+	unsigned long		rs_blocks;
+	unsigned long		rs_blocks_logged;
+};
+
+struct transaction_stats_s {
+	int 			ts_type;
+	unsigned long		ts_tid;
+	union {
+		struct transaction_run_stats_s run;
+		struct transaction_chp_stats_s chp;
+	} u;
+};
+
+#define JBD2_STATS_RUN		1
+#define JBD2_STATS_CHECKPOINT	2
+
+static inline unsigned long
+jbd2_time_diff(unsigned long start, unsigned long end)
+{
+	if (end >= start)
+		return end - start;
+
+	return end + (MAX_JIFFY_OFFSET - start);
+}
+
 /**
  * struct journal_s - The journal_s type is the concrete type associated with
  *     journal_t.
@@ -635,6 +711,12 @@ struct transaction_s
  * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
  *	number that will fit in j_blocksize
  * @j_last_sync_writer: most recent pid which did a synchronous write
+ * @j_history: Buffer storing the transactions statistics history
+ * @j_history_max: Maximum number of transactions in the statistics history
+ * @j_history_cur: Current number of transactions in the statistics history
+ * @j_history_lock: Protect the transactions statistics history
+ * @j_proc_entry: procfs entry for the jbd statistics directory
+ * @j_stats: Overall statistics
  * @j_private: An opaque pointer to fs-private information.
  */
 
@@ -827,6 +909,19 @@ struct journal_s
 	pid_t			j_last_sync_writer;
 
 	/*
+	 * Journal statistics
+	 */
+	struct transaction_stats_s *j_history;
+	int			j_history_max;
+	int			j_history_cur;
+	/*
+	 * Protect the transactions statistics history
+	 */
+	spinlock_t		j_history_lock;
+	struct proc_dir_entry	*j_proc_entry;
+	struct transaction_stats_s j_stats;
+
+	/*
 	 * An opaque pointer to fs-private information.  ext3 puts its
 	 * superblock pointer here
 	 */
@@ -932,6 +1027,8 @@ extern int	   jbd2_journal_check_available_features
 		   (journal_t *, unsigned long, unsigned long, unsigned long);
 extern int	   jbd2_journal_set_features
 		   (journal_t *, unsigned long, unsigned long, unsigned long);
+extern void	   jbd2_journal_clear_features
+		   (journal_t *, unsigned long, unsigned long, unsigned long);
 extern int	   jbd2_journal_create     (journal_t *);
 extern int	   jbd2_journal_load       (journal_t *journal);
 extern void	   jbd2_journal_destroy    (journal_t *);
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -178,4 +178,47 @@ found_middle_swap:
 
 EXPORT_SYMBOL(generic_find_next_zero_le_bit);
 
+unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned
+		long size, unsigned long offset)
+{
+	const unsigned long *p = addr + BITOP_WORD(offset);
+	unsigned long result = offset & ~(BITS_PER_LONG - 1);
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= (BITS_PER_LONG - 1UL);
+	if (offset) {
+		tmp = ext2_swabp(p++);
+		tmp &= (~0UL << offset);
+		if (size < BITS_PER_LONG)
+			goto found_first;
+		if (tmp)
+			goto found_middle;
+		size -= BITS_PER_LONG;
+		result += BITS_PER_LONG;
+	}
+
+	while (size & ~(BITS_PER_LONG - 1)) {
+		tmp = *(p++);
+		if (tmp)
+			goto found_middle_swap;
+		result += BITS_PER_LONG;
+		size -= BITS_PER_LONG;
+	}
+	if (!size)
+		return result;
+	tmp = ext2_swabp(p);
+found_first:
+	tmp &= (~0UL >> (BITS_PER_LONG - size));
+	if (tmp == 0UL)		/* Are any bits set? */
+		return result + size; /* Nope. */
+found_middle:
+	return result + __ffs(tmp);
+
+found_middle_swap:
+	return result + __ffs(ext2_swab(tmp));
+}
+EXPORT_SYMBOL(generic_find_next_le_bit);
 #endif /* __BIG_ENDIAN */

linux-2.6-ext4-stable-queue.patch:

--- NEW FILE linux-2.6-ext4-stable-queue.patch ---
Patches from ext4 stable patch queue not yet in git.
As of 04 Feb 2008:

jbd2_journal_chksum_null_pointer_fix.patch
jbd2_fix_ref_count_on_bh.patch
jbd2_use_incompat_macro_to_check_JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT.patch
ext4_do_not_set_EXTENTS_FL_for_fast_symlinks.patch
test-filesys-flag.patch
allow_in-inode_eas_on_ext4_root_inode

===================================

JBD2: Fix null pointer deference in jbd2 journal checksum code
From: Mingming Cao <cmm at u.ibm.com>
The buffer head pointer passed to journal_wait_on_commit_record()
could be NULL if the previous journal_submit_commit_record() failed
or journal has already aborted.

We need to check the error returns from journal_submit_commit_record()
and avoid calling journal_wait_on_commit_record() in the failure case.

Signed-off-by: Mingming Cao <cmm at us.ibm.com>
---
 fs/jbd2/commit.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.24/fs/jbd2/commit.c
===================================================================
--- linux-2.6.24.orig/fs/jbd2/commit.c	2008-02-04 11:02:42.000000000 -0800
+++ linux-2.6.24/fs/jbd2/commit.c	2008-02-04 11:18:43.000000000 -0800
@@ -865,7 +865,8 @@ wait_for_iobuf:
 		if (err)
 			__jbd2_journal_abort_hard(journal);
 	}
-	err = journal_wait_on_commit_record(cbh);
+	if (!err && !is_journal_aborted(journal))
+		err = journal_wait_on_commit_record(cbh);
 
 	if (err)
 		jbd2_journal_abort(journal, err);

JBD2: Fix reference counting on buffer head.
From: "Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com>

With journal checksum patch we added asyn commit of journal commit headers.
During the conversion we missed to take a reference on buffer head. Before
the change sync_dirty_buffer did the get_bh(). The associative put_bh is
done by journal_wait_on_commit_record()

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm at us.ibm.com>
---
 fs/jbd2/commit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.24/fs/jbd2/commit.c
===================================================================
--- linux-2.6.24.orig/fs/jbd2/commit.c	2008-02-04 11:02:43.000000000 -0800
+++ linux-2.6.24/fs/jbd2/commit.c	2008-02-04 11:18:39.000000000 -0800
@@ -136,7 +136,7 @@ static int journal_submit_commit_record(
 
 	JBUFFER_TRACE(descriptor, "submit commit block");
 	lock_buffer(bh);
-
+	get_bh(bh);
 	set_buffer_dirty(bh);
 	set_buffer_uptodate(bh);
 	bh->b_end_io = journal_end_buffer_io_sync;

JBD2: Use the incompat macro for testing the incompat feature.
From: "Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com>

JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT need to be checked with JBD2_HAS_INCOMPAT_FEATURE

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
Signed-off-by: Mingming Cao <cmm at us.ibm.com>
---
 fs/jbd2/commit.c   |    2 +-
 fs/jbd2/recovery.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.24/fs/jbd2/commit.c
===================================================================
--- linux-2.6.24.orig/fs/jbd2/commit.c	2008-02-04 11:10:50.000000000 -0800
+++ linux-2.6.24/fs/jbd2/commit.c	2008-02-04 11:12:35.000000000 -0800
@@ -142,7 +142,7 @@ static int journal_submit_commit_record(
 	bh->b_end_io = journal_end_buffer_io_sync;
 
 	if (journal->j_flags & JBD2_BARRIER &&
-		!JBD2_HAS_COMPAT_FEATURE(journal,
+		!JBD2_HAS_INCOMPAT_FEATURE(journal,
 					 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
 		set_buffer_ordered(bh);
 		barrier_done = 1;
Index: linux-2.6.24/fs/jbd2/recovery.c
===================================================================
--- linux-2.6.24.orig/fs/jbd2/recovery.c	2008-02-04 10:59:16.000000000 -0800
+++ linux-2.6.24/fs/jbd2/recovery.c	2008-02-04 11:18:25.000000000 -0800
@@ -641,7 +641,7 @@ static int do_one_pass(journal_t *journa
 				if (chksum_err) {
 					info->end_transaction = next_commit_ID;
 
-					if (!JBD2_HAS_COMPAT_FEATURE(journal,
+					if (!JBD2_HAS_INCOMPAT_FEATURE(journal,
 					   JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){
 						printk(KERN_ERR
 						       "JBD: Transaction %u "

ext4: Don't set EXTENTS_FL flag for fast symlinks
From: Valerie Clement <valerie.clement at bull.net>

Don't set EXTENTS_FL flag for fast symlinks

From: Valerie Clement <valerie.clement at bull.net>

For fast symbolic links, the file content is stored in the i_block[]
array, which is not compatible with the new file extents format.
e2fsck reports error on such files because EXTENTS_FL is set.
Don't set the EXTENTS_FL flag when creating fast symlinks.

In the case of file migration, skip fast symbolic links.

Signed-off-by: Valerie Clement <valerie.clement at bull.net>
Signed-off-by: Mingming Cao <cmm at us.ibm.com>

---

 fs/ext4/migrate.c |    6 ++++++
 fs/ext4/namei.c   |    1 +
 2 files changed, 7 insertions(+)

Index: linux-2.6.24/fs/ext4/migrate.c
===================================================================
--- linux-2.6.24.orig/fs/ext4/migrate.c	2008-02-04 10:59:16.000000000 -0800
+++ linux-2.6.24/fs/ext4/migrate.c	2008-02-04 11:14:47.000000000 -0800
@@ -414,6 +414,12 @@ int ext4_ext_migrate(struct inode *inode
 	if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
 		return -EINVAL;
 
+	if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
+		/*
+		 * don't migrate fast symlink
+		 */
+		return retval;
+
 	down_write(&EXT4_I(inode)->i_data_sem);
 	handle = ext4_journal_start(inode,
 					EXT4_DATA_TRANS_BLOCKS(inode->i_sb) +
Index: linux-2.6.24/fs/ext4/namei.c
===================================================================
--- linux-2.6.24.orig/fs/ext4/namei.c	2008-02-04 10:59:16.000000000 -0800
+++ linux-2.6.24/fs/ext4/namei.c	2008-02-04 11:14:47.000000000 -0800
@@ -2234,6 +2234,7 @@ retry:
 		inode->i_op = &ext4_fast_symlink_inode_operations;
 		memcpy((char*)&EXT4_I(inode)->i_data,symname,l);
 		inode->i_size = l-1;
+		EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL;
 	}
 	EXT4_I(inode)->i_disksize = inode->i_size;
 	err = ext4_add_nondir(handle, dentry, inode);

ext4: Add new "development flag" to the ext4 filesystem
From: Theodore Tso <tytso at MIT.EDU>
This flag is simply a generic "this is a
crash/burn test filesystem" marker.  If it is set, then filesystem
code which is "in development" will be allowed to mount the
filesystem.  Filesystem code which is not considered ready for
prime-time will check for this flag, and if it is not set, it will
refuse to touch the filesystem.

As we start rolling ext4 out to distro's like Fedora, et. al, this
makes it less likely that a user might accidentally start using ext4
on a production filesystem; a bad thing, since that will essentially
make it be unfsckable until e2fsprogs catches up.

Signed-off-by: Theodore Tso <tytso at MIT.EDU>
Signed-off-by: Mingming Cao<cmm at us.ibm.com>

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 055a0cd..8a405ae 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1926,6 +1926,17 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
 		printk(KERN_WARNING
 		       "EXT4-fs warning: feature flags set on rev 0 fs, "
 		       "running e2fsck is recommended\n");
+
+	/*
+	 * Since ext4 is still considered development code, we require
+	 * that the TEST_FILESYS flag in s->flags be set.
+	 */
+	if (!(le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS)) {
+		printk(KERN_WARNING "EXT4-fs: %s: not marked "
+		       "OK to use with test code.\n", sb->s_id);
+		goto failed_mount;
+	}
+
 	/*
 	 * Check feature flags regardless of the revision level, since we
 	 * previously didn't change the revision level when setting the flags,
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 1852313..285fa6c 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -490,6 +490,13 @@ do {									       \
 #define	EXT4_ORPHAN_FS			0x0004	/* Orphans being recovered */
 
 /*
+ * Misc. filesystem flags
+ */
+#define EXT2_FLAGS_SIGNED_HASH		0x0001  /* Signed dirhash in use */
+#define EXT2_FLAGS_UNSIGNED_HASH	0x0002  /* Unsigned dirhash in use */
+#define EXT2_FLAGS_TEST_FILESYS		0x0004	/* OK for use on development code */
+
+/*
  * Mount flags
  */
 #define EXT4_MOUNT_CHECK		0x00001	/* Do mount-time checks */
 
allow in-inode EAs on ext4 root inode

From: Eric Sandeen <sandeen at redhat.com>

The ext3 root inode was treated specially with respect
to in-inode extended attributes, for reasons detailed
in the removed comment below.  The first mkfs-created
inodes would not get extra_i_size or the EXT3_STATE_XATTR
flag set in ext3_read_inode, which disallowed reading or
setting in-inode EAs on the root.

However, in ext4, ext4_mark_inode_dirty calls
ext4_expand_extra_isize for all inodes; once this is done
EAs may be placed in the root ext4 inode body.

But for reasons above, it won't be found after a reboot.

testcase:

setfattr -n user.name -v value mntpt/
setfattr -n user.name2 -v value2 mntpt/
umount mntpt/; remount mntpt/
getfattr -d mntpt/

name2/value2 has gone missing; debugfs shows it in the
inode body, but it is not found there by getattr.

The following fixes it up; newer mkfs appears to properly
zero the inodes, so this workaround isn't needed for ext4.

Signed-off-by: Eric Sandeen <sandeen at redhat.com>
Signed-off-by: Theodore Ts'o <tytso at mit.edu>

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e7e10df..4fed498 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2908,13 +2908,7 @@ void ext4_read_inode(struct inode * inode)
 		ei->i_data[block] = raw_inode->i_block[block];
 	INIT_LIST_HEAD(&ei->i_orphan);
 
-	if (inode->i_ino >= EXT4_FIRST_INO(inode->i_sb) + 1 &&
-	    EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
-		/*
-		 * When mke2fs creates big inodes it does not zero out
-		 * the unused bytes above EXT4_GOOD_OLD_INODE_SIZE,
-		 * so ignore those first few inodes.
-		 */
+	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
 		ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
 		if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
 		    EXT4_INODE_SIZE(inode->i_sb)) {



linux-2.6-firewire-git-pending.patch:

--- NEW FILE linux-2.6-firewire-git-pending.patch ---
#
# Patches under review and/or pending inclusion in the linux1394-git
# tree, which we think we're going to want...
#

If a device is being unplugged while fw-sbp2 had a login or reconnect on
schedule, it would take about half a minute to shut the fw_unit down:

Jan 27 18:34:54 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries)
<unplug>
Jan 27 18:34:59 stein firewire_sbp2: sbp2_scsi_abort
Jan 27 18:34:59 stein scsi 25:0:0:0: Device offlined - not ready after error recovery
Jan 27 18:35:01 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:06 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:12 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:17 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:22 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:27 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:32 stein firewire_sbp2: orb reply timed out, rcode=0x11
Jan 27 18:35:32 stein firewire_sbp2: failed to login to fw2.0 LUN 0000
Jan 27 18:35:32 stein firewire_sbp2: released fw2.0

After this patch, typically only a few seconds spent in __scsi_add_device
remain:

Jan 27 19:05:50 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries)
<unplug>
Jan 27 19:05:56 stein firewire_sbp2: sbp2_scsi_abort
Jan 27 19:05:56 stein scsi 33:0:0:0: Device offlined - not ready after error recovery
Jan 27 19:05:56 stein firewire_sbp2: released fw2.0

The benefit of this is negligible on simple setups.  But on buses with
several devices, we should avoid any unnecessary blockade of fw-sbp2's
workqueue thread.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
Signed-off-by: Jarod Wilson <jwilson at redhat.com>
---
 drivers/firewire/fw-sbp2.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -499,6 +499,9 @@ sbp2_send_management_orb(struct sbp2_log
 	unsigned int timeout;
 	int retval = -ENOMEM;
 
+	if (function == SBP2_LOGOUT_REQUEST && fw_device_is_shutdown(device))
+		return 0;
+
 	orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
 	if (orb == NULL)
 		return -ENOMEM;
@@ -619,16 +622,13 @@ static void sbp2_release_target(struct k
 	struct sbp2_logical_unit *lu, *next;
 	struct Scsi_Host *shost =
 		container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
-	struct fw_device *device = fw_device(tgt->unit->device.parent);
 
 	list_for_each_entry_safe(lu, next, &tgt->lu_list, link) {
 		if (lu->sdev)
 			scsi_remove_device(lu->sdev);
 
-		if (!fw_device_is_shutdown(device))
-			sbp2_send_management_orb(lu, tgt->node_id,
-					lu->generation, SBP2_LOGOUT_REQUEST,
-					lu->login_id, NULL);
+		sbp2_send_management_orb(lu, tgt->node_id, lu->generation,
+				SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
 
 		fw_core_remove_address_handler(&lu->address_handler);
 		list_del(&lu->link);
@@ -673,6 +673,9 @@ static void sbp2_login(struct work_struc
 	struct sbp2_login_response response;
 	int generation, node_id, local_node_id;
 
+	if (fw_device_is_shutdown(device))
+		goto out;
+
 	generation    = device->generation;
 	smp_rmb();    /* node_id must not be older than generation */
 	node_id       = device->node_id;
@@ -968,6 +971,9 @@ static void sbp2_reconnect(struct work_s
 	struct fw_device *device = fw_device(unit->device.parent);
 	int generation, node_id, local_node_id;
 
+	if (fw_device_is_shutdown(device))
+		goto out;
+
 	generation    = device->generation;
 	smp_rmb();    /* node_id must not be older than generation */
 	node_id       = device->node_id;

-- 
Stefan Richter
-=====-==--- ---= ==-==
http://arcgraph.de/sr/


There is a race between shutdown and creation of devices:  fw-core may
attempt to add a device with the same name of an already existing
device.  http://bugzilla.kernel.org/show_bug.cgi?id=9828

Impact of the bug:  Happens rarely (when shutdown of a device coincides
with creation of another), forces the user to unplug and replug the new
device to get it working.

The fix is obvious:  Free the minor number *after* instead of *before*
device_unregister().  This requires to take an additional reference of
the fw_device as long as the IDR tree points to it.

And while we are at it, we fix an additional race condition:
fw_device_op_open() took its reference of the fw_device a little bit too
late, hence was in danger to access an already invalid fw_device.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-cdev.c   |    8 +++++---
 drivers/firewire/fw-device.c |   20 ++++++++++++++------
 drivers/firewire/fw-device.h |    2 +-
 3 files changed, 20 insertions(+), 10 deletions(-)

Index: linux/drivers/firewire/fw-device.c
===================================================================
--- linux.orig/drivers/firewire/fw-device.c
+++ linux/drivers/firewire/fw-device.c
@@ -610,12 +610,14 @@ static DECLARE_RWSEM(idr_rwsem);
 static DEFINE_IDR(fw_device_idr);
 int fw_cdev_major;
 
-struct fw_device *fw_device_from_devt(dev_t devt)
+struct fw_device *fw_device_get_by_devt(dev_t devt)
 {
 	struct fw_device *device;
 
 	down_read(&idr_rwsem);
 	device = idr_find(&fw_device_idr, MINOR(devt));
+	if (device)
+		fw_device_get(device);
 	up_read(&idr_rwsem);
 
 	return device;
@@ -627,13 +629,14 @@ static void fw_device_shutdown(struct wo
 		container_of(work, struct fw_device, work.work);
 	int minor = MINOR(device->device.devt);
 
-	down_write(&idr_rwsem);
-	idr_remove(&fw_device_idr, minor);
-	up_write(&idr_rwsem);
-
 	fw_device_cdev_remove(device);
 	device_for_each_child(&device->device, NULL, shutdown_unit);
 	device_unregister(&device->device);
+
+	down_write(&idr_rwsem);
+	idr_remove(&fw_device_idr, minor);
+	up_write(&idr_rwsem);
+	fw_device_put(device);
 }
 
 static struct device_type fw_device_type = {
@@ -682,10 +685,13 @@ static void fw_device_init(struct work_s
 	}
 
 	err = -ENOMEM;
+
+	fw_device_get(device);
 	down_write(&idr_rwsem);
 	if (idr_pre_get(&fw_device_idr, GFP_KERNEL))
 		err = idr_get_new(&fw_device_idr, device, &minor);
 	up_write(&idr_rwsem);
+
 	if (err < 0)
 		goto error;
 
@@ -741,7 +747,9 @@ static void fw_device_init(struct work_s
 	idr_remove(&fw_device_idr, minor);
 	up_write(&idr_rwsem);
  error:
-	put_device(&device->device);
+	fw_device_put(device);		/* fw_device_idr's reference */
+
+	put_device(&device->device);	/* our reference */
 }
 
 static int update_unit(struct device *dev, void *data)
Index: linux/drivers/firewire/fw-cdev.c
===================================================================
--- linux.orig/drivers/firewire/fw-cdev.c
+++ linux/drivers/firewire/fw-cdev.c
@@ -109,15 +109,17 @@ static int fw_device_op_open(struct inod
 	struct client *client;
 	unsigned long flags;
 
-	device = fw_device_from_devt(inode->i_rdev);
+	device = fw_device_get_by_devt(inode->i_rdev);
 	if (device == NULL)
 		return -ENODEV;
 
 	client = kzalloc(sizeof(*client), GFP_KERNEL);
-	if (client == NULL)
+	if (client == NULL) {
+		fw_device_put(device);
 		return -ENOMEM;
+	}
 
-	client->device = fw_device_get(device);
+	client->device = device;
 	INIT_LIST_HEAD(&client->event_list);
 	INIT_LIST_HEAD(&client->resource_list);
 	spin_lock_init(&client->lock);
Index: linux/drivers/firewire/fw-device.h
===================================================================
--- linux.orig/drivers/firewire/fw-device.h
+++ linux/drivers/firewire/fw-device.h
@@ -77,13 +77,13 @@ fw_device_is_shutdown(struct fw_device *
 }
 
 struct fw_device *fw_device_get(struct fw_device *device);
+struct fw_device *fw_device_get_by_devt(dev_t devt);
 void fw_device_put(struct fw_device *device);
 int fw_device_enable_phys_dma(struct fw_device *device);
 
 void fw_device_cdev_update(struct fw_device *device);
 void fw_device_cdev_remove(struct fw_device *device);
 
-struct fw_device *fw_device_from_devt(dev_t devt);
 extern int fw_cdev_major;
 
 struct fw_unit {

-- 
Stefan Richter
-=====-==--- --=- ---=-
http://arcgraph.de/sr/


This should help to interpret user reports.  E.g. one can look up the
vendor OUI (first three bytes of the GUID) and thus tell what is what.

Also simplifies the math in the GUID sysfs attribute.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-device.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

Index: linux/drivers/firewire/fw-device.c
===================================================================
--- linux.orig/drivers/firewire/fw-device.c
+++ linux/drivers/firewire/fw-device.c
@@ -358,12 +358,9 @@ static ssize_t
 guid_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct fw_device *device = fw_device(dev);
-	u64 guid;
 
-	guid = ((u64)device->config_rom[3] << 32) | device->config_rom[4];
-
-	return snprintf(buf, PAGE_SIZE, "0x%016llx\n",
-			(unsigned long long)guid);
+	return snprintf(buf, PAGE_SIZE, "0x%08x%08x\n",
+			device->config_rom[3], device->config_rom[4]);
 }
 
 static struct device_attribute fw_device_attributes[] = {
@@ -723,13 +720,22 @@ static void fw_device_init(struct work_s
 	 */
 	if (atomic_cmpxchg(&device->state,
 		    FW_DEVICE_INITIALIZING,
-		    FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN)
+		    FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) {
 		fw_device_shutdown(&device->work.work);
-	else
-		fw_notify("created new fw device %s "
-			  "(%d config rom retries, S%d00)\n",
-			  device->device.bus_id, device->config_rom_retries,
-			  1 << device->max_speed);
+	} else {
+		if (device->config_rom_retries)
+			fw_notify("created device %s: GUID %08x%08x, S%d00, "
+				  "%d config ROM retries\n",
+				  device->device.bus_id,
+				  device->config_rom[3], device->config_rom[4],
+				  1 << device->max_speed,
+				  device->config_rom_retries);
+		else
+			fw_notify("created device %s: GUID %08x%08x, S%d00\n",
+				  device->device.bus_id,
+				  device->config_rom[3], device->config_rom[4],
+				  1 << device->max_speed);
+	}
 
 	/*
 	 * Reschedule the IRM work if we just finished reading the

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


Several different SBP-2 bridges accept a login early while the IDE
device is still powering up.  They are therefore unable to respond to
SCSI INQUIRY immediately, and the SCSI core has to retry the INQUIRY.
One of these retries is typically successful, and all is well.

But in case of Momobay FX-3A, the INQUIRY retries tend to fail entirely.
This can usually be avoided by waiting a little while after login before
letting the SCSI core send the INQUIRY.  The old sbp2 driver handles
this more gracefully for as yet unknown reasons (perhaps because it
waits for fetch agent resets to complete, unlike fw-sbp2 which quickly
proceeds after requesting the agent reset).  Therefore the workaround is
not as much necessary for sbp2.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -32,6 +32,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/mod_devicetable.h>
+#include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
@@ -82,6 +83,9 @@ MODULE_PARM_DESC(exclusive_login, "Exclu
  *   Avoids access beyond actual disk limits on devices with an off-by-one bug.
  *   Don't use this with devices which don't have this bug.
  *
+ * - delay inquiry
+ *   Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry.
+ *
  * - override internal blacklist
  *   Instead of adding to the built-in blacklist, use only the workarounds
  *   specified in the module load parameter.
@@ -91,6 +95,8 @@ MODULE_PARM_DESC(exclusive_login, "Exclu
 #define SBP2_WORKAROUND_INQUIRY_36	0x2
 #define SBP2_WORKAROUND_MODE_SENSE_8	0x4
 #define SBP2_WORKAROUND_FIX_CAPACITY	0x8
+#define SBP2_WORKAROUND_DELAY_INQUIRY	0x10
+#define SBP2_INQUIRY_DELAY		12
 #define SBP2_WORKAROUND_OVERRIDE	0x100
 
 static int sbp2_param_workarounds;
@@ -100,6 +106,7 @@ MODULE_PARM_DESC(workarounds, "Work arou
 	", 36 byte inquiry = "    __stringify(SBP2_WORKAROUND_INQUIRY_36)
 	", skip mode page 8 = "   __stringify(SBP2_WORKAROUND_MODE_SENSE_8)
 	", fix capacity = "       __stringify(SBP2_WORKAROUND_FIX_CAPACITY)
+	", delay inquiry = "      __stringify(SBP2_WORKAROUND_DELAY_INQUIRY)
 	", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
 	", or a combination)");
 
@@ -303,6 +310,11 @@ static const struct {
 		.workarounds		= SBP2_WORKAROUND_INQUIRY_36 |
 					  SBP2_WORKAROUND_MODE_SENSE_8,
 	},
+	/* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
+		.firmware_revision	= 0x002800,
+		.model			= 0x000000,
+		.workarounds		= SBP2_WORKAROUND_DELAY_INQUIRY,
+	},
 	/* Initio bridges, actually only needed for some older ones */ {
 		.firmware_revision	= 0x000200,
 		.model			= ~0,
@@ -712,6 +724,9 @@ static void sbp2_login(struct work_struc
 	PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect);
 	sbp2_agent_reset(lu);
 
+	if (lu->tgt->workarounds & SBP2_WORKAROUND_DELAY_INQUIRY)
+		ssleep(SBP2_INQUIRY_DELAY);
+
 	memset(&eight_bytes_lun, 0, sizeof(eight_bytes_lun));
 	eight_bytes_lun.scsi_lun[0] = (lu->lun >> 8) & 0xff;
 	eight_bytes_lun.scsi_lun[1] = lu->lun & 0xff;

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


Add the same workaround as found in fw-sbp2 for feature parity and
compatibility of the workarounds module parameter.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/ieee1394/sbp2.c |   12 ++++++++++++
 drivers/ieee1394/sbp2.h |    2 ++
 2 files changed, 14 insertions(+)

Index: linux/drivers/ieee1394/sbp2.c
===================================================================
--- linux.orig/drivers/ieee1394/sbp2.c
+++ linux/drivers/ieee1394/sbp2.c
@@ -183,6 +183,9 @@ MODULE_PARM_DESC(exclusive_login, "Exclu
  *   Avoids access beyond actual disk limits on devices with an off-by-one bug.
  *   Don't use this with devices which don't have this bug.
  *
+ * - delay inquiry
+ *   Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry.
+ *
  * - override internal blacklist
  *   Instead of adding to the built-in blacklist, use only the workarounds
  *   specified in the module load parameter.
@@ -195,6 +198,7 @@ MODULE_PARM_DESC(workarounds, "Work arou
 	", 36 byte inquiry = "    __stringify(SBP2_WORKAROUND_INQUIRY_36)
 	", skip mode page 8 = "   __stringify(SBP2_WORKAROUND_MODE_SENSE_8)
 	", fix capacity = "       __stringify(SBP2_WORKAROUND_FIX_CAPACITY)
+	", delay inquiry = "      __stringify(SBP2_WORKAROUND_DELAY_INQUIRY)
 	", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
 	", or a combination)");
 
@@ -357,6 +361,11 @@ static const struct {
 		.workarounds		= SBP2_WORKAROUND_INQUIRY_36 |
 					  SBP2_WORKAROUND_MODE_SENSE_8,
 	},
+	/* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
+		.firmware_revision	= 0x002800,
+		.model_id		= 0x000000,
+		.workarounds		= SBP2_WORKAROUND_DELAY_INQUIRY,
+	},
 	/* Initio bridges, actually only needed for some older ones */ {
 		.firmware_revision	= 0x000200,
 		.model_id		= SBP2_ROM_VALUE_WILDCARD,
@@ -914,6 +923,9 @@ static int sbp2_start_device(struct sbp2
 	sbp2_agent_reset(lu, 1);
 	sbp2_max_speed_and_size(lu);
 
+	if (lu->workarounds & SBP2_WORKAROUND_DELAY_INQUIRY)
+		ssleep(SBP2_INQUIRY_DELAY);
+
 	error = scsi_add_device(lu->shost, 0, lu->ud->id, 0);
 	if (error) {
 		SBP2_ERR("scsi_add_device failed");
Index: linux/drivers/ieee1394/sbp2.h
===================================================================
--- linux.orig/drivers/ieee1394/sbp2.h
+++ linux/drivers/ieee1394/sbp2.h
@@ -343,6 +343,8 @@ enum sbp2lu_state_types {
 #define SBP2_WORKAROUND_INQUIRY_36	0x2
 #define SBP2_WORKAROUND_MODE_SENSE_8	0x4
 #define SBP2_WORKAROUND_FIX_CAPACITY	0x8
+#define SBP2_WORKAROUND_DELAY_INQUIRY	0x10
+#define SBP2_INQUIRY_DELAY		12
 #define SBP2_WORKAROUND_OVERRIDE	0x100
 
 #endif /* SBP2_H */

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


Like the old sbp2 driver, wait for the write transaction to the
AGENT_RESET to complete before proceeding (after login, after reconnect,
or in SCSI error handling).

There is one occasion where AGENT_RESET is written to from atomic
context when getting DEAD status for a command ORB.  There we still
continue without waiting for the transaction to complete because this
is more difficult to fix...

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |   39 ++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -603,29 +603,46 @@ sbp2_send_management_orb(struct sbp2_log
 
 static void
 complete_agent_reset_write(struct fw_card *card, int rcode,
-			   void *payload, size_t length, void *data)
+			   void *payload, size_t length, void *done)
 {
-	struct fw_transaction *t = data;
+	complete(done);
+}
+
+static void sbp2_agent_reset(struct sbp2_logical_unit *lu)
+{
+	struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
+	DECLARE_COMPLETION_ONSTACK(done);
+	struct fw_transaction t;
+	static u32 z;
 
-	kfree(t);
+	fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST,
+			lu->tgt->node_id, lu->generation, device->max_speed,
+			lu->command_block_agent_address + SBP2_AGENT_RESET,
+			&z, sizeof(z), complete_agent_reset_write, &done);
+	wait_for_completion(&done);
 }
 
-static int sbp2_agent_reset(struct sbp2_logical_unit *lu)
+static void
+complete_agent_reset_write_no_wait(struct fw_card *card, int rcode,
+				   void *payload, size_t length, void *data)
+{
+	kfree(data);
+}
+
+static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu)
 {
 	struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
 	struct fw_transaction *t;
-	static u32 zero;
+	static u32 z;
 
-	t = kzalloc(sizeof(*t), GFP_ATOMIC);
+	t = kmalloc(sizeof(*t), GFP_ATOMIC);
 	if (t == NULL)
-		return -ENOMEM;
+		return;
 
 	fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST,
 			lu->tgt->node_id, lu->generation, device->max_speed,
 			lu->command_block_agent_address + SBP2_AGENT_RESET,
-			&zero, sizeof(zero), complete_agent_reset_write, t);
-
-	return 0;
+			&z, sizeof(z), complete_agent_reset_write_no_wait, t);
 }
 
 static void sbp2_release_target(struct kref *kref)
@@ -1110,7 +1127,7 @@ complete_command_orb(struct sbp2_orb *ba
 
 	if (status != NULL) {
 		if (STATUS_GET_DEAD(*status))
-			sbp2_agent_reset(orb->lu);
+			sbp2_agent_reset_no_wait(orb->lu);
 
 		switch (STATUS_GET_RESPONSE(*status)) {
 		case SBP2_STATUS_REQUEST_COMPLETE:

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


for easier readable logs if more than one SBP-2 device is present.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |   66 ++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 33 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -149,6 +149,7 @@ struct sbp2_target {
 	struct kref kref;
 	struct fw_unit *unit;
 	struct list_head lu_list;
+	const char *bus_id;
 
 	u64 management_agent_address;
 	int directory_id;
@@ -566,20 +567,20 @@ sbp2_send_management_orb(struct sbp2_log
 
 	retval = -EIO;
 	if (sbp2_cancel_orbs(lu) == 0) {
-		fw_error("orb reply timed out, rcode=0x%02x\n",
-			 orb->base.rcode);
+		fw_error("%s: orb reply timed out, rcode=0x%02x\n",
+			 lu->tgt->bus_id, orb->base.rcode);
 		goto out;
 	}
 
 	if (orb->base.rcode != RCODE_COMPLETE) {
-		fw_error("management write failed, rcode 0x%02x\n",
-			 orb->base.rcode);
+		fw_error("%s: management write failed, rcode 0x%02x\n",
+			 lu->tgt->bus_id, orb->base.rcode);
 		goto out;
 	}
 
 	if (STATUS_GET_RESPONSE(orb->status) != 0 ||
 	    STATUS_GET_SBP_STATUS(orb->status) != 0) {
-		fw_error("error status: %d:%d\n",
+		fw_error("%s: error status: %d:%d\n", lu->tgt->bus_id,
 			 STATUS_GET_RESPONSE(orb->status),
 			 STATUS_GET_SBP_STATUS(orb->status));
 		goto out;
@@ -664,7 +665,7 @@ static void sbp2_release_target(struct k
 		kfree(lu);
 	}
 	scsi_remove_host(shost);
-	fw_notify("released %s\n", tgt->unit->device.bus_id);
+	fw_notify("released %s\n", tgt->bus_id);
 
 	put_device(&tgt->unit->device);
 	scsi_host_put(shost);
@@ -693,12 +694,11 @@ static void sbp2_login(struct work_struc
 {
 	struct sbp2_logical_unit *lu =
 		container_of(work, struct sbp2_logical_unit, work.work);
-	struct Scsi_Host *shost =
-		container_of((void *)lu->tgt, struct Scsi_Host, hostdata[0]);
+	struct sbp2_target *tgt = lu->tgt;
+	struct fw_device *device = fw_device(tgt->unit->device.parent);
+	struct Scsi_Host *shost;
 	struct scsi_device *sdev;
 	struct scsi_lun eight_bytes_lun;
-	struct fw_unit *unit = lu->tgt->unit;
-	struct fw_device *device = fw_device(unit->device.parent);
 	struct sbp2_login_response response;
 	int generation, node_id, local_node_id;
 
@@ -715,14 +715,14 @@ static void sbp2_login(struct work_struc
 		if (lu->retries++ < 5)
 			sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
 		else
-			fw_error("failed to login to %s LUN %04x\n",
-				 unit->device.bus_id, lu->lun);
+			fw_error("%s: failed to login to LUN %04x\n",
+				 tgt->bus_id, lu->lun);
 		goto out;
 	}
 
-	lu->generation        = generation;
-	lu->tgt->node_id      = node_id;
-	lu->tgt->address_high = local_node_id << 16;
+	lu->generation    = generation;
+	tgt->node_id	  = node_id;
+	tgt->address_high = local_node_id << 16;
 
 	/* Get command block agent offset and login id. */
 	lu->command_block_agent_address =
@@ -730,8 +730,8 @@ static void sbp2_login(struct work_struc
 		response.command_block_agent.low;
 	lu->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response);
 
-	fw_notify("logged in to %s LUN %04x (%d retries)\n",
-		  unit->device.bus_id, lu->lun, lu->retries);
+	fw_notify("%s: logged in to LUN %04x (%d retries)\n",
+		  tgt->bus_id, lu->lun, lu->retries);
 
 #if 0
 	/* FIXME: The linux1394 sbp2 does this last step. */
@@ -747,6 +747,7 @@ static void sbp2_login(struct work_struc
 	memset(&eight_bytes_lun, 0, sizeof(eight_bytes_lun));
 	eight_bytes_lun.scsi_lun[0] = (lu->lun >> 8) & 0xff;
 	eight_bytes_lun.scsi_lun[1] = lu->lun & 0xff;
+	shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
 
 	sdev = __scsi_add_device(shost, 0, 0,
 				 scsilun_to_int(&eight_bytes_lun), lu);
@@ -791,7 +792,7 @@ static void sbp2_login(struct work_struc
 	 */
 	PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
  out:
-	sbp2_target_put(lu->tgt);
+	sbp2_target_put(tgt);
 }
 
 static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
@@ -874,7 +875,7 @@ static int sbp2_scan_unit_dir(struct sbp
 			if (timeout > tgt->mgt_orb_timeout)
 				fw_notify("%s: config rom contains %ds "
 					  "management ORB timeout, limiting "
-					  "to %ds\n", tgt->unit->device.bus_id,
+					  "to %ds\n", tgt->bus_id,
 					  timeout / 1000,
 					  tgt->mgt_orb_timeout / 1000);
 			break;
@@ -902,7 +903,7 @@ static void sbp2_init_workarounds(struct
 	if (w)
 		fw_notify("Please notify linux1394-devel at lists.sourceforge.net "
 			  "if you need the workarounds parameter for %s\n",
-			  tgt->unit->device.bus_id);
+			  tgt->bus_id);
 
 	if (w & SBP2_WORKAROUND_OVERRIDE)
 		goto out;
@@ -924,8 +925,7 @@ static void sbp2_init_workarounds(struct
 	if (w)
 		fw_notify("Workarounds for %s: 0x%x "
 			  "(firmware_revision 0x%06x, model_id 0x%06x)\n",
-			  tgt->unit->device.bus_id,
-			  w, firmware_revision, model);
+			  tgt->bus_id, w, firmware_revision, model);
 	tgt->workarounds = w;
 }
 
@@ -949,6 +949,7 @@ static int sbp2_probe(struct device *dev
 	tgt->unit = unit;
 	kref_init(&tgt->kref);
 	INIT_LIST_HEAD(&tgt->lu_list);
+	tgt->bus_id = unit->device.bus_id;
 
 	if (fw_device_enable_phys_dma(device) < 0)
 		goto fail_shost_put;
@@ -999,8 +1000,8 @@ static void sbp2_reconnect(struct work_s
 {
 	struct sbp2_logical_unit *lu =
 		container_of(work, struct sbp2_logical_unit, work.work);
-	struct fw_unit *unit = lu->tgt->unit;
-	struct fw_device *device = fw_device(unit->device.parent);
+	struct sbp2_target *tgt = lu->tgt;
+	struct fw_device *device = fw_device(tgt->unit->device.parent);
 	int generation, node_id, local_node_id;
 
 	if (fw_device_is_shutdown(device))
@@ -1015,8 +1016,7 @@ static void sbp2_reconnect(struct work_s
 				     SBP2_RECONNECT_REQUEST,
 				     lu->login_id, NULL) < 0) {
 		if (lu->retries++ >= 5) {
-			fw_error("failed to reconnect to %s\n",
-				 unit->device.bus_id);
+			fw_error("%s: failed to reconnect\n", tgt->bus_id);
 			/* Fall back and try to log in again. */
 			lu->retries = 0;
 			PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
@@ -1025,17 +1025,17 @@ static void sbp2_reconnect(struct work_s
 		goto out;
 	}
 
-	lu->generation        = generation;
-	lu->tgt->node_id      = node_id;
-	lu->tgt->address_high = local_node_id << 16;
+	lu->generation    = generation;
+	tgt->node_id      = node_id;
+	tgt->address_high = local_node_id << 16;
 
-	fw_notify("reconnected to %s LUN %04x (%d retries)\n",
-		  unit->device.bus_id, lu->lun, lu->retries);
+	fw_notify("%s: reconnected to LUN %04x (%d retries)\n",
+		  tgt->bus_id, lu->lun, lu->retries);
 
 	sbp2_agent_reset(lu);
 	sbp2_cancel_orbs(lu);
  out:
-	sbp2_target_put(lu->tgt);
+	sbp2_target_put(tgt);
 }
 
 static void sbp2_update(struct fw_unit *unit)
@@ -1377,7 +1377,7 @@ static int sbp2_scsi_abort(struct scsi_c
 {
 	struct sbp2_logical_unit *lu = cmd->device->hostdata;
 
-	fw_notify("sbp2_scsi_abort\n");
+	fw_notify("%s: sbp2_scsi_abort\n", lu->tgt->bus_id);
 	sbp2_agent_reset(lu);
 	sbp2_cancel_orbs(lu);
 

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


When a reconnect failed but re-login succeeded, __scsi_add_device was
called again.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -741,6 +741,12 @@ static void sbp2_login(struct work_struc
 	PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect);
 	sbp2_agent_reset(lu);
 
+	/* This was a re-login. */
+	if (lu->sdev) {
+		sbp2_cancel_orbs(lu);
+		goto out;
+	}
+
 	if (lu->tgt->workarounds & SBP2_WORKAROUND_DELAY_INQUIRY)
 		ssleep(SBP2_INQUIRY_DELAY);
 

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


If fw-sbp2 was too late with requesting the reconnect, the target would
reject this.  In this case, log out before attempting the reconnect.
Else several firmwares will deny the re-login because they somehow
didn't invalidate the old login.

Also, don't retry reconnects in this situation.  The retries won't
succeed either.

These changes improve chances for successful re-login and shorten the
period during which the logical unit is inaccessible.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -710,6 +710,11 @@ static void sbp2_login(struct work_struc
 	node_id       = device->node_id;
 	local_node_id = device->card->node_id;
 
+	/* If this is a re-login attempt, log out, or we might be rejected. */
+	if (lu->sdev)
+		sbp2_send_management_orb(lu, device->node_id, generation,
+				SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
+
 	if (sbp2_send_management_orb(lu, node_id, generation,
 				SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
 		if (lu->retries++ < 5)
@@ -1021,9 +1026,17 @@ static void sbp2_reconnect(struct work_s
 	if (sbp2_send_management_orb(lu, node_id, generation,
 				     SBP2_RECONNECT_REQUEST,
 				     lu->login_id, NULL) < 0) {
-		if (lu->retries++ >= 5) {
+		/*
+		 * If reconnect was impossible even though we are in the
+		 * current generation, fall back and try to log in again.
+		 *
+		 * We could check for "Function rejected" status, but
+		 * looking at the bus generation as simpler and more general.
+		 */
+		smp_rmb(); /* get current card generation */
+		if (generation == device->card->generation ||
+		    lu->retries++ >= 5) {
 			fw_error("%s: failed to reconnect\n", tgt->bus_id);
-			/* Fall back and try to log in again. */
 			lu->retries = 0;
 			PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
 		}

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -28,15 +28,15 @@
  * and many others.
  */
 
+#include <linux/blkdev.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/mod_devicetable.h>
-#include <linux/delay.h>
-#include <linux/device.h>
 #include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
-#include <linux/blkdev.h>
 #include <linux/string.h>
 #include <linux/stringify.h>
 #include <linux/timer.h>
@@ -48,9 +48,9 @@
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 
-#include "fw-transaction.h"
-#include "fw-topology.h"
 #include "fw-device.h"
+#include "fw-topology.h"
+#include "fw-transaction.h"
 
 /*
  * So far only bridges from Oxford Semiconductor are known to support

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


While fw-sbp2 takes the necessary time to reconnect to a logical unit
after bus reset, the SCSI core keeps sending new commands.  They are all
immediately completed with host busy status, and application clients or
filesystems will break quickly.  The SCSI device might even be taken
offline:  http://bugzilla.kernel.org/show_bug.cgi?id=9734

The only remedy seems to be to block the SCSI device until reconnect.
Alas the SCSI core has no useful API to block only one logical unit i.e.
the scsi_device, therefore we block the entire Scsi_Host.  This
currently corresponds to an SBP-2 target.  In case of targets with
multiple logical units, we need to satisfy the dependencies between
logical units by carefully tracking the blocking state of the target and
its units.  We block all logical units of a target as soon as one of
them needs to be blocked, and keep them blocked until all of them are
ready to be unblocked.

Furthermore, as the history of the old sbp2 driver has shown, the
scsi_block_requests() API is a minefield with high potential of
deadlocks.  We therefore take extra measures to keep logical units
unblocked during __scsi_add_device() and during shutdown.

Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
---
 drivers/firewire/fw-sbp2.c |   71 +++++++++++++++++++++++++++++++++++--
 1 file changed, 69 insertions(+), 2 deletions(-)

Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -41,6 +41,8 @@
 #include <linux/stringify.h>
 #include <linux/timer.h>
 #include <linux/workqueue.h>
+#include <asm/atomic.h>
+#include <asm/system.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -139,6 +140,7 @@ struct sbp2_logical_unit {
 	int generation;
 	int retries;
 	struct delayed_work work;
+	atomic_t blocked;
 };
 
 /*
@@ -157,6 +159,9 @@ struct sbp2_target {
 	int address_high;
 	unsigned int workarounds;
 	unsigned int mgt_orb_timeout;
+
+	atomic_t dont_block;
+	atomic_t blocked;
 };
 
 /*
@@ -646,6 +651,53 @@ static void sbp2_agent_reset_no_wait(str
 			&z, sizeof(z), complete_agent_reset_write_no_wait, t);
 }
 
+/*
+ * Blocks lu->tgt if all of the following conditions are met:
+ *   - Login, INQUIRY, and high-level SCSI setup of all logical units of the
+ *     target have been successfully finished (indicated by dont_block == 0).
+ *   - The lu->generation is stale.  sbp2_reconnect will unblock lu later.
+ */
+static void sbp2_conditionally_block(struct sbp2_logical_unit *lu)
+{
+	struct fw_card *card = fw_device(lu->tgt->unit->device.parent)->card;
+
+	if (!atomic_read(&lu->tgt->dont_block) &&
+	    lu->generation != card->generation &&
+	    atomic_cmpxchg(&lu->blocked, 0, 1) == 0) {
+
+		/* raise the block count of the target */
+		if (atomic_inc_return(&lu->tgt->blocked) == 1) {
+			scsi_block_requests(lu->sdev->host);
+			fw_notify("blocked %s\n", lu->tgt->bus_id);
+		}
+	}
+}
+
+/* Unblocks lu->tgt as soon as all its logical units can be unblocked. */
+static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu)
+{
+	if (atomic_cmpxchg(&lu->blocked, 1, 0) == 1) {
+
+		/* lower the block count of the target */
+		if (atomic_dec_and_test(&lu->tgt->blocked)) {
+			scsi_unblock_requests(lu->sdev->host);
+			fw_notify("unblocked %s\n", lu->tgt->bus_id);
+		}
+	}
+}
+
+
+/* Prevents future blocking of tgt and then unblocks it. */
+static void sbp2_unblock(struct sbp2_target *tgt)
+{
+	struct Scsi_Host *shost =
+		container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
+
+	atomic_inc(&tgt->dont_block);
+	smp_wmb();
+	scsi_unblock_requests(shost);
+}
+
 static void sbp2_release_target(struct kref *kref)
 {
 	struct sbp2_target *tgt = container_of(kref, struct sbp2_target, kref);
@@ -653,6 +705,12 @@ static void sbp2_release_target(struct k
 	struct Scsi_Host *shost =
 		container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
 
+	/*
+	 * Make sure that the target is unblocked and won't be blocked anymore
+	 * before scsi_remove_device() is called.  Else it will deadlock.
+	 */
+	sbp2_unblock(tgt);
+
 	list_for_each_entry_safe(lu, next, &tgt->lu_list, link) {
 		if (lu->sdev)
 			scsi_remove_device(lu->sdev);
@@ -717,11 +775,14 @@ static void sbp2_login(struct work_struc
 
 	if (sbp2_send_management_orb(lu, node_id, generation,
 				SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
-		if (lu->retries++ < 5)
+		if (lu->retries++ < 5) {
 			sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
-		else
+		} else {
 			fw_error("%s: failed to login to LUN %04x\n",
 				 tgt->bus_id, lu->lun);
+			/* Let any waiting I/O fail from now on. */
+			sbp2_unblock(lu->tgt);
+		}
 		goto out;
 	}
 
@@ -749,6 +810,7 @@ static void sbp2_login(struct work_struc
 	/* This was a re-login. */
 	if (lu->sdev) {
 		sbp2_cancel_orbs(lu);
+		sbp2_conditionally_unblock(lu);
 		goto out;
 	}
 
@@ -786,6 +848,8 @@ static void sbp2_login(struct work_struc
 		 * Can you believe it?  Everything went well.
 		 */
 		lu->sdev = sdev;
+		smp_wmb();  /* We need lu->sdev when we want to block lu. */
+		atomic_dec(&lu->tgt->dont_block);
 		scsi_device_put(sdev);
 		goto out;
 	}
@@ -828,6 +892,7 @@ static int sbp2_add_logical_unit(struct 
 	lu->sdev = NULL;
 	lu->lun  = lun_entry & 0xffff;
 	lu->retries = 0;
+	atomic_inc(&tgt->dont_block);
 	INIT_LIST_HEAD(&lu->orb_list);
 	INIT_DELAYED_WORK(&lu->work, sbp2_login);
 
@@ -1053,6 +1118,7 @@ static void sbp2_reconnect(struct work_s
 
 	sbp2_agent_reset(lu);
 	sbp2_cancel_orbs(lu);
+	sbp2_conditionally_unblock(lu);
  out:
 	sbp2_target_put(tgt);
 }
@@ -1172,6 +1238,7 @@ complete_command_orb(struct sbp2_orb *ba
 		 * or when sending the write (less likely).
 		 */
 		result = DID_BUS_BUSY << 16;
+		sbp2_conditionally_block(orb->lu);
 	}
 
 	dma_unmap_single(device->card->device, orb->base.request_bus,

-- 
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/


linux-2.6-firewire-git-update.patch:

--- NEW FILE linux-2.6-firewire-git-update.patch ---
diff -Naurp linux-2.6-git/drivers/firewire/fw-cdev.c firewire-git/drivers/firewire/fw-cdev.c
--- linux-2.6-git/drivers/firewire/fw-cdev.c	2008-01-01 22:50:33.000000000 -0500
+++ firewire-git/drivers/firewire/fw-cdev.c	2008-01-25 12:41:22.000000000 -0500
@@ -206,12 +206,13 @@ fill_bus_reset_event(struct fw_cdev_even
 
 	event->closure	     = client->bus_reset_closure;
 	event->type          = FW_CDEV_EVENT_BUS_RESET;
+	event->generation    = client->device->generation;
+	smp_rmb();           /* node_id must not be older than generation */
 	event->node_id       = client->device->node_id;
 	event->local_node_id = card->local_node->node_id;
 	event->bm_node_id    = 0; /* FIXME: We don't track the BM. */
 	event->irm_node_id   = card->irm_node->node_id;
 	event->root_node_id  = card->root_node->node_id;
-	event->generation    = card->generation;
 }
 
 static void
diff -Naurp linux-2.6-git/drivers/firewire/fw-device.c firewire-git/drivers/firewire/fw-device.c
--- linux-2.6-git/drivers/firewire/fw-device.c	2008-01-01 22:50:33.000000000 -0500
+++ firewire-git/drivers/firewire/fw-device.c	2008-01-25 12:41:22.000000000 -0500
@@ -182,9 +182,14 @@ static void fw_device_release(struct dev
 
 int fw_device_enable_phys_dma(struct fw_device *device)
 {
+	int generation = device->generation;
+
+	/* device->node_id, accessed below, must not be older than generation */
+	smp_rmb();
+
 	return device->card->driver->enable_phys_dma(device->card,
 						     device->node_id,
-						     device->generation);
+						     generation);
 }
 EXPORT_SYMBOL(fw_device_enable_phys_dma);
 
@@ -384,17 +389,21 @@ complete_transaction(struct fw_card *car
 	complete(&callback_data->done);
 }
 
-static int read_rom(struct fw_device *device, int index, u32 * data)
+static int
+read_rom(struct fw_device *device, int generation, int index, u32 *data)
 {
 	struct read_quadlet_callback_data callback_data;
 	struct fw_transaction t;
 	u64 offset;
 
+	/* device->node_id, accessed below, must not be older than generation */
+	smp_rmb();
+
 	init_completion(&callback_data.done);
 
 	offset = 0xfffff0000400ULL + index * 4;
 	fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST,
-			device->node_id, device->generation, device->max_speed,
+			device->node_id, generation, device->max_speed,
 			offset, NULL, 4, complete_transaction, &callback_data);
 
 	wait_for_completion(&callback_data.done);
@@ -404,7 +413,14 @@ static int read_rom(struct fw_device *de
 	return callback_data.rcode;
 }
 
-static int read_bus_info_block(struct fw_device *device)
+/*
+ * Read the bus info block, perform a speed probe, and read all of the rest of
+ * the config ROM.  We do all this with a cached bus generation.  If the bus
+ * generation changes under us, read_bus_info_block will fail and get retried.
+ * It's better to start all over in this case because the node from which we
+ * are reading the ROM may have changed the ROM during the reset.
+ */
+static int read_bus_info_block(struct fw_device *device, int generation)
 {
 	static u32 rom[256];
 	u32 stack[16], sp, key;
@@ -414,7 +430,7 @@ static int read_bus_info_block(struct fw
 
 	/* First read the bus info block. */
 	for (i = 0; i < 5; i++) {
-		if (read_rom(device, i, &rom[i]) != RCODE_COMPLETE)
+		if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE)
 			return -1;
 		/*
 		 * As per IEEE1212 7.2, during power-up, devices can
@@ -449,7 +465,8 @@ static int read_bus_info_block(struct fw
 			device->max_speed = device->card->link_speed;
 
 		while (device->max_speed > SCODE_100) {
-			if (read_rom(device, 0, &dummy) == RCODE_COMPLETE)
+			if (read_rom(device, generation, 0, &dummy) ==
+			    RCODE_COMPLETE)
 				break;
 			device->max_speed--;
 		}
@@ -482,7 +499,7 @@ static int read_bus_info_block(struct fw
 			return -1;
 
 		/* Read header quadlet for the block to get the length. */
-		if (read_rom(device, i, &rom[i]) != RCODE_COMPLETE)
+		if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE)
 			return -1;
 		end = i + (rom[i] >> 16) + 1;
 		i++;
@@ -501,7 +518,8 @@ static int read_bus_info_block(struct fw
 		 * it references another block, and push it in that case.
 		 */
 		while (i < end) {
-			if (read_rom(device, i, &rom[i]) != RCODE_COMPLETE)
+			if (read_rom(device, generation, i, &rom[i]) !=
+			    RCODE_COMPLETE)
 				return -1;
 			if ((key >> 30) == 3 && (rom[i] >> 30) > 1 &&
 			    sp < ARRAY_SIZE(stack))
@@ -648,7 +666,7 @@ static void fw_device_init(struct work_s
 	 * device.
 	 */
 
-	if (read_bus_info_block(device) < 0) {
+	if (read_bus_info_block(device, device->generation) < 0) {
 		if (device->config_rom_retries < MAX_RETRIES) {
 			device->config_rom_retries++;
 			schedule_delayed_work(&device->work, RETRY_DELAY);
@@ -801,6 +819,7 @@ void fw_node_event(struct fw_card *card,
 
 		device = node->data;
 		device->node_id = node->node_id;
+		smp_wmb();  /* update node_id before generation */
 		device->generation = card->generation;
 		if (atomic_read(&device->state) == FW_DEVICE_RUNNING) {
 			PREPARE_DELAYED_WORK(&device->work, fw_device_update);
diff -Naurp linux-2.6-git/drivers/firewire/fw-device.h firewire-git/drivers/firewire/fw-device.h
--- linux-2.6-git/drivers/firewire/fw-device.h	2008-01-01 22:50:33.000000000 -0500
+++ firewire-git/drivers/firewire/fw-device.h	2008-01-25 12:41:22.000000000 -0500
@@ -35,6 +35,18 @@ struct fw_attribute_group {
 	struct attribute *attrs[11];
 };
 
+/*
+ * Note, fw_device.generation always has to be read before fw_device.node_id.
+ * Use SMP memory barriers to ensure this.  Otherwise requests will be sent
+ * to an outdated node_id if the generation was updated in the meantime due
+ * to a bus reset.
+ *
+ * Likewise, fw-core will take care to update .node_id before .generation so
+ * that whenever fw_device.generation is current WRT the actual bus generation,
+ * fw_device.node_id is guaranteed to be current too.
+ *
+ * The same applies to fw_device.card->node_id vs. fw_device.generation.
+ */
 struct fw_device {
 	atomic_t state;
 	struct fw_node *node;
diff -Naurp linux-2.6-git/drivers/firewire/fw-ohci.c firewire-git/drivers/firewire/fw-ohci.c
--- linux-2.6-git/drivers/firewire/fw-ohci.c	2008-01-01 22:50:33.000000000 -0500
+++ firewire-git/drivers/firewire/fw-ohci.c	2008-01-23 16:01:36.000000000 -0500
@@ -98,17 +98,48 @@ struct context;
 typedef int (*descriptor_callback_t)(struct context *ctx,
 				     struct descriptor *d,
 				     struct descriptor *last);
+
+/*
+ * A buffer that contains a block of DMA-able coherent memory used for
+ * storing a portion of a DMA descriptor program.
+ */
+struct descriptor_buffer {
+	struct list_head list;
+	dma_addr_t buffer_bus;
+	size_t buffer_size;
+	size_t used;
+	struct descriptor buffer[0];
+};
+
 struct context {
 	struct fw_ohci *ohci;
 	u32 regs;
+	int total_allocation;
 
-	struct descriptor *buffer;
-	dma_addr_t buffer_bus;
-	size_t buffer_size;
-	struct descriptor *head_descriptor;
-	struct descriptor *tail_descriptor;
-	struct descriptor *tail_descriptor_last;
-	struct descriptor *prev_descriptor;
+	/*
+	 * List of page-sized buffers for storing DMA descriptors.
+	 * Head of list contains buffers in use and tail of list contains
+	 * free buffers.
+	 */
+	struct list_head buffer_list;
+
+	/*
+	 * Pointer to a buffer inside buffer_list that contains the tail
+	 * end of the current DMA program.
+	 */
+	struct descriptor_buffer *buffer_tail;
+
+	/*
+	 * The descriptor containing the branch address of the first
+	 * descriptor that has not yet been filled by the device.
+	 */
+	struct descriptor *last;
+
+	/*
+	 * The last descriptor in the DMA program.  It contains the branch
+	 * address that must be updated upon appending a new descriptor.
+	 */
+	struct descriptor *prev;
 
 	descriptor_callback_t callback;
 
@@ -125,6 +156,7 @@ struct context {
 struct iso_context {
 	struct fw_iso_context base;
 	struct context context;
+	int excess_bytes;
 	void *header;
 	size_t header_length;
 };
@@ -197,8 +229,6 @@ static inline struct fw_ohci *fw_ohci(st
 #define SELF_ID_BUF_SIZE		0x800
 #define OHCI_TCODE_PHY_PACKET		0x0e
 #define OHCI_VERSION_1_1		0x010010
-#define ISO_BUFFER_SIZE			(64 * 1024)
-#define AT_BUFFER_SIZE			4096
 
 static char ohci_driver_name[] = KBUILD_MODNAME;
 
@@ -455,71 +485,108 @@ find_branch_descriptor(struct descriptor
 static void context_tasklet(unsigned long data)
 {
 	struct context *ctx = (struct context *) data;
-	struct fw_ohci *ohci = ctx->ohci;
 	struct descriptor *d, *last;
 	u32 address;
 	int z;
+	struct descriptor_buffer *desc;
 
-	dma_sync_single_for_cpu(ohci->card.device, ctx->buffer_bus,
-				ctx->buffer_size, DMA_TO_DEVICE);
-
-	d    = ctx->tail_descriptor;
-	last = ctx->tail_descriptor_last;
-
+	desc = list_entry(ctx->buffer_list.next,
+			struct descriptor_buffer, list);
+	last = ctx->last;
 	while (last->branch_address != 0) {
+		struct descriptor_buffer *old_desc = desc;
 		address = le32_to_cpu(last->branch_address);
 		z = address & 0xf;
-		d = ctx->buffer + (address - ctx->buffer_bus) / sizeof(*d);
+		address &= ~0xf;
+
+		/* If the branch address points to a buffer outside of the
+		 * current buffer, advance to the next buffer. */
+		if (address < desc->buffer_bus ||
+				address >= desc->buffer_bus + desc->used)
+			desc = list_entry(desc->list.next,
+					struct descriptor_buffer, list);
+		d = desc->buffer + (address - desc->buffer_bus) / sizeof(*d);
 		last = find_branch_descriptor(d, z);
 
 		if (!ctx->callback(ctx, d, last))
 			break;
 
-		ctx->tail_descriptor      = d;
-		ctx->tail_descriptor_last = last;
+		if (old_desc != desc) {
+			/* If we've advanced to the next buffer, move the
+			 * previous buffer to the free list. */
+			unsigned long flags;
+			old_desc->used = 0;
+			spin_lock_irqsave(&ctx->ohci->lock, flags);
+			list_move_tail(&old_desc->list, &ctx->buffer_list);
+			spin_unlock_irqrestore(&ctx->ohci->lock, flags);
+		}
+		ctx->last = last;
 	}
 }
 
+/*
+ * Allocate a new buffer and add it to the list of free buffers for this
+ * context.  Must be called with ohci->lock held.
+ */
+static int
+context_add_buffer(struct context *ctx)
+{
+	struct descriptor_buffer *desc;
+	dma_addr_t bus_addr;
+	int offset;
+
+	/*
+	 * 16MB of descriptors should be far more than enough for any DMA
+	 * program.  This will catch run-away userspace or DoS attacks.
+	 */
+	if (ctx->total_allocation >= 16*1024*1024)
+		return -ENOMEM;
+
+	desc = dma_alloc_coherent(ctx->ohci->card.device, PAGE_SIZE,
+			&bus_addr, GFP_ATOMIC);
+	if (!desc)
+		return -ENOMEM;
+
+	offset = (void *)&desc->buffer - (void *)desc;
+	desc->buffer_size = PAGE_SIZE - offset;
+	desc->buffer_bus = bus_addr + offset;
+	desc->used = 0;
+
+	list_add_tail(&desc->list, &ctx->buffer_list);
+	ctx->total_allocation += PAGE_SIZE;
+
+	return 0;
+}
+
 static int
 context_init(struct context *ctx, struct fw_ohci *ohci,
-	     size_t buffer_size, u32 regs,
-	     descriptor_callback_t callback)
+	     u32 regs, descriptor_callback_t callback)
 {
 	ctx->ohci = ohci;
 	ctx->regs = regs;
-	ctx->buffer_size = buffer_size;
-	ctx->buffer = kmalloc(buffer_size, GFP_KERNEL);
-	if (ctx->buffer == NULL)
+	ctx->total_allocation = 0;
+
+	INIT_LIST_HEAD(&ctx->buffer_list);
+	if (context_add_buffer(ctx) < 0)
 		return -ENOMEM;
 
+	ctx->buffer_tail = list_entry(ctx->buffer_list.next,
+			struct descriptor_buffer, list);
+
 	tasklet_init(&ctx->tasklet, context_tasklet, (unsigned long)ctx);
 	ctx->callback = callback;
 
-	ctx->buffer_bus =
-		dma_map_single(ohci->card.device, ctx->buffer,
-			       buffer_size, DMA_TO_DEVICE);
-	if (dma_mapping_error(ctx->buffer_bus)) {
-		kfree(ctx->buffer);
-		return -ENOMEM;
-	}
-
-	ctx->head_descriptor      = ctx->buffer;
-	ctx->prev_descriptor      = ctx->buffer;
-	ctx->tail_descriptor      = ctx->buffer;
-	ctx->tail_descriptor_last = ctx->buffer;
-
 	/*
 	 * We put a dummy descriptor in the buffer that has a NULL
 	 * branch address and looks like it's been sent.  That way we
-	 * have a descriptor to append DMA programs to.  Also, the
-	 * ring buffer invariant is that it always has at least one
-	 * element so that head == tail means buffer full.
+	 * have a descriptor to append DMA programs to.
 	 */
-
-	memset(ctx->head_descriptor, 0, sizeof(*ctx->head_descriptor));
-	ctx->head_descriptor->control = cpu_to_le16(DESCRIPTOR_OUTPUT_LAST);
-	ctx->head_descriptor->transfer_status = cpu_to_le16(0x8011);
-	ctx->head_descriptor++;
+	memset(ctx->buffer_tail->buffer, 0, sizeof(*ctx->buffer_tail->buffer));
+	ctx->buffer_tail->buffer->control = cpu_to_le16(DESCRIPTOR_OUTPUT_LAST);
+	ctx->buffer_tail->buffer->transfer_status = cpu_to_le16(0x8011);
+	ctx->buffer_tail->used += sizeof(*ctx->buffer_tail->buffer);
+	ctx->last = ctx->buffer_tail->buffer;
+	ctx->prev = ctx->buffer_tail->buffer;
 
 	return 0;
 }
@@ -528,35 +595,42 @@ static void
 context_release(struct context *ctx)
 {
 	struct fw_card *card = &ctx->ohci->card;
+	struct descriptor_buffer *desc, *tmp;
 
-	dma_unmap_single(card->device, ctx->buffer_bus,
-			 ctx->buffer_size, DMA_TO_DEVICE);
-	kfree(ctx->buffer);
+	list_for_each_entry_safe(desc, tmp, &ctx->buffer_list, list)
+		dma_free_coherent(card->device, PAGE_SIZE, desc,
+			desc->buffer_bus -
+			((void *)&desc->buffer - (void *)desc));
 }
 
+/* Must be called with ohci->lock held */
 static struct descriptor *
 context_get_descriptors(struct context *ctx, int z, dma_addr_t *d_bus)
 {
-	struct descriptor *d, *tail, *end;
+	struct descriptor *d = NULL;
+	struct descriptor_buffer *desc = ctx->buffer_tail;
 
-	d = ctx->head_descriptor;
-	tail = ctx->tail_descriptor;
-	end = ctx->buffer + ctx->buffer_size / sizeof(*d);
+	if (z * sizeof(*d) > desc->buffer_size)
+		return NULL;
 
-	if (d + z <= tail) {
-		goto has_space;
-	} else if (d > tail && d + z <= end) {
-		goto has_space;
-	} else if (d > tail && ctx->buffer + z <= tail) {
-		d = ctx->buffer;
-		goto has_space;
+	if (z * sizeof(*d) > desc->buffer_size - desc->used) {
+		/* No room for the descriptor in this buffer, so advance to the
+		 * next one. */
+
+		if (desc->list.next == &ctx->buffer_list) {
+			/* If there is no free buffer next in the list,
+			 * allocate one. */
+			if (context_add_buffer(ctx) < 0)
+				return NULL;
+		}
+		desc = list_entry(desc->list.next,
+				struct descriptor_buffer, list);
+		ctx->buffer_tail = desc;
 	}
 
-	return NULL;
-
- has_space:
+	d = desc->buffer + desc->used / sizeof(*d);
 	memset(d, 0, z * sizeof(*d));
-	*d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
+	*d_bus = desc->buffer_bus + desc->used;
 
 	return d;
 }
@@ -566,7 +640,7 @@ static void context_run(struct context *
 	struct fw_ohci *ohci = ctx->ohci;
 
 	reg_write(ohci, COMMAND_PTR(ctx->regs),
-		  le32_to_cpu(ctx->tail_descriptor_last->branch_address));
+		  le32_to_cpu(ctx->last->branch_address));
 	reg_write(ohci, CONTROL_CLEAR(ctx->regs), ~0);
 	reg_write(ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN | extra);
 	flush_writes(ohci);
@@ -576,15 +650,13 @@ static void context_append(struct contex
 			   struct descriptor *d, int z, int extra)
 {
 	dma_addr_t d_bus;
+	struct descriptor_buffer *desc = ctx->buffer_tail;
 
-	d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
-
-	ctx->head_descriptor = d + z + extra;
-	ctx->prev_descriptor->branch_address = cpu_to_le32(d_bus | z);
-	ctx->prev_descriptor = find_branch_descriptor(d, z);
+	d_bus = desc->buffer_bus + (d - desc->buffer) * sizeof(*d);
 
-	dma_sync_single_for_device(ctx->ohci->card.device, ctx->buffer_bus,
-				   ctx->buffer_size, DMA_TO_DEVICE);
+	desc->used += (z + extra) * sizeof(*d);
+	ctx->prev->branch_address = cpu_to_le32(d_bus | z);
+	ctx->prev = find_branch_descriptor(d, z);
 
 	reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_WAKE);
 	flush_writes(ctx->ohci);
@@ -1078,6 +1150,13 @@ static irqreturn_t irq_handler(int irq, 
 	if (unlikely(event & OHCI1394_postedWriteErr))
 		fw_error("PCI posted write error\n");
 
+	if (unlikely(event & OHCI1394_cycleTooLong)) {
+		if (printk_ratelimit())
+			fw_notify("isochronous cycle too long\n");
+		reg_write(ohci, OHCI1394_LinkControlSet,
+			  OHCI1394_LinkControl_cycleMaster);
+	}
+
 	if (event & OHCI1394_cycle64Seconds) {
 		cycle_time = reg_read(ohci, OHCI1394_IsochronousCycleTimer);
 		if ((cycle_time & 0x80000000) == 0)
@@ -1151,8 +1230,8 @@ static int ohci_enable(struct fw_card *c
 		  OHCI1394_RQPkt | OHCI1394_RSPkt |
 		  OHCI1394_reqTxComplete | OHCI1394_respTxComplete |
 		  OHCI1394_isochRx | OHCI1394_isochTx |
-		  OHCI1394_postedWriteErr | OHCI1394_cycle64Seconds |
-		  OHCI1394_masterIntEnable);
+		  OHCI1394_postedWriteErr | OHCI1394_cycleTooLong |
+		  OHCI1394_cycle64Seconds | OHCI1394_masterIntEnable);
 
 	/* Activate link_on bit and contender bit in our self ID packets.*/
 	if (ohci_update_phy_reg(card, 4, 0,
@@ -1408,9 +1487,13 @@ static int handle_ir_dualbuffer_packet(s
 	void *p, *end;
 	int i;
 
-	if (db->first_res_count > 0 && db->second_res_count > 0)
-		/* This descriptor isn't done yet, stop iteration. */
-		return 0;
+	if (db->first_res_count > 0 && db->second_res_count > 0) {
+		if (ctx->excess_bytes <= le16_to_cpu(db->second_req_count)) {
+			/* This descriptor isn't done yet, stop iteration. */
+			return 0;
+		}
+		ctx->excess_bytes -= le16_to_cpu(db->second_req_count);
+	}
 
 	header_length = le16_to_cpu(db->first_req_count) -
 		le16_to_cpu(db->first_res_count);
@@ -1429,11 +1512,15 @@ static int handle_ir_dualbuffer_packet(s
 		*(u32 *) (ctx->header + i) = __swab32(*(u32 *) (p + 4));
 		memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4);
 		i += ctx->base.header_size;
+		ctx->excess_bytes +=
+			(le32_to_cpu(*(u32 *)(p + 4)) >> 16) & 0xffff;
 		p += ctx->base.header_size + 4;
 	}
-
 	ctx->header_length = i;
 
+	ctx->excess_bytes -= le16_to_cpu(db->second_req_count) -
+		le16_to_cpu(db->second_res_count);
+
 	if (le16_to_cpu(db->control) & DESCRIPTOR_IRQ_ALWAYS) {
 		ir_header = (__le32 *) (db + 1);
 		ctx->base.callback(&ctx->base,
@@ -1452,24 +1539,24 @@ static int handle_ir_packet_per_buffer(s
 {
 	struct iso_context *ctx =
 		container_of(context, struct iso_context, context);
-	struct descriptor *pd = d + 1;
+	struct descriptor *pd;
 	__le32 *ir_header;
-	size_t header_length;
-	void *p, *end;
-	int i, z;
+	void *p;
+	int i;
 
-	if (pd->res_count == pd->req_count)
+	for (pd = d; pd <= last; pd++) {
+		if (pd->transfer_status)
+			break;
+	}
+	if (pd > last)
 		/* Descriptor(s) not done yet, stop iteration */
 		return 0;
 
-	header_length = le16_to_cpu(d->req_count);
-
 	i   = ctx->header_length;
-	z   = le32_to_cpu(pd->branch_address) & 0xf;
-	p   = d + z;
-	end = p + header_length;
+	p   = last + 1;
 
-	while (p < end && i + ctx->base.header_size <= PAGE_SIZE) {
+	if (ctx->base.header_size > 0 &&
+			i + ctx->base.header_size <= PAGE_SIZE) {
 		/*
 		 * The iso header is byteswapped to little endian by
 		 * the controller, but the remaining header quadlets
@@ -1478,14 +1565,11 @@ static int handle_ir_packet_per_buffer(s
 		 */
 		*(u32 *) (ctx->header + i) = __swab32(*(u32 *) (p + 4));
 		memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4);
-		i += ctx->base.header_size;
-		p += ctx->base.header_size + 4;
+		ctx->header_length += ctx->base.header_size;
 	}
 
-	ctx->header_length = i;
-
-	if (le16_to_cpu(pd->control) & DESCRIPTOR_IRQ_ALWAYS) {
-		ir_header = (__le32 *) (d + z);
+	if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) {
+		ir_header = (__le32 *) p;
 		ctx->base.callback(&ctx->base,
 				   le32_to_cpu(ir_header[0]) & 0xffff,
 				   ctx->header_length, ctx->header,
@@ -1493,7 +1577,6 @@ static int handle_ir_packet_per_buffer(s
 		ctx->header_length = 0;
 	}
 
-
 	return 1;
 }
 
@@ -1559,8 +1642,7 @@ ohci_allocate_iso_context(struct fw_card
 	if (ctx->header == NULL)
 		goto out;
 
-	retval = context_init(&ctx->context, ohci, ISO_BUFFER_SIZE,
-			      regs, callback);
+	retval = context_init(&ctx->context, ohci, regs, callback);
 	if (retval < 0)
 		goto out_with_header;
 
@@ -1775,19 +1857,6 @@ ohci_queue_iso_receive_dualbuffer(struct
 	 * packet, retransmit or terminate..
 	 */
 
-	if (packet->skip) {
-		d = context_get_descriptors(&ctx->context, 2, &d_bus);
-		if (d == NULL)
-			return -ENOMEM;
-
-		db = (struct db_descriptor *) d;
-		db->control = cpu_to_le16(DESCRIPTOR_STATUS |
-					  DESCRIPTOR_BRANCH_ALWAYS |
-					  DESCRIPTOR_WAIT);
-		db->first_size = cpu_to_le16(ctx->base.header_size + 4);
-		context_append(&ctx->context, d, 2, 0);
-	}
-
 	p = packet;
 	z = 2;
 
@@ -1815,11 +1884,18 @@ ohci_queue_iso_receive_dualbuffer(struct
 		db->control = cpu_to_le16(DESCRIPTOR_STATUS |
 					  DESCRIPTOR_BRANCH_ALWAYS);
 		db->first_size = cpu_to_le16(ctx->base.header_size + 4);
-		db->first_req_count = cpu_to_le16(header_size);
+		if (p->skip && rest == p->payload_length) {
+			db->control |= cpu_to_le16(DESCRIPTOR_WAIT);
+			db->first_req_count = db->first_size;
+		} else {
+			db->first_req_count = cpu_to_le16(header_size);
+		}
 		db->first_res_count = db->first_req_count;
 		db->first_buffer = cpu_to_le32(d_bus + sizeof(*db));
 
-		if (offset + rest < PAGE_SIZE)
+		if (p->skip && rest == p->payload_length)
+			length = 4;
+		else if (offset + rest < PAGE_SIZE)
 			length = rest;
 		else
 			length = PAGE_SIZE - offset;
@@ -1835,7 +1911,8 @@ ohci_queue_iso_receive_dualbuffer(struct
 		context_append(&ctx->context, d, z, header_z);
 		offset = (offset + length) & ~PAGE_MASK;
 		rest -= length;
-		page++;
+		if (offset == 0)
+			page++;
 	}
 
 	return 0;
@@ -1849,67 +1926,70 @@ ohci_queue_iso_receive_packet_per_buffer
 {
 	struct iso_context *ctx = container_of(base, struct iso_context, base);
 	struct descriptor *d = NULL, *pd = NULL;
-	struct fw_iso_packet *p;
+	struct fw_iso_packet *p = packet;
 	dma_addr_t d_bus, page_bus;
 	u32 z, header_z, rest;
-	int i, page, offset, packet_count, header_size;
-
-	if (packet->skip) {
-		d = context_get_descriptors(&ctx->context, 1, &d_bus);
-		if (d == NULL)
-			return -ENOMEM;
-
-		d->control = cpu_to_le16(DESCRIPTOR_STATUS |
-					 DESCRIPTOR_INPUT_LAST |
-					 DESCRIPTOR_BRANCH_ALWAYS |
-					 DESCRIPTOR_WAIT);
-		context_append(&ctx->context, d, 1, 0);
-	}
-
-	/* one descriptor for header, one for payload */
-	/* FIXME: handle cases where we need multiple desc. for payload */
-	z = 2;
-	p = packet;
+	int i, j, length;
+	int page, offset, packet_count, header_size, payload_per_buffer;
 
 	/*
 	 * The OHCI controller puts the status word in the
 	 * buffer too, so we need 4 extra bytes per packet.
 	 */
 	packet_count = p->header_length / ctx->base.header_size;
-	header_size  = packet_count * (ctx->base.header_size + 4);
+	header_size  = ctx->base.header_size + 4;
 
 	/* Get header size in number of descriptors. */
 	header_z = DIV_ROUND_UP(header_size, sizeof(*d));
 	page     = payload >> PAGE_SHIFT;
 	offset   = payload & ~PAGE_MASK;
-	rest     = p->payload_length;
+	payload_per_buffer = p->payload_length / packet_count;
 
 	for (i = 0; i < packet_count; i++) {
 		/* d points to the header descriptor */
+		z = DIV_ROUND_UP(payload_per_buffer + offset, PAGE_SIZE) + 1;
 		d = context_get_descriptors(&ctx->context,
-					    z + header_z, &d_bus);
+				z + header_z, &d_bus);
 		if (d == NULL)
 			return -ENOMEM;
 
-		d->control      = cpu_to_le16(DESCRIPTOR_INPUT_MORE);
+		d->control      = cpu_to_le16(DESCRIPTOR_STATUS |
+					      DESCRIPTOR_INPUT_MORE);
+		if (p->skip && i == 0)
+			d->control |= cpu_to_le16(DESCRIPTOR_WAIT);
 		d->req_count    = cpu_to_le16(header_size);
 		d->res_count    = d->req_count;
+		d->transfer_status = 0;
 		d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d)));
 
-		/* pd points to the payload descriptor */
-		pd = d + 1;
+		rest = payload_per_buffer;
+		for (j = 1; j < z; j++) {
+			pd = d + j;
+			pd->control = cpu_to_le16(DESCRIPTOR_STATUS |
+						  DESCRIPTOR_INPUT_MORE);
+
+			if (offset + rest < PAGE_SIZE)
+				length = rest;
+			else
+				length = PAGE_SIZE - offset;
+			pd->req_count = cpu_to_le16(length);
+			pd->res_count = pd->req_count;
+			pd->transfer_status = 0;
+
+			page_bus = page_private(buffer->pages[page]);
+			pd->data_address = cpu_to_le32(page_bus + offset);
+
+			offset = (offset + length) & ~PAGE_MASK;
+			rest -= length;
+			if (offset == 0)
+				page++;
+		}
 		pd->control = cpu_to_le16(DESCRIPTOR_STATUS |
 					  DESCRIPTOR_INPUT_LAST |
 					  DESCRIPTOR_BRANCH_ALWAYS);
-		if (p->interrupt)
+		if (p->interrupt && i == packet_count - 1)
 			pd->control |= cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS);
 
-		pd->req_count = cpu_to_le16(rest);
-		pd->res_count = pd->req_count;
-
-		page_bus = page_private(buffer->pages[page]);
-		pd->data_address = cpu_to_le32(page_bus + offset);
-
 		context_append(&ctx->context, d, z, header_z);
 	}
 
@@ -1923,16 +2003,22 @@ ohci_queue_iso(struct fw_iso_context *ba
 	       unsigned long payload)
 {
 	struct iso_context *ctx = container_of(base, struct iso_context, base);
+	unsigned long flags;
+	int retval;
 
+	spin_lock_irqsave(&ctx->context.ohci->lock, flags);
 	if (base->type == FW_ISO_CONTEXT_TRANSMIT)
-		return ohci_queue_iso_transmit(base, packet, buffer, payload);
+		retval = ohci_queue_iso_transmit(base, packet, buffer, payload);
 	else if (ctx->context.ohci->version >= OHCI_VERSION_1_1)
-		return ohci_queue_iso_receive_dualbuffer(base, packet,
+		retval = ohci_queue_iso_receive_dualbuffer(base, packet,
 							 buffer, payload);
 	else
-		return ohci_queue_iso_receive_packet_per_buffer(base, packet,
+		retval = ohci_queue_iso_receive_packet_per_buffer(base, packet,
 								buffer,
 								payload);
+	spin_unlock_irqrestore(&ctx->context.ohci->lock, flags);
+
+	return retval;
 }
 
 static const struct fw_card_driver ohci_driver = {
@@ -2004,10 +2090,10 @@ pci_probe(struct pci_dev *dev, const str
 	ar_context_init(&ohci->ar_response_ctx, ohci,
 			OHCI1394_AsRspRcvContextControlSet);
 
-	context_init(&ohci->at_request_ctx, ohci, AT_BUFFER_SIZE,
+	context_init(&ohci->at_request_ctx, ohci,
 		     OHCI1394_AsReqTrContextControlSet, handle_at_packet);
 
-	context_init(&ohci->at_response_ctx, ohci, AT_BUFFER_SIZE,
+	context_init(&ohci->at_response_ctx, ohci,
 		     OHCI1394_AsRspTrContextControlSet, handle_at_packet);
 
 	reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, ~0);
diff -Naurp linux-2.6-git/drivers/firewire/fw-sbp2.c firewire-git/drivers/firewire/fw-sbp2.c
--- linux-2.6-git/drivers/firewire/fw-sbp2.c	2008-01-28 10:57:54.000000000 -0500
+++ firewire-git/drivers/firewire/fw-sbp2.c	2008-01-28 10:58:18.000000000 -0500
@@ -140,26 +140,32 @@ struct sbp2_logical_unit {
 struct sbp2_target {
 	struct kref kref;
 	struct fw_unit *unit;
+	struct list_head lu_list;
 
 	u64 management_agent_address;
 	int directory_id;
 	int node_id;
 	int address_high;
-
-	unsigned workarounds;
-	struct list_head lu_list;
+	unsigned int workarounds;
+	unsigned int mgt_orb_timeout;
 };
 
-#define SBP2_MAX_SG_ELEMENT_LENGTH	0xf000
-#define SBP2_MAX_SECTORS		255	/* Max sectors supported */
-#define SBP2_ORB_TIMEOUT		2000	/* Timeout in ms */
-
+/*
+ * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be
+ * provided in the config rom. Most devices do provide a value, which
+ * we'll use for login management orbs, but with some sane limits.
+ */
+#define SBP2_MIN_LOGIN_ORB_TIMEOUT	5000U	/* Timeout in ms */
+#define SBP2_MAX_LOGIN_ORB_TIMEOUT	40000U	/* Timeout in ms */
+#define SBP2_ORB_TIMEOUT		2000U	/* Timeout in ms */
 #define SBP2_ORB_NULL			0x80000000
+#define SBP2_MAX_SG_ELEMENT_LENGTH	0xf000
 
 #define SBP2_DIRECTION_TO_MEDIA		0x0
 #define SBP2_DIRECTION_FROM_MEDIA	0x1
 
 /* Unit directory keys */
+#define SBP2_CSR_UNIT_CHARACTERISTICS	0x3a
 #define SBP2_CSR_FIRMWARE_REVISION	0x3c
 #define SBP2_CSR_LOGICAL_UNIT_NUMBER	0x14
 #define SBP2_CSR_LOGICAL_UNIT_DIRECTORY	0xd4
@@ -288,7 +294,7 @@ struct sbp2_command_orb {
 static const struct {
 	u32 firmware_revision;
 	u32 model;
-	unsigned workarounds;
+	unsigned int workarounds;
 } sbp2_workarounds_table[] = {
 	/* DViCO Momobay CX-1 with TSB42AA9 bridge */ {
 		.firmware_revision	= 0x002800,
@@ -489,6 +495,7 @@ sbp2_send_management_orb(struct sbp2_log
 {
 	struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
 	struct sbp2_management_orb *orb;
+	unsigned int timeout;
 	int retval = -ENOMEM;
 
 	orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
@@ -516,9 +523,13 @@ sbp2_send_management_orb(struct sbp2_log
 	orb->request.status_fifo.low  = lu->address_handler.offset;
 
 	if (function == SBP2_LOGIN_REQUEST) {
+		/* Ask for 2^2 == 4 seconds reconnect grace period */
 		orb->request.misc |=
-			MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login) |
-			MANAGEMENT_ORB_RECONNECT(0);
+			MANAGEMENT_ORB_RECONNECT(2) |
+			MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login);
+		timeout = lu->tgt->mgt_orb_timeout;
+	} else {
+		timeout = SBP2_ORB_TIMEOUT;
 	}
 
 	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
@@ -535,8 +546,7 @@ sbp2_send_management_orb(struct sbp2_log
 	sbp2_send_orb(&orb->base, lu, node_id, generation,
 		      lu->tgt->management_agent_address);
 
-	wait_for_completion_timeout(&orb->done,
-				    msecs_to_jiffies(SBP2_ORB_TIMEOUT));
+	wait_for_completion_timeout(&orb->done, msecs_to_jiffies(timeout));
 
 	retval = -EIO;
 	if (sbp2_cancel_orbs(lu) == 0) {
@@ -608,13 +618,17 @@ static void sbp2_release_target(struct k
 	struct sbp2_logical_unit *lu, *next;
 	struct Scsi_Host *shost =
 		container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
+	struct fw_device *device = fw_device(tgt->unit->device.parent);
 
 	list_for_each_entry_safe(lu, next, &tgt->lu_list, link) {
 		if (lu->sdev)
 			scsi_remove_device(lu->sdev);
 
-		sbp2_send_management_orb(lu, tgt->node_id, lu->generation,
-				SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
+		if (!fw_device_is_shutdown(device))
+			sbp2_send_management_orb(lu, tgt->node_id,
+					lu->generation, SBP2_LOGOUT_REQUEST,
+					lu->login_id, NULL);
+
 		fw_core_remove_address_handler(&lu->address_handler);
 		list_del(&lu->link);
 		kfree(lu);
@@ -628,6 +642,21 @@ static void sbp2_release_target(struct k
 
 static struct workqueue_struct *sbp2_wq;
 
+/*
+ * Always get the target's kref when scheduling work on one its units.
+ * Each workqueue job is responsible to call sbp2_target_put() upon return.
+ */
+static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
+{
+	if (queue_delayed_work(sbp2_wq, &lu->work, delay))
+		kref_get(&lu->tgt->kref);
+}
+
+static void sbp2_target_put(struct sbp2_target *tgt)
+{
+	kref_put(&tgt->kref, sbp2_release_target);
+}
+
 static void sbp2_reconnect(struct work_struct *work);
 
 static void sbp2_login(struct work_struct *work)
@@ -643,22 +672,19 @@ static void sbp2_login(struct work_struc
 	struct sbp2_login_response response;
 	int generation, node_id, local_node_id;
 
-	generation    = device->card->generation;
-	node_id       = device->node->node_id;
-	local_node_id = device->card->local_node->node_id;
+	generation    = device->generation;
+	smp_rmb();    /* node_id must not be older than generation */
+	node_id       = device->node_id;
+	local_node_id = device->card->node_id;
 
 	if (sbp2_send_management_orb(lu, node_id, generation,
 				SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
-		if (lu->retries++ < 5) {
-			if (queue_delayed_work(sbp2_wq, &lu->work,
-					       DIV_ROUND_UP(HZ, 5)))
-				kref_get(&lu->tgt->kref);
-		} else {
+		if (lu->retries++ < 5)
+			sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
+		else
 			fw_error("failed to login to %s LUN %04x\n",
 				 unit->device.bus_id, lu->lun);
-		}
-		kref_put(&lu->tgt->kref, sbp2_release_target);
-		return;
+		goto out;
 	}
 
 	lu->generation        = generation;
@@ -689,18 +715,47 @@ static void sbp2_login(struct work_struc
 	sdev = __scsi_add_device(shost, 0, 0,
 				 scsilun_to_int(&eight_bytes_lun), lu);
 	if (IS_ERR(sdev)) {
-		sbp2_send_management_orb(lu, node_id, generation,
-				SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
 		/*
-		 * Set this back to sbp2_login so we fall back and
-		 * retry login on bus reset.
+		 * The most frequent cause for __scsi_add_device() to fail
+		 * is a bus reset while sending the SCSI INQUIRY.  Try again.
+		 */
+		goto out_logout_login;
+
+	} else if (sdev->sdev_state == SDEV_OFFLINE) {
+		/*
+		 * FIXME:  We are unable to perform reconnects while in
+		 * sbp2_login().  Therefore __scsi_add_device() will get
+		 * into trouble if a bus reset happens in parallel.
+		 * It will either fail (that's OK, see above) or take sdev
+		 * offline.  Here is a crude workaround for the latter.
 		 */
-		PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
+		scsi_device_put(sdev);
+		scsi_remove_device(sdev);
+		goto out_logout_login;
+
 	} else {
+		/*
+		 * Can you believe it?  Everything went well.
+		 */
 		lu->sdev = sdev;
 		scsi_device_put(sdev);
+		goto out;
 	}
-	kref_put(&lu->tgt->kref, sbp2_release_target);
+
+ out_logout_login:
+	smp_rmb(); /* generation may have changed */
+	generation = device->generation;
+	smp_rmb(); /* node_id must not be older than generation */
+
+	sbp2_send_management_orb(lu, device->node_id, generation,
+				 SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
+	/*
+	 * If a bus reset happened, sbp2_update will have requeued
+	 * lu->work already.  Reset the work from reconnect to login.
+	 */
+	PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
+ out:
+	sbp2_target_put(lu->tgt);
 }
 
 static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
@@ -750,6 +805,7 @@ static int sbp2_scan_unit_dir(struct sbp
 {
 	struct fw_csr_iterator ci;
 	int key, value;
+	unsigned int timeout;
 
 	fw_csr_iterator_init(&ci, directory);
 	while (fw_csr_iterator_next(&ci, &key, &value)) {
@@ -772,6 +828,21 @@ static int sbp2_scan_unit_dir(struct sbp
 			*firmware_revision = value;
 			break;
 
+		case SBP2_CSR_UNIT_CHARACTERISTICS:
+			/* the timeout value is stored in 500ms units */
+			timeout = ((unsigned int) value >> 8 & 0xff) * 500;
+			timeout = max(timeout, SBP2_MIN_LOGIN_ORB_TIMEOUT);
+			tgt->mgt_orb_timeout =
+				  min(timeout, SBP2_MAX_LOGIN_ORB_TIMEOUT);
+
+			if (timeout > tgt->mgt_orb_timeout)
+				fw_notify("%s: config rom contains %ds "
+					  "management ORB timeout, limiting "
+					  "to %ds\n", tgt->unit->device.bus_id,
+					  timeout / 1000,
+					  tgt->mgt_orb_timeout / 1000);
+			break;
+
 		case SBP2_CSR_LOGICAL_UNIT_NUMBER:
 			if (sbp2_add_logical_unit(tgt, value) < 0)
 				return -ENOMEM;
@@ -790,7 +861,7 @@ static void sbp2_init_workarounds(struct
 				  u32 firmware_revision)
 {
 	int i;
-	unsigned w = sbp2_param_workarounds;
+	unsigned int w = sbp2_param_workarounds;
 
 	if (w)
 		fw_notify("Please notify linux1394-devel at lists.sourceforge.net "
@@ -865,18 +936,13 @@ static int sbp2_probe(struct device *dev
 
 	get_device(&unit->device);
 
-	/*
-	 * We schedule work to do the login so we can easily
-	 * reschedule retries. Always get the ref before scheduling
-	 * work.
-	 */
+	/* Do the login in a workqueue so we can easily reschedule retries. */
 	list_for_each_entry(lu, &tgt->lu_list, link)
-		if (queue_delayed_work(sbp2_wq, &lu->work, 0))
-			kref_get(&tgt->kref);
+		sbp2_queue_work(lu, 0);
 	return 0;
 
  fail_tgt_put:
-	kref_put(&tgt->kref, sbp2_release_target);
+	sbp2_target_put(tgt);
 	return -ENOMEM;
 
  fail_shost_put:
@@ -889,7 +955,7 @@ static int sbp2_remove(struct device *de
 	struct fw_unit *unit = fw_unit(dev);
 	struct sbp2_target *tgt = unit->device.driver_data;
 
-	kref_put(&tgt->kref, sbp2_release_target);
+	sbp2_target_put(tgt);
 	return 0;
 }
 
@@ -901,9 +967,10 @@ static void sbp2_reconnect(struct work_s
 	struct fw_device *device = fw_device(unit->device.parent);
 	int generation, node_id, local_node_id;
 
-	generation    = device->card->generation;
-	node_id       = device->node->node_id;
-	local_node_id = device->card->local_node->node_id;
+	generation    = device->generation;
+	smp_rmb();    /* node_id must not be older than generation */
+	node_id       = device->node_id;
+	local_node_id = device->card->node_id;
 
 	if (sbp2_send_management_orb(lu, node_id, generation,
 				     SBP2_RECONNECT_REQUEST,
@@ -915,10 +982,8 @@ static void sbp2_reconnect(struct work_s
 			lu->retries = 0;
 			PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
 		}
-		if (queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)))
-			kref_get(&lu->tgt->kref);
-		kref_put(&lu->tgt->kref, sbp2_release_target);
-		return;
+		sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
+		goto out;
 	}
 
 	lu->generation        = generation;
@@ -930,8 +995,8 @@ static void sbp2_reconnect(struct work_s
 
 	sbp2_agent_reset(lu);
 	sbp2_cancel_orbs(lu);
-
-	kref_put(&lu->tgt->kref, sbp2_release_target);
+ out:
+	sbp2_target_put(lu->tgt);
 }
 
 static void sbp2_update(struct fw_unit *unit)
@@ -947,8 +1012,7 @@ static void sbp2_update(struct fw_unit *
 	 */
 	list_for_each_entry(lu, &tgt->lu_list, link) {
 		lu->retries = 0;
-		if (queue_delayed_work(sbp2_wq, &lu->work, 0))
-			kref_get(&tgt->kref);
+		sbp2_queue_work(lu, 0);
 	}
 }
 
@@ -1103,9 +1167,9 @@ sbp2_map_scatterlist(struct sbp2_command
 	 * elements larger than 65535 bytes, some IOMMUs may merge sg elements
 	 * during DMA mapping, and Linux currently doesn't prevent this.
 	 */
-	for (i = 0, j = 0; i < count; i++) {
-		sg_len = sg_dma_len(sg + i);
-		sg_addr = sg_dma_address(sg + i);
+	for (i = 0, j = 0; i < count; i++, sg = sg_next(sg)) {
+		sg_len = sg_dma_len(sg);
+		sg_addr = sg_dma_address(sg);
 		while (sg_len) {
 			/* FIXME: This won't get us out of the pinch. */
 			if (unlikely(j >= ARRAY_SIZE(orb->page_table))) {
@@ -1158,7 +1222,7 @@ static int sbp2_scsi_queuecommand(struct
 	struct sbp2_logical_unit *lu = cmd->device->hostdata;
 	struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
 	struct sbp2_command_orb *orb;
-	unsigned max_payload;
+	unsigned int max_payload;
 	int retval = SCSI_MLQUEUE_HOST_BUSY;
 
 	/*
diff -Naurp linux-2.6-git/drivers/firewire/fw-topology.c firewire-git/drivers/firewire/fw-topology.c
--- linux-2.6-git/drivers/firewire/fw-topology.c	2008-01-01 22:50:33.000000000 -0500
+++ firewire-git/drivers/firewire/fw-topology.c	2008-01-25 12:41:22.000000000 -0500
@@ -518,6 +518,11 @@ fw_core_handle_bus_reset(struct fw_card 
 		card->bm_retries = 0;
 
 	card->node_id = node_id;
+	/*
+	 * Update node_id before generation to prevent anybody from using
+	 * a stale node_id together with a current generation.
+	 */
+	smp_wmb();
 	card->generation = generation;
 	card->reset_jiffies = jiffies;
 	schedule_delayed_work(&card->work, 0);
diff -Naurp linux-2.6-git/drivers/firewire/fw-transaction.c firewire-git/drivers/firewire/fw-transaction.c
--- linux-2.6-git/drivers/firewire/fw-transaction.c	2008-01-01 22:50:33.000000000 -0500
+++ firewire-git/drivers/firewire/fw-transaction.c	2008-01-25 12:41:24.000000000 -0500
@@ -153,7 +153,7 @@ fw_fill_request(struct fw_packet *packet
 	int ext_tcode;
 
 	if (tcode > 0x10) {
-		ext_tcode = tcode - 0x10;
+		ext_tcode = tcode & ~0x10;
 		tcode = TCODE_LOCK_REQUEST;
 	} else
 		ext_tcode = 0;
@@ -650,7 +650,7 @@ fw_core_handle_request(struct fw_card *c
 		 HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) | p->header[2];
 	tcode       = HEADER_GET_TCODE(p->header[0]);
 	destination = HEADER_GET_DESTINATION(p->header[0]);
-	source      = HEADER_GET_SOURCE(p->header[0]);
+	source      = HEADER_GET_SOURCE(p->header[1]);
 
 	spin_lock_irqsave(&address_handler_lock, flags);
 	handler = lookup_enclosing_address_handler(&address_handler_list,

linux-2.6-gelic-fixups.patch:

--- NEW FILE linux-2.6-gelic-fixups.patch ---
diff -u b/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
--- b/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -48,27 +48,19 @@
 #include "ps3_gelic_net.h"
 
 #define DRV_NAME "Gelic Network Driver"
-#define DRV_VERSION "1.0"
+#define DRV_VERSION "1.1"
 
 MODULE_AUTHOR("SCE Inc.");
 MODULE_DESCRIPTION("Gelic Network driver");
 MODULE_LICENSE("GPL");
 
-static inline struct device *ctodev(struct gelic_net_card *card)
-{
-	return &card->dev->core;
-}
-static inline unsigned int bus_id(struct gelic_net_card *card)
-{
-	return card->dev->bus_id;
-}
-static inline unsigned int dev_id(struct gelic_net_card *card)
-{
-	return card->dev->dev_id;
-}
+
+static inline void gelic_card_enable_rxdmac(struct gelic_card *card);
+static inline void gelic_card_disable_rxdmac(struct gelic_card *card);
+static inline void gelic_card_disable_txdmac(struct gelic_card *card);
 
 /* set irq_mask */
-static int gelic_net_set_irq_mask(struct gelic_net_card *card, u64 mask)
+int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
 {
 	int status;
 
@@ -76,54 +68,108 @@
 					    mask, 0);
 	if (status)
 		dev_info(ctodev(card),
-			 "lv1_net_set_interrupt_mask failed %d\n", status);
+			 "%s failed %d\n", __func__, status);
 	return status;
 }
-static inline void gelic_net_rx_irq_on(struct gelic_net_card *card)
+
+static inline void gelic_card_rx_irq_on(struct gelic_card *card)
+{
+	card->irq_mask |= GELIC_CARD_RXINT;
+	gelic_card_set_irq_mask(card, card->irq_mask);
+}
+static inline void gelic_card_rx_irq_off(struct gelic_card *card)
 {
-	gelic_net_set_irq_mask(card, card->ghiintmask | GELIC_NET_RXINT);
+	card->irq_mask &= ~GELIC_CARD_RXINT;
+	gelic_card_set_irq_mask(card, card->irq_mask);
 }
-static inline void gelic_net_rx_irq_off(struct gelic_net_card *card)
+
+static void gelic_card_get_ether_port_status(struct gelic_card *card,
+					     int inform)
 {
-	gelic_net_set_irq_mask(card, card->ghiintmask & ~GELIC_NET_RXINT);
+	u64 v2;
+	struct net_device *ether_netdev;
+
+	lv1_net_control(bus_id(card), dev_id(card),
+			GELIC_LV1_GET_ETH_PORT_STATUS,
+			GELIC_LV1_VLAN_TX_ETHERNET, 0, 0,
+			&card->ether_port_status, &v2);
+
+	if (inform) {
+		ether_netdev = card->netdev[GELIC_PORT_ETHERNET];
+		if (card->ether_port_status & GELIC_LV1_ETHER_LINK_UP)
+			netif_carrier_on(ether_netdev);
+		else
+			netif_carrier_off(ether_netdev);
+	}
 }
+
+void gelic_card_up(struct gelic_card *card)
+{
+	pr_debug("%s: called\n", __func__);
+	down(&card->updown_lock);
+	if (atomic_inc_return(&card->users) == 1) {
+		pr_debug("%s: real do\n", __func__);
+		/* enable irq */
+		gelic_card_set_irq_mask(card, card->irq_mask);
+		/* start rx */
+		gelic_card_enable_rxdmac(card);
+
+		napi_enable(&card->napi);
+	}
+	up(&card->updown_lock);
+	pr_debug("%s: done\n", __func__);
+}
+
+void gelic_card_down(struct gelic_card *card)
+{
+	u64 mask;
+	pr_debug("%s: called\n", __func__);
+	down(&card->updown_lock);
+	if (atomic_dec_if_positive(&card->users) == 0) {
+		pr_debug("%s: real do\n", __func__);
+		napi_disable(&card->napi);
+		/*
+		 * Disable irq. Wireless interrupts will
+		 * be disabled later if any
+		 */
+		mask = card->irq_mask & (GELIC_CARD_WLAN_EVENT_RECEIVED |
+					 GELIC_CARD_WLAN_COMMAND_COMPLETED);
+		gelic_card_set_irq_mask(card, mask);
+		/* stop rx */
+		gelic_card_disable_rxdmac(card);
+		/* stop tx */
+		gelic_card_disable_txdmac(card);
+	}
+	up(&card->updown_lock);
+	pr_debug("%s: done\n", __func__);
+}
+
 /**
- * gelic_net_get_descr_status -- returns the status of a descriptor
+ * gelic_descr_get_status -- returns the status of a descriptor
  * @descr: descriptor to look at
  *
  * returns the status as in the dmac_cmd_status field of the descriptor
  */
-static enum gelic_net_descr_status
-gelic_net_get_descr_status(struct gelic_net_descr *descr)
+static enum gelic_descr_dma_status
+gelic_descr_get_status(struct gelic_descr *descr)
 {
-	u32 cmd_status;
-
-	cmd_status = descr->dmac_cmd_status;
-	cmd_status >>= GELIC_NET_DESCR_IND_PROC_SHIFT;
-	return cmd_status;
+	return be32_to_cpu(descr->dmac_cmd_status) & GELIC_DESCR_DMA_STAT_MASK;
 }
 
 /**
- * gelic_net_set_descr_status -- sets the status of a descriptor
+ * gelic_descr_set_status -- sets the status of a descriptor
  * @descr: descriptor to change
  * @status: status to set in the descriptor
  *
  * changes the status to the specified value. Doesn't change other bits
  * in the status
  */
-static void gelic_net_set_descr_status(struct gelic_net_descr *descr,
-				       enum gelic_net_descr_status status)
+static void gelic_descr_set_status(struct gelic_descr *descr,
+				   enum gelic_descr_dma_status status)
 {
-	u32 cmd_status;
-
-	/* read the status */
-	cmd_status = descr->dmac_cmd_status;
-	/* clean the upper 4 bits */
-	cmd_status &= GELIC_NET_DESCR_IND_PROC_MASKO;
-	/* add the status to it */
-	cmd_status |= ((u32)status) << GELIC_NET_DESCR_IND_PROC_SHIFT;
-	/* and write it back */
-	descr->dmac_cmd_status = cmd_status;
+	descr->dmac_cmd_status = cpu_to_be32(status |
+			(be32_to_cpu(descr->dmac_cmd_status) &
+			 ~GELIC_DESCR_DMA_STAT_MASK));
 	/*
 	 * dma_cmd_status field is used to indicate whether the descriptor
 	 * is valid or not.
@@ -134,24 +180,24 @@
 }
 
 /**
- * gelic_net_free_chain - free descriptor chain
+ * gelic_card_free_chain - free descriptor chain
  * @card: card structure
  * @descr_in: address of desc
  */
-static void gelic_net_free_chain(struct gelic_net_card *card,
-				 struct gelic_net_descr *descr_in)
+static void gelic_card_free_chain(struct gelic_card *card,
+				  struct gelic_descr *descr_in)
 {
-	struct gelic_net_descr *descr;
+	struct gelic_descr *descr;
 
 	for (descr = descr_in; descr && descr->bus_addr; descr = descr->next) {
 		dma_unmap_single(ctodev(card), descr->bus_addr,
-				 GELIC_NET_DESCR_SIZE, DMA_BIDIRECTIONAL);
+				 GELIC_DESCR_SIZE, DMA_BIDIRECTIONAL);
 		descr->bus_addr = 0;
 	}
 }
 
 /**
- * gelic_net_init_chain - links descriptor chain
[...2041 lines suppressed...]
+};
 
-#define GELIC_NET_PORT                          2 /* for port status */
+/* status returened from GET_ETH_PORT_STATUS */
+enum gelic_lv1_ether_port_status {
+	GELIC_LV1_ETHER_LINK_UP		= 0x0000000000000001L,
+	GELIC_LV1_ETHER_FULL_DUPLEX	= 0x0000000000000002L,
+	GELIC_LV1_ETHER_AUTO_NEG	= 0x0000000000000004L,
+
+	GELIC_LV1_ETHER_SPEED_10	= 0x0000000000000010L,
+	GELIC_LV1_ETHER_SPEED_100	= 0x0000000000000020L,
+	GELIC_LV1_ETHER_SPEED_1000	= 0x0000000000000040L,
+	GELIC_LV1_ETHER_SPEED_MASK	= 0x0000000000000070L
+};
+
+enum gelic_lv1_vlan_index {
+	/* for outgoing packets */
+	GELIC_LV1_VLAN_TX_ETHERNET	= 0x0000000000000002L,
+	GELIC_LV1_VLAN_TX_WIRELESS	= 0x0000000000000003L,
+	/* for incoming packets */
+	GELIC_LV1_VLAN_RX_ETHERNET	= 0x0000000000000012L,
+	GELIC_LV1_VLAN_RX_WIRELESS	= 0x0000000000000013L
+};
 
 /* size of hardware part of gelic descriptor */
-#define GELIC_NET_DESCR_SIZE	(32)
-struct gelic_net_descr {
+#define GELIC_DESCR_SIZE	(32)
+
+enum gelic_port_type {
+	GELIC_PORT_ETHERNET = 0,
+	GELIC_PORT_WIRELESS = 1,
+	GELIC_PORT_MAX
+};
+
+struct gelic_descr {
 	/* as defined by the hardware */
-	u32 buf_addr;
-	u32 buf_size;
-	u32 next_descr_addr;
-	u32 dmac_cmd_status;
-	u32 result_size;
-	u32 valid_size;	/* all zeroes for tx */
-	u32 data_status;
-	u32 data_error;	/* all zeroes for tx */
+	__be32 buf_addr;
+	__be32 buf_size;
+	__be32 next_descr_addr;
+	__be32 dmac_cmd_status;
+	__be32 result_size;
+	__be32 valid_size;	/* all zeroes for tx */
+	__be32 data_status;
+	__be32 data_error;	/* all zeroes for tx */
 
 	/* used in the driver */
 	struct sk_buff *skb;
 	dma_addr_t bus_addr;
-	struct gelic_net_descr *next;
-	struct gelic_net_descr *prev;
-	struct vlan_ethhdr vlan;
+	struct gelic_descr *next;
+	struct gelic_descr *prev;
 } __attribute__((aligned(32)));
 
-struct gelic_net_descr_chain {
+struct gelic_descr_chain {
 	/* we walk from tail to head */
-	struct gelic_net_descr *head;
-	struct gelic_net_descr *tail;
+	struct gelic_descr *head;
+	struct gelic_descr *tail;
 };
 
-struct gelic_net_card {
-	struct net_device *netdev;
+struct gelic_vlan_id {
+	u16 tx;
+	u16 rx;
+};
+
+struct gelic_card {
 	struct napi_struct napi;
+	struct net_device *netdev[GELIC_PORT_MAX];
 	/*
 	 * hypervisor requires irq_status should be
 	 * 8 bytes aligned, but u64 member is
 	 * always disposed in that manner
 	 */
 	u64 irq_status;
-	u64 ghiintmask;
+	u64 irq_mask;
 
 	struct ps3_system_bus_device *dev;
-	u32 vlan_id[GELIC_NET_VLAN_MAX];
-	int vlan_index;
+	struct gelic_vlan_id vlan[GELIC_PORT_MAX];
+	int vlan_required;
 
-	struct gelic_net_descr_chain tx_chain;
-	struct gelic_net_descr_chain rx_chain;
+	struct gelic_descr_chain tx_chain;
+	struct gelic_descr_chain rx_chain;
 	int rx_dma_restart_required;
-	/* gurad dmac descriptor chain*/
-	spinlock_t chain_lock;
-
 	int rx_csum;
-	/* guard tx_dma_progress */
-	spinlock_t tx_dma_lock;
+	/*
+	 * tx_lock guards tx descriptor list and
+	 * tx_dma_progress.
+	 */
+	spinlock_t tx_lock;
 	int tx_dma_progress;
 
 	struct work_struct tx_timeout_task;
 	atomic_t tx_timeout_task_counter;
 	wait_queue_head_t waitq;
 
-	struct gelic_net_descr *tx_top, *rx_top;
-	struct gelic_net_descr descr[0];
+	/* only first user should up the card */
+	struct semaphore updown_lock;
+	atomic_t users;
+
+	u64 ether_port_status;
+	/* original address returned by kzalloc */
+	void *unalign;
+
+	/*
+	 * each netdevice has copy of irq
+	 */
+	unsigned int irq;
+	struct gelic_descr *tx_top, *rx_top;
+	struct gelic_descr descr[0]; /* must be the last */
 };
 
+struct gelic_port {
+	struct gelic_card *card;
+	struct net_device *netdev;
+	enum gelic_port_type type;
+	long priv[0]; /* long for alignment */
+};
 
-extern unsigned long p_to_lp(long pa);
+static inline struct gelic_card *port_to_card(struct gelic_port *p)
+{
+	return p->card;
+}
+static inline struct net_device *port_to_netdev(struct gelic_port *p)
+{
+	return p->netdev;
+}
+static inline struct gelic_card *netdev_card(struct net_device *d)
+{
+	return ((struct gelic_port *)netdev_priv(d))->card;
+}
+static inline struct gelic_port *netdev_port(struct net_device *d)
+{
+	return (struct gelic_port *)netdev_priv(d);
+}
+static inline struct device *ctodev(struct gelic_card *card)
+{
+	return &card->dev->core;
+}
+static inline u64 bus_id(struct gelic_card *card)
+{
+	return card->dev->bus_id;
+}
+static inline u64 dev_id(struct gelic_card *card)
+{
+	return card->dev->dev_id;
+}
+
+static inline void *port_priv(struct gelic_port *port)
+{
+	return port->priv;
+}
+
+extern int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask);
+/* shared netdev ops */
+extern void gelic_card_up(struct gelic_card *card);
+extern void gelic_card_down(struct gelic_card *card);
+extern int gelic_net_open(struct net_device *netdev);
+extern int gelic_net_stop(struct net_device *netdev);
+extern int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev);
+extern void gelic_net_set_multi(struct net_device *netdev);
+extern void gelic_net_tx_timeout(struct net_device *netdev);
+extern int gelic_net_change_mtu(struct net_device *netdev, int new_mtu);
+extern int gelic_net_setup_netdev(struct net_device *netdev,
+				  struct gelic_card *card);
+
+/* shared ethtool ops */
+extern void gelic_net_get_drvinfo(struct net_device *netdev,
+				  struct ethtool_drvinfo *info);
+extern u32 gelic_net_get_rx_csum(struct net_device *netdev);
+extern int gelic_net_set_rx_csum(struct net_device *netdev, u32 data);
 
 #endif /* _GELIC_NET_H */

linux-2.6-gelic-wireless-fix.patch:

--- NEW FILE linux-2.6-gelic-wireless-fix.patch ---
--- linux-2.6.23.ppc64/drivers/net/ps3_gelic_net.c~	2007-12-14 01:31:50.000000000 -0500
+++ linux-2.6.23.ppc64/drivers/net/ps3_gelic_net.c	2007-12-14 01:39:25.000000000 -0500
@@ -1139,7 +1139,7 @@ static irqreturn_t gelic_card_interrupt(
  *
  * see Documentation/networking/netconsole.txt
  */
-static void gelic_net_poll_controller(struct net_device *netdev)
+void gelic_net_poll_controller(struct net_device *netdev)
 {
 	struct gelic_card *card = netdev_card(netdev);
 
--- linux-2.6.23.ppc64/drivers/net/ps3_gelic_net.h~	2007-12-14 01:31:50.000000000 -0500
+++ linux-2.6.23.ppc64/drivers/net/ps3_gelic_net.h	2007-12-14 01:39:47.000000000 -0500
@@ -346,6 +346,7 @@ extern void gelic_net_tx_timeout(struct 
 extern int gelic_net_change_mtu(struct net_device *netdev, int new_mtu);
 extern int gelic_net_setup_netdev(struct net_device *netdev,
 				  struct gelic_card *card);
+extern void gelic_net_poll_controller(struct net_device *netdev);
 
 /* shared ethtool ops */
 extern void gelic_net_get_drvinfo(struct net_device *netdev,

linux-2.6-gelic-wireless-v2.patch:

--- NEW FILE linux-2.6-gelic-wireless-v2.patch ---
Subject: PS3: gelic: Add wireless support for PS3

This is the re-worked (rewritten) version wireless support driver for
PS3.  The formar one was submitted to net-dev ML in June 2007.

Major differnces from the previous one are:
  - The new driver has separate ethX interface from ethernet.
    They share same one MAC address.
  - Thus we can use both ethernet and wireless simultaenously.
  - The new driver returns AP's cipher information by the common IE
    format in the scan information.
  - Cipher selection is done via the common wirelee extension way

Signed-off-by: Masakazu Mokuno <mokuno at sm.sony.co.jp>
---
 drivers/net/Kconfig              |   10 
 drivers/net/Makefile             |    3 
 drivers/net/ps3_gelic_net.c      |   18 
 drivers/net/ps3_gelic_net.h      |    6 
 drivers/net/ps3_gelic_wireless.c | 2750 +++++++++++++++++++++++++++++++++++++++
 drivers/net/ps3_gelic_wireless.h |  329 ++++
 6 files changed, 3114 insertions(+), 2 deletions(-)

--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2302,6 +2302,16 @@ config GELIC_NET
 	  To compile this driver as a module, choose M here: the
 	  module will be called ps3_gelic.
 
+config GELIC_WIRELESS
+       bool "PS3 Wireless support"
+       depends on GELIC_NET
+       help
+        This option adds the support for the wireless feature of PS3.
+        If you have the wireless-less model of PS3 or have no plan to
+        use wireless feature, disabling this option saves memory.  As
+        the driver automatically distinguishes the models, you can
+        safely enable this option even if you have a wireless-less model.
+
 config GIANFAR
 	tristate "Gianfar Ethernet"
 	depends on 85xx || 83xx || PPC_86xx
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -66,7 +66,8 @@ obj-$(CONFIG_BNX2) += bnx2.o
 spidernet-y += spider_net.o spider_net_ethtool.o
 obj-$(CONFIG_SPIDER_NET) += spidernet.o sungem_phy.o
 obj-$(CONFIG_GELIC_NET) += ps3_gelic.o
-ps3_gelic-objs += ps3_gelic_net.o
+gelic_wireless-$(CONFIG_GELIC_WIRELESS) += ps3_gelic_wireless.o
+ps3_gelic-objs += ps3_gelic_net.o $(gelic_wireless-y)
 obj-$(CONFIG_TC35815) += tc35815.o
 obj-$(CONFIG_SKGE) += skge.o
 obj-$(CONFIG_SKY2) += sky2.o
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -46,9 +46,10 @@
 #include <asm/lv1call.h>
 
 #include "ps3_gelic_net.h"
+#include "ps3_gelic_wireless.h"
 
 #define DRV_NAME "Gelic Network Driver"
-#define DRV_VERSION "1.1"
+#define DRV_VERSION "2.0"
 
 MODULE_AUTHOR("SCE Inc.");
 MODULE_DESCRIPTION("Gelic Network driver");
@@ -1122,6 +1123,12 @@ static irqreturn_t gelic_card_interrupt(
 	if (status & GELIC_CARD_PORT_STATUS_CHANGED)
 		gelic_card_get_ether_port_status(card, 1);
 
+#ifdef CONFIG_GELIC_WIRELESS
+	if (status & (GELIC_CARD_WLAN_EVENT_RECEIVED |
+		      GELIC_CARD_WLAN_COMMAND_COMPLETED))
+		gelic_wl_interrupt(card->netdev[GELIC_PORT_WIRELESS], status);
+#endif
+
 	return IRQ_HANDLED;
 }
 
@@ -1603,6 +1610,12 @@ static int ps3_gelic_driver_probe(struct
 		goto fail_setup_netdev;
 	}
 
+#ifdef CONFIG_GELIC_WIRELESS
+	if (gelic_wl_driver_probe(card)) {
+		dev_dbg(&dev->core, "%s: WL init failed\n", __func__);
+		goto fail_setup_netdev;
+	}
+#endif
 	pr_debug("%s: done\n", __func__);
 	return 0;
 
@@ -1642,6 +1655,9 @@ static int ps3_gelic_driver_remove(struc
 	struct net_device *netdev0;
 	pr_debug("%s: called\n", __func__);
 
+#ifdef CONFIG_GELIC_WIRELESS
+	gelic_wl_driver_remove(card);
+#endif
 	/* stop interrupt */
 	gelic_card_set_irq_mask(card, 0);
 
--- a/drivers/net/ps3_gelic_net.h
+++ b/drivers/net/ps3_gelic_net.h
@@ -57,6 +57,8 @@
 #define GELIC_CARD_RX_PROTECTION_ERR         0x0000000004000000L
 #define GELIC_CARD_TX_TCP_UDP_CHECKSUM_ERR   0x0000000008000000L
 #define GELIC_CARD_PORT_STATUS_CHANGED       0x0000000020000000L
+#define GELIC_CARD_WLAN_EVENT_RECEIVED       0x0000000040000000L
+#define GELIC_CARD_WLAN_COMMAND_COMPLETED    0x0000000080000000L
 	/* INT 0 */
 #define GELIC_CARD_TX_FLAGGED_DESCR          0x0004000000000000L
 #define GELIC_CARD_RX_FLAGGED_DESCR          0x0040000000000000L
@@ -180,6 +182,10 @@ enum gelic_lv1_net_control_code {
 	GELIC_LV1_GET_ETH_PORT_STATUS	= 2,
 	GELIC_LV1_SET_NEGOTIATION_MODE	= 3,
 	GELIC_LV1_GET_VLAN_ID		= 4,
+	GELIC_LV1_GET_CHANNEL           = 6,
+	GELIC_LV1_POST_WLAN_CMD		= 9,
+	GELIC_LV1_GET_WLAN_CMD_RESULT	= 10,
+	GELIC_LV1_GET_WLAN_EVENT	= 11
 };
 
 /* status returened from GET_ETH_PORT_STATUS */
--- /dev/null
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -0,0 +1,2750 @@
+/*
+ *  PS3 gelic network driver.
+ *
+ * Copyright (C) 2007 Sony Computer Entertainment Inc.
+ * Copyright 2007 Sony 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#undef DEBUG
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#include <linux/etherdevice.h>
+#include <linux/ethtool.h>
+#include <linux/if_vlan.h>
+
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/tcp.h>
+#include <linux/wireless.h>
+#include <linux/ctype.h>
+#include <linux/string.h>
+#include <net/iw_handler.h>
+#include <net/ieee80211.h>
+
+#include <linux/dma-mapping.h>
+#include <net/checksum.h>
+#include <asm/firmware.h>
+#include <asm/ps3.h>
+#include <asm/lv1call.h>
+
+#include "ps3_gelic_net.h"
+#include "ps3_gelic_wireless.h"
+
+
+static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan);
+static int  gelic_wl_try_associate(struct net_device *netdev);
+
+/*
+ * tables
+ */
+
+/* 802.11b/g channel to freq in MHz */
+static const int channel_freq[] = {
+	2412, 2417, 2422, 2427, 2432,
+	2437, 2442, 2447, 2452, 2457,
+	2462, 2467, 2472, 2484
+};
+#define NUM_CHANNELS ARRAY_SIZE(channel_freq)
+
+/* in bps */
+static const int bitrate_list[] = {
+	  1000000,
+	  2000000,
+	  5500000,
+	 11000000,
+	  6000000,
+	  9000000,
[...2812 lines suppressed...]
+};
+
+enum gelic_eurus_scan_sec_type {
+	GELIC_EURUS_SCAN_SEC_NONE	= 0x0000,
+	GELIC_EURUS_SCAN_SEC_WEP	= 0x0100,
+	GELIC_EURUS_SCAN_SEC_WPA	= 0x0200,
+	GELIC_EURUS_SCAN_SEC_WPA2	= 0x0400,
+	GELIC_EURUS_SCAN_SEC_MASK	= 0x0f00,
+};
+
+enum gelic_eurus_scan_sec_wep_type {
+	GELIC_EURUS_SCAN_SEC_WEP_UNKNOWN	= 0x0000,
+	GELIC_EURUS_SCAN_SEC_WEP_40		= 0x0001,
+	GELIC_EURUS_SCAN_SEC_WEP_104		= 0x0002,
+	GELIC_EURUS_SCAN_SEC_WEP_MASK		= 0x0003,
+};
+
+enum gelic_eurus_scan_sec_wpa_type {
+	GELIC_EURUS_SCAN_SEC_WPA_UNKNOWN	= 0x0000,
+	GELIC_EURUS_SCAN_SEC_WPA_TKIP		= 0x0001,
+	GELIC_EURUS_SCAN_SEC_WPA_AES		= 0x0002,
+	GELIC_EURUS_SCAN_SEC_WPA_MASK		= 0x0003,
+};
+
+/*
+ * hw BSS information structure returned from GELIC_EURUS_CMD_GET_SCAN
+ */
+struct gelic_eurus_scan_info {
+	/* all fields are big endian */
+	__be16 size;
+	__be16 rssi; /* percentage */
+	__be16 channel; /* channel number */
+	__be16 beacon_period; /* FIXME: in msec unit */
+	__be16 capability;
+	__be16 security;
+	u8  bssid[8]; /* last ETH_ALEN are valid. bssid[0],[1] are unused */
+	u8  essid[32]; /* IW_ESSID_MAX_SIZE */
+	u8  rate[16]; /* first MAX_RATES_LENGTH(12) are valid */
+	u8  ext_rate[16]; /* first MAX_RATES_EX_LENGTH(16) are valid */
+	__be32 reserved1;
+	__be32 reserved2;
+	__be32 reserved3;
+	__be32 reserved4;
+	u8 elements[0]; /* ie */
+} __attribute__ ((packed));
+
+/* the hypervisor returns bbs up to 16 */
+#define GELIC_EURUS_MAX_SCAN  (16)
+struct gelic_wl_scan_info {
+	struct list_head list;
+	struct gelic_eurus_scan_info *hwinfo;
+
+	int valid; /* set 1 if this entry was in latest scanned list
+		     * from Eurus */
+	unsigned int eurus_index; /* index in the Eurus list */
+	unsigned long last_scanned; /* acquired time */
+
+	unsigned int rate_len;
+	unsigned int rate_ext_len;
+	unsigned int essid_len;
+};
+
+/* for GELIC_EURUS_CMD_GET_RSSI */
+struct gelic_eurus_rssi_info {
+	/* big endian */
+	__be16 rssi;
+} __attribute__ ((packed));
+
+
+/* for 'stat' member of gelic_wl_info */
+enum gelic_wl_info_status_bit {
+	GELIC_WL_STAT_CONFIGURED,
+	GELIC_WL_STAT_CH_INFO,   /* ch info aquired */
+	GELIC_WL_STAT_ESSID_SET, /* ESSID specified by userspace */
+	GELIC_WL_STAT_BSSID_SET, /* BSSID specified by userspace */
+	GELIC_WL_STAT_WPA_PSK_SET, /* PMK specified by userspace */
+	GELIC_WL_STAT_WPA_LEVEL_SET, /* WEP or WPA[2] selected */
+};
+
+/* for 'scan_stat' member of gelic_wl_info */
+enum gelic_wl_scan_state {
+	/* just initialized or get last scan result failed */
+	GELIC_WL_SCAN_STAT_INIT,
+	/* scan request issued, accepted or chip is scanning */
+	GELIC_WL_SCAN_STAT_SCANNING,
+	/* scan results retrieved */
+	GELIC_WL_SCAN_STAT_GOT_LIST,
+};
+
+/* for 'cipher_method' */
+enum gelic_wl_cipher_method {
+	GELIC_WL_CIPHER_NONE,
+	GELIC_WL_CIPHER_WEP,
+	GELIC_WL_CIPHER_TKIP,
+	GELIC_WL_CIPHER_AES,
+};
+
+/* for 'wpa_level' */
+enum gelic_wl_wpa_level {
+	GELIC_WL_WPA_LEVEL_NONE,
+	GELIC_WL_WPA_LEVEL_WPA,
+	GELIC_WL_WPA_LEVEL_WPA2,
+};
+
+/* for 'assoc_stat' */
+enum gelic_wl_assoc_state {
+	GELIC_WL_ASSOC_STAT_DISCONN,
+	GELIC_WL_ASSOC_STAT_ASSOCIATING,
+	GELIC_WL_ASSOC_STAT_ASSOCIATED,
+};
+/* part of private data alloc_etherdev() allocated */
+#define GELIC_WEP_KEYS 4
+struct gelic_wl_info {
+	/* bss list */
+	struct semaphore scan_lock;
+	struct list_head network_list;
+	struct list_head network_free_list;
+	struct gelic_wl_scan_info *networks;
+
+	unsigned long scan_age; /* last scanned time */
+	enum gelic_wl_scan_state scan_stat;
+	struct completion scan_done;
+
+	/* eurus command queue */
+	struct workqueue_struct *eurus_cmd_queue;
+	struct completion cmd_done_intr;
+
+	/* eurus event handling */
+	struct workqueue_struct *event_queue;
+	struct delayed_work event_work;
+
+	/* wl status bits */
+	unsigned long stat;
+	enum gelic_eurus_auth_method auth_method; /* open/shared */
+	enum gelic_wl_cipher_method group_cipher_method;
+	enum gelic_wl_cipher_method pairwise_cipher_method;
+	enum gelic_wl_wpa_level wpa_level; /* wpa/wpa2 */
+
+	/* association handling */
+	struct semaphore assoc_stat_lock;
+	struct delayed_work assoc_work;
+	enum gelic_wl_assoc_state assoc_stat;
+	struct completion assoc_done;
+
+	spinlock_t lock;
+	u16 ch_info; /* available channels. bit0 = ch1 */
+	/* WEP keys */
+	u8 key[GELIC_WEP_KEYS][IW_ENCODING_TOKEN_MAX];
+	unsigned long key_enabled;
+	unsigned int key_len[GELIC_WEP_KEYS];
+	unsigned int current_key;
+	/* WWPA PSK */
+	u8 psk[GELIC_WL_EURUS_PSK_MAX_LEN];
+	enum gelic_eurus_wpa_psk_type psk_type;
+	unsigned int psk_len;
+
+	u8 essid[IW_ESSID_MAX_SIZE];
+	u8 bssid[ETH_ALEN]; /* userland requested */
+	u8 active_bssid[ETH_ALEN]; /* associated bssid */
+	unsigned int essid_len;
+
+	/* buffer for hypervisor IO */
+	void *buf;
+
+	struct iw_public_data wireless_data;
+	struct iw_statistics iwstat;
+};
+
+#define GELIC_WL_BSS_MAX_ENT 32
+#define GELIC_WL_ASSOC_RETRY 50
+static inline struct gelic_port *wl_port(struct gelic_wl_info *wl)
+{
+	return container_of((void *)wl, struct gelic_port, priv);
+}
+static inline struct gelic_wl_info *port_wl(struct gelic_port *port)
+{
+	return port_priv(port);
+}
+
+struct gelic_eurus_cmd {
+	struct work_struct work;
+	struct gelic_wl_info *wl;
+	unsigned int cmd; /* command code */
+	u64 tag;
+	u64 size;
+	void *buffer;
+	unsigned int buf_size;
+	struct completion done;
+	int status;
+	u64 cmd_status;
+};
+
+/* private ioctls to pass PSK */
+#define GELIC_WL_PRIV_SET_PSK		(SIOCIWFIRSTPRIV + 0)
+#define GELIC_WL_PRIV_GET_PSK		(SIOCIWFIRSTPRIV + 1)
+
+extern int gelic_wl_driver_probe(struct gelic_card *card);
+extern int gelic_wl_driver_remove(struct gelic_card *card);
+extern void gelic_wl_interrupt(struct net_device *netdev, u64 status);
+#endif /* _GELIC_WIRELESS_H */

linux-2.6-git-initial-r500-drm.patch:

--- NEW FILE linux-2.6-git-initial-r500-drm.patch ---
diff -up linux-2.6.23.noarch/drivers/char/drm/drm_pciids.h.r500 linux-2.6.23.noarch/drivers/char/drm/drm_pciids.h
--- linux-2.6.23.noarch/drivers/char/drm/drm_pciids.h.r500	2007-12-12 11:17:09.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/drm_pciids.h	2007-12-12 11:17:39.000000000 +1000
@@ -139,6 +139,101 @@
 	{0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7103, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7109, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x710A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x710B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x710C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x710E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x710F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7140, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7141, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7142, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7143, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7147, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x714A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x714B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x714C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x714D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x714E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x714F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7153, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x715E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x715F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7183, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7186, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7187, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7188, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x718A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x718B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x718C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x718D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x718F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7193, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7196, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x719B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x719F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71D2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71D4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71D5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71D6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x71DE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7245, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7246, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7247, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7248, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x724A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x724B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x724C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x724D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x724E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x724F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7280, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7283, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7284, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x728B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x728C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7290, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7291, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7293, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x7297, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0, 0, 0}
diff -up linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c.r500 linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c
--- linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c.r500	2007-12-12 11:17:09.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/radeon_cp.c	2007-12-12 11:17:39.000000000 +1000
@@ -816,19 +816,44 @@ static const u32 R300_cp_microcode[][2] 
 	{0000000000, 0000000000},
 };
 
+static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
+{
+	u32 ret;
+	RADEON_WRITE(R520_MC_IND_INDEX, 0x7f0000 | (addr & 0xff));
+	ret = RADEON_READ(R520_MC_IND_DATA);
+	RADEON_WRITE(R520_MC_IND_INDEX, 0);
+	return ret;
+}
+
 u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
 {
-	return RADEON_READ(RADEON_MC_FB_LOCATION);
+	
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
+		return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
+	else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
+		return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION);
+	else
+		return RADEON_READ(RADEON_MC_FB_LOCATION);
 }
 
 static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
 {
-	RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc);
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
+		RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
+	else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
+		RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc);
+	else
+		RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc);
 }
 
 static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc)
 {
-	RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
+		RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
+	else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
+		RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc);
+	else
+		RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
 }
 
 static int RADEON_READ_PLL(struct drm_device * dev, int addr)
@@ -1089,41 +1114,43 @@ static int radeon_do_engine_reset(struct
 
 	radeon_do_pixcache_flush(dev_priv);
 
-	clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX);
-	mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL);
-
-	RADEON_WRITE_PLL(RADEON_MCLK_CNTL, (mclk_cntl |
-					    RADEON_FORCEON_MCLKA |
-					    RADEON_FORCEON_MCLKB |
-					    RADEON_FORCEON_YCLKA |
-					    RADEON_FORCEON_YCLKB |
-					    RADEON_FORCEON_MC |
-					    RADEON_FORCEON_AIC));
-
-	rbbm_soft_reset = RADEON_READ(RADEON_RBBM_SOFT_RESET);
-
-	RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset |
-					      RADEON_SOFT_RESET_CP |
-					      RADEON_SOFT_RESET_HI |
-					      RADEON_SOFT_RESET_SE |
-					      RADEON_SOFT_RESET_RE |
-					      RADEON_SOFT_RESET_PP |
-					      RADEON_SOFT_RESET_E2 |
-					      RADEON_SOFT_RESET_RB));
-	RADEON_READ(RADEON_RBBM_SOFT_RESET);
-	RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset &
-					      ~(RADEON_SOFT_RESET_CP |
-						RADEON_SOFT_RESET_HI |
-						RADEON_SOFT_RESET_SE |
-						RADEON_SOFT_RESET_RE |
-						RADEON_SOFT_RESET_PP |
-						RADEON_SOFT_RESET_E2 |
-						RADEON_SOFT_RESET_RB)));
-	RADEON_READ(RADEON_RBBM_SOFT_RESET);
-
-	RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl);
-	RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index);
-	RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset);
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_RV515) {
+		clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX);
+		mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL);
+		
+		RADEON_WRITE_PLL(RADEON_MCLK_CNTL, (mclk_cntl |
+						    RADEON_FORCEON_MCLKA |
+						    RADEON_FORCEON_MCLKB |
+						    RADEON_FORCEON_YCLKA |
+						    RADEON_FORCEON_YCLKB |
+						    RADEON_FORCEON_MC |
+						    RADEON_FORCEON_AIC));
+		
+		rbbm_soft_reset = RADEON_READ(RADEON_RBBM_SOFT_RESET);
+		
+		RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset |
+						      RADEON_SOFT_RESET_CP |
+						      RADEON_SOFT_RESET_HI |
+						      RADEON_SOFT_RESET_SE |
+						      RADEON_SOFT_RESET_RE |
+						      RADEON_SOFT_RESET_PP |
+						      RADEON_SOFT_RESET_E2 |
+						      RADEON_SOFT_RESET_RB));
+		RADEON_READ(RADEON_RBBM_SOFT_RESET);
+		RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset &
+						      ~(RADEON_SOFT_RESET_CP |
+							RADEON_SOFT_RESET_HI |
+							RADEON_SOFT_RESET_SE |
+							RADEON_SOFT_RESET_RE |
+							RADEON_SOFT_RESET_PP |
+							RADEON_SOFT_RESET_E2 |
+							RADEON_SOFT_RESET_RB)));
+		RADEON_READ(RADEON_RBBM_SOFT_RESET);
+		
+		RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl);
+		RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index);
+		RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset);
+	}
 
 	/* Reset the CP ring */
 	radeon_do_cp_reset(dev_priv);
@@ -1844,7 +1871,7 @@ int radeon_cp_init(struct drm_device *de
 	LOCK_TEST_WITH_RETURN(dev, file_priv);
 
 	if (init->func == RADEON_INIT_R300_CP)
-		r300_init_reg_flags();
+		r300_init_reg_flags(dev);
 
 	switch (init->func) {
 	case RADEON_INIT_CP:
@@ -2253,6 +2280,10 @@ int radeon_driver_load(struct drm_device
 	case CHIP_R350:
 	case CHIP_R420:
 	case CHIP_RV410:
+	case CHIP_RV515:
+	case CHIP_R520:
+	case CHIP_RV570:
+	case CHIP_R580:
 		dev_priv->flags |= RADEON_HAS_HIERZ;
 		break;
 	default:
diff -up linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h.r500 linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h
--- linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h.r500	2007-12-12 11:17:09.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/radeon_drv.h	2007-12-12 11:18:25.000000000 +1000
@@ -123,6 +123,12 @@ enum radeon_family {
 	CHIP_R420,
 	CHIP_RV410,
 	CHIP_RS400,
+	CHIP_RV515,
+	CHIP_R520,
+	CHIP_RV530,
+	CHIP_RV560,
+	CHIP_RV570,
+	CHIP_R580,
 	CHIP_LAST,
 };
 
@@ -383,7 +389,7 @@ extern long radeon_compat_ioctl(struct f
 				unsigned long arg);
 
 /* r300_cmdbuf.c */
-extern void r300_init_reg_flags(void);
+extern void r300_init_reg_flags(struct drm_device *dev);
 
 extern int r300_do_cp_cmdbuf(struct drm_device * dev,
 			     struct drm_file *file_priv,
@@ -455,6 +461,16 @@ extern int r300_do_cp_cmdbuf(struct drm_
 #define RADEON_IGPGART_ENABLE           0x38
 #define RADEON_IGPGART_UNK_39           0x39
 
+#define R520_MC_IND_INDEX 0x70
+#define R520_MC_IND_WR_EN (1<<24)
+#define R520_MC_IND_DATA  0x74
+
+#define RV515_MC_FB_LOCATION 0x01
+#define RV515_MC_AGP_LOCATION 0x02
+
+#define R520_MC_FB_LOCATION 0x04
+#define R520_MC_AGP_LOCATION 0x05
+
 #define RADEON_MPP_TB_CONFIG		0x01c0
 #define RADEON_MEM_CNTL			0x0140
 #define RADEON_MEM_SDRAM_MODE_REG	0x0158
@@ -1005,6 +1021,13 @@ do {									\
 	RADEON_WRITE( RADEON_PCIE_DATA, (val) );			\
 } while (0)
 
+#define RADEON_WRITE_MCIND( addr, val )					\
+	do {								\
+		RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff));	\
+		RADEON_WRITE(R520_MC_IND_DATA, (val));			\
+		RADEON_WRITE(R520_MC_IND_INDEX, 0);	\
+	} while (0)
+
 #define CP_PACKET0( reg, n )						\
 	(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
 #define CP_PACKET0_TABLE( reg, n )					\
diff -up linux-2.6.23.noarch/drivers/char/drm/r300_cmdbuf.c.r500 linux-2.6.23.noarch/drivers/char/drm/r300_cmdbuf.c
--- linux-2.6.23.noarch/drivers/char/drm/r300_cmdbuf.c.r500	2007-12-12 11:17:09.000000000 +1000
+++ linux-2.6.23.noarch/drivers/char/drm/r300_cmdbuf.c	2007-12-12 11:17:39.000000000 +1000
@@ -77,23 +77,31 @@ static int r300_emit_cliprects(drm_radeo
 				return -EFAULT;
 			}
 
-			box.x1 =
-			    (box.x1 +
-			     R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK;
-			box.y1 =
-			    (box.y1 +
-			     R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK;
-			box.x2 =
-			    (box.x2 +
-			     R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK;
-			box.y2 =
-			    (box.y2 +
-			     R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK;
+			if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
+				box.x1 = (box.x1) &
+					R300_CLIPRECT_MASK;
+				box.y1 = (box.y1) &
+					R300_CLIPRECT_MASK;
+				box.x2 = (box.x2) &
+					R300_CLIPRECT_MASK;
+				box.y2 = (box.y2) &
+					R300_CLIPRECT_MASK;
+			} else {
+				box.x1 = (box.x1 + R300_CLIPRECT_OFFSET) &
+					R300_CLIPRECT_MASK;
+				box.y1 = (box.y1 + R300_CLIPRECT_OFFSET) &
+					R300_CLIPRECT_MASK;
+				box.x2 = (box.x2 + R300_CLIPRECT_OFFSET) &
+					R300_CLIPRECT_MASK;
+				box.y2 = (box.y2 + R300_CLIPRECT_OFFSET) &
+					R300_CLIPRECT_MASK;
 
+			}
 			OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) |
 				 (box.y1 << R300_CLIPRECT_Y_SHIFT));
 			OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) |
 				 (box.y2 << R300_CLIPRECT_Y_SHIFT));
+
 		}
 
 		OUT_RING_REG(R300_RE_CLIPRECT_CNTL, r300_cliprect_cntl[nr - 1]);
@@ -133,9 +141,11 @@ static int r300_emit_cliprects(drm_radeo
 
 static u8 r300_reg_flags[0x10000 >> 2];
 
-void r300_init_reg_flags(void)
+void r300_init_reg_flags(struct drm_device *dev)
 {
 	int i;
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+
 	memset(r300_reg_flags, 0, 0x10000 >> 2);
 #define ADD_RANGE_MARK(reg, count,mark) \
 		for(i=((reg)>>2);i<((reg)>>2)+(count);i++)\
@@ -230,6 +240,9 @@ void r300_init_reg_flags(void)
 	ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8);
 	ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8);
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
+		ADD_RANGE(0x4074, 16);
+	}
 }
 
 static __inline__ int r300_check_range(unsigned reg, int count)

linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch:

--- NEW FILE linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch ---
From: Roland McGrath <roland at redhat.com>

This keeps an unstripped copy of the vDSO images built before they are
stripped and embedded in the kernel.  The unstripped copies get installed in
$(MODLIB)/vdso/ by "make install".  These files can be useful when they
contain source-level debugging information.

Signed-off-by: Roland McGrath <roland at redhat.com>
Cc: Sam Ravnborg <sam at ravnborg.org>
Cc: Andi Kleen <ak at suse.de>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

 arch/x86/Makefile        |    1 +
 arch/x86/kernel/Makefile_32 |   27 ++++++++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff -puN arch/x86/Makefile_32~i386-vdso-install-unstripped-copies-on-disk arch/x86/Makefile_32
--- a/arch/x86/Makefile_32~i386-vdso-install-unstripped-copies-on-disk
+++ a/arch/x86/Makefile_32
@@ -152,9 +152,12 @@ zdisk bzdisk: vmlinux
 fdimage fdimage144 fdimage288 isoimage: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
 
-install:
+install: vdso_install
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
 
+vdso_install:
+	$(Q)$(MAKE) $(build)=arch/x86/kernel vdso_install
+
 archclean:
 	$(Q)rm -rf $(objtree)/arch/i386/boot
 	$(Q)$(MAKE) $(clean)=arch/x86/boot

diff -puN arch/x86/kernel/Makefile_32~i386-vdso-install-unstripped-copies-on-disk arch/x86/kernel/Makefile_32
--- a/arch/x86/kernel/Makefile_32~i386-vdso-install-unstripped-copies-on-disk
+++ a/arch/x86/kernel/Makefile_32
@@ -54,6 +54,8 @@ obj-$(CONFIG_SCx200)		+= scx200_32.o
 # Note: kbuild does not track this dependency due to usage of .incbin
 $(obj)/vsyscall_32.o: $(obj)/vsyscall-int80_32.so $(obj)/vsyscall-sysenter_32.so
 targets += $(foreach F,int80 sysenter,vsyscall-$F_32.o vsyscall-$F_32.so)
+targets += $(foreach F,$(patsubst %,vsyscall-%_32,int80 sysenter),\
+		     $F.o $F.so $F.so.dbg)
 targets += vsyscall-note_32.o vsyscall_32.lds
 
 # The DSO images are built using a special linker script.
@@ -63,16 +65,32 @@ quiet_cmd_syscall = SYSCALL $@
 
 export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386
 
-vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
+vsyscall-flags = -shared -Wl,-soname=linux-gate.so.1 \
 		 $(call ld-option, -Wl$(comma)--hash-style=sysv)
-SYSCFLAGS_vsyscall-sysenter_32.so	= $(vsyscall-flags)
-SYSCFLAGS_vsyscall-int80_32.so	= $(vsyscall-flags)
+SYSCFLAGS_vsyscall-sysenter_32.so.dbg	= $(vsyscall-flags)
+SYSCFLAGS_vsyscall-int80_32.so.dbg	= $(vsyscall-flags)
 
-$(obj)/vsyscall-int80_32.so $(obj)/vsyscall-sysenter_32.so: \
-$(obj)/vsyscall-%.so: $(src)/vsyscall_32.lds \
+$(obj)/vsyscall-int80_32.so.dbg $(obj)/vsyscall-sysenter_32.so.dbg: \
+$(obj)/vsyscall-%.so.dbg: $(src)/vsyscall_32.lds \
 		      $(obj)/vsyscall-%.o $(obj)/vsyscall-note_32.o FORCE
 	$(call if_changed,syscall)
 
+$(obj)/%.so: OBJCOPYFLAGS := -S
+$(obj)/%.so: $(obj)/%.so.dbg FORCE
+	$(call if_changed,objcopy)
+
+vdsos := vdso-int80.so vdso-sysenter.so
+
+quiet_cmd_vdso_install = INSTALL $@
+      cmd_vdso_install = cp $(@:vdso-%.so=$(obj)/vsyscall-%_32.so.dbg) \
+			    $(MODLIB)/vdso/$@
+
+$(vdsos):
+	@mkdir -p $(MODLIB)/vdso
+	$(call cmd,vdso_install)
+
+vdso_install: $(vdsos)
+
 # We also create a special relocatable object that should mirror the symbol
 # table and layout of the linked DSO.  With ld -R we can then refer to
 # these symbols in the kernel code rather than hand-coded addresses.

linux-2.6-lirc.patch:

--- NEW FILE linux-2.6-lirc.patch ---
Linux Infrared Remote Control drivers (http://lirc.org/)

Signed-off-by: Jarod Wilson <jwilson at redhat.com>

 drivers/input/Kconfig                 |    2 +
 drivers/input/Makefile                |    1 +
 drivers/input/lirc/Kconfig            |  127 +++
 drivers/input/lirc/Makefile           |   24 +
 drivers/input/lirc/commandir.c        | 1009 +++++++++++++++++++++++
 drivers/input/lirc/commandir.h        |   41 +
 drivers/input/lirc/kcompat.h          |  150 ++++
 drivers/input/lirc/lirc.h             |  101 +++
 drivers/input/lirc/lirc_atiusb.c      | 1326 ++++++++++++++++++++++++++++++
 drivers/input/lirc/lirc_bt829.c       |  393 +++++++++
 drivers/input/lirc/lirc_cmdir.c       |  605 ++++++++++++++
 drivers/input/lirc/lirc_cmdir.h       |   27 +
 drivers/input/lirc/lirc_dev.c         |  827 +++++++++++++++++++
 drivers/input/lirc/lirc_dev.h         |  264 ++++++
 drivers/input/lirc/lirc_i2c.c         |  671 +++++++++++++++
 drivers/input/lirc/lirc_igorplugusb.c |  624 ++++++++++++++
 drivers/input/lirc/lirc_imon.c        | 1165 +++++++++++++++++++++++++++
 drivers/input/lirc/lirc_it87.c        | 1012 +++++++++++++++++++++++
 drivers/input/lirc/lirc_it87.h        |  116 +++
 drivers/input/lirc/lirc_mceusb.c      |  890 ++++++++++++++++++++
 drivers/input/lirc/lirc_mceusb2.c     | 1042 ++++++++++++++++++++++++
 drivers/input/lirc/lirc_parallel.c    |  745 +++++++++++++++++
 drivers/input/lirc/lirc_parallel.h    |   26 +
 drivers/input/lirc/lirc_pvr150.c      | 1431 +++++++++++++++++++++++++++++++++
 drivers/input/lirc/lirc_sasem.c       |  971 ++++++++++++++++++++++
 drivers/input/lirc/lirc_serial.c      | 1348 +++++++++++++++++++++++++++++++
 drivers/input/lirc/lirc_sir.c         | 1323 ++++++++++++++++++++++++++++++
 drivers/input/lirc/lirc_streamzap.c   |  810 +++++++++++++++++++
 drivers/input/lirc/lirc_ttusbir.c     |  393 +++++++++
 29 files changed, 17464 insertions(+), 0 deletions(-)

diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 63512d9..de4b170 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -161,5 +161,7 @@ source "drivers/input/gameport/Kconfig"
 
 endmenu
 
+source "drivers/input/lirc/Kconfig"
+
 endmenu
 
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 99af903..78b0420 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -22,3 +22,4 @@ obj-$(CONFIG_INPUT_TABLET)	+= tablet/
 obj-$(CONFIG_INPUT_TOUCHSCREEN)	+= touchscreen/
 obj-$(CONFIG_INPUT_MISC)	+= misc/
 
+obj-$(CONFIG_INPUT_LIRC)       += lirc/
diff --git a/drivers/input/lirc/Kconfig b/drivers/input/lirc/Kconfig
new file mode 100644
index 0000000..138e58a
--- /dev/null
+++ b/drivers/input/lirc/Kconfig
@@ -0,0 +1,127 @@
+#
+# LIRC driver(s) configuration
+#
+menuconfig INPUT_LIRC
+	bool "Linux Infrared Remote Control IR receiver/transmitter drivers"
+	default n
+	help
+	  Say Y here, and all supported Linux Infrared Remote Control IR and
+	  RF receiver and transmitter drivers will be displayed. When paired
+	  with a remote control and the lirc daemon, the receiver drivers
+	  allow control of your Linux system via remote control.
+
+if INPUT_LIRC
+
+config LIRC_DEV
+	tristate "LIRC device loadable module support"
+	default m
+	help
+	  LIRC device loadable module support, required for most LIRC drivers
+
+config LIRC_ATIUSB
+	tristate "ATI RF USB Receiver support"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the ATI USB RF remote receiver
+
+config LIRC_BT829
+        tristate "BT829 based hardware"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the IR interface on BT829-based hardware
+
+config LIRC_CMDIR
+	tristate "CommandIR USB Transceiver"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the CommandIR USB Transceiver
+
+config LIRC_I2C
+	tristate "I2C Based IR Receivers"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for I2C-based IR receivers, such as those commonly
+	  found onboard Hauppauge PVR-150/250/350 video capture cards
+
+config LIRC_IGORPLUGUSB
+	tristate "Igor Cesko's USB IR Receiver"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for Igor Cesko's USB IR Receiver
+
+config LIRC_IMON
+	tristate "Soundgraph IMON Receiver"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the Soundgraph IMON IR Receiver
+
+config LIRC_IT87
+	tristate "ITE IT87XX CIR Port Receiver"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the ITE IT87xx IR Receiver
+
+config LIRC_MCEUSB
+	tristate "Microsoft Media Center Ed. Receiver, v1"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the Microsoft Media Center Ed. Receiver, v1
+
+config LIRC_MCEUSB2
+	tristate "Microsoft Media Center Ed. Receiver, v2"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the Microsoft Media Center Ed. Receiver, v2
+
+config LIRC_PVR150
+	tristate "Hauppauge PVR-XXX Transmitter"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the Hauppauge PVR-150/250/350/500 IR Transmitter
+
+config LIRC_PARALLEL
+	tristate "Homebrew Parallel Port Receiver"
+	default m
+	depends on LIRC_DEV && !SMP
+	help
+	  Driver for Homebrew Parallel Port Receivers
+
+config LIRC_SERIAL
+	tristate "Homebrew Serial Port Receiver"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for Homebrew Serial Port Receivers
+
+config LIRC_SIR
+	tristate "Built-in SIR IrDA port"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the SIR IrDA port
+
+config LIRC_STREAMZAP
+	tristate "Streamzap PC Receiver"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the Streamzap PC Receiver
+
+config LIRC_TTUSBIR
+	tristate "Technotrend USB IR Receiver"
+	default m
+	depends on LIRC_DEV
+	help
+	  Driver for the Technotrend USB IR Receiver
+
+endif
diff --git a/drivers/input/lirc/Makefile b/drivers/input/lirc/Makefile
new file mode 100644
index 0000000..71124ef
--- /dev/null
+++ b/drivers/input/lirc/Makefile
@@ -0,0 +1,24 @@
+# Makefile for the lirc drivers.
+#
+
+# Each configuration option enables a list of files.
[...17280 lines suppressed...]
+		if (ttusbir->last_pulse == buf[i]) {
+			if (ttusbir->last_num < PULSE_MASK/63)
+				ttusbir->last_num++;
+		/* else we are in a idle period and do not need to
+		 * increment any longer */
+		} else {
+			l = ttusbir->last_num * 62; /* about 62 = us/byte */
+			if (ttusbir->last_pulse) /* pulse or space? */
+				l |= PULSE_BIT;
+			if (!lirc_buffer_full(&ttusbir->rbuf)) {
+				lirc_buffer_write_1(&ttusbir->rbuf, (void *)&l);
+				wake_up_interruptible(&ttusbir->rbuf.wait_poll);
+			}
+			ttusbir->last_num = 0;
+			ttusbir->last_pulse = buf[i];
+		}
+	}
+	usb_submit_urb(urb, GFP_ATOMIC); /* keep data rolling :-) */
+}
+
+/* Called whenever the USB subsystem thinks we could be the right driver
+   to handle this device
+*/
+static int probe(struct usb_interface *intf, const struct usb_device_id *id)
+{
+	int alt_set, endp;
+	int found = 0;
+	int i, j;
+	int struct_size;
+	struct usb_host_interface *host_interf;
+	struct usb_interface_descriptor *interf_desc;
+	struct usb_host_endpoint *host_endpoint;
+	struct ttusbir_device *ttusbir;
+
+	DPRINTK("Module ttusbir probe\n");
+
+	/* To reduce memory fragmentation we use only one allocation */
+	struct_size =  sizeof(struct ttusbir_device) +
+		(sizeof(struct urb *) * num_urbs) +
+		(sizeof(char *) * num_urbs) +
+		(num_urbs * 128);
+	ttusbir = kmalloc(struct_size, GFP_KERNEL);
+	if (!ttusbir)
+		return -ENOMEM;
+	memset(ttusbir, 0, struct_size);
+
+	ttusbir->urb = (struct urb **)((char *)ttusbir +
+				      sizeof(struct ttusbir_device));
+	ttusbir->buffer = (char **)((char *)ttusbir->urb +
+				   (sizeof(struct urb *) * num_urbs));
+	for (i = 0; i < num_urbs; i++)
+		ttusbir->buffer[i] = (char *)ttusbir->buffer +
+			(sizeof(char *)*num_urbs) + (i * 128);
+
+	ttusbir->driver = &driver;
+	ttusbir->alt_setting = -1;
+	/* @TODO check if error can be returned */
+	ttusbir->udev = usb_get_dev(interface_to_usbdev(intf));
+	ttusbir->interf = intf;
+	ttusbir->last_pulse = 0x00;
+	ttusbir->last_num = 0;
+
+	/* Now look for interface setting we can handle
+	   We are searching for the alt setting where end point
+	   0x82 has max packet size 16
+	*/
+	for (alt_set = 0; alt_set < intf->num_altsetting && !found; alt_set++) {
+		host_interf = &intf->altsetting[alt_set];
+		interf_desc = &host_interf->desc;
+		for (endp = 0; endp < interf_desc->bNumEndpoints; endp++) {
+			host_endpoint = &host_interf->endpoint[endp];
+			if ((host_endpoint->desc.bEndpointAddress == 0x82) &&
+			    (host_endpoint->desc.wMaxPacketSize == 0x10)) {
+				ttusbir->alt_setting = alt_set;
+				ttusbir->endpoint = endp;
+				found = 1;
+				break;
+			}
+		}
+	}
+	if (ttusbir->alt_setting != -1)
+		DPRINTK("alt setting: %d\n", ttusbir->alt_setting);
+	else {
+		err("Could not find alternate setting\n");
+		kfree(ttusbir);
+		return -EINVAL;
+	}
+
+	/* OK lets setup this interface setting */
+	usb_set_interface(ttusbir->udev, 0, ttusbir->alt_setting);
+
+	/* Store device info in interface structure */
+	usb_set_intfdata(intf, ttusbir);
+
+	/* Register as a LIRC plugin */
+	if (lirc_buffer_init(&ttusbir->rbuf, sizeof(lirc_t), 256) < 0) {
+		err("Could not get memory for LIRC data buffer\n");
+		usb_set_intfdata(intf, NULL);
+		kfree(ttusbir);
+		return -ENOMEM;
+	}
+	strcpy(ttusbir->plugin.name, "TTUSBIR");
+	ttusbir->plugin.minor = -1;
+	ttusbir->plugin.code_length = 1;
+	ttusbir->plugin.sample_rate = 0;
+	ttusbir->plugin.data = ttusbir;
+	ttusbir->plugin.add_to_buf = NULL;
+	ttusbir->plugin.get_queue = NULL;
+	ttusbir->plugin.rbuf = &ttusbir->rbuf;
+	ttusbir->plugin.set_use_inc = set_use_inc;
+	ttusbir->plugin.set_use_dec = set_use_dec;
+	ttusbir->plugin.ioctl = NULL;
+	ttusbir->plugin.fops = NULL;
+	ttusbir->plugin.owner = THIS_MODULE;
+	ttusbir->plugin.features = LIRC_CAN_REC_MODE2;
+	ttusbir->minor = lirc_register_plugin(&ttusbir->plugin);
+	if (ttusbir->minor < 0) {
+		err("Error registering as LIRC plugin\n");
+		usb_set_intfdata(intf, NULL);
+		lirc_buffer_free(&ttusbir->rbuf);
+		kfree(ttusbir);
+		return -EIO;
+	}
+
+	/* Allocate and setup the URB that we will use to talk to the device */
+	for (i = 0; i < num_urbs; i++) {
+		ttusbir->urb[i] = usb_alloc_urb(8, GFP_KERNEL);
+		if (!ttusbir->urb[i]) {
+			err("Could not allocate memory for the URB\n");
+			for (j = i - 1; j >= 0; j--)
+				kfree(ttusbir->urb[j]);
+			lirc_buffer_free(&ttusbir->rbuf);
+			lirc_unregister_plugin(ttusbir->minor);
+			kfree(ttusbir);
+			usb_set_intfdata(intf, NULL);
+			return -ENOMEM;
+		}
+		ttusbir->urb[i]->dev = ttusbir->udev;
+		ttusbir->urb[i]->context = ttusbir;
+		ttusbir->urb[i]->pipe = usb_rcvisocpipe(ttusbir->udev,
+							ttusbir->endpoint);
+		ttusbir->urb[i]->interval = 1;
+		ttusbir->urb[i]->transfer_flags = URB_ISO_ASAP;
+		ttusbir->urb[i]->transfer_buffer = &ttusbir->buffer[i][0];
+		ttusbir->urb[i]->complete = urb_complete;
+		ttusbir->urb[i]->number_of_packets = 8;
+		ttusbir->urb[i]->transfer_buffer_length = 128;
+		for (j = 0; j < 8; j++) {
+			ttusbir->urb[i]->iso_frame_desc[j].offset = j*16;
+			ttusbir->urb[i]->iso_frame_desc[j].length = 16;
+		}
+	}
+	return 0;
+}
+
+/* Called when the driver is unloaded or the device is unplugged
+ */
+static void disconnect(struct usb_interface *intf)
+{
+	int i;
+	struct ttusbir_device *ttusbir;
+
+	DPRINTK("Module ttusbir disconnect\n");
+
+	ttusbir = (struct ttusbir_device *) usb_get_intfdata(intf);
+	usb_set_intfdata(intf, NULL);
+	lirc_unregister_plugin(ttusbir->minor);
+	DPRINTK("unregistered\n");
+
+	for (i = 0; i < num_urbs; i++) {
+		usb_kill_urb(ttusbir->urb[i]);
+		usb_free_urb(ttusbir->urb[i]);
+	}
+	DPRINTK("URBs killed\n");
+	lirc_buffer_free(&ttusbir->rbuf);
+	kfree(ttusbir);
+}
+
+static int ttusbir_init_module(void)
+{
+	int result;
+
+	DPRINTK(KERN_DEBUG "Module ttusbir init\n");
+
+	/* register this driver with the USB subsystem */
+	result = usb_register(&driver);
+	if (result)
+		err("usb_register failed. Error number %d", result);
+	return result;
+}
+
+static void ttusbir_exit_module(void)
+{
+	printk(KERN_DEBUG "Module ttusbir exit\n");
+	/* deregister this driver with the USB subsystem */
+	usb_deregister(&driver);
+}
+
+module_init(ttusbir_init_module);
+module_exit(ttusbir_exit_module);

linux-2.6-netdev-atl2.patch:

--- NEW FILE linux-2.6-netdev-atl2.patch ---
diff -Nurp a/drivers/net/atl2/atl2_ethtool.c b/drivers/net/atl2/atl2_ethtool.c
--- a/drivers/net/atl2/atl2_ethtool.c	1969-12-31 19:00:00.000000000 -0500
+++ b/drivers/net/atl2/atl2_ethtool.c	2007-12-10 12:45:39.000000000 -0500
@@ -0,0 +1,416 @@
+/* atl2_ethtool.c -- atl2 ethtool support
+ *
+ * Copyright(c) 2007 Atheros Corporation. All rights reserved.
+ * Copyright(c) 2006 xiong huang <xiong.huang at atheros.com>
+ * Copyright(c) 2007 Chris Snook <csnook at redhat.com>
+ *
+ * Derived from Intel e1000 driver
+ * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#include <linux/bitops.h>
+#include <linux/ethtool.h>
+#include <linux/mii.h>
+#include <linux/netdevice.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/types.h>
+
+#include "atl2.h"
+#include "atl2_hw.h"
+
+extern char atl2_driver_name[];
+extern char atl2_driver_version[];
+
+extern int atl2_up(struct atl2_adapter *adapter);
+extern void atl2_down(struct atl2_adapter *adapter);
+extern void atl2_reinit_locked(struct atl2_adapter *adapter);
+extern s32 atl2_reset_hw(struct atl2_hw *hw);
+
+static int
+atl2_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+{
+	struct atl2_adapter *adapter = netdev_priv(netdev);
+	struct atl2_hw *hw = &adapter->hw;
+
+	ecmd->supported = (SUPPORTED_10baseT_Half |
+		SUPPORTED_10baseT_Full |
+		SUPPORTED_100baseT_Half |
+		SUPPORTED_100baseT_Full |
+		SUPPORTED_Autoneg |
+		SUPPORTED_TP);
+	ecmd->advertising = ADVERTISED_TP;
+
+	ecmd->advertising |= ADVERTISED_Autoneg;
+	ecmd->advertising |= hw->autoneg_advertised;
+
+	ecmd->port = PORT_TP;
+	ecmd->phy_address = 0;
+	ecmd->transceiver = XCVR_INTERNAL;
+
+	if (adapter->link_speed != SPEED_0) {
+		ecmd->speed = adapter->link_speed;
+		if (adapter->link_duplex == FULL_DUPLEX)
+			ecmd->duplex = DUPLEX_FULL;
+		else
+			ecmd->duplex = DUPLEX_HALF;
+	} else {
+		ecmd->speed = -1;
+		ecmd->duplex = -1;
+	}
+
+	ecmd->autoneg = AUTONEG_ENABLE;
+	return 0;
+}
+
+static int
+atl2_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+{
+	struct atl2_adapter *adapter = netdev_priv(netdev);
+	struct atl2_hw *hw = &adapter->hw;
+
+	while (test_and_set_bit(__ATL2_RESETTING, &adapter->flags))
+		msleep(1);
+
+	if (ecmd->autoneg == AUTONEG_ENABLE) {
+#define MY_ADV_MASK	(ADVERTISE_10_HALF| \
+					 ADVERTISE_10_FULL| \
+					 ADVERTISE_100_HALF| \
+					 ADVERTISE_100_FULL)
+
+		if ((ecmd->advertising&MY_ADV_MASK) == MY_ADV_MASK) {
+			hw->MediaType = MEDIA_TYPE_AUTO_SENSOR;
+			hw->autoneg_advertised =  MY_ADV_MASK;
+		} else if ((ecmd->advertising&MY_ADV_MASK) == ADVERTISE_100_FULL) {
+			hw->MediaType = MEDIA_TYPE_100M_FULL;
+			hw->autoneg_advertised = ADVERTISE_100_FULL;
+		} else if ((ecmd->advertising&MY_ADV_MASK) == ADVERTISE_100_HALF) {
+			hw->MediaType = MEDIA_TYPE_100M_HALF;
+			hw->autoneg_advertised = ADVERTISE_100_HALF;
+		} else if ((ecmd->advertising&MY_ADV_MASK) == ADVERTISE_10_FULL) {
+			hw->MediaType = MEDIA_TYPE_10M_FULL;
+			hw->autoneg_advertised = ADVERTISE_10_FULL;
+		}  else if ((ecmd->advertising&MY_ADV_MASK) == ADVERTISE_10_HALF) {
+			hw->MediaType = MEDIA_TYPE_10M_HALF;
+			hw->autoneg_advertised = ADVERTISE_10_HALF;
+		} else {
+			clear_bit(__ATL2_RESETTING, &adapter->flags);
+			return -EINVAL;
+		}
+		ecmd->advertising = hw->autoneg_advertised |
+			ADVERTISED_TP | ADVERTISED_Autoneg;
+	} else {
+		clear_bit(__ATL2_RESETTING, &adapter->flags);
+		return -EINVAL;
+	}
+
+	/* reset the link */
+	if (netif_running(adapter->netdev)) {
+		atl2_down(adapter);
+		atl2_up(adapter);
+	} else
+		atl2_reset_hw(&adapter->hw);
+
+	clear_bit(__ATL2_RESETTING, &adapter->flags);
+	return 0;
+}
+
+static u32
+atl2_get_tx_csum(struct net_device *netdev)
+{
+	return (netdev->features & NETIF_F_HW_CSUM) != 0;
+}
+
+static u32
+atl2_get_msglevel(struct net_device *netdev)
+{
+	return 0;
+}
+
+/*
+ * It's sane for this to be empty, but we might want to take advantage of this.
+ */
+static void
+atl2_set_msglevel(struct net_device *netdev, u32 data)
+{
+}
+
+static int
+atl2_get_regs_len(struct net_device *netdev)
+{
+#define ATL2_REGS_LEN 42
+	return ATL2_REGS_LEN * sizeof(u32);
+}
+
+static void
+atl2_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
+{
+	struct atl2_adapter *adapter = netdev_priv(netdev);
+	struct atl2_hw *hw = &adapter->hw;
+	u32 *regs_buff = p;
+	u16 phy_data;
+
+	memset(p, 0, ATL2_REGS_LEN * sizeof(u32));
+
+	regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id;
+
+	regs_buff[0]  = ATL2_READ_REG(hw, REG_VPD_CAP);
+	regs_buff[1]  = ATL2_READ_REG(hw, REG_SPI_FLASH_CTRL);
+	regs_buff[2]  = ATL2_READ_REG(hw, REG_SPI_FLASH_CONFIG);
+	regs_buff[3]  = ATL2_READ_REG(hw, REG_TWSI_CTRL);
+	regs_buff[4]  = ATL2_READ_REG(hw, REG_PCIE_DEV_MISC_CTRL);
+	regs_buff[5]  = ATL2_READ_REG(hw, REG_MASTER_CTRL);
+	regs_buff[6]  = ATL2_READ_REG(hw, REG_MANUAL_TIMER_INIT);
+	regs_buff[7]  = ATL2_READ_REG(hw, REG_IRQ_MODU_TIMER_INIT);
+	regs_buff[8]  = ATL2_READ_REG(hw, REG_PHY_ENABLE);
+	regs_buff[9]  = ATL2_READ_REG(hw, REG_CMBDISDMA_TIMER);
+	regs_buff[10] = ATL2_READ_REG(hw, REG_IDLE_STATUS);
+	regs_buff[11] = ATL2_READ_REG(hw, REG_MDIO_CTRL);
+	regs_buff[12] = ATL2_READ_REG(hw, REG_SERDES_LOCK);
+	regs_buff[13] = ATL2_READ_REG(hw, REG_MAC_CTRL);
+	regs_buff[14] = ATL2_READ_REG(hw, REG_MAC_IPG_IFG);
+	regs_buff[15] = ATL2_READ_REG(hw, REG_MAC_STA_ADDR);
+	regs_buff[16] = ATL2_READ_REG(hw, REG_MAC_STA_ADDR+4);
+	regs_buff[17] = ATL2_READ_REG(hw, REG_RX_HASH_TABLE);
+	regs_buff[18] = ATL2_READ_REG(hw, REG_RX_HASH_TABLE+4);
+	regs_buff[19] = ATL2_READ_REG(hw, REG_MAC_HALF_DUPLX_CTRL);
+	regs_buff[20] = ATL2_READ_REG(hw, REG_MTU);
+	regs_buff[21] = ATL2_READ_REG(hw, REG_WOL_CTRL);
+	regs_buff[22] = ATL2_READ_REG(hw, REG_SRAM_TXRAM_END);
+	regs_buff[23] = ATL2_READ_REG(hw, REG_DESC_BASE_ADDR_HI);
+	regs_buff[24] = ATL2_READ_REG(hw, REG_TXD_BASE_ADDR_LO);
[...3961 lines suppressed...]
+		case enable_option:
+			switch (*value) {
+				case OPTION_ENABLED:
+					printk(KERN_INFO "%s Enabled\n", opt->name);
+					return 0;
+					break;
+				case OPTION_DISABLED:
+					printk(KERN_INFO "%s Disabled\n", opt->name);
+					return 0;
+					break;
+			}
+			break;
+		case range_option:
+			if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
+				printk(KERN_INFO "%s set to %i\n", opt->name, *value);
+				return 0;
+			}
+			break;
+		case list_option:
+			for(i = 0; i < opt->arg.l.nr; i++) {
+				ent = &opt->arg.l.p[i];
+				if(*value == ent->i) {
+					if(ent->str[0] != '\0')
+						printk(KERN_INFO "%s\n", ent->str);
+				return 0;
+				}
+			}
+			break;
+		default:
+			BUG();
+	}
+
+	printk(KERN_INFO "Invalid %s specified (%i) %s\n",
+		opt->name, *value, opt->err);
+	*value = opt->def;
+	return -1;
+}
+
+/**
+ * atl2_check_options - Range Checking for Command Line Parameters
+ * @adapter: board private structure
+ *
+ * This routine checks all command line parameters for valid user
+ * input.  If an invalid value is given, or if no user specified
+ * value exists, a default value is used.  The final value is stored
+ * in a variable in the adapter structure.
+ **/
+void __devinit
+atl2_check_options(struct atl2_adapter *adapter)
+{
+	int val;
+	struct atl2_option opt;
+	int bd = adapter->bd_number;
+	if(bd >= ATL2_MAX_NIC) {
+		printk(KERN_NOTICE "Warning: no configuration for board #%i\n", bd);
+		printk(KERN_NOTICE "Using defaults for all values\n");
+#ifndef module_param_array
+		bd = ATL2_MAX_NIC;
+#endif
+	}
+
+	/* Bytes of Transmit Memory */
+	opt.type = range_option;
+	opt.name = "Bytes of Transmit Memory";
+	opt.err = "using default of " __MODULE_STRING(ATL2_DEFAULT_TX_MEMSIZE);
+	opt.def = ATL2_DEFAULT_TX_MEMSIZE;
+	opt.arg.r.min = ATL2_MIN_TX_MEMSIZE;
+	opt.arg.r.max = ATL2_MAX_TX_MEMSIZE;
+#ifdef module_param_array
+	if(num_TxMemSize > bd) {
+#endif
+		val = TxMemSize[bd];
+		atl2_validate_option(&val, &opt);
+		adapter->txd_ring_size = ((u32) val) * 1024;
+#ifdef module_param_array
+        } else {
+		adapter->txd_ring_size = ((u32)opt.def) * 1024;
+	}
+#endif
+	// txs ring size:
+	adapter->txs_ring_size = adapter->txd_ring_size / 128;
+	if (adapter->txs_ring_size > 160)
+		adapter->txs_ring_size = 160;
+
+	/* Receive Memory Block Count */
+	opt.type = range_option;
+	opt.name = "Number of receive memory block";
+	opt.err = "using default of " __MODULE_STRING(ATL2_DEFAULT_RXD_COUNT);
+	opt.def = ATL2_DEFAULT_RXD_COUNT;
+	opt.arg.r.min = ATL2_MIN_RXD_COUNT;
+	opt.arg.r.max = ATL2_MAX_RXD_COUNT;
+#ifdef module_param_array
+	if(num_RxMemBlock > bd) {
+#endif
+		val = RxMemBlock[bd];
+		atl2_validate_option(&val, &opt);
+		adapter->rxd_ring_size = (u32)val; //((u16)val)&~1; // even number
+#ifdef module_param_array
+	} else {
+		adapter->rxd_ring_size = (u32)opt.def;
+	}
+#endif
+	// init RXD Flow control value
+	adapter->hw.fc_rxd_hi = (adapter->rxd_ring_size/8)*7;
+	adapter->hw.fc_rxd_lo = (ATL2_MIN_RXD_COUNT/8) > (adapter->rxd_ring_size/12) ?
+		(ATL2_MIN_RXD_COUNT/8) : (adapter->rxd_ring_size/12);
+
+	/* Interrupt Moderate Timer */
+	opt.type = range_option;
+	opt.name = "Interrupt Moderate Timer";
+	opt.err = "using default of " __MODULE_STRING(INT_MOD_DEFAULT_CNT);
+	opt.def = INT_MOD_DEFAULT_CNT;
+	opt.arg.r.min = INT_MOD_MIN_CNT;
+	opt.arg.r.max = INT_MOD_MAX_CNT;
+#ifdef module_param_array
+	if(num_IntModTimer > bd) {
+#endif
+		val = IntModTimer[bd];
+		atl2_validate_option(&val, &opt);
+		adapter->imt = (u16) val;
+#ifdef module_param_array
+	} else {
+		adapter->imt = (u16)(opt.def);
+	}
+#endif
+	/* Flash Vendor */
+	opt.type = range_option;
+	opt.name = "SPI Flash Vendor";
+	opt.err = "using default of " __MODULE_STRING(FLASH_VENDOR_DEFAULT);
+	opt.def = FLASH_VENDOR_DEFAULT;
+	opt.arg.r.min = FLASH_VENDOR_MIN;
+	opt.arg.r.max = FLASH_VENDOR_MAX;
+#ifdef module_param_array
+	if(num_FlashVendor > bd) {
+#endif
+		val = FlashVendor[bd];
+		atl2_validate_option(&val, &opt);
+		adapter->hw.flash_vendor = (u8) val;
+#ifdef module_param_array
+	} else {
+		adapter->hw.flash_vendor = (u8)(opt.def);
+	}
+#endif
+	/* MediaType */
+	opt.type = range_option;
+	opt.name = "Speed/Duplex Selection";
+	opt.err = "using default of " __MODULE_STRING(MEDIA_TYPE_AUTO_SENSOR);
+	opt.def = MEDIA_TYPE_AUTO_SENSOR;
+	opt.arg.r.min = MEDIA_TYPE_AUTO_SENSOR;
+	opt.arg.r.max = MEDIA_TYPE_10M_HALF;
+#ifdef module_param_array
+	if(num_MediaType > bd) {
+#endif
+		val = MediaType[bd];
+		atl2_validate_option(&val, &opt);
+		adapter->hw.MediaType = (u16) val;
+#ifdef module_param_array
+	} else {
+		adapter->hw.MediaType = (u16)(opt.def);
+	}
+#endif
+}
diff -Nurp a/drivers/net/atl2/Makefile b/drivers/net/atl2/Makefile
--- a/drivers/net/atl2/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ b/drivers/net/atl2/Makefile	2008-01-31 14:37:35.000000000 -0500
@@ -0,0 +1,2 @@
+obj-$(CONFIG_ATL2)	+= atl2.o
+atl2-y			+= atl2_main.o atl2_hw.o atl2_ethtool.o atl2_param.o
diff -Nurp a/drivers/net/Kconfig b/drivers/net/Kconfig
--- a/drivers/net/Kconfig	2008-01-31 14:32:05.000000000 -0500
+++ b/drivers/net/Kconfig	2008-01-31 14:44:01.000000000 -0500
@@ -1999,6 +1999,17 @@ config NE_H8300
 	  Say Y here if you want to use the NE2000 compatible
 	  controller on the Renesas H8/300 processor.
 
+config ATL2
+	tristate "Atheros L2 Fast Ethernet support (EXPERIMENTAL)"
+	depends on PCI && EXPERIMENTAL
+	select CRC32
+	select MII
+	help
+	  This driver supports the Atheros L2 fast ethernet adapter.
+
+	  To compile this driver as a module, choose M here.  The module
+	  will be called atl2.
+
 source "drivers/net/fec_8xx/Kconfig"
 source "drivers/net/fs_enet/Kconfig"
 
diff -Nurp a/drivers/net/Makefile b/drivers/net/Makefile
--- a/drivers/net/Makefile	2008-01-31 14:32:05.000000000 -0500
+++ b/drivers/net/Makefile	2008-01-31 14:38:52.000000000 -0500
@@ -11,6 +11,7 @@ obj-$(CONFIG_CHELSIO_T3) += cxgb3/
 obj-$(CONFIG_EHEA) += ehea/
 obj-$(CONFIG_BONDING) += bonding/
 obj-$(CONFIG_ATL1) += atl1/
+obj-$(CONFIG_ATL2) += atl2/
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
 obj-$(CONFIG_TEHUTI) += tehuti.o
 

linux-2.6-netdev-bonding-fix-null-deref.patch:

--- NEW FILE linux-2.6-netdev-bonding-fix-null-deref.patch ---
From: Jay Vosburgh <fubar at us.ibm.com>
Date: Wed, 30 Jan 2008 02:07:45 +0000 (-0800)
Subject: bonding: fix NULL pointer deref in startup processing
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fjgarzik%2Fnetdev-2.6.git;a=commitdiff_plain;h=5eb71eec3616b0a62e63197016576a74da240c6b

bonding: fix NULL pointer deref in startup processing

	Fix the "are we creating a duplicate" check to not compare
the name if the name is NULL (meaning that the system should select
a name).  Bug reported by Benny Amorsen <benny+usenet at amorsen.dk>.

Signed-off-by: Jay Vosburgh <fubar at us.ibm.com>
Signed-off-by: Jeff Garzik <jeff at garzik.org>
---

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 65c7eba..81b4574 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4896,14 +4896,16 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
 	down_write(&bonding_rwsem);
 
 	/* Check to see if the bond already exists. */
-	list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
-		if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
-			printk(KERN_ERR DRV_NAME
+	if (name) {
+		list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
+			if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
+				printk(KERN_ERR DRV_NAME
 			       ": cannot add bond %s; it already exists\n",
-			       name);
-			res = -EPERM;
-			goto out_rtnl;
-		}
+				       name);
+				res = -EPERM;
+				goto out_rtnl;
+			}
+	}
 
 	bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
 				ether_setup);

linux-2.6-netdev-e1000-disable-alpm.patch:

--- NEW FILE linux-2.6-netdev-e1000-disable-alpm.patch ---
Port of f2fa3114919fa195f800a04a5e57156c0f67fff4 (from the netdev tree)
from e1000e to e1000.

Should fix the checksum problems too.

bz #400561 (F8)
---
 drivers/net/e1000/e1000_main.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

--- linux-2.6.23.noarch.orig/drivers/net/e1000/e1000_main.c
+++ linux-2.6.23.noarch/drivers/net/e1000/e1000_main.c
@@ -846,6 +846,33 @@ e1000_reset(struct e1000_adapter *adapte
 	e1000_release_manageability(adapter);
 }
 
+static void e1000e_disable_l1aspm(struct pci_dev *pdev)
+{
+	int pos;
+	u32 cap;
+	u16 val;
+
+	/*
+	 * 82573 workaround - disable L1 ASPM on mobile chipsets
+	 *
+	 * L1 ASPM on various mobile (ich7) chipsets do not behave properly
+	 * resulting in lost data or garbage information on the pci-e link
+	 * level. This could result in (false) bad EEPROM checksum errors,
+	 * long ping times (up to 2s) or even a system freeze/hang.
+	 *
+	 * Unfortunately this feature saves about 1W power consumption when
+	 * active.
+	 */
+	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
+	pci_read_config_dword(pdev, pos + PCI_EXP_LNKCAP, &cap);
+	pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &val);
+	if (val & 0x2) {
+		dev_warn(&pdev->dev, "Disabling L1 ASPM\n");
+		val &= ~0x2;
+		pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, val);
+	}
+}
+
 /**
  * e1000_probe - Device Initialization Routine
  * @pdev: PCI device information struct
@@ -872,6 +899,7 @@ e1000_probe(struct pci_dev *pdev,
 	uint16_t eeprom_apme_mask = E1000_EEPROM_APME;
 	DECLARE_MAC_BUF(mac);
 
+	e1000e_disable_l1aspm(pdev);
 	if ((err = pci_enable_device(pdev)))
 		return err;
 
@@ -5180,6 +5209,7 @@ e1000_resume(struct pci_dev *pdev)
 
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
+	e1000e_disable_l1aspm(pdev);
 	if ((err = pci_enable_device(pdev))) {
 		printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
 		return err;
@@ -5276,6 +5306,7 @@ static pci_ers_result_t e1000_io_slot_re
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct e1000_adapter *adapter = netdev->priv;
 
+	e1000e_disable_l1aspm(pdev);
 	if (pci_enable_device(pdev)) {
 		printk(KERN_ERR "e1000: Cannot re-enable PCI device after reset.\n");
 		return PCI_ERS_RESULT_DISCONNECT;

linux-2.6-pasemi-for-2.6.25.patch:

--- NEW FILE linux-2.6-pasemi-for-2.6.25.patch ---
commit a7fe365fc5de83d07fad485f4e298b2ce351e74c
Author: Olof Johansson <olof at lixom.net>
Date:   Sun Dec 2 22:35:25 2007 -0600

    [POWERPC] pasemi: Fix module information for gpio-mdio
    
    Fix up the module information for gpio-mdio, it wouldn't load
    because of lacking license, and wouldn't auto-load because of missing
    MODULE_DEVICE_TABLE.
    
    Signed-off-by: Olof Johansson <olof at lixom.net>

commit d4979a554a2371d45822e9904f94cf94f7852258
Author: Olof Johansson <olof at lixom.net>
Date:   Fri Nov 30 17:42:11 2007 -0600

    [POWERPC] pasemi: Register i2c_board_info
    
    Setup i2c_board_info based on device tree contents. This has to be
    a device_initcall since we need PCI to be probed by the time we
    run it, but before the actual driver is initialized.
    
    Signed-off-by: Olof Johansson <olof at lixom.net>

commit f84d132e591691d859afaebd6a63073588dc8d97
Author: Olof Johansson <olof at lixom.net>
Date:   Thu Nov 29 21:32:38 2007 -0600

    [POWERPC] Consolidate compatible-to-i2c_boardinfo mapping code
    
    Move the mapping from device tree compatible field to i2c_boardinfo
    structures for powerpc, since several platforms now use this.
    
    Signed-off-by: Olof Johansson <olof at lixom.net>

commit 32e2b55eec7116a859b384dbcc4b52a54a156869
Author: Olof Johansson <olof at lixom.net>
Date:   Wed Nov 7 09:31:06 2007 -0600

    [POWERPC] pasemi: Move cpus to hold loop before restart
    
    Use smp_send_stop() to move all cpus besides the one executing reboot
    into a hold loop, to keep them from being in powersavings mode at the
    time of reboot.
    
    Signed-off-by: Olof Johansson <olof at lixom.net>

commit 8b32bc03256c82a6a4fcb3c2520b54469b74ec82
Author: Olof Johansson <olof at lixom.net>
Date:   Wed Nov 7 09:26:06 2007 -0600

    [POWERPC] pasemi: Don't enter powersaving states from elevated astates
    
    When the PWRficient cpus are entered into powersavings states, the
    astate is automatically dropped down to 0. While we still restore it
    when we come out of idle, it can still cause some weird effects with
    respect to performance (especially since it takes a while to ramp up to
    higher astates).
    
    So, to avoid this, don't enter power savings when the cpufreq driver
    (or user) has set higher astates than 0.
    
    The restore is still required, since there's a chance the astate has
    been raised from the other cpu while the idling one was asleep.
    
    Signed-off-by: Olof Johansson <olof at lixom.net>

commit 0d08a84770cb03aea24268e515342d44df8ea588
Author: Olof Johansson <olof at lixom.net>
Date:   Sun Nov 4 20:57:45 2007 -0600

    [POWERPC] pasemi: Broaden specific references to 1682M
    
    There will be more product numbers in the future than just PA6T-1682M,
    but they will share much of the features. Remove some of the explicit
    references and compatibility checks with 1682M, and replace most of them
    with the more generic term "PWRficient".
    
    Signed-off-by: Olof Johansson <olof at lixom.net>
    Acked-by: Michael Buesch <mb at bu3sch.de>
    Acked-by: Doug Thompson <dougthompson at xmission.com>

commit 2dd3c0016090543e12aa0c5aee574ded6a88b886
Author: Olof Johansson <olof at lixom.net>
Date:   Sun Nov 4 15:44:15 2007 -0600

    [POWERPC] pasemi: clean up mdio_gpio a bit
    
    Misc cleanups of mdio_gpio:
    * Better error handling/unrolling in case of init/alloc failures
    * Go through child nodes and get their interrupts instead of using
      hardcoded values
    * Remap the GPIO registers at module load/driver init instead of during probe
    * Coding style and other misc cleanups
    
    Signed-off-by: Olof Johansson <olof at lixom.net>
diff --git a/arch/powerpc/platforms/pasemi/Kconfig b/arch/powerpc/platforms/pasemi/Kconfig
index 735e153..2f4dd6e 100644
--- a/arch/powerpc/platforms/pasemi/Kconfig
+++ b/arch/powerpc/platforms/pasemi/Kconfig
@@ -17,7 +17,7 @@ config PPC_PASEMI_IOMMU
 	bool "PA Semi IOMMU support"
 	depends on PPC_PASEMI
 	help
-	  IOMMU support for PA6T-1682M
+	  IOMMU support for PA Semi PWRficient
 
 config PPC_PASEMI_IOMMU_DMA_FORCE
 	bool "Force DMA engine to use IOMMU"
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile
index f47fcac..6b8af1f 100644
--- a/arch/powerpc/platforms/pasemi/Makefile
+++ b/arch/powerpc/platforms/pasemi/Makefile
@@ -1,4 +1,4 @@
-obj-y	+= setup.o pci.o time.o idle.o powersave.o iommu.o
+obj-y	+= setup.o pci.o time.o idle.o powersave.o iommu.o misc.o
 obj-$(CONFIG_PPC_PASEMI_MDIO)	+= gpio_mdio.o
 obj-$(CONFIG_ELECTRA_IDE) += electra_ide.o
 obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c
index 1cfb8b0..58556b0 100644
--- a/arch/powerpc/platforms/pasemi/cpufreq.c
+++ b/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -32,6 +32,7 @@
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/time.h>
+#include <asm/smp.h>
 
 #define SDCASR_REG		0x0100
 #define SDCASR_REG_STRIDE	0x1000
@@ -124,6 +125,11 @@ static void set_astate(int cpu, unsigned int astate)
 	local_irq_restore(flags);
 }
 
+int check_astate(void)
+{
+	return get_cur_astate(hard_smp_processor_id());
+}
+
 void restore_astate(int cpu)
 {
 	set_astate(cpu, current_astate);
@@ -147,7 +153,10 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	if (!cpu)
 		goto out;
 
-	dn = of_find_compatible_node(NULL, "sdc", "1682m-sdc");
+	dn = of_find_compatible_node(NULL, NULL, "1682m-sdc");
+	if (!dn)
+		dn = of_find_compatible_node(NULL, NULL,
+					     "pasemi,pwrficient-sdc");
 	if (!dn)
 		goto out;
 	err = of_address_to_resource(dn, 0, &res);
@@ -160,7 +169,10 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
 		goto out;
 	}
 
-	dn = of_find_compatible_node(NULL, "gizmo", "1682m-gizmo");
+	dn = of_find_compatible_node(NULL, NULL, "1682m-gizmo");
+	if (!dn)
+		dn = of_find_compatible_node(NULL, NULL,
+					     "pasemi,pwrficient-gizmo");
 	if (!dn) {
 		err = -ENODEV;
 		goto out_unmap_sdcasr;
@@ -292,7 +304,8 @@ static struct cpufreq_driver pas_cpufreq_driver = {
 
 static int __init pas_cpufreq_init(void)
 {
-	if (!machine_is_compatible("PA6T-1682M"))
+	if (!machine_is_compatible("PA6T-1682M") &&
+	    !machine_is_compatible("pasemi,pwrficient"))
 		return -ENODEV;
 
 	return cpufreq_register_driver(&pas_cpufreq_driver);
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index dae9f65..04a8686 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -218,45 +218,27 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
 				     const struct of_device_id *match)
 {
 	struct device *dev = &ofdev->dev;
-	struct device_node *np = ofdev->node;
-	struct device_node *gpio_np;
+	struct device_node *phy_dn, *np = ofdev->node;
 	struct mii_bus *new_bus;
-	struct resource res;
 	struct gpio_priv *priv;
 	const unsigned int *prop;
-	int err = 0;
+	int err;
 	int i;
 
-	gpio_np = of_find_compatible_node(NULL, "gpio", "1682m-gpio");
-
-	if (!gpio_np)
-		return -ENODEV;
-
-	err = of_address_to_resource(gpio_np, 0, &res);
-	of_node_put(gpio_np);
-
-	if (err)
-		return -EINVAL;
-
-	if (!gpio_regs)
-		gpio_regs = ioremap(res.start, 0x100);
-
-	if (!gpio_regs)
-		return -EPERM;
-
+	err = -ENOMEM;
 	priv = kzalloc(sizeof(struct gpio_priv), GFP_KERNEL);
-	if (priv == NULL)
-		return -ENOMEM;
+	if (!priv)
+		goto out;
 
 	new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
 
-	if (new_bus == NULL)
-		return -ENOMEM;
+	if (!new_bus)
+		goto out_free_priv;
 
-	new_bus->name = "pasemi gpio mdio bus",
-	new_bus->read = &gpio_mdio_read,
-	new_bus->write = &gpio_mdio_write,
-	new_bus->reset = &gpio_mdio_reset,
+	new_bus->name = "pasemi gpio mdio bus";
+	new_bus->read = &gpio_mdio_read;
+	new_bus->write = &gpio_mdio_write;
+	new_bus->reset = &gpio_mdio_reset;
 
 	prop = of_get_property(np, "reg", NULL);
 	new_bus->id = *prop;
@@ -265,9 +247,24 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
 	new_bus->phy_mask = 0;
 
 	new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
-	for(i = 0; i < PHY_MAX_ADDR; ++i)
-		new_bus->irq[i] = irq_create_mapping(NULL, 10);
 
+	if (!new_bus->irq)
+		goto out_free_bus;
+
+	for (i = 0; i < PHY_MAX_ADDR; i++)
+		new_bus->irq[i] = NO_IRQ;
+
+	for (phy_dn = of_get_next_child(np, NULL);
+	     phy_dn != NULL;
+	     phy_dn = of_get_next_child(np, phy_dn)) {
+		const unsigned int *ip, *regp;
+
+		ip = of_get_property(phy_dn, "interrupts", NULL);
+		regp = of_get_property(phy_dn, "reg", NULL);
+		if (!ip || !regp || *regp >= PHY_MAX_ADDR)
+			continue;
+		new_bus->irq[*regp] = irq_create_mapping(NULL, *ip);
+	}
 
 	prop = of_get_property(np, "mdc-pin", NULL);
 	priv->mdc_pin = *prop;
@@ -280,17 +277,21 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
 
 	err = mdiobus_register(new_bus);
 
-	if (0 != err) {
+	if (err != 0) {
 		printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n",
 				new_bus->name, err);
-		goto bus_register_fail;
+		goto out_free_irq;
 	}
 
 	return 0;
 
-bus_register_fail:
+out_free_irq:
+	kfree(new_bus->irq);
+out_free_bus:
 	kfree(new_bus);
-
+out_free_priv:
+	kfree(priv);
+out:
 	return err;
 }
 
@@ -317,6 +318,7 @@ static struct of_device_id gpio_mdio_match[] =
 	},
 	{},
 };
+MODULE_DEVICE_TABLE(of, gpio_mdio_match);
 
 static struct of_platform_driver gpio_mdio_driver =
 {
@@ -330,12 +332,32 @@ static struct of_platform_driver gpio_mdio_driver =
 
 int gpio_mdio_init(void)
 {
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "1682m-gpio");
+	if (!np)
+		np = of_find_compatible_node(NULL, NULL,
+					     "pasemi,pwrficient-gpio");
+	if (!np)
+		return -ENODEV;
+	gpio_regs = of_iomap(np, 0);
+	of_node_put(np);
+
+	if (!gpio_regs)
+		return -ENODEV;
+
 	return of_register_platform_driver(&gpio_mdio_driver);
 }
+module_init(gpio_mdio_init);
 
 void gpio_mdio_exit(void)
 {
 	of_unregister_platform_driver(&gpio_mdio_driver);
+	if (gpio_regs)
+		iounmap(gpio_regs);
 }
-device_initcall(gpio_mdio_init);
+module_exit(gpio_mdio_exit);
 
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Olof Johansson <olof at lixom.net>");
+MODULE_DESCRIPTION("Driver for MDIO over GPIO on PA Semi PWRficient-based boards");
diff --git a/arch/powerpc/platforms/pasemi/misc.c b/arch/powerpc/platforms/pasemi/misc.c
new file mode 100644
index 0000000..e3a9607
--- /dev/null
+++ b/arch/powerpc/platforms/pasemi/misc.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007 PA Semi, Inc
+ *
+ * Parts based on arch/powerpc/sysdev/fsl_soc.c:
+ *
+ * 2006 (c) MontaVista Software, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/of.h>
+#include <linux/i2c.h>
+#include <asm/i2c_of.h>
+
+#ifdef CONFIG_I2C_BOARDINFO
+static int __init pasemi_register_i2c_devices(void)
+{
+	struct pci_dev *pdev;
+	struct device_node *adap_node;
+	struct device_node *node;
+
+	pdev = NULL;
+	while ((pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa003, pdev))) {
+		adap_node = pci_device_to_OF_node(pdev);
+
+		if (!adap_node)
+			continue;
+
+		node = NULL;
+		while ((node = of_get_next_child(adap_node, node))) {
+			struct i2c_board_info info = {};
+			const u32 *addr;
+			int len;
+
+			addr = of_get_property(node, "reg", &len);
+			if (!addr || len < sizeof(int) ||
+			    *addr > (1 << 10) - 1) {
+				printk(KERN_WARNING
+					"pasemi_register_i2c_devices: "
+					"invalid i2c device entry\n");
+				continue;
+			}
+
+			info.irq = irq_of_parse_and_map(node, 0);
+			if (info.irq == NO_IRQ)
+				info.irq = -1;
+
+			if (of_fill_i2c_info(node, &info) < 0)
+				continue;
+
+			info.addr = *addr;
+
+			i2c_register_board_info(PCI_FUNC(pdev->devfn), &info,
+						1);
+		}
+	}
+	return 0;
+}
+device_initcall(pasemi_register_i2c_devices);
+#endif
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h
index 516acab..c96127b 100644
--- a/arch/powerpc/platforms/pasemi/pasemi.h
+++ b/arch/powerpc/platforms/pasemi/pasemi.h
@@ -16,8 +16,14 @@ extern void idle_doze(void);
 
 /* Restore astate to last set */
 #ifdef CONFIG_PPC_PASEMI_CPUFREQ
+extern int check_astate(void);
 extern void restore_astate(int cpu);
 #else
+static inline int check_astate(void)
+{
+	/* Always return >0 so we never power save */
+	return 1;
+}
 static inline void restore_astate(int cpu)
 {
 }
diff --git a/arch/powerpc/platforms/pasemi/powersave.S b/arch/powerpc/platforms/pasemi/powersave.S
index 6d0fba6..56f45ad 100644
--- a/arch/powerpc/platforms/pasemi/powersave.S
+++ b/arch/powerpc/platforms/pasemi/powersave.S
@@ -62,7 +62,16 @@ sleep_common:
 	mflr	r0
 	std	r0, 16(r1)
 	stdu	r1,-64(r1)
+#ifdef CONFIG_PPC_PASEMI_CPUFREQ
+	std	r3, 48(r1)
 
+	/* Only do power savings when in astate 0 */
+	bl	.check_astate
+	cmpwi	r3,0
+	bne	1f
+
+	ld	r3, 48(r1)
+#endif
 	LOAD_REG_IMMEDIATE(r6,MSR_DR|MSR_IR|MSR_ME|MSR_EE)
 	mfmsr	r4
 	andc	r5,r4,r6
@@ -73,7 +82,7 @@ sleep_common:
 
 	mtmsrd	r4,0
 
-	addi	r1,r1,64
+1:	addi	r1,r1,64
 	ld	r0,16(r1)
 	mtlr	r0
 	blr
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 3d62060..2b63865 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -43,6 +43,10 @@
 
 #include "pasemi.h"
 
+#if !defined(CONFIG_SMP)
+static void smp_send_stop(void) {}
+#endif
+
 /* SDC reset register, must be pre-mapped at reset time */
 static void __iomem *reset_reg;
 
@@ -60,6 +64,9 @@ static int num_mce_regs;
 
 static void pas_restart(char *cmd)
 {
+	/* Need to put others cpu in hold loop so they're not sleeping */
+	smp_send_stop();
+	udelay(10000);
 	printk("Restarting...\n");
 	while (1)
 		out_le32(reset_reg, 0x6000000);
@@ -362,8 +369,12 @@ static inline void pasemi_pcmcia_init(void)
 
 
 static struct of_device_id pasemi_bus_ids[] = {
+	/* Unfortunately needed for legacy firmwares */
 	{ .type = "localbus", },
 	{ .type = "sdc", },
+	/* These are the proper entries, which newer firmware uses */
+	{ .compatible = "pasemi,localbus", },
+	{ .compatible = "pasemi,sdc", },
 	{},
 };
 
@@ -389,7 +400,8 @@ static int __init pas_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
 
-	if (!of_flat_dt_is_compatible(root, "PA6T-1682M"))
+	if (!of_flat_dt_is_compatible(root, "PA6T-1682M") &&
+	    !of_flat_dt_is_compatible(root, "pasemi,pwrficient"))
 		return 0;
 
 	hpte_init_native();
@@ -400,7 +412,7 @@ static int __init pas_probe(void)
 }
 
 define_machine(pasemi) {
-	.name			= "PA Semi PA6T-1682M",
+	.name			= "PA Semi PWRficient",
 	.probe			= pas_probe,
 	.setup_arch		= pas_setup_arch,
 	.init_early		= pas_init_early,
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 99a77d7..a81da82 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_MV64X60)		+= $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \
 				   mv64x60_udbg.o
 obj-$(CONFIG_RTC_DRV_CMOS)	+= rtc_cmos_setup.o
 obj-$(CONFIG_AXON_RAM)		+= axonram.o
+obj-$(CONFIG_I2C_BOARDINFO)	+= i2c_of_mapping.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
 obj-$(CONFIG_PPC_INDIRECT_PCI)	+= indirect_pci.o
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..bbd7d69 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -320,43 +320,7 @@ arch_initcall(gfar_of_init);
 
 #ifdef CONFIG_I2C_BOARDINFO
 #include <linux/i2c.h>
-struct i2c_driver_device {
-	char	*of_device;
-	char	*i2c_driver;
-	char	*i2c_type;
-};
-
-static struct i2c_driver_device i2c_devices[] __initdata = {
-	{"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",},
-	{"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
-	{"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
-	{"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
-	{"dallas,ds1307",  "rtc-ds1307",  "ds1307",},
-	{"dallas,ds1337",  "rtc-ds1307",  "ds1337",},
-	{"dallas,ds1338",  "rtc-ds1307",  "ds1338",},
-	{"dallas,ds1339",  "rtc-ds1307",  "ds1339",},
-	{"dallas,ds1340",  "rtc-ds1307",  "ds1340",},
-	{"stm,m41t00",     "rtc-ds1307",  "m41t00"},
-	{"dallas,ds1374",  "rtc-ds1374",  "rtc-ds1374",},
-};
-
-static int __init of_find_i2c_driver(struct device_node *node,
-				     struct i2c_board_info *info)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
-		if (!of_device_is_compatible(node, i2c_devices[i].of_device))
-			continue;
-		if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver,
-			    KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
-		    strlcpy(info->type, i2c_devices[i].i2c_type,
-			    I2C_NAME_SIZE) >= I2C_NAME_SIZE)
-			return -ENOMEM;
-		return 0;
-	}
-	return -ENODEV;
-}
+#include <asm/i2c_of.h>
 
 static void __init of_register_i2c_devices(struct device_node *adap_node,
 					   int bus_num)
@@ -378,7 +342,7 @@ static void __init of_register_i2c_devices(struct device_node *adap_node,
 		if (info.irq == NO_IRQ)
 			info.irq = -1;
 
-		if (of_find_i2c_driver(node, &info) < 0)
+		if (of_fill_i2c_info(node, &info) < 0)
 			continue;
 
 		info.addr = *addr;
diff --git a/arch/powerpc/sysdev/i2c_of_mapping.c b/arch/powerpc/sysdev/i2c_of_mapping.c
new file mode 100644
index 0000000..7a7e263
--- /dev/null
+++ b/arch/powerpc/sysdev/i2c_of_mapping.c
@@ -0,0 +1,61 @@
+/*
+ * Parts based on arch/powerpc/sysdev/fsl_soc.c:
+ *
+ * 2006 (c) MontaVista Software, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/i2c.h>
+#include <asm/i2c_of.h>
+
+struct i2c_driver_device {
+	char    *of_device;
+	char    *i2c_driver;
+	char    *i2c_type;
+};
+
+
+/* This table is used to map from device tree compat fields to
+ * the driver and model used by the i2c board info structures.
+ *
+ * Add new mappings as needed.
+ */
+
+static struct i2c_driver_device i2c_devices[] __initdata = {
+	{"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",},
+	{"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
+	{"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
+	{"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
+	{"dallas,ds1307",  "rtc-ds1307",  "ds1307",},
+	{"dallas,ds1337",  "rtc-ds1307",  "ds1337",},
+	{"dallas,ds1338",  "rtc-ds1307",  "ds1338",},
+	{"dallas,ds1339",  "rtc-ds1307",  "ds1339",},
+	{"dallas,ds1340",  "rtc-ds1307",  "ds1340",},
+	{"stm,m41t00",     "rtc-ds1307",  "m41t00"},
+	{"dallas,ds1374",  "rtc-ds1374",  "rtc-ds1374",},
+};
+
+int __init of_fill_i2c_info(struct device_node *node,
+			    struct i2c_board_info *info)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
+		if (!of_device_is_compatible(node, i2c_devices[i].of_device))
+			continue;
+		if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver,
+			    KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
+		    strlcpy(info->type, i2c_devices[i].i2c_type,
+			    I2C_NAME_SIZE) >= I2C_NAME_SIZE)
+			return -ENOMEM;
+		return 0;
+	}
+	return -ENODEV;
+}
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index 2d7cd48..6bbd4fa 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -98,7 +98,7 @@ config HW_RANDOM_PASEMI
 	default HW_RANDOM
 	---help---
 	  This driver provides kernel-side support for the Random Number
-	  Generator hardware found on PA6T-1682M processor.
+	  Generator hardware found on PA Semi PWRficient SoCs.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called pasemi-rng.
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index fa6040b..24ae307 100644
--- a/drivers/char/hw_random/pasemi-rng.c
+++ b/drivers/char/hw_random/pasemi-rng.c
@@ -126,10 +126,9 @@ static int __devexit rng_remove(struct of_device *dev)
 }
 
 static struct of_device_id rng_match[] = {
-	{
-		.compatible      = "1682m-rng",
-	},
-	{},
+	{ .compatible      = "1682m-rng", },
+	{ .compatible      = "pasemi,pwrficient-rng", },
+	{ },
 };
 
 static struct of_platform_driver rng_driver = {
diff --git a/drivers/edac/pasemi_edac.c b/drivers/edac/pasemi_edac.c
index 9007d06..9032091 100644
--- a/drivers/edac/pasemi_edac.c
+++ b/drivers/edac/pasemi_edac.c
@@ -225,7 +225,7 @@ static int __devinit pasemi_edac_probe(struct pci_dev *pdev,
 		EDAC_FLAG_NONE;
 	mci->mod_name = MODULE_NAME;
 	mci->dev_name = pci_name(pdev);
-	mci->ctl_name = "pasemi,1682m-mc";
+	mci->ctl_name = "pasemi,pwrficient-mc";
 	mci->edac_check = pasemi_edac_check;
 	mci->ctl_page_to_phys = NULL;
 	pci_read_config_dword(pdev, MCCFG_SCRUB, &scrub);
@@ -297,4 +297,4 @@ module_exit(pasemi_edac_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Egor Martovetsky <egor at pasemi.com>");
-MODULE_DESCRIPTION("MC support for PA Semi PA6T-1682M memory controller");
+MODULE_DESCRIPTION("MC support for PA Semi PWRficient memory controller");
diff --git a/include/asm-powerpc/i2c_of.h b/include/asm-powerpc/i2c_of.h
new file mode 100644
index 0000000..66c4804
--- /dev/null
+++ b/include/asm-powerpc/i2c_of.h
@@ -0,0 +1,14 @@
+/*
+ * Functions to map device tree compatible fields to values used by i2c
+ * board info structures
+ */
+
+#ifndef POWERPC_I2C_OF_H
+#define POWERPC_I2C_OF_H
+
+#ifdef CONFIG_I2C_BOARDINFO
+extern int __init of_fill_i2c_info(struct device_node *node,
+				   struct i2c_board_info *info);
+#endif
+
+#endif

linux-2.6-pasemi-reserve-i2c.patch:

--- NEW FILE linux-2.6-pasemi-reserve-i2c.patch ---
--- linux-2.6.23.ppc64/arch/powerpc//platforms/pasemi/misc.c~	2007-12-03 23:07:32.000000000 +0000
+++ linux-2.6.23.ppc64/arch/powerpc//platforms/pasemi/misc.c	2007-12-04 12:39:05.000000000 +0000
@@ -60,6 +60,9 @@ static int __init pasemi_register_i2c_de
 						1);
 		}
 	}
+	/* Ensure that buses up to 2 are reserved */
+	i2c_register_board_info(2, NULL, 0);
+
 	return 0;
 }
 device_initcall(pasemi_register_i2c_devices);
--- linux-2.6.23.ppc64/drivers/i2c/busses/i2c-pasemi.c~	2007-12-03 22:47:54.000000000 +0000
+++ linux-2.6.23.ppc64/drivers/i2c/busses/i2c-pasemi.c	2007-12-04 12:21:14.000000000 +0000
@@ -368,6 +368,7 @@ static int __devinit pasemi_smb_probe(st
 	smbus->adapter.class = I2C_CLASS_HWMON;
 	smbus->adapter.algo = &smbus_algorithm;
 	smbus->adapter.algo_data = smbus;
+	smbus->adapter.nr = PCI_FUNC(dev->devfn);
 
 	/* set up the sysfs linkage to our parent device */
 	smbus->adapter.dev.parent = &dev->dev;
@@ -375,7 +376,7 @@ static int __devinit pasemi_smb_probe(st
 	reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR |
 		  (CLK_100K_DIV & CTL_CLK_M)));
 
-	error = i2c_add_adapter(&smbus->adapter);
+	error = i2c_add_numbered_adapter(&smbus->adapter);
 	if (error)
 		goto out_release_region;
 

linux-2.6-powerpc-bootwrapper.patch:

--- NEW FILE linux-2.6-powerpc-bootwrapper.patch ---
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index bd87626..f70df9b 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -167,6 +167,9 @@ boot := arch/$(ARCH)/boot
 $(BOOT_TARGETS): vmlinux
 	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
+bootwrapper_install:
+	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
+
 define archhelp
   @echo '* zImage          - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
   @echo '  install         - Install kernel using'
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 18e3271..7fc188b 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -243,3 +243,51 @@ clean-kernel := vmlinux.strip vmlinux.bin
 clean-kernel += $(addsuffix .gz,$(clean-kernel))
 # If not absolute clean-files are relative to $(obj).
 clean-files += $(addprefix $(objtree)/, $(clean-kernel))
+
+WRAPPER_OBJDIR := /usr/lib/kernel-wrapper
+WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts
+WRAPPER_BINDIR := /usr/sbin
+INSTALL := install
+
+extra-installed		:= $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
+hostprogs-installed	:= $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
+wrapper-installed	:= $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
+dts-installed		:= $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts))
+
+all-installed		:= $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
+
+quiet_cmd_mkdir           = MKDIR   $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
+      cmd_mkdir           = mkdir -p $@
+
+quiet_cmd_install	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,%,$@)
+      cmd_install	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_OBJDIR)/%,$(obj)/%,$@) $@ 
+
+quiet_cmd_install_dts	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,dts/%,$@)
+      cmd_install_dts	  = $(INSTALL)  -m0644 $(patsubst $(DESTDIR)$(WRAPPER_DTSDIR)/%,$(srctree)/$(obj)/dts/%,$@) $@ 
+
+quiet_cmd_install_exe	  = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
+      cmd_install_exe	  = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(obj)/%,$@) $@ 
+
+quiet_cmd_install_wrapper = INSTALL $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,%,$@)
+      cmd_install_wrapper = $(INSTALL)  -m0755 $(patsubst $(DESTDIR)$(WRAPPER_BINDIR)/%,$(srctree)/$(obj)/%,$@) $@ ;\
+				sed -i $@ -e 's%^object=.*%object=$(WRAPPER_OBJDIR)%' \
+					  -e 's%^objbin=.*%objbin=$(WRAPPER_BINDIR)%' \
+
+
+$(DESTDIR)$(WRAPPER_OBJDIR) $(DESTDIR)$(WRAPPER_DTSDIR) $(DESTDIR)$(WRAPPER_BINDIR):
+	$(call cmd,mkdir)
+
+$(extra-installed)	: $(DESTDIR)$(WRAPPER_OBJDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_OBJDIR)
+	$(call cmd,install)
+
+$(hostprogs-installed)  : $(DESTDIR)$(WRAPPER_BINDIR)/% : $(obj)/% | $(DESTDIR)$(WRAPPER_BINDIR)
+	$(call cmd,install_exe)
+
+$(dts-installed)	: $(DESTDIR)$(WRAPPER_DTSDIR)/% : $(srctree)/$(obj)/dts/% | $(DESTDIR)$(WRAPPER_DTSDIR)
+	$(call cmd,install_dts)
+
+$(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(DESTDIR)$(WRAPPER_BINDIR)
+	$(call cmd,install_wrapper)
+
+$(obj)/bootwrapper_install: $(all-installed)
+
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 31147a0..a591ced 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -45,6 +45,7 @@ CROSS=
 
 # directory for object and other files used by this script
 object=arch/powerpc/boot
+objbin=$object
 
 # directory for working files
 tmpdir=.
@@ -95,6 +96,7 @@ while [ "$#" -gt 0 ]; do
 	shift
 	[ "$#" -gt 0 ] || usage
 	object="$1"
+	objbin="$1"
 	;;
     -W)
 	shift
@@ -116,6 +118,9 @@ while [ "$#" -gt 0 ]; do
 done
 
 if [ -n "$dts" ]; then
+    if [ ! -r "$dts" -a -r "$object/dts/$dts" ]; then
+	dts="$object/dts/$dts"
+    fi
     if [ -z "$dtb" ]; then
 	dtb="$platform.dtb"
     fi
@@ -246,11 +251,11 @@ fi
 # post-processing needed for some platforms
 case "$platform" in
 pseries|chrp)
-    $object/addnote "$ofile"
+    $objbin/addnote "$ofile"
     ;;
 coff)
     ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
-    $object/hack-coff "$ofile"
+    $objbin/hack-coff "$ofile"
     ;;
 cuboot*)
     gzip -f -9 "$ofile"
@@ -259,7 +264,7 @@ cuboot*)
     ;;
 treeboot*)
     mv "$ofile" "$ofile.elf"
-    $object/mktree "$ofile.elf" "$ofile" "$base" "$entry"
+    $objbin/mktree "$ofile.elf" "$ofile" "$base" "$entry"
     if [ -z "$cacheit" ]; then
 	rm -f "$ofile.elf"
     fi
@@ -287,8 +292,6 @@ ps3)
     overlay_dest="256"
     overlay_size="256"
 
-    rm -f "$object/otheros.bld"
-
     ${CROSS}objcopy -O binary "$ofile" "$ofile.bin"
 
     dd if="$ofile.bin" of="$ofile.bin" conv=notrunc   \
@@ -299,6 +302,8 @@ ps3)
         skip=$system_reset_overlay seek=$overlay_dest \
         count=$overlay_size bs=1
 
-    gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld"
+    odir="$(dirname "$ofile.bin")"
+    rm -f "$odir/otheros.bld"
+    gzip --force -9 --stdout "$ofile.bin" > "$odir/otheros.bld"
     ;;
 esac

linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch ---
I see nothing that this lock_kernel() actually protects against
so remove it.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Acked-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 drivers/macintosh/via-pmu.c |    3 ---
 1 file changed, 3 deletions(-)

--- everything.orig/drivers/macintosh/via-pmu.c	2007-12-04 19:51:41.356950738 +0100
+++ everything/drivers/macintosh/via-pmu.c	2007-12-04 19:54:37.936951768 +0100
@@ -33,7 +33,6 @@
 #include <linux/adb.h>
 #include <linux/pmu.h>
 #include <linux/cuda.h>
-#include <linux/smp_lock.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/pm.h>
@@ -2547,7 +2546,6 @@ pmu_release(struct inode *inode, struct 
 	struct pmu_private *pp = file->private_data;
 	unsigned long flags;
 
-	lock_kernel();
 	if (pp != 0) {
 		file->private_data = NULL;
 		spin_lock_irqsave(&all_pvt_lock, flags);
@@ -2561,7 +2559,6 @@ pmu_release(struct inode *inode, struct 
 
 		kfree(pp);
 	}
-	unlock_kernel();
 	return 0;
 }
 

-- 

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch ---
Some code in via-pmu.c is never compiled because of "compile options"
within the file. Remove the code completely.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Acked-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 drivers/macintosh/via-pmu.c |   42 +-----------------------------------------
 1 file changed, 1 insertion(+), 41 deletions(-)

--- everything.orig/drivers/macintosh/via-pmu.c	2007-12-04 19:54:37.936951768 +0100
+++ everything/drivers/macintosh/via-pmu.c	2007-12-04 19:54:39.056952311 +0100
@@ -64,9 +64,7 @@
 #include "via-pmu-event.h"
 
 /* Some compile options */
-#undef SUSPEND_USES_PMU
 #define DEBUG_SLEEP
-#undef HACKED_PCI_SAVE
 
 /* Misc minor number allocated for /dev/pmu */
 #define PMU_MINOR		154
@@ -1255,9 +1253,7 @@ void
 pmu_suspend(void)
 {
 	unsigned long flags;
-#ifdef SUSPEND_USES_PMU
-	struct adb_request *req;
-#endif
+
 	if (!via)
 		return;
 	
@@ -1275,17 +1271,10 @@ pmu_suspend(void)
 		via_pmu_interrupt(0, NULL);
 		spin_lock_irqsave(&pmu_lock, flags);
 		if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) {
-#ifdef SUSPEND_USES_PMU
-			pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0);
-			spin_unlock_irqrestore(&pmu_lock, flags);
-			while(!req.complete)
-				pmu_poll();
-#else /* SUSPEND_USES_PMU */
 			if (gpio_irq >= 0)
 				disable_irq_nosync(gpio_irq);
 			out_8(&via[IER], CB1_INT | IER_CLR);
 			spin_unlock_irqrestore(&pmu_lock, flags);
-#endif /* SUSPEND_USES_PMU */
 			break;
 		}
 	} while (1);
@@ -1306,18 +1295,11 @@ pmu_resume(void)
 		return;
 	}
 	adb_int_pending = 1;
-#ifdef SUSPEND_USES_PMU
-	pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
-	spin_unlock_irqrestore(&pmu_lock, flags);
-	while(!req.complete)
-		pmu_poll();
-#else /* SUSPEND_USES_PMU */
 	if (gpio_irq >= 0)
 		enable_irq(gpio_irq);
 	out_8(&via[IER], CB1_INT | IER_SET);
 	spin_unlock_irqrestore(&pmu_lock, flags);
 	pmu_poll();
-#endif /* SUSPEND_USES_PMU */
 }
 
 /* Interrupt data could be the result data from an ADB cmd */
@@ -1803,14 +1785,10 @@ static void broadcast_wake(void)
  * PCI devices which may get powered off when we sleep.
  */
 static struct pci_save {
-#ifndef HACKED_PCI_SAVE
 	u16	command;
 	u16	cache_lat;
 	u16	intr;
 	u32	rom_address;
-#else
-	u32	config[16];
-#endif	
 } *pbook_pci_saves;
 static int pbook_npci_saves;
 
@@ -1856,16 +1834,10 @@ pbook_pci_save(void)
 			pci_dev_put(pd);
 			return;
 		}
-#ifndef HACKED_PCI_SAVE
 		pci_read_config_word(pd, PCI_COMMAND, &ps->command);
 		pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
 		pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
 		pci_read_config_dword(pd, PCI_ROM_ADDRESS, &ps->rom_address);
-#else
-		int i;
-		for (i=1;i<16;i++)
-			pci_read_config_dword(pd, i<<4, &ps->config[i]);
-#endif
 		++ps;
 	}
 }
@@ -1884,17 +1856,6 @@ pbook_pci_restore(void)
 	int j;
 
 	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
-#ifdef HACKED_PCI_SAVE
-		int i;
-		if (npci-- == 0) {
-			pci_dev_put(pd);
-			return;
-		}
-		ps++;
-		for (i=2;i<16;i++)
-			pci_write_config_dword(pd, i<<4, ps->config[i]);
-		pci_write_config_dword(pd, 4, ps->config[1]);
-#else
 		if (npci-- == 0)
 			return;
 		ps++;
@@ -1918,7 +1879,6 @@ pbook_pci_restore(void)
 			pci_write_config_word(pd, PCI_COMMAND, ps->command);
 			break;
 		}
-#endif	
 	}
 }
 

-- 

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch ---
This patch replaces the pmu sleep notifier that adb had with
suspend/resume hooks in a new platform driver/device.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 drivers/macintosh/adb.c |   96 ++++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 39 deletions(-)

--- everything.orig/drivers/macintosh/adb.c	2007-12-04 19:51:40.646950955 +0100
+++ everything/drivers/macintosh/adb.c	2007-12-04 19:54:40.186972819 +0100
@@ -89,14 +89,6 @@ static int sleepy_trackpad;
 static int autopoll_devs;
 int __adb_probe_sync;
 
-#ifdef CONFIG_PM_SLEEP
-static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
-static struct pmu_sleep_notifier adb_sleep_notifier = {
-	adb_notify_sleep,
-	SLEEP_LEVEL_ADB,
-};
-#endif
-
 static int adb_scan_bus(void);
 static int do_adb_reset_bus(void);
 static void adbdev_init(void);
@@ -281,6 +273,36 @@ adb_reset_bus(void)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+/*
+ * notify clients before sleep
+ */
+static int adb_suspend(struct platform_device *dev, pm_message_t state)
+{
+	adb_got_sleep = 1;
+	/* We need to get a lock on the probe thread */
+	down(&adb_probe_mutex);
+	/* Stop autopoll */
+	if (adb_controller->autopoll)
+		adb_controller->autopoll(0);
+	blocking_notifier_call_chain(&adb_client_list, ADB_MSG_POWERDOWN, NULL);
+
+	return 0;
+}
+
+/*
+ * reset bus after sleep
+ */
+static int adb_resume(struct platform_device *dev)
+{
+	adb_got_sleep = 0;
+	up(&adb_probe_mutex);
+	adb_reset_bus();
+
+	return 0;
+}
+#endif /* CONFIG_PM */
+
 int __init adb_init(void)
 {
 	struct adb_driver *driver;
@@ -313,14 +335,12 @@ int __init adb_init(void)
 		printk(KERN_WARNING "Warning: no ADB interface detected\n");
 		adb_controller = NULL;
 	} else {
-#ifdef CONFIG_PM_SLEEP
-		pmu_register_sleep_notifier(&adb_sleep_notifier);
-#endif /* CONFIG_PM */
 #ifdef CONFIG_PPC
 		if (machine_is_compatible("AAPL,PowerBook1998") ||
 			machine_is_compatible("PowerBook1,1"))
 			sleepy_trackpad = 1;
 #endif /* CONFIG_PPC */
+
 		init_completion(&adb_probe_task_comp);
 		adbdev_init();
 		adb_reset_bus();
@@ -330,33 +350,6 @@ int __init adb_init(void)
 
 __initcall(adb_init);
 
-#ifdef CONFIG_PM
-/*
- * notify clients before sleep and reset bus afterwards
- */
-void
-adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
-{
-	switch (when) {
-	case PBOOK_SLEEP_REQUEST:
-		adb_got_sleep = 1;
-		/* We need to get a lock on the probe thread */
-		down(&adb_probe_mutex);
-		/* Stop autopoll */
-		if (adb_controller->autopoll)
-			adb_controller->autopoll(0);
-		blocking_notifier_call_chain(&adb_client_list,
-			ADB_MSG_POWERDOWN, NULL);
-		break;
-	case PBOOK_WAKE:
-		adb_got_sleep = 0;
-		up(&adb_probe_mutex);
-		adb_reset_bus();
-		break;
-	}
-}
-#endif /* CONFIG_PM */
-
 static int
 do_adb_reset_bus(void)
 {
@@ -864,7 +857,29 @@ static const struct file_operations adb_
 	.release	= adb_release,
 };
 
-static void
+static struct platform_driver adb_pfdrv = {
+	.driver = {
+		.name = "adb",
+	},
+#ifdef CONFIG_PM
+	.suspend = adb_suspend,
+	.resume = adb_resume,
+#endif
+};
+
+static struct platform_device adb_pfdev = {
+	.name = "adb",
+};
+
+static int __init
+adb_dummy_probe(struct platform_device *dev)
+{
+	if (dev == &adb_pfdev)
+		return 0;
+	return -ENODEV;
+}
+
+static void __init
 adbdev_init(void)
 {
 	if (register_chrdev(ADB_MAJOR, "adb", &adb_fops)) {
@@ -876,4 +891,7 @@ adbdev_init(void)
 	if (IS_ERR(adb_dev_class))
 		return;
 	class_device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, "adb");
+
+	platform_device_register(&adb_pfdev);
+	platform_driver_probe(&adb_pfdrv, adb_dummy_probe);
 }

-- 

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch ---
This patch kills off the remnants of the ancient sleep notifiers.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 drivers/macintosh/via-pmu.c |   71 --------------------------------------------
 include/linux/pmu.h         |   36 ----------------------
 2 files changed, 107 deletions(-)

--- everything.orig/drivers/macintosh/via-pmu.c	2007-12-04 19:54:39.056952311 +0100
+++ everything/drivers/macintosh/via-pmu.c	2007-12-04 19:54:41.886951985 +0100
@@ -174,7 +174,6 @@ static struct proc_dir_entry *proc_pmu_b
 
 int __fake_sleep;
 int asleep;
-BLOCKING_NOTIFIER_HEAD(sleep_notifier_list);
 
 #ifdef CONFIG_ADB
 static int adb_dev_map;
@@ -1719,67 +1718,7 @@ pmu_present(void)
 	return via != 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-
-static LIST_HEAD(sleep_notifiers);
-
-int
-pmu_register_sleep_notifier(struct pmu_sleep_notifier *n)
-{
-	struct list_head *list;
-	struct pmu_sleep_notifier *notifier;
-
-	for (list = sleep_notifiers.next; list != &sleep_notifiers;
-	     list = list->next) {
-		notifier = list_entry(list, struct pmu_sleep_notifier, list);
-		if (n->priority > notifier->priority)
-			break;
-	}
-	__list_add(&n->list, list->prev, list);
-	return 0;
-}
-EXPORT_SYMBOL(pmu_register_sleep_notifier);
-
-int
-pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n)
-{
-	if (n->list.next == 0)
-		return -ENOENT;
-	list_del(&n->list);
-	n->list.next = NULL;
-	return 0;
-}
-EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
-#endif /* CONFIG_PM_SLEEP */
-
 #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
-
-/* Sleep is broadcast last-to-first */
-static void broadcast_sleep(int when)
-{
-	struct list_head *list;
-	struct pmu_sleep_notifier *notifier;
-
-	for (list = sleep_notifiers.prev; list != &sleep_notifiers;
-	     list = list->prev) {
-		notifier = list_entry(list, struct pmu_sleep_notifier, list);
-		notifier->notifier_call(notifier, when);
-	}
-}
-
-/* Wake is broadcast first-to-last */
-static void broadcast_wake(void)
-{
-	struct list_head *list;
-	struct pmu_sleep_notifier *notifier;
-
-	for (list = sleep_notifiers.next; list != &sleep_notifiers;
-	     list = list->next) {
-		notifier = list_entry(list, struct pmu_sleep_notifier, list);
-		notifier->notifier_call(notifier, PBOOK_WAKE);
-	}
-}
-
 /*
  * This struct is used to store config register values for
  * PCI devices which may get powered off when we sleep.
@@ -1962,9 +1901,6 @@ pmac_suspend_devices(void)
 
 	pm_prepare_console();
 	
-	/* Notify old-style device drivers */
-	broadcast_sleep(PBOOK_SLEEP_REQUEST);
-
 	/* Sync the disks. */
 	/* XXX It would be nice to have some way to ensure that
 	 * nobody is dirtying any new buffers while we wait. That
@@ -1973,12 +1909,9 @@ pmac_suspend_devices(void)
 	 */
 	sys_sync();
 
-	broadcast_sleep(PBOOK_SLEEP_NOW);
-
 	/* Send suspend call to devices, hold the device core's dpm_sem */
 	ret = device_suspend(PMSG_SUSPEND);
 	if (ret) {
-		broadcast_wake();
 		printk(KERN_ERR "Driver sleep failed\n");
 		return -EBUSY;
 	}
@@ -2019,7 +1952,6 @@ pmac_suspend_devices(void)
 		local_irq_enable();
 		preempt_enable();
 		device_resume();
-		broadcast_wake();
 		printk(KERN_ERR "Driver powerdown failed\n");
 		return -EBUSY;
 	}
@@ -2073,9 +2005,6 @@ pmac_wakeup_devices(void)
 	/* Resume devices */
 	device_resume();
 
-	/* Notify old style drivers */
-	broadcast_wake();
-
 	pm_restore_console();
 
 	return 0;
--- everything.orig/include/linux/pmu.h	2007-12-04 19:51:40.326951823 +0100
+++ everything/include/linux/pmu.h	2007-12-04 19:54:41.896951606 +0100
@@ -159,42 +159,6 @@ extern void pmu_unlock(void);
 extern int pmu_present(void);
 extern int pmu_get_model(void);
 
-#ifdef CONFIG_PM
-/*
- * Stuff for putting the powerbook to sleep and waking it again.
- *
- */
-#include <linux/list.h>
-
-struct pmu_sleep_notifier
-{
-	void (*notifier_call)(struct pmu_sleep_notifier *self, int when);
-	int priority;
-	struct list_head list;
-};
-
-/* Code values for calling sleep/wakeup handlers
- */
-#define PBOOK_SLEEP_REQUEST	1
-#define PBOOK_SLEEP_NOW		2
-#define PBOOK_WAKE		3
-
-/* priority levels in notifiers */
-#define SLEEP_LEVEL_VIDEO	100	/* Video driver (first wake) */
-#define SLEEP_LEVEL_MEDIABAY	90	/* Media bay driver */
-#define SLEEP_LEVEL_BLOCK	80	/* IDE, SCSI */
-#define SLEEP_LEVEL_NET		70	/* bmac, gmac */
-#define SLEEP_LEVEL_MISC	60	/* Anything else */
-#define SLEEP_LEVEL_USERLAND	55	/* Reserved for apm_emu */
-#define SLEEP_LEVEL_ADB		50	/* ADB (async) */
-#define SLEEP_LEVEL_SOUND	40	/* Sound driver (blocking) */
-
-/* special register notifier functions */
-int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
-int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
-
-#endif /* CONFIG_PM */
-
 #define PMU_MAX_BATTERIES	2
 
 /* values for pmu_power_flags */

-- 

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch:

--- NEW FILE linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch ---
Subject: [PATCH 2.6.25 5/5] powermac: proper sleep management

This adds platform_suspend_ops for PMU based machines, directly in
the PMU driver. This finally allows suspending via /sys/power/state
on powerbooks.

The patch also replaces the PMU ioctl with a simple call to
pm_suspend(PM_SUSPEND_MEM).

Additionally, it cleans up some debug code.

Signed-off-by: Johannes Berg <johannes at sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 drivers/macintosh/via-pmu.c |  451 ++++++++++++++++++++------------------------
 1 file changed, 206 insertions(+), 245 deletions(-)

--- everything.orig/drivers/macintosh/via-pmu.c	2007-12-11 15:13:33.156913629 +0100
+++ everything/drivers/macintosh/via-pmu.c	2007-12-11 15:19:21.126913032 +0100
@@ -10,13 +10,13 @@
  *
  * Copyright (C) 1998 Paul Mackerras and Fabio Riccardi.
  * Copyright (C) 2001-2002 Benjamin Herrenschmidt
+ * Copyright (C) 2006-2007 Johannes Berg
  *
  * THIS DRIVER IS BECOMING A TOTAL MESS !
  *  - Cleanup atomically disabling reply to PMU events after
  *    a sleep or a freq. switch
- *  - Move sleep code out of here to pmac_pm, merge into new
- *    common PM infrastructure
- *  - Save/Restore PCI space properly
+ *  - check if powerbook 3400 really needs the extra PCI
+ *    save/restore code we have
  *
  */
 #include <stdarg.h>
@@ -64,7 +64,7 @@
 #include "via-pmu-event.h"
 
 /* Some compile options */
-#define DEBUG_SLEEP
+#undef DEBUG_SLEEP
 
 /* Misc minor number allocated for /dev/pmu */
 #define PMU_MINOR		154
@@ -149,12 +149,9 @@ static spinlock_t pmu_lock;
 static u8 pmu_intr_mask;
 static int pmu_version;
 static int drop_interrupts;
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
 static int option_lid_wakeup = 1;
-#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
-#if (defined(CONFIG_PM_SLEEP)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY)
-static int sleep_in_progress;
-#endif
+#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */
 static unsigned long async_req_locks;
 static unsigned int pmu_irq_stats[11];
 
@@ -220,7 +217,7 @@ extern void enable_kernel_fp(void);
 
 #ifdef DEBUG_SLEEP
 int pmu_polled_request(struct adb_request *req);
-int pmu_wink(struct adb_request *req);
+void pmu_blink(int n);
 #endif
 
 /*
@@ -871,7 +868,7 @@ proc_read_options(char *page, char **sta
 {
 	char *p = page;
 
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
 	if (pmu_kind == PMU_KEYLARGO_BASED &&
 	    pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
 		p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup);
@@ -912,7 +909,7 @@ proc_write_options(struct file *file, co
 	*(val++) = 0;
 	while(*val == ' ')
 		val++;
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
 	if (pmu_kind == PMU_KEYLARGO_BASED &&
 	    pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
 		if (!strcmp(label, "lid_wakeup"))
@@ -1718,7 +1715,7 @@ pmu_present(void)
 	return via != 0;
 }
 
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
 /*
  * This struct is used to store config register values for
  * PCI devices which may get powered off when we sleep.
@@ -1821,42 +1818,6 @@ pbook_pci_restore(void)
 	}
 }
 
-#ifdef DEBUG_SLEEP
-/* N.B. This doesn't work on the 3400 */
-void 
-pmu_blink(int n)
-{
-	struct adb_request req;
-
-	memset(&req, 0, sizeof(req));
-
-	for (; n > 0; --n) {
-		req.nbytes = 4;
-		req.done = NULL;
-		req.data[0] = 0xee;
-		req.data[1] = 4;
-		req.data[2] = 0;
-		req.data[3] = 1;
-		req.reply[0] = ADB_RET_OK;
-		req.reply_len = 1;
-		req.reply_expected = 0;
-		pmu_polled_request(&req);
-		mdelay(50);
-		req.nbytes = 4;
-		req.done = NULL;
-		req.data[0] = 0xee;
-		req.data[1] = 4;
-		req.data[2] = 0;
-		req.data[3] = 0;
-		req.reply[0] = ADB_RET_OK;
-		req.reply_len = 1;
-		req.reply_expected = 0;
-		pmu_polled_request(&req);
-		mdelay(50);
-	}
-	mdelay(50);
-}
-#endif
 
 /*
  * Put the powerbook to sleep.
@@ -1894,122 +1855,6 @@ restore_via_state(void)
 
 extern void pmu_backlight_set_sleep(int sleep);
 
-static int
-pmac_suspend_devices(void)
-{
-	int ret;
-
-	pm_prepare_console();
-	
-	/* Sync the disks. */
-	/* XXX It would be nice to have some way to ensure that
-	 * nobody is dirtying any new buffers while we wait. That
-	 * could be achieved using the refrigerator for processes
-	 * that swsusp uses
-	 */
-	sys_sync();
-
-	/* Send suspend call to devices, hold the device core's dpm_sem */
-	ret = device_suspend(PMSG_SUSPEND);
-	if (ret) {
-		printk(KERN_ERR "Driver sleep failed\n");
-		return -EBUSY;
-	}
-
-#ifdef CONFIG_PMAC_BACKLIGHT
-	/* Tell backlight code not to muck around with the chip anymore */
-	pmu_backlight_set_sleep(1);
-#endif
-
-	/* Call platform functions marked "on sleep" */
-	pmac_pfunc_i2c_suspend();
-	pmac_pfunc_base_suspend();
-
-	/* Stop preemption */
-	preempt_disable();
-
-	/* Make sure the decrementer won't interrupt us */
-	asm volatile("mtdec %0" : : "r" (0x7fffffff));
-	/* Make sure any pending DEC interrupt occurring while we did
-	 * the above didn't re-enable the DEC */
-	mb();
-	asm volatile("mtdec %0" : : "r" (0x7fffffff));
-
-	/* We can now disable MSR_EE. This code of course works properly only
-	 * on UP machines... For SMP, if we ever implement sleep, we'll have to
-	 * stop the "other" CPUs way before we do all that stuff.
-	 */
-	local_irq_disable();
-
-	/* Broadcast power down irq
-	 * This isn't that useful in most cases (only directly wired devices can
-	 * use this but still... This will take care of sysdev's as well, so
-	 * we exit from here with local irqs disabled and PIC off.
-	 */
-	ret = device_power_down(PMSG_SUSPEND);
-	if (ret) {
-		wakeup_decrementer();
-		local_irq_enable();
-		preempt_enable();
-		device_resume();
-		printk(KERN_ERR "Driver powerdown failed\n");
-		return -EBUSY;
-	}
-
-	/* Wait for completion of async requests */
-	while (!batt_req.complete)
-		pmu_poll();
-
-	/* Giveup the lazy FPU & vec so we don't have to back them
-	 * up from the low level code
-	 */
-	enable_kernel_fp();
-
-#ifdef CONFIG_ALTIVEC
-	if (cpu_has_feature(CPU_FTR_ALTIVEC))
-		enable_kernel_altivec();
-#endif /* CONFIG_ALTIVEC */
-
-	return 0;
-}
-
-static int
-pmac_wakeup_devices(void)
-{
-	mdelay(100);
-
-#ifdef CONFIG_PMAC_BACKLIGHT
-	/* Tell backlight code it can use the chip again */
-	pmu_backlight_set_sleep(0);
-#endif
-
-	/* Power back up system devices (including the PIC) */
-	device_power_up();
-
-	/* Force a poll of ADB interrupts */
-	adb_int_pending = 1;
-	via_pmu_interrupt(0, NULL);
-
-	/* Restart jiffies & scheduling */
-	wakeup_decrementer();
-
-	/* Re-enable local CPU interrupts */
-	local_irq_enable();
-	mdelay(10);
-	preempt_enable();
-
-	/* Call platform functions marked "on wake" */
-	pmac_pfunc_base_resume();
-	pmac_pfunc_i2c_resume();
-
-	/* Resume devices */
-	device_resume();
-
-	pm_restore_console();
-
-	return 0;
-}
-
 #define	GRACKLE_PM	(1<<7)
 #define GRACKLE_DOZE	(1<<5)
 #define	GRACKLE_NAP	(1<<4)
@@ -2020,19 +1865,12 @@ static int powerbook_sleep_grackle(void)
 	unsigned long save_l2cr;
 	unsigned short pmcr1;
 	struct adb_request req;
-	int ret;
 	struct pci_dev *grackle;
 
 	grackle = pci_get_bus_and_slot(0, 0);
 	if (!grackle)
 		return -ENODEV;
 
-	ret = pmac_suspend_devices();
-	if (ret) {
-		printk(KERN_ERR "Sleep rejected by devices\n");
-		return ret;
-	}
-	
 	/* Turn off various things. Darwin does some retry tests here... */
 	pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE);
 	pmu_wait_complete(&req);
@@ -2095,8 +1933,6 @@ static int powerbook_sleep_grackle(void)
 			PMU_POW_ON|PMU_POW_BACKLIGHT|PMU_POW_CHARGER|PMU_POW_IRLED|PMU_POW_MEDIABAY);
 	pmu_wait_complete(&req);
 
-	pmac_wakeup_devices();
-
 	return 0;
 }
 
@@ -2106,7 +1942,6 @@ powerbook_sleep_Core99(void)
 	unsigned long save_l2cr;
 	unsigned long save_l3cr;
 	struct adb_request req;
-	int ret;
 	
 	if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0) {
 		printk(KERN_ERR "Sleep mode not supported on this machine\n");
@@ -2116,12 +1951,6 @@ powerbook_sleep_Core99(void)
 	if (num_online_cpus() > 1 || cpu_is_offline(0))
 		return -EAGAIN;
 
-	ret = pmac_suspend_devices();
-	if (ret) {
-		printk(KERN_ERR "Sleep rejected by devices\n");
-		return ret;
-	}
-
 	/* Stop environment and ADB interrupts */
 	pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0);
 	pmu_wait_complete(&req);
@@ -2192,42 +2021,24 @@ powerbook_sleep_Core99(void)
 	/* Restore LPJ, cpufreq will adjust the cpu frequency */
 	loops_per_jiffy /= 2;
 
-	pmac_wakeup_devices();
-
 	return 0;
 }
 
 #define PB3400_MEM_CTRL		0xf8000000
 #define PB3400_MEM_CTRL_SLEEP	0x70
 
+static void __iomem *pb3400_mem_ctrl;
+
 static int
 powerbook_sleep_3400(void)
 {
-	int ret, i, x;
+	int i, x;
 	unsigned int hid0;
 	unsigned long p;
 	struct adb_request sleep_req;
-	void __iomem *mem_ctrl;
 	unsigned int __iomem *mem_ctrl_sleep;
 
-	/* first map in the memory controller registers */
-	mem_ctrl = ioremap(PB3400_MEM_CTRL, 0x100);
-	if (mem_ctrl == NULL) {
-		printk("powerbook_sleep_3400: ioremap failed\n");
-		return -ENOMEM;
-	}
-	mem_ctrl_sleep = mem_ctrl + PB3400_MEM_CTRL_SLEEP;
-
-	/* Allocate room for PCI save */
-	pbook_alloc_pci_save();
-
-	ret = pmac_suspend_devices();
-	if (ret) {
-		pbook_free_pci_save();
-		iounmap(mem_ctrl);
-		printk(KERN_ERR "Sleep rejected by devices\n");
-		return ret;
-	}
+	mem_ctrl_sleep = pb3400_mem_ctrl + PB3400_MEM_CTRL_SLEEP;
 
 	/* Save the state of PCI config space for some slots */
 	pbook_pci_save();
@@ -2271,14 +2083,10 @@ powerbook_sleep_3400(void)
 	while (asleep)
 		mb();
 
-	pmac_wakeup_devices();
-	pbook_free_pci_save();
-	iounmap(mem_ctrl);
-
 	return 0;
 }
 
-#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
+#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */
 
 /*
  * Support for /dev/pmu device
@@ -2451,6 +2259,157 @@ pmu_release(struct inode *inode, struct 
 	return 0;
 }
 
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
+static int powerbook_prepare_sleep(void)
+{
+	if (pmu_kind == PMU_OHARE_BASED) {
+		/* first map in the memory controller registers */
+		pb3400_mem_ctrl = ioremap(PB3400_MEM_CTRL, 0x100);
+		if (!pb3400_mem_ctrl) {
+			printk(KERN_ERR "powerbook_sleep_3400: "
+			       "ioremap failed\n");
+			return -ENOMEM;
+		}
+
+		/* Allocate room for PCI save */
+		pbook_alloc_pci_save();
+	}
+
+	return 0;
+}
+
+/*
+ * overrides the weak arch_suspend_disable_irqs in kernel/power/main.c
+ *
+ * XXX: Once Scott Wood's patch is merged, this needs to use the ppc_md
+ *	hooks that patch adds!
+ */
+void arch_suspend_disable_irqs(void)
+{
+#ifdef CONFIG_PMAC_BACKLIGHT
+	/* Tell backlight code not to muck around with the chip anymore */
+	pmu_backlight_set_sleep(1);
+#endif
+
+	/* Call platform functions marked "on sleep" */
+	pmac_pfunc_i2c_suspend();
+	pmac_pfunc_base_suspend();
+
+	/* Stop preemption */
+	preempt_disable();
+
+	/* Make sure the decrementer won't interrupt us */
+	asm volatile("mtdec %0" : : "r" (0x7fffffff));
+	/* Make sure any pending DEC interrupt occurring while we did
+	 * the above didn't re-enable the DEC */
+	mb();
+	asm volatile("mtdec %0" : : "r" (0x7fffffff));
+
+	local_irq_disable();
+}
+
+static int powerbook_sleep(suspend_state_t state)
+{
+	int error = 0;
+
+	/* Wait for completion of async requests */
+	while (!batt_req.complete)
+		pmu_poll();
+
+	/* Giveup the lazy FPU & vec so we don't have to back them
+	 * up from the low level code
+	 */
+	enable_kernel_fp();
+
+#ifdef CONFIG_ALTIVEC
+	if (cpu_has_feature(CPU_FTR_ALTIVEC))
+		enable_kernel_altivec();
+#endif /* CONFIG_ALTIVEC */
+
+	switch (pmu_kind) {
+	case PMU_OHARE_BASED:
+		error = powerbook_sleep_3400();
+		break;
+	case PMU_HEATHROW_BASED:
+	case PMU_PADDINGTON_BASED:
+		error = powerbook_sleep_grackle();
+		break;
+	case PMU_KEYLARGO_BASED:
+		error = powerbook_sleep_Core99();
+		break;
+	default:
+		return -ENOSYS;
+	}
+
+	if (error)
+		return error;
+
+	mdelay(100);
+
+#ifdef CONFIG_PMAC_BACKLIGHT
+	/* Tell backlight code it can use the chip again */
+	pmu_backlight_set_sleep(0);
+#endif
+
+	return 0;
+}
+
+/*
+ * overrides the weak arch_suspend_enable_irqs in kernel/power/main.c
+ *
+ * XXX: Once Scott Wood's patch is merged, this needs to use the ppc_md
+ *	hooks that patch adds!
+ */
+void arch_suspend_enable_irqs(void)
+{
+	/* Force a poll of ADB interrupts */
+	adb_int_pending = 1;
+	via_pmu_interrupt(0, NULL);
+
+	/* Restart jiffies & scheduling */
+	wakeup_decrementer();
+
+	/* Re-enable local CPU interrupts */
+	local_irq_enable();
+	mdelay(10);
+	preempt_enable();
+
+	/* Call platform functions marked "on wake" */
+	pmac_pfunc_base_resume();
+	pmac_pfunc_i2c_resume();
+}
+
+static void powerbook_finish_sleep(void)
+{
+	if (pmu_kind == PMU_OHARE_BASED) {
+		pbook_free_pci_save();
+		iounmap(pb3400_mem_ctrl);
+	}
+}
+
+static int pmu_sleep_valid(suspend_state_t state)
+{
+	return state == PM_SUSPEND_MEM
+		&& (pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, -1) >= 0);
+}
+
+static struct platform_suspend_ops pmu_pm_ops = {
+	.prepare = powerbook_prepare_sleep,
+	.enter = powerbook_sleep,
+	.finish = powerbook_finish_sleep,
+	.valid = pmu_sleep_valid,
+};
+
+static int register_pmu_pm_ops(void)
+{
+	suspend_set_ops(&pmu_pm_ops);
+
+	return 0;
+}
+
+device_initcall(register_pmu_pm_ops);
+#endif
+
 static int
 pmu_ioctl(struct inode * inode, struct file *filp,
 		     u_int cmd, u_long arg)
@@ -2459,35 +2418,15 @@ pmu_ioctl(struct inode * inode, struct f
 	int error = -EINVAL;
 
 	switch (cmd) {
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
 	case PMU_IOC_SLEEP:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EACCES;
-		if (sleep_in_progress)
-			return -EBUSY;
-		sleep_in_progress = 1;
-		switch (pmu_kind) {
-		case PMU_OHARE_BASED:
-			error = powerbook_sleep_3400();
-			break;
-		case PMU_HEATHROW_BASED:
-		case PMU_PADDINGTON_BASED:
-			error = powerbook_sleep_grackle();
-			break;
-		case PMU_KEYLARGO_BASED:
-			error = powerbook_sleep_Core99();
-			break;
-		default:
-			error = -ENOSYS;
-		}
-		sleep_in_progress = 0;
-		break;
+		return pm_suspend(PM_SUSPEND_MEM);
 	case PMU_IOC_CAN_SLEEP:
-		if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0)
+		if (pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, -1) < 0)
 			return put_user(0, argp);
 		else
 			return put_user(1, argp);
-#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
 
 #ifdef CONFIG_PMAC_BACKLIGHT_LEGACY
 	/* Compatibility ioctl's for backlight */
@@ -2495,9 +2434,6 @@ pmu_ioctl(struct inode * inode, struct f
 	{
 		int brightness;
 
-		if (sleep_in_progress)
-			return -EBUSY;
-
 		brightness = pmac_backlight_get_legacy_brightness();
 		if (brightness < 0)
 			return brightness;
@@ -2509,9 +2445,6 @@ pmu_ioctl(struct inode * inode, struct f
 	{
 		int brightness;
 
-		if (sleep_in_progress)
-			return -EBUSY;
-
 		error = get_user(brightness, argp);
 		if (error)
 			return error;
@@ -2636,15 +2569,43 @@ pmu_polled_request(struct adb_request *r
 	local_irq_restore(flags);
 	return 0;
 }
-#endif /* DEBUG_SLEEP */
 
+/* N.B. This doesn't work on the 3400 */
+void pmu_blink(int n)
+{
+	struct adb_request req;
 
-/* FIXME: This is a temporary set of callbacks to enable us
- * to do suspend-to-disk.
- */
+	memset(&req, 0, sizeof(req));
 
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
+	for (; n > 0; --n) {
+		req.nbytes = 4;
+		req.done = NULL;
+		req.data[0] = 0xee;
+		req.data[1] = 4;
+		req.data[2] = 0;
+		req.data[3] = 1;
+		req.reply[0] = ADB_RET_OK;
+		req.reply_len = 1;
+		req.reply_expected = 0;
+		pmu_polled_request(&req);
+		mdelay(50);
+		req.nbytes = 4;
+		req.done = NULL;
+		req.data[0] = 0xee;
+		req.data[1] = 4;
+		req.data[2] = 0;
+		req.data[3] = 0;
+		req.reply[0] = ADB_RET_OK;
+		req.reply_len = 1;
+		req.reply_expected = 0;
+		pmu_polled_request(&req);
+		mdelay(50);
+	}
+	mdelay(50);
+}
+#endif /* DEBUG_SLEEP */
 
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
 int pmu_sys_suspended;
 
 static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state)
@@ -2678,7 +2639,7 @@ static int pmu_sys_resume(struct sys_dev
 	return 0;
 }
 
-#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
+#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */
 
 static struct sysdev_class pmu_sysclass = {
 	set_kset_name("pmu"),
@@ -2689,10 +2650,10 @@ static struct sys_device device_pmu = {
 };
 
 static struct sysdev_driver driver_pmu = {
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
 	.suspend	= &pmu_sys_suspend,
 	.resume		= &pmu_sys_resume,
-#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
+#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */
 };
 
 static int __init init_pmu_sysfs(void)
@@ -2727,10 +2688,10 @@ EXPORT_SYMBOL(pmu_wait_complete);
 EXPORT_SYMBOL(pmu_suspend);
 EXPORT_SYMBOL(pmu_resume);
 EXPORT_SYMBOL(pmu_unlock);
-#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32)
+#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
 EXPORT_SYMBOL(pmu_enable_irled);
 EXPORT_SYMBOL(pmu_battery_count);
 EXPORT_SYMBOL(pmu_batteries);
 EXPORT_SYMBOL(pmu_power_flags);
-#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
+#endif /* CONFIG_SUSPEND && CONFIG_PPC32 */
 


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

linux-2.6-ppc-rtc.patch:

--- NEW FILE linux-2.6-ppc-rtc.patch ---
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 1e6715e..3e788b7 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -461,4 +461,12 @@ config RTC_DRV_RS5C313
 	help
 	  If you say yes here you get support for the Ricoh RS5C313 RTC chips.
 
+config RTC_DRV_PPC
+       tristate "PowerPC machine dependent RTC support"
+       depends on PPC_MERGE
+       help
+         The PowerPC kernel has machine-specific functions for accessing
+	 the RTC. This exposes that functionality through the generic RTC
+	 class.
+
 endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 465db4d..e822e56 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -49,3 +49,4 @@ obj-$(CONFIG_RTC_DRV_TEST)	+= rtc-test.o
 obj-$(CONFIG_RTC_DRV_V3020)	+= rtc-v3020.o
 obj-$(CONFIG_RTC_DRV_VR41XX)	+= rtc-vr41xx.o
 obj-$(CONFIG_RTC_DRV_X1205)	+= rtc-x1205.o
+obj-$(CONFIG_RTC_DRV_PPC)	+= rtc-ppc.o
--- /dev/null	2007-12-03 03:08:41.854157978 +0000
+++ b/drivers/rtc/rtc-ppc.c	2007-12-03 16:56:15.000000000 +0000
@@ -0,0 +1,69 @@
+/*
+ * RTC driver for ppc_md RTC functions
+ *
+ * © 2007 Red Hat, Inc.
+ *
+ * Author: David Woodhouse <dwmw2 at infradead.org>
+ *
+ * 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/module.h>
+#include <linux/err.h>
+#include <linux/rtc.h>
+#include <linux/platform_device.h>
+#include <asm/machdep.h>
+
+static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+	ppc_md.get_rtc_time(tm);
+	return 0;
+}
+
+static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+	return ppc_md.set_rtc_time(tm);
+}
+
+static const struct rtc_class_ops ppc_rtc_ops = {
+	.set_time = ppc_rtc_set_time,
+	.read_time = ppc_rtc_read_time,
+};
+
+static struct rtc_device *rtc;
+static struct platform_device *ppc_rtc_pdev;
+
+static int __init ppc_rtc_init(void)
+{
+	if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time)
+		return -ENODEV;
+
+	ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0);
+	if (IS_ERR(ppc_rtc_pdev))
+		return PTR_ERR(ppc_rtc_pdev);
+
+	rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev,
+				  &ppc_rtc_ops, THIS_MODULE);
+	if (IS_ERR(rtc)) {
+		platform_device_unregister(ppc_rtc_pdev);
+		return PTR_ERR(rtc);
+	}
+
+	return 0;
+}
+
+static void __exit ppc_rtc_exit(void)
+{
+	rtc_device_unregister(rtc);
+	platform_device_unregister(ppc_rtc_pdev);
+}
+
+module_init(ppc_rtc_init);
+module_exit(ppc_rtc_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("David Woodhouse <dwmw2 at infradead.org>");
+MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");

linux-2.6-ps3-legacy-bootloader-hack.patch:

--- NEW FILE linux-2.6-ps3-legacy-bootloader-hack.patch ---
A temporary hack to support the legacy 2.6.16 bootloader.  This will be
removed as soon as a 2.6.22 bootloader is ready.

Hacked-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
 arch/powerpc/kernel/prom.c         |    6 ++++++
 arch/powerpc/platforms/ps3/setup.c |    4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -939,6 +939,12 @@ static int __init early_init_dt_scan_mem
 				size = 0x80000000ul - base;
 		}
 #endif
+#ifdef CONFIG_PPC_PS3
+	/* temporary hack for the legacy bootloader */
+	if (of_flat_dt_is_compatible(of_get_flat_dt_root(), "PS3PF")) {
+		size = 0x8000000;
+	}
+#endif
 		lmb_add(base, size);
 	}
 	return 0;
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -210,7 +210,9 @@ static int __init ps3_probe(void)
 	DBG(" -> %s:%d\n", __func__, __LINE__);
 
 	dt_root = of_get_flat_dt_root();
-	if (!of_flat_dt_is_compatible(dt_root, "sony,ps3"))
+	if (!of_flat_dt_is_compatible(dt_root, "sony,ps3")
+		/* temporary hack for the legacy bootloader */
+		&& !of_flat_dt_is_compatible(dt_root, "PS3PF"))
 		return 0;
 
 	powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE;

linux-2.6-ps3-storage-alias.patch:

--- NEW FILE linux-2.6-ps3-storage-alias.patch ---
--- linux-2.6.22.ppc64/drivers/block/ps3disk.c~	2007-07-25 16:06:16.000000000 +0100
+++ linux-2.6.22.ppc64/drivers/block/ps3disk.c	2007-07-26 08:49:44.000000000 +0100
@@ -628,3 +628,4 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("PS3 Disk Storage Driver");
 MODULE_AUTHOR("Sony Corporation");
 MODULE_ALIAS(PS3_MODULE_ALIAS_STOR_DISK);
+MODULE_ALIAS("ps3_storage");

linux-2.6-rndis_wlan.patch:

--- NEW FILE linux-2.6-rndis_wlan.patch ---
commit c4b411b390cfb0fe70a0eb2db70f4fb3ed3bc3c4
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:51 2008 +0200

    Add new driver 'rndis_wlan' for wireless RNDIS devices.
    
    New driver for wireless RNDIS devices. So far only known chip that uses
    wireless RNDIS is Broadcom 4320. Driver detects all RNDIS devices that
    have RNDIS wireless physical medium. At least following devices are
    detected:
    
      Buffalo WLI-U2-KG125S
      U.S. Robotics USR5421
      Belkin F5D7051
      Linksys WUSB54GSv2
      Linksys WUSB54GSC
      Asus WL169gE
      Eminent EM4045
      BT Voyager 1055
      Linksys WUSB54GSv1
      U.S. Robotics USR5420
      BUFFALO WLI-USB-G54
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit f252cf8b662f629c1a3502fcb41ef087d73c303f
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:45 2008 +0200

    Move usbnet.h and rndis_host.h to include/linux/usb
    
    Move headers usbnet.h and rndis_host.h to include/linux/usb and fix includes
    for drivers/net/usb modules. Headers are moved because rndis_wlan will be
    outside drivers/net/usb in drivers/net/wireless and yet need these headers.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 759964297fc35b8e38e7c9d828e9505322ea11f5
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sun Jan 27 23:34:33 2008 +0200

    rndis_host: Add RNDIS physical medium checking into generic_rndis_bind()
    
    Add RNDIS physical medium checking into generic_rndis_bind() and also make
    rndis_host to be only bind on every medium except wireless.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 04136a20e91bec8cd1c2cf919ddef8fb0df83942
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:34 2008 +0200

    rndis_host: Add link_change function pointer to 'struct rndis_data'.
    
    Callback to signal link state changes from minidriver to
    'subminidrivers'.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 92d1f152f3861f4fafc0eea93ea904b027cb6349
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:28 2008 +0200

    rndis_host: Add early_init function pointer to 'struct rndis_data'.
    
    Function pointer is for 'subminidrivers' that need to do work on device
    right after minidriver has initialized hardware.
    
    For example, rndis_wlan setting device specific configuration parameters
    with OID_GEN_RNDIS_CONFIG_PARAMETER right after rndis_host has
    initialized hardware with RNDIS_INIT.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit bc82bb39f2feb6d02d67dafc2a7d073b18bcd3f3
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:23 2008 +0200

    usbnet: add driver_priv pointer to 'struct usbnet'
    
    Add a private data pointer to usbnet for rndis_wlan module to use.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 979f81d29fcbcfb885731c179ba3fb35dc0e41e3
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:17 2008 +0200

    rndis_host: export functions
    
    Export rndis_host functions and also rename rndis_bind() to
    generic_rndis_bind() for modules using rndis_host as base.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit acd85817a5d49a57e15c1bf623f2b42c4ce310ff
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:12 2008 +0200

    rndis_host: Split up rndis_host.c
    
    Split up rndis_host.c into rndis_host.h and rndis_base.c. This is done so
    that rndis_wlan can reuse common parts with rndis_host.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 4339098646304ad10352e2d88db7938aefc4f274
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:06 2008 +0200

    usbnet: Use wlan device name for RNDIS wireless devices
    
    Use wlan device name for RNDIS wireless devices.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Signed-off-by: Bjorge Dijkstra <bjd at jooz.net>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 7e90d8d06bb53755efc553bf68f01b98009898a1
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:51:01 2008 +0200

    rndis_host: Fix rndis packet filter flags.
    
    RNDIS packet filter flags are not exactly the same as CDC flags
    so we cannot reuse them.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Signed-off-by: Bjorge Dijkstra <bjd at jooz.net>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 1ebc0a52277ee415989b28e83ad914051f936ef6
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:50:55 2008 +0200

    rndis_host: Halt device if rndis_bind fails.
    
    When bind fails after device was initialized, shutdown device properly
    by sending RNDIS_MSG_HALT.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Signed-off-by: Bjorge Dijkstra <bjd at jooz.net>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 4a565e67420d42e4afb0b75e865bfe68d867469d
Author: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
Date:   Sat Jan 26 00:50:49 2008 +0200

    rndis_host: Use 1KB buffer in rndis_unbind
    
    rndis_command requires the caller to pass in a buffer of at least 1KB.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Signed-off-by: Bjorge Dijkstra <bjd at jooz.net>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 43afa83e72732356f76e0663fc6e8ccc92b203ed
Author: Bjorge Dijkstra <bjd at jooz.net>
Date:   Sat Jan 26 00:50:44 2008 +0200

    cdc_ether: Hardwire CDC descriptors when missing
    
    Just as ActiveSync devices, some regular RNDIS devices also lack
    the CDC descriptors (e.g. devices based on BCM4320 WLAN chip).
    This patch hardwires the CDC descriptors for all RNDIS style devices
    when they are missing.
    
    Signed-off-by: Bjorge Dijkstra <bjd at jooz.net>
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at mbnet.fi>
    Acked-by: David Brownell <dbrownell at users.sourceforge.net>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit c088851901888afc7ec355ea14b03db2692a3c61
Author: Bjorge Dijkstra <bjd at jooz.net>
Date:   Sat Jan 26 00:50:38 2008 +0200

    rndis_host: Fix sparse warning
    
    rndis_unbind and usbnet_cdc_unbind don't return anything.
    
[...3948 lines suppressed...]
+	.tx_fixup =	rndis_tx_fixup,
+	.reset =	rndis_wext_reset,
+	.early_init =	bcm4320_early_init,
+	.link_change =	rndis_wext_link_change,
+};
+
+static const struct driver_info rndis_wext_info = {
+	.description =	"Wireless RNDIS device",
+	.flags =	FLAG_WLAN | FLAG_FRAMING_RN | FLAG_NO_SETINT,
+	.bind =		rndis_wext_bind,
+	.unbind =	rndis_wext_unbind,
+	.status =	rndis_status,
+	.rx_fixup =	rndis_rx_fixup,
+	.tx_fixup =	rndis_tx_fixup,
+	.reset =	rndis_wext_reset,
+	.early_init =	bcm4320_early_init,
+	.link_change =	rndis_wext_link_change,
+};
+
+/*-------------------------------------------------------------------------*/
+
+static const struct usb_device_id products [] = {
+#define	RNDIS_MASTER_INTERFACE \
+	.bInterfaceClass	= USB_CLASS_COMM, \
+	.bInterfaceSubClass	= 2 /* ACM */, \
+	.bInterfaceProtocol	= 0x0ff
+
+/* INF driver for these devices have DriverVer >= 4.xx.xx.xx and many custom
+ * parameters available. Chipset marked as 'BCM4320SKFBG' in NDISwrapper-wiki.
+ */
+{
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x0411,
+	.idProduct		= 0x00bc,	/* Buffalo WLI-U2-KG125S */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x0baf,
+	.idProduct		= 0x011b,	/* U.S. Robotics USR5421 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x050d,
+	.idProduct		= 0x011b,	/* Belkin F5D7051 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x1799,	/* Belkin has two vendor ids */
+	.idProduct		= 0x011b,	/* Belkin F5D7051 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x13b1,
+	.idProduct		= 0x0014,	/* Linksys WUSB54GSv2 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x13b1,
+	.idProduct		= 0x0026,	/* Linksys WUSB54GSC */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x0b05,
+	.idProduct		= 0x1717,	/* Asus WL169gE */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x0a5c,
+	.idProduct		= 0xd11b,	/* Eminent EM4045 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x1690,
+	.idProduct		= 0x0715,	/* BT Voyager 1055 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320b_info,
+},
+/* These devices have DriverVer < 4.xx.xx.xx and do not have any custom
+ * parameters available, hardware probably contain older firmware version with
+ * no way of updating. Chipset marked as 'BCM4320????' in NDISwrapper-wiki.
+ */
+{
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x13b1,
+	.idProduct		= 0x000e,	/* Linksys WUSB54GSv1 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320a_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x0baf,
+	.idProduct		= 0x0111,	/* U.S. Robotics USR5420 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320a_info,
+}, {
+	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
+			  | USB_DEVICE_ID_MATCH_DEVICE,
+	.idVendor		= 0x0411,
+	.idProduct		= 0x004b,	/* BUFFALO WLI-USB-G54 */
+	RNDIS_MASTER_INTERFACE,
+	.driver_info		= (unsigned long) &bcm4320a_info,
+},
+/* Generic Wireless RNDIS devices that we don't have exact
+ * idVendor/idProduct/chip yet.
+ */
+{
+	/* RNDIS is MSFT's un-official variant of CDC ACM */
+	USB_INTERFACE_INFO(USB_CLASS_COMM, 2 /* ACM */, 0x0ff),
+	.driver_info = (unsigned long) &rndis_wext_info,
+}, {
+	/* "ActiveSync" is an undocumented variant of RNDIS, used in WM5 */
+	USB_INTERFACE_INFO(USB_CLASS_MISC, 1, 1),
+	.driver_info = (unsigned long) &rndis_wext_info,
+},
+	{ },		// END
+};
+MODULE_DEVICE_TABLE(usb, products);
+
+static struct usb_driver rndis_wlan_driver = {
+	.name =		"rndis_wlan",
+	.id_table =	products,
+	.probe =	usbnet_probe,
+	.disconnect =	usbnet_disconnect,
+	.suspend =	usbnet_suspend,
+	.resume =	usbnet_resume,
+};
+
+static int __init rndis_wlan_init(void)
+{
+	return usb_register(&rndis_wlan_driver);
+}
+module_init(rndis_wlan_init);
+
+static void __exit rndis_wlan_exit(void)
+{
+	usb_deregister(&rndis_wlan_driver);
+}
+module_exit(rndis_wlan_exit);
+
+MODULE_AUTHOR("Bjorge Dijkstra");
+MODULE_AUTHOR("Jussi Kivilinna");
+MODULE_DESCRIPTION("Driver for RNDIS based USB Wireless adapters");
+MODULE_LICENSE("GPL");
+
diff -up linux-2.6.24.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.24.noarch/drivers/net/wireless/Kconfig
--- linux-2.6.24.noarch/drivers/net/wireless/Kconfig.orig	2008-01-29 17:12:32.000000000 -0500
+++ linux-2.6.24.noarch/drivers/net/wireless/Kconfig	2008-01-29 17:13:29.000000000 -0500
@@ -553,6 +553,34 @@ config USB_ZD1201
 	  To compile this driver as a module, choose M here: the
 	  module will be called zd1201.
 
+config USB_NET_RNDIS_WLAN
+	tristate "Wireless RNDIS USB support"
+	depends on USB && WLAN_80211 && EXPERIMENTAL
+	select USB_USBNET
+	select USB_NET_CDCETHER
+	select USB_NET_RNDIS_HOST
+	select WIRELESS_EXT
+	---help---
+	  This is a driver for wireless RNDIS devices.
+	  These are USB based adapters found in devices such as:
+
+	  Buffalo WLI-U2-KG125S
+	  U.S. Robotics USR5421
+	  Belkin F5D7051
+	  Linksys WUSB54GSv2
+	  Linksys WUSB54GSC
+	  Asus WL169gE
+	  Eminent EM4045
+	  BT Voyager 1055
+	  Linksys WUSB54GSv1
+	  U.S. Robotics USR5420
+	  BUFFALO WLI-USB-G54
+
+	  All of these devices are based on Broadcom 4320 chip which is the
+	  only wireless RNDIS chip known to date.
+
+	  If you choose to build a module, it'll be called rndis_wlan.
+
 config RTL8180
 	tristate "Realtek 8180/8185 PCI support"
 	depends on MAC80211 && PCI && WLAN_80211 && EXPERIMENTAL

linux-2.6-scsi-mpt-vmware-fix.patch:

--- NEW FILE linux-2.6-scsi-mpt-vmware-fix.patch ---
The attached patch is a workaround for a bug in VMWare's emulated LSI
Fusion SCSI HBA.  The emulated firmware returns zero for the maximum
number of attached devices; the real firmware returns a positive
number.  Therefore, the kernel that boots and works fine on bare metal
will fail on VMWare because this firmware value is handed to the SCSI
midlayer, which then skips the entire bus scan.

F7 bz 241935

The patch below was submitted by Eric Moore of LSI to the linux-scsi
mailing list:

http://marc.info/?l=linux-scsi&m=117432237404247

then immediately rejected by Christoph Hellwig, who prefers that
VMWare fix their emulation instead.

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index eddb933..21fadf2 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -2571,8 +2571,19 @@ GetPortFacts(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
 	pfacts->MaxPersistentIDs = le16_to_cpu(pfacts->MaxPersistentIDs);
 	pfacts->MaxLanBuckets = le16_to_cpu(pfacts->MaxLanBuckets);
 
-	max_id = (ioc->bus_type == SAS) ? pfacts->PortSCSIID :
-	    pfacts->MaxDevices;
+	switch (ioc->bus_type) {
+	case SAS:
+		max_id = pfacts->PortSCSIID;
+		break;
+	case FC:
+		max_id = pfacts->MaxDevices;
+		break;
+	case SPI:
+	default:
+		max_id = MPT_MAX_SCSI_DEVICES;
+		break;
+	}
+
 	ioc->devices_per_bus = (max_id > 255) ? 256 : max_id;
 	ioc->number_of_buses = (ioc->devices_per_bus < 256) ? 1 : max_id/256;
 

linux-2.6-selinux-strip-leading-slashes.patch:

--- NEW FILE linux-2.6-selinux-strip-leading-slashes.patch ---
commit b1aa5301b9f88a4891061650c591fb8fe1c1d1da
Author: Stephen Smalley <sds at tycho.nsa.gov>
Date:   Fri Jan 25 13:03:42 2008 -0500

    selinux: fix labeling of /proc/net inodes
    
    The proc net rewrite had a side effect on selinux, leading it to mislabel
    the /proc/net inodes, thereby leading to incorrect denials.  Fix
    security_genfs_sid to ignore extra leading / characters in the path supplied
    by selinux_proc_get_sid since we now get "//net/..." rather than "/net/...".
    
    Signed-off-by: Stephen Smalley <sds at tycho.nsa.gov>
    Signed-off-by: James Morris <jmorris at namei.org>

diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index f83b19d..4bf715d 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1744,6 +1744,9 @@ int security_genfs_sid(const char *fstype,
 	struct ocontext *c;
 	int rc = 0, cmp = 0;
 
+	while (path[0] == '/' && path[1] == '/')
+		path++;
+
 	POLICY_RDLOCK;
 
 	for (genfs = policydb.genfs; genfs; genfs = genfs->next) {


linux-2.6-smarter-relatime.patch:

--- NEW FILE linux-2.6-smarter-relatime.patch ---

Subject: [patch] [patch] implement smarter atime updates support
From: Ingo Molnar <mingo at elte.hu>

change relatime updates to be performed once per day. This makes
relatime a compatible solution for HSM, mailer-notification and
tmpwatch applications too.

also add the CONFIG_DEFAULT_RELATIME kernel option, which makes
"norelatime" the default for all mounts without an extra kernel
boot option.

add the "default_relatime=0" boot option to turn this off.

also add the /proc/sys/kernel/default_relatime flag which can be changed
runtime to modify the behavior of subsequent new mounts.

tested by moving the date forward:

   # date
   Sun Aug  5 22:55:14 CEST 2007
   # date -s "Tue Aug  7 22:55:14 CEST 2007"
   Tue Aug  7 22:55:14 CEST 2007

access to a file did not generate disk IO before the date was set, and
it generated exactly one IO after the date was set.

Signed-off-by: Ingo Molnar <mingo at elte.hu>
---
 Documentation/kernel-parameters.txt |    8 +++++
 fs/Kconfig                          |   22 ++++++++++++++
 fs/inode.c                          |   53 +++++++++++++++++++++++++++---------
 fs/namespace.c                      |   24 ++++++++++++++++
 include/linux/mount.h               |    3 ++
 kernel/sysctl.c                     |   17 +++++++++++
 6 files changed, 114 insertions(+), 13 deletions(-)

Index: linux/Documentation/kernel-parameters.txt
===================================================================
--- linux.orig/Documentation/kernel-parameters.txt
+++ linux/Documentation/kernel-parameters.txt
@@ -525,6 +525,10 @@ and is between 256 and 4096 characters. 
 			This is a 16-member array composed of values
 			ranging from 0-255.
 
+	default_relatime=
+			[FS] mount all filesystems with relative atime
+			updates by default.
+
 	vt.default_utf8=
 			[VT]
 			Format=<0|1>
@@ -1468,6 +1472,10 @@ and is between 256 and 4096 characters. 
 			Format: <reboot_mode>[,<reboot_mode2>[,...]]
 			See arch/*/kernel/reboot.c or arch/*/kernel/process.c			
 
+	relatime_interval=
+			[FS] relative atime update frequency, in seconds.
+			(default: 1 day: 86400 seconds)
+
 	reserve=	[KNL,BUGS] Force the kernel to ignore some iomem area
 
 	reservetop=	[X86-32]
--- linux-2.6.23.noarch/fs/Kconfig~	2007-10-17 17:09:10.000000000 -0400
+++ linux-2.6.23.noarch/fs/Kconfig	2007-10-17 17:10:05.000000000 -0400
@@ -2173,6 +2173,29 @@ config 9P_FS
 
 endif # NETWORK_FILESYSTEMS
 
+config DEFAULT_RELATIME
+	bool "Mount all filesystems with relatime by default"
+	default y
+	help
+	  If you say Y here, all your filesystems will be mounted
+	  with the "relatime" mount option. This eliminates many atime
+	  ('file last accessed' timestamp) updates (which otherwise
+	  is performed on every file access and generates a write
+	  IO to the inode) and thus speeds up IO. Atime is still updated,
+	  but only once per day.
+
+	  The mtime ('file last modified') and ctime ('file created')
+	  timestamp are unaffected by this change.
+
+	  Use the "norelatime" kernel boot option to turn off this
+	  feature.
+
+config DEFAULT_RELATIME_VAL
+	int
+	default "1" if DEFAULT_RELATIME
+	default "0"
+
+
 if BLOCK
 menu "Partition Types"
 
Index: linux/fs/inode.c
===================================================================
--- linux.orig/fs/inode.c
+++ linux/fs/inode.c
@@ -1162,6 +1162,41 @@ sector_t bmap(struct inode * inode, sect
 }
 EXPORT_SYMBOL(bmap);
 
+/*
+ * Relative atime updates frequency (default: 1 day):
+ */
+int relatime_interval __read_mostly = 24*60*60;
+
+/*
+ * With relative atime, only update atime if the
+ * previous atime is earlier than either the ctime or
+ * mtime.
+ */
+static int relatime_need_update(struct inode *inode, struct timespec now)
+{
+	/*
+	 * Is mtime younger than atime? If yes, update atime:
+	 */
+	if (timespec_compare(&inode->i_mtime, &inode->i_atime) >= 0)
+		return 1;
+	/*
+	 * Is ctime younger than atime? If yes, update atime:
+	 */
+	if (timespec_compare(&inode->i_ctime, &inode->i_atime) >= 0)
+		return 1;
+
+	/*
+	 * Is the previous atime value older than a day? If yes,
+	 * update atime:
+	 */
+	if ((long)(now.tv_sec - inode->i_atime.tv_sec) >= relatime_interval)
+		return 1;
+	/*
+	 * Good, we can skip the atime update:
+	 */
+	return 0;
+}
+
 /**
  *	touch_atime	-	update the access time
  *	@mnt: mount the inode is accessed on
@@ -1191,22 +1226,14 @@ void touch_atime(struct vfsmount *mnt, s
 			return;
 		if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
 			return;
-
-		if (mnt->mnt_flags & MNT_RELATIME) {
-			/*
-			 * With relative atime, only update atime if the
-			 * previous atime is earlier than either the ctime or
-			 * mtime.
-			 */
-			if (timespec_compare(&inode->i_mtime,
-						&inode->i_atime) < 0 &&
-			    timespec_compare(&inode->i_ctime,
-						&inode->i_atime) < 0)
+	}
+	now = current_fs_time(inode->i_sb);
+	if (mnt) {
+		if (mnt->mnt_flags & MNT_RELATIME)
+			if (!relatime_need_update(inode, now))
 				return;
-		}
 	}
 
-	now = current_fs_time(inode->i_sb);
 	if (timespec_equal(&inode->i_atime, &now))
 		return;
 
Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c
+++ linux/fs/namespace.c
@@ -1107,6 +1107,7 @@ int do_add_mount(struct vfsmount *newmnt
 		goto unlock;
 
 	newmnt->mnt_flags = mnt_flags;
+
 	if ((err = graft_tree(newmnt, nd)))
 		goto unlock;
 
@@ -1362,6 +1363,24 @@ int copy_mount_options(const void __user
 }
 
 /*
+ * Allow users to disable (or enable) atime updates via a .config
+ * option or via the boot line, or via /proc/sys/fs/default_relatime:
+ */
+int default_relatime __read_mostly = CONFIG_DEFAULT_RELATIME_VAL;
+
+static int __init set_default_relatime(char *str)
+{
+	get_option(&str, &default_relatime);
+
+	printk(KERN_INFO "Mount all filesystems with"
+		"default relative atime updates: %s.\n",
+		default_relatime ? "enabled" : "disabled");
+
+	return 1;
+}
+__setup("default_relatime=", set_default_relatime);
+
+/*
  * Flags is a 32-bit value that allows up to 31 non-fs dependent flags to
  * be given to the mount() call (ie: read-only, no-dev, no-suid etc).
  *
@@ -1409,6 +1428,11 @@ long do_mount(char *dev_name, char *dir_
 		mnt_flags |= MNT_NODIRATIME;
 	if (flags & MS_RELATIME)
 		mnt_flags |= MNT_RELATIME;
+	else if (default_relatime &&
+				!(flags & (MNT_NOATIME | MNT_NODIRATIME))) {
+		mnt_flags |= MNT_RELATIME;
+		flags |= MS_RELATIME;
+	}
 
 	flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
 		   MS_NOATIME | MS_NODIRATIME | MS_RELATIME);
Index: linux/include/linux/mount.h
===================================================================
--- linux.orig/include/linux/mount.h
+++ linux/include/linux/mount.h
@@ -103,5 +103,8 @@ extern void shrink_submounts(struct vfsm
 extern spinlock_t vfsmount_lock;
 extern dev_t name_to_dev_t(char *name);
 
+extern int default_relatime;
+extern int relatime_interval;
+
 #endif
 #endif /* _LINUX_MOUNT_H */
Index: linux/kernel/sysctl.c
===================================================================
--- linux.orig/kernel/sysctl.c
+++ linux/kernel/sysctl.c
@@ -30,6 +30,7 @@
 #include <linux/capability.h>
 #include <linux/smp_lock.h>
 #include <linux/fs.h>
+#include <linux/mount.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kobject.h>
@@ -1206,6 +1207,22 @@ static ctl_table fs_table[] = {
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= "default_relatime",
+		.data		= &default_relatime,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= "relatime_interval",
+		.data		= &relatime_interval,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
 	{
 		.ctl_name	= CTL_UNNUMBERED,


linux-2.6-usb-ehci-hcd-respect-nousb.patch:

--- NEW FILE linux-2.6-usb-ehci-hcd-respect-nousb.patch ---
Make the EHCI host driver respect the "nousb" kernel option.

Signed-off-by: Chuck Ebbert <cebbert at redhat.com>

---
 drivers/usb/host/ehci-hcd.c |    3 +++
 1 file changed, 3 insertions(+)

--- linux-2.6.23.noarch.orig/drivers/usb/host/ehci-hcd.c
+++ linux-2.6.23.noarch/drivers/usb/host/ehci-hcd.c
@@ -973,6 +973,9 @@ static int __init ehci_hcd_init(void)
 {
 	int retval = 0;
 
+	if (usb_disabled())
+		return -ENODEV;
+
 	pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
 		 hcd_name,
 		 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),

linux-2.6-utrace-ptrace-compat-avr32.patch:

--- NEW FILE linux-2.6-utrace-ptrace-compat-avr32.patch ---
[PATCH 4d] utrace: avr32 ptrace compatibility

From: Haavard Skinnemoen <hskinnemoen at atmel.com>

Rip out most of the ptrace code for AVR32 and replace it with the much
nicer utrace stuff.  It builds in all possible combinations of
CONFIG_UTRACE and CONFIG_PTRACE, and it seems to work as far as I've tested
it with strace and some simple debugging with gdb.

Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
Signed-off-by: Roland McGrath <roland at redhat.com>

---

 arch/avr32/kernel/ptrace.c |   91 +++++++++-----------------------------------
 1 files changed, 19 insertions(+), 72 deletions(-)

--- linux-2.6/arch/avr32/kernel/ptrace.c
+++ linux-2.6/arch/avr32/kernel/ptrace.c
@@ -112,98 +112,45 @@ const struct utrace_regset_view *utrace_
 }
 #endif /* CONFIG_UTRACE */
 
+#ifdef CONFIG_PTRACE
 
-#if 0
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+static const struct ptrace_layout_segment avr32_uarea[] = {
+	{ 0, ELF_NGREG * sizeof(long), 0, 0 },
+	{ 0, 0, -1, 0 },
+};
+
+int arch_ptrace(long *request, struct task_struct *child,
+		struct utrace_attached_engine *engine,
+		unsigned long addr, unsigned long data, long *val)
 {
-	int ret;
+	pr_debug("arch_ptrace(%ld, %d, %#lx, %#lx)\n",
+		 *request, child->pid, addr, data);
 
 	pr_debug("ptrace: Enabling monitor mode...\n");
 	ocd_write(DC, ocd_read(DC) | (1 << OCD_DC_MM_BIT)
 			| (1 << OCD_DC_DBE_BIT));
 
-	switch (request) {
-	/* Read the word at location addr in the child process */
-	case PTRACE_PEEKTEXT:
-	case PTRACE_PEEKDATA:
-		ret = generic_ptrace_peekdata(child, addr, data);
-		break;
-
+	switch (*request) {
 	case PTRACE_PEEKUSR:
-		ret = ptrace_read_user(child, addr,
-				       (unsigned long __user *)data);
-		break;
-
-	/* Write the word in data at location addr */
-	case PTRACE_POKETEXT:
-	case PTRACE_POKEDATA:
-		ret = generic_ptrace_pokedata(child, addr, data);
-		break;
+		return ptrace_peekusr(child, engine, avr32_uarea, addr, data);
 
 	case PTRACE_POKEUSR:
-		ret = ptrace_write_user(child, addr, data);
-		break;
-
-	/* continue and stop at next (return from) syscall */
-	case PTRACE_SYSCALL:
-	/* restart after signal */
-	case PTRACE_CONT:
-		ret = -EIO;
-		if (!valid_signal(data))
-			break;
-		if (request == PTRACE_SYSCALL)
-			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-		else
-			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-		child->exit_code = data;
-		/* XXX: Are we sure no breakpoints are active here? */
-		wake_up_process(child);
-		ret = 0;
-		break;
-
-	/*
-	 * Make the child exit. Best I can do is send it a
-	 * SIGKILL. Perhaps it should be put in the status that it
-	 * wants to exit.
-	 */
-	case PTRACE_KILL:
-		ret = 0;
-		if (child->exit_state == EXIT_ZOMBIE)
-			break;
-		child->exit_code = SIGKILL;
-		wake_up_process(child);
-		break;
-
-	/*
-	 * execute single instruction.
-	 */
-	case PTRACE_SINGLESTEP:
-		ret = -EIO;
-		if (!valid_signal(data))
-			break;
-		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-		ptrace_single_step(child);
-		child->exit_code = data;
-		wake_up_process(child);
-		ret = 0;
+		return ptrace_pokeusr(child, engine, avr32_uarea, addr, data);
 		break;
 
 	case PTRACE_GETREGS:
-		ret = ptrace_getregs(child, (void __user *)data);
+		return ptrace_whole_regset(child, engine, data, 0, 0);
 		break;
 
 	case PTRACE_SETREGS:
-		ret = ptrace_setregs(child, (const void __user *)data);
-		break;
-
-	default:
-		ret = ptrace_request(child, request, addr, data);
+		return ptrace_whole_regset(child, engine, data, 0, 1);
 		break;
 	}
 
-	return ret;
+	return -ENOSYS;
 }
-#endif
+#endif /* CONFIG_PTRACE */
+#endif /* CONFIG_UTRACE */
 
 asmlinkage void syscall_trace(struct pt_regs *regs, int is_exit)
 {

linux-2.6-utrace-regset-avr32.patch:

--- NEW FILE linux-2.6-utrace-regset-avr32.patch ---
[PATCH 2d] utrace: avr32 regset support

From: Haavard Skinnemoen <hskinnemoen at atmel.com>

Rip out most of the ptrace code for AVR32 and replace it with the much
nicer utrace stuff.

CC: Haavard Skinnemoen <hskinnemoen at atmel.com>
Signed-off-by: Roland McGrath <roland at redhat.com>

---

 arch/avr32/kernel/ptrace.c |  111 +++++++++++++++++---------------------------
 1 files changed, 44 insertions(+), 67 deletions(-)

--- linux-2.6/arch/avr32/kernel/ptrace.c
+++ linux-2.6/arch/avr32/kernel/ptrace.c
@@ -14,10 +14,14 @@
 #include <linux/ptrace.h>
 #include <linux/errno.h>
 #include <linux/user.h>
+#include <linux/tracehook.h>
 
+#include <asm/tracehook.h>
 #include <asm/mmu_context.h>
 #include <linux/kdebug.h>
 
+#ifdef CONFIG_UTRACE
+
 static struct pt_regs *get_user_regs(struct task_struct *tsk)
 {
 	return (struct pt_regs *)((unsigned long)task_stack_page(tsk) +
@@ -57,86 +61,59 @@ void ptrace_disable(struct task_struct *
 	clear_tsk_thread_flag(child, TIF_BREAKPOINT);
 }
 
-/*
- * Read the word at offset "offset" into the task's "struct user". We
- * actually access the pt_regs struct stored on the kernel stack.
- */
-static int ptrace_read_user(struct task_struct *tsk, unsigned long offset,
-			    unsigned long __user *data)
+static int genregs_get(struct task_struct *target,
+		       const struct utrace_regset *regset,
+		       unsigned int pos, unsigned int count,
+		       void *kbuf, void __user *ubuf)
 {
-	unsigned long *regs;
-	unsigned long value;
-
-	if (offset & 3 || offset >= sizeof(struct user)) {
-		printk("ptrace_read_user: invalid offset 0x%08lx\n", offset);
-		return -EIO;
-	}
-
-	regs = (unsigned long *)get_user_regs(tsk);
-
-	value = 0;
-	if (offset < sizeof(struct pt_regs))
-		value = regs[offset / sizeof(regs[0])];
+	struct pt_regs *regs = get_user_regs(target);
 
-	pr_debug("ptrace_read_user(%s[%u], %#lx, %p) -> %#lx\n",
-		 tsk->comm, tsk->pid, offset, data, value);
-
-	return put_user(value, data);
+	return utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
+				     regs, 0, -1);
 }
 
-/*
- * Write the word "value" to offset "offset" into the task's "struct
- * user". We actually access the pt_regs struct stored on the kernel
- * stack.
- */
-static int ptrace_write_user(struct task_struct *tsk, unsigned long offset,
-			     unsigned long value)
+static int genregs_set(struct task_struct *target,
+		       const struct utrace_regset *regset,
+		       unsigned int pos, unsigned int count,
+		       const void *kbuf, const void __user *ubuf)
 {
-	unsigned long *regs;
-
-	pr_debug("ptrace_write_user(%s[%u], %#lx, %#lx)\n",
-			tsk->comm, tsk->pid, offset, value);
-
-	if (offset & 3 || offset >= sizeof(struct user)) {
-		pr_debug("  invalid offset 0x%08lx\n", offset);
-		return -EIO;
-	}
-
-	if (offset >= sizeof(struct pt_regs))
-		return 0;
+	struct pt_regs *regs = get_user_regs(target);
 
-	regs = (unsigned long *)get_user_regs(tsk);
-	regs[offset / sizeof(regs[0])] = value;
-
-	return 0;
+	return utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
+				    regs, 0, -1);
 }
 
-static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
-{
-	struct pt_regs *regs = get_user_regs(tsk);
+static const struct utrace_regset native_regsets[] = {
+	{
+		.core_note_type = NT_PRSTATUS,
+		.n	= ELF_NGREG,
+		.size	= sizeof(long),
+		.align	= sizeof(long),
+		.get	= genregs_get,
+		.set	= genregs_set,
+	},
+	/*
+	 * Other register sets that probably would make sense:
+	 *   - Coprocessor registers (8 coprocs with 16 registers each)
+	 *   - TLS stuff
+	 */
+};
 
-	return copy_to_user(uregs, regs, sizeof(*regs)) ? -EFAULT : 0;
-}
+static const struct utrace_regset_view utrace_avr32_native_view = {
+	.name		= UTS_MACHINE,
+	.e_machine	= ELF_ARCH,
+	.regsets	= native_regsets,
+	.n		= ARRAY_SIZE(native_regsets),
+};
 
-static int ptrace_setregs(struct task_struct *tsk, const void __user *uregs)
+const struct utrace_regset_view *utrace_native_view(struct task_struct *tsk)
 {
-	struct pt_regs newregs;
-	int ret;
-
-	ret = -EFAULT;
-	if (copy_from_user(&newregs, uregs, sizeof(newregs)) == 0) {
-		struct pt_regs *regs = get_user_regs(tsk);
-
-		ret = -EINVAL;
-		if (valid_user_regs(&newregs)) {
-			*regs = newregs;
-			ret = 0;
-		}
-	}
-
-	return ret;
+	return &utrace_avr32_native_view;
 }
+#endif /* CONFIG_UTRACE */
+
 
+#if 0
 long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 {
 	int ret;

linux-2.6-utrace-tracehook-avr32.patch:

--- NEW FILE linux-2.6-utrace-tracehook-avr32.patch ---
[PATCH 1e] utrace: tracehook for AVR32

From: Haavard Skinnemoen <hskinnemoen at atmel.com>

This patch does the initial tracehook conversion for AVR32.

Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
Signed-off-by: Roland McGrath <roland at redhat.com>

---

 arch/avr32/kernel/ptrace.c       |   50 +++++++++++++++----------------
 arch/avr32/kernel/process.c      |    2 -
 arch/avr32/kernel/entry-avr32b.S |   10 +++++-
 include/asm-avr32/tracehook.h    |   62 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 94 insertions(+), 30 deletions(-)
 create include/asm-avr32/tracehook.h

--- linux-2.6/arch/avr32/kernel/ptrace.c
+++ linux-2.6/arch/avr32/kernel/ptrace.c
@@ -5,20 +5,16 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#undef DEBUG
+#include <linux/compile.h>
+#include <linux/elf.h>
+#include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/ptrace.h>
 #include <linux/errno.h>
 #include <linux/user.h>
-#include <linux/security.h>
-#include <linux/unistd.h>
-#include <linux/notifier.h>
-
-#include <asm/traps.h>
-#include <asm/uaccess.h>
-#include <asm/ocd.h>
+
 #include <asm/mmu_context.h>
 #include <linux/kdebug.h>
 
@@ -28,6 +24,7 @@ static struct pt_regs *get_user_regs(str
 				  THREAD_SIZE - sizeof(struct pt_regs));
 }
 
+#if 0
 static void ptrace_single_step(struct task_struct *tsk)
 {
 	pr_debug("ptrace_single_step: pid=%u, PC=0x%08lx, SR=0x%08lx\n",
@@ -229,30 +226,31 @@ long arch_ptrace(struct task_struct *chi
 
 	return ret;
 }
+#endif
 
-asmlinkage void syscall_trace(void)
+asmlinkage void syscall_trace(struct pt_regs *regs, int is_exit)
 {
 	if (!test_thread_flag(TIF_SYSCALL_TRACE))
 		return;
-	if (!(current->ptrace & PT_PTRACED))
-		return;
 
-	/* The 0x80 provides a way for the tracing parent to
-	 * distinguish between a syscall stop and SIGTRAP delivery */
-	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-				 ? 0x80 : 0));
+	tracehook_report_syscall(regs, is_exit);
+}
 
-	/*
-	 * 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) {
-		pr_debug("syscall_trace: sending signal %d to PID %u\n",
-			 current->exit_code, current->pid);
-		send_sig(current->exit_code, current, 1);
-		current->exit_code = 0;
-	}
+/*
+ * Handle hitting a breakpoint
+ */
+static void do_breakpoint(struct task_struct *tsk, struct pt_regs *regs)
+{
+	siginfo_t info;
+
+	info.si_signo = SIGTRAP;
+	info.si_errno = 0;
+	info.si_code  = TRAP_BRKPT;
+	info.si_addr  = (void __user *)instruction_pointer(regs);
+
+	pr_debug("ptrace_break: Sending SIGTRAP to PID %u (pc = 0x%p)\n",
+		 tsk->pid, info.si_addr);
+	force_sig_info(SIGTRAP, &info, tsk);
 }
 
 /*
--- linux-2.6/arch/avr32/kernel/process.c
+++ linux-2.6/arch/avr32/kernel/process.c
@@ -383,8 +383,6 @@ asmlinkage int sys_execve(char __user *u
 		goto out;
 
 	error = do_execve(filename, uargv, uenvp, regs);
-	if (error == 0)
-		current->ptrace &= ~PT_DTRACE;
 	putname(filename);
 
 out:
--- linux-2.6/arch/avr32/kernel/entry-avr32b.S
+++ linux-2.6/arch/avr32/kernel/entry-avr32b.S
@@ -230,15 +230,21 @@ ret_from_fork:
 	rjmp    syscall_exit_cont
 
 syscall_trace_enter:
-	pushm	r8-r12
+	mov	r12, sp		/* regs		*/
+	mov	r11, 0		/* is_exit	*/
 	rcall	syscall_trace
-	popm	r8-r12
+
+	/* syscall_trace may update r8, so reload r8-r12 from regs. */
+	sub	lr, sp, -REG_R12
+	ldm	lr, r8-r12
 	rjmp	syscall_trace_cont
 
 syscall_exit_work:
 	bld	r1, TIF_SYSCALL_TRACE
 	brcc	1f
 	unmask_interrupts
+	mov	r12, sp
+	mov	r11, 1
 	rcall	syscall_trace
 	mask_interrupts
 	ld.w	r1, r0[TI_flags]
--- linux-2.6/include/asm-avr32/tracehook.h
+++ linux-2.6/include/asm-avr32/tracehook.h
@@ -0,0 +1,62 @@
+/*
+ * Tracing hooks for AVR32
+ *
+ * Copyright (C) 2007 Atmel 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.
+ */
+#ifndef _ASM_AVR32_TRACEHOOK_H
+#define _ASM_AVR32_TRACEHOOK_H
+
+#include <linux/sched.h>
+
+#define ARCH_HAS_SINGLE_STEP	1
+
+static inline void tracehook_enable_single_step(struct task_struct *tsk)
+{
+	/*
+	 * If the process is stopped in debug mode, simply set
+	 * TIF_SINGLE_STEP to tell the monitor code to set the single
+	 * step bit in DC before returning.
+	 *
+	 * Otherwise, we need to set a breakpoint at the return
+	 * address before returning to userspace. TIF_BREAKPOINT will
+	 * tell the syscall/exception exit code to do this.
+	 */
+	if (!(tsk->thread.cpu_context.sr & SR_D))
+		set_tsk_thread_flag(tsk, TIF_BREAKPOINT);
+
+	set_tsk_thread_flag(tsk, TIF_SINGLE_STEP);
+}
+
+static inline void tracehook_disable_single_step(struct task_struct *tsk)
+{
+	clear_tsk_thread_flag(tsk, TIF_BREAKPOINT);
+	clear_tsk_thread_flag(tsk, TIF_SINGLE_STEP);
+}
+
+static inline int tracehook_single_step_enabled(struct task_struct *tsk)
+{
+	return test_tsk_thread_flag(tsk, TIF_SINGLE_STEP);
+}
+
+static inline void tracehook_enable_syscall_trace(struct task_struct *tsk)
+{
+	set_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
+}
+
+static inline void tracehook_disable_syscall_trace(struct task_struct *tsk)
+{
+	clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
+}
+
+static inline void tracehook_abort_syscall(struct pt_regs *regs)
+{
+	/* Invalid system call number => return -ENOSYS */
+	regs->r8 = -1;
+}
+
+
+#endif /* _ASM_AVR32_TRACEHOOK_H */

linux-2.6-uvcvideo.patch:

--- NEW FILE linux-2.6-uvcvideo.patch ---
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index c9f14bf..19acd71 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -718,6 +718,7 @@ source "drivers/media/video/em28xx/Kconfig"
 source "drivers/media/video/usbvision/Kconfig"
 
 source "drivers/media/video/usbvideo/Kconfig"
+source "drivers/media/video/uvcvideo/Kconfig"
 
 source "drivers/media/video/et61x251/Kconfig"
 
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index b5a0641..91033cf 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -123,6 +123,8 @@ obj-$(CONFIG_USB_KONICAWC)      += usbvideo/
 obj-$(CONFIG_USB_VICAM)         += usbvideo/
 obj-$(CONFIG_USB_QUICKCAM_MESSENGER)	+= usbvideo/
 
+obj-$(CONFIG_USB_UVCVIDEO)	+= uvcvideo/
+
 obj-$(CONFIG_VIDEO_IVTV) += ivtv/
 
 obj-$(CONFIG_VIDEO_VIVI) += vivi.o
diff --git a/drivers/media/video/uvcvideo/Kconfig b/drivers/media/video/uvcvideo/Kconfig
new file mode 100644
index 0000000..dccaab7
--- /dev/null
+++ b/drivers/media/video/uvcvideo/Kconfig
@@ -0,0 +1,7 @@
+config USB_UVCVIDEO
+	tristate "USB Video class device (uvcvideo) driver"
+	---help---
+	Say M or Y here to enable support for USB video devices that
+	conform to the USB video class device specification.
+	.
+	If unsure, jump up and down and look confused.
diff --git a/drivers/media/video/uvcvideo/Makefile b/drivers/media/video/uvcvideo/Makefile
new file mode 100644
index 0000000..ada681c
--- /dev/null
+++ b/drivers/media/video/uvcvideo/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_USB_UVCVIDEO)	:= uvcvideo.o
+uvcvideo-objs   := uvc_driver.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_ctrl.o uvc_status.o uvc_isight.o
diff --git a/drivers/media/video/uvcvideo/uvc_compat.h b/drivers/media/video/uvcvideo/uvc_compat.h
new file mode 100644
index 0000000..321f3d3
--- /dev/null
+++ b/drivers/media/video/uvcvideo/uvc_compat.h
@@ -0,0 +1,263 @@
+#ifndef _UVC_COMPAT_H
+#define _UVC_COMPAT_H
+
+#include <linux/version.h>
+
+#ifndef __KERNEL__
+#ifndef __user
+#define __user
+#endif
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+/*
+ * Extended control API
+ */
+struct v4l2_ext_control
+{
+	__u32 id;
+	__u32 reserved2[2];
+	union {
+		__s32 value;
+		__s64 value64;
+		void *reserved;
+	};
+} __attribute__ ((packed));
+
+struct v4l2_ext_controls
+{
+	__u32 ctrl_class;
+	__u32 count;
+	__u32 error_idx;
+	__u32 reserved[2];
+	struct v4l2_ext_control *controls;
+};
+
+/* Values for ctrl_class field */
+#define V4L2_CTRL_CLASS_USER		0x00980000	/* Old-style 'user' controls */
+#define V4L2_CTRL_CLASS_MPEG		0x00990000	/* MPEG-compression controls */
+
+#define V4L2_CTRL_ID_MASK		(0x0fffffff)
+#define V4L2_CTRL_ID2CLASS(id)		((id) & 0x0fff0000UL)
+#define V4L2_CTRL_DRIVER_PRIV(id)	(((id) & 0xffff) >= 0x1000)
+
+/* Control flags */
+#define V4L2_CTRL_FLAG_READ_ONLY	0x0004
+#define V4L2_CTRL_FLAG_UPDATE		0x0008
+#define V4L2_CTRL_FLAG_INACTIVE		0x0010
+#define V4L2_CTRL_FLAG_SLIDER		0x0020
+
+/* Query flags, to be ORed with the control ID */
+#define V4L2_CTRL_FLAG_NEXT_CTRL	0x80000000
+
+/* User-class control IDs defined by V4L2 */
+#undef	V4L2_CID_BASE
+#define V4L2_CID_BASE			(V4L2_CTRL_CLASS_USER | 0x900)
+#define V4L2_CID_USER_BASE		V4L2_CID_BASE
+#define V4L2_CID_USER_CLASS		(V4L2_CTRL_CLASS_USER | 1)
+	
+#define VIDIOC_G_EXT_CTRLS		_IOWR ('V', 71, struct v4l2_ext_controls)
+#define VIDIOC_S_EXT_CTRLS		_IOWR ('V', 72, struct v4l2_ext_controls)
+#define VIDIOC_TRY_EXT_CTRLS		_IOWR ('V', 73, struct v4l2_ext_controls)
+
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+/*
+ * Frame size and frame rate enumeration
+ *
+ * Included in Linux 2.6.19
+ */
+enum v4l2_frmsizetypes
+{
+	V4L2_FRMSIZE_TYPE_DISCRETE	= 1,
+	V4L2_FRMSIZE_TYPE_CONTINUOUS	= 2,
+	V4L2_FRMSIZE_TYPE_STEPWISE	= 3,
+};
+
+struct v4l2_frmsize_discrete
+{
+	__u32			width;		/* Frame width [pixel] */
+	__u32			height;		/* Frame height [pixel] */
+};
+
+struct v4l2_frmsize_stepwise
+{
+	__u32			min_width;	/* Minimum frame width [pixel] */
+	__u32			max_width;	/* Maximum frame width [pixel] */
+	__u32			step_width;	/* Frame width step size [pixel] */
+	__u32			min_height;	/* Minimum frame height [pixel] */
+	__u32			max_height;	/* Maximum frame height [pixel] */
+	__u32			step_height;	/* Frame height step size [pixel] */
+};
+
+struct v4l2_frmsizeenum
+{
+	__u32			index;		/* Frame size number */
+	__u32			pixel_format;	/* Pixel format */
+	__u32			type;		/* Frame size type the device supports. */
+
+        union {					/* Frame size */
+		struct v4l2_frmsize_discrete	discrete;
+		struct v4l2_frmsize_stepwise	stepwise;
+	};
+
+	__u32   reserved[2];			/* Reserved space for future use */
+};
+
+enum v4l2_frmivaltypes
+{
+	V4L2_FRMIVAL_TYPE_DISCRETE	= 1,
+	V4L2_FRMIVAL_TYPE_CONTINUOUS	= 2,
+	V4L2_FRMIVAL_TYPE_STEPWISE	= 3,
+};
+
+struct v4l2_frmival_stepwise
+{
+	struct v4l2_fract	min;		/* Minimum frame interval [s] */
+	struct v4l2_fract	max;		/* Maximum frame interval [s] */
+	struct v4l2_fract	step;		/* Frame interval step size [s] */
+};
+
+struct v4l2_frmivalenum
+{
+	__u32			index;		/* Frame format index */
+	__u32			pixel_format;	/* Pixel format */
+	__u32			width;		/* Frame width */
+	__u32			height;		/* Frame height */
+	__u32			type;		/* Frame interval type the device supports. */
+
+	union {					/* Frame interval */
+		struct v4l2_fract		discrete;
+		struct v4l2_frmival_stepwise	stepwise;
+	};
+
+	__u32	reserved[2];			/* Reserved space for future use */
+};
+
+#define VIDIOC_ENUM_FRAMESIZES		_IOWR ('V', 74, struct v4l2_frmsizeenum)
+#define VIDIOC_ENUM_FRAMEINTERVALS	_IOWR ('V', 75, struct v4l2_frmivalenum)
+#endif
+
+#ifdef __KERNEL__
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+/*
+ * kzalloc()
+ */
[...6529 lines suppressed...]
+	/* Video streaming object, must always be non-NULL. */
+	struct uvc_streaming *streaming;
+
+	void (*decode) (struct urb *urb, struct uvc_video_device *video,
+			struct uvc_buffer *buf);
+
+	/* Context data used by the bulk completion handler. */
+	struct {
+		__u8 header[256];
+		unsigned int header_size;
+		int skip_payload;
+		__u32 payload_size;
+		__u32 max_payload_size;
+	} bulk;
+
+	struct urb *urb[UVC_URBS];
+	char *urb_buffer[UVC_URBS];
+
+	__u8 last_fid;
+};
+
+enum uvc_device_state {
+	UVC_DEV_DISCONNECTED = 1,
+};
+
+struct uvc_device {
+	struct usb_device *udev;
+	struct usb_interface *intf;
+	__u32 quirks;
+	int intfnum;
+
+	enum uvc_device_state state;
+	struct kref kref;
+	struct list_head list;
+
+	/* Video control interface */
+	__u16 uvc_version;
+	__u32 clock_frequency;
+
+	struct list_head entities;
+
+	struct uvc_video_device video;
+
+	/* Status Interrupt Endpoint */
+	struct usb_host_endpoint *int_ep;
+	struct urb *int_urb;
+	__u8 status[16];
+
+	/* Video Streaming interfaces */
+	struct list_head streaming;
+};
+
+enum uvc_handle_state {
+	UVC_HANDLE_PASSIVE	= 0,
+	UVC_HANDLE_ACTIVE	= 1,
+};
+
+struct uvc_fh {
+	struct uvc_video_device *device;
+	enum uvc_handle_state state;
+};
+
+struct uvc_driver {
+	struct usb_driver driver;
+
+	struct mutex open_mutex;	/* protects from open/disconnect race */
+
+	struct list_head devices;	/* struct uvc_device list */
+	struct list_head controls;	/* struct uvc_control_info list */
+	struct mutex ctrl_mutex;	/* protects controls and devices lists */
+};
+
+/* ------------------------------------------------------------------------
+ * Debugging, printing and logging
+ */
+
+#define UVC_TRACE_PROBE		(1 << 0)
+#define UVC_TRACE_DESCR		(1 << 1)
+#define UVC_TRACE_CONTROL	(1 << 2)
+#define UVC_TRACE_FORMAT	(1 << 3)
+#define UVC_TRACE_CAPTURE	(1 << 4)
+#define UVC_TRACE_CALLS		(1 << 5)
+#define UVC_TRACE_IOCTL		(1 << 6)
+#define UVC_TRACE_FRAME		(1 << 7)
+#define UVC_TRACE_SUSPEND	(1 << 8)
+#define UVC_TRACE_STATUS	(1 << 9)
+
+extern unsigned int uvc_trace_param;
+
+#define uvc_trace(flag, msg...) \
+	do { \
+		if (uvc_trace_param & flag) \
+			printk(KERN_DEBUG "uvcvideo: " msg); \
+	} while(0)
+
+#define uvc_printk(level, msg...) \
+	printk(level "uvcvideo: " msg)
+
+#define UVC_GUID_FORMAT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+#define UVC_GUID_ARGS(guid) \
+        (guid)[3],  (guid)[2],  (guid)[1],  (guid)[0], \
+        (guid)[5],  (guid)[4], \
+        (guid)[7],  (guid)[6], \
+        (guid)[8],  (guid)[9], \
+        (guid)[10], (guid)[11], (guid)[12], \
+        (guid)[13], (guid)[14], (guid)[15]
+
+/* --------------------------------------------------------------------------
+ * Internal functions.
+ */
+
+/* Core driver */
+extern struct uvc_driver uvc_driver;
+extern void uvc_delete(struct kref *kref);
+
+/* Video buffers queue management. */
+extern void uvc_queue_init(struct uvc_video_queue *queue);
+extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
+		unsigned int nbuffers, unsigned int buflength);
+extern int uvc_free_buffers(struct uvc_video_queue *queue);
+extern void uvc_query_buffer(struct uvc_buffer *buf,
+		struct v4l2_buffer *v4l2_buf);
+extern int uvc_queue_buffer(struct uvc_video_queue *queue,
+		struct v4l2_buffer *v4l2_buf);
+extern int uvc_dequeue_buffer(struct uvc_video_queue *queue,
+		struct v4l2_buffer *v4l2_buf, int nonblocking);
+extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable);
+extern void uvc_queue_cancel(struct uvc_video_queue *queue);
+extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
+		struct uvc_buffer *buf);
+
+/* V4L2 interface */
+extern struct file_operations uvc_fops;
+
+/* Video */
+extern int uvc_video_init(struct uvc_video_device *video);
+extern int uvc_video_suspend(struct uvc_video_device *video);
+extern int uvc_video_resume(struct uvc_video_device *video);
+extern int uvc_video_enable(struct uvc_video_device *video, int enable);
+extern int uvc_probe_video(struct uvc_video_device *video,
+		struct uvc_streaming_control *probe);
+extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,
+		__u8 intfnum, __u8 cs, void *data, __u16 size);
+extern int uvc_set_video_ctrl(struct uvc_video_device *video,
+		struct uvc_streaming_control *ctrl, int probe);
+
+/* Status */
+extern int uvc_status_init(struct uvc_device *dev);
+extern void uvc_status_cleanup(struct uvc_device *dev);
+extern int uvc_status_suspend(struct uvc_device *dev);
+extern int uvc_status_resume(struct uvc_device *dev);
+
+/* Controls */
+extern struct uvc_control *uvc_find_control(struct uvc_video_device *video,
+		__u32 v4l2_id, struct uvc_control_mapping **mapping);
+extern int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
+		struct v4l2_queryctrl *v4l2_ctrl);
+
+extern int uvc_ctrl_add_info(struct uvc_control_info *info);
+extern int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping);
+extern int uvc_ctrl_init_device(struct uvc_device *dev);
+extern void uvc_ctrl_cleanup_device(struct uvc_device *dev);
+extern int uvc_ctrl_resume_device(struct uvc_device *dev);
+extern void uvc_ctrl_init(void);
+
+extern int uvc_ctrl_begin(struct uvc_video_device *video);
+extern int __uvc_ctrl_commit(struct uvc_video_device *video, int rollback);
+static inline int uvc_ctrl_commit(struct uvc_video_device *video)
+{
+	return __uvc_ctrl_commit(video, 0);
+}
+static inline int uvc_ctrl_rollback(struct uvc_video_device *video)
+{
+	return __uvc_ctrl_commit(video, 1);
+}
+
+extern int uvc_ctrl_get(struct uvc_video_device *video,
+		struct v4l2_ext_control *xctrl);
+extern int uvc_ctrl_set(struct uvc_video_device *video,
+		struct v4l2_ext_control *xctrl);
+
+extern int uvc_xu_ctrl_query(struct uvc_video_device *video,
+		struct uvc_xu_control *ctrl, int set);
+
+/* Utility functions */
+extern void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
+		unsigned int n_terms, unsigned int threshold);
+extern uint32_t uvc_fraction_to_interval(uint32_t numerator,
+		uint32_t denominator);
+extern struct usb_host_endpoint *uvc_find_endpoint(
+		struct usb_host_interface *alts, __u8 epaddr);
+
+/* Quirks support */
+void uvc_video_decode_isight (struct urb *urb, struct uvc_video_device *video, 
+		struct uvc_buffer *buf);
+
+#endif /* __KERNEL__ */
+
+#endif
+

linux-2.6-wireless-pending.patch:

--- NEW FILE linux-2.6-wireless-pending.patch ---
commit 1649f279a01d5623c5ab048dea69654c13b87dd9
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:55:21 2008 +0100

    rt2x00: Fix queue index handling
    
    When Q_INDEX is increased, the queue->length should be increased,
    only when Q_INDEX_DONE is increased should queue_length be descreased.
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 49dc7bf4c18be97f49e5d84804e2a210294f2ebc
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:54:57 2008 +0100

    rt2x00: Move beacon and atim queue defines into rt2x00
    
    As Johannes Berg indicated the BEACON and AFTER_BEACON
    queue indeces in mac80211 should be removed because they
    are too hardware specific. This patch adds the queue index
    defines into rt2x00queue.h and removes the dependency of
    the defines inside mac80211.h.
    
    Also move rt2x00pci_beacon_update() into rt2400pci and
    rt2500pci individually since it is no longer a generic
    function since rt61 and rt2800 no longer use that.
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 00bb22220f6e648a50faa755e7c6673d6c98f283
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:52:21 2008 +0100

    rt2x00: Initialize QID from queue->qid
    
    The QID_MGMT is assigned to the beacon and atim queue
    during initialization. This means we don't need a seperate
    check in write_tx_desc()..
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit ac70a432ade9dc1943a5fc6887477942ef2c297f
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:51:47 2008 +0100

    rt2x00: Remove TX_MGMT queue usage
    
    rt73usb doesn't have a 5th queue, correctly initialize hw->queues
    rt61pci had a 5th queue but was removed recently, correctly initialize
    hw->queues and remove the last remnants.
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 5a6bd1bd947056843e39693322586c11b88301ef
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:49:59 2008 +0100

    rt2x00: Add per-interface structure
    
    Rework the interface handling. Delete the interface structure
    and replace it with a per-interface structure. This changes the
    way rt2x00 handles the active interface drastically.
    
    Copy ieee80211_bss_conf to the this rt2x00_intf structure during
    the bss_info_changed() callback function. This will allow us to
    reference it later, and removes the requirement for the device flag
    SHORT_PREAMBLE flag which is interface specific.
    
    Drivers receive the option to give the maximum number of virtual
    interfaces the device can handle. Virtual interface support:
    rt2400pci: 1 sta or 1 ap, * monitor interfaces
    rt2500pci: 1 sta or 1 ap, * monitor interfaces
    rt2500usb: 1 sta or 1 ap, * monitor interfaces
    rt61pci: 1 sta or 4 ap, * monitor interfaces
    rt73usb: 1 sta or 4 ap, * monitor interfaces
    
    At the moment none of the drivers support AP and STA interfaces
    simultaneously, this is a hardware limitation so future support
    will be very unlikely.
    
    Each interface structure receives its dedicated beacon entry,
    with this we can easily work with beaconing while multiple master
    mode interfaces are currently active.
    
    The configuration handlers for the MAC, BSSID and type are
    often called together since they all belong to the interface
    configuration. Merge the 3 configuration calls and cleanup
    the API between rt2x00lib and the drivers. While we are cleaning
    up the interface configuration anyway, we might as well clean up
    the configuration handler as well.
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 45df21472750a43c3430aced2976dd664e2f9db9
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:48:38 2008 +0100

    rt2x00: Driver requiring firmware should select crc algo
    
    The driver should select what CRC algorithm is required
    when performing a checksum on the firmware.
    
    rt61pci & rt73usb require crc-itu-t
    rt2800pci & rt2800usb require crc-ccitt
    
    Legacy 2800pci/usb driver uses crc-itu-t + bit order reversion,
    but that is just inefficient especially since the end result is
    the same as a different algorithm which is also available as library. ;)
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit a9ccef5ab4a89d5d8ff1a34273345b778ed3ce0e
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:48:03 2008 +0100

    rt2x00: Enable master and adhoc mode again
    
    This will enable the creation of master mode and adhoc
    interfaces again. This does not mean the issues surrounding
    beaconing have been resolved, but this will make testing
    easier and perhaps we can discover which cards are actually
    working and which ones not.
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 044eab1f0336a45c54b4968c5d1e2897bb138269
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:47:30 2008 +0100

    rt2x00: Fix tx parameter initialization
    
    Check if the aifs, cw_min and cw_max are above 0
    when determining if the default should be used.
    Tor aifs a negative number is used to determine
    if the default should be used or not.
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit b39069b5bb4ed12838a80b33f6b04e376744deac
Author: Ivo van Doorn <ivdoorn at gmail.com>
Date:   Sun Feb 3 15:47:02 2008 +0100

    rt2x00: Add new USB ID to rt2500usb
    
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 0ea32c0eed26d17d7a4c8da6b2b30b64cade906a
Author: Adam Baker <linux at baker-net.org.uk>
Date:   Sun Feb 3 15:46:24 2008 +0100

    rt2x00: don't write past the end when writing short descriptors on rt61
    
    The space allocated in the skb for a descriptor is only 24 bytes when
    setting up beacons in rt61 so make sure we don't write to the descriptor
    words beyond that and corrupt the beacon packet.
    
    Signed-off-by: Adam Baker <linux at baker-net.org.uk>
    Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

commit 412f0889afb95408fb53a4b754c6a69e609dc2c5
Author: John W. Linville <linville at tuxdriver.com>
Date:   Tue Feb 5 16:42:23 2008 -0500

    rt2x00: Queue handling overhaul
    
    This introduces a big queue handling overhaul, this also
    renames "ring" to "queues".
    
    Move queue handling into rt2x00queue.c and the matching header,
    use Kerneldoc to improve rt2x00 library documentation.
    
    Access to the queues is now protected under a spinlock, this
    to prevent race conditions which could corrupt the indexing
    system of the queue.
    
    Each queue entry allocates x bytes for driver/device specific data,
    this cleans up the queue structure significantly and improves
    code readability.
    
    rt2500usb no longer needs 2 entries in the beacon queue to correctly
    send out the guardian byte. This is now handled in the entry specific
    structure.
    
    rt61 and rt73 now use the correct descriptor size for beacon frames,
    since this data is written into the registers not the entire TXD
    descriptor was used but instead of a subset of it named TXINFO.
    
    Finally this also fixes numerous other bugs related to incorrect
    beacon handling or beacon related code.
[...11545 lines suppressed...]
 
 	rt2x00_desc_read(rxd, 0, &word0);
 	rt2x00_desc_read(rxd, 1, &word1);
 
-	desc->flags = 0;
+	rxdesc->flags = 0;
 	if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR))
-		desc->flags |= RX_FLAG_FAILED_FCS_CRC;
+		rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC;
 
 	/*
 	 * Obtain the status about this packet.
 	 */
-	desc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
-	desc->rssi = rt73usb_agc_to_rssi(entry->ring->rt2x00dev, word1);
-	desc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
-	desc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
-	desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
+	rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
+	rxdesc->rssi = rt73usb_agc_to_rssi(entry->queue->rt2x00dev, word1);
+	rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
+	rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
+	rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
+
+	/*
+	 * The data behind the ieee80211 header must be
+	 * aligned on a 4 byte boundary.
+	 */
+	if (header_size % 4 == 0) {
+		skb_push(entry->skb, 2);
+		memmove(entry->skb->data, entry->skb->data + 2,
+			entry->skb->len - 2);
+	}
 
 	/*
 	 * Set descriptor and data pointer.
 	 */
+	skbdesc->data = entry->skb->data + entry->queue->desc_size;
+	skbdesc->data_len = entry->queue->data_size;
 	skbdesc->desc = entry->skb->data;
-	skbdesc->desc_len = entry->ring->desc_size;
-	skbdesc->data = entry->skb->data + entry->ring->desc_size;
-	skbdesc->data_len = desc->size;
+	skbdesc->desc_len = entry->queue->desc_size;
+
+	/*
+	 * Remove descriptor from skb buffer and trim the whole thing
+	 * down to only contain data.
+	 */
+	skb_pull(entry->skb, skbdesc->desc_len);
+	skb_trim(entry->skb, rxdesc->size);
 }
 
 /*
@@ -1755,7 +1792,7 @@ static void rt73usb_probe_hw_mode(struct
 	rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
 	rt2x00dev->hw->max_signal = MAX_SIGNAL;
 	rt2x00dev->hw->max_rssi = MAX_RX_SSI;
-	rt2x00dev->hw->queues = 5;
+	rt2x00dev->hw->queues = 4;
 
 	SET_IEEE80211_DEV(rt2x00dev->hw, &rt2x00dev_usb(rt2x00dev)->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -1825,9 +1862,10 @@ static int rt73usb_probe_hw(struct rt2x0
 	rt73usb_probe_hw_mode(rt2x00dev);
 
 	/*
-	 * This device requires firmware
+	 * This device requires firmware.
 	 */
 	__set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags);
+	__set_bit(DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, &rt2x00dev->flags);
 
 	/*
 	 * Set the rssi offset.
@@ -1960,52 +1998,52 @@ static void rt73usb_reset_tsf(struct iee
 }
 
 static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
-			  struct ieee80211_tx_control *control)
+				 struct ieee80211_tx_control *control)
 {
 	struct rt2x00_dev *rt2x00dev = hw->priv;
-	struct skb_desc *desc;
-	struct data_ring *ring;
-	struct data_entry *entry;
-	int timeout;
+	struct rt2x00_intf *intf = vif_to_intf(control->vif);
+	struct skb_frame_desc *skbdesc;
+	unsigned int beacon_base;
+	unsigned int timeout;
 
-	/*
-	 * Just in case the ieee80211 doesn't set this,
-	 * but we need this queue set for the descriptor
-	 * initialization.
-	 */
-	control->queue = IEEE80211_TX_QUEUE_BEACON;
-	ring = rt2x00lib_get_ring(rt2x00dev, control->queue);
-	entry = rt2x00_get_data_entry(ring);
+	if (unlikely(!intf->beacon))
+		return -ENOBUFS;
 
 	/*
 	 * Add the descriptor in front of the skb.
 	 */
-	skb_push(skb, ring->desc_size);
-	memset(skb->data, 0, ring->desc_size);
+	skb_push(skb, intf->beacon->queue->desc_size);
+	memset(skb->data, 0, intf->beacon->queue->desc_size);
 
 	/*
 	 * Fill in skb descriptor
 	 */
-	desc = get_skb_desc(skb);
-	desc->desc_len = ring->desc_size;
-	desc->data_len = skb->len - ring->desc_size;
-	desc->desc = skb->data;
-	desc->data = skb->data + ring->desc_size;
-	desc->ring = ring;
-	desc->entry = entry;
+	skbdesc = get_skb_frame_desc(skb);
+	memset(skbdesc, 0, sizeof(*skbdesc));
+	skbdesc->data = skb->data + intf->beacon->queue->desc_size;
+	skbdesc->data_len = skb->len - intf->beacon->queue->desc_size;
+	skbdesc->desc = skb->data;
+	skbdesc->desc_len = intf->beacon->queue->desc_size;
+	skbdesc->entry = intf->beacon;
 
+	/*
+	 * mac80211 doesn't provide the control->queue variable
+	 * for beacons. Set our own queue identification so
+	 * it can be used during descriptor initialization.
+	 */
+	control->queue = RT2X00_BCN_QUEUE_BEACON;
 	rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
 
 	/*
 	 * Write entire beacon with descriptor to register,
 	 * and kick the beacon generator.
 	 */
+	beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx);
 	timeout = REGISTER_TIMEOUT * (skb->len / sizeof(u32));
 	rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE,
-				 USB_VENDOR_REQUEST_OUT,
-				 HW_BEACON_BASE0, 0x0000,
+				 USB_VENDOR_REQUEST_OUT, beacon_base, 0,
 				 skb->data, skb->len, timeout);
-	rt73usb_kick_tx_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON);
+	rt73usb_kick_tx_queue(rt2x00dev, control->queue);
 
 	return 0;
 }
@@ -2046,19 +2084,41 @@ static const struct rt2x00lib_ops rt73us
 	.get_tx_data_len	= rt73usb_get_tx_data_len,
 	.kick_tx_queue		= rt73usb_kick_tx_queue,
 	.fill_rxdone		= rt73usb_fill_rxdone,
-	.config_mac_addr	= rt73usb_config_mac_addr,
-	.config_bssid		= rt73usb_config_bssid,
-	.config_type		= rt73usb_config_type,
+	.config_intf		= rt73usb_config_intf,
 	.config_preamble	= rt73usb_config_preamble,
 	.config			= rt73usb_config,
 };
 
+static const struct data_queue_desc rt73usb_queue_rx = {
+	.entry_num		= RX_ENTRIES,
+	.data_size		= DATA_FRAME_SIZE,
+	.desc_size		= RXD_DESC_SIZE,
+	.priv_size		= sizeof(struct queue_entry_priv_usb_rx),
+};
+
+static const struct data_queue_desc rt73usb_queue_tx = {
+	.entry_num		= TX_ENTRIES,
+	.data_size		= DATA_FRAME_SIZE,
+	.desc_size		= TXD_DESC_SIZE,
+	.priv_size		= sizeof(struct queue_entry_priv_usb_tx),
+};
+
+static const struct data_queue_desc rt73usb_queue_bcn = {
+	.entry_num		= 4 * BEACON_ENTRIES,
+	.data_size		= MGMT_FRAME_SIZE,
+	.desc_size		= TXINFO_SIZE,
+	.priv_size		= sizeof(struct queue_entry_priv_usb_tx),
+};
+
 static const struct rt2x00_ops rt73usb_ops = {
 	.name		= KBUILD_MODNAME,
-	.rxd_size	= RXD_DESC_SIZE,
-	.txd_size	= TXD_DESC_SIZE,
+	.max_sta_intf	= 1,
+	.max_ap_intf	= 4,
 	.eeprom_size	= EEPROM_SIZE,
 	.rf_size	= RF_SIZE,
+	.rx		= &rt73usb_queue_rx,
+	.tx		= &rt73usb_queue_tx,
+	.bcn		= &rt73usb_queue_bcn,
 	.lib		= &rt73usb_rt2x00_ops,
 	.hw		= &rt73usb_mac80211_ops,
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS

linux-2.6-x86-debug-boot.patch:

--- NEW FILE linux-2.6-x86-debug-boot.patch ---
---
 arch/i386/boot/main.c |   12 ++++++++++++
 arch/i386/boot/pm.c   |    8 ++++++++
 2 files changed, 20 insertions(+)

--- linux-2.6.22.noarch.orig/arch/i386/boot/main.c
+++ linux-2.6.22.noarch/arch/i386/boot/main.c
@@ -105,6 +105,7 @@ static void set_bios_mode(void)
 void main(void)
 {
 	/* First, copy the boot header into the "zeropage" */
+	puts("Booting: ");
 	copy_boot_params();
 
 	/* End of heap check */
@@ -118,6 +119,7 @@ void main(void)
 	}
 
 	/* Make sure we have all the proper CPU support */
+	putchar('A');
 	if (validate_cpu()) {
 		puts("Unable to boot - please use a kernel appropriate "
 		     "for your CPU.\n");
@@ -125,37 +127,47 @@ void main(void)
 	}
 
 	/* Tell the BIOS what CPU mode we intend to run in. */
+	putchar('B');
 	set_bios_mode();
 
 	/* Detect memory layout */
+	putchar('C');
 	detect_memory();
 
 	/* Set keyboard repeat rate (why?) */
+	putchar('D');
 	keyboard_set_repeat();
 
 	/* Set the video mode */
+	putchar('E');
 	set_video();
 
 	/* Query MCA information */
+	putchar('F');
 	query_mca();
 
 	/* Voyager */
 #ifdef CONFIG_X86_VOYAGER
+	putchar('G');
 	query_voyager();
 #endif
 
+	putchar('H');
 	/* Query Intel SpeedStep (IST) information */
 	query_ist();
 
 	/* Query APM information */
 #if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
+	putchar('I');
 	query_apm_bios();
 #endif
 
 	/* Query EDD information */
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
+	putchar('J');
 	query_edd();
 #endif
 	/* Do the last things and invoke protected mode */
+	putchar('K');
 	go_to_protected_mode();
 }
--- linux-2.6.22.noarch.orig/arch/i386/boot/pm.c
+++ linux-2.6.22.noarch/arch/i386/boot/pm.c
@@ -145,24 +145,30 @@ static void setup_idt(void)
 void go_to_protected_mode(void)
 {
 	/* Hook before leaving real mode, also disables interrupts */
+	putchar('L');
 	realmode_switch_hook();
 
 	/* Move the kernel/setup to their final resting places */
+	putchar('M');
 	move_kernel_around();
 
 	/* Enable the A20 gate */
+	putchar('N');
 	if (enable_a20()) {
 		puts("A20 gate not responding, unable to boot...\n");
 		die();
 	}
 
 	/* Reset coprocessor (IGNNE#) */
+	putchar('O');
 	reset_coprocessor();
 
 	/* Mask all interrupts in the PIC */
+	putchar('P');
 	mask_all_interrupts();
 
 	/* Actual transition to protected mode... */
+	puts("Q\n");
 	setup_idt();
 	setup_gdt();
 	protected_mode_jump(boot_params.hdr.code32_start,

linux-2.6-xfs-optimize-away-realtime-tests.patch:

--- NEW FILE linux-2.6-xfs-optimize-away-realtime-tests.patch ---
Use XFS_IS_REALTIME_INODE in more places, and #define it to
0 if CONFIG_XFS_RT is off.  This should be safe because mount
checks in xfs_rtmount_init:

# define xfs_rtmount_init(m)    (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))

so if we get mounted w/o CONFIG_XFS_RT, no realtime inodes should
be encountered after that.

Defining XFS_IS_REALTIME_INODE to 0 saves a bit of stack space,
presumeably gcc can optimize around the various "if (0)" type
checks:

xfs_alloc_file_space	-8
xfs_bmap_adjacent	-16
xfs_bmapi		-8
xfs_bmap_rtalloc	-16
xfs_bunmapi		-28
xfs_free_file_space	-64
xfs_imap		+8  <-- ?  hmm.
xfs_iomap_write_direct	-12
xfs_qm_dqusage_adjust	-4
xfs_qm_vop_chown_reserve -4

Compile tested only at this point.

Signed-off-by: Eric Sandeen <sandeen at sandeen.net>

Index: linux-2.6.22.i386/fs/xfs/xfs_rtalloc.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_rtalloc.h
+++ linux-2.6.22.i386/fs/xfs/xfs_rtalloc.h
@@ -21,8 +21,6 @@
 struct xfs_mount;
 struct xfs_trans;
 
-#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
-
 /* Min and max rt extent sizes, specified in bytes */
 #define	XFS_MAX_RTEXTSIZE	(1024 * 1024 * 1024)	/* 1GB */
 #define	XFS_DFL_RTEXTSIZE	(64 * 1024)	        /* 64KB */
Index: linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_ioctl.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/linux-2.6/xfs_ioctl.c
+++ linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -736,7 +736,7 @@ xfs_ioctl(
 	case XFS_IOC_DIOINFO: {
 		struct dioattr	da;
 		xfs_buftarg_t	*target =
-			(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
+			XFS_IS_REALTIME_INODE(ip) ?
 			mp->m_rtdev_targp : mp->m_ddev_targp;
 
 		da.d_mem = da.d_miniosz = 1 << target->bt_sshift;
Index: linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_lrw.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/linux-2.6/xfs_lrw.c
+++ linux-2.6.22.i386/fs/xfs/linux-2.6/xfs_lrw.c
@@ -220,7 +220,7 @@ xfs_read(
 
 	if (unlikely(ioflags & IO_ISDIRECT)) {
 		xfs_buftarg_t	*target =
-			(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
+			XFS_IS_REALTIME_INODE(ip) ?
 				mp->m_rtdev_targp : mp->m_ddev_targp;
 		if ((*offset & target->bt_smask) ||
 		    (size & target->bt_smask)) {
@@ -694,7 +694,7 @@ start:
 
 	if (ioflags & IO_ISDIRECT) {
 		xfs_buftarg_t	*target =
-			(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
+			XFS_IS_REALTIME_INODE(xip) ?
 				mp->m_rtdev_targp : mp->m_ddev_targp;
 
 		if ((pos & target->bt_smask) || (count & target->bt_smask)) {
Index: linux-2.6.22.i386/fs/xfs/xfs_dfrag.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_dfrag.c
+++ linux-2.6.22.i386/fs/xfs/xfs_dfrag.c
@@ -184,8 +184,7 @@ xfs_swap_extents(
 	}
 
 	/* Verify both files are either real-time or non-realtime */
-	if ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) !=
-	    (tip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
+	if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) {
 		error = XFS_ERROR(EINVAL);
 		goto error0;
 	}
Index: linux-2.6.22.i386/fs/xfs/xfs_iocore.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_iocore.c
+++ linux-2.6.22.i386/fs/xfs/xfs_iocore.c
@@ -94,7 +94,7 @@ xfs_iocore_inode_reinit(
 	xfs_iocore_t	*io = &ip->i_iocore;
 
 	io->io_flags = 0;
-	if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
+	if (XFS_IS_REALTIME_INODE(ip))
 		io->io_flags |= XFS_IOCORE_RT;
 	io->io_dmevmask = ip->i_d.di_dmevmask;
 	io->io_dmstate = ip->i_d.di_dmstate;
Index: linux-2.6.22.i386/fs/xfs/xfs_rw.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_rw.h
+++ linux-2.6.22.i386/fs/xfs/xfs_rw.h
@@ -58,7 +58,7 @@ struct xfs_mount;
 static inline xfs_daddr_t
 xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
 {
-	return (((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME) ? \
+	return (XFS_IS_REALTIME_INODE(ip) ? \
 		 (xfs_daddr_t)XFS_FSB_TO_BB((ip)->i_mount, (fsb)) : \
 		 XFS_FSB_TO_DADDR((ip)->i_mount, (fsb)));
 }
@@ -87,7 +87,7 @@ xfs_get_extsz_hint(
 {
 	xfs_extlen_t	extsz;
 
-	if (unlikely(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
+	if (unlikely(XFS_IS_REALTIME_INODE(ip))) {
 		extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
 				? ip->i_d.di_extsize
 				: ip->i_mount->m_sb.sb_rextsize;
Index: linux-2.6.22.i386/fs/xfs/xfs_vnodeops.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_vnodeops.c
+++ linux-2.6.22.i386/fs/xfs/xfs_vnodeops.c
@@ -144,7 +144,7 @@ xfs_getattr(
 	default:
 		vap->va_rdev = 0;
 
-		if (!(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
+		if (!(XFS_IS_REALTIME_INODE(ip))) {
 			vap->va_blocksize = xfs_preferred_iosize(mp);
 		} else {
 
@@ -521,7 +521,7 @@ xfs_setattr(
 		 */
 		if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
 		    (mask & XFS_AT_XFLAGS) &&
-		    (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) !=
+		    (XFS_IS_REALTIME_INODE(ip)) !=
 		    (vap->va_xflags & XFS_XFLAG_REALTIME)) {
 			code = XFS_ERROR(EINVAL);	/* EFBIG? */
 			goto error_return;
@@ -533,7 +533,7 @@ xfs_setattr(
 		if ((mask & XFS_AT_EXTSIZE) && vap->va_extsize != 0) {
 			xfs_extlen_t	size;
 
-			if ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ||
+			if (XFS_IS_REALTIME_INODE(ip) ||
 			    ((mask & XFS_AT_XFLAGS) &&
 			    (vap->va_xflags & XFS_XFLAG_REALTIME))) {
 				size = mp->m_sb.sb_rextsize <<
@@ -1188,7 +1188,7 @@ xfs_fsync(
 		 * If this inode is on the RT dev we need to flush that
 		 * cache as well.
 		 */
-		if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
+		if (XFS_IS_REALTIME_INODE(ip))
 			xfs_blkdev_issue_flush(ip->i_mount->m_rtdev_targp);
 	}
 
@@ -4263,7 +4263,7 @@ xfs_zero_remaining_bytes(
 	int			error = 0;
 
 	bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize,
-				ip->i_d.di_flags & XFS_DIFLAG_REALTIME ?
+				XFS_IS_REALTIME_INODE(ip) ?
 				mp->m_rtdev_targp : mp->m_ddev_targp);
 
 	for (offset = startoff; offset <= endoff; offset = lastoffset + 1) {
@@ -4360,7 +4360,7 @@ xfs_free_file_space(
 	error = 0;
 	if (len <= 0)	/* if nothing being freed */
 		return error;
-	rt = (ip->i_d.di_flags & XFS_DIFLAG_REALTIME);
+	rt = XFS_IS_REALTIME_INODE(ip);
 	startoffset_fsb	= XFS_B_TO_FSB(mp, offset);
 	end_dmi_offset = offset + len;
 	endoffset_fsb = XFS_B_TO_FSBT(mp, end_dmi_offset);
Index: linux-2.6.22.i386/fs/xfs/xfs_dinode.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_dinode.h
+++ linux-2.6.22.i386/fs/xfs/xfs_dinode.h
@@ -274,6 +274,12 @@ typedef enum xfs_dinode_fmt
 #define XFS_DIFLAG_NODEFRAG      (1 << XFS_DIFLAG_NODEFRAG_BIT)
 #define XFS_DIFLAG_FILESTREAM    (1 << XFS_DIFLAG_FILESTREAM_BIT)
 
+#ifdef CONFIG_XFS_RT
+#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
+#else
+#define XFS_IS_REALTIME_INODE(ip) (0)
+#endif
+
 #define XFS_DIFLAG_ANY \
 	(XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
 	 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
Index: linux-2.6.22.i386/fs/xfs/xfs_bmap.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_bmap.c
+++ linux-2.6.22.i386/fs/xfs/xfs_bmap.c
@@ -2969,7 +2969,7 @@ STATIC int
 xfs_bmap_alloc(
 	xfs_bmalloca_t	*ap)		/* bmap alloc argument struct */
 {
-	if ((ap->ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && ap->userdata)
+	if (XFS_IS_REALTIME_INODE(ap->ip) && ap->userdata)
 		return xfs_bmap_rtalloc(ap);
 	return xfs_bmap_btalloc(ap);
 }
@@ -3097,7 +3097,7 @@ xfs_bmap_del_extent(
 		 * Realtime allocation.  Free it and record di_nblocks update.
 		 */
 		if (whichfork == XFS_DATA_FORK &&
-		    (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
+		    XFS_IS_REALTIME_INODE(ip)) {
 			xfs_fsblock_t	bno;
 			xfs_filblks_t	len;
 
Index: linux-2.6.22.i386/fs/xfs/xfs_bmap_btree.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_bmap_btree.c
+++ linux-2.6.22.i386/fs/xfs/xfs_bmap_btree.c
@@ -2062,8 +2062,7 @@ xfs_bmbt_insert(
 				pcur->bc_private.b.allocated;
 			pcur->bc_private.b.allocated = 0;
 			ASSERT((cur->bc_private.b.firstblock != NULLFSBLOCK) ||
-			       (cur->bc_private.b.ip->i_d.di_flags &
-				XFS_DIFLAG_REALTIME));
+			       XFS_IS_REALTIME_INODE(cur->bc_private.b.ip));
 			cur->bc_private.b.firstblock =
 				pcur->bc_private.b.firstblock;
 			ASSERT(cur->bc_private.b.flist ==

linux-2.6-xfs-setfattr-32bit-compat.patch:

--- NEW FILE linux-2.6-xfs-setfattr-32bit-compat.patch ---
Date: Mon, 17 Sep 2007 12:36:02 -0500
From: Eric Sandeen <sandeen at sandeen.net>
To: Eric Sandeen <sandeen at sandeen.net>
CC: xfs-oss <xfs at oss.sgi.com>
Subject: [PATCH V2] fix 32-bit compat ioctls for GETXFLAGS, SETXFLAGS, GETVERSION

In Red Hat bugzilla #291981, Sami Farin notes that 32-bit-compat
lsattr/chattr does not work on xfs.  After investigation, I found:

XFS_IOC_GETVERSION, XFS_IOC_GETXFLAGS and XFS_IOC_SETXFLAGS all
take a "long" which changes size between 32 and 64 bit platforms.

So, the ioctl cmds that come in from a 32-bit app aren't as expected, 
for example on GETXFLAGS,

	unknown cmd fd(3) cmd(80046601){t:'f';sz:4}

due to the size mismatch.

So, use instead the 32-bit version of the commands for compat ioctls,
and other than that it doesn't take any more manipulation.

Also, for both native and compat versions, just define them to
the values as defined in fs.h

Signed-off-by: Eric Sandeen <sandeen at sandeen.net>

Index: linux-2.6.22/fs/xfs/linux-2.6/xfs_ioctl32.c
===================================================================
--- linux-2.6.22.orig/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ linux-2.6.22/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -376,9 +376,6 @@ xfs_compat_ioctl(
 	switch (cmd) {
 	case XFS_IOC_DIOINFO:
 	case XFS_IOC_FSGEOMETRY:
-	case XFS_IOC_GETVERSION:
-	case XFS_IOC_GETXFLAGS:
-	case XFS_IOC_SETXFLAGS:
 	case XFS_IOC_FSGETXATTR:
 	case XFS_IOC_FSSETXATTR:
 	case XFS_IOC_FSGETXATTRA:
@@ -404,6 +401,11 @@ xfs_compat_ioctl(
 	case XFS_IOC_ERROR_CLEARALL:
 		break;
 
+	case XFS_IOC32_GETXFLAGS:
+	case XFS_IOC32_SETXFLAGS:
+	case XFS_IOC32_GETVERSION:
+		cmd = _NATIVE_IOC(cmd, long);
+		break;
 #ifdef BROKEN_X86_ALIGNMENT
 	/* xfs_flock_t has wrong u32 vs u64 alignment */
 	case XFS_IOC_ALLOCSP_32:
Index: linux-2.6.22/fs/xfs/xfs_fs.h
===================================================================
--- linux-2.6.22.orig/fs/xfs/xfs_fs.h
+++ linux-2.6.22/fs/xfs/xfs_fs.h
@@ -436,9 +436,13 @@ typedef struct xfs_handle {
 /*
  * ioctl commands that are used by Linux filesystems
  */
-#define XFS_IOC_GETXFLAGS	_IOR('f', 1, long)
-#define XFS_IOC_SETXFLAGS	_IOW('f', 2, long)
-#define XFS_IOC_GETVERSION	_IOR('v', 1, long)
+#define XFS_IOC_GETXFLAGS	FS_IOC_GETFLAGS
+#define XFS_IOC_SETXFLAGS	FS_IOC_SETFLAGS
+#define XFS_IOC_GETVERSION	FS_IOC_GETVERSION
+/* 32-bit compat counterparts */
+#define XFS_IOC32_GETXFLAGS	FS_IOC32_GETFLAGS
+#define XFS_IOC32_SETXFLAGS	FS_IOC32_SETFLAGS
+#define XFS_IOC32_GETVERSION	FS_IOC32_GETVERSION
 
 /*

  * ioctl commands that replace IRIX fcntl()'s





linux-2.6-xfs-xfs_mount-refactor.patch:

--- NEW FILE linux-2.6-xfs-xfs_mount-refactor.patch ---
Refactoring xfs_mountfs() to call sub-functions for logical
chunks can help save a bit of stack, and can make it easier to
read this long function.

The mount path is one of the longest common callchains, easily
getting to within a few bytes of the end of a 4k stack when
over lvm, quotas are enabled, and quotacheck must be done.

With this change on top of the other stack-related changes
I've sent, I can get xfs to survive a normal xfsqa run on
4k stacks over lvm.

Signed-off-by: Eric Sandeen <sandeen at sandeen.net>

Index: linux-2.6.24.noarch/fs/xfs/xfs_mount.c
===================================================================
--- linux-2.6.24.noarch.orig/fs/xfs/xfs_mount.c
+++ linux-2.6.24.noarch/fs/xfs/xfs_mount.c
@@ -734,49 +734,13 @@ xfs_initialize_perag_data(xfs_mount_t *m
 }
 
 /*
- * xfs_mountfs
- *
- * This function does the following on an initial mount of a file system:
- *	- reads the superblock from disk and init the mount struct
- *	- if we're a 32-bit kernel, do a size check on the superblock
- *		so we don't mount terabyte filesystems
- *	- init mount struct realtime fields
- *	- allocate inode hash table for fs
- *	- init directory manager
- *	- perform recovery and init the log manager
+ * Update alignment values based on mount options and sb values
  */
-int
-xfs_mountfs(
-	xfs_mount_t	*mp,
-	int		mfsi_flags)
+STATIC int
+xfs_update_alignment(xfs_mount_t *mp, int mfsi_flags, __uint64_t *update_flags)
 {
-	xfs_buf_t	*bp;
 	xfs_sb_t	*sbp = &(mp->m_sb);
-	xfs_inode_t	*rip;
-	bhv_vnode_t	*rvp = NULL;
-	int		readio_log, writeio_log;
-	xfs_daddr_t	d;
-	__uint64_t	resblks;
-	__int64_t	update_flags;
-	uint		quotamount, quotaflags;
-	int		agno;
-	int		uuid_mounted = 0;
-	int		error = 0;
 
-	if (mp->m_sb_bp == NULL) {
-		if ((error = xfs_readsb(mp, mfsi_flags))) {
-			return error;
-		}
-	}
-	xfs_mount_common(mp, sbp);
-
-	/*
-	 * Check if sb_agblocks is aligned at stripe boundary
-	 * If sb_agblocks is NOT aligned turn off m_dalign since
-	 * allocator alignment is within an ag, therefore ag has
-	 * to be aligned at stripe boundary.
-	 */
-	update_flags = 0LL;
 	if (mp->m_dalign && !(mfsi_flags & XFS_MFSI_SECOND)) {
 		/*
 		 * If stripe unit and stripe width are not multiples
@@ -787,8 +751,7 @@ xfs_mountfs(
 			if (mp->m_flags & XFS_MOUNT_RETERR) {
 				cmn_err(CE_WARN,
 					"XFS: alignment check 1 failed");
-				error = XFS_ERROR(EINVAL);
-				goto error1;
+				return XFS_ERROR(EINVAL);
 			}
 			mp->m_dalign = mp->m_swidth = 0;
 		} else {
@@ -798,8 +761,7 @@ xfs_mountfs(
 			mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
 			if (mp->m_dalign && (sbp->sb_agblocks % mp->m_dalign)) {
 				if (mp->m_flags & XFS_MOUNT_RETERR) {
-					error = XFS_ERROR(EINVAL);
-					goto error1;
+					return XFS_ERROR(EINVAL);
 				}
 				xfs_fs_cmn_err(CE_WARN, mp,
 "stripe alignment turned off: sunit(%d)/swidth(%d) incompatible with agsize(%d)",
@@ -816,8 +778,7 @@ xfs_mountfs(
 "stripe alignment turned off: sunit(%d) less than bsize(%d)",
                                         	mp->m_dalign,
 						mp->m_blockmask +1);
-					error = XFS_ERROR(EINVAL);
-					goto error1;
+					return XFS_ERROR(EINVAL);
 				}
 				mp->m_swidth = 0;
 			}
@@ -830,11 +791,11 @@ xfs_mountfs(
 		if (XFS_SB_VERSION_HASDALIGN(sbp)) {
 			if (sbp->sb_unit != mp->m_dalign) {
 				sbp->sb_unit = mp->m_dalign;
-				update_flags |= XFS_SB_UNIT;
+				*update_flags |= XFS_SB_UNIT;
 			}
 			if (sbp->sb_width != mp->m_swidth) {
 				sbp->sb_width = mp->m_swidth;
-				update_flags |= XFS_SB_WIDTH;
+				*update_flags |= XFS_SB_WIDTH;
 			}
 		}
 	} else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
@@ -843,49 +804,45 @@ xfs_mountfs(
 			mp->m_swidth = sbp->sb_width;
 	}
 
-	xfs_alloc_compute_maxlevels(mp);
-	xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK);
-	xfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK);
-	xfs_ialloc_compute_maxlevels(mp);
+	return 0;
+}
 
-	if (sbp->sb_imax_pct) {
-		__uint64_t	icount;
+/*
+ * Set the maximum inode count for this filesystem
+ */
+STATIC void
+xfs_set_maxicount(xfs_mount_t *mp)
+{
+	xfs_sb_t	*sbp = &(mp->m_sb);
+	__uint64_t	icount;
 
-		/* Make sure the maximum inode count is a multiple of the
-		 * units we allocate inodes in.
+	if (sbp->sb_imax_pct) {
+		/*
+		 * Make sure the maximum inode count is a multiple
+		 * of the units we allocate inodes in.
 		 */
-
 		icount = sbp->sb_dblocks * sbp->sb_imax_pct;
 		do_div(icount, 100);
 		do_div(icount, mp->m_ialloc_blks);
 		mp->m_maxicount = (icount * mp->m_ialloc_blks)  <<
 				   sbp->sb_inopblog;
-	} else
+	} else {
 		mp->m_maxicount = 0;
-
-	mp->m_maxioffset = xfs_max_file_offset(sbp->sb_blocklog);
-
-	/*
-	 * XFS uses the uuid from the superblock as the unique
-	 * identifier for fsid.  We can not use the uuid from the volume
-	 * since a single partition filesystem is identical to a single
-	 * partition volume/filesystem.
-	 */
-	if ((mfsi_flags & XFS_MFSI_SECOND) == 0 &&
-	    (mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
-		if (xfs_uuid_mount(mp)) {
-			error = XFS_ERROR(EINVAL);
-			goto error1;
-		}
-		uuid_mounted=1;
 	}
+}
+
+/*
+ * Set the default minimum read and write sizes unless
+ * already specified in a mount option.
+ * We use smaller I/O sizes when the file system
+ * is being used for NFS service (wsync mount option).
+ */
+STATIC void
+xfs_set_rw_sizes(xfs_mount_t *mp)
+{
+	xfs_sb_t	*sbp = &(mp->m_sb);
+	int		readio_log, writeio_log;
 
-	/*
-	 * Set the default minimum read and write sizes unless
-	 * already specified in a mount option.
-	 * We use smaller I/O sizes when the file system
-	 * is being used for NFS service (wsync mount option).
-	 */
 	if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) {
 		if (mp->m_flags & XFS_MOUNT_WSYNC) {
 			readio_log = XFS_WSYNC_READIO_LOG;
@@ -911,17 +868,14 @@ xfs_mountfs(
 		mp->m_writeio_log = writeio_log;
 	}
 	mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
+}
 
-	/*
-	 * Set the inode cluster size.
-	 * This may still be overridden by the file system
-	 * block size if it is larger than the chosen cluster size.
-	 */
-	mp->m_inode_cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
-
-	/*
-	 * Set whether we're using inode alignment.
-	 */
+/*
+ * Set whether we're using inode alignment.
+ */
+STATIC void
+xfs_set_inoalignment(xfs_mount_t *mp)
+{
 	if (XFS_SB_VERSION_HASALIGN(&mp->m_sb) &&
 	    mp->m_sb.sb_inoalignmt >=
 	    XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size))
@@ -937,14 +891,22 @@ xfs_mountfs(
 		mp->m_sinoalign = mp->m_dalign;
 	else
 		mp->m_sinoalign = 0;
-	/*
-	 * Check that the data (and log if separate) are an ok size.
-	 */
+}
+
+/*
+ * Check that the data (and log if separate) are an ok size.
+ */
+STATIC int
+xfs_check_sizes(xfs_mount_t *mp, int mfsi_flags)
+{
+	xfs_buf_t	*bp;
+	xfs_daddr_t	d;
+	int		error;
+
 	d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks);
 	if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) {
 		cmn_err(CE_WARN, "XFS: size check 1 failed");
-		error = XFS_ERROR(E2BIG);
-		goto error1;
+		return XFS_ERROR(E2BIG);
 	}
 	error = xfs_read_buf(mp, mp->m_ddev_targp,
 			     d - XFS_FSS_TO_BB(mp, 1),
@@ -953,10 +915,9 @@ xfs_mountfs(
 		xfs_buf_relse(bp);
 	} else {
 		cmn_err(CE_WARN, "XFS: size check 2 failed");
-		if (error == ENOSPC) {
+		if (error == ENOSPC)
 			error = XFS_ERROR(E2BIG);
-		}
-		goto error1;
+		return error;
 	}
 
 	if (((mfsi_flags & XFS_MFSI_CLIENT) == 0) &&
@@ -964,8 +925,7 @@ xfs_mountfs(
 		d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
 		if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
 			cmn_err(CE_WARN, "XFS: size check 3 failed");
-			error = XFS_ERROR(E2BIG);
-			goto error1;
+			return XFS_ERROR(E2BIG);
 		}
 		error = xfs_read_buf(mp, mp->m_logdev_targp,
 				     d - XFS_FSB_TO_BB(mp, 1),
@@ -974,17 +934,110 @@ xfs_mountfs(
 			xfs_buf_relse(bp);
 		} else {
 			cmn_err(CE_WARN, "XFS: size check 3 failed");
-			if (error == ENOSPC) {
+			if (error == ENOSPC)
 				error = XFS_ERROR(E2BIG);
-			}
+			return error;
+		}
+	}
+	return 0;
+}
+
+/*
+ * xfs_mountfs
+ *
+ * This function does the following on an initial mount of a file system:
+ *	- reads the superblock from disk and init the mount struct
+ *	- if we're a 32-bit kernel, do a size check on the superblock
+ *		so we don't mount terabyte filesystems
+ *	- init mount struct realtime fields
+ *	- allocate inode hash table for fs
+ *	- init directory manager
+ *	- perform recovery and init the log manager
+ */
+int
+xfs_mountfs(
+	xfs_mount_t	*mp,
+	int		mfsi_flags)
+{
+	xfs_sb_t	*sbp = &(mp->m_sb);
+	xfs_inode_t	*rip;
+	bhv_vnode_t	*rvp = NULL;
+	__uint64_t	resblks;
+	__int64_t	update_flags = 0LL;
+	uint		quotamount, quotaflags;
+	int		agno;
+	int		uuid_mounted = 0;
+	int		error = 0;
+
+	if (mp->m_sb_bp == NULL) {
+		error = xfs_readsb(mp, mfsi_flags);
+		if (error)
+			return error;
+	}
+	xfs_mount_common(mp, sbp);
+
+	/*
+	 * Check if sb_agblocks is aligned at stripe boundary
+	 * If sb_agblocks is NOT aligned turn off m_dalign since
+	 * allocator alignment is within an ag, therefore ag has
+	 * to be aligned at stripe boundary.
+	 */
+	error = xfs_update_alignment(mp, mfsi_flags, &update_flags);
+	if (error)
+		goto error1;
+
+	xfs_alloc_compute_maxlevels(mp);
+	xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK);
+	xfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK);
+	xfs_ialloc_compute_maxlevels(mp);
+
+	xfs_set_maxicount(mp);
+
+	mp->m_maxioffset = xfs_max_file_offset(sbp->sb_blocklog);
+
+	/*
+	 * XFS uses the uuid from the superblock as the unique
+	 * identifier for fsid.  We can not use the uuid from the volume
+	 * since a single partition filesystem is identical to a single
+	 * partition volume/filesystem.
+	 */
+	if ((mfsi_flags & XFS_MFSI_SECOND) == 0 &&
+	    (mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
+		if (xfs_uuid_mount(mp)) {
+			error = XFS_ERROR(EINVAL);
 			goto error1;
 		}
 	}
 
 	/*
+	 * Set the minimum read and write sizes
+	 */
+	xfs_set_rw_sizes(mp);
+
+	/*
+	 * Set the inode cluster size.
+	 * This may still be overridden by the file system
+	 * block size if it is larger than the chosen cluster size.
+	 */
+	mp->m_inode_cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
+
+	/*
+	 * Set inode alignment fields
+	 */
+	xfs_set_inoalignment(mp);
+
+	/*
+	 * Check that the data (and log if separate) are an ok size.
+	 */
+	error = xfs_check_sizes(mp, mfsi_flags);
+	if (error)
+		goto error1;
+
+	/*
 	 * Initialize realtime fields in the mount structure
 	 */
-	if ((error = xfs_rtmount_init(mp))) {
+	error = xfs_rtmount_init(mp);
+	if (error) {
 		cmn_err(CE_WARN, "XFS: RT mount failed");
 		goto error1;
 	}
@@ -1102,7 +1155,8 @@ xfs_mountfs(
 	/*
 	 * Initialize realtime inode pointers in the mount structure
 	 */
-	if ((error = xfs_rtmount_inodes(mp))) {
+	error = xfs_rtmount_inodes(mp);
+	if (error) {
 		/*
 		 * Free up the root inode.
 		 */
@@ -1120,7 +1174,8 @@ xfs_mountfs(
 	/*
 	 * Initialise the XFS quota management subsystem for this mount
 	 */
-	if ((error = XFS_QM_INIT(mp, &quotamount, &quotaflags)))
+	error = XFS_QM_INIT(mp, &quotamount, &quotaflags);
+	if (error)
 		goto error4;
 
 	/*
@@ -1137,7 +1192,8 @@ xfs_mountfs(
 	/*
 	 * Complete the quota initialisation, post-log-replay component.
 	 */
-	if ((error = XFS_QM_MOUNT(mp, quotamount, quotaflags, mfsi_flags)))
+	error = XFS_QM_MOUNT(mp, quotamount, quotaflags, mfsi_flags);
+	if (error)
 		goto error4;
 
 	/*


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

iD8DBQBHmR5WyGugalF9Dw4RAgviAJsF8E19NUBvcgI4inL02JCSMljEHwCbBfsp
fU6wxlRC0o2yQ596/IyRLNI=
=2egt
-----END PGP SIGNATURE-----


--- NEW FILE mirrors ---
http://ftp.kernel.org/pub/linux/kernel/v2.6/snapshots/
http://ftp.kernel.org/pub/linux/kernel/v2.6/
http://ftp.kernel.org/pub/linux/kernel/v2.6/snapshots/old/
http://ftp.kernel.org/pub/linux/kernel/v2.6/testing/


--- NEW FILE upstream ---
linux-2.6.24.tar.bz2


--- NEW FILE upstream-key.gpg ---
pub  1024D/517D0F0E 2000-10-10 Linux Kernel Archives Verification Key <ftpadmin at kernel.org>
     Key fingerprint = C75D C40A 11D7 AF88 9981  ED5B C86B A06A 517D 0F0E
sub  4096g/E50A8F2A 2000-10-10

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.3 (GNU/Linux)
Comment: For info see http://www.gnupg.org

mQGiBDnirDkRBADCTL/iUTeZKb0tiAcKdZdsUP/KSnrGGjlinolUAsUC0D6/hUB1
RdCpJOOERTIEr1yvehqDM7veRhNMoxJNQxa/sSrkywey5qc8uaskUNEqenimq/70
bahWJeoWXjad68mQFh65lULnHQrrioeJnh9UpyGJppNb/yIjdnymH9aYEwCglgP7
UegBzH22h8NVQEK2PWWbyUUD/jQA4lI0wRWcL9HpkYkHcH0LTKRB9zYpQYtyvzJi
yTGwJyFMfYNXy0RT11dICeLkf3HMR84hkPERKMhALobLxVUbfc7j2AygmzGphWGy
DH/xjptQP/zrsq87ylYRONK18w1J42cm+yZa4XThMDPJMrb9/l8qnxU1JnW7W1al
HKTpBACbs+91KLqrnIGcF44TMwxgUj5CUrayPoEnLU+ZMBqfSjmu8RqEYmTxJCKv
7erBFSuazBGj5X7twunrtrW3bxO63MbLbHjfXSRrMnKOb8dRULIg6eWAnoAx8VVZ
YjrOpwAntU3WxYOpbiCHt9kLbb+N5rvNtFcmOqRRQaCIUFOOaLQ8TGludXggS2Vy
bmVsIEFyY2hpdmVzIFZlcmlmaWNhdGlvbiBLZXkgPGZ0cGFkbWluQGtlcm5lbC5v
cmc+iFUEExECABUFAjnirDkDCwoDAxUDAgMWAgECF4AACgkQyGugalF9Dw4MNACe
JiQTyCmQzPGou2cl/RyOXj79kYYAnAsT6xt72hp/PFiywYM9vBsDVv9niQEVAwUQ
OeKwNWx5eAAqlgcFAQEdZgf/Vn2dMKrn8021NhavP0uA3pHGRmdKQ2WJBdLiN2tv
LkpAioZtho+op+xBz8j1zdIJQ/7XWko869KHge2BAFwA8rWDzjtaAWdE0Jo/NiAR
epUwV2FdRRwSxIcNG2CCPyJnfPokRqjdl2z9k2PkwidHSq+2k6JxCWnOcIXChSKf
kHnemtA65ixAlhuxvyN3MPuYs1jAHyDGcyMfomp1qH9tXFQhhyXRrG2eMAfslstC
XGXLcoLN3O2BMR/fG2GlV6kOqGOvoMIW3clVeQLQ9B1yyekKiVY6Vg+CgK5qhg8z
9tjH4f33zzNDwsx1WSCOU/1LIPzFBNbR9QtTF2XmOUfRs4hGBBARAgAGBQI54rBc
AAoJEH2d7s4ry8YhmjsAoMUW9RxfXBSos0A6LwGd+5pXv/MRAKCYFLG2T4GSV+qf
iRsXnrgDHQHD04hGBBARAgAGBQI54rOZAAoJEPKlddweGoeC/+sAoL5f7JF21mRe
Z8VV4nhh7prm+idSAKCMXDWW/tBOeJDYpiEhgyGSGgJJWrkEDQQ54q+cEBAAjRmb
txamcZ9EYsQTnQvVL2l6vY5Rnbc1JDdcyHEV1kH5OwZWqvckL4QgKKBbTQwyB9pC
o0nGK4PkBbrwL0outfHQ5jl9DUzTKIu+asWUyf3fxfUV6j2A6BMo59KNnJzUyJ2+
B5na6NN8nEqEtmogROtjT8LkOvYwqD4A/5re2vwtie+h5yU6A+JbyGQF6lFxThZj
4WGctBgCcDBqRkPAG8DFFAdeN5SMAArktCYuUGXi2q88EDoOs3Ykw0kB8+ZFECz/
4/b93so5Wt2hC15cxAJoXFfR3mXHm40EHzMdEublWV4blB2KvFocQC74/H74QPUk
cWlc6EhPodKvcuOfTimDxXaiGNFONUPgNAmCXeVoOapdWpb3x7iOHPwSaXeJSrO9
fc4GtVjDv90DT2ekK7cvYk8s6B3t7p7W21Xi+hRgrw63B3HElr01gdMZY5XA5ey/
WmnyBS6LOxXlnVBE+2uSQ+aZHqrLpXcRvq2ZonOziDSE0i940ZvIwlSzn0U5BQWl
9hBDQw78RacYqaFvlpcGiPj75bScB4eemxV6Wdo9mtK0Vrr+9bWScXHEv7did4X+
7tBWKbA8M+g290OSzjeQBGLuPmbjxzEKH9jcUumzBzzC5x5GFh7On9TLXQ4K/oRT
6QQpS93YrTVbR60G4MKsePWLJmg7IgYUtNdLGjsAAwUP/0aAAq8CmWtourj1XxNY
pFmOAU45d65fPWVadKyF++B+uDyRNYN7HQCqrJ7ddn0sH7OBtlE8yaBYgR0TFly9
9+LqQO4r4IGCw2TBgA5tKnOWoPGEzvrLeoxR3SnPrKBlDvx6Rr9h3OJ9UV5u/NLh
mCP9iN10gWCGzsWbONc6qD6PugbTur44D6s4CRK9xfliSrtG3GBHW914UKjJeB9s
e3oc1rkmNv39kKcu33w4XVETAj4qpXnwoJvy639dfvnQt1TWFjIt20iP7m+jkT3B
b526uJ5GuJl6r8sm5OYYRs5cLigvUzRZVgYnjjqlRRACx0WcinKK55Li2Pq4qcRV
vSE5Tr3kTUTGxdmy113FbscrhLhesGALv3Hb7jeeWC8jviGEaHppgUumR6v0hsI1
rZ3K8kCjFRAYV8OKtcEeMqjouArGi5dn0ClmG4lwH4SEdqC/TRNWGG+iVpWf5yCj
9mvtvUhLtl6QjXHLrJdSGyafvqR1EQMJadFt4URvx0M7tqZIcwPUnb+7Oc+J96po
e/EQmnm6rFnTpWz0BbY4mbJC7vUH4JyLs0nlxiKrBjaO9C1DSAKBpjqaga8dQe1Z
kLOI2F7IWFeKV2LaMl+ZvvfWMECNcqNW2fkCuP9Fpz5K+xg21TwovVy93aWKgFL6
06jK51oQp3fW86xXK9ZGKYqQiEYEGBECAAYFAjnir5wACgkQyGugalF9Dw5M9QCg
hhmHalzWf8B3AVrjPrtrRHA1vlgAn3YRlU5l0V5W1iXvHXQCUHIESpgm
=SZZb
-----END PGP PUBLIC KEY BLOCK-----


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/.cvsignore,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- .cvsignore	18 Jan 2008 19:14:27 -0000	1.11
+++ .cvsignore	18 Feb 2008 16:55:16 -0000	1.11.2.1
@@ -1,4 +1,7 @@
-linux-2.6.21.tar.bz2
-patch-2.6.21.7.bz2
-linux-2.6.21.7-xen-3.1.0.patch.bz2
+clog
+GNUmakefile
+kernel-2.6.*.config
+temp-*
+kernel-2.6.24
+linux-2.6.24.tar.bz2
 xen-3.2.0.tar.gz


Index: Makefile
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/Makefile,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -r1.2 -r1.2.6.1
--- Makefile	15 Oct 2007 18:56:30 -0000	1.2
+++ Makefile	18 Feb 2008 16:55:16 -0000	1.2.6.1
@@ -1,7 +1,18 @@
-# Makefile for source rpm: kernel-xen-2.6
+# Makefile for source rpm: kernel
 # $Id$
-NAME := kernel-xen-2.6
-SPECFILE = $(firstword $(wildcard *.spec))
+NAME     := kernel-xen-2.6
+SPECFILE := kernel.spec
+
+# use noarch for make prep instead of the current CPU
+# noarch creates and checks all config files not just the current one,
+# in addition "i386" isn't a valid kernel target
+PREPARCH  = noarch
+
+# we only check the .sign signatures
+UPSTREAM_CHECKS = sign
+
+# local targets we need to carry around in addition to the default sources
+TARGETS		= download
 
 define find-makefile-common
 for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
@@ -10,7 +21,7 @@
 MAKEFILE_COMMON := $(shell $(find-makefile-common))
 
 ifeq ($(MAKEFILE_COMMON),)
-# attempt a checkout
+# attept a checkout
 define checkout-makefile-common
 test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
 endef
@@ -19,3 +30,187 @@
 endif
 
 include $(MAKEFILE_COMMON)
+include Makefile.config
+
+debug:
+	@perl -pi -e 's/# CONFIG_SLUB_DEBUG_ON is not set/CONFIG_SLUB_DEBUG_ON=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_LOCK_STAT is not set/CONFIG_LOCK_STAT=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_STACK_USAGE is not set/CONFIG_DEBUG_STACK_USAGE=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_IGNORE_QUIET is not set/CONFIG_DEBUG_IGNORE_QUIET=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_SLAB is not set/CONFIG_DEBUG_SLAB=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_MUTEXES is not set/CONFIG_DEBUG_MUTEXES=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_RT_MUTEXES is not set/CONFIG_DEBUG_RT_MUTEXES=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_RWSEMS is not set/CONFIG_DEBUG_RWSEMS=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_LOCK_ALLOC is not set/CONFIG_DEBUG_LOCK_ALLOC=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_PROVE_LOCKING is not set/CONFIG_PROVE_LOCKING=y/' config-nodebug
+	@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_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
+	@perl -pi -e 's/# CONFIG_FAIL_MAKE_REQUEST is not set/CONFIG_FAIL_MAKE_REQUEST=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_FAULT_INJECTION_DEBUG_FS is not set/CONFIG_FAULT_INJECTION_DEBUG_FS=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set/CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_DEBUG_SG is not set/CONFIG_DEBUG_SG=y/' config-nodebug
+	@perl -pi -e 's/# CONFIG_EXT4DEV_FS is not set/CONFIG_EXT4DEV_FS=m/' config-generic
+
+	@perl -pi -e 's/^%define debugbuildsenabled 1/%define debugbuildsenabled 0/' kernel.spec
+
+release:
+	@perl -pi -e 's/CONFIG_SLUB_DEBUG_ON=y/# CONFIG_SLUB_DEBUG_ON is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_LOCK_STAT=y/# CONFIG_LOCK_STAT is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_STACK_USAGE=y/# CONFIG_DEBUG_STACK_USAGE is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_IGNORE_QUIET=y/# CONFIG_DEBUG_IGNORE_QUIET is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_SLAB=y/# CONFIG_DEBUG_SLAB is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_MUTEXES=y/# CONFIG_DEBUG_MUTEXES is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_RT_MUTEXES=y/# CONFIG_DEBUG_RT_MUTEXES is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_RWSEMS=y/# CONFIG_DEBUG_RWSEMS is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_LOCK_ALLOC=y/# CONFIG_DEBUG_LOCK_ALLOC is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_PROVE_LOCKING=y/# CONFIG_PROVE_LOCKING is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_SPINLOCK=y/# CONFIG_DEBUG_SPINLOCK is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_VM=y/# CONFIG_DEBUG_VM is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_SLEEP_IN_IRQ=y/# CONFIG_DEBUG_SLEEP_IN_IRQ is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_FAULT_INJECTION=y/# CONFIG_FAULT_INJECTION is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_FAILSLAB=y/# CONFIG_FAILSLAB is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_FAIL_PAGE_ALLOC=y/# CONFIG_FAIL_PAGE_ALLOC is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_FAIL_MAKE_REQUEST=y/# CONFIG_FAIL_MAKE_REQUEST is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_FAULT_INJECTION_DEBUG_FS=y/# CONFIG_FAULT_INJECTION_DEBUG_FS is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y/# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_DEBUG_SG=y/# CONFIG_DEBUG_SG is not set/' config-nodebug
+	@perl -pi -e 's/CONFIG_EXT4DEV_FS=m/# CONFIG_EXT4DEV_FS is not set/' config-generic
+
+	@perl -pi -e 's/^%define debugbuildsenabled 0/%define debugbuildsenabled 1/' kernel.spec
+
+
+reconfig:
+	@rm -f kernel-*-config
+	@VERSION="2.6.24" make -f Makefile.config configs
+	@scripts/reconfig.sh
+
+# since i386 isn't a target...
+compile compile-short: DIST_DEFINES += --target $(shell uname -m)
+
+#
+# Hacks for building vanilla (unpatched) kernel rpms.
+# Use "make vanilla-TARGET" like "make TARGET" (make vanilla-scratch-build).
+#
+vanilla-%: $(SPECFILE:.spec=-vanilla.spec)
+	@$(MAKE) $* SPECFILE=$<
+
+$(SPECFILE:.spec=-vanilla.spec): $(SPECFILE)
+	@rm -f $@
+	(echo %define nopatches 1; cat $<) > $@
+
+#scratch-build: NAME = $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{NAME}\n" --specfile $(SPECFILE)| head -1)
+#scratch-build: test-srpm
+#	$(BUILD_CLIENT) build $(BUILD_FLAGS) --scratch $(TARGET) \
+#			$(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
+
+# Dismal kludge for building via brew from cvs after "make vanilla-tag".
+ifdef BEEHIVE_SRPM_BUILD
+export CHECKOUT_TAG ?= $(shell sed s/^.// CVS/Tag)
+tag-pattern = $(TAG_NAME)-$(TAG_VERSION)-0_%_$(TAG_RELEASE)
+ifeq (,$(filter-out $(tag-pattern),$(CHECKOUT_TAG)))
+variant := $(patsubst $(tag-pattern),%,$(CHECKOUT_TAG))
+srpm: SPECFILE := $(wildcard $(SPECFILE:.spec=-$(variant).spec) \
+			     $(SPECFILE:.spec=.t.$(variant).spec))
+srpm beehive-sprm: RELEASE := 0.$(variant).$(RELEASE)
+endif
+endif
+
+ifndef KVERSION
+KVERSION := $(shell awk '$$1 == "%define" && $$2 == "base_sublevel" { \
+				print "2.6." $$3 \
+			 }' $(SPECFILE))
+endif
+
+#
+# Hacks for building kernel rpms from upstream code plus local GIT branches.
+# Use "make git/BRANCH/TARGET" like "make TARGET".
+# Use "make git/BRANCH-fedora/TARGET" to include Fedora patches on top.
+#
+ifndef GIT_SPEC
+git/%:
+	@$(MAKE) GIT_SPEC=$(subst /,-,$(*D)) git-$(*F)
+else
+git-%: $(SPECFILE:.spec=.t.$(GIT_SPEC).spec)
+	@$(MAKE) GIT_SPEC= $* SPECFILE=$<
+endif
+
+#
+# Your git-branches.mk file can define GIT_DIR, e.g.:
+#	GIT_DIR = ${HOME}/kernel/.git
+# Make sure GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are also set
+# or your rpm changelogs will look like crap.
+#
+# For each branch it can define a variable branch-BRANCH or tag-BRANCH
+# giving the parent of BRANCH to diff against in a separate patch.  If
+# the parent is unknown, it will use $(branch-upstream) defaulting to
+# "refs/remotes/upstream/master".
+#
+# Defining tag-BRANCH means the tag corresponds to an upstream patch in
+# the sources file, so that is used instead of generating a patch with
+# git.  If there is no tag-upstream defined, it will figure out a vNNN
+# tag or vNNN-gitN pseudo-tag from the last patch in the sources file.
+# For example:
+#	tag-some-hacks = v2.6.21-rc5
+#	branch-more-hacks = some-hacks
+# Leads to patches:
+#	git diff v2.6.21-rc5..more-hacks > linux-2.6.21-rc5-some-hacks.patch
+#	git diff some-hacks..more-hacks > linux-2.6.21-rc5-more-hacks.patch
+# Whereas having no git-branches.mk at all but doing
+# "make GIT_DIR=... git/mybranch/test-srpm" does:
+#	id=`cat patch-2.6.21-rc5-git4.id` # auto-fetched via upstream file
+#	git diff $id..upstream > linux-2.6.21-rc5-git4-upstream.patch
+#	git diff upstream..mybranch > linux-2.6.21-rc5-git4-mybranch.patch
+# If the upstream patch (or any branch patch) is empty it's left out.
+#
+git-branches.mk:;
+-include git-branches.mk
+
+branch-upstream ?= refs/remotes/upstream/master
+
+ifdef GIT_DIR
+export GIT_DIR
+export GIT_AUTHOR_NAME
+export GIT_AUTHOR_EMAIL
+gen-patches ?= gen-patches
+
+ifndef havespec
+$(SPECFILE:.spec=.t.%-fedora.spec): $(SPECFILE) $(gen-patches) FORCE
+	./$(gen-patches) --fedora < $< > $@ $(gen-patches-args)
+$(SPECFILE:.spec=.t.%.spec): $(SPECFILE) $(gen-patches) FORCE
+	./$(gen-patches) < $< > $@ $(gen-patches-args)
+.PRECIOUS: $(SPECFILE:.spec=.t.%.spec) $(SPECFILE:.spec=.t.%-fedora.spec)
+endif
+
+spec-%: $(SPECFILE:.spec=.t.%.spec) ;
+$(SPECFILE):;
+FORCE:;
+
+branch-of-* = $(firstword $(head-$*) $*)
+gen-patches-args = --name $* v$(KVERSION) $(call heads,$(branch-of-*))
+define heads
+$(if $(tag-$1),$(filter-out v$(KVERSION),$(tag-$1)),\
+     $(call heads,$(firstword $(branch-$1) $(branch-upstream)))) $1
+endef
+
+files-%-fedora:
+	@echo $(SPECFILE:.spec=.t.$*-fedora.spec)
+	@$(call list-patches,$(branch-of-*))
+files-%:
+	@echo $(SPECFILE:.spec=.t.$*.spec)
+	@$(call list-patches,$(branch-of-*))
+define list-patches
+$(if $(tag-$1),version=$(patsubst v%,%,$(tag-$1)),\
+     $(call list-patches,$(firstword $(branch-$1) $(branch-upstream)))); \
+echo linux-$${version}-$(patsubst refs/remotes/%/master,%,$1).patch
+endef
+
+ifndef tag-$(branch-upstream)
+tag-$(branch-upstream) := $(shell \
+	sed -n 's/^.*  *//;s/\.bz2$$//;s/patch-/v/;/^v/h;$${g;p}' sources)
+endif
+endif




Index: config-debug
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-debug,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-debug	29 Oct 2007 17:29:06 -0000	1.2
+++ config-debug	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -25,4 +25,6 @@
 CONFIG_DEBUG_STACK_USAGE=y
 
 CONFIG_ACPI_DEBUG=y
-# CONFIG_ACPI_DEBUG_FUNC_TRACE is not set
\ No newline at end of file
+# CONFIG_ACPI_DEBUG_FUNC_TRACE is not set
+
+CONFIG_DEBUG_SG=y


Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -40,8 +40,8 @@
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
 CONFIG_DEFAULT_CFQ=y
-CONFIG_IPC_NS=y
 CONFIG_USER_NS=y
+CONFIG_PID_NS=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
@@ -73,7 +73,8 @@
 CONFIG_PCIEAER=y
 CONFIG_HOTPLUG_PCI_PCIE=m
 CONFIG_HOTPLUG_PCI_FAKE=m
-# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
+# CONFIG_PCI_LEGACY is not set
+
 CONFIG_ISA=y
 # CONFIG_EISA is not set
 # CONFIG_MCA is not set
@@ -365,8 +366,6 @@
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_RZ1000=y
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_IDEDMA_ONLYDISK is not set
 CONFIG_BLK_DEV_AEC62XX=y
 CONFIG_BLK_DEV_ALI15X3=y
 # CONFIG_WDC_ALI15X3 is not set
@@ -393,10 +392,9 @@
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 CONFIG_BLK_DEV_VIA82CXXX=y
-# CONFIG_IDE_CHIPSETS is not set
 CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
 # CONFIG_BLK_DEV_HD is not set
+CONFIG_VIRTIO_BLK=m
 
 #
 # SCSI device support
@@ -678,11 +676,6 @@
 CONFIG_IP_MULTIPLE_TABLES=y
 CONFIG_IP_ROUTE_MULTIPATH=y
 CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
-CONFIG_IP_ROUTE_MULTIPATH_RR=m
-CONFIG_IP_ROUTE_MULTIPATH_RANDOM=m
-CONFIG_IP_ROUTE_MULTIPATH_WRANDOM=m
-CONFIG_IP_ROUTE_MULTIPATH_DRR=m
 # CONFIG_IP_PNP is not set
 CONFIG_NET_IPIP=m
 CONFIG_NET_IPGRE=m
@@ -699,6 +692,7 @@
 CONFIG_NETCONSOLE_DYNAMIC=y
 CONFIG_NETPOLL_TRAP=y
 CONFIG_NET_POLL_CONTROLLER=y
+CONFIG_VIRTIO_NET=m
 
 #
 # IP: Virtual Server Configuration
@@ -737,8 +731,9 @@
 CONFIG_IPV6_MULTIPLE_TABLES=y
 
 CONFIG_NET_9P=m
-# CONFIG_NET_9P_DEBUG is not set
 CONFIG_NET_9P_FD=m
+CONFIG_NET_9P_VIRTIO=m
+# CONFIG_NET_9P_DEBUG is not set
 
 CONFIG_DECNET=m
 CONFIG_DECNET_ROUTER=y
@@ -961,7 +956,6 @@
 CONFIG_NET_SCH_HFSC=m
 CONFIG_NET_SCH_NETEM=m
 CONFIG_NET_SCH_RR=m
-CONFIG_NET_ESTIMATOR=y
 CONFIG_NET_CLS=y
 CONFIG_NET_CLS_TCINDEX=m
 CONFIG_NET_CLS_ROUTE4=m
@@ -1120,7 +1114,7 @@
 CONFIG_BNX2=m
 CONFIG_QLA3XXX=m
 CONFIG_ATL1=m
-# CONFIG_DGRS is not set
+CONFIG_ATL2=m
 # CONFIG_EEPRO100 is not set
 CONFIG_E100=m
 CONFIG_FEALNX=m
@@ -1225,9 +1219,14 @@
 # CONFIG_PCMCIA_RAYCS is not set
 
 CONFIG_MAC80211=m
+CONFIG_MAC80211_RC_DEFAULT_PID=y
+# CONFIG_MAC80211_RC_DEFAULT_SIMPLE is not set
+CONFIG_MAC80211_RC_DEFAULT="pid"
+CONFIG_MAC80211_RC_PID=y
+CONFIG_MAC80211_RC_SIMPLE=y
 CONFIG_MAC80211_LEDS=y
-CONFIG_MAC80211_HT=y
-# CONFIG_MAC80211_DEBUGFS is not set
+CONFIG_MAC80211_DEBUGFS=y
+# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
 # CONFIG_MAC80211_DEBUG is not set
 CONFIG_IEEE80211=m
 CONFIG_IEEE80211_DEBUG=y
@@ -1237,6 +1236,7 @@
 CONFIG_IEEE80211_SOFTMAC=m
 CONFIG_IEEE80211_SOFTMAC_DEBUG=y
 CONFIG_CFG80211=m
+CONFIG_NL80211=y
 
 CONFIG_ADM8211=m
 CONFIG_ATH5K=m
@@ -1245,17 +1245,9 @@
 CONFIG_ATMEL=m
 # CONFIG_BCM43XX is not set
 CONFIG_B43=m
-CONFIG_B43_PCI=y
 CONFIG_B43_PCMCIA=y
 CONFIG_B43_DEBUG=y
-CONFIG_B43_DMA=y
-CONFIG_B43_PIO=y
-CONFIG_B43_DMA_AND_PIO_MODE=y
-# CONFIG_B43_DMA_MODE is not set
-# CONFIG_B43_PIO_MODE is not set
 CONFIG_B43LEGACY=m
-CONFIG_B43LEGACY_PCI=y
-CONFIG_B43LEGACY_PCMCIA=y
 CONFIG_B43LEGACY_DEBUG=y
 CONFIG_B43LEGACY_DMA=y
 CONFIG_B43LEGACY_PIO=y
@@ -1273,17 +1265,21 @@
 # CONFIG_IPW2200 is not set
 # CONFIG_IPW2100_DEBUG is not set
 # CONFIG_IPW2200_DEBUG is not set
-# CONFIG_LIBERTAS is not set
-
-CONFIG_IWLWIFI=y
-CONFIG_IWLWIFI_DEBUG=y
-CONFIG_IWLWIFI_SENSITIVITY=y
-CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y
-CONFIG_IWLWIFI_QOS=y
-CONFIG_IWLWIFI_HT=y
+CONFIG_LIBERTAS=m
+CONFIG_LIBERTAS_USB=m
+CONFIG_LIBERTAS_CS=m
+CONFIG_LIBERTAS_SDIO=m
+CONFIG_LIBERTAS_DEBUG=y
 CONFIG_IWL4965=m
+CONFIG_IWL4965_DEBUG=y
+CONFIG_IWL4965_SENSITIVITY=y
+CONFIG_IWL4965_SPECTRUM_MEASUREMENT=y
+CONFIG_IWL4965_QOS=y
+CONFIG_IWL4965_HT=y
 CONFIG_IWL3945=m
-# CONFIG_NL80211 is not set
+CONFIG_IWL3945_DEBUG=y
+CONFIG_IWL3945_SPECTRUM_MEASUREMENT=y
+CONFIG_IWL3945_QOS=y
 CONFIG_NORTEL_HERMES=m
 CONFIG_P54_COMMON=m
 CONFIG_P54_USB=m
@@ -1297,6 +1293,7 @@
 CONFIG_PCMCIA_ATMEL=m
 CONFIG_PCMCIA_WL3501=m
 CONFIG_RT2X00=y
+CONFIG_RT2X00_LIB_DEBUGFS=y
 # CONFIG_RT2X00_DEBUG is not set
 CONFIG_RT2400PCI=m
 CONFIG_RT2400PCI_RFKILL=y
@@ -1306,14 +1303,14 @@
 CONFIG_RT61PCI_RFKILL=y
 CONFIG_RT2500USB=m
 CONFIG_RT73USB=m
-CONFIG_RTL818X=y
+CONFIG_RTL8180=m
 CONFIG_RTL8187=m
 CONFIG_TMD_HERMES=m
 CONFIG_USB_ATMEL=m
 CONFIG_USB_ZD1201=m
-# CONFIG_ZD1211RW is not set
-CONFIG_ZD1211RW_MAC80211=m
-# CONFIG_ZD1211RW_MAC80211_DEBUG is not set
+CONFIG_USB_NET_RNDIS_WLAN=m
+CONFIG_ZD1211RW=m
+# CONFIG_ZD1211RW_DEBUG is not set
 
 
 #
@@ -1354,7 +1351,23 @@
 #
 # Amateur Radio support
 #
-# CONFIG_HAMRADIO is not set
+CONFIG_HAMRADIO=y
+CONFIG_AX25=m
+CONFIG_AX25_DAMA_SLAVE=y
+CONFIG_NETROM=m
+CONFIG_ROSE=m
+CONFIG_MKISS=m
+CONFIG_6PACK=m
+CONFIG_BPQETHER=m
+CONFIG_SCC=m
+CONFIG_DMASCC=m
+CONFIG_SCC_DELAY=n
+CONFIG_SCC_TRXECHO=y
+CONFIG_BAYCOM_SER_FDX=m
+CONFIG_BAYCOM_SER_HDX=m
+CONFIG_BAYCOM_PAR=m
+CONFIG_BAYCOM_EPP=m
+CONFIG_YAM=m
 
 #
 # IrDA (infrared) support
@@ -1426,6 +1439,8 @@
 CONFIG_BT_HCIBCM203X=m
 CONFIG_BT_HCIBFUSB=m
 CONFIG_BT_HCIBPA10X=m
+CONFIG_BT_HCIBTSDIO=m
+CONFIG_BT_HCIUART_LL=y
 
 #
 # ISDN subsystem
@@ -1551,7 +1566,6 @@
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 CONFIG_INPUT_JOYDEV=m
-# CONFIG_INPUT_TSDEV is not set
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_EVBUG is not set
 
@@ -1655,7 +1669,6 @@
 #
 CONFIG_VT=y
 CONFIG_VT_CONSOLE=y
-CONFIG_VT_UNICODE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
@@ -1673,7 +1686,7 @@
 CONFIG_TCG_NSC=m
 CONFIG_TCG_ATMEL=m
 # CONFIG_TCG_INFINEON is not set
-# CONFIG_TELCLOCK is not set
+CONFIG_TELCLOCK=m
 
 #
 # Serial drivers
@@ -1715,7 +1728,6 @@
 CONFIG_PRINTER=m
 CONFIG_LP_CONSOLE=y
 CONFIG_PPDEV=m
-CONFIG_TIPAR=m
 
 #
 # I2C support
@@ -1800,6 +1812,7 @@
 CONFIG_SENSORS_GL518SM=m
 CONFIG_SENSORS_GL520SM=m
 CONFIG_SENSORS_HDAPS=m
+# CONFIG_SENSORS_I5K_AMB is not set
 CONFIG_SENSORS_IBMPEX=m
 CONFIG_SENSORS_IT87=m
 CONFIG_SENSORS_K8TEMP=m
@@ -1895,7 +1908,9 @@
 # CONFIG_WAFER_WDT is not set
 # CONFIG_CPU5_WDT is not set
 CONFIG_I6300ESB_WDT=m
+CONFIG_IT8712F_WDT=m
 # CONFIG_SBC8360_WDT is not set
+# CONFIG_SBC7240_WDT is not set
 CONFIG_W83977F_WDT=m
 CONFIG_PCIPCWATCHDOG=m
 CONFIG_USBPCWATCHDOG=m
@@ -1903,21 +1918,21 @@
 
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
-CONFIG_RTC=y
+# CONFIG_RTC is not set
 # CONFIG_RTC_DEBUG is not set
 # CONFIG_GEN_RTC is not set
-# CONFIG_RTC_CLASS is not set
+CONFIG_RTC_CLASS=y
 # CONFIG_RTC_HCTOSYS is not set
-CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 CONFIG_RTC_INTF_SYSFS=y
 CONFIG_RTC_INTF_PROC=y
 CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
-CONFIG_RTC_DRV_CMOS=m
+CONFIG_RTC_DRV_CMOS=y
 CONFIG_RTC_DRV_DS1307=m
 CONFIG_RTC_DRV_DS1553=m
 CONFIG_RTC_DRV_DS1672=m
 CONFIG_RTC_DRV_DS1742=m
+CONFIG_RTC_DRV_DS1374=m
 # CONFIG_RTC_DRV_EP93XX is not set
 CONFIG_RTC_DRV_ISL1208=m
 CONFIG_RTC_DRV_M41T80=m
@@ -2178,7 +2193,6 @@
 CONFIG_VIDEO_SAA7146_VV=m
 CONFIG_VIDEO_TUNER=m
 # CONFIG_VIDEO_TUNER_CUSTOMIZE is not set
-CONFIG_VIDEO_BUF=m
 CONFIG_VIDEO_BTCX=m
 CONFIG_VIDEO_PVRUSB2=m
 CONFIG_VIDEO_PVRUSB2_24XXX=y
@@ -2259,7 +2273,7 @@
 # CONFIG_FB_VIRTUAL is not set
 CONFIG_FB_VOODOO1=m
 # CONFIG_FB_VT8623 is not set
-
+CONFIG_FB_EFI=y
 
 # CONFIG_FIRMWARE_EDID is not set
 
@@ -2304,8 +2318,6 @@
 CONFIG_SND_PCM_OSS=m
 CONFIG_SND_PCM_OSS_PLUGINS=y
 CONFIG_SND_RTCTIMER=m
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
 CONFIG_SND_DYNAMIC_MINORS=y
 # CONFIG_SND_SUPPORT_OLD_API is not set
 
@@ -2397,6 +2409,7 @@
 CONFIG_SND_VX222=m
 CONFIG_SND_YMFPCI=m
 CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y
+CONFIG_SND_SIS7019=m
 
 #
 # ALSA USB devices
@@ -2415,7 +2428,6 @@
 # Open Sound System
 #
 # CONFIG_SOUND_PRIME is not set
-# CONFIG_SOUND_BT878 is not set
 
 #
 # USB support
@@ -2423,6 +2435,8 @@
 CONFIG_USB=y
 CONFIG_USB_SUPPORT=y
 # CONFIG_USB_DEBUG is not set
+
+# DEPRECATED: See bug 362221. Fix udev.
 # CONFIG_USB_DEVICE_CLASS is not set
 
 # CONFIG_USB_PERSIST is not set
@@ -2631,7 +2645,7 @@
 CONFIG_USB_RIO500=m
 CONFIG_USB_LCD=m
 CONFIG_USB_BERRY_CHARGE=m
-# CONFIG_USB_IOWARRIOR is not set
+CONFIG_USB_IOWARRIOR=m
 # CONFIG_USB_TEST is not set
 # CONFIG_USB_GADGET is not set
 # CONFIG_USB_GADGET_PXA2XX is not set
@@ -2668,6 +2682,7 @@
 CONFIG_USB_TRANCEVIBRATOR=m
 
 CONFIG_USB_QUICKCAM_MESSENGER=m
+CONFIG_USB_UVCVIDEO=m
 # CONFIG_USB_HIDINPUT_POWERBOOK is not set
 
 #
@@ -2758,7 +2773,6 @@
 CONFIG_TMPFS_POSIX_ACL=y
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
 CONFIG_DEBUG_FS=y
 
 #
@@ -2823,7 +2837,8 @@
 # CONFIG_SMB_NLS_DEFAULT is not set
 CONFIG_CIFS=m
 # CONFIG_CIFS_STATS is not set
-# CONFIG_CIFS_EXPERIMENTAL is not set
+CONFIG_CIFS_EXPERIMENTAL=y
+CONFIG_CIFS_UPCALL=y
 CONFIG_CIFS_XATTR=y
 CONFIG_CIFS_POSIX=y
 CONFIG_CIFS_WEAK_PW_HASH=y
@@ -2843,6 +2858,7 @@
 # CONFIG_AF_RXRPC is not set
 
 CONFIG_OCFS2_FS=m
+# CONFIG_OCFS2_DEBUG_FS is not set
 # CONFIG_OCFS2_DEBUG_MASKLOG is not set
 CONFIG_CONFIGFS_FS=m
 
@@ -2952,6 +2968,7 @@
 CONFIG_DEBUG_LIST=y
 CONFIG_DEBUG_SHIRQ=y
 CONFIG_DEBUG_DEVRES=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
 
 #
 # Security options
@@ -2966,11 +2983,10 @@
 CONFIG_SECURITY_SELINUX_BOOTPARAM=y
 CONFIG_SECURITY_SELINUX_DISABLE=y
 CONFIG_SECURITY_SELINUX_DEVELOP=y
-CONFIG_SECURITY_SELINUX_AVC_STATS=y
 CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
 CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
 CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT=y
-CONFIG_UTS_NS=y
+CONFIG_SECURITY_SELINUX_AVC_STATS=y
 CONFIG_AUDIT=y
 CONFIG_AUDITSYSCALL=y
 
@@ -3002,7 +3018,6 @@
 CONFIG_CRYPTO_MD4=m
 CONFIG_CRYPTO_MD5=m
 CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_MPILIB=y
 CONFIG_CRYPTO_NULL=m
 CONFIG_CRYPTO_PCBC=m
 CONFIG_CRYPTO_SEED=m
@@ -3010,7 +3025,6 @@
 CONFIG_CRYPTO_SHA1=y
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_SIGNATURE_DSA=y
 CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_TGR192=m
 CONFIG_CRYPTO_TWOFISH=m
@@ -3064,7 +3078,8 @@
 CONFIG_CGROUP_CPUACCT=y
 CONFIG_PROC_PID_CPUSET=y
 
-CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_SYSFS_DEPRECATED is not set
+
 CONFIG_RELAY=y
 # CONFIG_PRINTK_TIME is not set
 CONFIG_ENABLE_MUST_CHECK=y
@@ -3084,10 +3099,8 @@
 CONFIG_IBMASR=m
 
 CONFIG_PM_LEGACY=y
-# CONFIG_PM_SYSFS_DEPRECATED is not set
 CONFIG_PM_DEBUG=y
 CONFIG_PM_TRACE=y
-# CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 # CONFIG_PM_VERBOSE is not set
 
 CONFIG_CRASH=m
@@ -3106,7 +3119,6 @@
 CONFIG_SCSI_ARCMSR=m
 CONFIG_SCSI_ARCMSR_AER=y
 # CONFIG_SCSI_DTC3280 is not set
-# CONFIG_SCSI_ESP_CORE is not set
 # CONFIG_SCSI_GENERIC_NCR5380 is not set
 # CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
 # CONFIG_SCSI_NCR53C406A is not set
@@ -3117,7 +3129,6 @@
 # CONFIG_SCSI_T128 is not set
 # CONFIG_SCSI_U14_34F is not set
 # CONFIG_SCSI_ULTRASTOR is not set
-# CONFIG_CD_NO_IDESCSI is not set
 
 # CONFIG_EL1 is not set
 # CONFIG_EL2 is not set
@@ -3291,13 +3302,8 @@
 CONFIG_CFAG12864B_RATE=20
 
 # CONFIG_PHANTOM is not set
-# CONFIG_BLINK is not set
 CONFIG_EEPROM_93CX6=m
 
-CONFIG_CPU_IDLE=y
-# CONFIG_CPU_IDLE_GOV_LADDER is not set
-CONFIG_CPU_IDLE_GOV_MENU=y
-
 CONFIG_POWER_SUPPLY=m
 # CONFIG_POWER_SUPPLY_DEBUG is not set
 CONFIG_APM_POWER=m
@@ -3337,3 +3343,6 @@
 
 # CONFIG_SAMPLES is not set
 
+# CONFIG_WRITABLE_DEVMEM is not set
+# CONFIG_WRITABLE_DEVKMEM is not set
+


Index: config-ia64-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-ia64-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-ia64-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-ia64-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -13,7 +13,6 @@
 # CONFIG_XEN_VT is not set
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_TIME_INTERPOLATION=y
 CONFIG_EFI=y
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
@@ -63,6 +62,7 @@
 #
 # Character devices
 #
+CONFIG_TCG_INFINEON=m
 
 #
 # Watchdog Cards
@@ -114,8 +114,10 @@
 CONFIG_ACPI=y
 CONFIG_ACPI_AC=m
 # CONFIG_ACPI_ASUS is not set
-CONFIG_ACPI_BAY=m
-CONFIG_ACPI_BATTERY=m
+CONFIG_ACPI_PROCFS_POWER=y
+CONFIG_ACPI_SYSFS_POWER=y
+# CONFIG_ACPI_BAY is not set
+# CONFIG_ACPI_BATTERY is not set
 CONFIG_ACPI_BLACKLIST_YEAR=0
 CONFIG_ACPI_BUTTON=m
 # CONFIG_ACPI_DOCK is not set
@@ -187,3 +189,7 @@
 # CONFIG_IA64_MC_ERR_INJECT is not set
 
 CONFIG_DMIID=y
+
+CONFIG_SENSORS_I5K_AMB=m
+
+CONFIG_SPARSEMEM_VMEMMAP=y


Index: config-nodebug
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-nodebug,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-nodebug	29 Oct 2007 17:29:06 -0000	1.2
+++ config-nodebug	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -25,3 +25,5 @@
 CONFIG_DEBUG_STACK_USAGE=y
 
 # CONFIG_ACPI_DEBUG is not set
+
+CONFIG_DEBUG_SG=y


Index: config-powerpc-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-powerpc-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-powerpc-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-powerpc-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -33,8 +33,9 @@
 CONFIG_SUSPEND=y
 CONFIG_HIBERNATION=y
 # CONFIG_RTC is not set
-CONFIG_GEN_RTC=y
+# CONFIG_GEN_RTC is not set
 # CONFIG_GEN_RTC_X is not set
+CONFIG_RTC_DRV_PPC=y
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
 CONFIG_BLK_DEV_IDE_PMAC=y
@@ -49,6 +50,7 @@
 CONFIG_I2C_POWERMAC=y
 CONFIG_APPLE_AIRPORT=m
 CONFIG_SERIAL_PMACZILOG=m
+# CONFIG_SERIAL_PMACZILOG_TTYS is not set
 CONFIG_AGP_UNINORTH=y
 CONFIG_FB_OF=y
 # CONFIG_FB_CONTROL is not set
@@ -119,9 +121,6 @@
 # CONFIG_PPC_LITE5200 is not set
 CONFIG_PPC_BESTCOMM=y
 CONFIG_PMAC_RACKMETER=m
-CONFIG_SERIAL_MPC52xx=y
-CONFIG_SERIAL_MPC52xx_CONSOLE=y
-CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
 CONFIG_USB_OHCI_HCD_PPC_SOC=y
 CONFIG_USB_OHCI_HCD_PCI=y
 CONFIG_USB_OHCI_HCD_PPC_OF=y
@@ -157,8 +156,6 @@
 # CONFIG_BLK_DEV_IDEPNP is not set
 # CONFIG_BLK_DEV_IDEPCI is not set
 CONFIG_IDEPCI_SHARE_IRQ=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_IDEDMA_ONLYDISK is not set
 # CONFIG_BLK_DEV_AEC62XX is not set
 # CONFIG_BLK_DEV_ALI15X3 is not set
 # CONFIG_BLK_DEV_AMD74XX is not set
@@ -186,9 +183,7 @@
 CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
 CONFIG_BLK_DEV_IDEDMA_PMAC=y
 # CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
 CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
 # CONFIG_BLK_DEV_HD is not set
 # CONFIG_USB_STORAGE_ISD200 is not set
 CONFIG_MTD_PHYSMAP_OF=m
@@ -210,4 +205,3 @@
 CONFIG_AXON_RAM=m
 CONFIG_OPROFILE_CELL=y
 
-# CONFIG_MPC5200_WDT is not set


Index: config-powerpc32-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-powerpc32-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-powerpc32-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-powerpc32-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -47,7 +47,6 @@
 CONFIG_FB_PLATINUM=y
 CONFIG_FB_VALKYRIE=y
 CONFIG_FB_CT65550=y
-CONFIG_DMASOUND_PMAC=m
 # CONFIG_BDI_SWITCH is not set
 CONFIG_MAC_FLOPPY=m
 # CONFIG_BLK_DEV_FD is not set
@@ -67,7 +66,16 @@
 
 CONFIG_PATA_MPC52xx=m
 
+CONFIG_SERIAL_MPC52xx=y
+CONFIG_SERIAL_MPC52xx_CONSOLE=y
+CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD=115200
+# CONFIG_MPC5200_WDT is not set
+
 CONFIG_PPC_MPC5200_BUGFIX=y
+CONFIG_FEC_MPC52xx=m
+#CHECK: This may later become a tristate.
+CONFIG_FEC_MPC52xx_MDIO=y
+
 CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_DEBUG_STACKOVERFLOW=y
 
@@ -82,9 +90,9 @@
 # CONFIG_BLK_DEV_HT6560B is not set
 # CONFIG_BLK_DEV_QD65XX is not set
 # CONFIG_BLK_DEV_UMC8672 is not set
-CONFIG_SERIAL_PMACZILOG_TTYS=y
 # CONFIG_VIRQ_DEBUG is not set
 
 CONFIG_PPC_BESTCOMM_ATA=m
 CONFIG_PPC_BESTCOMM_FEC=m
 CONFIG_PPC_BESTCOMM_GEN_BD=m
+


Index: config-powerpc64
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-powerpc64,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-powerpc64	29 Oct 2007 17:29:06 -0000	1.2
+++ config-powerpc64	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -16,7 +16,7 @@
 CONFIG_PPC_CELLEB=y
 CONFIG_PS3_HTAB_SIZE=20
 # CONFIG_PS3_DYNAMIC_DMA is not set
-CONFIG_PS3_USE_LPAR_ADDR=y
+# CONFIG_PS3_USE_LPAR_ADDR is not set
 CONFIG_PS3_ADVANCED=y
 CONFIG_PS3_HTAB_SIZE=20
 # CONFIG_PS3_DYNAMIC_DMA is not set
@@ -77,8 +77,7 @@
 CONFIG_VIOCD=m
 CONFIG_VIOTAPE=m
 
-# virq_to_hw() requires irq_map[] to be exported. Ick.
-# CONFIG_PASEMI_MAC is not set 
+CONFIG_PASEMI_MAC=m
 CONFIG_SERIAL_OF_PLATFORM=m
 
 CONFIG_PPC_PASEMI_IOMMU=y
@@ -110,7 +109,6 @@
 # CONFIG_FB_ATY is not set
 
 # CONFIG_POWER4_ONLY is not set
-# CONFIG_PPC_PASEMI is not set
 
 CONFIG_RTAS_PROC=y
 CONFIG_IOMMU_VMERGE=y
@@ -126,7 +124,6 @@
 
 CONFIG_EHEA=m
 CONFIG_INFINIBAND_EHCA=m
-CONFIG_INFINIBAND_EHCA_SCALING=y
 
 CONFIG_HCALL_STATS=y
 
@@ -148,7 +145,7 @@
 CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
 # CONFIG_IBM_NEW_EMAC_DEBUG is not set
 
-CONFIG_SERIAL_PMACZILOG_TTYS=y
 # CONFIG_VIRQ_DEBUG is not set
 CONFIG_ELECTRA_CF=m
 
+CONFIG_SPARSEMEM_VMEMMAP=y


Index: config-s390x
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-s390x,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-s390x	29 Oct 2007 17:29:06 -0000	1.2
+++ config-s390x	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -63,7 +63,6 @@
 CONFIG_TN3215=y
 CONFIG_TN3215_CONSOLE=y
 CONFIG_CCW_CONSOLE=y
-CONFIG_SCLP=y
 CONFIG_SCLP_TTY=y
 CONFIG_SCLP_CONSOLE=y
 CONFIG_SCLP_VT220_TTY=y


Index: config-sparc-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-sparc-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-sparc-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-sparc-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -39,7 +39,6 @@
 CONFIG_FB_CG14=y
 CONFIG_FB_P9100=y
 CONFIG_FB_LEO=y
-# CONFIG_FB_PCI is not set
 # CONFIG_FB_IGA is not set
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_PROM_CONSOLE=y
@@ -81,7 +80,6 @@
 CONFIG_SUN_MOSTEK_RTC=y
 # CONFIG_SUN_BPP is not set
 # CONFIG_SUN_VIDEOPIX is not set
-# CONFIG_SUN_AURORA is not set
 CONFIG_TADPOLE_TS102_UCTRL=m
 CONFIG_SUN_JSFLASH=m
 CONFIG_APM_RTC_IS_GMT=y
@@ -97,7 +95,6 @@
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
 # CONFIG_SCSI_ADVANSYS is not set
-# CONFIG_SCSI_MEGARAID is not set
 # CONFIG_SCSI_SATA is not set
 # CONFIG_SCSI_BUSLOGIC is not set
 # CONFIG_SCSI_CPQFCTS is not set
@@ -115,9 +112,6 @@
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_NSP32 is not set
 CONFIG_SCSI_SUNESP=m
-CONFIG_FC4=m
-CONFIG_FC4_SOC=m
-CONFIG_FC4_SOCAL=m
 CONFIG_SCSI_PLUTO=m
 CONFIG_SCSI_FCAL=m
 CONFIG_SUNLANCE=m


Index: config-sparc64-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-sparc64-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-sparc64-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-sparc64-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -63,7 +63,6 @@
 CONFIG_FB_PM2=y
 CONFIG_FB_P9100=y
 # CONFIG_FB_LEO is not set
-CONFIG_FB_PCI=y
 CONFIG_FB_XVR500=y
 CONFIG_FB_XVR2500=y
 # CONFIG_MDA_CONSOLE is not set
@@ -90,7 +89,6 @@
 CONFIG_SUN_MOSTEK_RTC=y
 CONFIG_OBP_FLASH=m
 # CONFIG_SUN_VIDEOPIX is not set
-# CONFIG_SUN_AURORA is not set
 # CONFIG_SERIO_SERPORT is not set
 CONFIG_BLK_DEV_FD=y
 CONFIG_SUNVDC=m
@@ -109,15 +107,9 @@
 # CONFIG_SCSI_GDTH is not set
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_AIC79XX is not set
-# CONFIG_SCSI_MEGARAID is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
 CONFIG_SCSI_QLOGICPTI=m
 CONFIG_SCSI_SUNESP=m
-CONFIG_FC4=m
-CONFIG_FC4_SOC=m
-CONFIG_FC4_SOCAL=m
-CONFIG_SCSI_PLUTO=m
-CONFIG_SCSI_FCAL=m
 CONFIG_SUNLANCE=m
 CONFIG_SUNBMAC=m
 CONFIG_SUNQE=m
@@ -130,7 +122,6 @@
 CONFIG_ATM_FORE200E_USE_TASKLET=y
 CONFIG_ATM_FORE200E_DEBUG=0
 CONFIG_ATM_FORE200E_TX_RETRY=16
-CONFIG_DRM_FFB=m
 # CONFIG_DRM_TDFX is not set
 # CONFIG_DRM_R128 is not set
 # CONFIG_KEYBOARD_ATKBD is not set
@@ -138,7 +129,6 @@
 # CONFIG_INPUT_PCSPKR is not set
 CONFIG_INPUT_SPARCSPKR=m
 # CONFIG_SOUND_PRIME is not set
-CONFIG_SND_BIT32_EMUL=m
 CONFIG_SND_SUN_AMD7930=m
 CONFIG_SND_SUN_CS4231=m
 CONFIG_SND_SUN_DBRI=m
@@ -159,3 +149,4 @@
 # CONFIG_DEBUG_PAGEALLOC is not set
 # CONFIG_STACK_DEBUG is not set
 
+CONFIG_SPARSEMEM_VMEMMAP=y


Index: config-x86-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-x86-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-x86-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-x86-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -1,5 +1,6 @@
 CONFIG_UID16=y
-CONFIG_X86_64_XEN is not set
+# CONFIG_64BIT is not set
+
 #
 # Processor type and features
 #
@@ -50,7 +51,6 @@
 CONFIG_X86_USE_PPRO_CHECKSUM=y
 CONFIG_HPET=y
 CONFIG_HPET_TIMER=y
-CONFIG_HPET_EMULATE_RTC=y
 # CONFIG_HPET_RTC_IRQ is not set
 # CONFIG_HPET_MMAP is not set
 CONFIG_X86_LOCAL_APIC=y
@@ -77,7 +77,7 @@
 CONFIG_EFI=y
 CONFIG_EFI_VARS=y
 CONFIG_EFI_PCDP=y
-CONFIG_EFI_RTC=y
+CONFIG_FB_IMAC=y
 
 # CONFIG_PCI_GOBIOS is not set
 # CONFIG_PCI_GODIRECT is not set
@@ -125,6 +125,8 @@
 CONFIG_ACPI=y
 CONFIG_ACPI_AC=m
 # CONFIG_ACPI_ASUS is not set
+CONFIG_ACPI_PROCFS_POWER=y
+CONFIG_ACPI_SYSFS_POWER=y
 CONFIG_ACPI_BATTERY=m
 CONFIG_ACPI_BAY=m
 CONFIG_ACPI_BLACKLIST_YEAR=1999
@@ -139,7 +141,6 @@
 CONFIG_ACPI_PROCFS=y
 CONFIG_ACPI_SBS=m
 CONFIG_ACPI_SLEEP=y
-# CONFIG_ACPI_PROCFS_SLEEP is not set
 CONFIG_ACPI_SYSTEM=y
 CONFIG_ACPI_THERMAL=y
 CONFIG_ACPI_TOSHIBA=m
@@ -177,7 +178,7 @@
 CONFIG_X86_SPEEDSTEP_SMI=y
 CONFIG_X86_SPEEDSTEP_LIB=y
 # CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set
-CONFIG_X86_P4_CLOCKMOD=m
+# CONFIG_X86_P4_CLOCKMOD is not set
 CONFIG_X86_LONGRUN=y
 # CONFIG_X86_LONGHAUL is not set
 # CONFIG_X86_CPUFREQ_NFORCE2 is not set
@@ -216,6 +217,8 @@
 CONFIG_PCI_DIRECT=y
 CONFIG_PCI_MMCONFIG=y
 CONFIG_PCI_BIOS=y
+CONFIG_DMAR=y
+CONFIG_DMAR_GFX_WA=y
 
 CONFIG_HOTPLUG_PCI=y
 CONFIG_HOTPLUG_PCI_COMPAQ=m
@@ -224,7 +227,6 @@
 
 # CONFIG_HOTPLUG_PCI_CPCI is not set
 CONFIG_HOTPLUG_PCI_PCIE=m
-# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
 # SHPC has half-arsed PCI probing, which makes it load on too many systems
 # CONFIG_HOTPLUG_PCI_SHPC is not set
 CONFIG_PM=y
@@ -251,7 +253,6 @@
 CONFIG_I2C_AMD8111=m
 CONFIG_I2C_I801=m
 CONFIG_I2C_I810=m
-CONFIG_I2C_ISA=m
 CONFIG_I2C_NFORCE2=m
 CONFIG_I2C_PIIX4=m
 CONFIG_I2C_PROSAVAGE=m
@@ -283,7 +284,6 @@
 CONFIG_EDAC_I82975X=m
 CONFIG_EDAC_I3000=m
 CONFIG_EDAC_I5000=m
-CONFIG_EDAC_K8=m
 CONFIG_EDAC_R82600=m
 
 CONFIG_SCHED_MC=y
@@ -304,6 +304,7 @@
 # CONFIG_SGI_IOC4 is not set
 
 CONFIG_ASUS_LAPTOP=m
+CONFIG_EEEPC=m
 CONFIG_FUJITSU_LAPTOP=m
 CONFIG_MSI_LAPTOP=m
 CONFIG_SONY_LAPTOP=m
@@ -333,6 +334,10 @@
 
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_CPU_IDLE=y
+# CONFIG_CPU_IDLE_GOV_LADDER is not set
+CONFIG_CPU_IDLE_GOV_MENU=y
+
 
 CONFIG_THINKPAD_ACPI=m
 # CONFIG_THINKPAD_ACPI_DEBUG is not set
@@ -343,11 +348,14 @@
 CONFIG_DMIID=y
 
 CONFIG_VIRTUALIZATION=y
+CONFIG_PARAVIRT_GUEST=y
 CONFIG_VMI=y
 CONFIG_LGUEST=m
+CONFIG_LGUEST_GUEST=y
 # CONFIG_XEN is not set
 # CONFIG_HVC_XEN is not set
 
 CONFIG_DMADEVICES=y
 CONFIG_INTEL_IOATDMA=m
 
+CONFIG_SENSORS_I5K_AMB=m


Index: config-x86_64-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-x86_64-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-x86_64-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-x86_64-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -1,3 +1,4 @@
+CONFIG_64BIT=y
 CONFIG_UID16=y
 # CONFIG_X86_64_XEN is not set
 # CONFIG_MK8 is not set
@@ -12,6 +13,7 @@
 # CONFIG_NUMA_EMU is not set
 CONFIG_NR_CPUS=64
 CONFIG_X86_POWERNOW_K8=y
+# CONFIG_X86_P4_CLOCKMOD is not set
 CONFIG_IA32_EMULATION=y
 # CONFIG_IA32_AOUT is not set
 # CONFIG_IOMMU_DEBUG is not set
@@ -24,6 +26,12 @@
 CONFIG_EDD=m
 CONFIG_PCI_BIOS=y
 CONFIG_PCI_MMCONFIG=y
+CONFIG_DMAR=y
+CONFIG_DMAR_GFX_WA=y
+
+CONFIG_EFI=y
+CONFIG_EFI_VARS=y
+CONFIG_EFI_PCDP=y
 
 CONFIG_I2O=m
 CONFIG_I2O_BLOCK=m
@@ -62,6 +70,8 @@
 CONFIG_ACPI=y
 CONFIG_ACPI_AC=m
 # CONFIG_ACPI_ASUS is not set
+CONFIG_ACPI_PROCFS_POWER=y
+CONFIG_ACPI_SYSFS_POWER=y
 CONFIG_ACPI_BATTERY=m
 CONFIG_ACPI_BAY=m
 CONFIG_ACPI_BLACKLIST_YEAR=0
@@ -76,7 +86,6 @@
 CONFIG_ACPI_PROCFS=y
 CONFIG_ACPI_SBS=m
 CONFIG_ACPI_SLEEP=y
-# CONFIG_ACPI_PROCFS_SLEEP is not set
 CONFIG_ACPI_THERMAL=y
 CONFIG_ACPI_TOSHIBA=m
 CONFIG_ACPI_POWER=y
@@ -86,6 +95,7 @@
 CONFIG_ACPI_PROC_EVENT=y
 
 CONFIG_ASUS_LAPTOP=m
+CONFIG_EEEPC=m
 CONFIG_FUJITSU_LAPTOP=m
 CONFIG_MSI_LAPTOP=m
 CONFIG_SONY_LAPTOP=m
@@ -101,13 +111,11 @@
 CONFIG_HOTPLUG_PCI_IBM=m
 # CONFIG_HOTPLUG_PCI_CPCI is not set
 CONFIG_HOTPLUG_PCI_PCIE=m
-# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
 # SHPC has half-arsed PCI probing, which makes it load on too many systems
 CONFIG_HOTPLUG_PCI_SHPC=m
 CONFIG_HPET=y
 # CONFIG_HPET_MMAP is not set
 # CONFIG_HPET_RTC_IRQ is not set
-CONFIG_HPET_EMULATE_RTC=y
 CONFIG_PM=y
 
 CONFIG_IEEE80211=m
@@ -148,7 +156,6 @@
 CONFIG_I2C_SIS96X=m
 CONFIG_I2C_VIA=m
 CONFIG_I2C_VIAPRO=m
-CONFIG_I2C_ISA=m
 
 CONFIG_DELL_RBU=m
 CONFIG_DCDBAS=m
@@ -165,7 +172,6 @@
 CONFIG_EDAC_I82875P=m
 CONFIG_EDAC_I82860=m
 CONFIG_EDAC_I82975X=m
-CONFIG_EDAC_K8=m
 CONFIG_EDAC_R82600=m
 
 CONFIG_SCHED_MC=y
@@ -225,9 +231,17 @@
 
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
+CONFIG_CPU_IDLE=y
+# CONFIG_CPU_IDLE_GOV_LADDER is not set
+CONFIG_CPU_IDLE_GOV_MENU=y
 
 CONFIG_VIRTUALIZATION=y
 
 CONFIG_DMADEVICES=y
 CONFIG_INTEL_IOATDMA=m
 
+CONFIG_SENSORS_I5K_AMB=m
+
+# CONFIG_X86_MCE is not set
+
+CONFIG_SPARSEMEM_VMEMMAP=y


Index: config-xen-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-xen-generic,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-xen-generic	29 Oct 2007 17:29:06 -0000	1.2
+++ config-xen-generic	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -1,72 +1,6 @@
-
-CONFIG_XEN_PCIDEV_FRONTEND=y
-# CONFIG_XEN_PCIDEV_FE_DEBUG is not set
-
-
 CONFIG_XEN=y
-CONFIG_XEN_INTERFACE_VERSION=0x00030202
-
-#
-# XEN
-#
-CONFIG_XEN_PRIVILEGED_GUEST=y
-# CONFIG_XEN_UNPRIVILEGED_GUEST is not set
-CONFIG_XEN_PRIVCMD=y
-CONFIG_XEN_XENBUS_DEV=y
-CONFIG_XEN_BACKEND=y
-CONFIG_XEN_BLKDEV_BACKEND=m
-CONFIG_XEN_BLKDEV_TAP=m
-CONFIG_XEN_NETDEV_BACKEND=m
-# CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
-CONFIG_XEN_NETDEV_LOOPBACK=m
-CONFIG_XEN_PCIDEV_BACKEND=m
-CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
-# CONFIG_XEN_PCIDEV_BACKEND_PASS is not set
-# CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_TPMDEV_BACKEND is not set
+CONFIG_HVC_XEN=y
+CONFIG_XENCTRL=y
 CONFIG_XEN_BLKDEV_FRONTEND=m
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
-CONFIG_XEN_SCRUB_PAGES=y
-# CONFIG_XEN_DISABLE_SERIAL is not set
-CONFIG_XEN_SYSFS=y
-CONFIG_XEN_COMPAT_030002_AND_LATER=y
-# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
-CONFIG_XEN_COMPAT_030002=y
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
-CONFIG_HAVE_IRQ_IGNORE_UNHANDLED=y
-CONFIG_NO_IDLE_HZ=y
-CONFIG_XEN_UTIL=y
-CONFIG_XEN_BALLOON=y
-CONFIG_XEN_DEVMEM=y
-CONFIG_XEN_SKBUFF=y
-CONFIG_XEN_REBOOT=y
-CONFIG_XEN_SMPBOOT=y
-
-# Microcode needs sys_mlock & sys_munlock that are not exported
-# it needs to be compiled in
-# FIXME: This isn't going to work as of .19, due to firmware loader
-# not being available that early in boot. This will cause long pauses during boot.
-CONFIG_MICROCODE=y
-
-# TPM is not working, somebody have to merge the xen bits
-# CONFIG_TCG_TPM is not set
-
-# frequency scaling really needs to be done in the hypervisor instead
-# CONFIG_CPU_FREQ is not set
-
-# need to set the serial stuff up like this or serial console doesn't
-# work quite right in dom0.  ick.
-CONFIG_SERIAL_8250=m
-# CONFIG_SERIAL_8250_CONSOLE is not set
-
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ_250=y
-
-# xen and kvm conflict
-# CONFIG_KVM is not set
-# CONFIG_KVM_INTEL is not set
-# CONFIG_KVM_AMD is not set
 


Index: config-xen-ia64
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-xen-ia64,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-xen-ia64	29 Oct 2007 17:29:06 -0000	1.2
+++ config-xen-ia64	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -1,25 +0,0 @@
-# CONFIG_IA64_GENERIC is not set
-CONFIG_IA64_DIG=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM_MANUAL=y
-CONFIG_FORCE_MAX_ZONEORDER=11
-
-CONFIG_XEN=y
-CONFIG_XEN_IA64_DOM0_VP=y
-CONFIG_XEN_DISABLE_SERIAL=y
-# CONFIG_XEN_PCIDEV_BACKEND is not set
-# CONFIG_XEN_PCIDEV_BACKEND_VPCI is not set
-# CONFIG_XEN_PCIDEV_BACKEND_PASS is not set
-# CONFIG_XEN_PCIDEV_BE_DEBUG is not set
-# CONFIG_XEN_TPMDEV_BACKEND is not set
-
-# internal #defines conflict with xen-ia64
-# CONFIG_FB_NEOMAGIC is not set
-
-# don't work, missing symbols
-# CONFIG_KEXEC is not set
-# CONFIG_CRASH_DUMP is not set
-
-# Missing function not exported
-# CONFIG_XEN_BLKDEV_TAP is not set


Index: config-xen-x86
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-xen-x86,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-xen-x86	29 Oct 2007 17:29:06 -0000	1.2
+++ config-xen-x86	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -1,4 +0,0 @@
-
-# CONFIG_X86_PC is not set
-CONFIG_X86_XEN=y
-# CONFIG_X86_GENERICARCH is not set


Index: config-xen-x86_64
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/config-xen-x86_64,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- config-xen-x86_64	29 Oct 2007 17:29:06 -0000	1.2
+++ config-xen-x86_64	18 Feb 2008 16:55:16 -0000	1.2.4.1
@@ -1,8 +0,0 @@
-# things we want different from i686 xen
-
-CONFIG_X86_64=y
-
-# CONFIG_X86_XEN is not set
-CONFIG_X86_64_XEN=y
-
-CONFIG_GENERIC_CPU=y


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/kernel.spec,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- kernel.spec	15 Feb 2008 15:03:30 -0000	1.11
+++ kernel.spec	18 Feb 2008 16:55:16 -0000	1.11.2.1
@@ -1,6 +1,3 @@
-# we are kernel-xen-2.6!
-%define xen_package_magic 1
-
 Summary: The Linux kernel (the core of the Linux operating system)
 
 # For a stable, released kernel, released_kernel should be 1. For rawhide
@@ -19,33 +16,22 @@
 
 # fedora_build defines which build revision of this kernel version we're
 # building. Rather than incrementing forever, as with the prior versioning
-# setup, the trick below will allow us to use the automatic CVS Revision keyword
-# expansion, without breaking release number ordering.
-#
-# CVS Revision 1.42 was after RPM Release 2925.14. We do some math to
-# increase the Release number starting from 2926
+# setup, we set fedora_cvs_origin to the current cvs revision s/1.// of the
+# 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 baserevision 42
-%define baserelease 2926
-%define fedora_build %(R="$Revision$"; \
-	# be careful: '%%' becomes '%' below \
-	R="${R%% \$}"; R="${R##: 1.}"; \
-	# keep anything after the first dot, so this won't \
-	# break horribily when using branches \
-	# (e.g. 1.42.1.2.3.4 will become 1.2926.1.2.3.4) \
-	r1="${R%%%%.*}";rest="${R#$r1}"; \
-	# now, the math: \
-	echo `expr '(' $r1 - %{baserevision} ')' + %{baserelease}`$rest)
+%define fedora_cvs_origin 384
+%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 21
+%define base_sublevel 24
 
 ## If this is a released kernel ##
 %if 0%{?released_kernel}
 # Do we have a 2.6.21.y update to apply?
-%define stable_update 7
+%define stable_update 0
 # Set rpm version accordingly
 %if 0%{?stable_update}
 %define stablerev .%{stable_update}
@@ -59,7 +45,7 @@
 # The rc snapshot level
 %define rcrev 0
 # The git snapshot level
-%define gitrev 17
+%define gitrev 0
 # Set rpm version accordingly
 %define rpmversion 2.6.%{upstream_sublevel}
 %endif
@@ -92,6 +78,8 @@
 %define with_headers   %{?_without_headers:   0} %{?!_without_headers:   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}
 
 # Additional options for user-friendly one-off kernel building:
 #
@@ -104,55 +92,15 @@
 # Only build the xen kernel (--with xenonly):
 %define with_xenonly   %{?_with_xenonly:      1} %{?!_with_xenonly:      0}
 
-# Whether or not to do C=1 builds with sparse
-%define usesparse 0
-%if "%fedora" >= "7"
-%define usesparse 1
-%endif
-
-# defaults for the non-xen package:
-
-# don't include xen patches
-%define includexen 0
-
-# don't build xen variant
-%define with_xen 0
+# should we do C=1 builds with sparse
+%define with_sparse	%{?_with_sparse:      1} %{?!_with_sparse:      0}
 
-# Install vdso files
-%define do_vdso_install 1
-
-
-# Magic that will be enabled for the kernel-xen-2.6 Fedora package:
-%if 0%{?xen_package_magic}
-
-# Include the Xen patches
+# Whether or not to apply the Xen patches -- leave this enabled
 %define includexen 1
-
-# Enable the xen variant
-%define with_xen 1
-
-# No vdso files
-%define do_vdso_install 0
-
-# Disable all other variants
+# Disable non-xen sub-packages under kernel-xen-2.6
 %define with_xenonly 1
-
-# No kernel-headers
 %define with_headers 0
 
-
-# We don't build the .config files dynamically, currently
-%define preconfigured 1
-
-# The main package is called kernel-xen-2.6
-%define variant -xen-2.6
-
-# However the -xen variant will be called kernel-xen
-%define variantbase kernel
-
-%endif   # (xen_package_magic)
-
-
 # Set debugbuildsenabled to 1 for production (build separate debug kernels)
 #  and 0 for rawhide (all kernels are debug kernels).
 # See also 'make debug' and 'make release'.
@@ -178,9 +126,9 @@
 %define pkg_release 0.%{fedora_build}%{?rctag}%{?gittag}%{?buildid}%{?dist}
 %endif
 
-%define mainpkgname kernel%{?variant}
+%define mainpkgname kernel-xen-2.6
 %if !0%{?variantbase:1}
-%define variantbase %{mainpkgname}
+%define variantbase kernel
 %endif
 
 # The kernel tarball/base version
@@ -191,8 +139,8 @@
 %define xen_hv_version 3.2.0
 %define xen_hv_dirname xen-%{xen_hv_version}
 %define xen_flags verbose=y crash_debug=y
-%define xen_target vmlinuz
-%define xen_image vmlinuz
+%define xen_target bzImage
+%define xen_image arch/x86/boot/bzImage
 
 %define KVERREL %{PACKAGE_VERSION}-%{PACKAGE_RELEASE}
 %define hdrarch %_target_cpu
@@ -208,6 +156,7 @@
 %if %{nopatches}
 %define includexen 0
 %define with_xen 0
+%define with_bootwrapper 0
 %define variant -vanilla
 %else
 %define variant_fedora -fedora
@@ -215,9 +164,10 @@
 
 %define using_upstream_branch 0
 %if 0%{?upstream_branch:1}
+%define stable_update 0
 %define using_upstream_branch 1
 %define variant -%{upstream_branch}%{?variant_fedora}
-%define pkg_release %{upstream_branch_release}.%{pkg_release}
+%define pkg_release 0.%{fedora_build}%{upstream_branch_tag}%{?buildid}%{?dist}
 %endif
 
 %if !%{debugbuildsenabled}
@@ -282,8 +232,8 @@
 %define with_pae 0
 %endif
 
-# xen only builds on i686, x86_64 and ia64
-%ifnarch i686 x86_64 ia64
+# xen only builds on i686
+%ifnarch i686
 %define with_xen 0
 %endif
 
@@ -316,9 +266,14 @@
 %define all_arch_configs kernel-%{version}-*.config
 %endif
 
+# bootwrapper is only on ppc
+%ifnarch ppc ppc64
+%define with_bootwrapper 0
+%endif
+
 # sparse blows up on ppc64
 %ifarch ppc64 ppc alpha sparc64
-%define usesparse 0
+%define with_sparse 0
 %endif
 
 # Per-arch tweaks
@@ -396,7 +351,7 @@
 
 %if %{nopatches}
 # XXX temporary until last vdso patches are upstream
-%define vdso_arches %{nil}
+%define vdso_arches ppc ppc64
 %endif
 
 %if %{nopatches}%{using_upstream_branch}
@@ -415,7 +370,7 @@
 
 # We don't build a kernel on i386; we only do kernel-headers there,
 # and we no longer build for 31bit S390. Same for 32bit sparc.
-%define nobuildarches i386 s390 sparc
+%define nobuildarches i386 s390 sparc ppc
 
 %ifarch %nobuildarches
 %define with_up 0
@@ -500,12 +455,9 @@
 URL: http://www.kernel.org/
 Version: %{rpmversion}
 Release: %{pkg_release}
-# non-xen kernel says:
-# > DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
-# > SET %%nobuildarches (ABOVE) INSTEAD
-# However kernel-xen-2.6 can ignore this warning because it is not responsible
-# for generating the kernel-headers packages.
-ExclusiveArch: noarch i686 x86_64
+# DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
+# SET %%nobuildarches (ABOVE) INSTEAD
+ExclusiveArch: noarch i686
 ExclusiveOS: Linux
 
 %kernel_reqprovconf
@@ -520,8 +472,8 @@
 BuildRequires: module-init-tools, patch >= 2.5.4, bash >= 2.03, sh-utils, tar
 BuildRequires: bzip2, findutils, gzip, m4, perl, make >= 3.78, diffutils, gawk
 BuildRequires: gcc >= 3.4.2, binutils >= 2.12, redhat-rpm-config
-%if %{usesparse}
-BuildRequires: sparse >= 0.3
+%if %{with_sparse}
+BuildRequires: sparse >= 0.4.1
 %endif
 BuildConflicts: rhbuildsys(DiskFree) < 500Mb
 
@@ -583,12 +535,6 @@
 Source91: config-sparc64
 Source92: config-sparc64-smp
 
-Source100: kernel-%{version}-i686-xen.config
-Source101: kernel-%{version}-x86_64-xen.config
-
-%if %{using_upstream_branch}
-### BRANCH PATCH ###
-%else
 # Here should be only the patches up to the upstream canonical Linus tree.
 
 # For a stable release kernel
@@ -612,339 +558,197 @@
 %endif
 %endif
 
+%if %{using_upstream_branch}
+### BRANCH PATCH ###
 %endif
 
 %if !%{nopatches}
 
-# compile fix with latest glibc
-Patch1: linux-2.6-sumversion-limits-dot-h.patch
+Patch21: linux-2.6-utrace-tracehook.patch
+Patch22: linux-2.6-utrace-tracehook-ia64.patch
+Patch23: linux-2.6-utrace-tracehook-sparc64.patch
+Patch24: linux-2.6-utrace-tracehook-s390.patch
+Patch25: linux-2.6-utrace-tracehook-um.patch
+Patch26: linux-2.6-utrace-tracehook-avr32.patch
+Patch27: linux-2.6-utrace-regset.patch
+Patch28: linux-2.6-utrace-regset-ia64.patch
+Patch29: linux-2.6-utrace-regset-sparc64.patch
+Patch30: linux-2.6-utrace-regset-s390.patch
+Patch31: linux-2.6-utrace-regset-avr32.patch
+Patch32: linux-2.6-utrace-core.patch
+Patch33: linux-2.6-utrace-ptrace-compat.patch
+Patch34: linux-2.6-utrace-ptrace-compat-ia64.patch
+Patch35: linux-2.6-utrace-ptrace-compat-sparc64.patch
+Patch36: linux-2.6-utrace-ptrace-compat-s390.patch
+Patch37: linux-2.6-utrace-ptrace-compat-avr32.patch
+
+Patch41: linux-2.6-sysrq-c.patch
+Patch42: linux-2.6-x86-tune-generic.patch
+Patch75: linux-2.6-x86-debug-boot.patch
+
+Patch85: linux-2.6-alsa-rc4-mm1.patch
+Patch86: linux-2.6-alsa-support-sis7019.patch
+
+Patch120: linux-2.6-powerpc-bootwrapper.patch
+Patch121: linux-2.6-pasemi-for-2.6.25.patch
+Patch122: linux-2.6-pasemi-reserve-i2c.patch
+Patch123: linux-2.6-ppc-rtc.patch
+Patch124: linux-2.6-gelic-fixups.patch
+Patch125: linux-2.6-gelic-wireless-v2.patch
+Patch126: linux-2.6-gelic-wireless-fix.patch
+Patch130: linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch
+Patch131: linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch
+Patch132: linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch
+Patch133: linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch
+Patch134: linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch
+Patch140: linux-2.6-ps3-ehci-iso.patch
+Patch141: linux-2.6-ps3-storage-alias.patch
+Patch142: linux-2.6-ps3-legacy-bootloader-hack.patch
+Patch143: linux-2.6-g5-therm-shutdown.patch
 
-# Patches 10 through 99 are for things that are going upstream really soon.
-Patch11: nouveau-drm.patch
-
-Patch12: linux-2.6-fix-pmops-1.patch
-Patch13: linux-2.6-fix-pmops-2.patch
-Patch14: linux-2.6-fix-pmops-3.patch
-Patch15: linux-2.6-fix-pmops-4.patch
+%endif
 
-# DRM bits for 965
-Patch17: linux-2.6-i965gm-support.patch
+Patch150: linux-2.6-build-nonintconfig.patch
 
-# enable sysrq-c on all kernels, not only kexec
-Patch20: linux-2.6-sysrq-c.patch
+%if !%{nopatches}
 
-# utrace
-Patch30: linux-2.6-utrace-sig_kernel-macros.patch
-Patch31: linux-2.6-utrace-recalc_sigpending_and_wake.patch
-Patch32: linux-2.6-utrace-tracehook.patch
-Patch33: linux-2.6-utrace-tracehook-ia64.patch
-Patch34: linux-2.6-utrace-tracehook-sparc64.patch
-Patch35: linux-2.6-utrace-tracehook-s390.patch
-Patch36: linux-2.6-utrace-tracehook-um.patch
-Patch37: linux-2.6-utrace-regset.patch
-Patch38: linux-2.6-utrace-regset-ia64.patch
-Patch39: linux-2.6-utrace-regset-sparc64.patch
-Patch40: linux-2.6-utrace-regset-s390.patch
-Patch41: linux-2.6-utrace-core.patch
-Patch42: linux-2.6-utrace-ptrace-compat.patch
-Patch43: linux-2.6-utrace-ptrace-compat-ia64.patch
-Patch44: linux-2.6-utrace-ptrace-compat-sparc64.patch
-Patch45: linux-2.6-utrace-ptrace-compat-s390.patch
-
-#xen bits of utrace patches:
-Patch52: linux-2.6-utrace-tracehook-xen.patch
-Patch62: linux-2.6-utrace-ptrace-compat-xen.patch
-
-
-# build-id stuff (http://fedoraproject.org/wiki/Releases/FeatureBuildId)
-Patch70: linux-2.6-use-build-id-ld-option.patch
-
-# Patches 100 through 500 are meant for architecture patches
-
-# 200 - 299   x86(-64)
-
-Patch200: linux-2.6-x86-tune-generic.patch
-Patch201: linux-2.6-x86-vga-vidfail.patch
-Patch202: linux-2.6-x86-64-edac-support.patch
-Patch203: linux-2.6-x86_64-silence-up-apic-errors.patch
-Patch204: linux-2.6-x86_64-silence-up-apic-errors-xen.patch
-Patch205: linux-2.6-x86-dont-delete-cpu_devs-data.patch
-Patch206: linux-2.6-x86-fsc-interrupt-controller-quirk.patch
-Patch207: linux-2.6-x86-dell-hpet.patch
-Patch209: linux-2.6-x86-64_pmtrace.patch
-
-
-# 300 - 399   ppc(64)
-Patch300: linux-2.6-g5-therm-shutdown.patch
-Patch301: linux-2.6-powerpc-slabalign.patch
-Patch302: linux-2.6-ppc-data-exception.patch
-Patch303: linux-2.6-ppc32-ucmpdi2.patch
-Patch304: linux-2.6-ibmvscsi-schizo.patch
-Patch305: linux-2.6-pmac-zilog.patch
-Patch306: linux-2.6-powerpc-reserve-initrd-1.patch
-Patch307: linux-2.6-powerpc-reserve-initrd-2.patch
-Patch308: linux-2.6-cell-spu-device-tree.patch
-Patch309: linux-2.6-cell-spufs-fixes.patch
-
-Patch310: linux-2.6-common-uevent.patch
-Patch311: linux-2.6-uevent-macio.patch
-Patch312: linux-2.6-uevent-of_platform.patch
-Patch313: linux-2.6-uevent-ebus.patch
-
-Patch330: linux-2.6-powermac-generic-suspend-1.patch
-Patch331: linux-2.6-powermac-generic-suspend-2.patch
-Patch332: linux-2.6-powermac-generic-suspend-3.patch
-Patch333: linux-2.6-powermac-generic-suspend-4.patch
-
-Patch340: linux-2.6-mpc52xx-sdma.patch
-Patch341: linux-2.6-mpc52xx-fec.patch
-
-# Patches from ps3-linux-patches.git (2007-05-04)
-Patch350: linux-2.6-ps3-stable-patches.patch
-Patch351: linux-2.6-ps3-smp-boot.patch
-Patch352: linux-2.6-ps3-system-bus-rework.patch
-Patch353: linux-2.6-ps3-kexec.patch
-Patch354: linux-2.6-ps3-gelic.patch
-Patch355: linux-2.6-ps3-gelic-wireless.patch
-Patch356: linux-2.6-ps3-ehci-iso.patch
-Patch357: linux-2.6-ps3-clear-spu-irq.patch
-Patch358: linux-2.6-ps3-wrap-spu-runctl.patch
-# Ignore the SPE logo bits. Cute, but not exactly necessary
-Patch359: linux-2.6-ps3-storage.patch
-Patch360: linux-2.6-ps3-sound.patch
-Patch361: linux-2.6-ps3-device-init.patch
-Patch362: linux-2.6-ps3-system-bus-rework-2.patch
-
-# And then some minor tweaks...
-Patch370: linux-2.6-ps3-memory-probe.patch
-Patch371: linux-2.6-ps3-legacy-ioport.patch
-Patch372: linux-2.6-ps3fb-panic.patch
-Patch373: linux-2.6-ps3-ethernet-modular.patch
-Patch374: linux-2.6-ps3-sound-autoload.patch
-Patch375: linux-2.6-ps3-ethernet-autoload.patch
-Patch376: linux-2.6-ps3av-export-header.patch
-Patch377: linux-2.6-ps3-usb-autoload.patch
-
-
-
-# 400 - 499   ia64
-
-# 500 - 599   s390(x)
-
-# 600 - 699   sparc(64)
-
-#
-# Patches 800 through 899 are reserved for bugfixes to the core system
-# and patches related to how RPMs are build
-#
-Patch800: linux-2.6-build-nonintconfig.patch
-
-# Exec-shield.
-Patch810: linux-2.6-execshield.patch
-Patch811: linux-2.6-execshield-xen.patch
-
-# Module signing infrastructure.
-Patch900: linux-2.6-modsign-mpilib.patch
-Patch901: linux-2.6-modsign-crypto.patch
-Patch902: linux-2.6-modsign-include.patch
-Patch903: linux-2.6-modsign-verify.patch
-Patch904: linux-2.6-modsign-ksign.patch
-Patch905: linux-2.6-modsign-core.patch
-Patch906: linux-2.6-modsign-script.patch
-
-# 950 - 999 Xen
-# linux-2.6.21.7-xen-3.1.0.patch patch generated by
-# 'hg diff -rd91e11100fb0 -rd610071e6045 -X .hgtags' on
-# http://hg.et.redhat.com/kernel-dev/ehabkost/linux-2.6.21.y-xen-3.1.0
-Patch950: linux-2.6.21.7-xen-3.1.0.patch.bz2
-Patch960: linux-2.6-xen-blkfront-wait-add.patch
-Patch961: linux-2.6-xen-backwards-time.patch
-Patch962: linux-2.6-xen-irq_vector-uninitialize.patch
-
-# Fix sleazy-FPU implementation
-Patch963: linux-2.6-xen-sleazy-fpu-i386.patch
-Patch964: linux-2.6-xen-sleazy-fpu-x86_64.patch
-
-# Fix VM_PFNMAP BUG_ON()
-Patch965: linux-2.6-xen-privcmd-use-nopfn.patch
-
-# Remove bogus WARN_ON() from synchronize_irq() (bug #293451)
-Patch966: linux-2.6-xen-fix-irq-warn-mismerge.patch
-
-# virt-install --nographics --paravirt fix (bug #348931)
-Patch967: linux-2.6-xen-paravirt-nographics-pvfb-fix.patch
-
-#
-# Patches 1000 to 5000 are reserved for bugfixes to drivers and filesystems
-#
-
-Patch1010: linux-2.6-debug-sizeof-structs.patch
-Patch1011: linux-2.6-debug-slab-backtrace.patch
-Patch1012: linux-2.6-debug-nmi-timeout.patch
-Patch1013: linux-2.6-debug-taint-vm.patch
-Patch1015: linux-2.6-debug-spinlock-taint.patch
-Patch1016: linux-2.6-debug-extra-warnings.patch
-Patch1019: linux-2.6-debug-must_check.patch
-Patch1020: linux-2.6-debug-no-quiet.patch
-Patch1021: linux-2.6-debug-boot-delay.patch
-Patch1022: linux-2.6-debug-sysfs-crash-debugging.patch
-Patch1023: linux-2.6-debug-sysfs-crash-debugging-xen.patch
-
-# Restrict /dev/mem usage.
-Patch1050: linux-2.6-devmem.patch
-Patch1051: linux-2.6-devmem-xen.patch
-
-# Provide read only /dev/crash driver.
-Patch1060: linux-2.6-crash-driver.patch
-Patch1061: linux-2.6-crash-driver-xen.patch
-
-# SCSI bits.
-Patch1100: linux-2.6-scsi-bounce-isa.patch
-Patch1106: linux-2.6-scsi-cpqarray-set-master.patch
-Patch1107: linux-2.6-3w-9xxx-mem_len.patch
-
-# NIC driver fixes
-Patch1300: linux-2.6-net-e1000-no-msi-warning.patch
-
-# e1000e backport
-Patch1350: linux-2.6-netdev-e1000e-01.patch
-Patch1351: linux-2.6-netdev-e1000e-02.patch
-Patch1352: linux-2.6-netdev-e1000e-03.patch
-Patch1353: linux-2.6-netdev-e1000e-04.patch
-Patch1354: linux-2.6-netdev-e1000e-05.patch
-Patch1355: linux-2.6-netdev-e1000e-06.patch
-Patch1356: linux-2.6-netdev-e1000e-07.patch
-Patch1357: linux-2.6-netdev-e1000e-08.patch
-Patch1358: linux-2.6-netdev-e1000e-09.patch
-Patch1359: linux-2.6-netdev-e1000e-10.patch
-Patch1360: linux-2.6-netdev-e1000e-backport.patch
-
-# Filesystem stuff.
-# Squashfs
-Patch1400: linux-2.6-squashfs.patch
-# GFS2
-Patch1410: linux-2.6-gfs2-update.patch
-
-
-# Networking core.
-Patch1500: linux-2.6-net-silence-noisy-printks.patch
-
-# Misc bits.
-Patch1600: linux-2.6-module_version.patch
-Patch1601: linux-2.6-sha_alignment.patch
-Patch1610: linux-2.6-input-kill-stupid-messages.patch
-Patch1620: linux-2.6-ondemand-timer.patch
-Patch1630: linux-2.6-kvm-19.patch
-Patch1631: linux-2.6-amd-disabled-svm-detect.patch
-Patch1632: linux-2.6-amd-disabled-svm-detect-msr-1.patch
-Patch1633: linux-2.6-kvm-reinit-real-mode-tss.patch
-Patch1650: linux-2.6-serial-460800.patch
-Patch1660: linux-2.6-mm-udf-fixes.patch
-Patch1661: linux-2.6-udf-2.6.22-rc2-1-udf_data_corruption.patch
-Patch1662: linux-2.6-udf-2.6.22-rc4-1-udf_block_leak.patch
-Patch1670: linux-2.6-sysfs-inode-allocator-oops.patch
-# checksum fixes (bug #223258)
-Patch1665: linux-2.6-disable-netback-checksum.patch
-
-Patch1690: linux-2.6-PT_LOAD-align.patch
-Patch1700: linux-2.6-dvb-spinlock.patch
-Patch1710: linux-2.6-nfs-noreaddirplus.patch
-Patch1711: linux-2.6-nfs-missing-braces.patch
-Patch1720: linux-2.6-proc-self-maps-fix.patch
-Patch1730: linux-2.6-suspend-ordering.patch
-Patch1740: linux-2.6-softlockup-disable.patch
-Patch1770: linux-2.6-optimise-spinlock-debug.patch
-Patch1771: linux-2.6-silence-noise.patch
-Patch1781: linux-2.6-softirq-printout-irq-trace-events.patch
-Patch1791: linux-2.6-libertas.diff
-Patch1792: linux-2.6-olpc-touchpad.diff
-Patch1793: linux-2.6-raid-autorun.patch
-Patch1794: linux-2.6-i82875-edac-pci-setup.patch
-Patch1795: linux-2.6-crap-sysfs-workaround.patch
-Patch1796: linux-2.6-oprofile-0.9.3.patch
-
-# SELinux/audit patches.
-Patch1801: linux-2.6-selinux-mprotect-checks.patch
-
-# no external module should use these symbols.
-Patch1910: linux-2.6-unexport-symbols.patch
-
-# VM bits.
-Patch2000: linux-2.6-vm-invalidate_mapping_pages-cond-resched.patch
-Patch2001: linux-2.6-vm-silence-atomic-alloc-failures.patch
-
-# Tweak some defaults.
-Patch2100: linux-2.6-defaults-fat-utf8.patch
-Patch2103: linux-2.6-defaults-unicode-vt.patch
-Patch2105: linux-2.6-defaults-nonmi.patch
-Patch2106: linux-2.6-defaults-pci_no_msi_mmconf.patch
-Patch2107: linux-2.6-usb-autosuspend-default-disable.patch
-
-# SATA Bits
-Patch2201: linux-2.6-libata-hpa.patch
-Patch2202: linux-2.6-libata-sata_nv-adma.patch
-Patch2203: linux-2.6-libata-ali-atapi-dma.patch
-Patch2204: linux-2.6-ata-quirk.patch
-Patch2206: linux-2.6-libata-sata_nv-wildcard-removal.patch
-Patch2207: linux-2.6-libata-pata-pcmcia-new-ident.patch
-Patch2208: linux-2.6-libata-atiixp-ids.patch
-Patch2209: linux-2.6-libata-pata-hpt3x2n-correct-revision-boundary.patch
-Patch2210: linux-2.6-libata-pata-sis-fix-timing.patch
-Patch2211: linux-2.6-libata-setxfer.patch
-Patch2212: linux-2.6-libata_ali_max_dma_speed.patch
-Patch2213: linux-2.6-ata-use-pio-for-non-16-byte-xfers.patch
-Patch2214: linux-2.6-ata-call-check-dma-with-qc-prepared.patch
-Patch2215: linux-2.6-libata-ich8m-add-pciid.patch
-Patch2216: linux-2.6-libata-pata_dma-param.patch
-Patch2217: linux-2.6-libata-ncq-blacklist-2.6.22-rc7.patch
-Patch2218: linux-2.6-libata-pata_it821x-partly-fix-dma.patch
-
-# ATA spindown
-Patch2220: linux-2.6-2110_scsi-sd-printing.patch
-Patch2221: linux-2.6-2111_sd-start-stop.patch
-Patch2222: linux-2.6-2112_libata-suspend.patch
-Patch2223: linux-2.6-2113_libata-spindown-compat.patch
-Patch2224: linux-2.6-2114_libata-shutdown-warning.patch
-Patch2225: linux-2.6-2115_libata-spindown-status.patch
-Patch2226: linux-2.6-2116_libata-remove-spindown-compat.patch
-Patch2227: linux-2.6-2117_sata-via-suspend.patch
-Patch2228: linux-2.6-2118_scsi-constants.patch
-
-# Wireless bits
-Patch2300: linux-2.6-wireless.patch
-Patch2301: git-wireless-dev.patch
-Patch2302: linux-2.6-bcm43xx-pci-neuter.patch
-
-# Assorted dyntick/clock/timer fixes.
-Patch2402: linux-2.6-acpi-keep-tsc-stable-when-lapic-timer-c2-ok-is-set.patch
-Patch2403: linux-2.6-clockevents-fix-resume-logic.patch
-
-# ACPI bits
-Patch2500: linux-2.6-acpi-unblacklist-dell-gx240.patch
-Patch2501: linux-2.6-acpi-dock-oops.patch
-Patch2502: linux-2.6-acpi-boot-regression.patch
-Patch2503: linux-2.6-acpi-preserve-ebx-in-acpi_copy_wakeup_routine.patch
-
-# Excessive wakeups.
-Patch2600: linux-2.6-wakeups-hdaps.patch
-
-Patch3000: linux-2.6-acpi-config_pm-poweroff.patch
-
-# Add the new firewire stack. Diff between the v2.6.20 tag and commit
-# 5468ee91741092a711327628c7c524a4d4d0cd6a in the linux1394 git tree.
-Patch5000: linux-2.6-firewire.patch
-Patch5001: linux-2.6-firewire-be32-fix.patch
-
-# Security:
-
-# CVE-2008-0600 (bug #432517)
-Patch6000: linux-2.6-cve-2008-0600.patch
-
-#
-# 10000 to 20000 is for stuff that has to come last due to the
-# amount of drivers they touch. But only these should go here.
-# Not patches you're too lazy for to put in the proper place.
-#
+Patch160: linux-2.6-execshield.patch
+Patch250: linux-2.6-debug-sizeof-structs.patch
+Patch260: linux-2.6-debug-nmi-timeout.patch
+Patch270: linux-2.6-debug-taint-vm.patch
+Patch280: linux-2.6-debug-spinlock-taint.patch
+Patch330: linux-2.6-debug-no-quiet.patch
+Patch350: linux-2.6-devmem.patch
+Patch370: linux-2.6-crash-driver.patch
+Patch400: linux-2.6-scsi-cpqarray-set-master.patch
+Patch402: linux-2.6-scsi-mpt-vmware-fix.patch
+Patch420: linux-2.6-squashfs.patch
+Patch430: linux-2.6-net-silence-noisy-printks.patch
+Patch450: linux-2.6-input-kill-stupid-messages.patch
+Patch460: linux-2.6-serial-460800.patch
+Patch510: linux-2.6-silence-noise.patch
+Patch570: linux-2.6-selinux-mprotect-checks.patch
+Patch571: linux-2.6-selinux-strip-leading-slashes.patch
+Patch590: linux-2.6-unexport-symbols.patch
+Patch610: linux-2.6-defaults-fat-utf8.patch
+Patch660: linux-2.6-libata-ali-atapi-dma.patch
+Patch670: linux-2.6-ata-quirk.patch
+Patch680: linux-2.6-wireless.patch
+Patch681: linux-2.6-wireless-pending.patch
+Patch690: linux-2.6-at76.patch
+Patch691: linux-2.6-rndis_wlan.patch
+Patch692: linux-2.6-ath5k-use-soft-wep.patch
+Patch820: linux-2.6-compile-fixes.patch
+Patch821: linux-2.6-compile-fix-gcc-43.patch
+Patch1101: linux-2.6-default-mmf_dump_elf_headers.patch
+Patch1102: linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch
+Patch1400: linux-2.6-smarter-relatime.patch
+Patch1503: linux-2.6-xfs-xfs_mount-refactor.patch
+Patch1504: linux-2.6-xfs-optimize-away-realtime-tests.patch
+Patch1509: linux-2.6-xfs-setfattr-32bit-compat.patch
+Patch1515: linux-2.6-lirc.patch
+Patch1520: linux-2.6-dcdbas-autoload.patch
+
+# drm-mm catchup (modesetting, ...)
+Patch1801: linux-2.6-drm-mm.patch
+Patch1800: linux-2.6-agp-mm.patch
+# nouveau + drm fixes
+Patch1802: nouveau-drm.patch
+Patch1803: linux-2.6-ppc32-ucmpdi2.patch
+Patch1804: linux-2.6-drm-radeon-update.patch
+Patch1805: linux-2.6-git-initial-r500-drm.patch
+
+# Work around E1000 corrupt EEPROM problem.
+Patch2000: linux-2.6-e1000-corrupt-eeprom-checksum.patch
+Patch2001: linux-2.6-netdev-e1000-disable-alpm.patch
+
+# fix null pointer deref in bonding driver
+Patch2010: linux-2.6-netdev-bonding-fix-null-deref.patch
+
+# atl2 network driver
+Patch2020: linux-2.6-netdev-atl2.patch
+
+# ext4 patches
+Patch2100: linux-2.6-ext4-linus-git.patch
+Patch2101: linux-2.6-ext4-stable-queue.patch
+
+# linux1394 git patches
+Patch2200: linux-2.6-firewire-git-update.patch
+Patch2201: linux-2.6-firewire-git-pending.patch
+
+# epoll lockdep annotation (bz #323411)
+Patch2205: linux-2.6-epoll-lockdep-annotation.patch
+
+# make USB EHCI driver respect "nousb" parameter
+Patch2300: linux-2.6-usb-ehci-hcd-respect-nousb.patch
+
+# acpi hotkey driver for asus eeepc
+Patch2350: linux-2.6-acpi-eeepc-hotkey.patch
+
+# usb video
+Patch2400: linux-2.6-uvcvideo.patch
+
+# kernel-xen patches start
+Patch5001: linux-2.6-0001-xen-debug-Add-xprintk-to-log-directly-via-hypercall.patch
+Patch5002: linux-2.6-0002-xen-dom0-Make-hvc_xen-console-work-for-dom0.patch
+Patch5003: linux-2.6-0003-xen-dom0-Initialize-xenbus-for-dom0.patch
+Patch5004: linux-2.6-0004-xen-dom0-Set-up-basic-IO-permissions-for-dom0.patch
+Patch5005: linux-2.6-0005-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch
+Patch5006: linux-2.6-0006-xen-dom0-Add-support-for-the-platform_ops-hypercall.patch
+Patch5007: linux-2.6-0007-xen-acpi-Enable-early-access-to-ACPI-tables.patch
+Patch5008: linux-2.6-0008-xen-dom0-Add-paravirt_ops-ioremap_page_range-for.patch
+Patch5009: linux-2.6-0009-MTRR-use-cpu_callout_map-instead-of-cpu_online_map.patch
+Patch5010: linux-2.6-0010-xen-mtrr-Add-mtrr_ops-support-for-Xen-mtrr.patch
+Patch5011: linux-2.6-0011-xen-mtrr-Don-t-enable-xen-mtrr-on-bare-metal.patch
+Patch5012: linux-2.6-0012-xen-mtrr-set-cpu-in-cpu_callout_map.patch
+Patch5013: linux-2.6-0013-xen-mtrr-Clean-up-the-num_var_ranges-CPU_UNKOWN-hac.patch
+Patch5014: linux-2.6-0014-xen-mtrr-Use-specific-cpu_has_foo-macros-instead-of.patch
+Patch5015: linux-2.6-0015-xen-mtrr-Kill-some-unneccessary-includes.patch
+Patch5016: linux-2.6-0016-xen-mtrr-No-need-to-explicitly-set-use_intel_if-0.patch
+Patch5017: linux-2.6-0017-xen-mtrr-Use-generic_validate_add_page.patch
+Patch5018: linux-2.6-0018-xen-mtrr-Implement-xen_get_free_region.patch
+Patch5019: linux-2.6-0019-xen-mtrr-Add-xen_-get-set-_mtrr-implementations.patch
+Patch5020: linux-2.6-0020-irq2.diff-from-Juan-Quintela.patch
+Patch5021: linux-2.6-0021-xen-dom0-Obvious-cpuid-fix-to-domU-handling.patch
+Patch5022: linux-2.6-0022-xen-debug-Diagnose-bind_virq_to_irq-errors.patch
+Patch5023: linux-2.6-0023-xen-traps-Revert-Juan-s-traps_32.c-changes-to-debug.patch
+Patch5024: linux-2.6-0024-xen-debug-Move-init_apic_mappings-after-trap-init.patch
+Patch5025: linux-2.6-0025-xen-debug-Trace-progress-in-trap_init-around-init.patch
+Patch5026: linux-2.6-0026-xen-apic-Disable-init_apic_mappings-when-under-CO.patch
+Patch5027: linux-2.6-0027-xen-debug-Log-entry-into-virtual-console-s-xen_init.patch
+Patch5028: linux-2.6-0028-xen-debug-Log-bind_virq_to_irq-events.patch
+Patch5029: linux-2.6-0029-xen-debug-Work-around-USB-issue-triggered-by-Xen-de.patch
+Patch5030: linux-2.6-0030-Remove-duplicated-dma_alloc-free_noncoherent-define.patch
+Patch5031: linux-2.6-0031-xem-dom0-Add-hypervisor-memory_exchange-descriptor.patch
+Patch5032: linux-2.6-0032-xen-dom0-add-virt_to_pfn-macro.patch
+Patch5033: linux-2.6-0033-xen-dom0-use-virt_to_pfn-where-appropriate.patch
+Patch5034: linux-2.6-0034-xen-dom0-Add-contiguous-region-support.patch
+Patch5035: linux-2.6-0035-xen-dom0-Don-t-mask-off-PCD-bits-from-pte-entries.patch
+Patch5036: linux-2.6-0036-xen-dom0-Remove-duplicate-xen_store_interface-assig.patch
+Patch5037: linux-2.6-0037-xen-dom0-Slightly-re-arrange-xenbus_probe_init-er.patch
+Patch5038: linux-2.6-0038-xen-dom0-Use-max_low_pfn-declaration-from-linux-boo.patch
+Patch5039: linux-2.6-0039-xen-dma-Add-dma_mapping_ops-indirection-for-32-bit.patch
+Patch5040: linux-2.6-0040-xen-dma-Remove-unused-32-bit-dma_ops-map_simple-me.patch
+Patch5041: linux-2.6-0041-xen-dma-Initial-commit-of-pci-xen.c-dma-mapping-fun.patch
+Patch5042: linux-2.6-0042-xen-dma-Add-calls-to-dma_ops-alloc-free_coherent-ho.patch
+Patch5043: linux-2.6-0043-xen-dma-Add-xen_alloc-free_coherent.patch
+Patch5044: linux-2.6-0044-xen-dma-Don-t-merge-bios-on-xen-pvops.patch
+Patch5045: linux-2.6-0045-xen-dom0-Minor-coding-style-issue-in-ISA-mapping-co.patch
+Patch5046: linux-2.6-0046-xen-dom0-Use-i-PAGE_SHIFT-instead-of-PAGE_DOWN-i.patch
+Patch5047: linux-2.6-0047-xen-dom0-Match-up-set_pte_mfn-prototype-with-the.patch
+Patch5048: linux-2.6-0048-xen-dom0-Reserve-ISA-address-space-earlier.patch
+Patch5049: linux-2.6-0049-xen-Add-empty-xenctrl-module.patch
+Patch5050: linux-2.6-0050-xen-dom0-Add-proc-xen-capabilities.patch
+Patch5051: linux-2.6-0051-xen-Add-proc-xen-privcmd.patch
+Patch5052: linux-2.6-0052-xen-dom0-Add-proc-xen-xsd_-port-kva.patch
+Patch5053: linux-2.6-0053-xen-Add-proc-xen-xenbus.patch
+Patch5054: linux-2.6-0054-xen-Add-dev-xen-evtchn.patch
+Patch5055: linux-2.6-0055-xen-Add-__init-__exit-notations-to-xenctrl-function.patch
+Patch5056: linux-2.6-0056-xen-Add-Xen-s-sys-hypervisor-interface.patch
+Patch5057: linux-2.6-0057-xen-dom0-Add-basic-proc-xen-balloon.patch
+Patch5058: linux-2.6-0058-xen-dom0-Re-work-privcmd_ioctl-a-little.patch
+Patch5059: linux-2.6-0059-xen-dom0-Add-IOCTL_PRIVCMD_MMAP.patch
+# kernel-xen patches end
 
 # Xen hypervisor patches (20000+)
 Patch20000: xen-compile-fix.patch
@@ -957,9 +761,6 @@
 # Include build-id notes on xen-syms
 Patch20005: xen-syms-build-id.patch
 
-
-
-
 %endif
 
 BuildRoot: %{_tmppath}/%{mainpkgname}-%{KVERREL}-root-%{_target_cpu}
@@ -995,6 +796,12 @@
 building most standard programs and are also needed for rebuilding the
 glibc package.
 
+%package bootwrapper
+Summary: Boot wrapper files for generating combined kernel + initrd images
+Group: Development/System
+%description bootwrapper
+Kernel-bootwrapper contains the wrapper code which makes bootable "zImage"
+files combining both kernel and initial ramdisk.
 
 %package -n %{mainpkgname}-debuginfo-common
 Summary: Kernel source files used by %{mainpkgname}-debuginfo packages
@@ -1082,8 +889,9 @@
 
 
 %define variant_summary The Linux kernel compiled with extra debugging enabled for PAE capable machines
-%kernel_variant_package PAE-debug
-%description -n %{variantbase}-PAE-debug
+%kernel_variant_package PAEdebug
+Obsoletes: %{variantbase}-PAEdebug
+%description -n %{variantbase}-PAEdebug
 This package includes a version of the Linux kernel with support for up to
 64GB of high memory. It requires a CPU with Physical Address Extensions (PAE).
 The non-PAE kernel can only address up to 4GB of memory.
@@ -1145,6 +953,13 @@
 %endif
 %endif
 
+%if %{with_xenonly}
+%if !%{with_xen}
+echo "Cannot build --with xenonly, xen build is disabled"
+exit 1
+%endif
+%endif
+
 # If the package has a variantbase set, the up (no variant suffix) packages would
 # be inconsistent (sometimes using %%{mainpkgname}, other using %%{variantbase})
 #
@@ -1159,63 +974,6 @@
 exit 1
 %endif
 
-
-
-
-# First we unpack the kernel tarball.
-# If this isn't the first make prep, we use links to the existing clean tarball
-# which speeds things up quite a bit.
-if [ ! -d kernel-%{kversion}/vanilla ]; then
-  # Ok, first time we do a make prep.
-  rm -f pax_global_header
-%setup -q -n kernel-%{kversion} -c
-  mv linux-%{kversion} vanilla
-else
-  # We already have a vanilla dir.
-  cd kernel-%{kversion}
-  if [ -d linux-%{kversion}.%{_target_cpu} ]; then
-     # Just in case we ctrl-c'd a prep already
-     rm -rf deleteme.%{_target_cpu}
-     # Move away the stale away, and delete in background.
-     mv linux-%{kversion}.%{_target_cpu} deleteme.%{_target_cpu}
-     rm -rf deleteme.%{_target_cpu} &
-  fi
-fi
-
-cp -rl vanilla linux-%{kversion}.%{_target_cpu}
-
-cd linux-%{kversion}.%{_target_cpu}
-
-%if 0%{?preconfigured}
-  # The .config files were already generated
-  cp $RPM_SOURCE_DIR/kernel-%{kversion}*.config .
-%else
-  # Drop some necessary files from the source dir into the buildroot
-  cp $RPM_SOURCE_DIR/config-* .
-  cp %{SOURCE15} .
-
-  # Dynamically generate kernel .config files from config-* files
-  make -f %{SOURCE20} VERSION=%{version} configs
-%endif
-
-
-#if a rhel kernel, apply the rhel config options
-%if 0%{?rhel}
-  for i in %{all_arch_configs}
-  do
-    mv $i $i.tmp
-    ./merge.pl config-rhel-generic $i.tmp > $i
-    rm $i.tmp
-  done
-  for i in kernel-%{version}-{i586,i686,i686-PAE,x86_64}*.config
-  do
-    echo i is this file  $i
-    mv $i $i.tmp
-    ./merge.pl config-rhel-x86-generic $i.tmp > $i
-    rm $i.tmp
-  done
-%endif
-
 patch_command='patch -p1 -F1 -s'
 ApplyPatch()
 {
@@ -1231,15 +989,43 @@
   esac
 }
 
-%if %{using_upstream_branch}
-### BRANCH APPLY ###
-%else
+# First we unpack the kernel tarball.
+# If this isn't the first make prep, we use links to the existing clean tarball
+# which speeds things up quite a bit.
 
 # Update to latest upstream.
+%if 0%{?released_kernel}
+%define vanillaversion 2.6.%{base_sublevel}
 # released_kernel with stable_update available case
 %if 0%{?stable_update}
-ApplyPatch patch-2.6.%{base_sublevel}.%{stable_update}.bz2
+%define vanillaversion 2.6.%{base_sublevel}.%{stable_update}
+%endif
+# non-released_kernel case
+%else
+%if 0%{?rcrev}
+%define vanillaversion 2.6.%{upstream_sublevel}-rc%{rcrev}
+%if 0%{?gitrev}
+%define vanillaversion 2.6.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}
+%endif
+%else
+# pre-{base_sublevel+1}-rc1 case
+%if 0%{?gitrev}
+%define vanillaversion 2.6.%{base_sublevel}-git%{gitrev}
+%endif
+%endif
+%endif
+
+if [ ! -d kernel-%{kversion}/vanilla-%{vanillaversion} ]; then
+  # Ok, first time we do a make prep.
+  rm -f pax_global_header
+%setup -q -n kernel-%{kversion} -c
+  mv linux-%{kversion} vanilla-%{vanillaversion}
+  cd vanilla-%{vanillaversion}
 
+# Update vanilla to the latest upstream.
+# released_kernel with stable_update available case
+%if 0%{?stable_update}
+ApplyPatch patch-2.6.%{base_sublevel}.%{stable_update}.bz2
 # non-released_kernel case
 %else
 %if 0%{?rcrev}
@@ -1255,495 +1041,358 @@
 %endif
 %endif
 
-%endif
+ cd ..
 
+else
+  # We already have a vanilla dir.
+  cd kernel-%{kversion}
+  if [ -d linux-%{kversion}.%{_target_cpu} ]; then
+     # Just in case we ctrl-c'd a prep already
+     rm -rf deleteme.%{_target_cpu}
+     # Move away the stale away, and delete in background.
+     mv linux-%{kversion}.%{_target_cpu} deleteme.%{_target_cpu}
+     rm -rf deleteme.%{_target_cpu} &
+  fi
+fi
 
-%if !%{nopatches}
+cp -rl vanilla-%{vanillaversion} linux-%{kversion}.%{_target_cpu}
 
-#
-# Xen
-#
-%if %{includexen}
-#
-# Apply the main xen patch...
-#%patch951 -p1
-%patch950 -p1 -b .p.xen
-#
-# ... and back out all the tpm additions, they need fixing
-#
-for f in `find drivers/char/tpm -type f -name "*.p.xen"` ; do \
-    g=`dirname $f`/`basename $f .p.xen`; \
-    mv "$f" "$g"; \
-    if [ ! -s "$g" ] ; then rm -f "$g" ; fi; \
-done
-# Delete the rest of the backup files, they just confuse the build later
-find -name "*.p.xen" | xargs rm -f
+cd linux-%{kversion}.%{_target_cpu}
 
-# Xen utrace
-%patch960 -p1
-%patch961 -p1
-%patch962 -p1
-%patch963 -p1
-%patch964 -p1
-%patch965 -p1
-%patch966 -p1
-%patch967 -p1
+%if %{using_upstream_branch}
+### BRANCH APPLY ###
 %endif
 
+# Drop some necessary files from the source dir into the buildroot
+cp $RPM_SOURCE_DIR/config-* .
+cp %{SOURCE15} .
 
-# compile fix
-%patch1 -p1
-
-# Patches 10 through 100 are meant for core subsystem upgrades
-%patch11 -p1
-
-# Power management fixes
-%patch12 -p1
-%patch13 -p1
-%patch14 -p1
-%patch15 -p1
+# Dynamically generate kernel .config files from config-* files
+make -f %{SOURCE20} VERSION=%{version} configs
 
-# DRM support for 965GM
-%patch17 -p1
+#if a rhel kernel, apply the rhel config options
+%if 0%{?rhel}
+  for i in %{all_arch_configs}
+  do
+    mv $i $i.tmp
+    ./merge.pl config-rhel-generic $i.tmp > $i
+    rm $i.tmp
+  done
+  for i in kernel-%{version}-{i586,i686,i686-PAE,x86_64}*.config
+  do
+    echo i is this file  $i
+    mv $i $i.tmp
+    ./merge.pl config-rhel-x86-generic $i.tmp > $i
+    rm $i.tmp
+  done
+%endif
 
-# sysrq works always
-%patch20 -p1
+# 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
+# builds (as used in the buildsystem).
+ApplyPatch linux-2.6-build-nonintconfig.patch
 
-# Roland's utrace ptrace replacement.
-%patch30 -p1
-%patch31 -p1
-%patch32 -p1
-%patch33 -p1
-%patch34 -p1
-%patch35 -p1
-%patch36 -p1
-%patch37 -p1
-%patch38 -p1
-%patch39 -p1
-%patch40 -p1
-%patch41 -p1
-%patch42 -p1
-%patch43 -p1
-%patch44 -p1
-%patch45 -p1
+%if !%{nopatches}
 
-%if %{includexen}
-#xen bits of utrace
-%patch52 -p1
-%patch62 -p1
-%endif
+# Roland's utrace ptrace replacement.
+# Main patch includes i386, x86_64, powerpc.
+ApplyPatch linux-2.6-utrace-tracehook.patch
+# Additional arch work by other contributors.
+ApplyPatch linux-2.6-utrace-tracehook-ia64.patch
+ApplyPatch linux-2.6-utrace-tracehook-sparc64.patch
+ApplyPatch linux-2.6-utrace-tracehook-s390.patch
+ApplyPatch linux-2.6-utrace-tracehook-um.patch
+ApplyPatch linux-2.6-utrace-tracehook-avr32.patch
+# Main patch includes i386, x86_64, powerpc.
+ApplyPatch linux-2.6-utrace-regset.patch
+# Additional arch work by other contributors.
+ApplyPatch linux-2.6-utrace-regset-ia64.patch
+ApplyPatch linux-2.6-utrace-regset-sparc64.patch
+ApplyPatch linux-2.6-utrace-regset-s390.patch
+ApplyPatch linux-2.6-utrace-regset-avr32.patch
+# Core patch has no machine dependencies.
+ApplyPatch linux-2.6-utrace-core.patch
+# Main patch includes i386, x86_64, powerpc.
+ApplyPatch linux-2.6-utrace-ptrace-compat.patch
+# Additional arch work by other contributors.
+ApplyPatch linux-2.6-utrace-ptrace-compat-ia64.patch
+ApplyPatch linux-2.6-utrace-ptrace-compat-sparc64.patch
+ApplyPatch linux-2.6-utrace-ptrace-compat-s390.patch
+ApplyPatch linux-2.6-utrace-ptrace-compat-avr32.patch
 
-# Use --build-id option
-%patch70 -p1
+# enable sysrq-c on all kernels, not only kexec
+ApplyPatch linux-2.6-sysrq-c.patch
 
 # Architecture patches
-
-#
 # x86(-64)
-#
 # Compile 686 kernels tuned for Pentium4.
-%patch200 -p1
-# add vidfail capability;
-# without this patch specifying a framebuffer on the kernel prompt would
-# make the boot stop if there's no supported framebuffer device; this is bad
-# for the installer cd that wants to automatically fall back to textmode
-# in that case
-%patch201 -p1
-# EDAC support for K8
-%patch202 -p1
-# Suppress APIC errors on UP x86-64.
-%patch203 -p1
-%if %{includexen}
-# Suppress APIC errors on UP x86-64 (xen bits)
-%patch204 -p1
-%endif
-# Don't delete cpu_devs data to identify different x86 types in late_initcall
-%patch205 -p1
-# quirk for Siemens Nixdorf AG FSC Multiprocessor Interrupt Controller
-%patch206 -p1
-# Blacklist Dell Optiplex 320 from using the HPET
-%patch207 -p1
-# Add x86-64 PM_TRACE support.
-%patch209 -p1
+ApplyPatch linux-2.6-x86-tune-generic.patch
+
 
 #
 # PowerPC
 #
+###  UPSTREAM PATCHES FROM 2.6.25 (we think):
+# Export bootwrapper for userspace to use
+ApplyPatch linux-2.6-powerpc-bootwrapper.patch
+# PA Semi updates
+ApplyPatch linux-2.6-pasemi-for-2.6.25.patch
+ApplyPatch linux-2.6-pasemi-reserve-i2c.patch
+# RTC class driver for ppc_md rtc functions
+ApplyPatch linux-2.6-ppc-rtc.patch
+# PlayStation wireless support
+ApplyPatch linux-2.6-gelic-fixups.patch
+ApplyPatch linux-2.6-gelic-wireless-v2.patch
+ApplyPatch linux-2.6-gelic-wireless-fix.patch
+# Suspend through /sys/power/state
+ApplyPatch linux-2.6-powerpc-generic-suspend-001-pmu-no-lock-kernel.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-002-pmu-remove-dead-code.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-003-remove-adb-sleep-notifier.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-004-kill-pmu-sleep-notifier.patch
+ApplyPatch linux-2.6-powerpc-generic-suspend-005-proper-sleep-management.patch
+### NOT (YET) UPSTREAM:
+# The EHCI ISO patch isn't yet upstream but is needed to fix reboot
+ApplyPatch linux-2.6-ps3-ehci-iso.patch
+# The storage alias patch is Fedora-local, and allows the old 'ps3_storage'
+# module name to work on upgrades. Otherwise, I believe mkinitrd will fail
+# to pull the module in,
+ApplyPatch linux-2.6-ps3-storage-alias.patch
+# Support booting from Sony's original released 2.6.16-based kboot
+ApplyPatch linux-2.6-ps3-legacy-bootloader-hack.patch
 # Alleviate G5 thermal shutdown problems
-%patch300 -p1
-# Ensure slab objects are aligned enough for a uint64_t (#235392)
-%patch301 -p1
-# Fix data exception problem
-%patch302 -p1
-# Temporary hack to work around GCC PR #25724 / #21237
-%patch303 -p1
-# Fix up ibmvscsi for combined pSeries/iSeries build
-%patch304 -p1
-# Move pmac_zilog to its newly-registered device number
-%patch305 -p1
-# Ensure initrd memory is reserved at boot
-%patch306 -p1
-%patch307 -p1
-%patch308 -p1
-%patch309 -p1
-
-# uevent support for of_platform device
-%patch310 -p1
-%patch311 -p1
-%patch312 -p1
-%patch313 -p1
-
-#powermac-generic-suspend-*
-%patch330 -p1
-%patch331 -p1
-%patch332 -p1
-%patch333 -p1
-
-# Efika Ethernet
-%patch340 -p1
-%patch341 -p1
-
-# PlayStation 3 support
-%patch350 -p1
-%patch351 -p1
-%patch352 -p1
-%patch353 -p1
-%patch354 -p1
-%patch355 -p1
-%patch356 -p1
-%patch357 -p1
-%patch358 -p1
-%patch359 -p1
-%patch360 -p1
-%patch361 -p1
-%patch362 -p1
-
-%patch370 -p1
-%patch371 -p1
-%patch372 -p1
-%patch373 -p1
-%patch374 -p1
-%patch375 -p1
-%patch376 -p1
-%patch377 -p1
+ApplyPatch linux-2.6-g5-therm-shutdown.patch
 
-# S390
-
-#
-# Patches 800 through 899 are reserved for bugfixes to the core system
-# and patches related to how RPMs are build
 #
-
-
-# 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
-# builds (as used in the buildsystem).
-%patch800 -p1
-
 # Exec shield
-%patch810 -p1
-%if %{includexen}
-%patch811 -p1
-%endif
-
 #
-# GPG signed kernel modules
-#
-%patch900 -p1
-%patch901 -p1
-%patch902 -p1
-%patch903 -p1
-%patch904 -p1
-%patch905 -p1
-%patch906 -p1
-
+ApplyPatch linux-2.6-execshield.patch
 
 #
-# Patches 1000 to 5000 are reserved for bugfixes to drivers and filesystems
+# bugfixes to drivers and filesystems
 #
 
+# USB
+ApplyPatch linux-2.6-usb-ehci-hcd-respect-nousb.patch
+
+# ACPI
+# eeepc hotkey support
+ApplyPatch linux-2.6-acpi-eeepc-hotkey.patch
 
 # Various low-impact patches to aid debugging.
-%patch1010 -p1
-%patch1011 -p1
-%patch1012 -p1
-%patch1013 -p1
-%patch1015 -p1
-%patch1016 -p1
-%patch1019 -p1
-# Disable the 'quiet' boot switch for better bug reports.
-%patch1020 -p1
-%patch1021 -p1
-%patch1022 -p1
-%if %{includexen}
-%patch1023 -p1
+ApplyPatch linux-2.6-debug-sizeof-structs.patch
+ApplyPatch linux-2.6-debug-nmi-timeout.patch
+ApplyPatch linux-2.6-debug-taint-vm.patch
+ApplyPatch linux-2.6-debug-spinlock-taint.patch
+%if !%{debugbuildsenabled}
+ApplyPatch linux-2.6-debug-no-quiet.patch
 %endif
 
 #
 # Make /dev/mem a need-to-know function
 #
-%patch1050 -p1
-%if %{includexen}
-%patch1051 -p1
-%endif
+ApplyPatch linux-2.6-devmem.patch
 
 #
 # /dev/crash driver for the crashdump analysis tool
 #
-%patch1060 -p1
-%if %{includexen}
-%patch1061 -p1
-%endif
+ApplyPatch linux-2.6-crash-driver.patch
 
 #
 # SCSI Bits.
 #
-# Fix old SCSI adapter crashes with CD-ROM
-%patch1100 -p1
 # fix cpqarray pci enable
-%patch1106 -p1
-
-# Fix 3w-9xxx to use PCI resource length correctly (bug #309611)
-%patch1107 -p1
-
-#
-# Various NFS/NFSD fixes.
-#
-
-# NIC driver fixes
-# Don't print warnings about MSI failures on e1000
-%patch1300 -p1
-
-# e1000e backport
-%patch1350 -p1
-%patch1351 -p1
-%patch1352 -p1
-%patch1353 -p1
-%patch1354 -p1
-%patch1355 -p1
-%patch1356 -p1
-%patch1357 -p1
-%patch1358 -p1
-%patch1359 -p1
-%patch1360 -p1
+ApplyPatch linux-2.6-scsi-cpqarray-set-master.patch
+# fix vmware emulated scsi controller
+#ApplyPatch linux-2.6-scsi-mpt-vmware-fix.patch
+
+# ALSA
+#
+# upstream ALSA
+#ApplyPatch linux-2.6-alsa-rc4-mm1.patch
+# SiS 7019 support
+ApplyPatch linux-2.6-alsa-support-sis7019.patch
 
 # Filesystem patches.
 # Squashfs
-%patch1400 -p1
-# GFS2 update
-%patch1410 -p1
+ApplyPatch linux-2.6-squashfs.patch
 
 # Networking
 # Disable easy to trigger printk's.
-%patch1500 -p1
+ApplyPatch linux-2.6-net-silence-noisy-printks.patch
 
 # Misc fixes
-# Add missing MODULE_VERSION tags to some modules.
-%patch1600 -p1
-# Fix SHA1 alignment problem on ia64
-%patch1601 -p1
 # The input layer spews crap no-one cares about.
-%patch1610 -p1
-# don't wakeup ondemand timer whilst idle.
-%patch1620 -p1
-# Update KVM. (should we just carry the latest version?)
-%patch1630 -p1
-# KVM: Detect if AMD svm was disabled by BIOS
-%patch1631 -p1
-# KVM: Fix above patch on 32-bit
-%patch1632 -p1
-# KVM: reinit real-mode TSS before switching back
-%patch1633 -p1
+ApplyPatch linux-2.6-input-kill-stupid-messages.patch
 # Allow to use 480600 baud on 16C950 UARTs
-%patch1650 -p1
-# Allow large files on UDF
-%patch1660 -p1
-%patch1661 -p1
-%patch1662 -p1
-# fix oops in sysfs_readdir
-%patch1670 -p1
-
-%if %{includexen}
-# checksum fixes (bug #223258)
-%patch1665 -p1
-%endif
-
-# Align kernel data segment to page boundary.
-%patch1690 -p1
-# DVB spinlock bug
-%patch1700 -p1
-# NFS: Added support to turn off the NFSv3 READDIRPLUS RPC.
-%patch1710 -p1
-# Missing braces
-%patch1711 -p1
-# setuid /proc/self/maps fix.
-%patch1720 -p1
-# Fix ACPI suspend / device suspend ordering problem
-%patch1730 -p1
-# Add a safety net to softlockup so that it doesn't prevent installs.
-%patch1740 -p1
-# Speed up spinlock debug.
-%patch1770 -p1
+ApplyPatch linux-2.6-serial-460800.patch
 # Silence some useless messages that still get printed with 'quiet'
-%patch1771 -p1
-# softirqs: print out irq-trace events
-%patch1781 -p1
-
-# OLPC specific patches
-%if 0%{?olpc}
-# Marvell Libertas wireless driver
-%patch1791 -p1
-# OLPC touchpad
-%patch1792 -p1
-%endif
-
-# temporarily restore START_ARRAY ioctl
-%patch1793 -p1
-
-# Fix i82875 EDAC driver setup so X will start
-%patch1794 -p1
-# Work around sysfs/uevent use-after-free problems with Bluetooth HID
-%patch1795 -p1
-
-%if %{includexen}
-# Xenoprof's DOMAIN_SWITCH_CODE changed in oprofile 0.9.3
-%patch1796 -p1
-%endif
+ApplyPatch linux-2.6-silence-noise.patch
 
 # Fix the SELinux mprotect checks on executable mappings
-%patch1801 -p1
+ApplyPatch linux-2.6-selinux-mprotect-checks.patch
+# strip extra leading slashes in pathnames
+ApplyPatch linux-2.6-selinux-strip-leading-slashes.patch
 
 # Remove kernel-internal functionality that nothing external should use.
-%patch1910 -p1
+ApplyPatch linux-2.6-unexport-symbols.patch
 
-#
-# VM related fixes.
-#
-# Re-add cond_resched to invalidate_mapping_pages()
-%patch2000 -p1
-# Silence GFP_ATOMIC failures.
-%patch2001 -p1
 
 # Changes to upstream defaults.
 # Use UTF-8 by default on VFAT.
-%patch2100 -p1
+ApplyPatch linux-2.6-defaults-fat-utf8.patch
 
-# Use unicode VT's by default.
-%patch2103 -p1
-# Disable NMI watchdog by default.
-%patch2105 -p1
-# Disable MMCONFIG & MSI by default.
-%patch2106 -p1
-# Disable USB autosuspend by default.
-%patch2107 -p1
-
-# HPA support for libata.
-%patch2201 -p1
-# sata_nv: Don't attempt using ADMA for (READ|SET)_MAX commands
-%patch2202 -p1
 # Disable ATAPI DMA on ALI chipsets.
-%patch2203 -p1
-# libata: don't initialize sg in ata_exec_internal() if DMA_NONE
+ApplyPatch linux-2.6-libata-ali-atapi-dma.patch
 # ia64 ata quirk
-%patch2204 -p1
-# remove the wildcard from sata_nv driver
-%patch2206 -p1
-# pata_pcmcia.c: add card ident for jvc cdrom
-%patch2207 -p1
-# Add libata ID's for ATI SB700
-%patch2208 -p1
-# hpt3x2n: Correct revision boundary
-%patch2209 -p1
-# pata_sis: Fix and clean up some timing setups
-%patch2210 -p1
-# libata: always use polling SETXFER
-%patch2211 -p1
-# pata_ali: limit DMA speeds
-%patch2212 -p1
-# libata: use PIO when xfer is not a multiple of 16
-%patch2213 -p1
-# libata: call check_dma with qc better prepared
-%patch2214 -p1
-# libata: add intel ich8m (santa rosa) pata ID
-%patch2215 -p1
-# libata: add option to disable PATA DMA
-%patch2216 -p1
-# libata: update NCQ blacklist
-%patch2217 -p1
-# libata: partially fix dma for pata_it821x
-%patch2218 -p1
-
-# ATA spindown
-%patch2220 -p1
-%patch2221 -p1
-%patch2222 -p1
-%patch2223 -p1
-%patch2224 -p1
-%patch2225 -p1
-%patch2226 -p1
-%patch2227 -p1
-%patch2228 -p1
-
-# Add critical wireless updates from 2.6.22
-%patch2300 -p1
-# Add the new wireless stack and drivers from wireless-dev
-%patch2301 -p1
-# avoid bcm43xx vs bcm43xx-mac80211 PCI ID conflicts
-%patch2302 -p1
-
-# Assorted dyntick/clock/timer fixes.
-%patch2402 -p1
-%patch2403 -p1
-
-
-# ACPI patches
-# Remove Dell Optiplex GX240 from the ACPI blacklist
-%patch2500 -p1
-# Fix ACPI dock oops (#238054)
-%patch2501 -p1
-# Fix another ACPI boot regression.
-%patch2502 -p1
-# Fix possible breakage of ACPI suspend
-%patch2503 -p1
-
-# Fix excessive wakeups
-# Make hdaps timer only tick when in use.
-%patch2600 -p1
-
-
-# ACPI patches
-%patch3000 -p1
-
-#
-# Patches 5000 to 6000 are reserved for new drivers that are about to
-# be merged upstream
-#
-
-# Pull in the new firewire stack from 2.6.20-rc3-mm1.
-%patch5000 -p1
-%patch5001 -p1
-
-# security:
-%patch6000 -p1
+ApplyPatch linux-2.6-ata-quirk.patch
 
-#
-# final stuff
-#
+# wireless patches headed for 2.6.25
+ApplyPatch linux-2.6-wireless.patch
+# wireless patches headed for 2.6.26
+ApplyPatch linux-2.6-wireless-pending.patch
+
+# Add misc wireless bits from upstream wireless tree
+ApplyPatch linux-2.6-at76.patch
+ApplyPatch linux-2.6-rndis_wlan.patch
+
+# Make ath5k use software WEP
+ApplyPatch linux-2.6-ath5k-use-soft-wep.patch
+
+# implement smarter atime updates support.
+ApplyPatch linux-2.6-smarter-relatime.patch
+
+# xfs bugfixes & stack reduction.  Upstream; will be in 2.6.25.
+ApplyPatch linux-2.6-xfs-xfs_mount-refactor.patch
+ApplyPatch linux-2.6-xfs-optimize-away-realtime-tests.patch
+ApplyPatch linux-2.6-xfs-setfattr-32bit-compat.patch
 
 #
-# misc small stuff to make things compile or otherwise improve performance
+# misc small stuff to make things compile
 #
 
-# END OF PATCH APPLICATIONS
+C=$(wc -l $RPM_SOURCE_DIR/linux-2.6-compile-fixes.patch | awk '{print $1}')
+if [ "$C" -gt 10 ]; then
+ApplyPatch linux-2.6-compile-fixes.patch
+fi
+
+# build with gcc43
+ApplyPatch linux-2.6-compile-fix-gcc-43.patch
+
+# build id related enhancements
+ApplyPatch linux-2.6-default-mmf_dump_elf_headers.patch
+ApplyPatch linux-2.6-i386-vdso-install-unstripped-copies-on-disk.patch
+
+# http://www.lirc.org/
+ApplyPatch linux-2.6-lirc.patch
+
+# DMI autoloading for dcdbas driver
+ApplyPatch linux-2.6-dcdbas-autoload.patch
+
+ApplyPatch linux-2.6-e1000-corrupt-eeprom-checksum.patch
+ApplyPatch linux-2.6-netdev-e1000-disable-alpm.patch
+ApplyPatch linux-2.6-netdev-bonding-fix-null-deref.patch
+# atl2 driver for eeepc (and others)
+ApplyPatch linux-2.6-netdev-atl2.patch
+
+# drm-mm catchup (modesetting, ...)
+ApplyPatch linux-2.6-agp-mm.patch
+ApplyPatch linux-2.6-drm-mm.patch
+# Nouveau DRM + drm fixes
+ApplyPatch nouveau-drm.patch
+ApplyPatch linux-2.6-ppc32-ucmpdi2.patch
+ApplyPatch linux-2.6-drm-radeon-update.patch
+ApplyPatch linux-2.6-git-initial-r500-drm.patch
+
+# ext4dev from Linus' upstream git tree, slated for 2.6.25
+ApplyPatch linux-2.6-ext4-linus-git.patch
+# ext4dev stable patch queue, slated for 2.6.25
+ApplyPatch linux-2.6-ext4-stable-queue.patch
+
+
+# linux1394 git patches
+ApplyPatch linux-2.6-firewire-git-update.patch
+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
+
+# epoll lockdep annotation (bz #323411)
+ApplyPatch linux-2.6-epoll-lockdep-annotation.patch
+
+# usb video
+ApplyPatch linux-2.6-uvcvideo.patch
 
+# ---------- below all scheduled for 2.6.24 -----------------
+
+# kernel-xen apply start
+ApplyPatch linux-2.6-0001-xen-debug-Add-xprintk-to-log-directly-via-hypercall.patch
+ApplyPatch linux-2.6-0002-xen-dom0-Make-hvc_xen-console-work-for-dom0.patch
+ApplyPatch linux-2.6-0003-xen-dom0-Initialize-xenbus-for-dom0.patch
+ApplyPatch linux-2.6-0004-xen-dom0-Set-up-basic-IO-permissions-for-dom0.patch
+ApplyPatch linux-2.6-0005-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch
+ApplyPatch linux-2.6-0006-xen-dom0-Add-support-for-the-platform_ops-hypercall.patch
+ApplyPatch linux-2.6-0007-xen-acpi-Enable-early-access-to-ACPI-tables.patch
+ApplyPatch linux-2.6-0008-xen-dom0-Add-paravirt_ops-ioremap_page_range-for.patch
+ApplyPatch linux-2.6-0009-MTRR-use-cpu_callout_map-instead-of-cpu_online_map.patch
+ApplyPatch linux-2.6-0010-xen-mtrr-Add-mtrr_ops-support-for-Xen-mtrr.patch
+ApplyPatch linux-2.6-0011-xen-mtrr-Don-t-enable-xen-mtrr-on-bare-metal.patch
+ApplyPatch linux-2.6-0012-xen-mtrr-set-cpu-in-cpu_callout_map.patch
+ApplyPatch linux-2.6-0013-xen-mtrr-Clean-up-the-num_var_ranges-CPU_UNKOWN-hac.patch
+ApplyPatch linux-2.6-0014-xen-mtrr-Use-specific-cpu_has_foo-macros-instead-of.patch
+ApplyPatch linux-2.6-0015-xen-mtrr-Kill-some-unneccessary-includes.patch
+ApplyPatch linux-2.6-0016-xen-mtrr-No-need-to-explicitly-set-use_intel_if-0.patch
+ApplyPatch linux-2.6-0017-xen-mtrr-Use-generic_validate_add_page.patch
+ApplyPatch linux-2.6-0018-xen-mtrr-Implement-xen_get_free_region.patch
+ApplyPatch linux-2.6-0019-xen-mtrr-Add-xen_-get-set-_mtrr-implementations.patch
+ApplyPatch linux-2.6-0020-irq2.diff-from-Juan-Quintela.patch
+ApplyPatch linux-2.6-0021-xen-dom0-Obvious-cpuid-fix-to-domU-handling.patch
+ApplyPatch linux-2.6-0022-xen-debug-Diagnose-bind_virq_to_irq-errors.patch
+ApplyPatch linux-2.6-0023-xen-traps-Revert-Juan-s-traps_32.c-changes-to-debug.patch
+ApplyPatch linux-2.6-0024-xen-debug-Move-init_apic_mappings-after-trap-init.patch
+ApplyPatch linux-2.6-0025-xen-debug-Trace-progress-in-trap_init-around-init.patch
+ApplyPatch linux-2.6-0026-xen-apic-Disable-init_apic_mappings-when-under-CO.patch
+ApplyPatch linux-2.6-0027-xen-debug-Log-entry-into-virtual-console-s-xen_init.patch
+ApplyPatch linux-2.6-0028-xen-debug-Log-bind_virq_to_irq-events.patch
+ApplyPatch linux-2.6-0029-xen-debug-Work-around-USB-issue-triggered-by-Xen-de.patch
+ApplyPatch linux-2.6-0030-Remove-duplicated-dma_alloc-free_noncoherent-define.patch
+ApplyPatch linux-2.6-0031-xem-dom0-Add-hypervisor-memory_exchange-descriptor.patch
+ApplyPatch linux-2.6-0032-xen-dom0-add-virt_to_pfn-macro.patch
+ApplyPatch linux-2.6-0033-xen-dom0-use-virt_to_pfn-where-appropriate.patch
+ApplyPatch linux-2.6-0034-xen-dom0-Add-contiguous-region-support.patch
+ApplyPatch linux-2.6-0035-xen-dom0-Don-t-mask-off-PCD-bits-from-pte-entries.patch
+ApplyPatch linux-2.6-0036-xen-dom0-Remove-duplicate-xen_store_interface-assig.patch
+ApplyPatch linux-2.6-0037-xen-dom0-Slightly-re-arrange-xenbus_probe_init-er.patch
+ApplyPatch linux-2.6-0038-xen-dom0-Use-max_low_pfn-declaration-from-linux-boo.patch
+ApplyPatch linux-2.6-0039-xen-dma-Add-dma_mapping_ops-indirection-for-32-bit.patch
+ApplyPatch linux-2.6-0040-xen-dma-Remove-unused-32-bit-dma_ops-map_simple-me.patch
+ApplyPatch linux-2.6-0041-xen-dma-Initial-commit-of-pci-xen.c-dma-mapping-fun.patch
+ApplyPatch linux-2.6-0042-xen-dma-Add-calls-to-dma_ops-alloc-free_coherent-ho.patch
+ApplyPatch linux-2.6-0043-xen-dma-Add-xen_alloc-free_coherent.patch
+ApplyPatch linux-2.6-0044-xen-dma-Don-t-merge-bios-on-xen-pvops.patch
+ApplyPatch linux-2.6-0045-xen-dom0-Minor-coding-style-issue-in-ISA-mapping-co.patch
+ApplyPatch linux-2.6-0046-xen-dom0-Use-i-PAGE_SHIFT-instead-of-PAGE_DOWN-i.patch
+ApplyPatch linux-2.6-0047-xen-dom0-Match-up-set_pte_mfn-prototype-with-the.patch
+ApplyPatch linux-2.6-0048-xen-dom0-Reserve-ISA-address-space-earlier.patch
+ApplyPatch linux-2.6-0049-xen-Add-empty-xenctrl-module.patch
+ApplyPatch linux-2.6-0050-xen-dom0-Add-proc-xen-capabilities.patch
+ApplyPatch linux-2.6-0051-xen-Add-proc-xen-privcmd.patch
+ApplyPatch linux-2.6-0052-xen-dom0-Add-proc-xen-xsd_-port-kva.patch
+ApplyPatch linux-2.6-0053-xen-Add-proc-xen-xenbus.patch
+ApplyPatch linux-2.6-0054-xen-Add-dev-xen-evtchn.patch
+ApplyPatch linux-2.6-0055-xen-Add-__init-__exit-notations-to-xenctrl-function.patch
+ApplyPatch linux-2.6-0056-xen-Add-Xen-s-sys-hypervisor-interface.patch
+ApplyPatch linux-2.6-0057-xen-dom0-Add-basic-proc-xen-balloon.patch
+ApplyPatch linux-2.6-0058-xen-dom0-Re-work-privcmd_ioctl-a-little.patch
+ApplyPatch linux-2.6-0059-xen-dom0-Add-IOCTL_PRIVCMD_MMAP.patch
+# kernel-xen apply end
+
+# END OF PATCH APPLICATIONS
 
 %endif
 
 # Any further pre-build tree manipulations happen here.
 
-if [ -e scripts/checkpatch.pl ];then
-  chmod +x scripts/checkpatch.pl
-fi
+chmod +x scripts/checkpatch.pl
 
 cp %{SOURCE10} Documentation/
 
@@ -1778,17 +1427,16 @@
 # Unpack the Xen tarball.
 %if %{includexen}
 cp %{SOURCE2} .
-if [ -d xen ]; then
-  rm -rf xen
+if [ -d %{xen_hv_dirname} ]; then
+  rm -rf %{xen_hv_dirname}
 fi
-%setup -D -T -q -n kernel-%{kversion} -a1
+%setup -D -T -q -n kernel-%{version} -a1
 cd %{xen_hv_dirname}/
 # Any necessary hypervisor patches go here
-%patch20000 -p1
-%patch20001 -p1
-%patch20004 -p1
-%patch20005 -p1
-
+ApplyPatch xen-compile-fix.patch
+ApplyPatch xen-version-strings.patch
+ApplyPatch xen-build-id.patch
+ApplyPatch xen-syms-build-id.patch
 %endif
 
 
@@ -1797,7 +1445,7 @@
 ###
 %build
 
-%if %{usesparse}
+%if %{with_sparse}
 %define sparse_mflags	C=1
 %endif
 
@@ -1876,11 +1524,9 @@
 
     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer
     make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=$KernelVer
-%if %{do_vdso_install}
 %ifarch %{vdso_arches}
     make -s ARCH=$Arch INSTALL_MOD_PATH=$RPM_BUILD_ROOT vdso_install KERNELRELEASE=$KernelVer
 %endif
-%endif
 
     # And save the headers/makefiles etc for building modules against
     #
@@ -1900,6 +1546,10 @@
     # first copy everything
     cp --parents `find  -type f -name "Makefile*" -o -name "Kconfig*"` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
     cp Module.symvers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
+    cp System.map $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
+    if [ -s Module.markers ]; then
+      cp Module.markers $RPM_BUILD_ROOT/lib/modules/$KernelVer/build
+    fi
     # then drop all but the needed Makefiles/Kconfig files
     rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/Documentation
     rm -rf $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/scripts
@@ -1918,9 +1568,6 @@
     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 `readlink asm` $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
-    if [ "$Arch" = "x86_64" ]; then
-      cp -a asm-i386 $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/include
-    fi
     # While arch/powerpc/include/asm is still a symlink to the old
     # include/asm-ppc{64,} directory, include that in kernel-devel too.
     if [ "$Arch" = "powerpc" -a -r ../arch/powerpc/include/asm ]; then
@@ -1969,7 +1616,7 @@
     collect_modules_list networking \
     			 'register_netdev|ieee80211_register_hw|usbnet_probe'
     collect_modules_list block \
-    			 'ata_scsi_ioctl|scsi_add_host|blk_init_queue'
+    			 'ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans'
 
     # detect missing or incorrect license tags
     rm -f modinfo
@@ -2022,7 +1669,7 @@
 %if %{with_debug}
 BuildKernel %make_target %kernel_image debug
 %if %{with_pae}
-BuildKernel %make_target %kernel_image PAE-debug
+BuildKernel %make_target %kernel_image PAEdebug
 %endif
 %endif
 
@@ -2127,6 +1774,10 @@
 rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
 %endif
 
+%if %{with_bootwrapper}
+make DESTDIR=$RPM_BUILD_ROOT bootwrapper_install WRAPPER_OBJDIR=%{_libdir}/kernel-wrapper WRAPPER_DTSDIR=%{_libdir}/kernel-wrapper/dts
+%endif
+
 ###
 ### clean
 ###
@@ -2211,8 +1862,8 @@
 %endif
 
 %if %{with_pae_debug}
-%kernel_variant_preun PAE-debug
-%kernel_variant_post -v PAE-debug -s kernel-smp -r kernel-PAE-debug
+%kernel_variant_post -v PAEdebug -s kernel-smp -r kernel-PAEdebug
+%kernel_variant_preun PAEdebug
 %endif
 
 %if %{with_xen}
@@ -2234,6 +1885,13 @@
 /usr/include/*
 %endif
 
+%if %{with_bootwrapper}
+%files bootwrapper
+%defattr(-,root,root)
+/usr/sbin/*
+%{_libdir}/kernel-wrapper
+%endif
+
 # only some architecture builds need kernel-doc
 %if %{with_doc}
 %files -n %{mainpkgname}-doc
@@ -2268,11 +1926,9 @@
 /lib/modules/%{KVERREL}%{?2}/extra\
 /lib/modules/%{KVERREL}%{?2}/updates\
 /lib/modules/%{KVERREL}%{?2}/weak-updates\
-%if %{do_vdso_install}\
 %ifarch %{vdso_arches}\
 /lib/modules/%{KVERREL}%{?2}/vdso\
 %endif\
-%endif\
 /lib/modules/%{KVERREL}%{?2}/modules.block\
 /lib/modules/%{KVERREL}%{?2}/modules.networking\
 %ghost /boot/initrd-%{KVERREL}%{?2}.img\
@@ -2306,7 +1962,7 @@
 %kernel_variant_files %{with_smp} smp
 %kernel_variant_files %{with_debug} debug
 %kernel_variant_files %{with_pae} PAE
-%kernel_variant_files %{with_pae_debug} PAE-debug
+%kernel_variant_files %{with_pae_debug} PAEdebug
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 

linux-2.6-ata-quirk.patch:

Index: linux-2.6-ata-quirk.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-ata-quirk.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-ata-quirk.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-ata-quirk.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -46,13 +46,13 @@
 +
 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_11, quirk_intel_ide_controller);
 +
---- linux-2.6.20/arch/ia64/kernel/Makefile	2007-02-08 02:13:41.000000000 -0500
-+++ linux-2.6.20_fix/arch/ia64/kernel/Makefile	2007-02-12 09:49:39.000000000 -0500
+--- linux-2.6.21.noarch/arch/ia64/kernel/Makefile~	2007-05-27 23:23:36.000000000 -0400
++++ linux-2.6.21.noarch/arch/ia64/kernel/Makefile	2007-05-27 23:23:48.000000000 -0400
 @@ -33,6 +33,7 @@ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
  obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR)	+= uncached.o
  obj-$(CONFIG_AUDIT)		+= audit.o
  obj-$(CONFIG_PCI_MSI)		+= msi_ia64.o
 +obj-$(CONFIG_PCI)		+= quirks.o
  mca_recovery-y			+= mca_drv.o mca_drv_asm.o
+ obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o
  
- obj-$(CONFIG_IA64_ESI)		+= esi.o

linux-2.6-build-nonintconfig.patch:

Index: linux-2.6-build-nonintconfig.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-build-nonintconfig.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-build-nonintconfig.patch	24 Jan 2007 01:28:48 -0000	1.1
+++ linux-2.6-build-nonintconfig.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,140 +1,113 @@
-diff -urNp --exclude-from=/home/davej/.exclude linux-600/scripts/kconfig/conf.c linux-800/scripts/kconfig/conf.c
---- linux-600/scripts/kconfig/conf.c
-+++ linux-800/scripts/kconfig/conf.c
-@@ -20,6 +20,7 @@ enum {
+--- linux-2.6.23.noarch/scripts/kconfig/Makefile~	2007-10-29 19:20:10.000000000 -0400
++++ linux-2.6.23.noarch/scripts/kconfig/Makefile	2007-10-29 19:20:24.000000000 -0400
+@@ -29,6 +29,11 @@ oldconfig: $(obj)/conf
+ silentoldconfig: $(obj)/conf
+ 	$< -s $(Kconfig)
+ 
++nonint_oldconfig: $(obj)/conf
++	$< -b $(Kconfig)
++loose_nonint_oldconfig: $(obj)/conf
++	$< -B $(Kconfig)
++
+ # Create new linux.po file
+ # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
+ # The symlink is used to repair a deficiency in arch/um
+--- linux-2.6.17/scripts/kconfig/conf.c.nonintconfig
++++ linux-2.6.17/scripts/kconfig/conf.c
+@@ -21,6 +21,8 @@ enum {
  	ask_all,
  	ask_new,
  	ask_silent,
 +	dont_ask,
++	dont_ask_dont_tell,
  	set_default,
  	set_yes,
  	set_mod,
-@@ -37,6 +37,8 @@ static struct menu *rootEntry;
+@@ -37,6 +39,8 @@ static struct menu *rootEntry;
  
  static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
  
 +static int return_value = 0;
 +
- static void strip(char *str)
+ static const char *get_help(struct menu *menu)
  {
- 	char *p = str;
-@@ -93,6 +96,12 @@ static void conf_askvalue(struct symbol 
+ 	if (menu_has_help(menu))
+@@ -103,6 +107,16 @@ static void conf_askvalue(struct symbol 
  		fflush(stdout);
  		fgets(line, 128, stdin);
- 		return;
+ 		return 1;
 +	case dont_ask:
 +		if (!sym_has_value(sym)) {
 +			fprintf(stderr,"CONFIG_%s\n",sym->name);
 +			return_value++;
 +		}
-+		return;
++		/*FALLTHROUGH*/
++	case dont_ask_dont_tell:
++		if (sym_has_value(sym))
++			return 0;
++		return 1;
  	case set_default:
  		printf("%s\n", def);
- 		return;
-@@ -337,6 +346,10 @@ static int conf_choice(struct menu *menu
+ 		return 1;
+@@ -346,6 +358,11 @@ static int conf_choice(struct menu *menu
  			printf("?");
  		printf("]: ");
  		switch (input_mode) {
 +		case dont_ask:
++		case dont_ask_dont_tell:
 +			cnt = def;
 +			printf("%d\n", cnt);
 +			break;
  		case ask_new:
  		case ask_silent:
  			if (!is_new) {
-@@ -472,7 +485,10 @@ static void check_conf(struct menu *menu
+@@ -482,6 +499,10 @@ static void check_conf(struct menu *menu
  			if (!conf_cnt++)
- 				printf("*\n* Restart config...\n*\n");
+ 				printf(_("*\n* Restart config...\n*\n"));
  			rootEntry = menu_get_parent_menu(menu);
--			conf(rootEntry);
-+			if (input_mode == dont_ask)
++			if (input_mode == dont_ask
++			    || input_mode == dont_ask_dont_tell)
 +				fprintf(stderr,"CONFIG_%s\n",sym->name);
 +			else
-+				conf(rootEntry);
+ 			conf(rootEntry);
  		}
- 		if (sym_is_choice(sym) && sym_get_tristate_value(sym) != mod)
- 			return;
-@@ -493,6 +509,9 @@ int main(int ac, char **av)
+ 	}
+@@ -501,6 +522,12 @@ int main(int ac, char **av)
  		case 'o':
  			input_mode = ask_new;
  			break;
 +		case 'b':
 +			input_mode = dont_ask;
 +			break;
++		case 'B':
++			input_mode = dont_ask_dont_tell;
++			break;
  		case 's':
  			input_mode = ask_silent;
  			valid_stdin = isatty(0) && isatty(1) && isatty(2);
-@@ -557,6 +576,7 @@ int main(int ac, char **av)
+@@ -566,6 +593,8 @@ int main(int ac, char **av)
  		}
  	case ask_all:
  	case ask_new:
 +	case dont_ask:
++	case dont_ask_dont_tell:
  		conf_read(NULL);
  		break;
- 	default:
-@@ -632,7 +632,7 @@ int main(int ac, char **av)
+ 	case set_no:
+@@ -612,7 +641,8 @@ int main(int ac, char **av)
  	do {
  		conf_cnt = 0;
  		check_conf(&rootmenu);
 -	} while (conf_cnt);
-+	} while ((conf_cnt) && (input_mode != dont_ask));
++ 	} while (conf_cnt && (input_mode != dont_ask
++			      && input_mode != dont_ask_dont_tell));
  	if (conf_write(NULL)) {
  		fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
  		return 1;
-@@ -643,5 +643,5 @@ skip_check:
+@@ -623,5 +653,5 @@ skip_check:
  		return 1;
  	}
  
 -	return 0;
 +	return return_value;
  }
---- linux-2.6.16.noarch/scripts/kconfig/Makefile~	2006-03-25 15:55:18.000000000 -0500
-+++ linux-2.6.16.noarch/scripts/kconfig/Makefile	2006-03-25 15:55:47.000000000 -0500
-@@ -23,6 +23,9 @@ oldconfig: $(obj)/conf
- silentoldconfig: $(obj)/conf
- 	$< -s arch/$(ARCH)/Kconfig
- 
-+nonint_oldconfig: scripts/kconfig/conf
-+	./scripts/kconfig/conf -b arch/$(ARCH)/Kconfig
-+
- update-po-config: $(obj)/kxgettext
- 	xgettext --default-domain=linux \
-           --add-comments --keyword=_ --keyword=N_ \
---- linux-2.6.14/scripts/kconfig/confdata.c~	2005-11-10 14:55:46.000000000 -0500
-+++ linux-2.6.14/scripts/kconfig/confdata.c	2005-11-10 14:56:01.000000000 -0500
-@@ -161,7 +161,7 @@ load:
- 			if (def == S_DEF_USER) {
- 				sym = sym_find(line + 9);
- 				if (!sym) {
--					conf_warning("trying to assign nonexistent symbol %s", line + 9);
-+					conf_warning("trying to assign nonexistent symbol %s", line + 9);
- 					break;
- 				}
- 			} else {
-@@ -197,7 +197,7 @@ load:
- 			if (def == S_DEF_USER) {
- 				sym = sym_find(line + 7);
- 				if (!sym) {
--					conf_warning("trying to assign nonexistent symbol %s", line + 7);
-+					conf_warning("trying to assign nonexistent symbol %s", line + 7);
- 					break;
- 				}
- 			} else {
---- linux-2.6.14/scripts/kconfig/confdata.c~	2005-11-15 23:51:37.000000000 -0500
-+++ linux-2.6.14/scripts/kconfig/confdata.c	2005-11-15 23:52:50.000000000 -0500
-@@ -153,7 +153,6 @@ int conf_read_simple(const char *name)
- 				break;
- 			} else if (!(sym->flags & SYMBOL_NEW)) {
- 				conf_warning("trying to reassign symbol %s", sym->name);
--				break;
- 			}
- 			switch (sym->type) {
- 			case S_BOOLEAN:
-@@ -183,7 +182,6 @@ int conf_read_simple(const char *name)
- 				break;
- 			} else if (!(sym->flags & SYMBOL_NEW)) {
- 				conf_warning("trying to reassign symbol %s", sym->name);
--				break;
- 			}
- 			switch (sym->type) {
- 			case S_TRISTATE:

linux-2.6-crash-driver.patch:

Index: linux-2.6-crash-driver.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-crash-driver.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-crash-driver.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-crash-driver.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -1,6 +1,6 @@
 diff -urNp --exclude-from=/home/davej/.exclude linux-1050/arch/i386/mm/init.c linux-1060/arch/i386/mm/init.c
---- linux-1050/arch/i386/mm/init.c
-+++ linux-1060/arch/i386/mm/init.c
+--- linux-1050/arch/x86/mm/init_32.c
++++ linux-1060/arch/x86/mm/init_32.c
 @@ -248,6 +248,8 @@ int devmem_is_allowed(unsigned long page
     return 0;
  }
@@ -24,8 +24,8 @@
  # ifdef CONFIG_SMP
  #  if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
 diff -urNp --exclude-from=/home/davej/.exclude linux-1050/arch/x86_64/mm/init.c linux-1060/arch/x86_64/mm/init.c
---- linux-1050/arch/x86_64/mm/init.c
-+++ linux-1060/arch/x86_64/mm/init.c
+--- linux-1050/arch/x86/mm/init_64.c
++++ linux-1060/arch/x86/mm/init_64.c
 @@ -6,5 +6,6 @@
   */
  
@@ -33,15 +33,14 @@
  #include <linux/signal.h>
  #include <linux/sched.h>
  #include <linux/kernel.h>
-@@ -417,6 +418,8 @@ int devmem_is_allowed(unsigned long page
+@@ -452,6 +452,7 @@ static inline int page_is_ram (unsigned 
+ 	}
+ 	return 0;
  }
- 
- 
 +EXPORT_SYMBOL_GPL(page_is_ram);
-+
- static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
- 			 kcore_vsyscall;
  
+ /*
+  * Memory hotplug specific functions
 diff -urNp --exclude-from=/home/davej/.exclude linux-1050/drivers/char/crash.c linux-1060/drivers/char/crash.c
 --- linux-1050/drivers/char/crash.c
 +++ linux-1060/drivers/char/crash.c
@@ -188,17 +187,18 @@
  	int "Maximum number of legacy PTY in use"
 --- linux-2.6.16.noarch/drivers/char/Makefile~	2006-03-25 18:50:42.000000000 -0500
 +++ linux-2.6.16.noarch/drivers/char/Makefile	2006-03-25 18:50:59.000000000 -0500
-@@ -95,6 +95,7 @@ obj-$(CONFIG_IPMI_HANDLER)	+= ipmi/
+@@ -95,6 +95,8 @@ obj-$(CONFIG_IPMI_HANDLER)	+= ipmi/
+ obj-$(CONFIG_JS_RTC)		+= js-rtc.o
+ js-rtc-y = rtc.o
  
- obj-$(CONFIG_HANGCHECK_TIMER)	+= hangcheck-timer.o
- obj-$(CONFIG_TCG_TPM)		+= tpm/
 +obj-$(CONFIG_CRASH)		+= crash.o
- 
++
  # Files generated that shall be removed upon make clean
- clean-files := consolemap_deftbl.c defkeymap.c qtronixmap.c
+ clean-files := consolemap_deftbl.c defkeymap.c
+ 
 diff -urNp --exclude-from=/home/davej/.exclude linux-1050/include/asm-i386/crash.h linux-1060/include/asm-i386/crash.h
---- linux-1050/include/asm-i386/crash.h
-+++ linux-1060/include/asm-i386/crash.h
+--- linux-1050/include/asm-x86/crash.h
++++ linux-1060/include/asm-x86/crash.h
 @@ -0,0 +1,75 @@
 +#ifndef _ASM_I386_CRASH_H
 +#define _ASM_I386_CRASH_H
@@ -369,93 +369,3 @@
 +#endif /* __KERNEL__ */
 +
 +#endif /* _ASM_IA64_CRASH_H */
-diff -urNp --exclude-from=/home/davej/.exclude linux-1050/include/asm-x86_64/crash.h linux-1060/include/asm-x86_64/crash.h
---- linux-1050/include/asm-x86_64/crash.h
-+++ linux-1060/include/asm-x86_64/crash.h
-@@ -0,0 +1,75 @@
-+#ifndef _ASM_X86_64_CRASH_H
-+#define _ASM_X86_64_CRASH_H
-+
-+/*
-+ * linux/include/asm-x86_64/crash.h
-+ *
-+ * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2, or (at your option)
-+ * any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-+ *
-+ */
-+
-+#ifdef __KERNEL__
-+
-+#include <linux/mm.h>
-+#include <linux/highmem.h>
-+#include <asm/mmzone.h>
-+
-+extern int page_is_ram(unsigned long);
-+
-+static inline void *
-+map_virtual(u64 offset, struct page **pp)
-+{
-+	struct page *page;
-+	unsigned long pfn;
-+	void *vaddr;
-+
-+	pfn = (unsigned long)(offset >> PAGE_SHIFT);
-+
-+	if (!page_is_ram(pfn)) {
-+		printk(KERN_INFO
-+		    "crash memory driver: !page_is_ram(pfn: %lx)\n", pfn);
-+		return NULL;
-+	}
-+
-+	if (!pfn_valid(pfn)) {
-+		printk(KERN_INFO
-+		    "crash memory driver: invalid pfn: %lx )\n", pfn);
-+		return NULL;
-+	}
-+
-+	page = pfn_to_page(pfn);
-+
-+	vaddr = kmap(page);
-+	if (!vaddr) {
-+		printk(KERN_INFO
-+		    "crash memory driver: pfn: %lx kmap(page: %lx) failed\n", 
-+			pfn, (unsigned long)page);
-+		return NULL;
-+	}
-+
-+	*pp = page;
-+	return (vaddr + (offset & (PAGE_SIZE-1)));
-+}
-+
-+static inline void unmap_virtual(struct page *page) 
-+{ 
-+	kunmap(page);
-+}
-+
-+#endif /* __KERNEL__ */
-+
-+#endif /* _ASM_X86_64_CRASH_H */
---- linux-2.6.21.noarch/arch/x86_64/kernel/e820.c~	2007-05-04 00:04:56.000000000 -0400
-+++ linux-2.6.21.noarch/arch/x86_64/kernel/e820.c	2007-05-04 00:05:02.000000000 -0400
-@@ -25,7 +25,7 @@
- #include <asm/bootsetup.h>
- #include <asm/sections.h>
- 
--struct e820map e820 __initdata;
-+struct e820map e820;
- 
- /* 
-  * PFN of last memory page.

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.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-debug-nmi-timeout.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-debug-nmi-timeout.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -1,5 +1,5 @@
---- linux-2.6.20.noarch/arch/i386/kernel/nmi.c~	2007-04-13 15:52:37.000000000 -0400
-+++ linux-2.6.20.noarch/arch/i386/kernel/nmi.c	2007-04-13 15:53:06.000000000 -0400
+--- 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
  		 * wait a few IRQs (5 seconds) before doing the oops ...
  		 */
@@ -9,8 +9,8 @@
  			/*
  			 * die_nmi will return ONLY if NOTIFY_STOP happens..
  			 */
---- linux-2.6.20.noarch/arch/x86_64/kernel/nmi.c~	2007-04-13 15:53:09.000000000 -0400
-+++ linux-2.6.20.noarch/arch/x86_64/kernel/nmi.c	2007-04-13 15:53:29.000000000 -0400
+--- 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 ...
  		 */
@@ -20,11 +20,11 @@
  			die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs,
  				panic_on_timeout);
  	} else {
---- linux-2.6.20.noarch/lib/Kconfig.debug~	2007-04-13 15:53:48.000000000 -0400
-+++ linux-2.6.20.noarch/lib/Kconfig.debug	2007-04-13 15:55:18.000000000 -0400
-@@ -133,6 +133,14 @@ config DETECT_SOFTLOCKUP
- 	   can be detected via the NMI-watchdog, on platforms that
- 	   support it.)
+--- 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
+ 	  application, you can say N to avoid the very slight overhead
+ 	  this adds.
  
 +config DEBUG_NMI_TIMEOUT
 +	int "Number of seconds before NMI timeout"
@@ -34,6 +34,6 @@
 +	  This value is the number of seconds the NMI watchdog will tick
 +	  before it decides the machine has hung.
 +
- config SCHEDSTATS
- 	bool "Collect scheduler statistics"
+ config TIMER_STATS
+ 	bool "Collect kernel timers statistics"
  	depends on DEBUG_KERNEL && PROC_FS

linux-2.6-debug-spinlock-taint.patch:

Index: linux-2.6-debug-spinlock-taint.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-debug-spinlock-taint.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-debug-spinlock-taint.patch	24 Jan 2007 01:28:48 -0000	1.1
+++ linux-2.6-debug-spinlock-taint.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,42 +1,44 @@
---- linux-2.6.17.noarch/lib/spinlock_debug.c~	2006-07-04 16:23:43.000000000 -0400
-+++ linux-2.6.17.noarch/lib/spinlock_debug.c	2006-07-04 16:24:45.000000000 -0400
-@@ -57,9 +57,9 @@ static void spin_bug(spinlock_t *lock, c
+diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c
+index 9c4b025..b7a010a 100644
+--- a/lib/spinlock_debug.c
++++ b/lib/spinlock_debug.c
+@@ -58,9 +58,9 @@ static void spin_bug(spinlock_t *lock, const char *msg)
  
  	if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
  		owner = lock->owner;
 -	printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
 +	printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d (%s)\n",
  		msg, raw_smp_processor_id(),
--		current->comm, current->pid);
-+		current->comm, current->pid, print_tainted());
+-		current->comm, task_pid_nr(current));
++		current->comm, task_pid_nr(current), print_tainted());
  	printk(KERN_EMERG " lock: %p, .magic: %08x, .owner: %s/%d, "
  			".owner_cpu: %d\n",
  		lock, lock->magic,
-@@ -112,9 +112,9 @@ static void __spin_lock_debug(spinlock_t
+@@ -114,9 +114,9 @@ static void __spin_lock_debug(spinlock_t *lock)
  		if (print_once) {
  			print_once = 0;
  			printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
 -					"%s/%d, %p\n",
 +					"%s/%d, %p (%s)\n",
  				raw_smp_processor_id(), current->comm,
--				current->pid, lock);
-+				current->pid, lock, print_tainted());
+-				task_pid_nr(current), lock);
++				task_pid_nr(current), lock, print_tainted());
  			dump_stack();
- 		}
- 	}
-@@ -154,9 +154,9 @@ static void rwlock_bug(rwlock_t *lock, c
+ #ifdef CONFIG_SMP
+ 			trigger_all_cpu_backtrace();
+@@ -159,9 +159,9 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
  	if (!debug_locks_off())
  		return;
  
 -	printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n",
 +	printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p (%s)\n",
  		msg, raw_smp_processor_id(), current->comm,
--		current->pid, lock);
-+		current->pid, lock, print_tainted());
+-		task_pid_nr(current), lock);
++		task_pid_nr(current), lock, print_tainted());
  	dump_stack();
  }
  
-@@ -177,9 +177,9 @@ static void __read_lock_debug(rwlock_t *
+@@ -184,9 +184,9 @@ static void __read_lock_debug(rwlock_t *lock)
  		if (print_once) {
  			print_once = 0;
  			printk(KERN_EMERG "BUG: read-lock lockup on CPU#%d, "
@@ -48,7 +50,7 @@
  			dump_stack();
  		}
  	}
-@@ -250,9 +250,9 @@ static void __write_lock_debug(rwlock_t 
+@@ -259,9 +259,9 @@ static void __write_lock_debug(rwlock_t *lock)
  		if (print_once) {
  			print_once = 0;
  			printk(KERN_EMERG "BUG: write-lock lockup on CPU#%d, "
@@ -60,3 +62,4 @@
  			dump_stack();
  		}
  	}
+

linux-2.6-debug-taint-vm.patch:

Index: linux-2.6-debug-taint-vm.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-debug-taint-vm.patch,v
retrieving revision 1.3
retrieving revision 1.3.8.1
diff -u -r1.3 -r1.3.8.1
--- linux-2.6-debug-taint-vm.patch	24 Jul 2007 14:13:44 -0000	1.3
+++ linux-2.6-debug-taint-vm.patch	18 Feb 2008 16:55:17 -0000	1.3.8.1
@@ -1,5 +1,7 @@
---- linux-2.6.20.noarch/include/asm-generic/bug.h~	2007-02-12 16:18:21.000000000 -0500
-+++ linux-2.6.20.noarch/include/asm-generic/bug.h	2007-02-12 16:19:57.000000000 -0500
+diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
+index d56fedb..e35833a 100644
+--- a/include/asm-generic/bug.h
++++ b/include/asm-generic/bug.h
 @@ -3,6 +3,10 @@
  
  #include <linux/compiler.h>
@@ -11,29 +13,56 @@
  #ifdef CONFIG_BUG
  
  #ifdef CONFIG_GENERIC_BUG
-@@ -22,7 +26,7 @@ struct bug_entry {
+@@ -22,7 +26,8 @@ struct bug_entry {
  
  #ifndef HAVE_ARCH_BUG
  #define BUG() do { \
 -	printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
-+	printk("BUG: failure at %s:%d/%s()! (%s)\n", __FILE__, __LINE__, __FUNCTION__, print_tainted()); \
++	printk(KERN_ERR "BUG: failure at %s:%d/%s()! (%s)\n",	\
++		__FILE__, __LINE__, __FUNCTION__, print_tainted()); \
  	panic("BUG!"); \
  } while (0)
  #endif
-@@ -35,8 +39,7 @@ struct bug_entry {
+@@ -32,13 +37,13 @@ struct bug_entry {
+ #endif
+ 
+ #ifndef HAVE_ARCH_WARN_ON
++#ifndef __ASSEMBLY__
++void out_of_line_warnon(char *file, unsigned int line, const char *func);
++#endif
  #define WARN_ON(condition) ({						\
- 	typeof(condition) __ret_warn_on = (condition);			\
- 	if (unlikely(__ret_warn_on)) {					\
--		printk("BUG: at %s:%d %s()\n", __FILE__,		\
+ 	int __ret_warn_on = !!(condition);				\
+-	if (unlikely(__ret_warn_on)) {					\
+-		printk("WARNING: at %s:%d %s()\n", __FILE__,		\
 -			__LINE__, __FUNCTION__);			\
-+		printk("BUG: warning at %s:%d/%s() (%s)\n", __FILE__, __LINE__, __FUNCTION__, print_tainted()); \
- 		dump_stack();						\
- 	}								\
+-		dump_stack();						\
+-	}								\
++	if (unlikely(__ret_warn_on))					\
++		out_of_line_warnon(__FILE__, __LINE__, __FUNCTION__);	\
  	unlikely(__ret_warn_on);					\
-diff -urNp --exclude-from=/home/davej/.exclude linux-1740/kernel/panic.c linux-2000/kernel/panic.c
---- linux-1740/kernel/panic.c
-+++ linux-2000/kernel/panic.c
-@@ -151,6 +151,7 @@ const char *print_tainted(void)
+ })
+ #endif
+diff --git a/init/main.c b/init/main.c
+index 80b04b6..b1fad76 100644
+--- a/init/main.c
++++ b/init/main.c
+@@ -855,3 +855,11 @@ static int __init kernel_init(void * unused)
+ 	init_post();
+ 	return 0;
+ }
++
++void out_of_line_warnon(char *file, unsigned int line, const char *func)
++{
++	printk(KERN_ERR "WARNING: at %s:%d %s() (%s)\n",
++		file, line, func, print_tainted());
++	dump_stack();
++}
++EXPORT_SYMBOL(out_of_line_warnon);
+diff --git a/kernel/panic.c b/kernel/panic.c
+index 6f6e03e..198fc58 100644
+--- a/kernel/panic.c
++++ b/kernel/panic.c
+@@ -173,6 +173,7 @@ const char *print_tainted(void)
  		snprintf(buf, sizeof(buf), "Not tainted");
  	return(buf);
  }
@@ -41,9 +70,11 @@
  
  void add_taint(unsigned flag)
  {
---- linux-2.6.15/mm/page_alloc.c~	2006-01-07 20:48:33.000000000 -0500
-+++ linux-2.6.15/mm/page_alloc.c	2006-01-07 20:49:24.000000000 -0500
-@@ -137,12 +137,12 @@ static inline int bad_range(struct zone 
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c
+index b5a58d4..7a0c25d 100644
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -221,12 +221,12 @@ static inline int bad_range(struct zone *zone, struct page *page)
  static void bad_page(struct page *page)
  {
  	printk(KERN_EMERG "Bad page state in process '%s'\n"
@@ -58,9 +89,11 @@
  	dump_stack();
  	page->flags &= ~(1 << PG_lru	|
  			1 << PG_private |
---- linux-2.6.20.noarch/mm/slab.c~	2007-04-04 16:36:51.000000000 -0400
-+++ linux-2.6.20.noarch/mm/slab.c	2007-04-04 16:37:03.000000000 -0400
-@@ -1802,8 +1802,8 @@ static void check_poison_obj(struct kmem
+diff --git a/mm/slab.c b/mm/slab.c
+index 2e338a5..e5627f9 100644
+--- a/mm/slab.c
++++ b/mm/slab.c
+@@ -1846,8 +1846,8 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp)
  			/* Print header */
  			if (lines == 0) {
  				printk(KERN_ERR
@@ -69,11 +102,9 @@
 +					"Slab corruption (%s): %s start=%p, len=%d\n",
 +					print_tainted(), cachep->name, realobj, size);
  				print_objinfo(cachep, objp, 0);
- 				dump_stack();
  			}
---- linux-2.6.21.noarch/mm/slab.c~	2007-05-14 11:51:33.000000000 -0400
-+++ linux-2.6.21.noarch/mm/slab.c	2007-05-14 11:53:00.000000000 -0400
-@@ -2924,8 +2924,8 @@ static void check_slabp(struct kmem_cach
+ 			/* Hexdump the affected line */
+@@ -2935,8 +2935,8 @@ static void check_slabp(struct kmem_cache *cachep, struct slab *slabp)
  	if (entries != cachep->num - slabp->inuse) {
  bad:
  		printk(KERN_ERR "slab: Internal list corruption detected in "
@@ -84,3 +115,16 @@
  		for (i = 0;
  		     i < sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t);
  		     i++) {
+diff --git a/mm/slub.c b/mm/slub.c
+index 9c1d9f3..e11d58d 100644
+--- a/mm/slub.c
++++ b/mm/slub.c
+@@ -451,7 +451,7 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...)
+ 	va_end(args);
+ 	printk(KERN_ERR "========================================"
+ 			"=====================================\n");
+-	printk(KERN_ERR "BUG %s: %s\n", s->name, buf);
++	printk(KERN_ERR "BUG %s (%s): %s\n", s->name, print_tainted(), buf);
+ 	printk(KERN_ERR "----------------------------------------"
+ 			"-------------------------------------\n\n");
+ }

linux-2.6-defaults-fat-utf8.patch:

Index: linux-2.6-defaults-fat-utf8.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-defaults-fat-utf8.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-defaults-fat-utf8.patch	24 Jan 2007 01:28:48 -0000	1.1
+++ linux-2.6-defaults-fat-utf8.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,9 +1,9 @@
 
 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181963
 
---- linux-2.6.15.noarch/fs/fat/inode.c~	2006-02-20 23:20:12.000000000 -0500
-+++ linux-2.6.15.noarch/fs/fat/inode.c	2006-02-20 23:21:42.000000000 -0500
-@@ -952,7 +952,8 @@ static int parse_options(char *options, 
+--- linux-2.6.21.noarch/fs/fat/inode.c~	2007-05-27 23:22:31.000000000 -0400
++++ linux-2.6.21.noarch/fs/fat/inode.c	2007-05-27 23:22:50.000000000 -0400
+@@ -950,7 +950,8 @@ static int parse_options(char *options, 
  		opts->shortname = 0;
  	opts->name_check = 'n';
  	opts->quiet = opts->showexec = opts->sys_immutable = opts->dotsOK =  0;
@@ -11,5 +11,5 @@
 +	opts->utf8 = 1;
 +	opts->unicode_xlate = 0;
  	opts->numtail = 1;
- 	opts->nocase = 0;
+ 	opts->usefree = opts->nocase = 0;
  	*debug = 0;

linux-2.6-devmem.patch:

Index: linux-2.6-devmem.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-devmem.patch,v
retrieving revision 1.3
retrieving revision 1.3.8.1
diff -u -r1.3 -r1.3.8.1
--- linux-2.6-devmem.patch	24 Jul 2007 14:13:44 -0000	1.3
+++ linux-2.6-devmem.patch	18 Feb 2008 16:55:17 -0000	1.3.8.1
@@ -1,7 +1,15 @@
-Index: patching/arch/i386/mm/init.c
+
+Restrict the abilities of /dev/mem and /dev/kmem
+Make them read-only, and also restrict which areas of
+memory can be read.
+
+Original by Arjan van de Ven
+Signed-off-by: Dave Jones <davej at redhat.com>
+
+Index: linux-2.6/arch/i386/mm/init.c
 ===================================================================
---- patching.orig/arch/i386/mm/init.c
-+++ patching/arch/i386/mm/init.c
+--- linux-2.6.orig/arch/x86/mm/init_32.c
++++ linux-2.6/arch/x86/mm/init_32.c
 @@ -233,6 +233,25 @@ int page_is_ram(unsigned long pagenr)
  	return 0;
  }
@@ -18,38 +26,37 @@
 + */
 +int devmem_is_allowed(unsigned long pagenr)
 +{
-+   if (pagenr <= 256)
-+       return 1;
-+   if (!page_is_ram(pagenr))
-+       return 1;
-+   return 0;
++	if (pagenr <= 256)
++		return 1;
++	if (!page_is_ram(pagenr))
++		return 1;
++	return 0;
 +}
 +
  #ifdef CONFIG_HIGHMEM
  pte_t *kmap_pte;
  pgprot_t kmap_prot;
-Index: patching/arch/ia64/mm/init.c
+Index: linux-2.6/arch/ia64/mm/init.c
 ===================================================================
---- patching.orig/arch/ia64/mm/init.c
-+++ patching/arch/ia64/mm/init.c
-@@ -281,6 +281,13 @@ free_initrd_mem (unsigned long start, un
+--- linux-2.6.orig/arch/ia64/mm/init.c
++++ linux-2.6/arch/ia64/mm/init.c
+@@ -263,6 +263,12 @@ free_initrd_mem (unsigned long start, un
  	}
  }
  
 +int page_is_ram(unsigned long pagenr)
 +{
 +      //FIXME: implement w/efi walk
-+      printk("page is ram is called!!!!!\n");	
 +      return 1;
 +}
 +
  /*
   * This installs a clean page in the kernel's page table.
   */
-Index: patching/arch/powerpc/mm/mem.c
+Index: linux-2.6/arch/powerpc/mm/mem.c
 ===================================================================
---- patching.orig/arch/powerpc/mm/mem.c
-+++ patching/arch/powerpc/mm/mem.c
+--- linux-2.6.orig/arch/powerpc/mm/mem.c
++++ linux-2.6/arch/powerpc/mm/mem.c
 @@ -45,6 +45,7 @@
  #include <asm/prom.h>
  #include <asm/lmb.h>
@@ -58,7 +65,7 @@
  #include <asm/vdso.h>
  
  #include "mmu_decl.h"
-@@ -339,6 +340,19 @@ void __init mem_init(void)
+@@ -343,6 +344,19 @@ void __init mem_init(void)
  	max_mapnr = max_pfn;
  	totalram_pages += free_all_bootmem();
  #endif
@@ -78,15 +85,13 @@
  	for_each_online_pgdat(pgdat) {
  		for (i = 0; i < pgdat->node_spanned_pages; i++) {
  			if (!pfn_valid(pgdat->node_start_pfn + i))
-Index: patching/arch/s390/mm/init.c
-===================================================================
---- patching.orig/arch/s390/mm/init.c
-+++ patching/arch/s390/mm/init.c
-@@ -148,6 +148,11 @@ void __init paging_init(void)
+--- linux-2.6.21.noarch/arch/s390/mm/init.c~	2007-05-27 23:04:09.000000000 -0400
++++ linux-2.6.21.noarch/arch/s390/mm/init.c	2007-05-27 23:04:20.000000000 -0400
+@@ -156,6 +156,11 @@ void __init paging_init(void)
  	free_area_init_nodes(max_zone_pfns);
  }
  
-+int page_is_ram (unsigned long pagenr)
++int page_is_ram(unsigned long pagenr)
 +{
 +	return pagenr < max_mapnr;
 +}
@@ -94,15 +99,15 @@
  void __init mem_init(void)
  {
  	unsigned long codesize, reservedpages, datasize, initsize;
-Index: patching/arch/x86_64/mm/init.c
+Index: linux-2.6/arch/x86_64/mm/init.c
 ===================================================================
---- patching.orig/arch/x86_64/mm/init.c
-+++ patching/arch/x86_64/mm/init.c
+--- linux-2.6.orig/arch/x86/mm/init_64.c
++++ linux-2.6/arch/x86/mm/init_64.c
 @@ -452,6 +452,28 @@ void __init clear_kernel_mapping(unsigne
  	__flush_tlb_all();
  } 
  
-+static inline int page_is_ram (unsigned long pagenr)
++static int page_is_ram(unsigned long pagenr)
 +{
 +	int i;
 +
@@ -136,10 +141,10 @@
 + * valid. The argument is a physical page number.
 + *
 + *
-+ * On x86-64, access has to be given to the first megabyte of ram because that area
++ * On x86-64, access has to be given to the first 1MB of ram because that area
 + * contains bios code and data regions used by X and dosemu and similar apps.
-+ * Access has to be given to non-kernel-ram areas as well, these contain the PCI
-+ * mmio resources as well as potential bios/acpi data regions.
++ * Access has to be given to non-kernel-ram areas as well, these contain the
++ * PCI MMIO resources as well as potential bios/acpi data regions.
 + */
 +int devmem_is_allowed(unsigned long pagenr)
 +{
@@ -154,224 +159,23 @@
  static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
  			 kcore_vsyscall;
  
-Index: patching/drivers/char/mem.c
-===================================================================
---- patching.orig/drivers/char/mem.c
-+++ patching/drivers/char/mem.c
-@@ -35,6 +35,22 @@
- # include <linux/efi.h>
- #endif
- 
-+static inline int range_is_allowed(unsigned long from, unsigned long to)
-+{
-+	unsigned long cursor;
-+
-+	cursor = from >> PAGE_SHIFT;
-+	while ((cursor << PAGE_SHIFT) < to) {
-+		if (!devmem_is_allowed(cursor)) {
-+			printk ("Program %s tried to read /dev/mem between %lx->%lx.\n",
-+					current->comm, from, to);
-+			return 0;
-+		}
-+		cursor++;
-+	}
-+	return 1;
-+}
-+
- /*
-  * Architectures vary in how they handle caching for addresses
-  * outside of main memory.
-@@ -152,6 +168,8 @@ static ssize_t read_mem(struct file * fi
- 		 */
- 		ptr = xlate_dev_mem_ptr(p);
- 
-+		if (!range_is_allowed(p, p+count))
-+			return -EPERM;
- 		if (copy_to_user(buf, ptr, sz))
- 			return -EFAULT;
- 		buf += sz;
-@@ -209,6 +227,8 @@ static ssize_t write_mem(struct file * f
- 		 */
- 		ptr = xlate_dev_mem_ptr(p);
- 
-+		if (!range_is_allowed(ptr, ptr+sz))
-+			return -EPERM;
- 		copied = copy_from_user(ptr, buf, sz);
- 		if (copied) {
- 			written += sz - copied;
-@@ -359,6 +379,8 @@ static ssize_t read_kmem(struct file *fi
- 	ssize_t low_count, read, sz;
- 	char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
- 
-+	return -EPERM;
-+
- 	read = 0;
- 	if (p < (unsigned long) high_memory) {
- 		low_count = count;
-@@ -434,126 +456,6 @@ static ssize_t read_kmem(struct file *fi
-  	return read;
- }
- 
--
--static inline ssize_t
--do_write_kmem(void *p, unsigned long realp, const char __user * buf,
--	      size_t count, loff_t *ppos)
--{
--	ssize_t written, sz;
--	unsigned long copied;
--
--	written = 0;
--#ifdef __ARCH_HAS_NO_PAGE_ZERO_MAPPED
--	/* we don't have page 0 mapped on sparc and m68k.. */
--	if (realp < PAGE_SIZE) {
--		unsigned long sz = PAGE_SIZE - realp;
--		if (sz > count)
--			sz = count;
--		/* Hmm. Do something? */
--		buf += sz;
--		p += sz;
--		realp += sz;
--		count -= sz;
--		written += sz;
--	}
--#endif
--
--	while (count > 0) {
--		char *ptr;
--		/*
--		 * Handle first page in case it's not aligned
--		 */
--		if (-realp & (PAGE_SIZE - 1))
--			sz = -realp & (PAGE_SIZE - 1);
--		else
--			sz = PAGE_SIZE;
--
--		sz = min_t(unsigned long, sz, count);
--
--		/*
--		 * On ia64 if a page has been mapped somewhere as
--		 * uncached, then it must also be accessed uncached
--		 * by the kernel or data corruption may occur
--		 */
--		ptr = xlate_dev_kmem_ptr(p);
--
--		copied = copy_from_user(ptr, buf, sz);
--		if (copied) {
--			written += sz - copied;
--			if (written)
--				break;
--			return -EFAULT;
--		}
--		buf += sz;
--		p += sz;
--		realp += sz;
--		count -= sz;
--		written += sz;
--	}
--
--	*ppos += written;
--	return written;
--}
--
--
--/*
-- * This function writes to the *virtual* memory as seen by the kernel.
-- */
--static ssize_t write_kmem(struct file * file, const char __user * buf, 
--			  size_t count, loff_t *ppos)
--{
--	unsigned long p = *ppos;
--	ssize_t wrote = 0;
--	ssize_t virtr = 0;
--	ssize_t written;
--	char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
--
--	if (p < (unsigned long) high_memory) {
--
--		wrote = count;
--		if (count > (unsigned long) high_memory - p)
--			wrote = (unsigned long) high_memory - p;
--
--		written = do_write_kmem((void*)p, p, buf, wrote, ppos);
--		if (written != wrote)
--			return written;
--		wrote = written;
--		p += wrote;
--		buf += wrote;
--		count -= wrote;
--	}
--
--	if (count > 0) {
--		kbuf = (char *)__get_free_page(GFP_KERNEL);
--		if (!kbuf)
--			return wrote ? wrote : -ENOMEM;
--		while (count > 0) {
--			int len = count;
--
--			if (len > PAGE_SIZE)
--				len = PAGE_SIZE;
--			if (len) {
--				written = copy_from_user(kbuf, buf, len);
--				if (written) {
--					if (wrote + virtr)
--						break;
--					free_page((unsigned long)kbuf);
--					return -EFAULT;
--				}
--			}
--			len = vwrite(kbuf, (char *)p, len);
--			count -= len;
--			buf += len;
--			virtr += len;
--			p += len;
--		}
--		free_page((unsigned long)kbuf);
--	}
--
-- 	*ppos = p;
-- 	return virtr + wrote;
--}
--
- #if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
- static ssize_t read_port(struct file * file, char __user * buf,
- 			 size_t count, loff_t *ppos)
-@@ -828,7 +730,6 @@ extern const struct file_operations mem_
- static const struct file_operations kmem_fops = {
- 	.llseek		= memory_lseek,
- 	.read		= read_kmem,
--	.write		= write_kmem,
- 	.mmap		= mmap_kmem,
- 	.open		= open_kmem,
- 	.get_unmapped_area = get_unmapped_area_mem,
-@@ -964,7 +865,6 @@ static const struct {
- 	const struct file_operations	*fops;
- } devlist[] = { /* list of minor devices */
- 	{1, "mem",     S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
--	{2, "kmem",    S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
- 	{3, "null",    S_IRUGO | S_IWUGO,           &null_fops},
- #if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
- 	{4, "port",    S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
-Index: patching/fs/proc/kcore.c
+Index: linux-2.6/fs/proc/kcore.c
 ===================================================================
---- patching.orig/fs/proc/kcore.c
-+++ patching/fs/proc/kcore.c
-@@ -23,10 +23,10 @@
- #include <asm/io.h>
+--- linux-2.6.orig/fs/proc/kcore.c
++++ linux-2.6/fs/proc/kcore.c
+@@ -25,7 +25,7 @@
  
- #define CORE_STR "CORE"
--
-+unsigned int allow_kcore_access = 0;
  static int open_kcore(struct inode * inode, struct file * filp)
  {
 -	return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
-+	return (capable(CAP_SYS_RAWIO) && allow_kcore_access) ? 0 : -EPERM;
++	return -EPERM;
  }
  
  static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
-Index: patching/include/asm-alpha/page.h
+Index: linux-2.6/include/asm-alpha/page.h
 ===================================================================
---- patching.orig/include/asm-alpha/page.h
-+++ patching/include/asm-alpha/page.h
+--- linux-2.6.orig/include/asm-alpha/page.h
++++ linux-2.6/include/asm-alpha/page.h
 @@ -93,6 +93,8 @@ typedef unsigned long pgprot_t;
  #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE | VM_EXEC | \
  					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
@@ -381,10 +185,10 @@
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
  
-Index: patching/include/asm-arm/page.h
+Index: linux-2.6/include/asm-arm/page.h
 ===================================================================
---- patching.orig/include/asm-arm/page.h
-+++ patching/include/asm-arm/page.h
+--- linux-2.6.orig/include/asm-arm/page.h
++++ linux-2.6/include/asm-arm/page.h
 @@ -192,6 +192,8 @@ typedef unsigned long pgprot_t;
  
  #include <asm-generic/page.h>
@@ -394,23 +198,10 @@
  #endif /* __KERNEL__ */
  
  #endif
-Index: patching/include/asm-arm26/page.h
-===================================================================
---- patching.orig/include/asm-arm26/page.h
-+++ patching/include/asm-arm26/page.h
-@@ -95,6 +95,8 @@ typedef unsigned long pgprot_t;
- #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
- 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
- 
-+#define devmem_is_allowed(x) 1
-+
- #endif /* __KERNEL__ */
- 
- #include <asm-generic/page.h>
-Index: patching/include/asm-cris/page.h
+Index: linux-2.6/include/asm-cris/page.h
 ===================================================================
---- patching.orig/include/asm-cris/page.h
-+++ patching/include/asm-cris/page.h
+--- linux-2.6.orig/include/asm-cris/page.h
++++ linux-2.6/include/asm-cris/page.h
 @@ -76,6 +76,8 @@ typedef struct { unsigned long pgprot; }
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
@@ -420,10 +211,10 @@
  #endif /* __KERNEL__ */
  
  #endif /* _CRIS_PAGE_H */
-Index: patching/include/asm-h8300/page.h
+Index: linux-2.6/include/asm-h8300/page.h
 ===================================================================
---- patching.orig/include/asm-h8300/page.h
-+++ patching/include/asm-h8300/page.h
+--- linux-2.6.orig/include/asm-h8300/page.h
++++ linux-2.6/include/asm-h8300/page.h
 @@ -78,6 +78,8 @@ extern unsigned long memory_end;
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
@@ -433,11 +224,11 @@
  #endif /* __KERNEL__ */
  
  #endif /* _H8300_PAGE_H */
-Index: patching/include/asm-i386/page.h
+Index: linux-2.6/include/asm-i386/page.h
 ===================================================================
---- patching.orig/include/asm-i386/page.h
-+++ patching/include/asm-i386/page.h
-@@ -110,6 +110,8 @@ extern int sysctl_legacy_va_layout;
+--- linux-2.6.orig/include/asm-x86/page_32.h
++++ linux-2.6/include/asm-x86/page_32.h
+@@ -108,6 +108,8 @@ extern int sysctl_legacy_va_layout;
  
  extern int page_is_ram(unsigned long pagenr);
  
@@ -446,23 +237,21 @@
  #endif /* __ASSEMBLY__ */
  
  #ifdef __ASSEMBLY__
-Index: patching/include/asm-ia64/page.h
+Index: linux-2.6/include/asm-ia64/page.h
 ===================================================================
---- patching.orig/include/asm-ia64/page.h
-+++ patching/include/asm-ia64/page.h
-@@ -229,6 +229,8 @@ get_order (unsigned long size)
+--- linux-2.6.orig/include/asm-ia64/page.h
++++ linux-2.6/include/asm-ia64/page.h
+@@ -227,5 +227,6 @@ get_order (unsigned long size)
  					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
  					  ? VM_EXEC : 0))
  
 +#define devmem_is_allowed(x) 1
-+
- #ifndef __ASSEMBLY__
- #ifdef CONFIG_XEN
- 
-Index: patching/include/asm-m68k/page.h
+ # endif /* __KERNEL__ */
+ #endif /* _ASM_IA64_PAGE_H */
+Index: linux-2.6/include/asm-m68k/page.h
 ===================================================================
---- patching.orig/include/asm-m68k/page.h
-+++ patching/include/asm-m68k/page.h
+--- linux-2.6.orig/include/asm-m68k/page.h
++++ linux-2.6/include/asm-m68k/page.h
 @@ -177,6 +177,8 @@ static inline void *__va(unsigned long x
  
  #include <asm-generic/page.h>
@@ -472,10 +261,10 @@
  #endif /* __KERNEL__ */
  
  #endif /* _M68K_PAGE_H */
-Index: patching/include/asm-m68knommu/page.h
+Index: linux-2.6/include/asm-m68knommu/page.h
 ===================================================================
---- patching.orig/include/asm-m68knommu/page.h
-+++ patching/include/asm-m68knommu/page.h
+--- linux-2.6.orig/include/asm-m68knommu/page.h
++++ linux-2.6/include/asm-m68knommu/page.h
 @@ -77,6 +77,8 @@ extern unsigned long memory_end;
  
  #include <asm-generic/page.h>
@@ -485,22 +274,22 @@
  #endif /* __KERNEL__ */
  
  #endif /* _M68KNOMMU_PAGE_H */
-Index: patching/include/asm-mips/page.h
+Index: linux-2.6/include/asm-mips/page.h
 ===================================================================
---- patching.orig/include/asm-mips/page.h
-+++ patching/include/asm-mips/page.h
-@@ -199,4 +199,6 @@ typedef struct { unsigned long pgprot; }
+--- linux-2.6.orig/include/asm-mips/page.h
++++ linux-2.6/include/asm-mips/page.h
+@@ -178,4 +178,6 @@ typedef struct { unsigned long pgprot; }
  
  #endif /* defined (__KERNEL__) */
  
 +#define devmem_is_allowed(x) 1
 +
  #endif /* _ASM_PAGE_H */
-Index: patching/include/asm-parisc/page.h
+Index: linux-2.6/include/asm-parisc/page.h
 ===================================================================
---- patching.orig/include/asm-parisc/page.h
-+++ patching/include/asm-parisc/page.h
-@@ -173,6 +173,8 @@ extern int npmem_ranges;
+--- linux-2.6.orig/include/asm-parisc/page.h
++++ linux-2.6/include/asm-parisc/page.h
+@@ -169,6 +169,8 @@ extern int npmem_ranges;
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
  
@@ -509,10 +298,10 @@
  #endif /* __KERNEL__ */
  
  #endif /* _PARISC_PAGE_H */
-Index: patching/include/asm-ppc/page.h
+Index: linux-2.6/include/asm-ppc/page.h
 ===================================================================
---- patching.orig/include/asm-ppc/page.h
-+++ patching/include/asm-ppc/page.h
+--- linux-2.6.orig/include/asm-ppc/page.h
++++ linux-2.6/include/asm-ppc/page.h
 @@ -173,6 +173,8 @@ extern __inline__ int get_order(unsigned
  /* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
  #define __HAVE_ARCH_GATE_AREA		1
@@ -522,10 +311,10 @@
  #include <asm-generic/memory_model.h>
  #endif /* __KERNEL__ */
  #endif /* _PPC_PAGE_H */
-Index: patching/include/asm-powerpc/page.h
+Index: linux-2.6/include/asm-powerpc/page.h
 ===================================================================
---- patching.orig/include/asm-powerpc/page.h
-+++ patching/include/asm-powerpc/page.h
+--- linux-2.6.orig/include/asm-powerpc/page.h
++++ linux-2.6/include/asm-powerpc/page.h
 @@ -191,6 +191,8 @@ extern const char *arch_vma_name(struct 
  #include <asm-generic/memory_model.h>
  #endif /* __ASSEMBLY__ */
@@ -535,11 +324,11 @@
  #endif /* __KERNEL__ */
  
  #endif /* _ASM_POWERPC_PAGE_H */
-Index: patching/include/asm-s390/page.h
+Index: linux-2.6/include/asm-s390/page.h
 ===================================================================
---- patching.orig/include/asm-s390/page.h
-+++ patching/include/asm-s390/page.h
-@@ -166,6 +166,8 @@ static inline int pfn_valid(unsigned lon
+--- linux-2.6.orig/include/asm-s390/page.h
++++ linux-2.6/include/asm-s390/page.h
+@@ -148,6 +148,8 @@ page_get_storage_key(unsigned long addr)
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
  
@@ -548,22 +337,20 @@
  #endif /* __KERNEL__ */
  
  #endif /* _S390_PAGE_H */
-Index: patching/include/asm-sh/page.h
-===================================================================
---- patching.orig/include/asm-sh/page.h
-+++ patching/include/asm-sh/page.h
-@@ -148,5 +148,7 @@ typedef struct { unsigned long pgd; } pg
- #define __HAVE_ARCH_GATE_AREA
- #endif
+--- linux-2.6.22.noarch/include/asm-sh/page.h~	2007-07-20 14:22:49.000000000 -0400
++++ linux-2.6.22.noarch/include/asm-sh/page.h	2007-07-20 14:22:54.000000000 -0400
+@@ -158,5 +158,7 @@ typedef struct { unsigned long pgd; } pg
+ #define ARCH_KMALLOC_MINALIGN	4
+ #define ARCH_SLAB_MINALIGN	4
  
 +#define devmem_is_allowed(x) 1
 +
  #endif /* __KERNEL__ */
  #endif /* __ASM_SH_PAGE_H */
-Index: patching/include/asm-sh64/page.h
+Index: linux-2.6/include/asm-sh64/page.h
 ===================================================================
---- patching.orig/include/asm-sh64/page.h
-+++ patching/include/asm-sh64/page.h
+--- linux-2.6.orig/include/asm-sh64/page.h
++++ linux-2.6/include/asm-sh64/page.h
 @@ -115,5 +115,7 @@ typedef struct { unsigned long pgprot; }
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
@@ -572,10 +359,10 @@
 +
  #endif /* __KERNEL__ */
  #endif /* __ASM_SH64_PAGE_H */
-Index: patching/include/asm-sparc/page.h
+Index: linux-2.6/include/asm-sparc/page.h
 ===================================================================
---- patching.orig/include/asm-sparc/page.h
-+++ patching/include/asm-sparc/page.h
+--- linux-2.6.orig/include/asm-sparc/page.h
++++ linux-2.6/include/asm-sparc/page.h
 @@ -163,6 +163,8 @@ extern unsigned long pfn_base;
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
@@ -585,10 +372,10 @@
  #endif /* __KERNEL__ */
  
  #endif /* _SPARC_PAGE_H */
-Index: patching/include/asm-sparc64/page.h
+Index: linux-2.6/include/asm-sparc64/page.h
 ===================================================================
---- patching.orig/include/asm-sparc64/page.h
-+++ patching/include/asm-sparc64/page.h
+--- linux-2.6.orig/include/asm-sparc64/page.h
++++ linux-2.6/include/asm-sparc64/page.h
 @@ -141,6 +141,8 @@ typedef unsigned long pgprot_t;
  #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
  				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
@@ -598,22 +385,21 @@
  #include <asm-generic/page.h>
  
  #endif /* __KERNEL__ */
-Index: patching/include/asm-um/page.h
-===================================================================
---- patching.orig/include/asm-um/page.h
-+++ patching/include/asm-um/page.h
-@@ -113,6 +113,7 @@ extern unsigned long uml_physmem;
- 
+--- linux-2.6.21.noarch/include/asm-um/page.h~	2007-05-27 23:05:22.000000000 -0400
++++ linux-2.6.21.noarch/include/asm-um/page.h	2007-05-27 23:05:34.000000000 -0400
+@@ -114,6 +114,8 @@ extern unsigned long uml_physmem;
  extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
  #define HAVE_ARCH_VALIDATE
+ 
 +#define devmem_is_allowed(x) 1
++
+ #include <asm-generic/memory_model.h>
+ #include <asm-generic/page.h>
  
- extern int arch_free_page(struct page *page, int order);
- #define HAVE_ARCH_FREE_PAGE
-Index: patching/include/asm-v850/page.h
+Index: linux-2.6/include/asm-v850/page.h
 ===================================================================
---- patching.orig/include/asm-v850/page.h
-+++ patching/include/asm-v850/page.h
+--- linux-2.6.orig/include/asm-v850/page.h
++++ linux-2.6/include/asm-v850/page.h
 @@ -126,6 +126,8 @@ typedef unsigned long pgprot_t;
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
@@ -623,10 +409,10 @@
  #endif /* KERNEL */
  
  #endif /* __V850_PAGE_H__ */
-Index: patching/include/asm-x86_64/page.h
+Index: linux-2.6/include/asm-x86_64/page.h
 ===================================================================
---- patching.orig/include/asm-x86_64/page.h
-+++ patching/include/asm-x86_64/page.h
+--- linux-2.6.orig/include/asm-x86/page_64.h
++++ linux-2.6/include/asm-x86/page_64.h
 @@ -138,6 +138,10 @@ typedef struct { unsigned long pgprot; }
  #include <asm-generic/memory_model.h>
  #include <asm-generic/page.h>
@@ -638,20 +424,159 @@
  #endif /* __KERNEL__ */
  
  #endif /* _X86_64_PAGE_H */
-Index: patching/arch/x86_64/kernel/machine_kexec.c
-===================================================================
---- patching.orig/arch/x86_64/kernel/machine_kexec.c
-+++ patching/arch/x86_64/kernel/machine_kexec.c
-@@ -344,10 +344,12 @@ NORET_TYPE void machine_kexec(struct kim
-  * Useful for holding code to do something appropriate
-  * after a kernel panic.
-  */
+--- linux-2.6.20.noarch/fs/proc/kcore.c.orig	2007-06-04 15:44:29.000000000 -0400
++++ linux-2.6.20.noarch/fs/proc/kcore.c	2007-06-04 15:48:57.000000000 -0400
+@@ -23,10 +23,10 @@
+ #include <asm/io.h>
+ 
+ #define CORE_STR "CORE"
+-
++unsigned int allow_kcore_access;
+ static int open_kcore(struct inode * inode, struct file * filp)
+ {
+-	return -EPERM;
++	return (capable(CAP_SYS_RAWIO) && allow_kcore_access) ? 0 : -EPERM;
+ }
+ 
+ static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
+--- linux-2.6.23.noarch/arch/x86/kernel/setup_32.c~	2007-10-22 01:29:17.000000000 -0400
++++ linux-2.6.23.noarch/arch/x86/kernel/setup_32.c	2007-10-22 01:29:41.000000000 -0400
+@@ -391,12 +391,16 @@ static inline unsigned long long get_tot
+ }
+ 
+ #ifdef CONFIG_KEXEC
 +extern int allow_kcore_access;
- static int __init setup_crashkernel(char *arg)
++
+ static void __init reserve_crashkernel(void)
+ {
+ 	unsigned long long total_mem;
+ 	unsigned long long crash_size, crash_base;
+ 	int ret;
+ 
++	allow_kcore_access = 1;	/*enable ability to read /proc/kcore*/
++
+ 	total_mem = get_total_mem();
+ 
+ 	ret = parse_crashkernel(boot_command_line, total_mem,
+--- linux-2.6.23.noarch/drivers/char/Kconfig~	2007-11-15 14:10:18.000000000 -0500
++++ linux-2.6.23.noarch/drivers/char/Kconfig	2007-11-15 14:10:40.000000000 -0500
+@@ -1062,6 +1062,20 @@ config DEVPORT
+ 	depends on ISA || PCI
+ 	default y
+ 
++config WRITABLE_DEVMEM
++	bool "Allow writing to /dev/mem"
++	help
++	  Very little software actually requires a writable /dev/mem
++	  Disabling this feature will close off a potential attack
++	  vector for kernel rootkits.
++
++config WRITABLE_DEVKMEM
++	bool "Allow writing to /dev/kmem"
++	help
++	  Very little software actually requires a writable /dev/kmem
++	  Disabling this feature will close off a potential attack
++	  vector for kernel rootkits.
++
+ source "drivers/s390/char/Kconfig"
+ 
+ endmenu
+--- vanilla/drivers/char/mem.c	2007-11-15 14:15:27.000000000 -0500
++++ linux-2.6.23.noarch/drivers/char/mem.c	2007-11-15 14:13:54.000000000 -0500
+@@ -108,6 +108,23 @@ static inline int valid_mmap_phys_addr_r
+ }
+ #endif
+ 
++static inline int range_is_allowed(unsigned long from, unsigned long to)
++{
++	unsigned long cursor;
++
++	cursor = from >> PAGE_SHIFT;
++	while ((cursor << PAGE_SHIFT) < to) {
++		if (!devmem_is_allowed(cursor)) {
++			printk(KERN_INFO "Program %s tried to read /dev/mem "
++				"between %lx->%lx.\n",
++				current->comm, from, to);
++			return 0;
++		}
++		cursor++;
++	}
++	return 1;
++}
++
+ /*
+  * This funcion reads the *physical* memory. The f_pos points directly to the 
+  * memory location. 
+@@ -157,6 +174,9 @@ static ssize_t read_mem(struct file * fi
+ 		 */
+ 		ptr = xlate_dev_mem_ptr(p);
+ 
++		//FIXME: Add write-once sysctl
++		//if (!range_is_allowed(p, p+count))
++		//	return -EPERM;
+ 		if (copy_to_user(buf, ptr, sz))
+ 			return -EFAULT;
+ 		buf += sz;
+@@ -169,6 +189,7 @@ static ssize_t read_mem(struct file * fi
+ 	return read;
+ }
+ 
++#ifdef CONFIG_WRITABLE_DEVMEM
+ static ssize_t write_mem(struct file * file, const char __user * buf, 
+ 			 size_t count, loff_t *ppos)
  {
- 	unsigned long size, base;
- 	char *p;
-+	allow_kcore_access = 1; /*enable ability to read /proc/kcore*/
- 	if (!arg)
- 		return -EINVAL;
- 	size = memparse(arg, &p);
+@@ -214,6 +235,8 @@ static ssize_t write_mem(struct file * f
+ 		 */
+ 		ptr = xlate_dev_mem_ptr(p);
+ 
++		if (!range_is_allowed(ptr, ptr+sz))
++			return -EPERM;
+ 		copied = copy_from_user(ptr, buf, sz);
+ 		if (copied) {
+ 			written += sz - copied;
+@@ -230,6 +253,9 @@ static ssize_t write_mem(struct file * f
+ 	*ppos += written;
+ 	return written;
+ }
++#else
++#define write_mem 0
++#endif
+ 
+ #ifndef __HAVE_PHYS_MEM_ACCESS_PROT
+ static pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
+@@ -363,6 +389,9 @@ static ssize_t read_kmem(struct file *fi
+ 	ssize_t low_count, read, sz;
+ 	char * kbuf; /* k-addr because vread() takes vmlist_lock rwlock */
+ 
++	//FIXME: Add write-once sysctl
++	//return -EPERM;
++
+ 	read = 0;
+ 	if (p < (unsigned long) high_memory) {
+ 		low_count = count;
+@@ -439,6 +468,7 @@ static ssize_t read_kmem(struct file *fi
+ }
+ 
+ 
++#ifdef CONFIG_WRITABLE_DEVKMEM
+ static inline ssize_t
+ do_write_kmem(void *p, unsigned long realp, const char __user * buf,
+ 	      size_t count, loff_t *ppos)
+@@ -557,6 +587,9 @@ static ssize_t write_kmem(struct file * 
+  	*ppos = p;
+  	return virtr + wrote;
+ }
++#else
++#define write_kmem 0
++#endif
+ 
+ #ifdef CONFIG_DEVPORT
+ static ssize_t read_port(struct file * file, char __user * buf,
+@@ -873,7 +906,6 @@ static const struct {
+ 	const struct file_operations	*fops;
+ } devlist[] = { /* list of minor devices */
+ 	{1, "mem",     S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
+-	{2, "kmem",    S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
+ 	{3, "null",    S_IRUGO | S_IWUGO,           &null_fops},
+ #ifdef CONFIG_DEVPORT
+ 	{4, "port",    S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},

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.3
retrieving revision 1.3.8.1
diff -u -r1.3 -r1.3.8.1
--- linux-2.6-execshield.patch	24 Jul 2007 14:13:44 -0000	1.3
+++ linux-2.6-execshield.patch	18 Feb 2008 16:55:17 -0000	1.3.8.1
@@ -1,13 +1,13 @@
 Index: linux-2.6/arch/i386/kernel/cpu/common.c
 ===================================================================
---- linux-2.6.orig/arch/i386/kernel/cpu/common.c
-+++ linux-2.6/arch/i386/kernel/cpu/common.c
+--- linux-2.6.orig/arch/x86/kernel/cpu/common.c
++++ linux-2.6/arch/x86/kernel/cpu/common.c
 @@ -437,6 +437,13 @@ void __cpuinit identify_cpu(struct cpuin
  	if (disable_pse)
  		clear_bit(X86_FEATURE_PSE, c->x86_capability);
  
 +	if (exec_shield != 0) {
-+#ifdef CONFIG_HIGHMEM64G   /* NX implies PAE */
++#ifdef CONFIG_X86_PAE
 +		if (!test_bit(X86_FEATURE_NX, c->x86_capability))
 +#endif
 +		clear_bit(X86_FEATURE_SEP, c->x86_capability);
@@ -16,19 +16,18 @@
  	/* If the model name is still unset, do table lookup. */
  	if ( !c->x86_model_id[0] ) {
  		char *p;
-Index: linux-2.6/arch/i386/kernel/process.c
-===================================================================
---- linux-2.6.orig/arch/i386/kernel/process.c
-+++ linux-2.6/arch/i386/kernel/process.c
-@@ -647,6 +647,8 @@ struct task_struct fastcall * __switch_t
+--- linux-2.6.21.noarch/arch/x86/kernel/process_32.c~	2007-05-27 22:27:45.000000000 -0400
++++ linux-2.6.21.noarch/arch/x86/kernel/process_32.c	2007-05-27 22:28:22.000000000 -0400
+@@ -649,7 +649,8 @@ struct task_struct fastcall * __switch_t
  	/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
  
  	__unlazy_fpu(prev_p);
+-
 +	if (next_p->mm)
 +		load_user_cs_desc(cpu, next_p->mm);
  
- 	/*
- 	 * Reload esp0.
+ 	/* we're going to use this soon, after a few expensive things */
+ 	if (next_p->fpu_counter > 5)
 @@ -907,3 +909,60 @@ unsigned long arch_align_stack(unsigned 
  		sp -= get_random_int() % 8192;
  	return sp & ~0xf;
@@ -90,16 +89,16 @@
 +		current->mm->brk = new_brk;
 +}
 +
---- linux-2.6.20.noarch/arch/i386/kernel/smp.c~	2007-02-17 21:43:47.000000000 -0500
-+++ linux-2.6.20.noarch/arch/i386/kernel/smp.c	2007-02-17 21:43:53.000000000 -0500
-@@ -23,6 +23,7 @@
+--- linux-2.6.22.noarch/arch/x86/kernel/smp_32.c~	2007-07-20 13:48:03.000000000 -0400
++++ linux-2.6.22.noarch/arch/x86/kernel/smp_32.c	2007-07-20 13:48:08.000000000 -0400
+@@ -22,6 +22,7 @@
  
  #include <asm/mtrr.h>
  #include <asm/tlbflush.h>
 +#include <asm/desc.h>
+ #include <asm/mmu_context.h>
  #include <mach_apic.h>
  
- /*
 @@ -325,6 +326,8 @@ fastcall void smp_invalidate_interrupt(s
  	unsigned long cpu;
  
@@ -109,73 +108,59 @@
  
  	if (!cpu_isset(cpu, flush_cpumask))
  		goto out;
-Index: linux-2.6/arch/i386/kernel/sysenter.c
-===================================================================
---- linux-2.6.orig/arch/i386/kernel/sysenter.c
-+++ linux-2.6/arch/i386/kernel/sysenter.c
+--- linux-2.6.22.noarch/arch/x86/kernel/sysenter_32.c~	2007-07-31 14:20:04.000000000 -0400
++++ linux-2.6.22.noarch/arch/x86/kernel/sysenter_32.c	2007-07-31 14:20:11.000000000 -0400
 @@ -16,6 +16,7 @@
  #include <linux/string.h>
  #include <linux/elf.h>
  #include <linux/mm.h>
 +#include <linux/mman.h>
+ #include <linux/err.h>
  #include <linux/module.h>
  
- #include <asm/cpufeature.h>
-@@ -118,7 +118,8 @@ static struct vm_operations_struct sysca
- extern void SYSENTER_RETURN;
- 
- /* Setup a VMA at program startup for the vsyscall page */
--int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
-+int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack,
-+				unsigned long start_code, unsigned long interp_map_address)
- {
- 	struct vm_area_struct *vma;
- 	struct mm_struct *mm = current->mm;
-@@ -126,7 +127,7 @@ int arch_setup_additional_pages(struct l
- 	int ret;
- 
- 	down_write(&mm->mmap_sem);
--	addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
-+	addr = get_unmapped_area_prot(NULL, 0, PAGE_SIZE, 0, 0, 1);
- 	if (IS_ERR_VALUE(addr)) {
- 		ret = addr;
- 		goto up_fail;
-Index: linux-2.6/kernel/sysctl.c
-===================================================================
---- linux-2.6.orig/kernel/sysctl.c
-+++ linux-2.6/kernel/sysctl.c
-@@ -77,6 +77,26 @@
- extern int percpu_pagelist_fraction;
- extern int compat_log;
+@@ -284,7 +284,7 @@ int arch_setup_additional_pages(struct l
+ 	if (compat)
+ 		addr = VDSO_HIGH_BASE;
+ 	else {
+-		addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
++		addr = get_unmapped_area_prot(NULL, 0, PAGE_SIZE, 0, 0, 1);
+ 		if (IS_ERR_VALUE(addr)) {
+ 			ret = addr;
+ 			goto up_fail;
+--- linux-2.6.22.noarch/kernel/sysctl.c~	2007-07-20 13:48:52.000000000 -0400
++++ linux-2.6.22.noarch/kernel/sysctl.c	2007-07-20 13:49:22.000000000 -0400
+@@ -80,6 +80,26 @@ extern int maps_protect;
+ extern int sysctl_stat_interval;
+ extern int audit_argv_kb;
  
 +int exec_shield = (1<<0);
 +/* exec_shield is a bitmask:
-+          0: off; vdso at STACK_TOP, 1 page below TASK_SIZE
-+   (1<<0) 1: on [also on if !=0]
-+   (1<<1) 2: force noexecstack regardless of PT_GNU_STACK
-+   The old settings
-+   (1<<2) 4: vdso just below .text of main (unless too low)
-+   (1<<3) 8: vdso just below .text of PT_INTERP (unless too low)
-+   are ignored because the vdso is placed completely randomly
-+*/
++ * 0: off; vdso at STACK_TOP, 1 page below TASK_SIZE
++ * (1<<0) 1: on [also on if !=0]
++ * (1<<1) 2: force noexecstack regardless of PT_GNU_STACK
++ * The old settings
++ * (1<<2) 4: vdso just below .text of main (unless too low)
++ * (1<<3) 8: vdso just below .text of PT_INTERP (unless too low)
++ * are ignored because the vdso is placed completely randomly
++ */
 +
 +static int __init setup_exec_shield(char *str)
 +{
-+        get_option (&str, &exec_shield);
++	get_option(&str, &exec_shield);
 +
-+        return 1;
++	return 1;
 +}
 +
 +__setup("exec-shield=", setup_exec_shield);
 +
- /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
- static int maxolduid = 65535;
- static int minolduid;
-@@ -331,6 +351,22 @@
+ /* Constants used for minimum and  maximum */
+ #ifdef CONFIG_DETECT_SOFTLOCKUP
+ static int one = 1;
+@@ -331,6 +351,14 @@
  		.proc_handler	= &proc_dointvec,
  	},
  	{
-+		.ctl_name	= KERN_EXEC_SHIELD,
++		.ctl_name	= CTL_UNNUMBERED,
 +		.procname	= "exec-shield",
 +		.data		= &exec_shield,
 +		.maxlen		= sizeof(int),
@@ -183,14 +168,6 @@
 +		.proc_handler	= &proc_dointvec,
 +	},
 +	{
-+		.ctl_name	= KERN_PRINT_FATAL,
-+		.procname	= "print-fatal-signals",
-+		.data		= &print_fatal_signals,
-+		.maxlen		= sizeof(int),
-+		.mode		= 0644,
-+		.proc_handler	= &proc_dointvec,
-+	},
-+	{
  		.ctl_name	= KERN_CORE_USES_PID,
  		.procname	= "core_uses_pid",
  		.data		= &core_uses_pid,
@@ -233,44 +210,41 @@
  		return prev;
  	}
  
-@@ -933,7 +940,7 @@ unsigned long do_mmap_pgoff(struct file 
+@@ -933,7 +940,8 @@ unsigned long do_mmap_pgoff(struct file 
  	/* Obtain the address to map to. we verify (or select) it and ensure
  	 * that it represents a valid section of the address space.
  	 */
 -	addr = get_unmapped_area(file, addr, len, pgoff, flags);
-+	addr = get_unmapped_area_prot(file, addr, len, pgoff, flags, prot & PROT_EXEC);
++	addr = get_unmapped_area_prot(file, addr, len, pgoff, flags,
++		prot & PROT_EXEC);
  	if (addr & ~PAGE_MASK)
  		return addr;
  
-@@ -1353,16 +1360,21 @@ void arch_unmap_area_topdown(struct mm_s
- 		mm->free_area_cache = mm->mmap_base;
+@@ -1370,13 +1370,17 @@ void arch_unmap_area_topdown(struct mm_s
  }
  
-+
  unsigned long
 -get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
 -		unsigned long pgoff, unsigned long flags)
 +get_unmapped_area_prot(struct file *file, unsigned long addr, unsigned long len,
 +		unsigned long pgoff, unsigned long flags, int exec)
  {
- 	unsigned long ret;
+ 	unsigned long (*get_area)(struct file *, unsigned long,
+ 				  unsigned long, unsigned long, unsigned long);
  
- 	if (!(flags & MAP_FIXED)) {
- 		unsigned long (*get_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
- 
--		get_area = current->mm->get_unmapped_area;
-+		if (exec && current->mm->get_unmapped_exec_area)
-+			get_area = current->mm->get_unmapped_exec_area;
-+		else
-+			get_area = current->mm->get_unmapped_area;
-+
- 		if (file && file->f_op && file->f_op->get_unmapped_area)
- 			get_area = file->f_op->get_unmapped_area;
- 		addr = get_area(file, addr, len, pgoff, flags);
-@@ -1393,7 +1405,71 @@ get_unmapped_area(struct file *file, uns
+-	get_area = current->mm->get_unmapped_area;
++	if (exec && current->mm->get_unmapped_exec_area)
++		get_area = current->mm->get_unmapped_exec_area;
++	else
++		get_area = current->mm->get_unmapped_area;
++
+ 	if (file && file->f_op && file->f_op->get_unmapped_area)
+ 		get_area = file->f_op->get_unmapped_area;
+ 	addr = get_area(file, addr, len, pgoff, flags);
+@@ -1393,7 +1405,72 @@ get_unmapped_area(struct file *file, uns
  	return addr;
  }
- 
+-
 -EXPORT_SYMBOL(get_unmapped_area);
 +EXPORT_SYMBOL(get_unmapped_area_prot);
 +
@@ -318,7 +292,9 @@
 +			 * as much as possible:
 +			 */
 +			if (addr >= 0x01000000) {
-+				tmp = randomize_range(0x01000000, PAGE_ALIGN(max(mm->start_brk, (unsigned long)0x08000000)), len);
++				tmp = randomize_range(0x01000000,
++					PAGE_ALIGN(max(mm->start_brk,
++					(unsigned long)0x08000000)), len);
 +				vma = find_vma(mm, tmp);
 +				if (TASK_SIZE - len >= tmp &&
 +				    (!vma || tmp + len <= vma->vm_start))
@@ -389,16 +365,13 @@
  
  	/*
  	 * Walk the list again, actually closing and freeing it,
-Index: linux-2.6/arch/i386/kernel/traps.c
-===================================================================
---- linux-2.6.orig/arch/i386/kernel/traps.c
-+++ linux-2.6/arch/i386/kernel/traps.c
-@@ -638,7 +638,82 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", inv
+--- linux-2.6.22.noarch/arch/x86/kernel/traps_32.c~	2007-07-20 13:50:07.000000000 -0400
++++ linux-2.6.22.noarch/arch/x86/kernel/traps_32.c	2007-07-20 13:52:09.000000000 -0400
+@@ -573,7 +573,91 @@ 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)
--DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0)
-+
+ DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0, 0)
+-DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0, 1)
 +
 +/*
 + * lazy-check for CS validity on exec-shield binaries:
@@ -423,6 +396,9 @@
 +		for (vma = current->mm->mmap; vma; vma = vma->vm_next)
 +			if ((vma->vm_flags & VM_EXEC) && (vma->vm_end > limit))
 +				limit = vma->vm_end;
++		vma = get_gate_vma(current);
++		if (vma && (vma->vm_flags & VM_EXEC) && (vma->vm_end > limit))
++			limit = vma->vm_end;
 +		spin_unlock(&current->mm->page_table_lock);
 +		if (limit >= TASK_SIZE)
 +			limit = -1UL;
@@ -440,8 +416,10 @@
 +		 * we won't hit this branch next time around.
 +		 */
 +		if (print_fatal_signals >= 2) {
-+			printk("#GPF fixup (%ld[seg:%lx]) at %08lx, CPU#%d.\n", error_code, error_code/8, regs->eip, smp_processor_id());
-+			printk(" exec_limit: %08lx, user_cs: %08lx/%08lx, CPU_cs: %08lx/%08lx.\n", current->mm->context.exec_limit, desc1->a, desc1->b, desc2->a, desc2->b);
++			printk(KERN_ERR "#GPF fixup (%ld[seg:%lx]) at %08lx, CPU#%d.\n",
++				error_code, error_code/8, regs->eip, smp_processor_id());
++			printk(KERN_ERR "exec_limit: %08lx, user_cs: %08lx/%08lx, CPU_cs: %08lx/%08lx.\n",
++				current->mm->context.exec_limit, desc1->a, desc1->b, desc2->a, desc2->b);
 +		}
 +		load_user_cs_desc(cpu, current->mm);
 +		return 1;
@@ -454,17 +432,21 @@
 + * The fixup code for errors in iret jumps to here (iret_exc).  It loses
 + * the original trap number and error code.  The bogus trap 32 and error
 + * code 0 are what the vanilla kernel delivers via:
-+ * DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0)
++ * DO_ERROR_INFO(32, SIGSEGV, "iret exception", iret_error, ILL_BADSTK, 0, 1)
++ *
++ * NOTE: Because of the final "1" in the macro we need to enable interrupts.
 + *
 + * In case of a general protection fault in the iret instruction, we
 + * need to check for a lazy CS update for exec-shield.
 + */
 +fastcall void do_iret_error(struct pt_regs *regs, long error_code)
 +{
-+	int ok = check_lazy_exec_limit(get_cpu(), regs, error_code);
++	int ok;
++	local_irq_enable();
++	ok = check_lazy_exec_limit(get_cpu(), regs, error_code);
 +	put_cpu();
 +	if (!ok && notify_die(DIE_TRAP, "iret exception", regs,
-+			      error_code, 32, SIGSEGV) != NOTIFY_STOP) {
++	    error_code, 32, SIGSEGV) != NOTIFY_STOP) {
 +		siginfo_t info;
 +		info.si_signo = SIGSEGV;
 +		info.si_errno = 0;
@@ -474,6 +456,7 @@
 +			&info);
 +	}
 +}
++
  
  fastcall void __kprobes do_general_protection(struct pt_regs * regs,
  					      long error_code)
@@ -485,15 +468,15 @@
  
  	/*
  	 * Perform the lazy TSS's I/O bitmap copy. If the TSS has an
-@@ -672,7 +748,6 @@ fastcall void __kprobes do_general_prote
+@@ -676,7 +676,6 @@ fastcall void __kprobes do_general_prote
  		put_cpu();
  		return;
  	}
 -	put_cpu();
  
- 	current->thread.error_code = error_code;
- 	current->thread.trap_no = 13;
-@@ -683,17 +758,31 @@ fastcall void __kprobes do_general_prote
+ 	if (regs->eflags & VM_MASK)
+ 		goto gp_in_vm86;
+@@ -683,6 +683,22 @@ fastcall void __kprobes do_general_prote
  	if (!user_mode(regs))
  		goto gp_in_kernel;
  
@@ -505,13 +488,18 @@
 +		return;
 +
 +	if (print_fatal_signals) {
-+		printk("#GPF(%ld[seg:%lx]) at %08lx, CPU#%d.\n", error_code, error_code/8, regs->eip, smp_processor_id());
-+		printk(" exec_limit: %08lx, user_cs: %08lx/%08lx.\n", current->mm->context.exec_limit, current->mm->context.user_cs.a, current->mm->context.user_cs.b);
++		printk(KERN_ERR "#GPF(%ld[seg:%lx]) at %08lx, CPU#%d.\n", error_code,
++			error_code/8, regs->eip, smp_processor_id());
++		printk(KERN_ERR "exec_limit: %08lx, user_cs: %08lx/%08lx.\n",
++			current->mm->context.exec_limit,
++			current->mm->context.user_cs.a,
++			current->mm->context.user_cs.b);
 +	}
 +
  	current->thread.error_code = error_code;
  	current->thread.trap_no = 13;
  	force_sig(SIGSEGV, current);
+@@ -705,11 +705,13 @@ fastcall void __kprobes do_general_prote
  	return;
  
  gp_in_vm86:
@@ -523,12 +511,12 @@
  gp_in_kernel:
 +	put_cpu();
  	if (!fixup_exception(regs)) {
- 		if (notify_die(DIE_GPF, "general protection fault", regs,
- 				error_code, 13, SIGSEGV) == NOTIFY_STOP)
+ 		current->thread.error_code = error_code;
+ 		current->thread.trap_no = 13;
 Index: linux-2.6/arch/i386/mm/init.c
 ===================================================================
---- linux-2.6.orig/arch/i386/mm/init.c
-+++ linux-2.6/arch/i386/mm/init.c
+--- linux-2.6.orig/arch/x86/mm/init_32.c
++++ linux-2.6/arch/x86/mm/init_32.c
 @@ -433,7 +433,7 @@ u64 __supported_pte_mask __read_mostly =
   * Control non executable mappings.
   *
@@ -546,21 +534,22 @@
  	} else
  		return -EINVAL;
  
-@@ -514,7 +515,10 @@ void __init paging_init(void)
+@@ -514,7 +515,11 @@ void __init paging_init(void)
  	set_nx();
  	if (nx_enabled)
  		printk("NX (Execute Disable) protection: active\n");
 +	else
  #endif
 +	if (exec_shield)
-+		printk("Using x86 segment limits to approximate NX protection\n");
++		printk(KERN_INFO "Using x86 segment limits to approximate "
++			"NX protection\n");
  
  	pagetable_init();
  
 Index: linux-2.6/arch/i386/mm/mmap.c
 ===================================================================
---- linux-2.6.orig/arch/i386/mm/mmap.c
-+++ linux-2.6/arch/i386/mm/mmap.c
+--- linux-2.6.orig/arch/x86/mm/mmap_32.c
++++ linux-2.6/arch/x86/mm/mmap_32.c
 @@ -62,15 +62,17 @@ void arch_pick_mmap_layout(struct mm_str
  	 * Fall back to the standard layout if the personality
  	 * bit is set, or if the expected stack growth is unlimited:
@@ -583,8 +572,8 @@
  }
 Index: linux-2.6/arch/i386/mm/pageattr.c
 ===================================================================
---- linux-2.6.orig/arch/i386/mm/pageattr.c
-+++ linux-2.6/arch/i386/mm/pageattr.c
+--- linux-2.6.orig/arch/x86/mm/pageattr_32.c
++++ linux-2.6/arch/x86/mm/pageattr_32.c
 @@ -8,6 +8,8 @@
  #include <linux/highmem.h>
  #include <linux/module.h>
@@ -594,11 +583,12 @@
  #include <asm/uaccess.h>
  #include <asm/processor.h>
  #include <asm/tlbflush.h>
-@@ -130,6 +132,12 @@ __change_page_attr(struct page *page, pg
+@@ -130,6 +132,13 @@ __change_page_attr(struct page *page, pg
  	BUG_ON(PageHighMem(page));
  	address = (unsigned long)page_address(page);
  
-+	if (address >= (unsigned long)__start_rodata && address <= (unsigned long)__end_rodata &&
++	if (address >= (unsigned long)__start_rodata &&
++		address <= (unsigned long)__end_rodata &&
 +		(pgprot_val(prot) & _PAGE_RW)) {
 +		pgprot_val(prot) &= ~(_PAGE_RW);
 +		add_taint(TAINT_MACHINE_CHECK);
@@ -607,46 +597,19 @@
  	kpte = lookup_address(address);
  	if (!kpte)
  		return -EINVAL;
-Index: linux-2.6/arch/ia64/ia32/binfmt_elf32.c
-===================================================================
---- linux-2.6.orig/arch/ia64/ia32/binfmt_elf32.c
-+++ linux-2.6/arch/ia64/ia32/binfmt_elf32.c
-@@ -266,7 +266,7 @@ elf32_set_personality (void)
- }
- 
- static unsigned long
--elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
-+elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type, unsigned long unused)
- {
- 	unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK;
- 
-Index: linux-2.6/arch/powerpc/kernel/vdso.c
-===================================================================
---- linux-2.6.orig/arch/powerpc/kernel/vdso.c
-+++ linux-2.6/arch/powerpc/kernel/vdso.c
-@@ -218,7 +218,8 @@ static struct vm_operations_struct vdso_
-  * vDSO and insert it into the mm struct tree
-  */
- int arch_setup_additional_pages(struct linux_binprm *bprm,
--				int executable_stack)
-+				int executable_stack, unsigned long start_code,
-+				unsigned long interp_map_address)
- {
- 	struct mm_struct *mm = current->mm;
- 	struct vm_area_struct *vma;
 Index: linux-2.6/arch/x86_64/ia32/ia32_binfmt.c
 ===================================================================
---- linux-2.6.orig/arch/x86_64/ia32/ia32_binfmt.c
-+++ linux-2.6/arch/x86_64/ia32/ia32_binfmt.c
-@@ -251,8 +251,6 @@ elf_core_copy_task_xfpregs(struct task_s
+--- linux-2.6.orig/arch/x86/ia32/ia32_binfmt.c
++++ linux-2.6/arch/x86/ia32/ia32_binfmt.c
+@@ -167,8 +167,6 @@ elf32_core_copy_task_xfpregs(struct task
  #define elf_check_arch(x) \
  	((x)->e_machine == EM_386)
  
 -extern int force_personality32;
 -
- #define ELF_EXEC_PAGESIZE PAGE_SIZE
- #define ELF_HWCAP (boot_cpu_data.x86_capability[0])
- #define ELF_PLATFORM  ("i686")
+ #undef	ELF_EXEC_PAGESIZE
+ #undef	ELF_HWCAP
+ #undef	ELF_PLATFORM
 @@ -266,8 +264,6 @@ do {							\
  		set_thread_flag(TIF_ABI_PENDING);		\
  	else							\
@@ -656,34 +619,10 @@
  } while (0)
  
  /* Override some function names */
-@@ -311,7 +307,7 @@ static void elf32_init(struct pt_regs *)
- 
- #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
- #define arch_setup_additional_pages syscall32_setup_pages
--extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
-+extern int syscall32_setup_pages(struct linux_binprm *, int exstack, unsigned long start_code, unsigned long interp_map_address);
- 
- #include "../../../fs/binfmt_elf.c" 
- 
-Index: linux-2.6/arch/x86_64/ia32/syscall32.c
-===================================================================
---- linux-2.6.orig/arch/x86_64/ia32/syscall32.c
-+++ linux-2.6/arch/x86_64/ia32/syscall32.c
-@@ -42,7 +42,9 @@ static struct vm_operations_struct sysca
- struct linux_binprm;
- 
- /* Setup a VMA at program startup for the vsyscall page */
--int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
-+int syscall32_setup_pages(struct linux_binprm *bprm, int exstack,
-+			  unsigned long start_code,
-+			  unsigned long interp_map_address)
- {
- 	int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT;
- 	struct vm_area_struct *vma;
 Index: linux-2.6/arch/x86_64/kernel/process.c
 ===================================================================
---- linux-2.6.orig/arch/x86_64/kernel/process.c
-+++ linux-2.6/arch/x86_64/kernel/process.c
+--- linux-2.6.orig/arch/x86/kernel/process_64.c
++++ linux-2.6/arch/x86/kernel/process_64.c
 @@ -686,12 +686,6 @@ void set_personality_64bit(void)
  
  	/* Make sure to be in 64bit mode */
@@ -699,8 +638,8 @@
  asmlinkage long sys_fork(struct pt_regs *regs)
 Index: linux-2.6/arch/x86_64/kernel/setup64.c
 ===================================================================
---- linux-2.6.orig/arch/x86_64/kernel/setup64.c
-+++ linux-2.6/arch/x86_64/kernel/setup64.c
+--- linux-2.6.orig/arch/x86/kernel/setup64.c
++++ linux-2.6/arch/x86/kernel/setup64.c
 @@ -40,46 +40,6 @@ unsigned long __supported_pte_mask __rea
  EXPORT_SYMBOL(__supported_pte_mask);
  static int do_not_nx __cpuinitdata = 0;
@@ -750,8 +689,8 @@
   * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
 Index: linux-2.6/arch/x86_64/mm/fault.c
 ===================================================================
---- linux-2.6.orig/arch/x86_64/mm/fault.c
-+++ linux-2.6/arch/x86_64/mm/fault.c
+--- linux-2.6.orig/arch/x86/mm/fault_64.c
++++ linux-2.6/arch/x86/mm/fault_64.c
 @@ -108,7 +108,7 @@ static noinline int is_prefetch(struct p
  	instr = (unsigned char __user *)convert_rip_to_linear(current, regs);
  	max_instr = instr + 15;
@@ -763,9 +702,9 @@
  	while (scan_more && instr < max_instr) { 
 Index: linux-2.6/arch/x86_64/mm/mmap.c
 ===================================================================
---- linux-2.6.orig/arch/x86_64/mm/mmap.c
-+++ linux-2.6/arch/x86_64/mm/mmap.c
-@@ -1,29 +1,87 @@
+--- linux-2.6.orig/arch/x86/mm/mmap_64.c
++++ linux-2.6/arch/x86/mm/mmap_64.c
+@@ -1,29 +1,88 @@
 -/* Copyright 2005 Andi Kleen, SuSE Labs.
 - * Licensed under GPL, v.2
 +/*
@@ -796,7 +735,7 @@
 +
 +#include <linux/personality.h>
  #include <linux/mm.h>
--#include <linux/sched.h>
+ #include <linux/sched.h>
  #include <linux/random.h>
 -#include <asm/ia32.h>
  
@@ -896,162 +835,9 @@
  }
  
  /*
-Index: linux-2.6/fs/binfmt_elf.c
-===================================================================
---- linux-2.6.orig/fs/binfmt_elf.c
-+++ linux-2.6/fs/binfmt_elf.c
-@@ -45,7 +45,7 @@
- 
- static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs);
- static int load_elf_library(struct file *);
--static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int);
-+static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int, unsigned long);
- 
- #ifndef elf_addr_t
- #define elf_addr_t unsigned long
-@@ -83,7 +83,7 @@ static struct linux_binfmt elf_format = 
- 		.min_coredump	= ELF_EXEC_PAGESIZE
- };
- 
--#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
-+#define BAD_ADDR(x) ((unsigned long)(x) >= PAGE_MASK)
- 
- static int set_brk(unsigned long start, unsigned long end)
- {
-@@ -285,33 +285,71 @@ create_elf_tables(struct linux_binprm *b
- #ifndef elf_map
- 
- static unsigned long elf_map(struct file *filep, unsigned long addr,
--		struct elf_phdr *eppnt, int prot, int type)
-+		struct elf_phdr *eppnt, int prot, int type,
-+		unsigned long total_size)
- {
- 	unsigned long map_addr;
--	unsigned long pageoffset = ELF_PAGEOFFSET(eppnt->p_vaddr);
-+	unsigned long size = eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr);
-+	unsigned long off = eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr);
-+
-+	addr = ELF_PAGESTART(addr);
-+	size = ELF_PAGEALIGN(size);
- 
--	down_write(&current->mm->mmap_sem);
- 	/* mmap() will return -EINVAL if given a zero size, but a
- 	 * segment with zero filesize is perfectly valid */
--	if (eppnt->p_filesz + pageoffset)
--		map_addr = do_mmap(filep, ELF_PAGESTART(addr),
--				   eppnt->p_filesz + pageoffset, prot, type,
--				   eppnt->p_offset - pageoffset);
--	else
--		map_addr = ELF_PAGESTART(addr);
-+	if (!size)
-+		return addr;
-+
-+	down_write(&current->mm->mmap_sem);
-+	/*
-+	* total_size is the size of the ELF (interpreter) image.
-+	* The _first_ mmap needs to know the full size, otherwise
-+	* randomization might put this image into an overlapping
-+	* position with the ELF binary image. (since size < total_size)
-+	* So we first map the 'big' image - and unmap the remainder at
-+	* the end. (which unmap is needed for ELF images with holes.)
-+	*/
-+	if (total_size) {
-+		total_size = ELF_PAGEALIGN(total_size);
-+		map_addr = do_mmap(filep, addr, total_size, prot, type, off);
-+		if (!BAD_ADDR(map_addr))
-+			do_munmap(current->mm, map_addr+size, total_size-size);
-+	} else
-+		map_addr = do_mmap(filep, addr, size, prot, type, off);
-+
- 	up_write(&current->mm->mmap_sem);
- 	return(map_addr);
- }
- 
- #endif /* !elf_map */
- 
-+static inline unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
-+{
-+	int i, first_idx = -1, last_idx = -1;
-+
-+	for (i = 0; i < nr; i++)
-+		if (cmds[i].p_type == PT_LOAD) {
-+			last_idx = i;
-+			if (first_idx == -1)
-+				first_idx = i;
-+		}
-+
-+	if (first_idx == -1)
-+		return 0;
-+
-+	return cmds[last_idx].p_vaddr + cmds[last_idx].p_memsz -
-+				ELF_PAGESTART(cmds[first_idx].p_vaddr);
-+}
-+
-+
- /* This is much more generalized than the library routine read function,
-    so we keep this separate.  Technically the library read function
-    is only provided so that we can read a.out libraries that have
-    an ELF header */
- 
- static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
--		struct file *interpreter, unsigned long *interp_load_addr)
-+		struct file *interpreter, unsigned long *interp_map_addr,
-+		unsigned long no_base)
- {
- 	struct elf_phdr *elf_phdata;
- 	struct elf_phdr *eppnt;
-@@ -319,6 +357,7 @@ static unsigned long load_elf_interp(str
- 	int load_addr_set = 0;
- 	unsigned long last_bss = 0, elf_bss = 0;
- 	unsigned long error = ~0UL;
-+	unsigned long total_size;
- 	int retval, i, size;
- 
- 	/* First of all, some simple consistency checks */
-@@ -357,6 +396,10 @@ static unsigned long load_elf_interp(str
- 		goto out_close;
- 	}
- 
-+	total_size = total_mapping_size(elf_phdata, interp_elf_ex->e_phnum);
-+	if (!total_size)
-+		goto out_close;
-+
- 	eppnt = elf_phdata;
- 	for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) {
- 		if (eppnt->p_type == PT_LOAD) {
-@@ -374,9 +417,14 @@ static unsigned long load_elf_interp(str
- 			vaddr = eppnt->p_vaddr;
- 			if (interp_elf_ex->e_type == ET_EXEC || load_addr_set)
- 				elf_type |= MAP_FIXED;
-+			else if (no_base && interp_elf_ex->e_type == ET_DYN)
-+				load_addr = -vaddr;
- 
- 			map_addr = elf_map(interpreter, load_addr + vaddr,
--					   eppnt, elf_prot, elf_type);
-+					   eppnt, elf_prot, elf_type, total_size);
-+			total_size = 0;
-+			if (!*interp_map_addr)
-+				*interp_map_addr = map_addr;
- 			error = map_addr;
- 			if (BAD_ADDR(map_addr))
- 				goto out_close;
-@@ -442,8 +490,7 @@ static unsigned long load_elf_interp(str
- 			goto out_close;
- 	}
- 
--	*interp_load_addr = load_addr;
--	error = ((unsigned long)interp_elf_ex->e_entry) + load_addr;
-+	error = load_addr;
- 
- out_close:
- 	kfree(elf_phdata);
-@@ -586,12 +586,12 @@ static int load_elf_binary(struct linux_
- 	int elf_exec_fileno;
- 	int retval, i;
- 	unsigned int size;
--	unsigned long elf_entry, interp_load_addr = 0;
-+	unsigned long elf_entry, interp_load_addr = 0, interp_map_addr = 0;
- 	unsigned long start_code, end_code, start_data, end_data;
+--- linux-2.6.21.noarch/fs/binfmt_elf.c~	2007-05-27 22:36:34.000000000 -0400
++++ linux-2.6.21.noarch/fs/binfmt_elf.c	2007-05-27 22:36:45.000000000 -0400
+@@ -608,7 +608,7 @@ static int load_elf_binary(struct linux_
  	unsigned long reloc_func_desc = 0;
  	char passed_fileno[6];
  	struct files_struct *files;
@@ -1060,18 +846,18 @@
  	unsigned long def_flags = 0;
  	struct {
  		struct elfhdr elf_ex;
-@@ -700,6 +747,8 @@ static int load_elf_binary(struct linux_
- 	}
+@@ -675,6 +675,8 @@ static int load_elf_binary(struct linux_
+ 	fd_install(elf_exec_fileno = retval, bprm->file);
  
  	elf_ppnt = elf_phdata;
 +	executable_stack = EXSTACK_DEFAULT;
 +
- 	for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++)
- 		if (elf_ppnt->p_type == PT_GNU_STACK) {
- 			if (elf_ppnt->p_flags & PF_X)
-@@ -710,6 +759,11 @@ static int load_elf_binary(struct linux_
+ 	elf_bss = 0;
+ 	elf_brk = 0;
+ 
+@@ -767,6 +767,11 @@ static int load_elf_binary(struct linux_
+ 			break;
  		}
- 	have_pt_gnu_stack = (i < loc->elf_ex.e_phnum);
  
 +	if (current->personality == PER_LINUX && (exec_shield & 2)) {
 +		executable_stack = EXSTACK_DISABLE_X;
@@ -1081,11 +867,11 @@
  	/* Some simple consistency checks for the interpreter */
  	if (elf_interpreter) {
  		interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT;
-@@ -762,6 +816,15 @@ static int load_elf_binary(struct linux_
+@@ -824,6 +824,15 @@ static int load_elf_binary(struct linux_
  	if (retval)
  		goto out_free_dentry;
  
-+#ifdef __i386__
++#ifdef CONFIG_X86_32
 +	/*
 +	 * Turn off the CS limit completely if exec-shield disabled or
 +	 * NX active:
@@ -1097,7 +883,7 @@
  	/* Discard our unneeded old files struct */
  	if (files) {
  		put_files_struct(files);
-@@ -779,7 +842,8 @@ static int load_elf_binary(struct linux_
+@@ -850,7 +850,8 @@ static int load_elf_binary(struct linux_
  	/* Do this immediately, since STACK_TOP as used in setup_arg_pages
  	   may depend on the personality.  */
  	SET_PERSONALITY(loc->elf_ex, ibcs2_interpreter);
@@ -1107,47 +893,6 @@
  		current->personality |= READ_IMPLIES_EXEC;
  
  	if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
-@@ -800,9 +864,8 @@ static int load_elf_binary(struct linux_
- 	current->mm->start_stack = bprm->p;
- 
- 	/* Now we do a little grungy work by mmaping the ELF image into
--	   the correct location in memory.  At this point, we assume that
--	   the image should be loaded at fixed address, not at a variable
--	   address. */
-+	   the correct location in memory.
-+	 */
- 	for(i = 0, elf_ppnt = elf_phdata;
- 	    i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
- 		int elf_prot = 0, elf_flags;
-@@ -927,7 +927,7 @@ static int load_elf_binary(struct linux_
- 		}
- 
- 		error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
--				elf_prot, elf_flags);
-+				elf_prot, elf_flags, 0);
- 		if (BAD_ADDR(error)) {
- 			send_sig(SIGKILL, current, 0);
- 			goto out_free_dentry;
-@@ -936,10 +998,17 @@ static int load_elf_binary(struct linux_
- 		if (interpreter_type == INTERPRETER_AOUT)
- 			elf_entry = load_aout_interp(&loc->interp_ex,
- 						     interpreter);
--		else
-+		else {
- 			elf_entry = load_elf_interp(&loc->interp_elf_ex,
- 						    interpreter,
--						    &interp_load_addr);
-+						    &interp_map_addr,
-+						    load_bias);
-+			if (!BAD_ADDR(elf_entry)) {
-+				/* load_elf_interp() returns relocation adjustment */
-+				interp_load_addr = elf_entry;
-+				elf_entry += loc->interp_elf_ex.e_entry;
-+			}
-+		}
- 		if (BAD_ADDR(elf_entry)) {
- 			force_sig(SIGSEGV, current);
- 			retval = IS_ERR((void *)elf_entry) ?
 @@ -960,21 +1029,22 @@ static int load_elf_binary(struct linux_
  		}
  	}
@@ -1161,8 +906,8 @@
  
  #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
 -	retval = arch_setup_additional_pages(bprm, executable_stack);
-+	retval = arch_setup_additional_pages(bprm, executable_stack,
-+			start_code, interp_map_addr);
++	retval = arch_setup_additional_pages(bprm, executable_stack);
++
  	if (retval < 0) {
  		send_sig(SIGKILL, current, 0);
 -		goto out;
@@ -1186,21 +931,19 @@
  	if (current->personality & MMAP_PAGE_ZERO) {
  		/* Why this, you ask???  Well SVr4 maps page 0 as read-only,
  		   and some applications "depend" upon this behavior.
-Index: linux-2.6/fs/proc/array.c
-===================================================================
---- linux-2.6.orig/fs/proc/array.c
-+++ linux-2.6/fs/proc/array.c
-@@ -403,8 +403,12 @@ static int do_task_stat(struct task_stru
+--- linux-2.6.22.noarch/fs/proc/array.c~	2007-07-20 18:09:09.000000000 -0400
++++ linux-2.6.22.noarch/fs/proc/array.c	2007-07-20 18:09:27.000000000 -0400
+@@ -439,8 +439,12 @@ static int do_task_stat(struct task_stru
+ 	}
  	rcu_read_unlock();
- 	mutex_unlock(&tty_mutex);
  
--	if (!whole || num_threads<2)
+-	if (!whole || num_threads < 2)
 -		wchan = get_wchan(task);
-+	if (!whole || num_threads<2) {
++	if (!whole || num_threads < 2) {
 +		wchan = 0;
 +		if (current->uid == task->uid || current->euid == task->uid ||
-+				capable(CAP_SYS_NICE))
-+			wchan = get_wchan(task);
++			capable(CAP_SYS_NICE))
++				wchan = get_wchan(task);
 +	}
  	if (!whole) {
  		min_flt = task->min_flt;
@@ -1218,10 +961,10 @@
  #ifdef CONFIG_NUMA
  	REG("numa_maps",  S_IRUGO, numa_maps),
  #endif
-@@ -1768,7 +1768,7 @@ static struct pid_entry tgid_base_stuff[
- 	REG("mounts",     S_IRUGO, mounts),
+@@ -2018,7 +2018,7 @@ static const struct pid_entry tgid_base_
  	REG("mountstats", S_IRUSR, mountstats),
  #ifdef CONFIG_MMU
+ 	REG("clear_refs", S_IWUSR, clear_refs),
 -	REG("smaps",      S_IRUGO, smaps),
 +	REG("smaps",      S_IRUSR, smaps),
  #endif
@@ -1236,10 +979,10 @@
  #ifdef CONFIG_NUMA
  	REG("numa_maps", S_IRUGO, numa_maps),
  #endif
-@@ -2042,7 +2042,7 @@ static struct pid_entry tid_base_stuff[]
- 	LNK("exe",       exe),
+@@ -2301,7 +2301,7 @@ static const struct pid_entry tid_base_s
  	REG("mounts",    S_IRUGO, mounts),
  #ifdef CONFIG_MMU
+ 	REG("clear_refs", S_IWUSR, clear_refs),
 -	REG("smaps",     S_IRUGO, smaps),
 +	REG("smaps",     S_IRUSR, smaps),
  #endif
@@ -1269,7 +1012,7 @@
 -		(PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10);
 +		(PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10,
 +		mm->start_brk, mm->brk, mm->start_stack);
-+#ifdef __i386__
++#ifdef CONFIG_X86_32
 +	if (!nx_enabled)
 +		buffer += sprintf(buffer,
 +			"ExecLim:\t%08lx\n", mm->context.exec_limit);
@@ -1281,7 +1024,7 @@
  {
  	struct proc_maps_private *priv = m->private;
  	struct task_struct *task = priv->task;
-+#ifdef __i386__
++#ifdef CONFIG_X86_32
 +	struct mm_struct *tmm = get_task_mm(task);
 +#endif
  	struct vm_area_struct *vma = v;
@@ -1293,7 +1036,7 @@
  			flags & VM_WRITE ? 'w' : '-',
 -			flags & VM_EXEC ? 'x' : '-',
 +			(flags & VM_EXEC
-+#ifdef __i386__
++#ifdef CONFIG_X86_32
 +				|| (!nx_enabled && tmm &&
 +				(vma->vm_start < tmm->context.exec_limit))
 +#endif
@@ -1302,28 +1045,26 @@
  			flags & VM_MAYSHARE ? 's' : 'p',
  			vma->vm_pgoff << PAGE_SHIFT,
  			MAJOR(dev), MINOR(dev), ino, &len);
-+#ifdef __i386__
++#ifdef CONFIG_X86_32
 +	if (tmm)
 +		mmput(tmm);
 +#endif
  
  	/*
  	 * Print the dentry name for named mappings, and a
-Index: linux-2.6/include/asm-i386/a.out.h
-===================================================================
---- linux-2.6.orig/include/asm-i386/a.out.h
-+++ linux-2.6/include/asm-i386/a.out.h
+--- linux-2.6.23.noarch/include/asm-x86/a.out.h~	2007-10-29 19:22:53.000000000 -0400
++++ linux-2.6.23.noarch/include/asm-x86/a.out.h	2007-10-29 19:23:18.000000000 -0400
 @@ -19,7 +19,7 @@ struct exec
  
  #ifdef __KERNEL__
- 
--#define STACK_TOP	TASK_SIZE
-+#define STACK_TOP	(TASK_SIZE - PAGE_SIZE)  /* 1 page for vdso */
- 
- #endif
- 
---- linux-2.6.19.noarch/include/asm-i386/desc.h~	2006-12-08 06:52:55.000000000 -0500
-+++ linux-2.6.19.noarch/include/asm-i386/desc.h	2006-12-08 06:53:14.000000000 -0500
+ # include <linux/thread_info.h>
+-# define STACK_TOP	TASK_SIZE
++# define STACK_TOP	(TASK_SIZE - PAGE_SIZE)  /* 1 page for vdso */
+ # ifdef CONFIG_X86_32
+ #  define STACK_TOP_MAX	STACK_TOP
+ # else
+--- linux-2.6.19.noarch/include/asm-x86/desc_32.h~	2006-12-08 06:52:55.000000000 -0500
++++ linux-2.6.19.noarch/include/asm-x86/desc_32.h	2006-12-08 06:53:14.000000000 -0500
 @@ -185,6 +185,20 @@ static inline unsigned long get_desc_bas
  	return base;
  }
@@ -1345,33 +1086,23 @@
  #else /* __ASSEMBLY__ */
  
  /*
-Index: linux-2.6/include/asm-i386/elf.h
-===================================================================
---- linux-2.6.19.noarch/include/asm-i386/elf.h~	2007-01-29 11:28:35.000000000 -0500
-+++ linux-2.6.19.noarch/include/asm-i386/elf.h	2007-01-29 11:32:29.000000000 -0500
-@@ -157,7 +157,8 @@ extern void __kernel_vsyscall;
- #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
- struct linux_binprm;
+--- linux-2.6.23.noarch/include/asm-x86/elf.h~	2007-10-29 19:23:46.000000000 -0400
++++ linux-2.6.23.noarch/include/asm-x86/elf.h	2007-10-29 19:24:09.000000000 -0400
+@@ -285,6 +285,11 @@ struct linux_binprm;
  extern int arch_setup_additional_pages(struct linux_binprm *bprm,
--                                       int executable_stack);
-+                                       int executable_stack, unsigned long start_code,
-+                                       unsigned long interp_map_address);
- #endif
- 
- extern unsigned int vdso_enabled;
-@@ -215,4 +216,7 @@ do {									      \
- 
- #endif
+ 				       int executable_stack);
  
++#ifdef CONFIG_X86_32
 +#define __HAVE_ARCH_RANDOMIZE_BRK
 +extern void randomize_brk(unsigned long old_brk);
++#endif
 +
+ #endif /* __KERNEL__ */
+ 
  #endif
-Index: linux-2.6/include/asm-i386/mmu.h
-===================================================================
---- linux-2.6.orig/include/asm-i386/mmu.h
-+++ linux-2.6/include/asm-i386/mmu.h
-@@ -7,11 +7,15 @@
+--- linux-2.6.23.noarch/include/asm-x86/mmu.h~	2007-10-29 19:24:40.000000000 -0400
++++ linux-2.6.23.noarch/include/asm-x86/mmu.h	2007-10-29 19:26:20.000000000 -0400
+@@ -9,6 +9,8 @@
   * we put the segment information here.
   *
   * cpu_vm_mask is used to optimize ldt flushing.
@@ -1379,30 +1110,22 @@
 + * mappings span.
   */
  typedef struct { 
- 	int size;
- 	struct semaphore sem;
  	void *ldt;
+@@ -18,6 +20,10 @@ typedef struct { 
+ 	int size;
+ 	struct mutex lock;
+ 	void *vdso;
++#ifdef CONFIG_X86_32
 +	struct desc_struct user_cs;
 +	unsigned long exec_limit;
- 	void *vdso;
++#endif
  } mm_context_t;
  
-Index: linux-2.6/include/asm-i386/pgalloc.h
-===================================================================
---- linux-2.6.orig/include/asm-i386/pgalloc.h
-+++ linux-2.6/include/asm-i386/pgalloc.h
-@@ -2,6 +2,7 @@
- #define _I386_PGALLOC_H
- 
- #include <asm/fixmap.h>
-+#include <asm/desc.h>
- #include <linux/threads.h>
- #include <linux/mm.h>		/* for struct page */
- 
+ #endif /* _ASM_X86_MMU_H */
 Index: linux-2.6/include/asm-i386/processor.h
 ===================================================================
---- linux-2.6.orig/include/asm-i386/processor.h
-+++ linux-2.6/include/asm-i386/processor.h
+--- linux-2.6.orig/include/asm-x86/processor_32.h
++++ linux-2.6/include/asm-x86/processor_32.h
 @@ -326,7 +326,10 @@ extern int bootloader_type;
  /* This decides where the kernel will search for a free chunk of vm
   * space during mmap's.
@@ -1440,36 +1163,20 @@
  /*
   * This file contains the functions and defines necessary to allocate
   * page tables.
-Index: linux-2.6/include/asm-powerpc/elf.h
-===================================================================
---- linux-2.6.orig/include/asm-powerpc/elf.h
-+++ linux-2.6/include/asm-powerpc/elf.h
-@@ -272,7 +272,8 @@ extern int ucache_bsize;
- #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
- struct linux_binprm;
- extern int arch_setup_additional_pages(struct linux_binprm *bprm,
--				       int executable_stack);
-+				       int executable_stack, unsigned long start_code,
-+					   unsigned long interp_map_address);
- #define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b);
- 
- /*
-Index: linux-2.6/include/asm-powerpc/pgalloc.h
-===================================================================
---- linux-2.6.orig/include/asm-powerpc/pgalloc.h
-+++ linux-2.6/include/asm-powerpc/pgalloc.h
-@@ -26,6 +26,11 @@ extern kmem_cache_t *pgtable_cache[];
- #define HUGEPTE_CACHE_NUM 2
- #endif
+--- linux-2.6.21.noarch/include/asm-powerpc/pgalloc.h~	2007-05-27 18:56:56.000000000 -0400
++++ linux-2.6.21.noarch/include/asm-powerpc/pgalloc.h	2007-05-27 18:57:04.000000000 -0400
+@@ -2,6 +2,11 @@
+ #define _ASM_POWERPC_PGALLOC_H
+ #ifdef __KERNEL__
  
 +/* Dummy functions since we don't support execshield on ppc */
 +#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)
 +
- /*
-  * This program is free software; you can redistribute it and/or
-  * modify it under the terms of the GNU General Public License
+ #ifdef CONFIG_PPC64
+ #include <asm/pgalloc-64.h>
+ #else
 Index: linux-2.6/include/asm-ppc/pgalloc.h
 ===================================================================
 --- linux-2.6.orig/include/asm-ppc/pgalloc.h
@@ -1513,13 +1220,11 @@
 +#define arch_remove_exec_range(mm, limit)	do { ; } while (0)
 +
  #endif /* _SPARC_PGALLOC_H */
-Index: linux-2.6/include/asm-sparc64/pgalloc.h
-===================================================================
---- linux-2.6.orig/include/asm-sparc64/pgalloc.h
-+++ linux-2.6/include/asm-sparc64/pgalloc.h
-@@ -68,4 +68,8 @@ static inline void pte_free(struct page 
- 
- #define check_pgt_cache()	do { } while (0)
+--- linux-2.6.21.noarch/include/asm-sparc64/pgalloc.h~	2007-05-27 22:44:38.000000000 -0400
++++ linux-2.6.21.noarch/include/asm-sparc64/pgalloc.h	2007-05-27 22:45:10.000000000 -0400
+@@ -70,4 +70,8 @@ static inline void check_pgt_cache(void)
+ 	quicklist_trim(0, NULL, 25, 16);
+ }
  
 +#define arch_add_exec_range(mm, limit)		do { ; } while (0)
 +#define arch_flush_exec_range(mm)		do { ; } while (0)
@@ -1528,8 +1233,8 @@
  #endif /* _SPARC64_PGALLOC_H */
 Index: linux-2.6/include/asm-x86_64/pgalloc.h
 ===================================================================
---- linux-2.6.orig/include/asm-x86_64/pgalloc.h
-+++ linux-2.6/include/asm-x86_64/pgalloc.h
+--- linux-2.6.orig/include/asm-x86/pgalloc_64.h
++++ linux-2.6/include/asm-x86/pgalloc_64.h
 @@ -6,6 +6,13 @@
  #include <linux/threads.h>
  #include <linux/mm.h>
@@ -1544,19 +1249,16 @@
  #define pmd_populate_kernel(mm, pmd, pte) \
  		set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte)))
  #define pud_populate(mm, pud, pmd) \
-Index: linux-2.6/include/linux/mm.h
-===================================================================
---- linux-2.6.orig/include/linux/mm.h
-+++ linux-2.6/include/linux/mm.h
-@@ -994,7 +994,14 @@
- extern void exit_mmap(struct mm_struct *);
- extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
+--- linux-2.6.21.noarch/include/linux/mm.h~	2007-05-27 22:45:45.000000000 -0400
++++ linux-2.6.21.noarch/include/linux/mm.h	2007-05-27 22:46:21.000000000 -0400
+@@ -1063,7 +1063,13 @@ extern int install_special_mapping(struc
+ 				   unsigned long addr, unsigned long len,
+ 				   unsigned long flags, struct page **pages);
  
 -extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
 +extern unsigned long get_unmapped_area_prot(struct file *, unsigned long, unsigned long, unsigned long, unsigned long, int);
 +
-+
-+static inline unsigned long get_unmapped_area(struct file * file, unsigned long addr,
++static inline unsigned long get_unmapped_area(struct file *file, unsigned long addr,
 +		unsigned long len, unsigned long pgoff, unsigned long flags)
 +{
 +	return get_unmapped_area_prot(file, addr, len, pgoff, flags, 0);
@@ -1564,15 +1266,6 @@
  
  extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
  	unsigned long len, unsigned long prot,
-@@ -1046,7 +1053,7 @@
- 			  struct file *filp,
- 			  pgoff_t offset,
- 			  unsigned long size);
--void handle_ra_miss(struct address_space *mapping, 
-+void handle_ra_miss(struct address_space *mapping,
- 		    struct file_ra_state *ra, pgoff_t offset);
- unsigned long max_sane_readahead(unsigned long nr);
- 
 Index: linux-2.6/include/linux/resource.h
 ===================================================================
 --- linux-2.6.orig/include/linux/resource.h
@@ -1590,19 +1283,18 @@
  
  /*
   * GPG wants 32kB of mlocked memory, to make sure pass phrases
-Index: linux-2.6/include/linux/sched.h
-===================================================================
---- linux-2.6.orig/include/linux/sched.h
-+++ linux-2.6/include/linux/sched.h
-@@ -87,6 +87,8 @@ struct sched_param {
- 
- struct exec_domain;
+--- linux-2.6.21.noarch/include/linux/sched.h~	2007-05-27 18:57:38.000000000 -0400
++++ linux-2.6.21.noarch/include/linux/sched.h	2007-05-27 18:57:57.000000000 -0400
+@@ -90,6 +90,9 @@ struct exec_domain;
  struct futex_pi_state;
+ struct bio;
+ 
 +extern int exec_shield;
 +extern int print_fatal_signals;
- 
++
  /*
   * List of flags we want to share for kernel threads,
+  * if only because they are not used by them anyway.
 @@ -252,6 +254,10 @@ extern int sysctl_max_map_count;
  extern unsigned long
  arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
@@ -1614,92 +1306,33 @@
  extern unsigned long
  arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
  			  unsigned long len, unsigned long pgoff,
-@@ -304,6 +310,9 @@ struct mm_struct {
+--- linux-2.6.23.noarch/include/linux/mm_types.h~	2007-10-17 15:09:05.000000000 -0400
++++ linux-2.6.23.noarch/include/linux/mm_types.h	2007-10-17 15:09:35.000000000 -0400
+@@ -155,6 +155,9 @@ struct mm_struct {
  	unsigned long (*get_unmapped_area) (struct file *filp,
  				unsigned long addr, unsigned long len,
  				unsigned long pgoff, unsigned long flags);
-+	unsigned long (*get_unmapped_exec_area) (struct file *filp,
++       unsigned long (*get_unmapped_exec_area) (struct file *filp,
 +				unsigned long addr, unsigned long len,
 +				unsigned long pgoff, unsigned long flags);
  	void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
  	unsigned long mmap_base;		/* base of mmap area */
  	unsigned long task_size;		/* size of task vm space */
-Index: linux-2.6/include/linux/sysctl.h
-===================================================================
---- linux-2.6.orig/include/linux/sysctl.h
-+++ linux-2.6/include/linux/sysctl.h
-@@ -100,6 +100,8 @@ enum
- 
- 	KERN_CAP_BSET=14,	/* int: capability bounding set */
- 	KERN_PANIC=15,		/* int: panic timeout */
-+	KERN_EXEC_SHIELD=1000,	/* int: exec-shield enabled (0/1/2) */
-+	KERN_PRINT_FATAL=1001,	/* int: print fatal signals (0/1/2) */
- 	KERN_REALROOTDEV=16,	/* real root device to mount after initrd */
- 
- 	KERN_SPARC_REBOOT=21,	/* reboot command on Sparc */
-Index: linux-2.6/kernel/signal.c
-===================================================================
---- linux-2.6.orig/kernel/signal.c
-+++ linux-2.6/kernel/signal.c
-@@ -764,6 +764,37 @@ out_set:
- #define LEGACY_QUEUE(sigptr, sig) \
- 	(((sig) < SIGRTMIN) && sigismember(&(sigptr)->signal, (sig)))
- 
-+int print_fatal_signals = 0;
-+
-+static void print_fatal_signal(struct pt_regs *regs, int signr)
-+{
-+	printk("%s/%d: potentially unexpected fatal signal %d.\n",
-+		current->comm, current->pid, signr);
-+
-+#ifdef __i386__
-+	printk("code at %08lx: ", regs->eip);
-+	{
-+		int i;
-+		for (i = 0; i < 16; i++) {
-+			unsigned char insn;
-+
-+			__get_user(insn, (unsigned char *)(regs->eip + i));
-+			printk("%02x ", insn);
-+		}
-+	}
-+#endif
-+	printk("\n");
-+	show_regs(regs);
-+}
-+
-+static int __init setup_print_fatal_signals(char *str)
-+{
-+	get_option (&str, &print_fatal_signals);
-+
-+	return 1;
-+}
-+
-+__setup("print-fatal-signals=", setup_print_fatal_signals);
- 
- static int
- specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
-@@ -1795,6 +1826,8 @@ relock:
- 		 * Anything else is fatal, maybe with a core dump.
- 		 */
- 		current->flags |= PF_SIGNALED;
-+		if (print_fatal_signals)
-+			print_fatal_signal(regs, signr);
- 		if (sig_kernel_coredump(signr)) {
- 			/*
- 			 * If it was able to dump core, this kills all
-Index: linux-2.6/mm/mprotect.c
-===================================================================
---- linux-2.6.orig/mm/mprotect.c
-+++ linux-2.6/mm/mprotect.c
-@@ -23,6 +23,7 @@
+--- linux-2.6.22.noarch/mm/mprotect.c~	2007-07-31 16:12:27.000000000 -0400
++++ linux-2.6.22.noarch/mm/mprotect.c	2007-07-31 16:14:24.000000000 -0400
+@@ -26,8 +26,12 @@
  #include <linux/swapops.h>
  #include <asm/uaccess.h>
  #include <asm/pgtable.h>
 +#include <asm/pgalloc.h>
  #include <asm/cacheflush.h>
  #include <asm/tlbflush.h>
++#ifdef CONFIG_X86
++#include <asm/desc.h>
++#endif
  
+ static void change_pte_range(struct mm_struct *mm, pmd_t *pmd,
+ 		unsigned long addr, unsigned long end, pgprot_t newprot,
 @@ -135,7 +136,7 @@ mprotect_fixup(struct vm_area_struct *vm
  	struct mm_struct *mm = vma->vm_mm;
  	unsigned long oldflags = vma->vm_flags;
@@ -1719,11 +1352,9 @@
  	if (is_vm_hugetlb_page(vma))
  		hugetlb_change_protection(vma, start, end, vma->vm_page_prot);
  	else
-Index: linux-2.6/mm/mremap.c
-===================================================================
---- linux-2.6.orig/mm/mremap.c
-+++ linux-2.6/mm/mremap.c
-@@ -389,8 +389,8 @@ unsigned long do_mremap(unsigned long ad
+--- linux-2.6.22.noarch/mm/mremap.c~	2007-07-13 15:40:07.000000000 -0400
++++ linux-2.6.22.noarch/mm/mremap.c	2007-07-13 15:41:04.000000000 -0400
+@@ -392,8 +392,8 @@ unsigned long do_mremap(unsigned long ad
  			if (vma->vm_flags & VM_MAYSHARE)
  				map_flags |= MAP_SHARED;
  
@@ -1731,6 +1362,257 @@
 -						vma->vm_pgoff, map_flags);
 +			new_addr = get_unmapped_area_prot(vma->vm_file, 0, new_len,
 +				vma->vm_pgoff, map_flags, vma->vm_flags & VM_EXEC);
- 			ret = new_addr;
- 			if (new_addr & ~PAGE_MASK)
+ 			if (new_addr & ~PAGE_MASK) {
+ 				ret = new_addr;
  				goto out;
+--- linux-2.6.21.noarch/mm/mmap.c~	2007-06-06 17:50:39.000000000 -0400
++++ linux-2.6.21.noarch/mm/mmap.c	2007-06-06 17:52:12.000000000 -0400
+@@ -1422,10 +1422,12 @@ unsigned long arch_get_unmapped_exec_are
+ 	if (len > TASK_SIZE)
+ 		return -ENOMEM;
+ 
+-	if (!addr && !(flags & MAP_FIXED))
+-		addr = randomize_range(SHLIB_BASE, 0x01000000, len);
++	if (flags & MAP_FIXED)
++		return addr;
+ 
+-	if (addr) {
++	if (!addr) {
++		addr = randomize_range(SHLIB_BASE, 0x01000000, len);
++	} else {
+ 		addr = PAGE_ALIGN(addr);
+ 		vma = find_vma(mm, addr);
+ 		if (TASK_SIZE - len >= addr &&
+
+
+
+diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
+index 1cfab32..e1189ba 100644
+--- a/arch/ia64/ia32/binfmt_elf32.c
++++ b/arch/ia64/ia32/binfmt_elf32.c
+@@ -226,7 +226,7 @@ elf32_set_personality (void)
+ }
+ 
+ static unsigned long
+-elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
++elf32_map(struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type, unsigned long unused)
+ {
+ 	unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK;
+ 
+diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
+index 4482a06..ba24cb2 100644
+--- a/fs/binfmt_elf.c
++++ b/fs/binfmt_elf.c
+@@ -45,7 +45,7 @@
+ 
+ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs);
+ static int load_elf_library(struct file *);
+-static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int);
++static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, int, int, unsigned long);
+ 
+ /*
+  * If we don't support core dumping, then supply a NULL so we
+@@ -80,7 +80,7 @@ static struct linux_binfmt elf_format = {
+ 		.hasvdso	= 1
+ };
+ 
+-#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
++#define BAD_ADDR(x) IS_ERR_VALUE(x)
+ 
+ static int set_brk(unsigned long start, unsigned long end)
+ {
+@@ -295,33 +295,70 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
+ #ifndef elf_map
+ 
+ static unsigned long elf_map(struct file *filep, unsigned long addr,
+-		struct elf_phdr *eppnt, int prot, int type)
++		struct elf_phdr *eppnt, int prot, int type,
++		unsigned long total_size)
+ {
+ 	unsigned long map_addr;
+-	unsigned long pageoffset = ELF_PAGEOFFSET(eppnt->p_vaddr);
++	unsigned long size = eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr);
++	unsigned long off = eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr);
++	addr = ELF_PAGESTART(addr);
++	size = ELF_PAGEALIGN(size);
+ 
+-	down_write(&current->mm->mmap_sem);
+ 	/* mmap() will return -EINVAL if given a zero size, but a
+ 	 * segment with zero filesize is perfectly valid */
+-	if (eppnt->p_filesz + pageoffset)
+-		map_addr = do_mmap(filep, ELF_PAGESTART(addr),
+-				   eppnt->p_filesz + pageoffset, prot, type,
+-				   eppnt->p_offset - pageoffset);
+-	else
+-		map_addr = ELF_PAGESTART(addr);
++	if (!size)
++		return addr;
++
++	down_write(&current->mm->mmap_sem);
++	/*
++	* total_size is the size of the ELF (interpreter) image.
++	* The _first_ mmap needs to know the full size, otherwise
++	* randomization might put this image into an overlapping
++	* position with the ELF binary image. (since size < total_size)
++	* So we first map the 'big' image - and unmap the remainder at
++	* the end. (which unmap is needed for ELF images with holes.)
++	*/
++	if (total_size) {
++		total_size = ELF_PAGEALIGN(total_size);
++		map_addr = do_mmap(filep, addr, total_size, prot, type, off);
++		if (!BAD_ADDR(map_addr))
++			do_munmap(current->mm, map_addr+size, total_size-size);
++	} else
++		map_addr = do_mmap(filep, addr, size, prot, type, off);
++
+ 	up_write(&current->mm->mmap_sem);
+ 	return(map_addr);
+ }
+ 
+ #endif /* !elf_map */
+ 
++static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
++{
++	int i, first_idx = -1, last_idx = -1;
++
++	for (i = 0; i < nr; i++) {
++		if (cmds[i].p_type == PT_LOAD) {
++			last_idx = i;
++			if (first_idx == -1)
++				first_idx = i;
++		}
++	}
++	if (first_idx == -1)
++		return 0;
++
++	return cmds[last_idx].p_vaddr + cmds[last_idx].p_memsz -
++				ELF_PAGESTART(cmds[first_idx].p_vaddr);
++}
++
++
+ /* This is much more generalized than the library routine read function,
+    so we keep this separate.  Technically the library read function
+    is only provided so that we can read a.out libraries that have
+    an ELF header */
+ 
+ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+-		struct file *interpreter, unsigned long *interp_load_addr)
++		struct file *interpreter, unsigned long *interp_map_addr,
++		unsigned long no_base)
+ {
+ 	struct elf_phdr *elf_phdata;
+ 	struct elf_phdr *eppnt;
+@@ -329,6 +366,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+ 	int load_addr_set = 0;
+ 	unsigned long last_bss = 0, elf_bss = 0;
+ 	unsigned long error = ~0UL;
++	unsigned long total_size;
+ 	int retval, i, size;
+ 
+ 	/* First of all, some simple consistency checks */
+@@ -367,6 +405,12 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+ 		goto out_close;
+ 	}
+ 
++	total_size = total_mapping_size(elf_phdata, interp_elf_ex->e_phnum);
++	if (!total_size) {
++		error = -EINVAL;
++		goto out_close;
++	}
++
+ 	eppnt = elf_phdata;
+ 	for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) {
+ 		if (eppnt->p_type == PT_LOAD) {
+@@ -384,9 +428,14 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+ 			vaddr = eppnt->p_vaddr;
+ 			if (interp_elf_ex->e_type == ET_EXEC || load_addr_set)
+ 				elf_type |= MAP_FIXED;
++			else if (no_base && interp_elf_ex->e_type == ET_DYN)
++				load_addr = -vaddr;
+ 
+ 			map_addr = elf_map(interpreter, load_addr + vaddr,
+-					   eppnt, elf_prot, elf_type);
++					   eppnt, elf_prot, elf_type, total_size);
++			total_size = 0;
++			if (!*interp_map_addr)
++				*interp_map_addr = map_addr;
+ 			error = map_addr;
+ 			if (BAD_ADDR(map_addr))
+ 				goto out_close;
+@@ -452,8 +501,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+ 			goto out_close;
+ 	}
+ 
+-	*interp_load_addr = load_addr;
+-	error = ((unsigned long)interp_elf_ex->e_entry) + load_addr;
++	error = load_addr;
+ 
+ out_close:
+ 	kfree(elf_phdata);
+@@ -550,7 +598,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
+ 	int elf_exec_fileno;
+ 	int retval, i;
+ 	unsigned int size;
+-	unsigned long elf_entry, interp_load_addr = 0;
++	unsigned long elf_entry;
++	unsigned long interp_load_addr = 0;
+ 	unsigned long start_code, end_code, start_data, end_data;
+ 	unsigned long reloc_func_desc = 0;
+ 	char passed_fileno[6];
+@@ -814,9 +863,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
+ 	current->mm->start_stack = bprm->p;
+ 
+ 	/* Now we do a little grungy work by mmaping the ELF image into
+-	   the correct location in memory.  At this point, we assume that
+-	   the image should be loaded at fixed address, not at a variable
+-	   address. */
++	   the correct location in memory. */
+ 	for(i = 0, elf_ppnt = elf_phdata;
+ 	    i < loc->elf_ex.e_phnum; i++, elf_ppnt++) {
+ 		int elf_prot = 0, elf_flags;
+@@ -870,11 +917,15 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
+ 			 * default mmap base, as well as whatever program they
+ 			 * might try to exec.  This is because the brk will
+ 			 * follow the loader, and is not movable.  */
++#ifdef CONFIG_X86
++			load_bias = 0;
++#else
+ 			load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
++#endif
+ 		}
+ 
+ 		error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
+-				elf_prot, elf_flags);
++				elf_prot, elf_flags, 0);
+ 		if (BAD_ADDR(error)) {
+ 			send_sig(SIGKILL, current, 0);
+ 			retval = IS_ERR((void *)error) ?
+@@ -950,13 +1001,25 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
+ 	}
+ 
+ 	if (elf_interpreter) {
+-		if (interpreter_type == INTERPRETER_AOUT)
++		if (interpreter_type == INTERPRETER_AOUT) {
+ 			elf_entry = load_aout_interp(&loc->interp_ex,
+ 						     interpreter);
+-		else
++		} else {
++			unsigned long uninitialized_var(interp_map_addr);
++
+ 			elf_entry = load_elf_interp(&loc->interp_elf_ex,
+ 						    interpreter,
+-						    &interp_load_addr);
++						    &interp_map_addr,
++						    load_bias);
++			if (!BAD_ADDR(elf_entry)) {
++				/*
++				 * load_elf_interp() returns relocation
++				 * adjustment
++				 */
++				interp_load_addr = elf_entry;
++				elf_entry += loc->interp_elf_ex.e_entry;
++			}
++		}
+ 		if (BAD_ADDR(elf_entry)) {
+ 			force_sig(SIGSEGV, current);
+ 			retval = IS_ERR((void *)elf_entry) ?

linux-2.6-input-kill-stupid-messages.patch:

Index: linux-2.6-input-kill-stupid-messages.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-input-kill-stupid-messages.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-input-kill-stupid-messages.patch	22 Mar 2007 16:01:16 -0000	1.1
+++ linux-2.6-input-kill-stupid-messages.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,15 +1,16 @@
---- linux-2.6.17.noarch/drivers/input/keyboard/atkbd.c~	2006-06-26 19:11:36.659767000 -0400
-+++ linux-2.6.17.noarch/drivers/input/keyboard/atkbd.c	2006-06-26 19:12:23.643737000 -0400
-@@ -383,9 +383,13 @@ static irqreturn_t atkbd_interrupt(struc
+--- linux-2.6.21.noarch/drivers/input/keyboard/atkbd.c~	2007-07-06 10:51:04.000000000 -0400
++++ linux-2.6.21.noarch/drivers/input/keyboard/atkbd.c	2007-07-06 10:51:33.000000000 -0400
+@@ -409,10 +409,14 @@ static irqreturn_t atkbd_interrupt(struc
  			goto out;
  		case ATKBD_RET_ACK:
  		case ATKBD_RET_NAK:
 +#if 0
 +			/* Quite a few key switchers and other tools trigger this and it confuses
 +			   people who can do nothing about it */
- 			printk(KERN_WARNING "atkbd.c: Spurious %s on %s. "
- 			       "Some program might be trying access hardware directly.\n",
- 			       data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
+ 			if (printk_ratelimit())
+ 				printk(KERN_WARNING "atkbd.c: Spurious %s on %s. "
+ 				       "Some program might be trying access hardware directly.\n",
+ 				       data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
 +#endif
  			goto out;
  		case ATKBD_RET_HANGEUL:

linux-2.6-net-silence-noisy-printks.patch:

Index: linux-2.6-net-silence-noisy-printks.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-net-silence-noisy-printks.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-net-silence-noisy-printks.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-net-silence-noisy-printks.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -4,123 +4,14 @@
 
 Signed-off-by: Dave Jones <davej at redhat.com>
 
-diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
-index 56b2f75..b2b36c7 100644
---- a/net/ipv4/netfilter/ip_conntrack_standalone.c
-+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c
-@@ -458,11 +458,8 @@ static unsigned int ip_conntrack_local(unsigned int hooknum,
- {
+--- linux-2.6.23.noarch/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c~	2007-10-16 13:56:02.000000000 -0400
++++ linux-2.6.23.noarch/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c	2007-10-16 13:56:08.000000000 -0400
+@@ -176,8 +176,6 @@ static unsigned int ipv4_conntrack_local
  	/* root is playing with raw sockets. */
- 	if ((*pskb)->len < sizeof(struct iphdr)
--	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr)) {
+ 	if (skb->len < sizeof(struct iphdr) ||
+ 	    ip_hdrlen(skb) < sizeof(struct iphdr)) {
 -		if (net_ratelimit())
 -			printk("ipt_hook: happy cracking.\n");
-+	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr))
  		return NF_ACCEPT;
--	}
- 	return ip_conntrack_in(hooknum, pskb, in, out, okfn);
- }
- 
-diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
-index d1d61e9..acd903e 100644
---- a/net/ipv4/netfilter/iptable_filter.c
-+++ b/net/ipv4/netfilter/iptable_filter.c
-@@ -102,11 +102,8 @@ ipt_local_out_hook(unsigned int hook,
- {
- 	/* root is playing with raw sockets. */
- 	if ((*pskb)->len < sizeof(struct iphdr)
--	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr)) {
--		if (net_ratelimit())
--			printk("ipt_hook: happy cracking.\n");
-+	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr))
- 		return NF_ACCEPT;
--	}
- 
- 	return ipt_do_table(pskb, hook, in, out, &packet_filter);
- }
-diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
-index 98b66ef..8d7bf96 100644
---- a/net/ipv4/netfilter/iptable_mangle.c
-+++ b/net/ipv4/netfilter/iptable_mangle.c
-@@ -136,11 +136,8 @@ ipt_local_hook(unsigned int hook,
- 
- 	/* root is playing with raw sockets. */
- 	if ((*pskb)->len < sizeof(struct iphdr)
--	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr)) {
--		if (net_ratelimit())
--			printk("ipt_hook: happy cracking.\n");
-+	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr))
- 		return NF_ACCEPT;
--	}
- 
- 	/* Save things which could affect route */
- 	mark = (*pskb)->mark;
-diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
-index 8f3e92d..4e3d6f6 100644
---- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
-+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
-@@ -199,11 +199,8 @@ static unsigned int ipv4_conntrack_local(unsigned int hooknum,
- {
- 	/* root is playing with raw sockets. */
- 	if ((*pskb)->len < sizeof(struct iphdr)
--	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr)) {
--		if (net_ratelimit())
--			printk("ipt_hook: happy cracking.\n");
-+	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr))
- 		return NF_ACCEPT;
--	}
- 	return nf_conntrack_in(PF_INET, hooknum, pskb);
- }
- 
-diff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c
-index 112a21d..847e6a4 100644
---- a/net/ipv6/netfilter/ip6table_filter.c
-+++ b/net/ipv6/netfilter/ip6table_filter.c
-@@ -102,11 +102,8 @@ ip6t_local_out_hook(unsigned int hook,
- #if 0
- 	/* root is playing with raw sockets. */
- 	if ((*pskb)->len < sizeof(struct iphdr)
--	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr)) {
--		if (net_ratelimit())
--			printk("ip6t_hook: happy cracking.\n");
-+	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr))
- 		return NF_ACCEPT;
--	}
- #endif
- 
- 	return ip6t_do_table(pskb, hook, in, out, &packet_filter);
-diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
-index 0c468d3..6c80e35 100644
---- a/net/ipv6/netfilter/ip6table_mangle.c
-+++ b/net/ipv6/netfilter/ip6table_mangle.c
-@@ -138,11 +138,8 @@ ip6t_local_hook(unsigned int hook,
- #if 0
- 	/* root is playing with raw sockets. */
- 	if ((*pskb)->len < sizeof(struct iphdr)
--	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr)) {
--		if (net_ratelimit())
--			printk("ip6t_hook: happy cracking.\n");
-+	    || (*pskb)->nh.iph->ihl * 4 < sizeof(struct iphdr))
- 		return NF_ACCEPT;
--	}
- #endif
- 
- 	/* save source/dest address, mark, hoplimit, flowlabel, priority,  */
-
-
-
-Remove noisy, easy to trigger (as user even, with sfuzz) printk.
-
-Signed-off-by: Dave Jones <davej at redhat.com>
-
---- linux-2.6.20.noarch/net/irda/af_irda.c~	2007-04-19 19:07:21.000000000 -0400
-+++ linux-2.6.20.noarch/net/irda/af_irda.c	2007-04-19 19:07:28.000000000 -0400
-@@ -1143,8 +1143,6 @@ static int irda_create(struct socket *so
- 			self->max_sdu_size_rx = TTP_SAR_UNBOUND;
- 			break;
- 		default:
--			IRDA_ERROR("%s: protocol not supported!\n",
--				   __FUNCTION__);
- 			return -ESOCKTNOSUPPORT;
- 		}
- 		break;
+ 	}
+ 	return nf_conntrack_in(PF_INET, hooknum, skb);

linux-2.6-ppc32-ucmpdi2.patch:

Index: linux-2.6-ppc32-ucmpdi2.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-ppc32-ucmpdi2.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-ppc32-ucmpdi2.patch	22 Mar 2007 16:01:16 -0000	1.1
+++ linux-2.6-ppc32-ucmpdi2.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,3 +1,8 @@
+Without this diff, nouveau doesn't build on ppc32.
+It works around a gcc bug. (PR #25724 / #21237)
+
+Hopefully we can just drop this when we move to gcc4.3
+
 --- linux-2.6.19.ppc/arch/powerpc/kernel/misc_32.S~	2006-11-29 21:57:37.000000000 +0000
 +++ linux-2.6.19.ppc/arch/powerpc/kernel/misc_32.S	2006-12-17 12:19:48.000000000 +0000
 @@ -728,6 +728,27 @@ _GLOBAL(__lshrdi3)

linux-2.6-ps3-ehci-iso.patch:

Index: linux-2.6-ps3-ehci-iso.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-ps3-ehci-iso.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-ps3-ehci-iso.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-ps3-ehci-iso.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -18,18 +18,27 @@
 Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
 
 ---
- drivers/usb/host/ehci-sched.c |   34 ++++++++++++++++++++++++++++++----
- 1 file changed, 30 insertions(+), 4 deletions(-)
+ drivers/usb/host/ehci-sched.c |   30 ++++++++++++++++++++++++++++++
+ 1 files changed, 30 insertions(+)
 
---- ps3-linux-dev.orig/drivers/usb/host/ehci-sched.c
-+++ ps3-linux-dev/drivers/usb/host/ehci-sched.c
-@@ -1168,8 +1168,21 @@ itd_urb_transaction (
+--- a/drivers/usb/host/ehci-sched.c
++++ b/drivers/usb/host/ehci-sched.c
+@@ -21,6 +21,10 @@
+ 
+ /*-------------------------------------------------------------------------*/
+ 
++#ifdef CONFIG_PPC_PS3
++#include <asm/firmware.h>
++#endif
++
+ /*
+  * EHCI scheduled transaction support:  interrupt, iso, split iso
+  * These are called "periodic" transactions in the EHCI spec.
+@@ -1302,8 +1306,21 @@ itd_urb_transaction (
  		if (likely (!list_empty(&stream->free_list))) {
  			itd = list_entry (stream->free_list.prev,
- 					 struct ehci_itd, itd_list);
--			list_del (&itd->itd_list);
--			itd_dma = itd->itd_dma;
-+#if defined(CONFIG_PPC_PS3)
+ 					struct ehci_itd, itd_list);
++#ifdef CONFIG_PPC_PS3
 +			/* Fix for Cell SCC ISO transfer (PS3 Bluetooth). */
 +			if (firmware_has_feature(FW_FEATURE_PS3_LV1)
 +				&& itd->frame == ((ehci_readl(ehci,
@@ -41,19 +50,17 @@
 +				itd_dma = itd->itd_dma;
 +			}
 +#else
-+                       list_del (&itd->itd_list);
-+                       itd_dma = itd->itd_dma;
+ 			list_del (&itd->itd_list);
+ 			itd_dma = itd->itd_dma;
 +#endif
  		} else
  			itd = NULL;
  
-@@ -1784,8 +1797,21 @@ sitd_urb_transaction (
+@@ -1922,8 +1939,21 @@ sitd_urb_transaction (
  		if (!list_empty(&stream->free_list)) {
  			sitd = list_entry (stream->free_list.prev,
  					 struct ehci_sitd, sitd_list);
--			list_del (&sitd->sitd_list);
--			sitd_dma = sitd->sitd_dma;
-+#if defined(CONFIG_PPC_PS3)
++#ifdef CONFIG_PPC_PS3
 +			/* Fix for Cell SCC ISO transfer (PS3 Bluetooth). */
 +			if (firmware_has_feature(FW_FEATURE_PS3_LV1)
 +				&& sitd->frame == ((ehci_readl(ehci,
@@ -65,8 +72,8 @@
 +				sitd_dma = sitd->sitd_dma;
 +			}
 +#else
-+                       list_del (&sitd->sitd_list);
-+                       sitd_dma = sitd->sitd_dma;
+ 			list_del (&sitd->sitd_list);
+ 			sitd_dma = sitd->sitd_dma;
 +#endif
  		} else
  			sitd = NULL;

linux-2.6-selinux-mprotect-checks.patch:

Index: linux-2.6-selinux-mprotect-checks.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-selinux-mprotect-checks.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-selinux-mprotect-checks.patch	24 Jan 2007 01:28:48 -0000	1.1
+++ linux-2.6-selinux-mprotect-checks.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,3 +1,6 @@
+This needs a fixed toolchain, and a userspace rebuild to work.
+For this reason, it's had difficulty getting upstream.
+
 --- linux-2.6.16-rc3/security/selinux/hooks.c	2006-02-13 13:19:09.000000000 -0500
 +++ linux-2.6.16-rc3-x/security/selinux/hooks.c	2006-02-14 14:44:48.000000000 -0500
 @@ -2365,7 +2365,6 @@ static int selinux_file_ioctl(struct fil

linux-2.6-serial-460800.patch:

Index: linux-2.6-serial-460800.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-serial-460800.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-serial-460800.patch	24 Jan 2007 01:28:48 -0000	1.1
+++ linux-2.6-serial-460800.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -38,13 +38,13 @@
  
  	switch (termios->c_cflag & CSIZE) {
  	case CS5:
-@@ -1697,7 +1708,8 @@
+@@ -2034,7 +2034,8 @@ serial8250_set_termios(struct uart_port 
  	/*
  	 * Ask the core to calculate the divisor for us.
  	 */
--	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 
+-	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
 +	max_baud = (up->port.type == PORT_16C950 ? port->uartclk/4 : port->uartclk/16);
-+	baud = uart_get_baud_rate(port, termios, old, 0, max_baud); 
++	baud = uart_get_baud_rate(port, termios, old, 0, max_baud);
  	quot = serial8250_get_divisor(port, baud);
  
  	/*
@@ -52,7 +52,7 @@
  	 */
  	spin_lock_irqsave(&up->port.lock, flags);
  
-+	/* 
++	/*
 +	 * 16C950 supports additional prescaler ratios between 1:16 and 1:4
 +	 * thus increasing max baud rate to uartclk/4.
 +	 */
@@ -64,7 +64,7 @@
 +		else
 +			serial_icr_write(up, UART_TCR, 0);
 +	}
-+	
++
  	/*
  	 * Update the per-port timeout.
  	 */

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.3
retrieving revision 1.3.8.1
diff -u -r1.3 -r1.3.8.1
--- linux-2.6-silence-noise.patch	24 Jul 2007 14:13:44 -0000	1.3
+++ linux-2.6-silence-noise.patch	18 Feb 2008 16:55:17 -0000	1.3.8.1
@@ -1,5 +1,5 @@
---- linux-2.6.18.noarch/arch/x86_64/mm/init.c~	2006-10-16 17:09:56.000000000 -0400
-+++ linux-2.6.18.noarch/arch/x86_64/mm/init.c	2006-10-16 17:10:09.000000000 -0400
+--- 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;
@@ -32,8 +32,8 @@
  				"#%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/i386/pci/i386.c~	2006-12-04 11:21:32.000000000 -0500
-+++ linux-2.6.19.noarch/arch/i386/pci/i386.c	2006-12-04 11:22:10.000000000 -0500
+--- 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_
  				pr = pci_find_parent_resource(dev, r);
  				if (!r->start || !pr ||
@@ -52,28 +52,7 @@
  						"resource region %d "
  						"of device %s\n",
  						idx, pci_name(dev));
---- linux-2.6.20.noarch/drivers/base/power/main.c~	2007-04-12 15:29:10.000000000 -0400
-+++ linux-2.6.20.noarch/drivers/base/power/main.c	2007-04-12 15:29:34.000000000 -0400
-@@ -53,9 +53,6 @@ int device_pm_add(struct device * dev)
- {
- 	int error;
- 
--	pr_debug("PM: Adding info for %s:%s\n",
--		 dev->bus ? dev->bus->name : "No Bus",
--		 kobject_name(&dev->kobj));
- 	down(&dpm_list_sem);
- 	list_add_tail(&dev->power.entry, &dpm_active);
- 	device_pm_set_parent(dev, dev->parent);
-@@ -67,9 +64,6 @@ int device_pm_add(struct device * dev)
- 
- void device_pm_remove(struct device * dev)
- {
--	pr_debug("PM: Removing info for %s:%s\n",
--		 dev->bus ? dev->bus->name : "No Bus",
--		 kobject_name(&dev->kobj));
- 	down(&dpm_list_sem);
- 	dpm_sysfs_remove(dev);
- 	put_device(dev->power.pm_parent);
+
 Remove noisy PM printk.
 This has served its purpose.
 
@@ -97,3 +76,24 @@
  	}
  	pci_restore_pcix_state(dev);
  	pci_restore_msi_state(dev);
+
+
+--- linux-2.6.22.noarch/drivers/base/power/main.c~	2007-07-13 15:44:37.000000000 -0400
++++ linux-2.6.22.noarch/drivers/base/power/main.c	2007-07-13 15:44:44.000000000 -0400
+@@ -37,6 +37,3 @@ int device_pm_add(struct device *dev)
+ {
+-	pr_debug("PM: Adding info for %s:%s\n",
+-		 dev->bus ? dev->bus->name : "No Bus",
+-		 kobject_name(&dev->kobj));
+ 	mutex_lock(&dpm_list_mtx);
+ 	list_add_tail(&dev->power.entry, &dpm_active);
+@@ -51,9 +48,6 @@ int device_pm_add(struct device *dev)
+ 
+ void device_pm_remove(struct device *dev)
+ {
+-	pr_debug("PM: Removing info for %s:%s\n",
+-		 dev->bus ? dev->bus->name : "No Bus",
+-		 kobject_name(&dev->kobj));
+ 	mutex_lock(&dpm_list_mtx);
+ 	dpm_sysfs_remove(dev);
+ 	list_del_init(&dev->power.entry);

linux-2.6-squashfs.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.3 -r 1.3.8.1 linux-2.6-squashfs.patch
Index: linux-2.6-squashfs.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-squashfs.patch,v
retrieving revision 1.3
retrieving revision 1.3.8.1
diff -u -r1.3 -r1.3.8.1
--- linux-2.6-squashfs.patch	24 Jul 2007 14:13:44 -0000	1.3
+++ linux-2.6-squashfs.patch	18 Feb 2008 16:55:17 -0000	1.3.8.1
@@ -1,26 +1,27 @@
-diff -x .gitignore -Nurp linux-2.6.20/fs/Kconfig linux-2.6.20-squashfs3.2-r2/fs/Kconfig
---- linux-2.6.20/fs/Kconfig	2006-12-25 01:13:12.000000000 +0000
-+++ linux-2.6.20-squashfs3.2-r2/fs/Kconfig	2007-01-16 02:06:03.000000000 +0000
-@@ -1404,6 +1404,71 @@ config CRAMFS
+diff -x .gitignore -Nurp linux-2.6.24/fs/Kconfig linux-2.6.24-squashfs3.3/fs/Kconfig
+--- linux-2.6.24/fs/Kconfig	2007-10-25 17:41:45.000000000 +0100
++++ linux-2.6.24-squashfs3.3/fs/Kconfig	2007-11-01 05:06:25.000000000 +0000
+@@ -1396,6 +1396,56 @@ config CRAMFS
  
  	  If unsure, say N.
  
 +config SQUASHFS
-+	tristate "SquashFS 3.2 - Squashed file system support"
++	tristate "SquashFS 3.3 - Squashed file system support"
 +	select ZLIB_INFLATE
 +	help
-+	  Saying Y here includes support for SquashFS 3.2 (a Compressed Read-Only File
-+	  System).  Squashfs is a highly compressed read-only filesystem for Linux.
-+	  It uses zlib compression to compress both files, inodes and directories.
-+	  Inodes in the system are very small and all blocks are packed to minimise
-+	  data overhead. Block sizes greater than 4K are supported up to a maximum of 64K.
-+	  SquashFS 3.1 supports 64 bit filesystems and files (larger than 4GB), full
-+	  uid/gid information, hard links and timestamps.
-+
-+	  Squashfs is intended for general read-only filesystem use, for archival
-+	  use (i.e. in cases where a .tar.gz file may be used), and in embedded
-+	  systems where low overhead is needed.  Further information and filesystem tools
-+	  are available from http://squashfs.sourceforge.net.
++	  Saying Y here includes support for SquashFS 3.3 (a Compressed
++	  Read-Only File System).  Squashfs is a highly compressed read-only
++	  filesystem for Linux.  It uses zlib compression to compress both
++	  files, inodes and directories.  Inodes in the system are very small
++	  and all blocks are packed to minimise data overhead. Block sizes
++	  greater than 4K are supported up to a maximum of 1 Mbytes (default
++	  block size 128K).  SquashFS 3.3 supports 64 bit filesystems and files
++	  (larger than 4GB), full uid/gid information, hard links and timestamps.  
++
++	  Squashfs is intended for general read-only filesystem use, for
++	  archival use (i.e. in cases where a .tar.gz file may be used), and in
++	  embedded systems where low overhead is needed.  Further information
++	  and filesystem tools are available from http://squashfs.sourceforge.net.
 +
 +	  If you want to compile this as a module ( = code which can be
 +	  inserted in and removed from the running kernel whenever you want),
@@ -32,13 +33,11 @@
 +
 +config SQUASHFS_EMBEDDED
 +
-+	bool "Additional options for memory-constrained systems" 
++	bool "Additional option for memory-constrained systems" 
 +	depends on SQUASHFS
 +	default n
 +	help
-+	  Saying Y here allows you to specify cache sizes and how Squashfs
-+	  allocates memory.  This is only intended for memory constrained
-+	  systems.
++	  Saying Y here allows you to specify cache size.
 +
 +	  If unsure, say N.
 +
@@ -56,43 +55,29 @@
 +	  Note there must be at least one cached fragment.  Anything
 +	  much more than three will probably not make much difference.
 +
-+config SQUASHFS_VMALLOC
-+	bool "Use Vmalloc rather than Kmalloc" if SQUASHFS_EMBEDDED
-+	depends on SQUASHFS
-+	default n
-+	help
-+	  By default SquashFS uses kmalloc to obtain fragment cache memory.
-+	  Kmalloc memory is the standard kernel allocator, but it can fail
-+	  on memory constrained systems.  Because of the way Vmalloc works,
-+	  Vmalloc can succeed when kmalloc fails.  Specifying this option
-+	  will make SquashFS always use Vmalloc to allocate the
-+	  fragment cache memory.
-+
-+	  If unsure, say N.
-+
  config VXFS_FS
  	tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
  	depends on BLOCK
-diff -x .gitignore -Nurp linux-2.6.20/fs/Makefile linux-2.6.20-squashfs3.2-r2/fs/Makefile
---- linux-2.6.20/fs/Makefile	2006-12-25 01:13:12.000000000 +0000
-+++ linux-2.6.20-squashfs3.2-r2/fs/Makefile	2007-01-16 02:06:03.000000000 +0000
-@@ -68,6 +68,7 @@ obj-$(CONFIG_JBD)		+= jbd/
+diff -x .gitignore -Nurp linux-2.6.24/fs/Makefile linux-2.6.24-squashfs3.3/fs/Makefile
+--- linux-2.6.24/fs/Makefile	2007-10-25 17:41:45.000000000 +0100
++++ linux-2.6.24-squashfs3.3/fs/Makefile	2007-11-01 05:08:09.000000000 +0000
+@@ -72,6 +72,7 @@ obj-$(CONFIG_JBD)		+= jbd/
  obj-$(CONFIG_JBD2)		+= jbd2/
  obj-$(CONFIG_EXT2_FS)		+= ext2/
  obj-$(CONFIG_CRAMFS)		+= cramfs/
 +obj-$(CONFIG_SQUASHFS)		+= squashfs/
- obj-$(CONFIG_RAMFS)		+= ramfs/
+ obj-y				+= ramfs/
  obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
  obj-$(CONFIG_CODA_FS)		+= coda/
-diff -x .gitignore -Nurp linux-2.6.20/fs/squashfs/inode.c linux-2.6.20-squashfs3.2-r2/fs/squashfs/inode.c
---- linux-2.6.20/fs/squashfs/inode.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.20-squashfs3.2-r2/fs/squashfs/inode.c	2007-01-16 02:28:36.000000000 +0000
-@@ -0,0 +1,2329 @@
+diff -x .gitignore -Nurp linux-2.6.24/fs/squashfs/inode.c linux-2.6.24-squashfs3.3/fs/squashfs/inode.c
+--- linux-2.6.24/fs/squashfs/inode.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.24-squashfs3.3/fs/squashfs/inode.c	2007-11-01 05:05:00.000000000 +0000
+@@ -0,0 +1,2192 @@
 +/*
 + * Squashfs - a compressed read only filesystem for Linux
 + *
 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
-+ * Phillip Lougher <phillip at lougher.org.uk>
++ * Phillip Lougher <phillip at lougher.demon.co.uk>
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -121,9 +106,12 @@
 +#include <linux/vfs.h>
 +#include <linux/vmalloc.h>
 +#include <linux/smp_lock.h>
++#include <linux/exportfs.h>
 +
 +#include "squashfs.h"
 +
++int squashfs_cached_blks;
++
 +static void vfs_read_inode(struct inode *i);
 +static struct dentry *squashfs_get_parent(struct dentry *child);
 +static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode);
@@ -133,7 +121,6 @@
 +				int readahead_blks, char *block_list,
 +				unsigned short **block_p, unsigned int *bsize);
 +static int squashfs_readpage(struct file *file, struct page *page);
-+static int squashfs_readpage4K(struct file *file, struct page *page);
 +static int squashfs_readdir(struct file *, void *, filldir_t);
 +static struct dentry *squashfs_lookup(struct inode *, struct dentry *,
 +				struct nameidata *);
@@ -186,10 +173,6 @@
 +	.readpage = squashfs_readpage
 +};
 +
-+SQSH_EXTERN const struct address_space_operations squashfs_aops_4K = {
-+	.readpage = squashfs_readpage4K
-+};
-+
 +static const struct file_operations squashfs_dir_ops = {
 +	.read = generic_read_dir,
 +	.readdir = squashfs_readdir
@@ -273,30 +256,36 @@
 +{
 +	struct squashfs_sb_info *msblk = s->s_fs_info;
 +	struct squashfs_super_block *sblk = &msblk->sblk;
-+	struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >>
-+			msblk->devblksize_log2) + 2];
++	struct buffer_head **bh;
 +	unsigned int offset = index & ((1 << msblk->devblksize_log2) - 1);
 +	unsigned int cur_index = index >> msblk->devblksize_log2;
 +	int bytes, avail_bytes, b = 0, k = 0;
 +	unsigned int compressed;
 +	unsigned int c_byte = length;
 +
++	bh = kmalloc(((sblk->block_size >> msblk->devblksize_log2) + 1) *
++								sizeof(struct buffer_head *), GFP_KERNEL);
++	if (bh == NULL)
++		goto read_failure;
++
 +	if (c_byte) {
 +		bytes = msblk->devblksize - offset;
 +		compressed = SQUASHFS_COMPRESSED_BLOCK(c_byte);
 +		c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte);
 +
-+		TRACE("Block @ 0x%llx, %scompressed size %d, src size %d\n", index, compressed
-+					? "" : "un", (unsigned int) c_byte, srclength);
++		TRACE("Block @ 0x%llx, %scompressed size %d, src size %d\n", index,
++					compressed ? "" : "un", (unsigned int) c_byte, srclength);
 +
 +		if (c_byte > srclength || index < 0 || (index + c_byte) > sblk->bytes_used)
 +			goto read_failure;
 +
-+		if (!(bh[0] = sb_getblk(s, cur_index)))
++		bh[0] = sb_getblk(s, cur_index);
++		if (bh[0] == NULL)
 +			goto block_release;
 +
 +		for (b = 1; bytes < c_byte; b++) {
-+			if (!(bh[b] = sb_getblk(s, ++cur_index)))
++			bh[b] = sb_getblk(s, ++cur_index);
++			if (bh[b] == NULL)
 +				goto block_release;
 +			bytes += msblk->devblksize;
 +		}
@@ -305,8 +294,8 @@
 +		if (index < 0 || (index + 2) > sblk->bytes_used)
[...1878 lines suppressed...]
 +			SQUASHFS_I(i)->start_block = inodep->start_block;
 +			SQUASHFS_I(i)->u.s1.block_list_start = next_block;
 +			SQUASHFS_I(i)->offset = next_offset;
-+			if (sblk->block_size > 4096)
-+				i->i_data.a_ops = &squashfs_aops;
-+			else
-+				i->i_data.a_ops = &squashfs_aops_4K;
++			i->i_data.a_ops = &squashfs_aops;
 +
 +			TRACE("File inode %x:%x, start_block %x, "
 +					"block_list_start %llx, offset %x\n",
@@ -3174,15 +3020,15 @@
 +
 +	return 1;
 +}
-diff -x .gitignore -Nurp linux-2.6.20/fs/squashfs/squashfs.h linux-2.6.20-squashfs3.2-r2/fs/squashfs/squashfs.h
---- linux-2.6.20/fs/squashfs/squashfs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.20-squashfs3.2-r2/fs/squashfs/squashfs.h	2007-01-12 01:42:11.000000000 +0000
-@@ -0,0 +1,87 @@
+diff -x .gitignore -Nurp linux-2.6.24/fs/squashfs/squashfs.h linux-2.6.24-squashfs3.3/fs/squashfs/squashfs.h
+--- linux-2.6.24/fs/squashfs/squashfs.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.24-squashfs3.3/fs/squashfs/squashfs.h	2007-08-19 04:23:16.000000000 +0100
+@@ -0,0 +1,86 @@
 +/*
 + * Squashfs - a compressed read only filesystem for Linux
 + *
 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
-+ * Phillip Lougher <phillip at lougher.org.uk>
++ * Phillip Lougher <phillip at lougher.demon.co.uk>
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -3230,7 +3076,7 @@
 +extern unsigned int squashfs_read_data(struct super_block *s, char *buffer,
 +				long long index, unsigned int length,
 +				long long *next_index, int srclength);
-+extern int squashfs_get_cached_block(struct super_block *s, char *buffer,
++extern int squashfs_get_cached_block(struct super_block *s, void *buffer,
 +				long long block, unsigned int offset,
 +				int length, long long *next_block,
 +				unsigned int *next_offset);
@@ -3242,7 +3088,6 @@
 +extern struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode, unsigned int inode_number);
 +extern const struct address_space_operations squashfs_symlink_aops;
 +extern const struct address_space_operations squashfs_aops;
-+extern const struct address_space_operations squashfs_aops_4K;
 +extern struct inode_operations squashfs_dir_inode_ops;
 +#else
 +#define SQSH_EXTERN static
@@ -3265,10 +3110,10 @@
 +	return 0;
 +}
 +#endif
-diff -x .gitignore -Nurp linux-2.6.20/include/linux/squashfs_fs.h linux-2.6.20-squashfs3.2-r2/include/linux/squashfs_fs.h
---- linux-2.6.20/include/linux/squashfs_fs.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.20-squashfs3.2-r2/include/linux/squashfs_fs.h	2007-01-12 00:06:09.000000000 +0000
-@@ -0,0 +1,934 @@
+diff -x .gitignore -Nurp linux-2.6.24/include/linux/squashfs_fs.h linux-2.6.24-squashfs3.3/include/linux/squashfs_fs.h
+--- linux-2.6.24/include/linux/squashfs_fs.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.24-squashfs3.3/include/linux/squashfs_fs.h	2007-11-01 03:50:57.000000000 +0000
+@@ -0,0 +1,935 @@
 +#ifndef SQUASHFS_FS
 +#define SQUASHFS_FS
 +
@@ -3276,7 +3121,7 @@
 + * Squashfs
 + *
 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
-+ * Phillip Lougher <phillip at lougher.org.uk>
++ * Phillip Lougher <phillip at lougher.demon.co.uk>
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -3299,16 +3144,9 @@
 +#define CONFIG_SQUASHFS_2_0_COMPATIBILITY
 +#endif
 +
-+#ifdef	CONFIG_SQUASHFS_VMALLOC
-+#define SQUASHFS_ALLOC(a)		vmalloc(a)
-+#define SQUASHFS_FREE(a)		vfree(a)
-+#else
-+#define SQUASHFS_ALLOC(a)		kmalloc(a, GFP_KERNEL)
-+#define SQUASHFS_FREE(a)		kfree(a)
-+#endif
 +#define SQUASHFS_CACHED_FRAGMENTS	CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE	
 +#define SQUASHFS_MAJOR			3
-+#define SQUASHFS_MINOR			0
++#define SQUASHFS_MINOR			1
 +#define SQUASHFS_MAGIC			0x73717368
 +#define SQUASHFS_MAGIC_SWAP		0x68737173
 +#define SQUASHFS_START			0
@@ -3318,10 +3156,10 @@
 +#define SQUASHFS_METADATA_LOG		13
 +
 +/* default size of data blocks */
-+#define SQUASHFS_FILE_SIZE		65536
-+#define SQUASHFS_FILE_LOG		16
++#define SQUASHFS_FILE_SIZE		131072
++#define SQUASHFS_FILE_LOG		17
 +
-+#define SQUASHFS_FILE_MAX_SIZE		65536
++#define SQUASHFS_FILE_MAX_SIZE		1048576
 +
 +/* Max number of uids and gids */
 +#define SQUASHFS_UIDS			256
@@ -3402,9 +3240,8 @@
 +
 +#define SQUASHFS_COMPRESSED_BIT_BLOCK		(1 << 24)
 +
-+#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B)	(((B) & \
-+	~SQUASHFS_COMPRESSED_BIT_BLOCK) ? (B) & \
-+	~SQUASHFS_COMPRESSED_BIT_BLOCK : SQUASHFS_COMPRESSED_BIT_BLOCK)
++#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B)	((B) & \
++	~SQUASHFS_COMPRESSED_BIT_BLOCK)
 +
 +#define SQUASHFS_COMPRESSED_BLOCK(B)	(!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK))
 +
@@ -3900,6 +3737,15 @@
 +	unsigned int		start_block:24;
 +} __attribute__  ((packed));
 +
++union squashfs_inode_header_1 {
++	struct squashfs_base_inode_header_1	base;
++	struct squashfs_dev_inode_header_1	dev;
++	struct squashfs_symlink_inode_header_1	symlink;
++	struct squashfs_reg_inode_header_1	reg;
++	struct squashfs_dir_inode_header_1	dir;
++	struct squashfs_ipc_inode_header_1	ipc;
++};
++
 +#define SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n) \
 +	SQUASHFS_MEMSET(s, d, n);\
 +	SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
@@ -4203,9 +4049,9 @@
 +
 +#endif
 +#endif
-diff -x .gitignore -Nurp linux-2.6.20/include/linux/squashfs_fs_i.h linux-2.6.20-squashfs3.2-r2/include/linux/squashfs_fs_i.h
---- linux-2.6.20/include/linux/squashfs_fs_i.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.20-squashfs3.2-r2/include/linux/squashfs_fs_i.h	2007-01-12 00:06:09.000000000 +0000
+diff -x .gitignore -Nurp linux-2.6.24/include/linux/squashfs_fs_i.h linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_i.h
+--- linux-2.6.24/include/linux/squashfs_fs_i.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_i.h	2007-08-19 04:24:08.000000000 +0100
 @@ -0,0 +1,45 @@
 +#ifndef SQUASHFS_FS_I
 +#define SQUASHFS_FS_I
@@ -4213,7 +4059,7 @@
 + * Squashfs
 + *
 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
-+ * Phillip Lougher <phillip at lougher.org.uk>
++ * Phillip Lougher <phillip at lougher.demon.co.uk>
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -4252,17 +4098,17 @@
 +	struct inode	vfs_inode;
 +};
 +#endif
-diff -x .gitignore -Nurp linux-2.6.20/include/linux/squashfs_fs_sb.h linux-2.6.20-squashfs3.2-r2/include/linux/squashfs_fs_sb.h
---- linux-2.6.20/include/linux/squashfs_fs_sb.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.20-squashfs3.2-r2/include/linux/squashfs_fs_sb.h	2007-01-12 01:23:47.000000000 +0000
-@@ -0,0 +1,74 @@
+diff -x .gitignore -Nurp linux-2.6.24/include/linux/squashfs_fs_sb.h linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_sb.h
+--- linux-2.6.24/include/linux/squashfs_fs_sb.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.24-squashfs3.3/include/linux/squashfs_fs_sb.h	2007-08-19 04:24:26.000000000 +0100
+@@ -0,0 +1,76 @@
 +#ifndef SQUASHFS_FS_SB
 +#define SQUASHFS_FS_SB
 +/*
 + * Squashfs
 + *
 + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007
-+ * Phillip Lougher <phillip at lougher.org.uk>
++ * Phillip Lougher <phillip at lougher.demon.co.uk>
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -4322,6 +4168,8 @@
 +	struct meta_index	*meta_index;
 +	z_stream		stream;
 +	long long		*inode_lookup_table;
++	int			unused_cache_blks;
++	int			unused_frag_blks;
 +	int			(*read_inode)(struct inode *i,  squashfs_inode_t \
 +				inode);
 +	long long		(*read_blocklist)(struct inode *inode, int \
@@ -4330,9 +4178,9 @@
 +	int			(*read_fragment_index_table)(struct super_block *s);
 +};
 +#endif
-diff -x .gitignore -Nurp linux-2.6.20/init/do_mounts_rd.c linux-2.6.20-squashfs3.2-r2/init/do_mounts_rd.c
---- linux-2.6.20/init/do_mounts_rd.c	2006-11-29 21:57:37.000000000 +0000
-+++ linux-2.6.20-squashfs3.2-r2/init/do_mounts_rd.c	2007-01-16 02:06:03.000000000 +0000
+diff -x .gitignore -Nurp linux-2.6.24/init/do_mounts_rd.c linux-2.6.24-squashfs3.3/init/do_mounts_rd.c
+--- linux-2.6.24/init/do_mounts_rd.c	2007-10-25 17:41:49.000000000 +0100
++++ linux-2.6.24-squashfs3.3/init/do_mounts_rd.c	2007-11-01 05:06:25.000000000 +0000
 @@ -5,6 +5,7 @@
  #include <linux/ext2_fs.h>
  #include <linux/romfs_fs.h>

linux-2.6-unexport-symbols.patch:

Index: linux-2.6-unexport-symbols.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-unexport-symbols.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-unexport-symbols.patch	24 Jan 2007 01:28:48 -0000	1.1
+++ linux-2.6-unexport-symbols.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,14 +1,13 @@
 No external modules should be touching these symbols.
 If they are, they are broken.
 
-diff -urNp --exclude-from=/home/davej/.exclude linux-3022/fs/open.c linux-10000/fs/open.c
---- linux-3022/fs/open.c
-+++ linux-10000/fs/open.c
-@@ -976,7 +976,6 @@ out_error:
- 	fd = error;
- 	goto out;
+--- linux-2.6.23.noarch/fs/open.c~	2007-11-15 12:56:28.000000000 -0500
++++ linux-2.6.23.noarch/fs/open.c	2007-11-15 12:56:46.000000000 -0500
+@@ -1061,7 +1061,6 @@ asmlinkage long sys_open(const char __us
+ 	prevent_tail_call(ret);
+ 	return ret;
  }
--EXPORT_SYMBOL_GPL(sys_open);
- 
- #ifndef __alpha__
+-EXPORT_UNUSED_SYMBOL_GPL(sys_open); /* To be deleted for 2.6.25 */
  
+ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
+ 			   int mode)

linux-2.6-utrace-core.patch:

Index: linux-2.6-utrace-core.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-core.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-core.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-core.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -19,38 +19,34 @@
 
 ---
 
+ kernel/Makefile                   |    1 
+ kernel/utrace.c                   | 2359 +++++++++++++++++++++++++++++++++++++
+ Documentation/utrace.txt          |  579 +++++++++
  Documentation/DocBook/Makefile    |    2 
  Documentation/DocBook/utrace.tmpl |   23 
- Documentation/utrace.txt          |  579 ++++++++++
- include/linux/sched.h             |    5 
  include/linux/tracehook.h         |   85 +
  include/linux/utrace.h            |  544 +++++++++
+ include/linux/sched.h             |    5 
  init/Kconfig                      |   18 
- kernel/Makefile                   |    1 
- kernel/utrace.c                   | 2141 ++++++++++++++++++++++++++++++++++++++
- 9 files changed, 3380 insertions(+), 18 deletions(-)
+ 9 files changed, 3598 insertions(+), 18 deletions(-)
  create kernel/utrace.c
  create Documentation/utrace.txt
  create Documentation/DocBook/utrace.tmpl
  create include/linux/utrace.h
 
-Index: b/kernel/Makefile
-===================================================================
---- a/kernel/Makefile
-+++ b/kernel/Makefile
-@@ -51,6 +51,7 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
- obj-$(CONFIG_UTS_NS) += utsname.o
+--- linux-2.6/kernel/Makefile
++++ linux-2.6/kernel/Makefile
+@@ -57,6 +57,7 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
  obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
  obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
+ obj-$(CONFIG_MARKERS) += marker.o
 +obj-$(CONFIG_UTRACE) += utrace.o
  
  ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
  # According to Alan Modra <alan at linuxcare.com.au>, the -fno-omit-frame-pointer is
-Index: b/kernel/utrace.c
-===================================================================
---- /dev/null
-+++ b/kernel/utrace.c
-@@ -0,0 +1,2141 @@
+--- linux-2.6/kernel/utrace.c
++++ linux-2.6/kernel/utrace.c
+@@ -0,0 +1,2359 @@
 +/*
 + * utrace infrastructure interface for debugging user processes
 + *
@@ -125,11 +121,11 @@
 +	utrace_cachep =
 +		kmem_cache_create("utrace_cache",
 +				  sizeof(struct utrace), 0,
-+				  SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
++				  SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
 +	utrace_engine_cachep =
 +		kmem_cache_create("utrace_engine_cache",
 +				  sizeof(struct utrace_attached_engine), 0,
-+				  SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
++				  SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
 +	return 0;
 +}
 +subsys_initcall(utrace_init);
@@ -154,12 +150,13 @@
 +	 * to attach.  The PF_STARTING flag is cleared after its
 +	 * report_clone hook has had a chance to run.
 +	 */
-+	if ((target->flags & PF_STARTING)
-+	    && (current->utrace == NULL
-+		|| current->utrace->u.live.cloning != target)) {
-+		yield();
-+		return (signal_pending(current)
-+			? ERR_PTR(-ERESTARTNOINTR) : NULL);
++	if (target->flags & PF_STARTING) {
++		utrace = current->utrace;
++		if (utrace == NULL || utrace->u.live.cloning != target) {
++			yield();
++			return (signal_pending(current)
++				? ERR_PTR(-ERESTARTNOINTR) : NULL);
++		}
 +	}
 +
 +	utrace = kmem_cache_alloc(utrace_cachep, GFP_KERNEL);
@@ -359,7 +356,18 @@
 +			 * which will call release_task itself.
 +			 */
 +			read_unlock(&tasklist_lock);
++	}
 +
++	/*
++	 * When it's in TASK_STOPPED state, do not set UTRACE_EVENT(JCTL).
++	 * That bit indicates utrace_report_jctl has not run yet, but it
++	 * may have.  Set UTRACE_ACTION_QUIESCE instead to be sure that
++	 * once it resumes it will recompute its flags in utrace_quiescent.
++	 */
++	if (((flags &~ tsk->utrace_flags) & UTRACE_EVENT(JCTL))
++	    && tsk->state == TASK_STOPPED) {
++		flags &= ~UTRACE_EVENT(JCTL);
++		flags |= UTRACE_ACTION_QUIESCE;
 +	}
 +
 +	tsk->utrace_flags = flags;
@@ -405,7 +413,7 @@
 +static int
 +quiesce(struct task_struct *target, int interrupt)
 +{
-+	int quiescent;
++	int ret;
 +
 +	target->utrace_flags |= UTRACE_ACTION_QUIESCE;
 +	read_barrier_depends();
@@ -413,27 +421,62 @@
 +	if (target->exit_state)
 +		goto dead;
 +
-+	quiescent = target->state & (TASK_TRACED | TASK_STOPPED);
-+	if (!quiescent) {
++	/*
++	 * First a quick check without the siglock.  If it's in TASK_TRACED
++	 * or TASK_STOPPED already, we know it is going to go through
++	 * utrace_get_signal before it resumes.
++	 */
++	ret = 1;
++	switch (target->state) {
++	case TASK_TRACED:
++		break;
++
++	case TASK_STOPPED:
++		/*
++		 * If it will call utrace_report_jctl but has not gotten
++		 * through it yet, then don't consider it quiescent yet.
++		 * utrace_report_jctl will take target->utrace->lock and
++		 * clear UTRACE_EVENT(JCTL) once it finishes.  After that,
++		 * it is considered quiescent; when it wakes up, it will go
++		 * through utrace_get_signal before doing anything else.
++		 */
++		if (!(target->utrace_flags & UTRACE_EVENT(JCTL)))
++			break;
++
++	default:
++		/*
++		 * Now get the siglock and check again.
++		 */
 +		spin_lock_irq(&target->sighand->siglock);
 +		if (unlikely(target->exit_state)) {
 +			spin_unlock_irq(&target->sighand->siglock);
 +			goto dead;
 +		}
-+		quiescent = unlikely(target->state
-+				     & (TASK_TRACED | TASK_STOPPED));
-+		if (!quiescent) {
++		switch (target->state) {
++		case TASK_TRACED:
++			break;
++
++		case TASK_STOPPED:
++			ret = !(target->utrace_flags & UTRACE_EVENT(JCTL));
++			break;
++
++		default:
++			/*
++			 * It is not stopped, so tell it to stop soon.
++			 */
++			ret = 0;
 +			if (interrupt)
 +				signal_wake_up(target, 0);
 +			else {
 +				set_tsk_thread_flag(target, TIF_SIGPENDING);
 +				kick_process(target);
 +			}
++			break;
 +		}
 +		spin_unlock_irq(&target->sighand->siglock);
 +	}
 +
-+	return quiescent;
++	return ret;
 +
 +dead:
 +	/*
@@ -479,7 +522,7 @@
 + */
 +struct utrace_attached_engine *
 +utrace_attach(struct task_struct *target, int flags,
-+	     const struct utrace_engine_ops *ops, void *data)
++	      const struct utrace_engine_ops *ops, void *data)
 +{
 +	struct utrace *utrace;
 +	struct utrace_attached_engine *engine;
@@ -494,6 +537,8 @@
 +		 * Check this first; a race with reaping may lead to restart.
 +		 */
 +		rcu_read_unlock();
++		if (!(flags & UTRACE_ATTACH_CREATE))
++			return ERR_PTR(-ENOENT);
 +		return ERR_PTR(-ESRCH);
 +	}
 +
@@ -579,10 +624,13 @@
 +EXPORT_SYMBOL_GPL(utrace_attach);
 +
 +/*
-+ * When an engine is detached, the target thread may still see it and make
-+ * callbacks until it quiesces.  We reset its event flags to just QUIESCE
-+ * and install a special ops vector whose callback is dead_engine_delete.
-+ * When the target thread quiesces, it can safely free the engine itself.
++ * When an engine is detached, the target thread may still see it
++ * and make callbacks until it quiesces.  We install a special ops
++ * vector whose callbacks are all dead_engine_delete.  When the
++ * target thread quiesces, it can safely free the engine itself.
++ * We must cover all callbacks in case of races between checking
++ * engine->flags and utrace_detach changing engine->ops.
++ * Only report_reap is never called due to a special case in utrace_reap.
 + */
 +static u32
 +dead_engine_delete(struct utrace_attached_engine *engine,
@@ -591,9 +639,38 @@
 +	return UTRACE_ACTION_DETACH;
 +}
 +
++/*
++ * Don't use .report_xxx = ... style here because this way makes it easier
++ * to be sure we're forced to have an initializer here for every member.
++ */
 +static const struct utrace_engine_ops dead_engine_ops =
 +{
-+	.report_quiesce = &dead_engine_delete
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 unsigned long, struct task_struct *)) &dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 pid_t)) &dead_engine_delete,
++	&dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 struct pt_regs *, u32, siginfo_t *,
++		 const struct k_sigaction *, struct k_sigaction *))
++	&dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 int)) &dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 const struct linux_binprm *, struct pt_regs *))
++	&dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 struct pt_regs *)) &dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 struct pt_regs *)) &dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *,
++		 long, long *)) &dead_engine_delete,
++	(u32 (*)(struct utrace_attached_engine *, struct task_struct *))
++	&dead_engine_delete,
++	NULL,			/* report_reap */
++	NULL,			/* allow_access_process_vm */
++	NULL,			/* unsafe_exec */
++	NULL,			/* tracer_task */
 +};
 +
 +
@@ -799,9 +876,32 @@
 +		return ret;
 +	}
 +
-+	flags = engine->flags;
-+	engine->flags = UTRACE_EVENT(QUIESCE) | UTRACE_ACTION_QUIESCE;
++	/*
++	 * This must work while the target thread races with us doing:
++	 *	if (engine->flags & UTRACE_EVENT(x)) REPORT(x, ...);
++	 * The REPORT macro uses smp_rmb() between checking engine->flags
++	 * and using engine->ops.  Here we change engine->ops first, then
++	 * use smp_wmb() before changing engine->flags.  This ensures it
++	 * can check the old flags before using the old ops, or check the
++	 * old flags before using the new ops, or check the new flags
++	 * before using the new ops, but can never check the new flags
++	 * before using the old ops.  Hence, dead_engine_ops might be used
++	 * with any old flags in place.  So, it has report_* callback
++	 * pointers for every event type.  Since it has to have those
++	 * anyway, we enable (for after any potential race) all the events
++	 * that have no overhead to enable.  We want it to get into that
++	 * callback and complete the detach ASAP.
++	 */
 +	rcu_assign_pointer(engine->ops, &dead_engine_ops);
++	smp_wmb();
++	flags = engine->flags;
++	engine->flags = (UTRACE_EVENT(QUIESCE)
++			 | UTRACE_EVENT(CLONE)
++			 | UTRACE_EVENT(VFORK_DONE)
++			 | UTRACE_EVENT(EXEC)
++			 | UTRACE_EVENT(EXIT)
++			 | UTRACE_EVENT(JCTL)
++			 | UTRACE_ACTION_QUIESCE);
 +
 +	if (quiesce(target, 1)) {
 +		remove_engine(engine, target, utrace);
@@ -926,7 +1026,7 @@
 +{
 +	struct utrace *utrace;
 +	int report;
-+	unsigned long old_flags, old_utrace_flags;
++	unsigned long old_flags, old_utrace_flags, set_utrace_flags;
 +	int ret = -EALREADY;
 +
 +#ifdef ARCH_HAS_SINGLE_STEP
@@ -960,6 +1060,22 @@
 +	}
 +
 +	/*
++	 * When it's in TASK_STOPPED state, do not set UTRACE_EVENT(JCTL).
++	 * That bit indicates utrace_report_jctl has not run yet and so the
++	 * target cannot be considered quiescent.  But if the bit wasn't
++	 * already set, it can't be in running in there and really is
++	 * quiescent now in its existing job control stop.  We set
++	 * UTRACE_ACTION_QUIESCE to be sure that once it resumes it will
++	 * recompute its flags in utrace_quiescent.
++	 */
++	set_utrace_flags = flags;
++	if (((set_utrace_flags &~ old_utrace_flags) & UTRACE_EVENT(JCTL))
++	    && target->state == TASK_STOPPED) {
++		set_utrace_flags &= ~UTRACE_EVENT(JCTL);
++		set_utrace_flags |= UTRACE_ACTION_QUIESCE;
++	}
++
++	/*
 +	 * When setting these flags, it's essential that we really
 +	 * synchronize with exit_notify.  They cannot be set after
 +	 * exit_notify takes the tasklist_lock.  By holding the read
@@ -969,20 +1085,20 @@
 +	 * knows positively that utrace_report_death will be called or
 +	 * that it won't.
 +	 */
-+	if ((flags &~ old_utrace_flags) & (UTRACE_ACTION_NOREAP
-+					   | DEATH_EVENTS)) {
++	if ((set_utrace_flags &~ old_utrace_flags) & (UTRACE_ACTION_NOREAP
++						      | DEATH_EVENTS)) {
 +		read_lock(&tasklist_lock);
 +		if (unlikely(target->exit_state)) {
 +			read_unlock(&tasklist_lock);
 +			spin_unlock(&utrace->lock);
 +			return ret;
 +		}
-+		target->utrace_flags |= flags;
++		target->utrace_flags |= set_utrace_flags;
 +		read_unlock(&tasklist_lock);
 +	}
 +
 +	engine->flags = flags;
-+	target->utrace_flags |= flags;
++	target->utrace_flags |= set_utrace_flags;
 +	ret = 0;
 +
 +	report = 0;
@@ -1104,10 +1220,20 @@
 +	return ret;
 +}
 +
-+#define REPORT(callback, ...) do { \
-+	u32 ret = (*rcu_dereference(engine->ops)->callback) \
-+		(engine, tsk, ##__VA_ARGS__); \
-+	action = update_action(tsk, utrace, engine, ret); \
++/*
++ * This macro is always used after checking engine->flags.
++ * The smp_rmb() here pairs with smp_wmb() in utrace_detach.
++ * engine->ops changes before engine->flags, so the flags we
++ * just tested properly enabled this report for the real ops,
++ * or harmlessly enabled it for dead_engine_ops.
++ */
++#define REPORT(callback, ...)						\
++	do {								\
++		u32 ret;						\
++		smp_rmb();						\
++		ret = (*rcu_dereference(engine->ops)->callback)		\
++			(engine, tsk, ##__VA_ARGS__);			\
++		action = update_action(tsk, utrace, engine, ret);	\
 +	} while (0)
 +
 +
@@ -1145,9 +1271,11 @@
 +		 * This must be current to be sure it's not possibly
 +		 * getting into utrace_report_death.
 +		 */
++		struct utrace *utrace;
 +		BUG_ON(tsk != current);
-+		spin_lock(&tsk->utrace->lock);
-+		action = remove_detached(tsk, tsk->utrace, action, ~0UL);
++		utrace = tsk->utrace;
++		spin_lock(&utrace->lock);
++		action = remove_detached(tsk, utrace, action, ~0UL);
 +	}
 +	return action;
 +}
@@ -1251,6 +1379,18 @@
 +		spin_unlock_irq(&tsk->sighand->siglock);
 +	}
 +
++	/*
++	 * We clear the UTRACE_EVENT(JCTL) bit to indicate that we are now
++	 * in a truly quiescent TASK_STOPPED state.  After this, we can be
++	 * detached by another thread.  Setting UTRACE_ACTION_QUIESCE
++	 * ensures that we will go through utrace_quiescent and recompute
++	 * flags after we resume.
++	 */
++	spin_lock(&utrace->lock);
++	tsk->utrace_flags &= ~UTRACE_EVENT(JCTL);
++	tsk->utrace_flags |= UTRACE_ACTION_QUIESCE;
++	spin_unlock(&utrace->lock);
++
 +	return action & UTRACE_JCTL_NOSIGCHLD;
 +}
 +
@@ -1630,6 +1770,7 @@
 +	struct list_head *pos, *next;
 +	struct utrace_attached_engine *engine;
 +	unsigned long action, ev;
++	int killed;
 +
 +/*
 +  XXX pass syscall # to engine hook directly, let it return inhibit-action
@@ -1653,12 +1794,32 @@
 +			break;
 +	}
 +	action = check_detach(tsk, action);
-+	if (unlikely(check_quiescent(tsk, action)) && !is_exit)
++	killed = check_quiescent(tsk, action);
++
++	if (!is_exit) {
++		if (unlikely(killed))
++			/*
++			 * We are continuing despite QUIESCE because of a
++			 * SIGKILL.  Don't let the system call actually
++			 * proceed.
++			 */
++			tracehook_abort_syscall(regs);
++
 +		/*
-+		 * We are continuing despite QUIESCE because of a SIGKILL.
-+		 * Don't let the system call actually proceed.
++		 * Clear TIF_SIGPENDING if it no longer needs to be set.
++		 * It may have been set as part of quiescence, and won't
++		 * ever have been cleared by another thread.  For other
++		 * reports, we can just leave it set and will go through
++		 * utrace_get_signal to reset things.  But here we are
++		 * about to enter a syscall, which might bail out with an
++		 * -ERESTART* error if it's set now.
 +		 */
-+		tracehook_abort_syscall(regs);
++		if (signal_pending(tsk)) {
++			spin_lock_irq(&tsk->sighand->siglock);
++			recalc_sigpending();
++			spin_unlock_irq(&tsk->sighand->siglock);
++		}
++	}
 +}
 +
 +
@@ -1726,12 +1887,50 @@
 +	__releases(tsk->sighand->siglock)
 +	__acquires(tsk->sighand->siglock)
 +{
-+	struct utrace *utrace = tsk->utrace;
++	struct utrace *utrace;
 +	struct utrace_signal signal = { info, return_ka, 0 };
 +	struct k_sigaction *ka;
 +	unsigned long action, event;
 +
 +	/*
++	 * We could have been considered quiescent while we were in
++	 * TASK_STOPPED, and detached asynchronously.  If we woke up
++	 * and checked tsk->utrace_flags before that was finished,
++	 * we might be here with utrace already removed or in the
++	 * middle of being removed.
++	 */
++	rcu_read_lock();
++	utrace = rcu_dereference(tsk->utrace);
++	if (unlikely(utrace == NULL)) {
++		rcu_read_unlock();
++		return 0;
++	}
++	if (!(tsk->utrace_flags & UTRACE_EVENT(JCTL))) {
++		/*
++		 * It's possible we might have just been in TASK_STOPPED
++		 * and subject to the aforementioned race.
++		 *
++		 * RCU makes it safe to get the utrace->lock even if it's
++		 * being freed.  Once we have that lock, either an external
++		 * detach has finished and this struct has been freed, or
++		 * else we know we are excluding any other detach attempt.
++		 * Since we are no longer in TASK_STOPPED now, all we
++		 * needed the lock for was to order any quiesce() call after us.
++		 */
++		spin_unlock_irq(&tsk->sighand->siglock);
++		spin_lock(&utrace->lock);
++		if (unlikely(tsk->utrace != utrace)) {
++			spin_unlock(&utrace->lock);
++			rcu_read_unlock();
++			cond_resched();
++			return -1;
++		}
++		spin_unlock(&utrace->lock);
++		spin_lock_irq(&tsk->sighand->siglock);
++	}
++	rcu_read_unlock();
++
++	/*
 +	 * If a signal was injected previously, it could not use our
 +	 * stack space directly.  It had to allocate a data structure,
 +	 * which we can now copy out of and free.
@@ -1805,13 +2004,28 @@
 +	 */
 +	if (signal.signr != 0) {
 +		if (signal.return_ka == NULL) {
-+			ka = &tsk->sighand->action[signal.signr - 1];
++			/*
++			 * utrace_inject_signal recorded this to have us
++			 * use the injected signal's normal sigaction.  We
++			 * have to perform the SA_ONESHOT work now because
++			 * our caller will never touch the real sigaction.
++			 */
++			ka = &tsk->sighand->action[info->si_signo - 1];
++			*return_ka = *ka;
 +			if (ka->sa.sa_flags & SA_ONESHOT)
 +				ka->sa.sa_handler = SIG_DFL;
-+			*return_ka = *ka;
 +		}
 +		else
 +			BUG_ON(signal.return_ka != return_ka);
++
++		/*
++		 * We already processed the SA_ONESHOT work ahead of time.
++		 * Once we return nonzero, our caller will only refer to
++		 * return_ka.  So we must clear the flag to be sure it
++		 * doesn't clear return_ka->sa.sa_handler.
++		 */
++		return_ka->sa.sa_flags &= ~SA_ONESHOT;
++
 +		return signal.signr;
 +	}
 +
@@ -2192,10 +2406,8 @@
 +
 +	return unsafe;
 +}
-Index: b/Documentation/utrace.txt
-===================================================================
---- /dev/null
-+++ b/Documentation/utrace.txt
+--- linux-2.6/Documentation/utrace.txt
++++ linux-2.6/Documentation/utrace.txt
 @@ -0,0 +1,579 @@
 +DRAFT DRAFT DRAFT	WORK IN PROGRESS	DRAFT DRAFT DRAFT
 +
@@ -2776,10 +2988,8 @@
 +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.
-Index: b/Documentation/DocBook/Makefile
-===================================================================
---- a/Documentation/DocBook/Makefile
-+++ b/Documentation/DocBook/Makefile
+--- linux-2.6/Documentation/DocBook/Makefile
++++ linux-2.6/Documentation/DocBook/Makefile
 @@ -9,7 +9,7 @@
  DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
  	    kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
@@ -2787,12 +2997,10 @@
 -	    kernel-api.xml filesystems.xml lsm.xml usb.xml \
 +	    kernel-api.xml filesystems.xml lsm.xml utrace.xml usb.xml \
  	    gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
- 	    genericirq.xml
+ 	    genericirq.xml s390-drivers.xml uio-howto.xml
  
-Index: b/Documentation/DocBook/utrace.tmpl
-===================================================================
---- /dev/null
-+++ b/Documentation/DocBook/utrace.tmpl
+--- linux-2.6/Documentation/DocBook/utrace.tmpl
++++ linux-2.6/Documentation/DocBook/utrace.tmpl
 @@ -0,0 +1,23 @@
 +<?xml version="1.0" encoding="UTF-8"?>
 +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
@@ -2817,10 +3025,8 @@
 +    </chapter>
 +
 +</book>
-Index: b/include/linux/tracehook.h
-===================================================================
---- a/include/linux/tracehook.h
-+++ b/include/linux/tracehook.h
+--- linux-2.6/include/linux/tracehook.h
++++ linux-2.6/include/linux/tracehook.h
 @@ -28,6 +28,7 @@
  
  #include <linux/sched.h>
@@ -2829,7 +3035,7 @@
  struct linux_binprm;
  struct pt_regs;
  
-@@ -342,6 +343,7 @@ utrace_regset_copyin_ignore(unsigned int
+@@ -353,6 +354,7 @@ utrace_regset_copyin_ignore(unsigned int
   */
  static inline void tracehook_init_task(struct task_struct *child)
  {
@@ -2837,7 +3043,7 @@
  }
  
  /*
-@@ -350,6 +352,9 @@ static inline void tracehook_init_task(s
+@@ -361,6 +363,9 @@ static inline void tracehook_init_task(s
   */
  static inline void tracehook_release_task(struct task_struct *p)
  {
@@ -2847,7 +3053,7 @@
  }
  
  /*
-@@ -360,7 +365,20 @@ static inline void tracehook_release_tas
+@@ -370,7 +375,20 @@ static inline void tracehook_release_tas
   */
  static inline int tracehook_check_released(struct task_struct *p)
  {
@@ -2869,7 +3075,7 @@
  }
  
  /*
-@@ -371,7 +389,7 @@ static inline int tracehook_check_releas
+@@ -381,7 +399,7 @@ static inline int tracehook_check_releas
  static inline int tracehook_notify_cldstop(struct task_struct *tsk,
  					   const siginfo_t *info)
  {
@@ -2878,7 +3084,7 @@
  }
  
  /*
-@@ -385,7 +403,11 @@ static inline int tracehook_notify_cldst
+@@ -395,7 +413,11 @@ static inline int tracehook_notify_cldst
  static inline int tracehook_notify_death(struct task_struct *tsk,
  					 int *noreap, void **death_cookie)
  {
@@ -2891,7 +3097,7 @@
  	*noreap = 0;
  	return 0;
  }
-@@ -398,7 +420,8 @@ static inline int tracehook_notify_death
+@@ -408,7 +430,8 @@ static inline int tracehook_notify_death
  static inline int tracehook_consider_fatal_signal(struct task_struct *tsk,
  						  int sig)
  {
@@ -2901,7 +3107,7 @@
  }
  
  /*
-@@ -411,7 +434,7 @@ static inline int tracehook_consider_ign
+@@ -421,7 +444,7 @@ static inline int tracehook_consider_ign
  						    int sig,
  						    void __user *handler)
  {
@@ -2910,7 +3116,7 @@
  }
  
  
-@@ -422,7 +445,7 @@ static inline int tracehook_consider_ign
+@@ -432,7 +455,7 @@ static inline int tracehook_consider_ign
   */
  static inline int tracehook_induce_sigpending(struct task_struct *tsk)
  {
@@ -2919,7 +3125,7 @@
  }
  
  /*
-@@ -437,6 +460,8 @@ static inline int tracehook_get_signal(s
+@@ -447,6 +470,8 @@ static inline int tracehook_get_signal(s
  				       siginfo_t *info,
  				       struct k_sigaction *return_ka)
  {
@@ -2928,7 +3134,7 @@
  	return 0;
  }
  
-@@ -449,6 +474,8 @@ static inline int tracehook_get_signal(s
+@@ -459,6 +484,8 @@ static inline int tracehook_get_signal(s
   */
  static inline int tracehook_finish_stop(int last_one)
  {
@@ -2937,7 +3143,7 @@
  	return 0;
  }
  
-@@ -460,7 +487,7 @@ static inline int tracehook_finish_stop(
+@@ -470,7 +497,7 @@ static inline int tracehook_finish_stop(
   */
  static inline int tracehook_inhibit_wait_stopped(struct task_struct *child)
  {
@@ -2946,7 +3152,7 @@
  }
  
  /*
-@@ -470,7 +497,7 @@ static inline int tracehook_inhibit_wait
+@@ -480,7 +507,7 @@ static inline int tracehook_inhibit_wait
   */
  static inline int tracehook_inhibit_wait_zombie(struct task_struct *child)
  {
@@ -2955,7 +3161,7 @@
  }
  
  /*
-@@ -480,7 +507,7 @@ static inline int tracehook_inhibit_wait
+@@ -490,7 +517,7 @@ static inline int tracehook_inhibit_wait
   */
  static inline int tracehook_inhibit_wait_continued(struct task_struct *child)
  {
@@ -2964,7 +3170,7 @@
  }
  
  
-@@ -490,13 +517,9 @@ static inline int tracehook_inhibit_wait
+@@ -500,13 +527,9 @@ static inline int tracehook_inhibit_wait
   */
  static inline int tracehook_unsafe_exec(struct task_struct *tsk)
  {
@@ -2980,7 +3186,7 @@
  }
  
  /*
-@@ -511,6 +534,8 @@ static inline int tracehook_unsafe_exec(
+@@ -521,6 +544,8 @@ static inline int tracehook_unsafe_exec(
   */
  static inline struct task_struct *tracehook_tracer_task(struct task_struct *p)
  {
@@ -2989,7 +3195,7 @@
  	return NULL;
  }
  
-@@ -522,6 +547,8 @@ static inline int tracehook_allow_access
+@@ -532,6 +557,8 @@ static inline int tracehook_allow_access
  {
  	if (tsk == current)
  		return 1;
@@ -2998,7 +3204,7 @@
  	return 0;
  }
  
-@@ -533,7 +560,7 @@ static inline int tracehook_allow_access
+@@ -543,7 +570,7 @@ static inline int tracehook_allow_access
   */
  static inline int tracehook_expect_breakpoints(struct task_struct *tsk)
  {
@@ -3007,18 +3213,18 @@
  }
  
  
-@@ -556,6 +583,10 @@ static inline int tracehook_expect_break
+@@ -566,6 +593,10 @@ static inline int tracehook_expect_break
  static inline void tracehook_report_death(struct task_struct *tsk,
  					  int exit_state, void *death_cookie)
  {
 +	smp_mb();
 +	if (tsk_utrace_flags(tsk) & (UTRACE_EVENT(DEATH)
-+				     | UTRACE_ACTION_QUIESCE))
++				     | UTRACE_EVENT(QUIESCE)))
 +		utrace_report_death(tsk, death_cookie);
  }
  
  /*
-@@ -565,14 +596,18 @@ static inline void tracehook_report_deat
+@@ -575,14 +606,18 @@ static inline void tracehook_report_deat
   */
  static inline void tracehook_report_delayed_group_leader(struct task_struct *p)
  {
@@ -3038,7 +3244,7 @@
  }
  
  /*
-@@ -581,6 +616,8 @@ static inline void tracehook_report_exec
+@@ -591,6 +626,8 @@ static inline void tracehook_report_exec
   */
  static inline void tracehook_report_exit(long *exit_code)
  {
@@ -3047,7 +3253,7 @@
  }
  
  /*
-@@ -595,6 +632,8 @@ static inline void tracehook_report_exit
+@@ -605,6 +642,8 @@ static inline void tracehook_report_exit
  static inline void tracehook_report_clone(unsigned long clone_flags,
  					  struct task_struct *child)
  {
@@ -3056,7 +3262,7 @@
  }
  
  /*
-@@ -608,6 +647,8 @@ static inline void tracehook_report_clon
+@@ -618,6 +657,8 @@ static inline void tracehook_report_clon
  						   pid_t pid,
  						   struct task_struct *child)
  {
@@ -3065,7 +3271,7 @@
  }
  
  /*
-@@ -619,6 +660,8 @@ static inline void tracehook_report_clon
+@@ -629,6 +670,8 @@ static inline void tracehook_report_clon
  static inline void tracehook_report_vfork_done(struct task_struct *child,
  					       pid_t child_pid)
  {
@@ -3074,7 +3280,7 @@
  }
  
  /*
-@@ -626,6 +669,9 @@ static inline void tracehook_report_vfor
+@@ -636,6 +679,9 @@ static inline void tracehook_report_vfor
   */
  static inline void tracehook_report_syscall(struct pt_regs *regs, int is_exit)
  {
@@ -3084,7 +3290,7 @@
  }
  
  /*
-@@ -645,6 +691,11 @@ static inline void tracehook_report_hand
+@@ -655,6 +701,11 @@ static inline void tracehook_report_hand
  						  const sigset_t *oldset,
  						  struct pt_regs *regs)
  {
@@ -3096,10 +3302,8 @@
  }
  
  
-Index: b/include/linux/utrace.h
-===================================================================
---- /dev/null
-+++ b/include/linux/utrace.h
+--- linux-2.6/include/linux/utrace.h
++++ linux-2.6/include/linux/utrace.h
 @@ -0,0 +1,544 @@
 +/*
 + * utrace infrastructure interface for debugging user processes
@@ -3645,11 +3849,9 @@
 +#endif  /* CONFIG_UTRACE */
 +
 +#endif	/* linux/utrace.h */
-Index: b/include/linux/sched.h
-===================================================================
---- a/include/linux/sched.h
-+++ b/include/linux/sched.h
-@@ -941,6 +941,11 @@ struct task_struct {
+--- linux-2.6/include/linux/sched.h
++++ linux-2.6/include/linux/sched.h
+@@ -1064,6 +1064,11 @@ struct task_struct {
  	struct audit_context *audit_context;
  	seccomp_t seccomp;
  
@@ -3661,14 +3863,13 @@
  /* Thread group tracking */
     	u32 parent_exec_id;
     	u32 self_exec_id;
-Index: b/init/Kconfig
-===================================================================
---- a/init/Kconfig
-+++ b/init/Kconfig
-@@ -595,6 +595,24 @@ config STOP_MACHINE
- 	  Need stop_machine() primitive.
- endmenu
+--- linux-2.6/init/Kconfig
++++ linux-2.6/init/Kconfig
+@@ -762,3 +762,21 @@ source "block/Kconfig"
  
+ config PREEMPT_NOTIFIERS
+ 	bool
++
 +menu "Process debugging support"
 +
 +config UTRACE
@@ -3686,7 +3887,3 @@
 +	  kernel and are very sure you don't need these facilitiies,
 +	  say Y.
 +endmenu
-+
- menu "Block layer"
- source "block/Kconfig"
- endmenu

linux-2.6-utrace-ptrace-compat-ia64.patch:

Index: linux-2.6-utrace-ptrace-compat-ia64.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-ptrace-compat-ia64.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-ptrace-compat-ia64.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-ptrace-compat-ia64.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -8,15 +8,13 @@
 
 ---
 
- arch/ia64/ia32/sys_ia32.c |   40 +
- arch/ia64/kernel/ptrace.c | 1016 +++++-----------------------------------------
- 2 files changed, 159 insertions(+), 897 deletions(-)
+ arch/ia64/ia32/sys_ia32.c |   40 ++
+ arch/ia64/kernel/ptrace.c | 1019 +++++----------------------------------------
+ 2 files changed, 159 insertions(+), 900 deletions(-)
 
-Index: b/arch/ia64/ia32/sys_ia32.c
-===================================================================
---- a/arch/ia64/ia32/sys_ia32.c
-+++ b/arch/ia64/ia32/sys_ia32.c
-@@ -2340,6 +2340,46 @@ const struct utrace_regset_view utrace_i
+--- linux-2.6/arch/ia64/ia32/sys_ia32.c
++++ linux-2.6/arch/ia64/ia32/sys_ia32.c
+@@ -2344,6 +2344,46 @@ const struct utrace_regset_view utrace_i
  };
  #endif
  
@@ -63,10 +61,8 @@
  typedef struct {
  	unsigned int	ss_sp;
  	unsigned int	ss_flags;
-Index: b/arch/ia64/kernel/ptrace.c
-===================================================================
---- a/arch/ia64/kernel/ptrace.c
-+++ b/arch/ia64/kernel/ptrace.c
+--- linux-2.6/arch/ia64/kernel/ptrace.c
++++ linux-2.6/arch/ia64/kernel/ptrace.c
 @@ -554,81 +554,6 @@ ia64_sync_user_rbs (struct task_struct *
  	return 0;
  }
@@ -149,7 +145,7 @@
  /*
   * Write f32-f127 back to task->thread.fph if it has been modified.
   */
-@@ -792,828 +717,6 @@ access_nat_bits (struct task_struct *chi
+@@ -792,831 +717,6 @@ access_nat_bits (struct task_struct *chi
  	return 0;
  }
  
@@ -324,10 +320,14 @@
 -			return 0;
 -
 -		      case PT_CR_IPSR:
--			if (write_access)
--				pt->cr_ipsr = ((*data & IPSR_MASK)
+-			if (write_access) {
+-				unsigned long tmp = *data;
+-				/* psr.ri==3 is a reserved value: SDM 2:25 */
+-				if ((tmp & IA64_PSR_RI) == IA64_PSR_RI)
+-					tmp &= ~IA64_PSR_RI;
+-				pt->cr_ipsr = ((tmp & IPSR_MASK)
 -					       | (pt->cr_ipsr & ~IPSR_MASK));
--			else
+-			} else
 -				*data = (pt->cr_ipsr & IPSR_MASK);
 -			return 0;
 -
@@ -950,7 +950,6 @@
 -
 -	      case PTRACE_DETACH:
 -		/* detach a process that was attached. */
--		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
 -		ret = ptrace_detach(child, data);
 -		goto out_tsk;
 -
@@ -978,7 +977,7 @@
  
  /* "asmlinkage" so the input arguments are preserved... */
  
-@@ -1667,6 +770,9 @@ syscall_trace_leave (long arg0, long arg
+@@ -1670,6 +770,9 @@ syscall_trace_leave (long arg0, long arg
  	}
  }
  
@@ -988,7 +987,7 @@
  /* Utrace implementation starts here */
  
  typedef struct utrace_get {
-@@ -2454,3 +1560,119 @@ const struct utrace_regset_view *utrace_
+@@ -2463,3 +1566,119 @@ const struct utrace_regset_view *utrace_
  #endif
  	return &utrace_ia64_native;
  }

linux-2.6-utrace-ptrace-compat-s390.patch:

Index: linux-2.6-utrace-ptrace-compat-s390.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-ptrace-compat-s390.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-ptrace-compat-s390.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-ptrace-compat-s390.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -7,15 +7,13 @@
 
 ---
 
+ arch/s390/kernel/ptrace.c         |  155 +++++++++++++++++++++++++++++++++++++
  arch/s390/kernel/compat_wrapper.S |    2 
- arch/s390/kernel/ptrace.c         |  151 ++++++++++++++++++++++++++++++++++++++
- 2 files changed, 152 insertions(+), 1 deletion(-)
+ 2 files changed, 156 insertions(+), 1 deletions(-)
 
-Index: b/arch/s390/kernel/ptrace.c
-===================================================================
---- a/arch/s390/kernel/ptrace.c
-+++ b/arch/s390/kernel/ptrace.c
-@@ -575,6 +575,157 @@ const struct utrace_regset_view *utrace_
+--- linux-2.6/arch/s390/kernel/ptrace.c
++++ linux-2.6/arch/s390/kernel/ptrace.c
+@@ -595,6 +595,161 @@ const struct utrace_regset_view *utrace_
  }
  
  
@@ -124,11 +122,15 @@
 +
 +#ifdef CONFIG_COMPAT
 +static const struct ptrace_layout_segment s390_compat_uarea[] = {
-+	{PT_PSWMASK / 2, PT_FPC / 2, 0, 0},
-+	{PT_FPC / 2, PT_CR_9 / 2, 1, 0},
-+	{PT_CR_9 / 2, PT_IEEE_IP / 2, 2, 0},
-+	{PT_IEEE_IP / 2, sizeof(struct user32), -1, -1},
-+	{0, 0, -1, 0}
++	{ offsetof(struct user_regs_struct32, psw),
++	  offsetof(struct user_regs_struct32, fp_regs), 0, 0 },
++	{ offsetof(struct user_regs_struct32, fp_regs),
++	  offsetof(struct user_regs_struct32, per_info), 1, 0 },
++	{ offsetof(struct user_regs_struct32, per_info),
++	  offsetof(struct user_regs_struct32, ieee_instruction_pointer), 2, 0 },
++	{ offsetof(struct user_regs_struct32, ieee_instruction_pointer),
++	  sizeof(struct user32), -1, -1 },
++	{ 0, 0, -1, 0 }
 +};
 +
 +int arch_compat_ptrace(compat_long_t *request,
@@ -173,10 +175,8 @@
  asmlinkage void
  syscall_trace(struct pt_regs *regs, int entryexit)
  {
-Index: b/arch/s390/kernel/compat_wrapper.S
-===================================================================
---- a/arch/s390/kernel/compat_wrapper.S
-+++ b/arch/s390/kernel/compat_wrapper.S
+--- linux-2.6/arch/s390/kernel/compat_wrapper.S
++++ linux-2.6/arch/s390/kernel/compat_wrapper.S
 @@ -121,7 +121,7 @@ sys32_ptrace_wrapper:
  	lgfr	%r3,%r3			# long
  	llgtr	%r4,%r4			# long

linux-2.6-utrace-ptrace-compat-sparc64.patch:

Index: linux-2.6-utrace-ptrace-compat-sparc64.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-ptrace-compat-sparc64.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-ptrace-compat-sparc64.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-ptrace-compat-sparc64.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -7,14 +7,12 @@
 
 ---
 
- arch/sparc64/kernel/ptrace.c |  566 +++++++------------------------------------
- 1 file changed, 100 insertions(+), 466 deletions(-)
+ arch/sparc64/kernel/ptrace.c |  566 +++++++-----------------------------------
+ 1 files changed, 100 insertions(+), 466 deletions(-)
 
-Index: b/arch/sparc64/kernel/ptrace.c
-===================================================================
---- a/arch/sparc64/kernel/ptrace.c
-+++ b/arch/sparc64/kernel/ptrace.c
-@@ -667,484 +667,118 @@ void flush_ptrace_access(struct vm_area_
+--- linux-2.6/arch/sparc64/kernel/ptrace.c
++++ linux-2.6/arch/sparc64/kernel/ptrace.c
+@@ -671,484 +671,118 @@ void flush_ptrace_access(struct vm_area_
  	}
  }
  

linux-2.6-utrace-ptrace-compat.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.2.8.1 linux-2.6-utrace-ptrace-compat.patch
Index: linux-2.6-utrace-ptrace-compat.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-ptrace-compat.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-ptrace-compat.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-ptrace-compat.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -12,31 +12,31 @@
 
 ---
 
- arch/i386/kernel/ptrace.c       |   40 
- arch/powerpc/kernel/ptrace.c    |  250 ++++
+ fs/proc/base.c                  |   40 +
+ arch/powerpc/kernel/ptrace.c    |  454 +++++----
  arch/powerpc/kernel/signal_32.c |   52 +
+ arch/powerpc/kernel/Makefile    |    2 
+ arch/powerpc/kernel/ptrace32.c  |  416 --------
  arch/powerpc/lib/sstep.c        |    3 
- arch/x86_64/ia32/ia32entry.S    |    2 
- arch/x86_64/ia32/ptrace32.c     |   56 -
- arch/x86_64/kernel/ptrace.c     |   46 
- fs/proc/base.c                  |   40 
- include/asm-x86_64/ptrace-abi.h |    3 
- include/asm-x86_64/tracehook.h  |    1 
- include/linux/ptrace.h          |  221 +++-
- include/linux/sched.h           |    4 
- init/Kconfig                    |   15 
- kernel/Makefile                 |    3 
- kernel/exit.c                   |   13 
+ arch/x86/ia32/ptrace32.c        |   57 +
+ arch/x86/ia32/ia32entry.S       |    2 
+ arch/x86/kernel/ptrace_64.c     |   46 +
+ arch/x86/kernel/ptrace_32.c     |   40 +
  kernel/fork.c                   |    2 
- kernel/ptrace.c                 | 2046 +++++++++++++++++++++++++++++++++++++---
+ kernel/exit.c                   |   13 
+ kernel/ptrace.c                 | 2061 +++++++++++++++++++++++++++++++++++++--
  kernel/sys_ni.c                 |    4 
- 18 files changed, 2627 insertions(+), 174 deletions(-)
+ kernel/Makefile                 |    3 
+ include/linux/sched.h           |    4 
+ include/linux/ptrace.h          |  222 +++-
+ include/asm-x86/ptrace-abi.h    |    6 
+ init/Kconfig                    |   15 
+ 19 files changed, 2650 insertions(+), 792 deletions(-)
+ delete arch/powerpc/kernel/ptrace32.c
 
-Index: b/fs/proc/base.c
-===================================================================
---- a/fs/proc/base.c
-+++ b/fs/proc/base.c
-@@ -148,6 +148,46 @@ static int get_nr_threads(struct task_st
+--- linux-2.6/fs/proc/base.c
++++ linux-2.6/fs/proc/base.c
+@@ -154,6 +154,46 @@ static int get_nr_threads(struct task_st
  	return count;
  }
  
@@ -63,7 +63,7 @@
 +		return -EPERM;
 +	smp_rmb();
 +	if (task->mm)
-+		dumpable = task->mm->dumpable;
++		dumpable = get_dumpable(task->mm);
 +	if (!dumpable && !capable(CAP_SYS_PTRACE))
 +		return -EPERM;
 +
@@ -83,221 +83,74 @@
  static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
  {
  	struct task_struct *task = get_proc_task(inode);
-Index: b/arch/i386/kernel/ptrace.c
-===================================================================
---- a/arch/i386/kernel/ptrace.c
-+++ b/arch/i386/kernel/ptrace.c
-@@ -736,6 +736,46 @@ const struct utrace_regset_view *utrace_
- 	return &utrace_i386_native;
+--- linux-2.6/arch/powerpc/kernel/ptrace.c
++++ linux-2.6/arch/powerpc/kernel/ptrace.c
+@@ -590,248 +590,320 @@ const struct utrace_regset_view *utrace_
  }
  
-+#ifdef CONFIG_PTRACE
-+static const struct ptrace_layout_segment i386_uarea[] = {
-+	{0, FRAME_SIZE*4, 0, 0},
-+	{FRAME_SIZE*4, offsetof(struct user, u_debugreg[0]), -1, 0},
-+	{offsetof(struct user, u_debugreg[0]),
-+	 offsetof(struct user, u_debugreg[8]), 4, 0},
-+	{0, 0, -1, 0}
-+};
-+
-+int arch_ptrace(long *req, struct task_struct *child,
-+		struct utrace_attached_engine *engine,
-+		unsigned long addr, unsigned long data, long *val)
-+{
-+	switch (*req) {
-+	case PTRACE_PEEKUSR:
-+		return ptrace_peekusr(child, engine, i386_uarea, addr, data);
-+	case PTRACE_POKEUSR:
-+		return ptrace_pokeusr(child, engine, i386_uarea, addr, data);
-+	case PTRACE_GETREGS:
-+		return ptrace_whole_regset(child, engine, data, 0, 0);
-+	case PTRACE_SETREGS:
-+		return ptrace_whole_regset(child, engine, data, 0, 1);
-+	case PTRACE_GETFPREGS:
-+		return ptrace_whole_regset(child, engine, data, 1, 0);
-+	case PTRACE_SETFPREGS:
-+		return ptrace_whole_regset(child, engine, data, 1, 1);
-+	case PTRACE_GETFPXREGS:
-+		return ptrace_whole_regset(child, engine, data, 2, 0);
-+	case PTRACE_SETFPXREGS:
-+		return ptrace_whole_regset(child, engine, data, 2, 1);
-+	case PTRACE_GET_THREAD_AREA:
-+	case PTRACE_SET_THREAD_AREA:
-+		return ptrace_onereg_access(child, engine,
-+					    utrace_native_view(current), 3,
-+					    addr, (void __user *)data,
-+					    *req == PTRACE_SET_THREAD_AREA);
-+	}
-+	return -ENOSYS;
-+}
-+#endif
  
- void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
++#ifdef CONFIG_PTRACE
+ /*
+  * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
+  * we mark them as obsolete now, they will be removed in a future version
+  */
+-static long arch_ptrace_old(struct task_struct *child, long request, long addr,
+-			    long data)
++static int arch_ptrace_old(long *request, struct task_struct *child,
++			   struct utrace_attached_engine *engine,
++			   unsigned long addr, unsigned long data, long *val)
  {
-Index: b/arch/x86_64/ia32/ptrace32.c
-===================================================================
---- a/arch/x86_64/ia32/ptrace32.c
-+++ b/arch/x86_64/ia32/ptrace32.c
-@@ -166,11 +166,6 @@ static int getreg32(struct task_struct *
- 
- #undef R32
- 
--asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
--{
--	return -ENOSYS;
--}
+-	int ret = -EPERM;
 -
- static int
- ia32_genregs_get(struct task_struct *target,
- 		 const struct utrace_regset *regset,
-@@ -600,3 +595,54 @@ const struct utrace_regset_view utrace_i
- 	.name = "i386", .e_machine = EM_386,
- 	.regsets = ia32_regsets, .n = ARRAY_SIZE(ia32_regsets)
- };
-+
-+
-+#ifdef CONFIG_PTRACE
-+/*
-+ * This matches the arch/i386/kernel/ptrace.c definitions.
-+ */
-+
-+static const struct ptrace_layout_segment ia32_uarea[] = {
-+	{0, sizeof(struct user_regs_struct32), 0, 0},
-+	{sizeof(struct user_regs_struct32),
-+	 offsetof(struct user32, u_debugreg[0]), -1, 0},
-+	{offsetof(struct user32, u_debugreg[0]),
-+	 offsetof(struct user32, u_debugreg[8]), 4, 0},
-+	{0, 0, -1, 0}
-+};
-+
-+int arch_compat_ptrace(compat_long_t *req, struct task_struct *child,
-+		       struct utrace_attached_engine *engine,
-+		       compat_ulong_t addr, compat_ulong_t data,
-+		       compat_long_t *val)
-+{
-+	switch (*req) {
-+	case PTRACE_PEEKUSR:
-+		return ptrace_compat_peekusr(child, engine, ia32_uarea,
-+					     addr, data);
-+	case PTRACE_POKEUSR:
-+		return ptrace_compat_pokeusr(child, engine, ia32_uarea,
-+					     addr, data);
-+	case PTRACE_GETREGS:
-+		return ptrace_whole_regset(child, engine, data, 0, 0);
-+	case PTRACE_SETREGS:
-+		return ptrace_whole_regset(child, engine, data, 0, 1);
-+	case PTRACE_GETFPREGS:
-+		return ptrace_whole_regset(child, engine, data, 1, 0);
-+	case PTRACE_SETFPREGS:
-+		return ptrace_whole_regset(child, engine, data, 1, 1);
-+	case PTRACE_GETFPXREGS:
-+		return ptrace_whole_regset(child, engine, data, 2, 0);
-+	case PTRACE_SETFPXREGS:
-+		return ptrace_whole_regset(child, engine, data, 2, 1);
-+	case PTRACE_GET_THREAD_AREA:
-+	case PTRACE_SET_THREAD_AREA:
[...2275 lines suppressed...]
+-	if (copied != sizeof(tmp))
+-		return -EIO;
+-	return put_user(tmp, (unsigned long __user *)data);
 +static u32
 +ptrace_report_exit(struct utrace_attached_engine *engine,
 +		   struct task_struct *tsk, long orig_code, long *code)
@@ -2757,18 +3441,22 @@
 +	END_CHECK;
 +
 +	return parent;
-+}
-+
+ }
+ 
+-int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data)
 +static int
 +ptrace_allow_access_process_vm(struct utrace_attached_engine *engine,
 +			       struct task_struct *target,
 +			       struct task_struct *caller)
-+{
+ {
+-	int copied;
 +	struct ptrace_state *state;
 +	int ours = 0;
 +
 +	START_CHECK;
-+
+ 
+-	copied = access_process_vm(tsk, addr, &data, sizeof(data), 1);
+-	return (copied == sizeof(data)) ? 0 : -EIO;
 +	state = get_ptrace_state(engine, target);
 +	if (likely(state != NULL)) {
 +		ours = (((engine->flags & UTRACE_ACTION_QUIESCE)
@@ -2783,7 +3471,7 @@
 +	END_CHECK;
 +
 +	return ours;
-+}
+ }
 +
 +
 +static const struct utrace_engine_ops ptrace_utrace_ops =
@@ -2802,11 +3490,9 @@
 +	.tracer_task = ptrace_tracer_task,
 +	.allow_access_process_vm = ptrace_allow_access_process_vm,
 +};
-Index: b/kernel/sys_ni.c
-===================================================================
---- a/kernel/sys_ni.c
-+++ b/kernel/sys_ni.c
-@@ -113,6 +113,10 @@ cond_syscall(sys_vm86);
+--- linux-2.6/kernel/sys_ni.c
++++ linux-2.6/kernel/sys_ni.c
+@@ -122,6 +122,10 @@ cond_syscall(sys_vm86);
  cond_syscall(compat_sys_ipc);
  cond_syscall(compat_sys_sysctl);
  
@@ -2817,32 +3503,28 @@
  /* arch-specific weak syscall entries */
  cond_syscall(sys_pciconfig_read);
  cond_syscall(sys_pciconfig_write);
-Index: b/kernel/Makefile
-===================================================================
---- a/kernel/Makefile
-+++ b/kernel/Makefile
+--- linux-2.6/kernel/Makefile
++++ linux-2.6/kernel/Makefile
 @@ -4,7 +4,7 @@
  
  obj-y     = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
  	    exit.o itimer.o time.o softirq.o resource.o \
--	    sysctl.o capability.o ptrace.o timer.o user.o \
-+	    sysctl.o capability.o timer.o user.o \
+-	    sysctl.o capability.o ptrace.o timer.o user.o user_namespace.o \
++	    sysctl.o capability.o timer.o user.o user_namespace.o \
  	    signal.o sys.o kmod.o workqueue.o pid.o \
  	    rcupdate.o extable.o params.o posix-timers.o \
  	    kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
-@@ -52,6 +52,7 @@ obj-$(CONFIG_UTS_NS) += utsname.o
- obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
+@@ -58,6 +58,7 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayac
  obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
+ obj-$(CONFIG_MARKERS) += marker.o
  obj-$(CONFIG_UTRACE) += utrace.o
 +obj-$(CONFIG_PTRACE) += ptrace.o
  
  ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
  # According to Alan Modra <alan at linuxcare.com.au>, the -fno-omit-frame-pointer is
-Index: b/include/linux/sched.h
-===================================================================
---- a/include/linux/sched.h
-+++ b/include/linux/sched.h
-@@ -1036,6 +1036,10 @@ struct task_struct {
+--- linux-2.6/include/linux/sched.h
++++ linux-2.6/include/linux/sched.h
+@@ -1161,6 +1161,10 @@ struct task_struct {
  	atomic_t fs_excl;	/* holding fs exclusive resources */
  	struct rcu_head rcu;
  
@@ -2853,11 +3535,9 @@
  	/*
  	 * cache last used pipe for splice
  	 */
-Index: b/include/linux/ptrace.h
-===================================================================
---- a/include/linux/ptrace.h
-+++ b/include/linux/ptrace.h
-@@ -49,50 +49,197 @@
+--- linux-2.6/include/linux/ptrace.h
++++ linux-2.6/include/linux/ptrace.h
+@@ -49,49 +49,195 @@
  #include <asm/ptrace.h>
  
  #ifdef __KERNEL__
@@ -2907,8 +3587,9 @@
 -extern int ptrace_check_attach(struct task_struct *task, int kill);
 -extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
  extern int ptrace_may_attach(struct task_struct *task);
- 
- 
+-extern int __ptrace_may_attach(struct task_struct *task);
++
++
 +#ifdef CONFIG_PTRACE
 +#include <asm/tracehook.h>
 +#include <linux/tracehook.h>
@@ -2964,7 +3645,7 @@
 +				struct utrace_attached_engine *engine,
 +				const struct utrace_regset_view *view,
 +				int setno, unsigned long regno,
-+				void __user *data, int write);
++				void __user *udata, void *kdata, int write);
 +
 +
 +/*
@@ -3005,7 +3686,7 @@
 +				    (unsigned long __user *)data, NULL, 0);
 +}
 +
-+/* Convenience wrapper for the common PTRACE_PEEKUSR implementation.  */
++/* Convenience wrapper for the common PTRACE_POKEUSR implementation.  */
 +static inline int ptrace_pokeusr(struct task_struct *child,
 +				 struct utrace_attached_engine *engine,
 +				 const struct ptrace_layout_segment layout[],
@@ -3087,40 +3768,27 @@
 +	return -ECHILD;
 +}
 +#endif	/* CONFIG_PTRACE */
-+
-+
- #ifndef force_successful_syscall_return
- /*
-  * System call handlers that, upon successful completion, need to return a
-Index: b/include/asm-x86_64/tracehook.h
-===================================================================
---- a/include/asm-x86_64/tracehook.h
-+++ b/include/asm-x86_64/tracehook.h
-@@ -15,6 +15,7 @@
- 
- #include <linux/sched.h>
- #include <asm/ptrace.h>
-+#include <asm/proto.h>
- 
- /*
-  * See linux/tracehook.h for the descriptions of what these need to do.
-Index: b/include/asm-x86_64/ptrace-abi.h
-===================================================================
---- a/include/asm-x86_64/ptrace-abi.h
-+++ b/include/asm-x86_64/ptrace-abi.h
-@@ -48,4 +48,7 @@
  
- #define PTRACE_ARCH_PRCTL	  30	/* arch_prctl for child */
+ int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data);
+ int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
+--- linux-2.6/include/asm-x86/ptrace-abi.h
++++ linux-2.6/include/asm-x86/ptrace-abi.h
+@@ -73,9 +73,9 @@
+ 
+ #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
 +
  #endif
-Index: b/init/Kconfig
-===================================================================
---- a/init/Kconfig
-+++ b/init/Kconfig
-@@ -597,10 +597,21 @@ endmenu
+--- linux-2.6/init/Kconfig
++++ linux-2.6/init/Kconfig
+@@ -765,10 +765,21 @@ config PREEMPT_NOTIFIERS
  
  menu "Process debugging support"
  

linux-2.6-utrace-regset-ia64.patch:

Index: linux-2.6-utrace-regset-ia64.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-regset-ia64.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-regset-ia64.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-regset-ia64.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -9,17 +9,15 @@
 
 ---
 
- arch/ia64/ia32/sys_ia32.c    |  472 +++++++++++++++++++++++++
- arch/ia64/kernel/ptrace.c    |  804 +++++++++++++++++++++++++++++++++++++++++++
- include/asm-ia64/elf.h       |   24 +
+ arch/ia64/ia32/sys_ia32.c    |  476 +++++++++++++++++++++++++
+ arch/ia64/kernel/ptrace.c    |  810 ++++++++++++++++++++++++++++++++++++++++++
  include/asm-ia64/tracehook.h |    7 
- 4 files changed, 1305 insertions(+), 2 deletions(-)
+ include/asm-ia64/elf.h       |   24 +
+ 4 files changed, 1315 insertions(+), 2 deletions(-)
 
-Index: b/arch/ia64/ia32/sys_ia32.c
-===================================================================
---- a/arch/ia64/ia32/sys_ia32.c
-+++ b/arch/ia64/ia32/sys_ia32.c
-@@ -44,6 +44,7 @@
+--- linux-2.6/arch/ia64/ia32/sys_ia32.c
++++ linux-2.6/arch/ia64/ia32/sys_ia32.c
+@@ -43,6 +43,7 @@
  #include <linux/eventpoll.h>
  #include <linux/personality.h>
  #include <linux/ptrace.h>
@@ -27,7 +25,15 @@
  #include <linux/stat.h>
  #include <linux/ipc.h>
  #include <linux/capability.h>
-@@ -1868,6 +1869,477 @@ sys32_ptrace (int request, pid_t pid, un
+@@ -50,6 +51,7 @@
+ #include <linux/vfs.h>
+ #include <linux/mman.h>
+ #include <linux/mutex.h>
++#include <linux/elf.h>
+ 
+ #include <asm/intrinsics.h>
+ #include <asm/types.h>
+@@ -1868,6 +1870,480 @@ sys32_ptrace (int request, pid_t pid, un
  }
  #endif
  
@@ -188,7 +194,7 @@
 +		end = (dst->pos - 7 * sizeof(int)) / sizeof(struct _fpreg_ia32);
 +		for (; start < end; start++)
 +			access_fpreg_ia32(start, (struct _fpreg_ia32 *)buf + start,
-+					pt, info->sw, tos, 0);
++					pt, info->sw, tos, 1);
 +		if (dst->count == 0)
 +			return;
 +	}
@@ -480,16 +486,19 @@
 + */
 +static const struct utrace_regset ia32_regsets[] = {
 +	{
++		.core_note_type = NT_PRSTATUS,
 +		.n = sizeof(struct user_regs_struct32)/4,
 +		.size = 4, .align = 4,
 +		.get = ia32_genregs_get, .set = ia32_genregs_set
 +	},
 +	{
++		.core_note_type = NT_PRFPREG,
 +		.n = sizeof(struct ia32_user_i387_struct) / 4,
 +		.size = 4, .align = 4,
 +		.get = ia32_fpregs_get, .set = ia32_fpregs_set
 +	},
 +	{
++		.core_note_type = NT_PRXFPREG,
 +		.n = sizeof(struct ia32_user_fxsr_struct) / 4,
 +		.size = 4, .align = 4,
 +		.get = ia32_fpxregs_get, .set = ia32_fpxregs_set
@@ -505,10 +514,8 @@
  typedef struct {
  	unsigned int	ss_sp;
  	unsigned int	ss_flags;
-Index: b/arch/ia64/kernel/ptrace.c
-===================================================================
---- a/arch/ia64/kernel/ptrace.c
-+++ b/arch/ia64/kernel/ptrace.c
+--- linux-2.6/arch/ia64/kernel/ptrace.c
++++ linux-2.6/arch/ia64/kernel/ptrace.c
 @@ -3,6 +3,9 @@
   *
   * Copyright (C) 1999-2005 Hewlett-Packard Co
@@ -519,23 +526,17 @@
   *
   * Derived from the x86 and Alpha versions.
   */
-@@ -18,13 +21,16 @@
+@@ -18,7 +21,10 @@
  #include <linux/security.h>
  #include <linux/audit.h>
  #include <linux/signal.h>
 +#include <linux/module.h>
++#include <linux/elf.h>
  
 +#include <asm/tracehook.h>
  #include <asm/pgtable.h>
  #include <asm/processor.h>
  #include <asm/ptrace_offsets.h>
- #include <asm/rse.h>
- #include <asm/system.h>
- #include <asm/uaccess.h>
-+#include <asm/elf.h>
- #include <asm/unwind.h>
- #ifdef CONFIG_PERFMON
- #include <asm/perfmon.h>
 @@ -548,6 +554,7 @@ ia64_sync_user_rbs (struct task_struct *
  	return 0;
  }
@@ -576,7 +577,7 @@
  static int
  access_uarea (struct task_struct *child, unsigned long addr,
  	      unsigned long *data, int write_access)
-@@ -1248,7 +1259,9 @@ ptrace_getregs (struct task_struct *chil
+@@ -1252,7 +1263,9 @@ ptrace_getregs (struct task_struct *chil
  	ret = retval ? -EIO : 0;
  	return ret;
  }
@@ -586,7 +587,7 @@
  static long
  ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
  {
-@@ -1394,6 +1407,7 @@ ptrace_setregs (struct task_struct *chil
+@@ -1398,6 +1411,7 @@ ptrace_setregs (struct task_struct *chil
  	ret = retval ? -EIO : 0;
  	return ret;
  }
@@ -594,7 +595,7 @@
  
  /*
   * Called by kernel/ptrace.c when detaching..
-@@ -1411,6 +1425,7 @@ ptrace_disable (struct task_struct *chil
+@@ -1415,6 +1429,7 @@ ptrace_disable (struct task_struct *chil
  	child_psr->tb = 0;
  }
  
@@ -602,7 +603,7 @@
  asmlinkage long
  sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
  {
-@@ -1598,6 +1613,7 @@ sys_ptrace (long request, pid_t pid, uns
+@@ -1601,6 +1616,7 @@ sys_ptrace (long request, pid_t pid, uns
  	unlock_kernel();
  	return ret;
  }
@@ -610,7 +611,7 @@
  
  /* "asmlinkage" so the input arguments are preserved... */
  
-@@ -1650,3 +1666,791 @@ syscall_trace_leave (long arg0, long arg
+@@ -1653,3 +1669,797 @@ syscall_trace_leave (long arg0, long arg
  		tracehook_report_syscall_step(&regs);
  	}
  }
@@ -650,35 +651,35 @@
 +
 +	pt = task_pt_regs(target);
 +	switch (addr) {
-+		case ELF_GR_OFFSET(1):
-+			ptr = &pt->r1;
-+			break;
-+		case ELF_GR_OFFSET(2):
-+		case ELF_GR_OFFSET(3):
-+			ptr = (void *)&pt->r2 + (addr - ELF_GR_OFFSET(2));
-+			break;
-+		case ELF_GR_OFFSET(4) ... ELF_GR_OFFSET(7):
-+			if (write_access) {
-+				/* read NaT bit first: */
-+				unsigned long dummy;
-+
-+				ret = unw_get_gr(info, addr/8, &dummy, &nat);
-+				if (ret < 0)
-+					return ret;
-+			}
-+			return unw_access_gr(info, addr/8, data, &nat, write_access);
-+		case ELF_GR_OFFSET(8) ... ELF_GR_OFFSET(11):
-+			ptr = (void *)&pt->r8 + addr - ELF_GR_OFFSET(8);
-+			break;
-+		case ELF_GR_OFFSET(12):
-+		case ELF_GR_OFFSET(13):
-+			ptr = (void *)&pt->r12 + addr - ELF_GR_OFFSET(12);
-+			break;
-+		case ELF_GR_OFFSET(14):
-+			ptr = &pt->r14;
-+			break;
-+		case ELF_GR_OFFSET(15):
-+			ptr = &pt->r15;
++	case ELF_GR_OFFSET(1):
++		ptr = &pt->r1;
++		break;
++	case ELF_GR_OFFSET(2):
++	case ELF_GR_OFFSET(3):
++		ptr = (void *)&pt->r2 + (addr - ELF_GR_OFFSET(2));
++		break;
++	case ELF_GR_OFFSET(4) ... ELF_GR_OFFSET(7):
++		if (write_access) {
++			/* read NaT bit first: */
++			unsigned long dummy;
++
++			ret = unw_get_gr(info, addr/8, &dummy, &nat);
++			if (ret < 0)
++				return ret;
++		}
++		return unw_access_gr(info, addr/8, data, &nat, write_access);
++	case ELF_GR_OFFSET(8) ... ELF_GR_OFFSET(11):
++		ptr = (void *)&pt->r8 + addr - ELF_GR_OFFSET(8);
++		break;
++	case ELF_GR_OFFSET(12):
++	case ELF_GR_OFFSET(13):
++		ptr = (void *)&pt->r12 + addr - ELF_GR_OFFSET(12);
++		break;
++	case ELF_GR_OFFSET(14):
++		ptr = &pt->r14;
++		break;
++	case ELF_GR_OFFSET(15):
++		ptr = &pt->r15;
 +	}
 +	if (write_access)
 +		*ptr = *data;
@@ -696,17 +697,17 @@
 +
 +	pt = task_pt_regs(target);
 +	switch (addr) {
-+		case ELF_BR_OFFSET(0):
-+			ptr = &pt->b0;
-+			break;
-+		case ELF_BR_OFFSET(1) ... ELF_BR_OFFSET(5):
-+			return unw_access_br(info, (addr - ELF_BR_OFFSET(0))/8,
-+					data, write_access);
-+		case ELF_BR_OFFSET(6):
-+			ptr = &pt->b6;
-+			break;
-+		case ELF_BR_OFFSET(7):
-+			ptr = &pt->b7;
++	case ELF_BR_OFFSET(0):
++		ptr = &pt->b0;
++		break;
++	case ELF_BR_OFFSET(1) ... ELF_BR_OFFSET(5):
++		return unw_access_br(info, (addr - ELF_BR_OFFSET(0))/8,
++				     data, write_access);
++	case ELF_BR_OFFSET(6):
++		ptr = &pt->b6;
++		break;
++	case ELF_BR_OFFSET(7):
++		ptr = &pt->b7;
 +	}
 +	if (write_access)
 +		*ptr = *data;
@@ -726,137 +727,141 @@
 +	pt = task_pt_regs(target);
 +	if (addr >= ELF_AR_RSC_OFFSET && addr <= ELF_AR_SSD_OFFSET) {
 +		switch (addr) {
-+			case ELF_AR_RSC_OFFSET:
-+				/* force PL3 */
-+				if (write_access)
-+					pt->ar_rsc = *data | (3 << 2);
-+				else
-+					*data = pt->ar_rsc;
-+				return 0;
-+			case ELF_AR_BSP_OFFSET:
-+				/*
-+				 * By convention, we use PT_AR_BSP to refer to
-+				 * the end of the user-level backing store.
-+				 * Use ia64_rse_skip_regs(PT_AR_BSP, -CFM.sof)
-+				 * to get the real value of ar.bsp at the time
-+				 * the kernel was entered.
-+				 *
-+				 * Furthermore, when changing the contents of
-+				 * PT_AR_BSP (or PT_CFM) we MUST copy any
-+				 * users-level stacked registers that are
-+				 * stored on the kernel stack back to
-+				 * user-space because otherwise, we might end
-+				 * up clobbering kernel stacked registers.
-+				 * Also, if this happens while the task is
-+				 * blocked in a system call, which convert the
-+				 * state such that the non-system-call exit
-+				 * path is used.  This ensures that the proper
-+				 * state will be picked up when resuming
-+				 * execution.  However, it *also* means that
-+				 * once we write PT_AR_BSP/PT_CFM, it won't be
-+				 * possible to modify the syscall arguments of
-+				 * the pending system call any longer.  This
-+				 * shouldn't be an issue because modifying
-+				 * PT_AR_BSP/PT_CFM generally implies that
-+				 * we're either abandoning the pending system
-+				 * call or that we defer it's re-execution
-+				 * (e.g., due to GDB doing an inferior
-+				 * function call).
-+				 */
-+				urbs_end = ia64_get_user_rbs_end(target, pt, &cfm);
-+				if (write_access) {
-+					if (*data != urbs_end) {
-+						if (ia64_sync_user_rbs(target, info->sw,
-+									pt->ar_bspstore,
-+									urbs_end) < 0)
-+							return -1;
-+						if (in_syscall(pt))
-+							convert_to_non_syscall(target,
-+									pt,
-+									cfm);
-+						/*
-+						 * Simulate user-level write
-+						 * of ar.bsp:
-+						 */
-+						pt->loadrs = 0;
-+						pt->ar_bspstore = *data;
-+					}
-+				} else
-+					*data = urbs_end;
-+				return 0;
-+			case ELF_AR_BSPSTORE_OFFSET: // ar_bsp_store
-+				ptr = &pt->ar_bspstore;
-+				break;
-+			case ELF_AR_RNAT_OFFSET:  // ar_rnat
-+				urbs_end = ia64_get_user_rbs_end(target, pt, NULL);
-+				rnat_addr = (long) ia64_rse_rnat_addr((long *)
-+						urbs_end);
-+				if (write_access)
-+					return ia64_poke(target, info->sw, urbs_end,
-+							rnat_addr, *data);
-+				else
-+					return ia64_peek(target, info->sw, urbs_end,
-+							rnat_addr, data);
-+			case ELF_AR_CCV_OFFSET:   // ar_ccv
-+				ptr = &pt->ar_ccv;
-+				break;
-+			case ELF_AR_UNAT_OFFSET:	// ar_unat
-+				ptr = &pt->ar_unat;
-+				break;
-+			case ELF_AR_FPSR_OFFSET:  // ar_fpsr
-+				ptr = &pt->ar_fpsr;
-+				break;
-+			case ELF_AR_PFS_OFFSET:  // ar_pfs
-+				ptr = &pt->ar_pfs;
-+				break;
-+			case ELF_AR_LC_OFFSET:   // ar_lc
-+				return unw_access_ar(info, UNW_AR_LC, data,
-+						write_access);
-+			case ELF_AR_EC_OFFSET:    // ar_ec
-+				return unw_access_ar(info, UNW_AR_EC, data,
-+						write_access);
-+			case ELF_AR_CSD_OFFSET:   // ar_csd
-+				ptr = &pt->ar_csd;
-+				break;
-+			case ELF_AR_SSD_OFFSET:   // ar_ssd
-+				ptr = &pt->ar_ssd;
++		case ELF_AR_RSC_OFFSET:
++			/* force PL3 */
++			if (write_access)
++				pt->ar_rsc = *data | (3 << 2);
++			else
++				*data = pt->ar_rsc;
++			return 0;
++		case ELF_AR_BSP_OFFSET:
++			/*
++			 * By convention, we use PT_AR_BSP to refer to
++			 * the end of the user-level backing store.
++			 * Use ia64_rse_skip_regs(PT_AR_BSP, -CFM.sof)
++			 * to get the real value of ar.bsp at the time
++			 * the kernel was entered.
++			 *
++			 * Furthermore, when changing the contents of
++			 * PT_AR_BSP (or PT_CFM) we MUST copy any
++			 * users-level stacked registers that are
++			 * stored on the kernel stack back to
++			 * user-space because otherwise, we might end
++			 * up clobbering kernel stacked registers.
++			 * Also, if this happens while the task is
++			 * blocked in a system call, which convert the
++			 * state such that the non-system-call exit
++			 * path is used.  This ensures that the proper
++			 * state will be picked up when resuming
++			 * execution.  However, it *also* means that
++			 * once we write PT_AR_BSP/PT_CFM, it won't be
++			 * possible to modify the syscall arguments of
++			 * the pending system call any longer.  This
++			 * shouldn't be an issue because modifying
++			 * PT_AR_BSP/PT_CFM generally implies that
++			 * we're either abandoning the pending system
++			 * call or that we defer it's re-execution
++			 * (e.g., due to GDB doing an inferior
++			 * function call).
++			 */
++			urbs_end = ia64_get_user_rbs_end(target, pt, &cfm);
++			if (write_access) {
++				if (*data != urbs_end) {
++					if (ia64_sync_user_rbs(target, info->sw,
++							       pt->ar_bspstore,
++							       urbs_end) < 0)
++						return -1;
++					if (in_syscall(pt))
++						convert_to_non_syscall(target,
++								       pt,
++								       cfm);
++					/*
++					 * Simulate user-level write
++					 * of ar.bsp:
++					 */
++					pt->loadrs = 0;
++					pt->ar_bspstore = *data;
++				}
++			} else
++				*data = urbs_end;
++			return 0;
++		case ELF_AR_BSPSTORE_OFFSET: // ar_bsp_store
++			ptr = &pt->ar_bspstore;
++			break;
++		case ELF_AR_RNAT_OFFSET:  // ar_rnat
++			urbs_end = ia64_get_user_rbs_end(target, pt, NULL);
++			rnat_addr = (long) ia64_rse_rnat_addr((long *)
++							      urbs_end);
++			if (write_access)
++				return ia64_poke(target, info->sw, urbs_end,
++						 rnat_addr, *data);
++			else
++				return ia64_peek(target, info->sw, urbs_end,
++						 rnat_addr, data);
++		case ELF_AR_CCV_OFFSET:   // ar_ccv
++			ptr = &pt->ar_ccv;
++			break;
++		case ELF_AR_UNAT_OFFSET:	// ar_unat
++			ptr = &pt->ar_unat;
++			break;
++		case ELF_AR_FPSR_OFFSET:  // ar_fpsr
++			ptr = &pt->ar_fpsr;
++			break;
++		case ELF_AR_PFS_OFFSET:  // ar_pfs
++			ptr = &pt->ar_pfs;
++			break;
++		case ELF_AR_LC_OFFSET:   // ar_lc
++			return unw_access_ar(info, UNW_AR_LC, data,
++					     write_access);
++		case ELF_AR_EC_OFFSET:    // ar_ec
++			return unw_access_ar(info, UNW_AR_EC, data,
++					     write_access);
++		case ELF_AR_CSD_OFFSET:   // ar_csd
++			ptr = &pt->ar_csd;
++			break;
++		case ELF_AR_SSD_OFFSET:   // ar_ssd
++			ptr = &pt->ar_ssd;
 +		}
 +	} else if (addr >= ELF_CR_IIP_OFFSET && addr <= ELF_CR_IPSR_OFFSET) {
 +		switch (addr) {
-+			case ELF_CR_IIP_OFFSET:
-+				ptr = &pt->cr_iip;
-+				break;
-+			case ELF_CFM_OFFSET:
-+				urbs_end = ia64_get_user_rbs_end(target, pt, &cfm);
-+				if (write_access) {
-+					if (((cfm ^ *data) & PFM_MASK) != 0) {
-+						if (ia64_sync_user_rbs(target, info->sw,
-+									pt->ar_bspstore,
-+									urbs_end) < 0)
-+							return -1;
-+						if (in_syscall(pt))
-+							convert_to_non_syscall(target,
-+									pt,
-+									cfm);
-+						pt->cr_ifs = ((pt->cr_ifs & ~PFM_MASK)
-+								| (*data & PFM_MASK));
-+					}
-+				} else
-+					*data = cfm;
-+				return 0;
-+			case ELF_CR_IPSR_OFFSET:
-+				if (write_access)
-+					pt->cr_ipsr = ((*data & IPSR_MASK)
-+							| (pt->cr_ipsr & ~IPSR_MASK));
-+				else
-+					*data = (pt->cr_ipsr & IPSR_MASK);
-+				return 0;
++		case ELF_CR_IIP_OFFSET:
++			ptr = &pt->cr_iip;
++			break;
++		case ELF_CFM_OFFSET:
++			urbs_end = ia64_get_user_rbs_end(target, pt, &cfm);
++			if (write_access) {
++				if (((cfm ^ *data) & PFM_MASK) != 0) {
++					if (ia64_sync_user_rbs(target, info->sw,
++							       pt->ar_bspstore,
++							       urbs_end) < 0)
++						return -1;
++					if (in_syscall(pt))
++						convert_to_non_syscall(target,
++								       pt,
++								       cfm);
++					pt->cr_ifs = ((pt->cr_ifs & ~PFM_MASK)
++						      | (*data & PFM_MASK));
++				}
++			} else
++				*data = cfm;
++			return 0;
++		case ELF_CR_IPSR_OFFSET:
++			if (write_access) {
++				unsigned long tmp = *data;
++				/* psr.ri==3 is a reserved value: SDM 2:25 */
++				if ((tmp & IA64_PSR_RI) == IA64_PSR_RI)
++					tmp &= ~IA64_PSR_RI;
++				pt->cr_ipsr = ((tmp & IPSR_MASK)
++					       | (pt->cr_ipsr & ~IPSR_MASK));
++			} else
++				*data = (pt->cr_ipsr & IPSR_MASK);
++			return 0;
 +		}
 +	} else if (addr == ELF_NAT_OFFSET)
-+			return access_nat_bits(target, pt, info,
-+					data, write_access);
++		return access_nat_bits(target, pt, info,
++				       data, write_access);
 +	else if (addr == ELF_PR_OFFSET)
-+			ptr = &pt->pr;
++		ptr = &pt->pr;
 +	else
 +		return -1;
 +
@@ -1370,12 +1375,14 @@
 +
 +static const struct utrace_regset native_regsets[] = {
 +	{
++		.core_note_type = NT_PRSTATUS,
 +		.n = ELF_NGREG,
 +		.size = sizeof(elf_greg_t), .align = sizeof(elf_greg_t),
 +		.get = gpregs_get, .set = gpregs_set,
 +		.writeback = gpregs_writeback
 +	},
 +	{
++		.core_note_type = NT_PRFPREG,
 +		.n = ELF_NFPREG,
 +		.size = sizeof(elf_fpreg_t), .align = sizeof(elf_fpreg_t),
 +		.get = fpregs_get, .set = fpregs_set, .active = fpregs_active
@@ -1402,10 +1409,8 @@
 +#endif
 +	return &utrace_ia64_native;
 +}
-Index: b/include/asm-ia64/tracehook.h
-===================================================================
---- a/include/asm-ia64/tracehook.h
-+++ b/include/asm-ia64/tracehook.h
+--- linux-2.6/include/asm-ia64/tracehook.h
++++ linux-2.6/include/asm-ia64/tracehook.h
 @@ -67,7 +67,10 @@ static inline int tracehook_single_step_
  
  static inline void tracehook_abort_syscall(struct pt_regs *regs)
@@ -1419,10 +1424,8 @@
  
 -#endif
 +#endif	/* asm/tracehook.h */
-Index: b/include/asm-ia64/elf.h
-===================================================================
---- a/include/asm-ia64/elf.h
-+++ b/include/asm-ia64/elf.h
+--- linux-2.6/include/asm-ia64/elf.h
++++ linux-2.6/include/asm-ia64/elf.h
 @@ -154,6 +154,30 @@ extern void ia64_init_addr_space (void);
  #define ELF_NGREG	128	/* we really need just 72 but let's leave some headroom... */
  #define ELF_NFPREG	128	/* f0 and f1 could be omitted, but so what... */

linux-2.6-utrace-regset-s390.patch:

Index: linux-2.6-utrace-regset-s390.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-regset-s390.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-regset-s390.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-regset-s390.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -9,24 +9,20 @@
 ---
 
  arch/s390/kernel/Makefile |    2 
- arch/s390/kernel/ptrace.c |  952 ++++++++++++++++++----------------------------
- 2 files changed, 390 insertions(+), 564 deletions(-)
+ arch/s390/kernel/ptrace.c |  958 +++++++++++++++++++--------------------------
+ 2 files changed, 409 insertions(+), 551 deletions(-)
 
-Index: b/arch/s390/kernel/Makefile
-===================================================================
---- a/arch/s390/kernel/Makefile
-+++ b/arch/s390/kernel/Makefile
+--- linux-2.6/arch/s390/kernel/Makefile
++++ linux-2.6/arch/s390/kernel/Makefile
 @@ -35,3 +35,5 @@ obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS
  # This is just to get the dependencies...
  #
  binfmt_elf32.o:	$(TOPDIR)/fs/binfmt_elf.c
 +
 +CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
-Index: b/arch/s390/kernel/ptrace.c
-===================================================================
---- a/arch/s390/kernel/ptrace.c
-+++ b/arch/s390/kernel/ptrace.c
-@@ -30,6 +30,7 @@
+--- linux-2.6/arch/s390/kernel/ptrace.c
++++ linux-2.6/arch/s390/kernel/ptrace.c
+@@ -30,10 +30,12 @@
  #include <linux/errno.h>
  #include <linux/ptrace.h>
  #include <linux/tracehook.h>
@@ -34,15 +30,12 @@
  #include <linux/user.h>
  #include <linux/security.h>
  #include <linux/audit.h>
-@@ -42,6 +43,7 @@
- #include <asm/system.h>
- #include <asm/uaccess.h>
- #include <asm/unistd.h>
-+#include <asm/elf.h>
+ #include <linux/signal.h>
++#include <linux/elf.h>
  
- #ifdef CONFIG_COMPAT
- #include "compat_ptrace.h"
-@@ -116,640 +118,462 @@ tracehook_single_step_enabled(struct tas
+ #include <asm/segment.h>
+ #include <asm/page.h>
+@@ -116,628 +118,482 @@ tracehook_single_step_enabled(struct tas
  	return task->thread.per_info.single_step;
  }
  
@@ -170,13 +163,15 @@
 +		unsigned long pswmask = regs->psw.mask;
 +		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
 +					   &pswmask, PT_PSWMASK, PT_PSWADDR);
-+		if (pswmask != PSW_MASK_MERGE(psw_user_bits, pswmask)
++		if (ret == 0 &&
 +#ifdef CONFIG_COMPAT
-+		    && pswmask != PSW_MASK_MERGE(psw_user32_bits, pswmask)
++		    pswmask != PSW_MASK_MERGE(psw_user32_bits, pswmask) &&
 +#endif
-+			)
++		    pswmask != PSW_MASK_MERGE(psw_user_bits, pswmask))
 +			/* Invalid psw mask. */
-+			return -EINVAL;
++			ret = -EINVAL;
++		if (ret)
++			return ret;
 +		regs->psw.mask = pswmask;
 +		FixPerRegisters(target);
 +	}
@@ -195,6 +190,8 @@
 +		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
 +					   &regs->psw.addr, PT_PSWADDR,
 +					   PT_ACR0);
++		if (ret)
++			return ret;
 +#ifndef CONFIG_64BIT
 +		/* I'd like to reject addresses without the
 +		   high order bit but older gdb's rely on it */
@@ -276,6 +273,14 @@
 -#endif
 -		    data != PSW_MASK_MERGE(psw_user_bits, data))
 -			/* Invalid psw mask. */
+-			return -EINVAL;
+-#ifndef CONFIG_64BIT
+-		if (addr == (addr_t) &dummy->regs.psw.addr)
+-			/* I'd like to reject addresses without the
+-			   high order bit but older gdb's rely on it */
+-			data |= PSW_ADDR_AMODE;
+-#endif
+-		*(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
 +static int
 +fpregs_set(struct task_struct *target,
 +	    const struct utrace_regset *regset,
@@ -288,23 +293,13 @@
 +		save_fp_regs(&target->thread.fp_regs);
 +
 +	/* If setting FPC, must validate it first. */
-+	if (count > 0 && pos == 0) {
-+		unsigned long fpc;
++	if (count > 0 && pos < offsetof(s390_fp_regs, fprs)) {
++		u32 fpc[2] = { target->thread.fp_regs.fpc, 0 };
++		BUILD_BUG_ON(offsetof(s390_fp_regs, fprs) != sizeof(fpc));
 +		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
 +					   &fpc, 0, sizeof(fpc));
 +		if (ret)
 +			return ret;
-+
-+		if ((fpc & ~((unsigned long) FPC_VALID_MASK
-+			     << (BITS_PER_LONG - 32))) != 0)
- 			return -EINVAL;
--#ifndef CONFIG_64BIT
--		if (addr == (addr_t) &dummy->regs.psw.addr)
--			/* I'd like to reject addresses without the
--			   high order bit but older gdb's rely on it */
--			data |= PSW_ADDR_AMODE;
--#endif
--		*(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
  
 -	} else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
 -		/*
@@ -323,17 +318,16 @@
 -		else
 -#endif
 -		*(addr_t *)((addr_t) &child->thread.acrs + offset) = data;
-+		memcpy(&target->thread.fp_regs, &fpc, sizeof(fpc));
-+	}
++		if ((fpc[0] & ~FPC_VALID_MASK) != 0 || fpc[1] != 0)
++			return -EINVAL;
  
 -	} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {
 -		/*
 -		 * orig_gpr2 is stored on the kernel stack
 -		 */
 -		task_pt_regs(child)->orig_gpr2 = data;
-+	if (ret == 0)
-+		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+					   &target->thread.fp_regs, 0, -1);
++		target->thread.fp_regs.fpc = fpc[0];
++	}
  
 -	} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
 -		/*
@@ -345,8 +339,9 @@
 -			return -EINVAL;
 -		offset = addr - (addr_t) &dummy->regs.fp_regs;
 -		*(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;
-+	if (ret == 0 && target == current)
-+		restore_fp_regs(&target->thread.fp_regs);
++	if (ret == 0 && count > 0)
++		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
++					   target->thread.fp_regs.fprs, 0, -1);
  
 -	} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {
 -		/*
@@ -354,7 +349,9 @@
 -		 */
 -		offset = addr - (addr_t) &dummy->regs.per_info;
 -		*(addr_t *)((addr_t) &child->thread.per_info + offset) = data;
--
++	if (ret == 0 && target == current)
++		restore_fp_regs(&target->thread.fp_regs);
+ 
 -	}
 +	return ret;
 +}
@@ -378,20 +375,18 @@
 +	     unsigned int pos, unsigned int count,
 +	     const void *kbuf, const void __user *ubuf)
  {
--	unsigned long tmp;
 -	ptrace_area parea; 
 -	int copied, ret;
--
++	int ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
++				       &target->thread.per_info, 0, -1);
+ 
 -	switch (request) {
 -	case PTRACE_PEEKTEXT:
 -	case PTRACE_PEEKDATA:
 -		/* Remove high order bit from address (only for 31 bit). */
 -		addr &= PSW_ADDR_INSN;
 -		/* read word at location addr. */
--		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
--		if (copied != sizeof(tmp))
--			return -EIO;
--		return put_user(tmp, (unsigned long __force __user *) data);
+-		return generic_ptrace_peekdata(child, addr, data);
 -
 -	case PTRACE_PEEKUSR:
 -		/* read the word at location addr in the USER area. */
@@ -402,10 +397,7 @@
 -		/* Remove high order bit from address (only for 31 bit). */
 -		addr &= PSW_ADDR_INSN;
 -		/* write the word at location addr. */
--		copied = access_process_vm(child, addr, &data, sizeof(data),1);
--		if (copied != sizeof(data))
--			return -EIO;
--		return 0;
+-		return generic_ptrace_pokedata(child, addr, data);
 -
 -	case PTRACE_POKEUSR:
 -		/* write the word at location addr in the USER area */
@@ -438,9 +430,6 @@
 -		return 0;
 -	}
 -	return ptrace_request(child, request, addr, data);
-+	int ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+				       &target->thread.per_info, 0, -1);
-+
 +	FixPerRegisters(target);
 +
 +	return ret;
@@ -478,11 +467,13 @@
 -		return -EIO;
 +static const struct utrace_regset native_regsets[] = {
 +	{
++		.core_note_type = NT_PRSTATUS,
 +		.size = sizeof(long), .align = sizeof(long),
 +		.n = sizeof(s390_regs) / sizeof(long),
 +		.get = genregs_get, .set = genregs_set
 +	},
 +	{
++		.core_note_type = NT_PRFPREG,
 +		.size = sizeof(long), .align = sizeof(long),
 +		.n = sizeof(s390_fp_regs) / sizeof(long),
 +		.get = fpregs_get, .set = fpregs_set
@@ -539,12 +530,13 @@
 +	int ret = 0;
 +
 +	/* Fake a 31 bit psw mask. */
-+	if (count > 0 && pos == PT_PSWMASK / 2) {
++	if (count > 0 && pos == offsetof(struct user_regs_struct32, psw.mask)) {
 +		u32 pswmask = PSW32_MASK_MERGE(psw32_user_bits,
 +					       (u32) (regs->psw.mask >> 32));
-+		ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
-+					    &pswmask, PT_PSWMASK / 2,
-+					    PT_PSWADDR / 2);
++		ret = utrace_regset_copyout(
++			&pos, &count, &kbuf, &ubuf, &pswmask,
++			offsetof(struct user_regs_struct32, psw.mask),
++			offsetof(struct user_regs_struct32, psw.addr));
 +	}
  
 -	} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
@@ -554,11 +546,13 @@
 -	        offset = addr - (addr_t) &dummy32->regs.fp_regs;
 -		tmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);
 +	/* Fake a 31 bit psw address. */
-+	if (ret == 0 && count > 0 && pos == PT_PSWADDR / 2) {
++	if (ret == 0 && count > 0 &&
++	    pos == offsetof(struct user_regs_struct32, psw.addr)) {
 +		u32 pswaddr = (u32) regs->psw.addr | PSW32_ADDR_AMODE31;
-+		ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
-+					    &pswaddr, PT_PSWADDR / 2,
-+					    PT_GPR0 / 2);
++		ret = utrace_regset_copyout(
++			&pos, &count, &kbuf, &ubuf, &pswaddr,
++			offsetof(struct user_regs_struct32, psw.addr),
++			offsetof(struct user_regs_struct32, gprs[0]));
 +	}
  
 -	} else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {
@@ -574,8 +568,11 @@
 -		    offset == (addr_t) &dummy_per32->lowcore.words.address)
 -			offset = offset*2 + 4;
 +	/* The GPRs are directly on the stack.  Just truncate them.  */
-+	while (ret == 0 && count > 0 && pos < PT_ACR0 / 2) {
-+		u32 value = regs->gprs[(pos - PT_GPR0 / 2) / sizeof(u32)];
++	while (ret == 0 && count > 0 &&
++	       pos < offsetof(struct user_regs_struct32, acrs[0])) {
++		unsigned int n =
++			pos - offsetof(struct user_regs_struct32, gprs[0]);
++		u32 value = regs->gprs[n / sizeof(u32)];
 +		if (kbuf) {
 +			*(u32 *) kbuf = value;
 +			kbuf += sizeof(u32);
@@ -593,14 +590,14 @@
 -	} else
 -		tmp = 0;
 +	/* The ACRs are kept in the thread_struct.  */
-+	if (ret == 0 && count > 0 && pos < PT_ACR0 / 2 + NUM_ACRS * ACR_SIZE) {
++	if (ret == 0 && count > 0 &&
++	    pos < offsetof(struct user_regs_struct32, acrs[NUM_ACRS])) {
 +		if (target == current)
 +			save_access_regs(target->thread.acrs);
-+
-+		ret = utrace_regset_copyout(&pos, &count, &kbuf, &ubuf,
-+					    target->thread.acrs,
-+					    PT_ACR0 / 2,
-+					    PT_ACR0 / 2 + NUM_ACRS * ACR_SIZE);
++		ret = utrace_regset_copyout(
++			&pos, &count, &kbuf, &ubuf, target->thread.acrs,
++			offsetof(struct user_regs_struct32, acrs[0]),
++			offsetof(struct user_regs_struct32, acrs[NUM_ACRS]));
 +	}
  
 -	return put_user(tmp, (__u32 __user *) data);
@@ -608,8 +605,7 @@
 +	if (count > 0) {
 +		if (kbuf)
 +			*(u32 *) kbuf = regs->orig_gpr2;
-+		else if (put_user((u32) regs->orig_gpr2,
-+				  (u32 __user *) ubuf))
++		else if (put_user((u32) regs->orig_gpr2, (u32 __user *) ubuf))
 +			return -EFAULT;
 +	}
 +
@@ -635,18 +631,19 @@
 +	int ret = 0;
 +
 +	/* Check for an invalid PSW mask.  */
-+	if (count > 0 && pos == PT_PSWMASK / 2) {
++	if (count > 0 && pos == offsetof(struct user_regs_struct32, psw.mask)) {
 +		u32 pswmask;
-+		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+					   &pswmask, PT_PSWMASK / 2,
-+					   PT_PSWADDR / 2);
++		ret = utrace_regset_copyin(
++			&pos, &count, &kbuf, &ubuf, &pswmask,
++			offsetof(struct user_regs_struct32, psw.mask),
++			offsetof(struct user_regs_struct32, psw.addr));
 +		if (ret)
 +			return ret;
  
 -	if (!test_thread_flag(TIF_31BIT) ||
 -	    (addr & 3) || addr > sizeof(struct user32) - 3)
 -		return -EIO;
-+		if (pswmask != PSW_MASK_MERGE(psw_user32_bits, pswmask))
++		if (pswmask != PSW32_MASK_MERGE(psw32_user_bits, pswmask))
 +			/* Invalid psw mask. */
 +			return -EINVAL;
  
@@ -663,11 +660,12 @@
 -		 */
 -		if (addr == (addr_t) &dummy32->regs.psw.mask) {
 +	/* Build a 64 bit psw address from 31 bit address. */
-+	if (count > 0 && pos == PT_PSWADDR / 2) {
++	if (count > 0 && pos == offsetof(struct user_regs_struct32, psw.addr)) {
 +		u32 pswaddr;
-+		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+					   &pswaddr, PT_PSWADDR / 2,
-+					   PT_GPR0 / 2);
++		ret = utrace_regset_copyin(
++			&pos, &count, &kbuf, &ubuf, &pswaddr,
++			offsetof(struct user_regs_struct32, psw.addr),
++			offsetof(struct user_regs_struct32, gprs[0]));
 +		if (ret == 0)
  			/* Build a 64 bit psw mask from 31 bit mask. */
 -			if (tmp != PSW32_MASK_MERGE(psw32_user_bits, tmp))
@@ -687,7 +685,10 @@
 +	}
 +
 +	/* The GPRs are directly onto the stack. */
-+	while (ret == 0 && count > 0 && pos < PT_ACR0 / 2) {
++	while (ret == 0 && count > 0 &&
++	       pos < offsetof(struct user_regs_struct32, acrs[0])) {
++		unsigned int n =
++			pos - offsetof(struct user_regs_struct32, gprs[0]);
 +		u32 value;
 +
 +		if (kbuf) {
@@ -712,7 +713,7 @@
 -		 * orig_gpr2 is stored on the kernel stack
 -		 */
 -		*(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp;
-+		regs->gprs[(pos - PT_GPR0 / 2) / sizeof(u32)] = value;
++		regs->gprs[n / sizeof(u32)] = value;
 +	}
  
 -	} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
@@ -726,16 +727,17 @@
 -	        offset = addr - (addr_t) &dummy32->regs.fp_regs;
 -		*(__u32 *)((addr_t) &child->thread.fp_regs + offset) = tmp;
 +	/* The ACRs are kept in the thread_struct.  */
-+	if (count > 0 && pos < PT_ORIGGPR2 / 2) {
-+		if (target == current
-+		    && (pos != PT_ACR0 / 2
-+			|| count < sizeof(target->thread.acrs)))
++	if (count > 0 &&
++	    pos < offsetof(struct user_regs_struct32, acrs[NUM_ACRS])) {
++		if (target == current &&
++		    (pos != offsetof(struct user_regs_struct32, acrs[0]) ||
++		     count < sizeof(target->thread.acrs)))
 +			save_access_regs(target->thread.acrs);
 +
-+		ret = utrace_regset_copyin(&pos, &count, &kbuf, &ubuf,
-+					   target->thread.acrs,
-+					   PT_ACR0 / 2,
-+					   PT_ACR0 / 2 + NUM_ACRS * ACR_SIZE);
++		ret = utrace_regset_copyin(
++			&pos, &count, &kbuf, &ubuf, target->thread.acrs,
++			offsetof(struct user_regs_struct32, acrs[0]),
++			offsetof(struct user_regs_struct32, acrs[NUM_ACRS]));
  
 -	} else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {
 -		/*
@@ -968,7 +970,7 @@
 -		tracehook_disable_single_step(child);
 -		wake_up_process(child);
 -		return 0;
--
+ 
 -	case PTRACE_KILL:
 -		/*
 -		 * make the child exit.  Best I can do is send it a sigkill. 
@@ -996,21 +998,19 @@
 -		/* give it a chance to run. */
 -		wake_up_process(child);
 -		return 0;
--
--	case PTRACE_DETACH:
--		/* detach a process that was attached. */
--		return ptrace_detach(child, data);
- 
 +static const struct utrace_regset s390_compat_regsets[] = {
 +	{
++		.core_note_type = NT_PRSTATUS,
 +		.size = sizeof(u32), .align = sizeof(u32),
-+		.n = sizeof(s390_regs) / sizeof(long),
++		.n = offsetof(struct user_regs_struct32, fp_regs) / sizeof(u32),
 +		.get = s390_genregs_get, .set = s390_genregs_set
 +	},
 +	{
++		.core_note_type = NT_PRFPREG,
 +		.size = sizeof(u32), .align = sizeof(u32),
 +		.n = sizeof(s390_fp_regs) / sizeof(u32),
 +		.get = fpregs_get, .set = fpregs_set
++
 +	},
 +	{
 +		.size = sizeof(u32), .align = sizeof(u32),

linux-2.6-utrace-regset-sparc64.patch:

Index: linux-2.6-utrace-regset-sparc64.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-regset-sparc64.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-regset-sparc64.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-regset-sparc64.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -9,14 +9,12 @@
 ---
 
  arch/sparc64/kernel/Makefile  |    2 
- arch/sparc64/kernel/ptrace.c  |  631 +++++++++++++++++++++++++++++++++++++-----
+ arch/sparc64/kernel/ptrace.c  |  635 +++++++++++++++++++++++++++++++++++++----
  arch/sparc64/kernel/systbls.S |    4 
- 3 files changed, 568 insertions(+), 69 deletions(-)
+ 3 files changed, 572 insertions(+), 69 deletions(-)
 
-Index: b/arch/sparc64/kernel/Makefile
-===================================================================
---- a/arch/sparc64/kernel/Makefile
-+++ b/arch/sparc64/kernel/Makefile
+--- linux-2.6/arch/sparc64/kernel/Makefile
++++ linux-2.6/arch/sparc64/kernel/Makefile
 @@ -5,6 +5,8 @@
  EXTRA_AFLAGS := -ansi
  EXTRA_CFLAGS := -Werror
@@ -26,10 +24,8 @@
  extra-y		:= head.o init_task.o vmlinux.lds
  
  obj-y		:= process.o setup.o cpu.o idprom.o \
-Index: b/arch/sparc64/kernel/ptrace.c
-===================================================================
---- a/arch/sparc64/kernel/ptrace.c
-+++ b/arch/sparc64/kernel/ptrace.c
+--- linux-2.6/arch/sparc64/kernel/ptrace.c
++++ linux-2.6/arch/sparc64/kernel/ptrace.c
 @@ -1,6 +1,6 @@
 -/* ptrace.c: Sparc process tracing support.
 +/* ptrace.c: Sparc64 process tracing support.
@@ -39,7 +35,7 @@
   * Copyright (C) 1997 Jakub Jelinek (jj at sunsite.mff.cuni.cz)
   *
   * Based upon code written by Ross Biro, Linus Torvalds, Bob Manson,
-@@ -11,106 +11,603 @@
+@@ -11,106 +11,607 @@
   */
  
  #include <linux/kernel.h>
@@ -217,9 +213,8 @@
 +	}
 +
 +	return err;
- }
- 
--static inline void pt_succ_return(struct pt_regs *regs, unsigned long value)
++}
++
 +#define FPREG_F0	0
 +#define FPREG_FSR	32
 +#define FPREG_GSR	33
@@ -231,11 +226,7 @@
 +		      const struct utrace_regset *regset,
 +		      unsigned int pos, unsigned int count,
 +		      void *kbuf, void __user *ubuf)
- {
--	regs->u_regs[UREG_I0] = value;
--	regs->tstate &= ~(TSTATE_ICARRY | TSTATE_XCARRY);
--	regs->tpc = regs->tnpc;
--	regs->tnpc += 4;
++{
 +	struct thread_info *t = task_thread_info(target);
 +	int err;
 +
@@ -264,22 +255,16 @@
 +	return err;
  }
  
--static inline void
--pt_succ_return_linux(struct pt_regs *regs, unsigned long value, void __user *addr)
+-static inline void pt_succ_return(struct pt_regs *regs, unsigned long value)
 +static int fpregs_set(struct task_struct *target,
 +		      const struct utrace_regset *regset,
 +		      unsigned int pos, unsigned int count,
 +		      const void *kbuf, const void __user *ubuf)
  {
--	if (test_thread_flag(TIF_32BIT)) {
--		if (put_user(value, (unsigned int __user *) addr)) {
--			pt_error_return(regs, EFAULT);
--			return;
--		}
--	} else {
--		if (put_user(value, (long __user *) addr)) {
--			pt_error_return(regs, EFAULT);
--			return;
+-	regs->u_regs[UREG_I0] = value;
+-	regs->tstate &= ~(TSTATE_ICARRY | TSTATE_XCARRY);
+-	regs->tpc = regs->tnpc;
+-	regs->tnpc += 4;
 +	struct thread_info *t = task_thread_info(target);
 +	int err;
 +
@@ -306,15 +291,19 @@
 +	}
 +
 +	return err;
-+}
-+
+ }
+ 
+-static inline void
+-pt_succ_return_linux(struct pt_regs *regs, unsigned long value, void __user *addr)
 +static const struct utrace_regset native_regsets[] = {
 +	{
++		.core_note_type = NT_PRSTATUS,
 +		.n = SPARC64_NGREGS,
 +		.size = sizeof(long), .align = sizeof(long),
 +		.get = genregs_get, .set = genregs_set
 +	},
 +	{
++		.core_note_type = NT_PRFPREG,
 +		.n = SPARC64_NFPREGS,
 +		.size = sizeof(long), .align = sizeof(long),
 +		.get = fpregs_get, .set = fpregs_set
@@ -345,7 +334,16 @@
 +			 const struct utrace_regset *regset,
 +			 unsigned int pos, unsigned int count,
 +			 void *kbuf, void __user *ubuf)
-+{
+ {
+-	if (test_thread_flag(TIF_32BIT)) {
+-		if (put_user(value, (unsigned int __user *) addr)) {
+-			pt_error_return(regs, EFAULT);
+-			return;
+-		}
+-	} else {
+-		if (put_user(value, (long __user *) addr)) {
+-			pt_error_return(regs, EFAULT);
+-			return;
 +	struct pt_regs *regs = task_pt_regs(target);
 +
 +	while (count > 0 && pos < (GENREG32_L0 * 4)) {
@@ -669,11 +667,13 @@
 +
 +static const struct utrace_regset sparc32_regsets[] = {
 +	{
++		.core_note_type = NT_PRSTATUS,
 +		.n = SPARC32_NGREGS,
 +		.size = sizeof(u32), .align = sizeof(u32),
 +		.get = genregs32_get, .set = genregs32_set
 +	},
 +	{
++		.core_note_type = NT_PRFPREG,
 +		.n = SPARC32_NFPREGS,
 +		.size = sizeof(u32), .align = sizeof(u32),
 +		.get = fpregs32_get, .set = fpregs32_set
@@ -708,11 +708,9 @@
  /* To get the necessary page struct, access_process_vm() first calls
   * get_user_pages().  This has done a flush_dcache_page() on the
   * accessed page.  Then our caller (copy_{to,from}_user_page()) did
-Index: b/arch/sparc64/kernel/systbls.S
-===================================================================
---- a/arch/sparc64/kernel/systbls.S
-+++ b/arch/sparc64/kernel/systbls.S
-@@ -24,7 +24,7 @@ sys_call_table32:
+--- linux-2.6/arch/sparc64/kernel/systbls.S
++++ linux-2.6/arch/sparc64/kernel/systbls.S
+@@ -23,7 +23,7 @@ sys_call_table32:
  /*10*/  .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod
  /*15*/	.word sys_chmod, sys32_lchown16, sparc_brk, sys32_perfctr, sys32_lseek
  /*20*/	.word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
@@ -721,7 +719,7 @@
  /*30*/	.word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
  	.word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
  /*40*/	.word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
-@@ -168,7 +168,7 @@ sunos_sys_table:
+@@ -169,7 +169,7 @@ sunos_sys_table:
  	.word sys_chmod, sys32_lchown16, sunos_brk
  	.word sunos_nosys, sys32_lseek, sunos_getpid
  	.word sunos_nosys, sunos_nosys, sunos_nosys

linux-2.6-utrace-regset.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.2.8.1 linux-2.6-utrace-regset.patch
Index: linux-2.6-utrace-regset.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-regset.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-regset.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-regset.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -11,1169 +11,939 @@
 
 ---
 
- arch/i386/kernel/i387.c             |  143 +++---
- arch/i386/kernel/ptrace.c           |  822 ++++++++++++++++++++----------------
- arch/powerpc/kernel/Makefile        |    4 
- arch/powerpc/kernel/ptrace-common.h |  145 ------
- arch/powerpc/kernel/ptrace.c        |  718 +++++++++++++++----------------
- arch/powerpc/kernel/ptrace32.c      |  443 -------------------
- arch/x86_64/ia32/fpu32.c            |   92 +++-
- arch/x86_64/ia32/ptrace32.c         |  721 ++++++++++++++++++++-----------
- arch/x86_64/kernel/ptrace.c         |  730 +++++++++++++++++++------------
- include/asm-i386/i387.h             |   13 
- include/asm-x86_64/fpu32.h          |    3 
- include/asm-x86_64/tracehook.h      |    8 
- include/linux/tracehook.h           |  244 ++++++++++
- kernel/ptrace.c                     |    8 
- 14 files changed, 2125 insertions(+), 1969 deletions(-)
- delete arch/powerpc/kernel/ptrace32.c
- delete arch/powerpc/kernel/ptrace-common.h
+ arch/powerpc/kernel/Makefile   |    2 
+ arch/powerpc/kernel/ptrace32.c |   20 -
+ arch/powerpc/kernel/ptrace.c   |  644 ++++++++++++++++++++++----------
+ arch/x86/ia32/ptrace32.c       |  721 +++++++++++++++++++++++-------------
+ arch/x86/ia32/fpu32.c          |   92 ++++-
+ arch/x86/kernel/ptrace_32.c    |  806 +++++++++++++++++++++++-----------------
+ arch/x86/kernel/i387_32.c      |  143 ++++---
+ arch/x86/kernel/ptrace_64.c    |  720 ++++++++++++++++++++++--------------
+ kernel/ptrace.c                |    9 
+ include/linux/tracehook.h      |  255 ++++++++++++-
+ include/asm-x86/fpu32.h        |    3 
+ include/asm-x86/i387_32.h      |   13 -
+ include/asm-x86/tracehook.h    |    8 
+ 13 files changed, 2228 insertions(+), 1208 deletions(-)
 
-Index: b/arch/i386/kernel/i387.c
-===================================================================
---- a/arch/i386/kernel/i387.c
-+++ b/arch/i386/kernel/i387.c
-@@ -222,14 +222,10 @@ void set_fpu_twd( struct task_struct *ts
-  * FXSR floating point environment conversions.
+--- linux-2.6/arch/powerpc/kernel/Makefile
++++ linux-2.6/arch/powerpc/kernel/Makefile
+@@ -10,6 +10,8 @@ CFLAGS_prom_init.o      += -fPIC
+ CFLAGS_btext.o		+= -fPIC
+ endif
+ 
++CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
++
+ obj-y				:= semaphore.o cputable.o ptrace.o syscalls.o \
+ 				   irq.o align.o signal_32.o pmc.o vdso.o \
+ 				   init_task.o process.o systbl.o idle.o \
+--- linux-2.6/arch/powerpc/kernel/ptrace32.c
++++ linux-2.6/arch/powerpc/kernel/ptrace32.c
+@@ -35,10 +35,6 @@
+ #include <asm/system.h>
+ #include <asm/tracehook.h>
+ 
+-/*
+- * does not yet catch signals sent when the child dies.
+- * in exit.c or in signal.c.
+- */
+ 
+ /*
+  * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
+@@ -173,7 +169,7 @@ long compat_sys_ptrace(int request, int 
+ 
+ 		CHECK_FULL_REGS(child->thread.regs);
+ 		if (index < PT_FPR0) {
+-			tmp = ptrace_get_reg(child, index);
++			tmp = 0;/*ptrace_get_reg(child, index);*/
+ 		} else {
+ 			flush_fp_to_thread(child);
+ 			/*
+@@ -223,7 +219,7 @@ long compat_sys_ptrace(int request, int 
+ 			flush_fp_to_thread(child);
+ 			tmp = ((unsigned long int *)child->thread.fpr)[numReg - PT_FPR0];
+ 		} else { /* register within PT_REGS struct */
+-			tmp = ptrace_get_reg(child, numReg);
++/*			tmp = ptrace_get_reg(child, numReg);*/
+ 		} 
+ 		reg32bits = ((u32*)&tmp)[part];
+ 		ret = put_user(reg32bits, (u32 __user *)data);
+@@ -281,7 +277,7 @@ long compat_sys_ptrace(int request, int 
+ 
+ 		CHECK_FULL_REGS(child->thread.regs);
+ 		if (index < PT_FPR0) {
+-			ret = ptrace_put_reg(child, index, data);
++/*			ret = ptrace_put_reg(child, index, data);*/
+ 		} else {
+ 			flush_fp_to_thread(child);
+ 			/*
+@@ -319,12 +315,12 @@ long compat_sys_ptrace(int request, int 
+ 			break;
+ 		CHECK_FULL_REGS(child->thread.regs);
+ 		if (numReg < PT_FPR0) {
+-			unsigned long freg = ptrace_get_reg(child, numReg);
++			unsigned long freg = 0;/*ptrace_get_reg(child, numReg);*/
+ 			if (index % 2)
+ 				freg = (freg & ~0xfffffffful) | (data & 0xfffffffful);
+ 			else
+ 				freg = (freg & 0xfffffffful) | (data << 32);
+-			ret = ptrace_put_reg(child, numReg, freg);
++/*			ret = ptrace_put_reg(child, numReg, freg);*/
+ 		} else {
+ 			flush_fp_to_thread(child);
+ 			((unsigned int *)child->thread.regs)[index] = data;
+@@ -358,8 +354,8 @@ long compat_sys_ptrace(int request, int 
+ 		CHECK_FULL_REGS(child->thread.regs);
+ 		ret = 0;
+ 		for (ui = 0; ui < PT_REGS_COUNT; ui ++) {
+-			ret |= __put_user(ptrace_get_reg(child, ui),
+-					  (unsigned int __user *) data);
++/*			ret |= __put_user(ptrace_get_reg(child, ui),
++					  (unsigned int __user *) data);*/
+ 			data += sizeof(int);
+ 		}
+ 		break;
+@@ -379,7 +375,7 @@ long compat_sys_ptrace(int request, int 
+ 			ret = __get_user(tmp, (unsigned int __user *) data);
+ 			if (ret)
+ 				break;
+-			ptrace_put_reg(child, ui, tmp);
++/*			ptrace_put_reg(child, ui, tmp);*/
+ 			data += sizeof(int);
+ 		}
+ 		break;
+--- linux-2.6/arch/powerpc/kernel/ptrace.c
++++ linux-2.6/arch/powerpc/kernel/ptrace.c
+@@ -27,6 +27,7 @@
+ #include <linux/signal.h>
+ #include <linux/seccomp.h>
+ #include <linux/audit.h>
++#include <linux/elf.h>
+ #ifdef CONFIG_PPC32
+ #include <linux/module.h>
+ #endif
+@@ -38,11 +39,6 @@
+ #include <asm/tracehook.h>
+ 
+ /*
+- * does not yet catch signals sent when the child dies.
+- * in exit.c or in signal.c.
+- */
+-
+-/*
+  * Set of msr bits that gdb can change on behalf of a process.
   */
+ #if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+@@ -60,69 +56,120 @@
+ #define PT_MAX_PUT_REG	PT_CCR
+ #endif
  
--static int convert_fxsr_to_user( struct _fpstate __user *buf,
--					struct i387_fxsave_struct *fxsave )
-+static inline void
-+convert_fxsr_env_to_i387(unsigned long env[7],
-+			 struct i387_fxsave_struct *fxsave)
+-/*
+- * Get contents of register REGNO in task TASK.
+- */
+-unsigned long ptrace_get_reg(struct task_struct *task, int regno)
++static int
++genregs_get(struct task_struct *target,
++	    const struct utrace_regset *regset,
++	    unsigned int pos, unsigned int count,
++	    void *kbuf, void __user *ubuf)
  {
--	unsigned long env[7];
--	struct _fpreg __user *to;
--	struct _fpxreg *from;
--	int i;
--
- 	env[0] = (unsigned long)fxsave->cwd | 0xffff0000ul;
- 	env[1] = (unsigned long)fxsave->swd | 0xffff0000ul;
- 	env[2] = twd_fxsr_to_i387(fxsave);
-@@ -237,7 +233,17 @@ static int convert_fxsr_to_user( struct 
- 	env[4] = fxsave->fcs | ((unsigned long)fxsave->fop << 16);
- 	env[5] = fxsave->foo;
- 	env[6] = fxsave->fos;
-+}
-+
-+static int convert_fxsr_to_user(struct _fpstate __user *buf,
-+				struct i387_fxsave_struct *fxsave)
-+{
-+	unsigned long env[7];
-+	struct _fpreg __user *to;
-+	struct _fpxreg *from;
-+	int i;
+-	unsigned long tmp = 0;
++	unsigned long tmp;
[...5750 lines suppressed...]
--static inline int get_vrregs(unsigned long __user *data,
--			     struct task_struct *task)
--{
--	unsigned long regsize;
--
--	/* copy AltiVec registers VR[0] .. VR[31] */
--	regsize = 32 * sizeof(vector128);
--	if (copy_to_user(data, task->thread.vr, regsize))
--		return -EFAULT;
--	data += (regsize / sizeof(unsigned long));
--
--	/* copy VSCR */
--	regsize = 1 * sizeof(vector128);
--	if (copy_to_user(data, &task->thread.vscr, regsize))
--		return -EFAULT;
--	data += (regsize / sizeof(unsigned long));
--
--	/* copy VRSAVE */
--	if (put_user(task->thread.vrsave, (u32 __user *)data))
--		return -EFAULT;
--
--	return 0;
--}
--
--/*
-- * Write contents of AltiVec register state into task TASK.
-- */
--static inline int set_vrregs(struct task_struct *task,
--			     unsigned long __user *data)
--{
--	unsigned long regsize;
--
--	/* copy AltiVec registers VR[0] .. VR[31] */
--	regsize = 32 * sizeof(vector128);
--	if (copy_from_user(task->thread.vr, data, regsize))
--		return -EFAULT;
--	data += (regsize / sizeof(unsigned long));
--
--	/* copy VSCR */
--	regsize = 1 * sizeof(vector128);
--	if (copy_from_user(&task->thread.vscr, data, regsize))
--		return -EFAULT;
--	data += (regsize / sizeof(unsigned long));
--
--	/* copy VRSAVE */
--	if (get_user(task->thread.vrsave, (u32 __user *)data))
--		return -EFAULT;
--
--	return 0;
--}
--#endif
--
--static inline int ptrace_set_debugreg(struct task_struct *task,
--				      unsigned long addr, unsigned long data)
--{
--	/* We only support one DABR and no IABRS at the moment */
--	if (addr > 0)
--		return -EINVAL;
--
--	/* The bottom 3 bits are flags */
--	if ((data & ~0x7UL) >= TASK_SIZE)
--		return -EIO;
--
--	/* Ensure translation is on */
--	if (data && !(data & DABR_TRANSLATION))
--		return -EIO;
--
--	task->thread.dabr = data;
--	return 0;
--}
--
--#endif /* _PPC64_PTRACE_COMMON_H */
-Index: b/kernel/ptrace.c
-===================================================================
---- a/kernel/ptrace.c
-+++ b/kernel/ptrace.c
-@@ -96,12 +96,6 @@ int ptrace_detach(struct task_struct *ch
+ 	/* do the secure computing check first */
+--- linux-2.6/kernel/ptrace.c
++++ linux-2.6/kernel/ptrace.c
+@@ -100,13 +100,6 @@ int ptrace_detach(struct task_struct *ch
  	if (!valid_signal(data))
  		return -EIO;
  
 -	/* Architecture-specific hardware disable .. */
 -	ptrace_disable(child);
+-	clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
 -
 -	/* .. re-parent .. */
 -	child->exit_code = data;
@@ -4420,9 +3854,9 @@
  	return -ENOSYS;
  }
  
-@@ -209,9 +203,7 @@ struct task_struct *ptrace_get_task_stru
- 	return child;
- }
+@@ -218,12 +211,10 @@ struct task_struct *ptrace_get_task_stru
+ #define arch_ptrace_attach(child)	do { } while (0)
+ #endif
  
 -#ifndef __ARCH_SYS_PTRACE
  asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
@@ -4430,10 +3864,11 @@
  	return -ENOSYS;
  }
 -#endif /* __ARCH_SYS_PTRACE */
-Index: b/include/linux/tracehook.h
-===================================================================
---- a/include/linux/tracehook.h
-+++ b/include/linux/tracehook.h
+ 
+ int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data)
+ {
+--- linux-2.6/include/linux/tracehook.h
++++ linux-2.6/include/linux/tracehook.h
 @@ -52,10 +52,10 @@ struct pt_regs;
   * should be one that can be evaluated in modules, i.e. uses exported symbols.
   *
@@ -4449,7 +3884,7 @@
   * Enabling or disabling redundantly is harmless.
   *
   *	void tracehook_enable_block_step(struct task_struct *tsk);
-@@ -93,6 +93,242 @@ struct pt_regs;
+@@ -93,6 +93,253 @@ struct pt_regs;
   */
  
  
@@ -4489,6 +3924,17 @@
 +	unsigned int bias;	/* Bias from natural indexing.  */
 +
 +	/*
++	 * If nonzero, this gives the n_type field (NT_* value) of the
++	 * core file note in which this regset's data appears.
++	 * NT_PRSTATUS is a special case in that the regset data starts
++	 * at offsetof(struct elf_prstatus, pr_reg) into the note data;
++	 * that is part of the per-machine ELF formats userland knows
++	 * about.  In other cases, the core file note contains exactly
++	 * the whole regset (n*size) and nothing else.
++	 */
++	unsigned int core_note_type;
++
++	/*
 +	 * Return -%ENODEV if not available on the hardware found.
 +	 * Return %0 if no interesting state in this thread.
 +	 * Return >%0 number of @size units of interesting state.
@@ -4692,11 +4138,19 @@
  /*
   * Following are entry points from core code, where the user debugging
   * support can affect the normal behavior.  The locking situation is
-Index: b/include/asm-i386/i387.h
-===================================================================
---- a/include/asm-i386/i387.h
-+++ b/include/asm-i386/i387.h
-@@ -129,17 +129,12 @@ extern int save_i387( struct _fpstate __
+--- linux-2.6/include/asm-x86/fpu32.h
++++ linux-2.6/include/asm-x86/fpu32.h
+@@ -7,4 +7,7 @@ int restore_i387_ia32(struct task_struct
+ int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, 
+ 		   struct pt_regs *regs, int fsave);
+ 
++int get_fpregs32(struct user_i387_ia32_struct *, struct task_struct *);
++int set_fpregs32(struct task_struct *, const struct user_i387_ia32_struct *);
++
+ #endif
+--- linux-2.6/include/asm-x86/i387_32.h
++++ linux-2.6/include/asm-x86/i387_32.h
+@@ -130,17 +130,12 @@ extern int save_i387( struct _fpstate __
  extern int restore_i387( struct _fpstate __user *buf );
  
  /*
@@ -4718,25 +4172,11 @@
  
  /*
   * FPU state for core dumps...
-Index: b/include/asm-x86_64/fpu32.h
-===================================================================
---- a/include/asm-x86_64/fpu32.h
-+++ b/include/asm-x86_64/fpu32.h
-@@ -7,4 +7,7 @@ int restore_i387_ia32(struct task_struct
- int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, 
- 		   struct pt_regs *regs, int fsave);
+--- linux-2.6/include/asm-x86/tracehook.h
++++ linux-2.6/include/asm-x86/tracehook.h
+@@ -60,4 +60,12 @@ static inline void tracehook_abort_sysca
  
-+int get_fpregs32(struct user_i387_ia32_struct *, struct task_struct *);
-+int set_fpregs32(struct task_struct *, const struct user_i387_ia32_struct *);
-+
  #endif
-Index: b/include/asm-x86_64/tracehook.h
-===================================================================
---- a/include/asm-x86_64/tracehook.h
-+++ b/include/asm-x86_64/tracehook.h
-@@ -48,4 +48,12 @@ static inline void tracehook_abort_sysca
- 	regs->orig_rax = -1L;
- }
  
 +/*
 + * These are used directly by some of the regset code.

linux-2.6-utrace-tracehook-ia64.patch:

Index: linux-2.6-utrace-tracehook-ia64.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-tracehook-ia64.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-tracehook-ia64.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-tracehook-ia64.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -8,19 +8,17 @@
 
 ---
 
- arch/ia64/ia32/ia32_entry.S  |    2 -
+ arch/ia64/ia32/ia32_entry.S  |    2 +
  arch/ia64/ia32/sys_ia32.c    |   23 ++-----------
- arch/ia64/kernel/ptrace.c    |   39 +++++-----------------
- arch/ia64/kernel/signal.c    |    4 +-
- include/asm-ia64/tracehook.h |   73 +++++++++++++++++++++++++++++++++++++++++++
+ arch/ia64/kernel/ptrace.c    |   39 ++++++----------------
+ arch/ia64/kernel/signal.c    |    4 ++
+ include/asm-ia64/tracehook.h |   73 ++++++++++++++++++++++++++++++++++++++++++
  5 files changed, 91 insertions(+), 50 deletions(-)
  create include/asm-ia64/tracehook.h
 
-Index: b/arch/ia64/ia32/ia32_entry.S
-===================================================================
---- a/arch/ia64/ia32/ia32_entry.S
-+++ b/arch/ia64/ia32/ia32_entry.S
-@@ -236,7 +236,7 @@ ia32_syscall_table:
+--- linux-2.6/arch/ia64/ia32/ia32_entry.S
++++ linux-2.6/arch/ia64/ia32/ia32_entry.S
+@@ -199,7 +199,7 @@ ia32_syscall_table:
  	data8 sys_setuid	/* 16-bit version */
  	data8 sys_getuid	/* 16-bit version */
  	data8 compat_sys_stime    /* 25 */
@@ -29,10 +27,8 @@
  	data8 sys32_alarm
  	data8 sys_ni_syscall
  	data8 sys32_pause
-Index: b/arch/ia64/ia32/sys_ia32.c
-===================================================================
---- a/arch/ia64/ia32/sys_ia32.c
-+++ b/arch/ia64/ia32/sys_ia32.c
+--- linux-2.6/arch/ia64/ia32/sys_ia32.c
++++ linux-2.6/arch/ia64/ia32/sys_ia32.c
 @@ -1436,25 +1436,6 @@ sys32_waitpid (int pid, unsigned int *st
  	return compat_sys_wait4(pid, stat_addr, options, NULL);
  }
@@ -87,10 +83,8 @@
  
  typedef struct {
  	unsigned int	ss_sp;
-Index: b/arch/ia64/kernel/ptrace.c
-===================================================================
---- a/arch/ia64/kernel/ptrace.c
-+++ b/arch/ia64/kernel/ptrace.c
+--- linux-2.6/arch/ia64/kernel/ptrace.c
++++ linux-2.6/arch/ia64/kernel/ptrace.c
 @@ -12,6 +12,7 @@
  #include <linux/mm.h>
  #include <linux/errno.h>
@@ -99,7 +93,7 @@
  #include <linux/smp_lock.h>
  #include <linux/user.h>
  #include <linux/security.h>
-@@ -1598,28 +1599,6 @@ sys_ptrace (long request, pid_t pid, uns
+@@ -1601,28 +1602,6 @@ sys_ptrace (long request, pid_t pid, uns
  	return ret;
  }
  
@@ -128,7 +122,7 @@
  /* "asmlinkage" so the input arguments are preserved... */
  
  asmlinkage void
-@@ -1627,9 +1606,8 @@ syscall_trace_enter (long arg0, long arg
+@@ -1630,9 +1609,8 @@ syscall_trace_enter (long arg0, long arg
  		     long arg4, long arg5, long arg6, long arg7,
  		     struct pt_regs regs)
  {
@@ -140,7 +134,7 @@
  
  	if (unlikely(current->audit_context)) {
  		long syscall;
-@@ -1664,8 +1642,11 @@ syscall_trace_leave (long arg0, long arg
+@@ -1667,8 +1645,11 @@ syscall_trace_leave (long arg0, long arg
  		audit_syscall_exit(success, result);
  	}
  
@@ -156,10 +150,8 @@
 +		tracehook_report_syscall_step(&regs);
 +	}
  }
-Index: b/arch/ia64/kernel/signal.c
-===================================================================
---- a/arch/ia64/kernel/signal.c
-+++ b/arch/ia64/kernel/signal.c
+--- linux-2.6/arch/ia64/kernel/signal.c
++++ linux-2.6/arch/ia64/kernel/signal.c
 @@ -10,7 +10,7 @@
  #include <linux/errno.h>
  #include <linux/kernel.h>
@@ -169,7 +161,7 @@
  #include <linux/sched.h>
  #include <linux/signal.h>
  #include <linux/smp.h>
-@@ -471,6 +471,8 @@ handle_signal (unsigned long sig, struct
+@@ -421,6 +421,8 @@ handle_signal (unsigned long sig, struct
  		sigaddset(&current->blocked, sig);
  	recalc_sigpending();
  	spin_unlock_irq(&current->sighand->siglock);
@@ -178,10 +170,8 @@
  	return 1;
  }
  
-Index: b/include/asm-ia64/tracehook.h
-===================================================================
---- /dev/null
-+++ b/include/asm-ia64/tracehook.h
+--- linux-2.6/include/asm-ia64/tracehook.h
++++ linux-2.6/include/asm-ia64/tracehook.h
 @@ -0,0 +1,73 @@
 +/*
 + * Copyright (C)2006 Intel Co

linux-2.6-utrace-tracehook-s390.patch:

Index: linux-2.6-utrace-tracehook-s390.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-tracehook-s390.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-tracehook-s390.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-tracehook-s390.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -7,18 +7,16 @@
 
 ---
 
+ arch/s390/kernel/traps.c         |    6 ++--
  arch/s390/kernel/compat_signal.c |    5 ++-
- arch/s390/kernel/ptrace.c        |   62 +++++++++++++++++++++------------------
- arch/s390/kernel/signal.c        |    3 +
- arch/s390/kernel/traps.c         |    6 +--
+ arch/s390/kernel/ptrace.c        |   62 +++++++++++++++++++++-----------------
+ arch/s390/kernel/signal.c        |    3 ++
  include/asm-s390/tracehook.h     |   46 ++++++++++++++++++++++++++++
  5 files changed, 90 insertions(+), 32 deletions(-)
  create include/asm-s390/tracehook.h
 
-Index: b/arch/s390/kernel/traps.c
-===================================================================
---- a/arch/s390/kernel/traps.c
-+++ b/arch/s390/kernel/traps.c
+--- linux-2.6/arch/s390/kernel/traps.c
++++ linux-2.6/arch/s390/kernel/traps.c
 @@ -18,7 +18,7 @@
  #include <linux/kernel.h>
  #include <linux/string.h>
@@ -28,7 +26,7 @@
  #include <linux/timer.h>
  #include <linux/mm.h>
  #include <linux/smp.h>
-@@ -360,7 +360,7 @@ void __kprobes do_single_step(struct pt_
+@@ -340,7 +340,7 @@ void __kprobes do_single_step(struct pt_
  					SIGTRAP) == NOTIFY_STOP){
  		return;
  	}
@@ -37,7 +35,7 @@
  		force_sig(SIGTRAP, current);
  }
  
-@@ -461,7 +461,7 @@ static void illegal_op(struct pt_regs * 
+@@ -441,7 +441,7 @@ static void illegal_op(struct pt_regs * 
  		if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
  			return;
  		if (*((__u16 *) opcode) == S390_BREAKPOINT_U16) {
@@ -46,11 +44,9 @@
  				force_sig(SIGTRAP, current);
  			else
  				signal = SIGILL;
-Index: b/arch/s390/kernel/compat_signal.c
-===================================================================
---- a/arch/s390/kernel/compat_signal.c
-+++ b/arch/s390/kernel/compat_signal.c
-@@ -28,6 +28,7 @@
+--- linux-2.6/arch/s390/kernel/compat_signal.c
++++ linux-2.6/arch/s390/kernel/compat_signal.c
+@@ -27,6 +27,7 @@
  #include <asm/ucontext.h>
  #include <asm/uaccess.h>
  #include <asm/lowcore.h>
@@ -58,7 +54,7 @@
  #include "compat_linux.h"
  #include "compat_ptrace.h"
  
-@@ -579,7 +580,9 @@ handle_signal32(unsigned long sig, struc
+@@ -580,7 +581,9 @@ handle_signal32(unsigned long sig, struc
  			sigaddset(&current->blocked,sig);
  		recalc_sigpending();
  		spin_unlock_irq(&current->sighand->siglock);
@@ -69,10 +65,8 @@
  	return ret;
  }
 -
-Index: b/arch/s390/kernel/ptrace.c
-===================================================================
---- a/arch/s390/kernel/ptrace.c
-+++ b/arch/s390/kernel/ptrace.c
+--- linux-2.6/arch/s390/kernel/ptrace.c
++++ linux-2.6/arch/s390/kernel/ptrace.c
 @@ -29,6 +29,7 @@
  #include <linux/smp_lock.h>
  #include <linux/errno.h>
@@ -128,7 +122,7 @@
  }
  
  #ifndef CONFIG_64BIT
-@@ -593,6 +611,7 @@ do_ptrace_emu31(struct task_struct *chil
+@@ -586,6 +604,7 @@ do_ptrace_emu31(struct task_struct *chil
  			copied += sizeof(unsigned int);
  		}
  		return 0;
@@ -136,7 +130,7 @@
  	case PTRACE_GETEVENTMSG:
  		return put_user((__u32) child->ptrace_message,
  				(unsigned int __force __user *) data);
-@@ -658,7 +677,7 @@ do_ptrace(struct task_struct *child, lon
+@@ -651,7 +670,7 @@ do_ptrace(struct task_struct *child, lon
  			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
  		child->exit_code = data;
  		/* make sure the single step bit is not set. */
@@ -145,7 +139,7 @@
  		wake_up_process(child);
  		return 0;
  
-@@ -672,7 +691,7 @@ do_ptrace(struct task_struct *child, lon
+@@ -665,7 +684,7 @@ do_ptrace(struct task_struct *child, lon
  			return 0;
  		child->exit_code = SIGKILL;
  		/* make sure the single step bit is not set. */
@@ -154,7 +148,7 @@
  		wake_up_process(child);
  		return 0;
  
-@@ -685,7 +704,7 @@ do_ptrace(struct task_struct *child, lon
+@@ -678,7 +697,7 @@ do_ptrace(struct task_struct *child, lon
  		if (data)
  			set_tsk_thread_flag(child, TIF_SINGLE_STEP);
  		else
@@ -163,7 +157,7 @@
  		/* give it a chance to run. */
  		wake_up_process(child);
  		return 0;
-@@ -738,30 +757,17 @@ syscall_trace(struct pt_regs *regs, int 
+@@ -726,30 +745,17 @@ syscall_trace(struct pt_regs *regs, int 
  	if (unlikely(current->audit_context) && entryexit)
  		audit_syscall_exit(AUDITSC_RESULT(regs->gprs[2]), regs->gprs[2]);
  
@@ -203,11 +197,9 @@
  	if (unlikely(current->audit_context) && !entryexit)
  		audit_syscall_entry(test_thread_flag(TIF_31BIT)?AUDIT_ARCH_S390:AUDIT_ARCH_S390X,
  				    regs->gprs[2], regs->orig_gpr2, regs->gprs[3],
-Index: b/arch/s390/kernel/signal.c
-===================================================================
---- a/arch/s390/kernel/signal.c
-+++ b/arch/s390/kernel/signal.c
-@@ -25,6 +25,7 @@
+--- linux-2.6/arch/s390/kernel/signal.c
++++ linux-2.6/arch/s390/kernel/signal.c
+@@ -24,6 +24,7 @@
  #include <linux/tty.h>
  #include <linux/personality.h>
  #include <linux/binfmts.h>
@@ -215,7 +207,7 @@
  #include <asm/ucontext.h>
  #include <asm/uaccess.h>
  #include <asm/lowcore.h>
-@@ -395,6 +396,8 @@ handle_signal(unsigned long sig, struct 
+@@ -396,6 +397,8 @@ handle_signal(unsigned long sig, struct 
  			sigaddset(&current->blocked,sig);
  		recalc_sigpending();
  		spin_unlock_irq(&current->sighand->siglock);
@@ -224,10 +216,8 @@
  	}
  
  	return ret;
-Index: b/include/asm-s390/tracehook.h
-===================================================================
---- /dev/null
-+++ b/include/asm-s390/tracehook.h
+--- linux-2.6/include/asm-s390/tracehook.h
++++ linux-2.6/include/asm-s390/tracehook.h
 @@ -0,0 +1,46 @@
 +/*
 + * Tracing hooks, s390/s390x support.

linux-2.6-utrace-tracehook-sparc64.patch:

Index: linux-2.6-utrace-tracehook-sparc64.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-tracehook-sparc64.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-tracehook-sparc64.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-tracehook-sparc64.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -7,18 +7,16 @@
 
 ---
 
- arch/sparc64/kernel/entry.S     |    6 ------
- arch/sparc64/kernel/ptrace.c    |   29 +++++++++--------------------
+ arch/sparc64/kernel/ptrace.c    |   29 +++++++++-------------------
  arch/sparc64/kernel/signal.c    |    2 ++
  arch/sparc64/kernel/signal32.c  |    2 ++
- include/asm-sparc64/tracehook.h |   40 ++++++++++++++++++++++++++++++++++++++++
+ arch/sparc64/kernel/entry.S     |    6 ------
+ include/asm-sparc64/tracehook.h |   40 +++++++++++++++++++++++++++++++++++++++
  5 files changed, 53 insertions(+), 26 deletions(-)
  create include/asm-sparc64/tracehook.h
 
-Index: b/arch/sparc64/kernel/ptrace.c
-===================================================================
---- a/arch/sparc64/kernel/ptrace.c
-+++ b/arch/sparc64/kernel/ptrace.c
+--- linux-2.6/arch/sparc64/kernel/ptrace.c
++++ linux-2.6/arch/sparc64/kernel/ptrace.c
 @@ -22,6 +22,7 @@
  #include <linux/seccomp.h>
  #include <linux/audit.h>
@@ -95,19 +93,17 @@
  	if (unlikely(current->audit_context) && !syscall_exit_p)
  		audit_syscall_entry((test_thread_flag(TIF_32BIT) ?
  				     AUDIT_ARCH_SPARC :
-Index: b/arch/sparc64/kernel/signal.c
-===================================================================
---- a/arch/sparc64/kernel/signal.c
-+++ b/arch/sparc64/kernel/signal.c
-@@ -23,6 +23,7 @@
- #include <linux/smp_lock.h>
+--- linux-2.6/arch/sparc64/kernel/signal.c
++++ linux-2.6/arch/sparc64/kernel/signal.c
+@@ -22,6 +22,7 @@
+ #include <linux/tty.h>
  #include <linux/binfmts.h>
  #include <linux/bitops.h>
 +#include <linux/tracehook.h>
  
  #include <asm/uaccess.h>
  #include <asm/ptrace.h>
-@@ -491,6 +492,7 @@ static inline void handle_signal(unsigne
+@@ -481,6 +482,7 @@ static inline void handle_signal(unsigne
  		sigaddset(&current->blocked,signr);
  	recalc_sigpending();
  	spin_unlock_irq(&current->sighand->siglock);
@@ -115,11 +111,9 @@
  }
  
  static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
-Index: b/arch/sparc64/kernel/signal32.c
-===================================================================
---- a/arch/sparc64/kernel/signal32.c
-+++ b/arch/sparc64/kernel/signal32.c
-@@ -21,6 +21,7 @@
+--- linux-2.6/arch/sparc64/kernel/signal32.c
++++ linux-2.6/arch/sparc64/kernel/signal32.c
+@@ -20,6 +20,7 @@
  #include <linux/binfmts.h>
  #include <linux/compat.h>
  #include <linux/bitops.h>
@@ -127,7 +121,7 @@
  
  #include <asm/uaccess.h>
  #include <asm/ptrace.h>
-@@ -1237,6 +1238,7 @@ static inline void handle_signal32(unsig
+@@ -1236,6 +1237,7 @@ static inline void handle_signal32(unsig
  		sigaddset(&current->blocked,signr);
  	recalc_sigpending();
  	spin_unlock_irq(&current->sighand->siglock);
@@ -135,10 +129,8 @@
  }
  
  static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs,
-Index: b/arch/sparc64/kernel/entry.S
-===================================================================
---- a/arch/sparc64/kernel/entry.S
-+++ b/arch/sparc64/kernel/entry.S
+--- linux-2.6/arch/sparc64/kernel/entry.S
++++ linux-2.6/arch/sparc64/kernel/entry.S
 @@ -1434,7 +1434,6 @@ execve_merge:
  
  	.globl	sys_pipe, sys_sigpause, sys_nis_syscall
@@ -159,10 +151,8 @@
  1:		ldx		[%curptr + TI_FLAGS], %l5
  		andcc		%l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
  		be,pt		%icc, rtrap
-Index: b/include/asm-sparc64/tracehook.h
-===================================================================
---- /dev/null
-+++ b/include/asm-sparc64/tracehook.h
+--- linux-2.6/include/asm-sparc64/tracehook.h
++++ linux-2.6/include/asm-sparc64/tracehook.h
 @@ -0,0 +1,40 @@
 +/*
 + * Tracing hooks, SPARC64 CPU support

linux-2.6-utrace-tracehook-um.patch:

Index: linux-2.6-utrace-tracehook-um.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-tracehook-um.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-tracehook-um.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-tracehook-um.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -19,294 +19,30 @@
 
 ---
 
- arch/um/kernel/exec.c           |    1 
- arch/um/kernel/process.c        |    6 
- arch/um/kernel/ptrace.c         |  327 ++++------------------------------------
- arch/um/kernel/signal.c         |    5 
- arch/um/kernel/skas/syscall.c   |    4 
- arch/um/sys-i386/signal.c       |    4 
- include/asm-um/ptrace-generic.h |    3 
- include/asm-um/ptrace-i386.h    |    2 
- include/asm-um/ptrace-x86_64.h  |    2 
- include/asm-um/thread_info.h    |    3 
- include/asm-um/tracehook.h      |   57 ++++++
- 11 files changed, 106 insertions(+), 308 deletions(-)
+ arch/um/kernel/ptrace.c        |   55 ++++++++++++++-------------------------
+ arch/um/kernel/skas/syscall.c  |    2 -
+ arch/um/kernel/signal.c        |    5 +++-
+ arch/um/kernel/exec.c          |    1 -
+ arch/um/kernel/process.c       |    2 +
+ arch/um/sys-i386/signal.c      |    4 ---
+ include/asm-um/ptrace-x86_64.h |    2 +
+ include/asm-um/ptrace-i386.h   |    2 +
+ include/asm-um/tracehook.h     |   57 ++++++++++++++++++++++++++++++++++++++++
+ include/asm-um/thread_info.h   |    3 ++
+ 10 files changed, 89 insertions(+), 44 deletions(-)
  create include/asm-um/tracehook.h
 
-Index: b/arch/um/kernel/ptrace.c
-===================================================================
---- a/arch/um/kernel/ptrace.c
-+++ b/arch/um/kernel/ptrace.c
-@@ -3,261 +3,21 @@
-  * Licensed under the GPL
-  */
- 
--#include "linux/sched.h"
--#include "linux/mm.h"
--#include "linux/errno.h"
--#include "linux/smp_lock.h"
--#include "linux/security.h"
--#include "linux/ptrace.h"
--#include "linux/audit.h"
--#ifdef CONFIG_PROC_MM
--#include "linux/proc_mm.h"
--#endif
--#include "asm/ptrace.h"
--#include "asm/uaccess.h"
--#include "kern_util.h"
--#include "skas_ptrace.h"
--#include "sysdep/ptrace.h"
--#include "os.h"
--
--static inline void set_singlestepping(struct task_struct *child, int on)
--{
--        if (on)
--                child->ptrace |= PT_DTRACE;
--        else
--                child->ptrace &= ~PT_DTRACE;
--        child->thread.singlestep_syscall = 0;
--
--#ifdef SUBARCH_SET_SINGLESTEPPING
--        SUBARCH_SET_SINGLESTEPPING(child, on);
--#endif
--}
-+#include <linux/audit.h>
-+#include <linux/elf.h>
-+#include <linux/module.h>
-+#include <linux/ptrace.h>
-+#include <linux/tracehook.h>
- 
- /*
-  * Called by kernel/ptrace.c when detaching..
-  */
- void ptrace_disable(struct task_struct *child)
- { 
--        set_singlestepping(child,0);
--}
--
--extern int peek_user(struct task_struct * child, long addr, long data);
--extern int poke_user(struct task_struct * child, long addr, long data);
--
--long arch_ptrace(struct task_struct *child, long request, long addr, long data)
--{
--	int i, ret;
--	unsigned long __user *p = (void __user *)(unsigned long)data;
--
--	switch (request) {
--		/* when I and D space are separate, these will need to be fixed. */
--	case PTRACE_PEEKTEXT: /* read word at location addr. */ 
--	case PTRACE_PEEKDATA: {
--		unsigned long tmp;
--		int copied;
--
--		ret = -EIO;
--		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
--		if (copied != sizeof(tmp))
--			break;
--		ret = put_user(tmp, p);
--		break;
--	}
--
--	/* read the word at location addr in the USER area. */
--        case PTRACE_PEEKUSR:
--                ret = peek_user(child, addr, data);
--                break;
--
--	/* when I and D space are separate, this will have to be fixed. */
--	case PTRACE_POKETEXT: /* write the word at location addr. */
--	case PTRACE_POKEDATA:
--		ret = -EIO;
--		if (access_process_vm(child, addr, &data, sizeof(data), 
--				      1) != sizeof(data))
--			break;
--		ret = 0;
--		break;
--
--	case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
--                ret = poke_user(child, addr, data);
--                break;
--
--	case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
--	case PTRACE_CONT: { /* restart after signal. */
--		ret = -EIO;
--		if (!valid_signal(data))
--			break;
--
--                set_singlestepping(child, 0);
--		if (request == PTRACE_SYSCALL) {
--			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
--		}
--		else {
--			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
--		}
--		child->exit_code = data;
--		wake_up_process(child);
--		ret = 0;
--		break;
--	}
--
--/*
-- * make the child exit.  Best I can do is send it a sigkill. 
-- * perhaps it should be put in the status that it wants to 
-- * exit.
-- */
--	case PTRACE_KILL: {
--		ret = 0;
--		if (child->exit_state == EXIT_ZOMBIE)	/* already dead */
--			break;
--
--                set_singlestepping(child, 0);
--		child->exit_code = SIGKILL;
--		wake_up_process(child);
--		break;
--	}
--
--	case PTRACE_SINGLESTEP: {  /* set the trap flag. */
--		ret = -EIO;
--		if (!valid_signal(data))
--			break;
--		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
--                set_singlestepping(child, 1);
--		child->exit_code = data;
--		/* give it a chance to run. */
--		wake_up_process(child);
--		ret = 0;
--		break;
--	}
--
--	case PTRACE_DETACH:
--		/* detach a process that was attached. */
--		ret = ptrace_detach(child, data);
-- 		break;
--
--#ifdef PTRACE_GETREGS
--	case PTRACE_GETREGS: { /* Get all gp regs from the child. */
--		if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) {
--			ret = -EIO;
--			break;
--		}
--		for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
--			__put_user(getreg(child, i), p);
--			p++;
--		}
--		ret = 0;
--		break;
--	}
--#endif
--#ifdef PTRACE_SETREGS
--	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
--		unsigned long tmp = 0;
--		if (!access_ok(VERIFY_READ, p, MAX_REG_OFFSET)) {
--			ret = -EIO;
--			break;
--		}
--		for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
--			__get_user(tmp, p);
--			putreg(child, i, tmp);
--			p++;
--		}
--		ret = 0;
--		break;
--	}
--#endif
--#ifdef PTRACE_GETFPREGS
--	case PTRACE_GETFPREGS: /* Get the child FPU state. */
--		ret = get_fpregs(data, child);
--		break;
--#endif
--#ifdef PTRACE_SETFPREGS
--	case PTRACE_SETFPREGS: /* Set the child FPU state. */
--	        ret = set_fpregs(data, child);
--		break;
--#endif
--#ifdef PTRACE_GETFPXREGS
--	case PTRACE_GETFPXREGS: /* Get the child FPU state. */
--		ret = get_fpxregs(data, child);
--		break;
--#endif
--#ifdef PTRACE_SETFPXREGS
--	case PTRACE_SETFPXREGS: /* Set the child FPU state. */
--		ret = set_fpxregs(data, child);
--		break;
--#endif
--	case PTRACE_GET_THREAD_AREA:
--		ret = ptrace_get_thread_area(child, addr,
--					     (struct user_desc __user *) data);
--		break;
--
--	case PTRACE_SET_THREAD_AREA:
--		ret = ptrace_set_thread_area(child, addr,
--					     (struct user_desc __user *) data);
--		break;
--
--	case PTRACE_FAULTINFO: {
--		/* Take the info from thread->arch->faultinfo,
--		 * but transfer max. sizeof(struct ptrace_faultinfo).
--		 * On i386, ptrace_faultinfo is smaller!
--		 */
--		ret = copy_to_user(p, &child->thread.arch.faultinfo,
--				   sizeof(struct ptrace_faultinfo));
--		if(ret)
--			break;
--		break;
--	}
--
--#ifdef PTRACE_LDT
--	case PTRACE_LDT: {
--		struct ptrace_ldt ldt;
--
--		if(copy_from_user(&ldt, p, sizeof(ldt))){
--			ret = -EIO;
--			break;
--		}
--
--		/* This one is confusing, so just punt and return -EIO for 
--		 * now
--		 */
--		ret = -EIO;
--		break;
--	}
--#endif
--#ifdef CONFIG_PROC_MM
--	case PTRACE_SWITCH_MM: {
--		struct mm_struct *old = child->mm;
--		struct mm_struct *new = proc_mm_get_mm(data);
--
--		if(IS_ERR(new)){
--			ret = PTR_ERR(new);
--			break;
--		}
--
--		atomic_inc(&new->mm_users);
--		child->mm = new;
--		child->active_mm = new;
--		mmput(old);
--		ret = 0;
--		break;
--	}
--#endif
--#ifdef PTRACE_ARCH_PRCTL
--        case PTRACE_ARCH_PRCTL:
--                /* XXX Calls ptrace on the host - needs some SMP thinking */
--                ret = arch_prctl_skas(child, data, (void *) addr);
--                break;
--#endif
--	default:
--		ret = ptrace_request(child, request, addr, data);
--		break;
--	}
--
--	return ret;
- }
+--- linux-2.6/arch/um/kernel/ptrace.c
++++ linux-2.6/arch/um/kernel/ptrace.c
+@@ -5,6 +5,7 @@
  
--void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs,
--		  int error_code)
-+static void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
-+			 int error_code)
- {
- 	struct siginfo info;
- 
-@@ -266,56 +26,39 @@ void send_sigtrap(struct task_struct *ts
+ #include "linux/audit.h"
+ #include "linux/ptrace.h"
++#include "linux/tracehook.h"
+ #include "linux/sched.h"
+ #include "asm/uaccess.h"
+ #ifdef CONFIG_PROC_MM
+@@ -235,20 +236,18 @@ void send_sigtrap(struct task_struct *ts
  	info.si_code = TRAP_BRKPT;
  
  	/* User-mode eip? */
@@ -314,33 +50,28 @@
 +	info.si_addr = UPT_IS_USER(&regs->regs) ?
 +		(void __user *) UPT_IP(&regs->regs) : NULL;
  
- 	/* Send us the fakey SIGTRAP */
+ 	/* Send us the fake SIGTRAP */
  	force_sig_info(SIGTRAP, &info, tsk);
  }
  
--/* XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
+-/*
+- * XXX Check PT_DTRACE vs TIF_SINGLESTEP for singlestepping check and
 - * PT_PTRACED vs TIF_SYSCALL_TRACE for syscall tracing check
-+/* notification of system call entry/exit
-+ * - triggered by current->work.syscall_trace
-  */
--void syscall_trace(union uml_pt_regs *regs, int entryexit)
-+void do_syscall_trace(struct pt_regs *regs, int entryexit)
+- */
+ void syscall_trace(struct uml_pt_regs *regs, int entryexit)
  {
 -	int is_singlestep = (current->ptrace & PT_DTRACE) && entryexit;
 -	int tracesysgood;
--
--	if (unlikely(current->audit_context)) {
--		if (!entryexit)
--			audit_syscall_entry(HOST_AUDIT_ARCH,
--					    UPT_SYSCALL_NR(regs),
--					    UPT_SYSCALL_ARG1(regs),
--					    UPT_SYSCALL_ARG2(regs),
--					    UPT_SYSCALL_ARG3(regs),
--					    UPT_SYSCALL_ARG4(regs));
--		else audit_syscall_exit(AUDITSC_RESULT(UPT_SYSCALL_RET(regs)),
--                                        UPT_SYSCALL_RET(regs));
--	}
--
++	/* do the secure computing check first */
++	if (!entryexit)
++		secure_computing(PT_REGS_SYSCALL_NR(regs));
+ 
+ 	if (unlikely(current->audit_context)) {
+ 		if (!entryexit)
+@@ -262,33 +261,19 @@ void syscall_trace(struct uml_pt_regs *r
+ 					UPT_SYSCALL_RET(regs));
+ 	}
+ 
 -	/* Fake a debug trap */
 -	if (is_singlestep)
 -		send_sigtrap(current, regs, 0);
@@ -351,37 +82,31 @@
 -	if (!(current->ptrace & PT_PTRACED))
 -		return;
 -
--	/* the 0x80 provides a way for the tracing parent to distinguish
--	   between a syscall stop and SIGTRAP delivery */
+-	/*
+-	 * the 0x80 provides a way for the tracing parent to distinguish
+-	 * between a syscall stop and SIGTRAP delivery
+-	 */
 -	tracesysgood = (current->ptrace & PT_TRACESYSGOOD);
 -	ptrace_notify(SIGTRAP | (tracesysgood ? 0x80 : 0));
 -
 -	if (entryexit) /* force do_signal() --> is_syscall() */
 -		set_thread_flag(TIF_SIGPENDING);
 -
--	/* this isn't the same as continuing with a signal, but it will do
+-	/*
+-	 * 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;
--	}
-+	/* do the secure computing check first */
-+	if (!entryexit)
-+		secure_computing(PT_REGS_SYSCALL_NR(regs));
-+
-+	if (unlikely(current->audit_context) && entryexit)
-+		audit_syscall_exit(AUDITSC_RESULT(UPT_SYSCALL_RET(&regs->regs)),
-+				   UPT_SYSCALL_RET(&regs->regs));
-+
 +	if (test_thread_flag(TIF_SYSCALL_TRACE))
 +		tracehook_report_syscall(regs, entryexit);
 +
 +	if (test_thread_flag(TIF_SINGLESTEP) && entryexit) {
 +		send_sigtrap(current, regs, 0);	/* XXX */
 +		tracehook_report_syscall_step(regs);
-+	}
+ 	}
 +
 +	if (unlikely(current->audit_context) && !entryexit)
 +		audit_syscall_entry(HOST_AUDIT_ARCH,
@@ -391,11 +116,9 @@
 +				    UPT_SYSCALL_ARG3(&regs->regs),
 +				    UPT_SYSCALL_ARG4(&regs->regs));
  }
-Index: b/arch/um/kernel/skas/syscall.c
-===================================================================
---- a/arch/um/kernel/skas/syscall.c
-+++ b/arch/um/kernel/skas/syscall.c
-@@ -19,8 +19,6 @@ void handle_syscall(union uml_pt_regs *r
+--- linux-2.6/arch/um/kernel/skas/syscall.c
++++ linux-2.6/arch/um/kernel/skas/syscall.c
+@@ -15,8 +15,6 @@ void handle_syscall(struct uml_pt_regs *
  	long result;
  	int syscall;
  
@@ -404,26 +127,17 @@
  	current->thread.nsyscalls++;
  	nsyscalls++;
  
-@@ -38,6 +36,4 @@ void handle_syscall(union uml_pt_regs *r
- 	else result = EXECUTE_SYSCALL(syscall, regs);
+--- linux-2.6/arch/um/kernel/signal.c
++++ linux-2.6/arch/um/kernel/signal.c
+@@ -5,6 +5,7 @@
  
- 	REGS_SET_SYSCALL_RETURN(r->skas.regs, result);
--
--	syscall_trace(r, 1);
- }
-Index: b/arch/um/kernel/signal.c
-===================================================================
---- a/arch/um/kernel/signal.c
-+++ b/arch/um/kernel/signal.c
-@@ -14,6 +14,7 @@
- #include "linux/tty.h"
- #include "linux/binfmts.h"
+ #include "linux/module.h"
  #include "linux/ptrace.h"
 +#include "linux/tracehook.h"
+ #include "linux/sched.h"
+ #include "asm/siginfo.h"
  #include "asm/signal.h"
- #include "asm/uaccess.h"
- #include "asm/unistd.h"
-@@ -93,6 +94,8 @@ static int handle_signal(struct pt_regs 
+@@ -80,6 +81,8 @@ static int handle_signal(struct pt_regs 
  			sigaddset(&current->blocked, signr);
  		recalc_sigpending();
  		spin_unlock_irq(&current->sighand->siglock);
@@ -432,51 +146,39 @@
  	}
  
  	return err;
-@@ -148,7 +151,7 @@ static int kern_do_signal(struct pt_regs
+@@ -138,7 +141,7 @@ static int kern_do_signal(struct pt_regs
  	 * on the host.  The tracing thread will check this flag and
  	 * PTRACE_SYSCALL if necessary.
  	 */
--	if(current->ptrace & PT_DTRACE)
-+	if(test_thread_flag(TIF_SYSCALL_TRACE))
+-	if (current->ptrace & PT_DTRACE)
++	if (test_thread_flag(TIF_SYSCALL_TRACE))
  		current->thread.singlestep_syscall =
  			is_syscall(PT_REGS_IP(&current->thread.regs));
  
-Index: b/arch/um/kernel/exec.c
-===================================================================
---- a/arch/um/kernel/exec.c
-+++ b/arch/um/kernel/exec.c
-@@ -51,7 +51,6 @@ static long execve1(char *file, char __u
-         error = do_execve(file, argv, env, &current->thread.regs);
-         if (error == 0){
+--- linux-2.6/arch/um/kernel/exec.c
++++ linux-2.6/arch/um/kernel/exec.c
+@@ -61,7 +61,6 @@ static long execve1(char *file, char __u
+ 	error = do_execve(file, argv, env, &current->thread.regs);
+ 	if (error == 0) {
  		task_lock(current);
--                current->ptrace &= ~PT_DTRACE;
+-		current->ptrace &= ~PT_DTRACE;
  #ifdef SUBARCH_EXECVE1
  		SUBARCH_EXECVE1(&current->thread.regs.regs);
  #endif
-Index: b/arch/um/kernel/process.c
-===================================================================
---- a/arch/um/kernel/process.c
-+++ b/arch/um/kernel/process.c
-@@ -458,11 +458,11 @@ int singlestepping(void * t)
+--- linux-2.6/arch/um/kernel/process.c
++++ linux-2.6/arch/um/kernel/process.c
+@@ -435,7 +435,7 @@ int singlestepping(void * t)
  {
  	struct task_struct *task = t ? t : current;
  
 -	if ( ! (task->ptrace & PT_DTRACE) )
--		return(0);
 +	if (!test_thread_flag(TIF_SINGLESTEP))
-+		return 0;
+ 		return 0;
  
  	if (task->thread.singlestep_syscall)
--		return(1);
-+		return 1;
- 
- 	return 2;
- }
-Index: b/arch/um/sys-i386/signal.c
-===================================================================
---- a/arch/um/sys-i386/signal.c
-+++ b/arch/um/sys-i386/signal.c
-@@ -267,8 +267,6 @@ int setup_signal_stack_sc(unsigned long 
+--- linux-2.6/arch/um/sys-i386/signal.c
++++ linux-2.6/arch/um/sys-i386/signal.c
+@@ -378,8 +378,6 @@ int setup_signal_stack_sc(unsigned long 
  	PT_REGS_EDX(regs) = (unsigned long) 0;
  	PT_REGS_ECX(regs) = (unsigned long) 0;
  
@@ -485,7 +187,7 @@
  	return 0;
  
  err:
-@@ -324,8 +322,6 @@ int setup_signal_stack_si(unsigned long 
+@@ -435,8 +433,6 @@ int setup_signal_stack_si(unsigned long 
  	PT_REGS_EDX(regs) = (unsigned long) &frame->info;
  	PT_REGS_ECX(regs) = (unsigned long) &frame->uc;
  
@@ -494,10 +196,8 @@
  	return 0;
  
  err:
-Index: b/include/asm-um/ptrace-x86_64.h
-===================================================================
---- a/include/asm-um/ptrace-x86_64.h
-+++ b/include/asm-um/ptrace-x86_64.h
+--- linux-2.6/include/asm-um/ptrace-x86_64.h
++++ linux-2.6/include/asm-um/ptrace-x86_64.h
 @@ -14,6 +14,8 @@
  #define __FRAME_OFFSETS /* Needed to get the R* macros */
  #include "asm/ptrace-generic.h"
@@ -507,24 +207,8 @@
  #define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
  
  /* Also defined in sysdep/ptrace.h, so may already be defined. */
-Index: b/include/asm-um/ptrace-generic.h
-===================================================================
---- a/include/asm-um/ptrace-generic.h
-+++ b/include/asm-um/ptrace-generic.h
-@@ -44,9 +44,6 @@ extern int set_fpxregs(unsigned long buf
- 
- extern void show_regs(struct pt_regs *regs);
- 
--extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs,
--			 int error_code);
--
- extern int arch_copy_tls(struct task_struct *new);
- extern void clear_flushed_tls(struct task_struct *task);
- 
-Index: b/include/asm-um/ptrace-i386.h
-===================================================================
---- a/include/asm-um/ptrace-i386.h
-+++ b/include/asm-um/ptrace-i386.h
+--- linux-2.6/include/asm-um/ptrace-i386.h
++++ linux-2.6/include/asm-um/ptrace-i386.h
 @@ -6,6 +6,8 @@
  #ifndef __UM_PTRACE_I386_H
  #define __UM_PTRACE_I386_H
@@ -534,10 +218,8 @@
  #define HOST_AUDIT_ARCH AUDIT_ARCH_I386
  
  #include "linux/compiler.h"
-Index: b/include/asm-um/tracehook.h
-===================================================================
---- /dev/null
-+++ b/include/asm-um/tracehook.h
+--- linux-2.6/include/asm-um/tracehook.h
++++ linux-2.6/include/asm-um/tracehook.h
 @@ -0,0 +1,57 @@
 +/*
 + * Tracing hooks, i386 CPU support
@@ -596,11 +278,9 @@
 +
 +
 +#endif
-Index: b/include/asm-um/thread_info.h
-===================================================================
---- a/include/asm-um/thread_info.h
-+++ b/include/asm-um/thread_info.h
-@@ -69,6 +69,8 @@ static inline struct thread_info *curren
+--- linux-2.6/include/asm-um/thread_info.h
++++ linux-2.6/include/asm-um/thread_info.h
+@@ -82,6 +82,8 @@ static inline struct thread_info *curren
  #define TIF_MEMDIE	 	5
  #define TIF_SYSCALL_AUDIT	6
  #define TIF_RESTORE_SIGMASK	7
@@ -609,7 +289,7 @@
  
  #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
  #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
-@@ -77,5 +79,6 @@ static inline struct thread_info *curren
+@@ -90,5 +92,6 @@ static inline struct thread_info *curren
  #define _TIF_MEMDIE		(1 << TIF_MEMDIE)
  #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
  #define _TIF_RESTORE_SIGMASK	(1 << TIF_RESTORE_SIGMASK)

linux-2.6-utrace-tracehook.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.2.8.1 linux-2.6-utrace-tracehook.patch
Index: linux-2.6-utrace-tracehook.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-utrace-tracehook.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-utrace-tracehook.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-utrace-tracehook.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -33,87 +33,82 @@
 
 ---
 
- arch/alpha/kernel/asm-offsets.c     |    2 
- arch/alpha/kernel/entry.S           |    4 
- arch/arm/kernel/ptrace.c            |   17 -
- arch/arm26/kernel/ptrace.c          |   32 --
+ fs/binfmt_flat.c                    |    3 
+ fs/binfmt_som.c                     |    2 
+ fs/proc/base.c                      |   17 +
+ fs/proc/array.c                     |   10 +
+ fs/binfmt_elf_fdpic.c               |    7 -
+ fs/exec.c                           |   11 -
+ fs/binfmt_elf.c                     |   10 -
+ fs/binfmt_aout.c                    |    6 -
+ security/selinux/hooks.c            |   54 +++--
+ security/selinux/include/objsec.h   |    1 
+ arch/s390/kernel/compat_linux.c     |    3 
+ arch/s390/kernel/process.c          |    3 
  arch/frv/kernel/ptrace.c            |   15 -
- arch/i386/kernel/entry.S            |    7 
- arch/i386/kernel/process.c          |    3 
- arch/i386/kernel/ptrace.c           |  104 +--------
- arch/i386/kernel/signal.c           |   37 +--
- arch/i386/kernel/vm86.c             |    7 
- arch/i386/math-emu/fpu_entry.c      |    6 
- arch/ia64/kernel/asm-offsets.c      |    2 
- arch/ia64/kernel/fsys.S             |   16 -
- arch/ia64/kernel/mca.c              |    2 
- arch/mips/kernel/ptrace.c           |   21 -
+ arch/arm/kernel/ptrace.c            |   17 -
  arch/mips/kernel/sysirix.c          |    2 
+ arch/mips/kernel/ptrace.c           |   23 --
+ arch/powerpc/kernel/sys_ppc32.c     |    5 
+ arch/powerpc/kernel/ptrace32.c      |    7 +
+ arch/powerpc/kernel/ptrace.c        |   49 +---
+ arch/powerpc/kernel/signal.c        |    3 
  arch/powerpc/kernel/asm-offsets.c   |    2 
  arch/powerpc/kernel/process.c       |    5 
- arch/powerpc/kernel/ptrace-common.h |   16 -
- arch/powerpc/kernel/ptrace.c        |   74 +-----
- arch/powerpc/kernel/ptrace32.c      |   13 -
- arch/powerpc/kernel/signal_32.c     |    3 
- arch/powerpc/kernel/signal_64.c     |    3 
- arch/powerpc/kernel/sys_ppc32.c     |    5 
- arch/ppc/kernel/asm-offsets.c       |    2 
- arch/s390/kernel/compat_linux.c     |    3 
- arch/s390/kernel/process.c          |    3 
+ arch/x86/math-emu/fpu_entry.c       |    6 -
+ arch/x86/ia32/sys_ia32.c            |    5 
+ arch/x86/ia32/ptrace32.c            |    2 
+ arch/x86/ia32/ia32_aout.c           |    6 -
+ arch/x86/ia32/ia32_signal.c         |    7 -
+ arch/x86/ia32/ia32entry.S           |    4 
+ arch/x86/kernel/vm86_32.c           |    7 -
+ arch/x86/kernel/process_64.c        |    5 
+ arch/x86/kernel/process_32.c        |    3 
+ arch/x86/kernel/entry_32.S          |    7 -
+ arch/x86/kernel/signal_64.c         |   28 +-
+ arch/x86/kernel/entry_64.S          |    8 -
+ arch/x86/kernel/ptrace_32.c         |  103 ++-------
+ arch/x86/kernel/traps_64.c          |    8 -
+ arch/x86/kernel/ptrace_64.c         |   57 ++---
+ arch/x86/kernel/signal_32.c         |   37 +--
+ arch/x86/mm/fault_64.c              |    2 
+ arch/alpha/kernel/asm-offsets.c     |    2 
+ arch/alpha/kernel/entry.S           |    4 
  arch/sparc64/kernel/binfmt_aout32.c |    2 
  arch/sparc64/kernel/process.c       |    3 
  arch/sparc64/kernel/sys_sparc32.c   |    3 
- arch/x86_64/ia32/ia32_aout.c        |    6 
- arch/x86_64/ia32/ia32_signal.c      |    7 
- arch/x86_64/ia32/ia32entry.S        |    4 
- arch/x86_64/ia32/ptrace32.c         |    2 
- arch/x86_64/ia32/sys_ia32.c         |    5 
- arch/x86_64/kernel/entry.S          |    8 
- arch/x86_64/kernel/process.c        |    5 
- arch/x86_64/kernel/ptrace.c         |   57 +---
- arch/x86_64/kernel/signal.c         |   28 +-
- arch/x86_64/kernel/traps.c          |    8 
- arch/x86_64/mm/fault.c              |    4 
- drivers/connector/cn_proc.c         |    4 
- 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                           |   11 
- fs/proc/array.c                     |   12 -
- fs/proc/base.c                      |   17 -
- include/asm-i386/signal.h           |    4 
- include/asm-i386/thread_info.h      |    7 
- include/asm-i386/tracehook.h        |   52 ++++
- include/asm-powerpc/tracehook.h     |   74 ++++++
- include/asm-x86_64/thread_info.h    |    3 
- include/asm-x86_64/tracehook.h      |   51 ++++
- include/linux/init_task.h           |    3 
- include/linux/ptrace.h              |   18 -
- include/linux/sched.h               |   16 -
- include/linux/tracehook.h           |  415 ++++++++++++++++++++++++++++++++++++
- kernel/exit.c                       |  243 +++++----------------
- kernel/fork.c                       |   66 +----
- kernel/ptrace.c                     |  299 +------------------------
- kernel/signal.c                     |  211 +++---------------
- kernel/sys.c                        |    2 
- kernel/timer.c                      |    6 
+ arch/ppc/kernel/asm-offsets.c       |    2 
+ arch/ia64/kernel/mca.c              |    2 
+ arch/ia64/kernel/asm-offsets.c      |    2 
+ arch/ia64/kernel/fsys.S             |   16 +
+ kernel/exit.c                       |  238 +++++---------------
+ kernel/sched.c                      |    2 
+ kernel/ptrace.c                     |  307 +-------------------------
+ kernel/timer.c                      |    6 -
+ kernel/signal.c                     |  210 ++++--------------
+ kernel/acct.c                       |    2 
  kernel/tsacct.c                     |    2 
+ kernel/sys.c                        |    2 
+ kernel/fork.c                       |   67 ++----
+ include/linux/ptrace.h              |   18 --
+ include/linux/sched.h               |   16 -
+ include/linux/init_task.h           |    3 
+ include/linux/tracehook.h           |  414 +++++++++++++++++++++++++++++++++++
+ include/asm-powerpc/tracehook.h     |   49 ++++
+ include/asm-x86/thread_info_32.h    |    7 -
+ include/asm-x86/thread_info_64.h    |    3 
+ include/asm-x86/tracehook.h         |   63 +++++
+ include/asm-x86/signal.h            |    4 
+ drivers/connector/cn_proc.c         |    4 
  mm/nommu.c                          |    4 
- security/selinux/hooks.c            |   54 ++--
- security/selinux/include/objsec.h   |    1 
- 70 files changed, 934 insertions(+), 1213 deletions(-)
+ 68 files changed, 861 insertions(+), 1146 deletions(-)
  create include/linux/tracehook.h
- create include/asm-i386/tracehook.h
  create include/asm-powerpc/tracehook.h
- create include/asm-x86_64/tracehook.h
+ create include/asm-x86/tracehook.h
 
-Index: b/fs/binfmt_flat.c
-===================================================================
---- a/fs/binfmt_flat.c
-+++ b/fs/binfmt_flat.c
-@@ -914,9 +914,6 @@ static int load_flat_binary(struct linux
+--- linux-2.6/fs/binfmt_flat.c
++++ linux-2.6/fs/binfmt_flat.c
+@@ -920,9 +920,6 @@ static int load_flat_binary(struct linux
  	
  	start_thread(regs, start_addr, current->mm->start_stack);
  
@@ -123,10 +118,8 @@
  	return 0;
  }
  
-Index: b/fs/binfmt_som.c
-===================================================================
---- a/fs/binfmt_som.c
-+++ b/fs/binfmt_som.c
+--- linux-2.6/fs/binfmt_som.c
++++ linux-2.6/fs/binfmt_som.c
 @@ -285,8 +285,6 @@ load_som_binary(struct linux_binprm * bp
  	map_hpux_gateway_page(current,current->mm);
  
@@ -136,19 +129,17 @@
  	return 0;
  
  	/* error cleanup */
-Index: b/fs/proc/base.c
-===================================================================
---- a/fs/proc/base.c
-+++ b/fs/proc/base.c
-@@ -67,6 +67,7 @@
+--- linux-2.6/fs/proc/base.c
++++ linux-2.6/fs/proc/base.c
+@@ -68,6 +68,7 @@
  #include <linux/mount.h>
  #include <linux/security.h>
  #include <linux/ptrace.h>
 +#include <linux/tracehook.h>
- #include <linux/seccomp.h>
+ #include <linux/cgroup.h>
  #include <linux/cpuset.h>
  #include <linux/audit.h>
-@@ -189,13 +190,6 @@ static int proc_root_link(struct inode *
+@@ -195,13 +196,6 @@ static int proc_root_link(struct inode *
  	return result;
  }
  
@@ -159,10 +150,10 @@
 -	 (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
[...3592 lines suppressed...]
-@@ -0,0 +1,74 @@
-+/*
-+ * Tracing hooks, PowerPC CPU support
-+ *
-+ * Copyright (C) 2006, 2007 Red Hat, Inc.  All rights reserved.
-+ *
-+ * This copyrighted material is made available to anyone wishing to use,
-+ * modify, copy, or redistribute it subject to the terms and conditions
-+ * of the GNU General Public License v.2.
-+ *
-+ * Red Hat Author: Roland McGrath.
-+ */
-+
-+#ifndef _ASM_TRACEHOOK_H
-+#define _ASM_TRACEHOOK_H	1
-+
-+#include <linux/sched.h>
-+#include <asm/ptrace.h>
-+
-+/*
-+ * See linux/tracehook.h for the descriptions of what these need to do.
-+ */
-+
-+#define ARCH_HAS_SINGLE_STEP	(1)
-+
-+static inline void tracehook_enable_single_step(struct task_struct *task)
-+{
-+	struct pt_regs *regs = task->thread.regs;
-+	if (regs != NULL) {
-+#if defined(CONFIG_PPC32) && (defined(CONFIG_40x) || defined(CONFIG_BOOKE))
-+		task->thread.dbcr0 = DBCR0_IDM | DBCR0_IC;
-+		regs->msr |= MSR_DE;
-+#else
-+		regs->msr |= MSR_SE;
-+#endif
-+	}
-+	set_tsk_thread_flag(task, TIF_SINGLESTEP);
-+}
-+
-+static inline void tracehook_disable_single_step(struct task_struct *task)
-+{
-+	struct pt_regs *regs = task->thread.regs;
-+	if (regs != NULL) {
-+#if defined(CONFIG_PPC32) && (defined(CONFIG_40x) || defined(CONFIG_BOOKE))
-+		task->thread.dbcr0 = 0;
-+		regs->msr &= ~MSR_DE;
-+#else
-+		regs->msr &= ~MSR_SE;
-+#endif
-+	}
-+	clear_tsk_thread_flag(task, TIF_SINGLESTEP);
-+}
-+
-+static inline int tracehook_single_step_enabled(struct task_struct *tsk)
-+{
-+	return test_tsk_thread_flag(tsk, TIF_SINGLESTEP);
-+}
-+
-+static inline void tracehook_enable_syscall_trace(struct task_struct *tsk)
-+{
-+	set_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
-+}
-+
-+static inline void tracehook_disable_syscall_trace(struct task_struct *tsk)
-+{
-+	clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
-+}
-+
-+static inline void tracehook_abort_syscall(struct pt_regs *regs)
-+{
-+	regs->orig_gpr3 = -1L;
-+}
-+
-+
-+#endif
-Index: b/include/asm-x86_64/tracehook.h
-===================================================================
---- /dev/null
-+++ b/include/asm-x86_64/tracehook.h
-@@ -0,0 +1,51 @@
+--- linux-2.6/include/asm-x86/thread_info_64.h
++++ linux-2.6/include/asm-x86/thread_info_64.h
+@@ -115,7 +115,7 @@ static inline struct thread_info *stack_
+ #define TIF_SECCOMP		8	/* secure computing */
+ #define TIF_RESTORE_SIGMASK	9	/* restore signal mask in do_signal */
+ #define TIF_MCE_NOTIFY		10	/* notify userspace of an MCE */
+-/* 16 free */
++#define TIF_FORCED_TF		16	/* true if TF in eflags artificially */
+ #define TIF_IA32		17	/* 32bit process */ 
+ #define TIF_FORK		18	/* ret_from_fork */
+ #define TIF_ABI_PENDING		19
+@@ -133,6 +133,7 @@ static inline struct thread_info *stack_
+ #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
+ #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
+ #define _TIF_MCE_NOTIFY		(1<<TIF_MCE_NOTIFY)
++#define _TIF_FORCED_TF		(1<<TIF_FORCED_TF)
+ #define _TIF_IA32		(1<<TIF_IA32)
+ #define _TIF_FORK		(1<<TIF_FORK)
+ #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)
+--- linux-2.6/include/asm-x86/tracehook.h
++++ linux-2.6/include/asm-x86/tracehook.h
+@@ -0,0 +1,63 @@
 +/*
-+ * Tracing hooks, x86-64 CPU support
++ * Tracing hooks, x86 CPU support
 + *
 + * Copyright (C) 2006, 2007 Red Hat, Inc.  All rights reserved.
 + *
@@ -4067,39 +3768,42 @@
 +	clear_tsk_thread_flag(tsk, TIF_SYSCALL_TRACE);
 +}
 +
++#ifdef CONFIG_X86_64
++
 +#define tracehook_syscall_callno(regs)	(&(regs)->orig_rax)
 +#define tracehook_syscall_retval(regs)	(&(regs)->rax)
 +static inline void tracehook_abort_syscall(struct pt_regs *regs)
 +{
 +	regs->orig_rax = -1L;
 +}
++#else
++
++#define tracehook_syscall_callno(regs)	(&(regs)->orig_eax)
++#define tracehook_syscall_retval(regs)	(&(regs)->eax)
++static inline void tracehook_abort_syscall(struct pt_regs *regs)
++{
++	regs->orig_eax = -1;
++}
 +
 +#endif
-Index: b/include/asm-x86_64/thread_info.h
-===================================================================
---- a/include/asm-x86_64/thread_info.h
-+++ b/include/asm-x86_64/thread_info.h
-@@ -115,7 +115,7 @@ static inline struct thread_info *stack_
- #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */
- #define TIF_SECCOMP		8	/* secure computing */
- #define TIF_RESTORE_SIGMASK	9	/* restore signal mask in do_signal */
--/* 16 free */
-+#define TIF_FORCED_TF		16	/* true if TF in eflags artificially */
- #define TIF_IA32		17	/* 32bit process */ 
- #define TIF_FORK		18	/* ret_from_fork */
- #define TIF_ABI_PENDING		19
-@@ -133,6 +133,7 @@ static inline struct thread_info *stack_
- #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
- #define _TIF_SECCOMP		(1<<TIF_SECCOMP)
- #define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
-+#define _TIF_FORCED_TF		(1<<TIF_FORCED_TF)
- #define _TIF_IA32		(1<<TIF_IA32)
- #define _TIF_FORK		(1<<TIF_FORK)
- #define _TIF_ABI_PENDING	(1<<TIF_ABI_PENDING)
-Index: b/drivers/connector/cn_proc.c
-===================================================================
---- a/drivers/connector/cn_proc.c
-+++ b/drivers/connector/cn_proc.c
++
++#endif
+--- linux-2.6/include/asm-x86/signal.h
++++ linux-2.6/include/asm-x86/signal.h
+@@ -247,10 +247,8 @@ struct pt_regs;
+ 
+ #define ptrace_signal_deliver(regs, cookie)		\
+ 	do {						\
+-		if (current->ptrace & PT_DTRACE) {	\
+-			current->ptrace &= ~PT_DTRACE;	\
++		if (test_and_clear_thread_flag(TIF_FORCED_TF)) \
+ 			(regs)->eflags &= ~TF_MASK;	\
+-		}					\
+ 	} while (0)
+ 
+ #else /* __i386__ */
+--- linux-2.6/drivers/connector/cn_proc.c
++++ linux-2.6/drivers/connector/cn_proc.c
 @@ -63,8 +63,8 @@ void proc_fork_connector(struct task_str
  	ktime_get_ts(&ts); /* get high res monotonic timestamp */
  	put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -4111,11 +3815,9 @@
  	ev->event_data.fork.child_pid = task->pid;
  	ev->event_data.fork.child_tgid = task->tgid;
  
-Index: b/mm/nommu.c
-===================================================================
---- a/mm/nommu.c
-+++ b/mm/nommu.c
-@@ -20,7 +20,7 @@
+--- linux-2.6/mm/nommu.c
++++ linux-2.6/mm/nommu.c
+@@ -21,7 +21,7 @@
  #include <linux/pagemap.h>
  #include <linux/slab.h>
  #include <linux/vmalloc.h>
@@ -4124,7 +3826,7 @@
  #include <linux/blkdev.h>
  #include <linux/backing-dev.h>
  #include <linux/mount.h>
-@@ -674,7 +674,7 @@ static unsigned long determine_vm_flags(
+@@ -706,7 +706,7 @@ static unsigned long determine_vm_flags(
  	 * it's being traced - otherwise breakpoints set in it may interfere
  	 * with another untraced process
  	 */

linux-2.6-wireless.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.2.8.1 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.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- linux-2.6-wireless.patch	24 Jul 2007 14:13:44 -0000	1.2
+++ linux-2.6-wireless.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -1,23814 +1,128428 @@
---- linux-2.6.21.noarch/CREDITS.orig	2007-06-14 13:40:38.000000000 -0400
-+++ linux-2.6.21.noarch/CREDITS	2007-06-14 13:40:56.000000000 -0400
-@@ -317,6 +317,12 @@ S: 2322 37th Ave SW
- S: Seattle, Washington 98126-2010
- S: USA
- 
-+N: Johannes Berg
-+E: johannes at sipsolutions.net
-+W: http://johannes.sipsolutions.net/
-+P: 1024D/9AB78CA5 AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5
-+D: powerpc & 802.11 hacker
-+
- N: Stephen R. van den Berg (AKA BuGless)
- E: berg at pool.informatik.rwth-aachen.de
- D: General kernel, gcc, and libc hacker
---- linux-2.6.21.noarch/lib/Makefile.orig	2007-06-14 13:54:21.000000000 -0400
-+++ linux-2.6.21.noarch/lib/Makefile	2007-06-14 13:41:27.000000000 -0400
-@@ -40,6 +40,7 @@ endif
- obj-$(CONFIG_BITREVERSE) += bitrev.o
- obj-$(CONFIG_CRC_CCITT)	+= crc-ccitt.o
- obj-$(CONFIG_CRC16)	+= crc16.o
-+obj-$(CONFIG_CRC_ITU_T)	+= crc-itu-t.o
- obj-$(CONFIG_CRC32)	+= crc32.o
- obj-$(CONFIG_LIBCRC32C)	+= libcrc32c.o
- obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o
---- linux-2.6.21.noarch/lib/Kconfig.orig	2007-06-14 13:54:21.000000000 -0400
-+++ linux-2.6.21.noarch/lib/Kconfig	2007-06-14 13:41:27.000000000 -0400
-@@ -23,6 +23,14 @@ config CRC16
- 	  the kernel tree does. Such modules that use library CRC16
- 	  functions require M here.
+commit b79caa68c0d48477453a90d12be34b47cb75f3a8
+Author: Michael Buesch <mb at bu3sch.de>
+Date:   Tue Feb 5 12:50:41 2008 +0100
+
+    b43: Fix DMA for 30/32-bit DMA engines
+    
+    This checks if the DMA address is bigger than what the controller can manage.
+    It will reallocate the buffers in the GFP_DMA zone in that case.
+    
+    Signed-off-by: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit 532031d7f426eb02f854d13184416cabcb01bdd5
+Author: Andrew Morton <akpm at linux-foundation.org>
+Date:   Mon Feb 4 23:58:42 2008 -0800
+
+    b43: fix build with CONFIG_SSB_PCIHOST=n
+    
+    m68k allmodconfig gives
+    
+    drivers/net/wireless/b43/main.c:251: error: implicit declaration of function 'mmiowb'
+    
+    because CONFIG_B43=m, CONFIG_SSB_PCIHOST=n.
+    
+    Might be Kconfig bustage, but this works...
+    
+    Cc: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit 03ac7a8141e1613add92d42e389a35a126b1caf8
+Author: Michael Buesch <mb at bu3sch.de>
+Date:   Mon Feb 4 18:11:41 2008 +0100
+
+    mac80211: Is not EXPERIMENTAL anymore
+    
+    Remove the EXPERIMENTAL dependency, as the existing mac80211
+    features are stable.
+    
+    Signed-off-by: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit 221c80cf03d77490b8e45184a273834d0259b9e0
+Author: Adrian Bunk <bunk at kernel.org>
+Date:   Sat Feb 2 23:19:01 2008 +0200
+
+    iwl3945-base.c: fix off-by-one errors
+    
+    This patch fixes two off-by-one errors resulting in array overflows
+    spotted by the Coverity checker.
+    
+    Signed-off-by: Adrian Bunk <bunk at kernel.org>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit 8dd0100ce9511e52614ecd0a6587c13ce5769c8b
+Author: Stefano Brivio <stefano.brivio at polimi.it>
+Date:   Sat Feb 2 19:16:03 2008 +0100
+
+    b43legacy: fix DMA slot resource leakage
+    
+    This fixes four resource leakages.
+    In any error path we must deallocate the DMA frame slots we
+    previously allocated by request_slot().
+    This is done by storing the ring pointers before doing any ring
+    allocation and restoring the old pointers in case of an error.
+    
+    This patch by Michael Buesch has been ported to b43legacy.
+    
+    Cc: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit 9eca9a8e81928685b4de00ecef83a7c13c340fc9
+Author: Stefano Brivio <stefano.brivio at polimi.it>
+Date:   Sat Feb 2 19:16:01 2008 +0100
+
+    b43legacy: drop packets we are not able to encrypt
+    
+    We must drop any packets we are not able to encrypt.
+    We must not send them unencrypted or with an all-zero-key (which
+    basically is the same as unencrypted, from a security point of view).
+    
+    This might only trigger shortly after resume before mac80211 reassociated
+    and reconfigured the keys.
+    
+    It is safe to drop these packets, as the association they belong to
+    is not guaranteed anymore anyway.
+    This is a security fix in the sense that it prevents information leakage.
+    
+    This patch by Michael Buesch has been ported to b43legacy.
+    
+    Cc: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit ada50731c0346bf900dc387edd3a6961297bf2d3
+Author: Stefano Brivio <stefano.brivio at polimi.it>
+Date:   Sat Feb 2 19:15:57 2008 +0100
+
+    b43legacy: fix suspend/resume
+    
+    This patch makes suspend/resume work with the b43legacy driver.
+    We must not overwrite the MAC addresses in the init function, as this
+    would also overwrite the MAC on resume. With an all-zero MAC the device
+    firmware is not able to ACK any received packets anymore.
+    Fix this by moving the initializion stuff that must be done on init but
+    not on resume to the start function.
+    Also zero out filter_flags to make sure we don't have some flags
+    from a previous instance for a tiny timeframe until mac80211 reconfigures
+    them.
+    
+    This patch by Michael Buesch has been ported to b43legacy.
+    
+    Cc: Michael Buesch <mb at bu3sch.de>
+    Signed-off-by: Stefano Brivio <stefano.brivio at polimi.it>
+    Signed-off-by: John W. Linville <linville at tuxdriver.com>
+
+commit 0cd67d48b519c3d8d89d238fab1cf68a5289638a
+Author: Stefano Brivio <stefano.brivio at polimi.it>
+Date:   Sat Feb 2 19:15:49 2008 +0100
+
+    b43legacy: fix PIO crash
+    
+    Fix the crash reported below, which seems to happen on bcm4306 rev. 2 devices
+    only while using PIO:
+    
+    Oops: 0000 [#1] PREEMPT
+    Modules linked in: b43(F) rfkill(F) led_class(F) input_polldev(F) arc4 b43legacy mac80211 cfg80211 i915 drm snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device ohci1394 ieee1394 ssb pcmcia snd_intel8x0m ehci_hcd uhci_hcd evdev
+    
+    Pid: 0, comm: swapper Tainted: GF	(2.6.24st3 #2)
+    EIP: 0060:[<f90f667b>] EFLAGS: 00010002 CPU: 0
+    EIP is at b43legacy_pio_handle_txstatus+0xbb/0x210 [b43legacy]
+    EAX: 0000049b EBX: f11f8044 ECX: 00000001 EDX: 00000000
+    ESI: f1ff8000 EDI: 00000000 EBP: f11f8040 ESP: c04f4ef4
+     DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
+    Process swapper (pid: 0, ti=c04f4000 task=c0488300 task.ti=c04b8000)
+    Stack: f90f2788 c05009f0 c0500900 000010f7 f1053823 c04f4f24 dfb8e800 00000003
+           f1368000 00000007 00000296 f90f1975 00001000 010c0800 01000000 00000007
+           f90f6391 f11f8000 00000082 c04f4f4a 00000000 00004fd0 10f70000 8c061000
+    Call Trace:
+     [<f90f2788>] b43legacy_debugfs_log_txstat+0x48/0xb0 [b43legacy]
+     [<f90f1975>] b43legacy_handle_hwtxstatus+0x75/0x80 [b43legacy]
+     [<f90f6391>] b43legacy_pio_rx+0x201/0x280 [b43legacy]
+     [<f90e4fa3>] b43legacy_interrupt_tasklet+0x2e3/0x870 [b43legacy]
+     [<c0123567>] tasklet_action+0x27/0x60
+     [<c01237b4>] __do_softirq+0x54/0xb0
+     [<c010686b>] do_softirq+0x7b/0xe0
+     [<c01457c0>] handle_level_irq+0x0/0x110
+     [<c01457c0>] handle_level_irq+0x0/0x110
+     [<c0123758>] irq_exit+0x38/0x40
+     [<c0106953>] do_IRQ+0x83/0xd0
+     [<c011812f>] __update_rq_clock+0x4f/0x180
+     [<c0104b4f>] common_interrupt+0x23/0x28
+     [<c011007b>] wakeup_code+0x7b/0xde
+     [<c02b1039>] acpi_processor_idle+0x24a/0x3c9
+     [<c01025c7>] cpu_idle+0x47/0x80
+     [<c04b9ad5>] start_kernel+0x205/0x290
+     [<c04b9360>] unknown_bootoption+0x0/0x1f0
+     =======================
+    Code: 0f 00 00 81 fb ff 00 00 00 0f 87 36 01 00 00 8d 04 db 85 ff 8d 6c c6 40 8d 5d 04 0f 85 ef 00 00 00 fe 4e 0e 0f b7 46 0c 8b 53 04 <8b> 4a 50 29 c8 83 e8 52 66 89 46 0c 8b 54 24 14 80 7a 0b 00 74
+    EIP: [<f90f667b>] b43legacy_pio_handle_txstatus+0xbb/0x210 [b43legacy] SS:ESP 0068:c04f4ef4
[...148956 lines suppressed...]
+ 		goto out;
++	bus->sprom_size = SSB_SPROMSIZE_WORDS_R123;
+ 	sprom_do_read(bus, buf);
+-	err = sprom_check_crc(buf);
++	err = sprom_check_crc(buf, bus->sprom_size);
+ 	if (err) {
+-		ssb_printk(KERN_WARNING PFX
+-			   "WARNING: Invalid SPROM CRC (corrupt SPROM)\n");
++		/* check for rev 4 sprom - has special signature */
++		if (buf[32] == 0x5372) {
++			kfree(buf);
++			buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
++				      GFP_KERNEL);
++			if (!buf)
++				goto out;
++			bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
++			sprom_do_read(bus, buf);
++			err = sprom_check_crc(buf, bus->sprom_size);
++		}
++		if (err)
++			ssb_printk(KERN_WARNING PFX "WARNING: Invalid"
++				   " SPROM CRC (corrupt SPROM)\n");
+ 	}
+-	err = sprom_extract(bus, sprom, buf);
++	err = sprom_extract(bus, sprom, buf, bus->sprom_size);
  
- config USB_ZD1201
- 	tristate "USB ZD1201 based Wireless device support"
--	depends on USB && NET_RADIO
-+	depends on USB && WLAN_80211
-+	select WIRELESS_EXT
- 	select FW_LOADER
- 	---help---
- 	  Say Y if you want to use wireless LAN adapters based on the ZyDAS
-@@ -542,11 +529,4 @@ source "drivers/net/wireless/hostap/Kcon
- source "drivers/net/wireless/bcm43xx/Kconfig"
- source "drivers/net/wireless/zd1211rw/Kconfig"
+ 	kfree(buf);
+ out:
+@@ -581,29 +632,28 @@ const struct ssb_bus_ops ssb_pci_ops = {
+ 	.write32	= ssb_pci_write32,
+ };
  
--# yes, this works even when no drivers are selected
--config NET_WIRELESS
--	bool
--	depends on NET_RADIO && (ISA || PCI || PPC_PMAC || PCMCIA)
--	default y
--
- endmenu
--
---- linux-2.6.21.noarch/drivers/net/wireless/bcm43xx/Kconfig.orig	2007-06-14 13:40:38.000000000 -0400
-+++ linux-2.6.21.noarch/drivers/net/wireless/bcm43xx/Kconfig	2007-06-14 13:40:57.000000000 -0400
-@@ -1,6 +1,7 @@
- config BCM43XX
- 	tristate "Broadcom BCM43xx wireless support"
--	depends on PCI && IEEE80211 && IEEE80211_SOFTMAC && NET_RADIO && EXPERIMENTAL
-+	depends on PCI && IEEE80211 && IEEE80211_SOFTMAC && WLAN_80211 && EXPERIMENTAL
-+	select WIRELESS_EXT
- 	select FW_LOADER
- 	select HW_RANDOM
- 	---help---
---- linux-2.6.21.noarch/drivers/net/wireless/hostap/Kconfig.orig	2007-06-14 13:40:38.000000000 -0400
-+++ linux-2.6.21.noarch/drivers/net/wireless/hostap/Kconfig	2007-06-14 13:40:57.000000000 -0400
-@@ -1,6 +1,7 @@
- config HOSTAP
- 	tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)"
--	depends on NET_RADIO
-+	depends on WLAN_80211
-+	select WIRELESS_EXT
- 	select IEEE80211
- 	select IEEE80211_CRYPT_WEP
- 	---help---
---- linux-2.6.21.noarch/Documentation/feature-removal-schedule.txt.orig	2007-06-14 13:40:38.000000000 -0400
-+++ linux-2.6.21.noarch/Documentation/feature-removal-schedule.txt	2007-06-14 13:40:57.000000000 -0400
-@@ -294,18 +294,6 @@ Who:	Richard Purdie <rpurdie at rpsys.net>
+-static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len)
++static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, u16 size)
+ {
+ 	int i, pos = 0;
  
- ---------------------------
+-	for (i = 0; i < SSB_SPROMSIZE_WORDS; i++) {
++	for (i = 0; i < size; i++)
+ 		pos += snprintf(buf + pos, buf_len - pos - 1,
+ 				"%04X", swab16(sprom[i]) & 0xFFFF);
+-	}
+ 	pos += snprintf(buf + pos, buf_len - pos - 1, "\n");
+ 
+ 	return pos + 1;
+ }
  
--What:	Wireless extensions over netlink (CONFIG_NET_WIRELESS_RTNETLINK)
--When:	with the merge of wireless-dev, 2.6.22 or later
--Why:	The option/code is
--	 * not enabled on most kernels
--	 * not required by any userspace tools (except an experimental one,
--	   and even there only for some parts, others use ioctl)
--	 * pointless since wext is no longer evolving and the ioctl
--	   interface needs to be kept
--Who:	Johannes Berg <johannes at sipsolutions.net>
--
-----------------------------
--
- What:	i8xx_tco watchdog driver
- When:	in 2.6.22
- Why:	the i8xx_tco watchdog driver has been replaced by the iTCO_wdt
+-static int hex2sprom(u16 *sprom, const char *dump, size_t len)
++static int hex2sprom(u16 *sprom, const char *dump, size_t len, u16 size)
+ {
+ 	char tmp[5] = { 0 };
+ 	int cnt = 0;
+ 	unsigned long parsed;
+ 
+-	if (len < SSB_SPROMSIZE_BYTES * 2)
++	if (len < size * 2)
+ 		return -EINVAL;
+ 
+-	while (cnt < SSB_SPROMSIZE_WORDS) {
++	while (cnt < size) {
+ 		memcpy(tmp, dump, 4);
+ 		dump += 4;
+ 		parsed = simple_strtoul(tmp, NULL, 16);
+@@ -627,7 +677,7 @@ static ssize_t ssb_pci_attr_sprom_show(s
+ 	if (!bus)
+ 		goto out;
+ 	err = -ENOMEM;
+-	sprom = kcalloc(SSB_SPROMSIZE_WORDS, sizeof(u16), GFP_KERNEL);
++	sprom = kcalloc(bus->sprom_size, sizeof(u16), GFP_KERNEL);
+ 	if (!sprom)
+ 		goto out;
+ 
+@@ -640,7 +690,7 @@ static ssize_t ssb_pci_attr_sprom_show(s
+ 	sprom_do_read(bus, sprom);
+ 	mutex_unlock(&bus->pci_sprom_mutex);
+ 
+-	count = sprom2hex(sprom, buf, PAGE_SIZE);
++	count = sprom2hex(sprom, buf, PAGE_SIZE, bus->sprom_size);
+ 	err = 0;
+ 
+ out_kfree:
+@@ -662,15 +712,15 @@ static ssize_t ssb_pci_attr_sprom_store(
+ 	if (!bus)
+ 		goto out;
+ 	err = -ENOMEM;
+-	sprom = kcalloc(SSB_SPROMSIZE_WORDS, sizeof(u16), GFP_KERNEL);
++	sprom = kcalloc(bus->sprom_size, sizeof(u16), GFP_KERNEL);
+ 	if (!sprom)
+ 		goto out;
+-	err = hex2sprom(sprom, buf, count);
++	err = hex2sprom(sprom, buf, count, bus->sprom_size);
+ 	if (err) {
+ 		err = -EINVAL;
+ 		goto out_kfree;
+ 	}
+-	err = sprom_check_crc(sprom);
++	err = sprom_check_crc(sprom, bus->sprom_size);
+ 	if (err) {
+ 		err = -EINVAL;
+ 		goto out_kfree;
+diff -up linux-2.6.24.noarch/Documentation/feature-removal-schedule.txt.orig linux-2.6.24.noarch/Documentation/feature-removal-schedule.txt
+--- linux-2.6.24.noarch/Documentation/feature-removal-schedule.txt.orig	2008-01-24 17:58:37.000000000 -0500
++++ linux-2.6.24.noarch/Documentation/feature-removal-schedule.txt	2008-02-05 22:16:24.000000000 -0500
+@@ -332,4 +332,36 @@ Why:	This driver has been marked obsolet
+ 	2.4 or later kernels, provides richer features and is more robust.
+ Who:	Stephen Hemminger <shemminger at linux-foundation.org>
+ 
++What:	bcm43xx wireless network driver
++When:	2.6.26
++Files:	drivers/net/wireless/bcm43xx
++Why:	This driver's functionality has been replaced by the
++	mac80211-based b43 and b43legacy drivers.
++Who:	John W. Linville <linville at tuxdriver.com>
++
++---------------------------
++
++What:	ieee80211 softmac wireless networking component
++When:	2.6.26 (or after removal of bcm43xx and port of zd1211rw to mac80211)
++Files:	net/ieee80211/softmac
++Why:	No in-kernel drivers will depend on it any longer.
++Who:	John W. Linville <linville at tuxdriver.com>
++
+ ---------------------------
++
++What:	rc80211-simple rate control algorithm for mac80211
++When:	2.6.26
++Files:	net/mac80211/rc80211-simple.c
++Why:	This algorithm was provided for reference but always exhibited bad
++	responsiveness and performance and has some serious flaws. It has been
++	replaced by rc80211-pid.
++Who:	Stefano Brivio <stefano.brivio at polimi.it>
++
++---------------------------
++
++What:	b43 support for firmware revision < 410
++When:	July 2008
++Why:	The support code for the old firmware hurts code readability/maintainability
++	and slightly hurts runtime performance. Bugfixes for the old firmware
++	are not provided by Broadcom anymore.
++Who:	Michael Buesch <mb at bu3sch.de>

linux-2.6-x86-tune-generic.patch:

Index: linux-2.6-x86-tune-generic.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/linux-2.6-x86-tune-generic.patch,v
retrieving revision 1.1
retrieving revision 1.1.22.1
diff -u -r1.1 -r1.1.22.1
--- linux-2.6-x86-tune-generic.patch	24 Jan 2007 01:28:48 -0000	1.1
+++ linux-2.6-x86-tune-generic.patch	18 Feb 2008 16:55:17 -0000	1.1.22.1
@@ -1,5 +1,7 @@
---- linux-2.6.15/arch/i386/Makefile.cpu~	2006-01-09 11:39:04.000000000 -0500
-+++ linux-2.6.15/arch/i386/Makefile.cpu	2006-01-09 11:39:36.000000000 -0500
+* Optimise for today's CPUs.
+
+--- linux-2.6/arch/x86/Makefile_32.cpu	2006-01-09 11:39:04.000000000 -0500
++++ linux-2.6/arch/x86/Makefile_32.cpu	2006-01-09 11:39:36.000000000 -0500
 @@ -15,7 +15,7 @@ cflags-$(CONFIG_M486)		+= -march=i486
  cflags-$(CONFIG_M586)		+= -march=i586
  cflags-$(CONFIG_M586TSC)	+= -march=i586

nouveau-drm.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.2.8.1 nouveau-drm.patch
Index: nouveau-drm.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/nouveau-drm.patch,v
retrieving revision 1.2
retrieving revision 1.2.8.1
diff -u -r1.2 -r1.2.8.1
--- nouveau-drm.patch	24 Jul 2007 14:13:45 -0000	1.2
+++ nouveau-drm.patch	18 Feb 2008 16:55:17 -0000	1.2.8.1
@@ -1,71 +1,58 @@
-diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig
-index ef833a1..065f499 100644
---- a/drivers/char/drm/Kconfig
-+++ b/drivers/char/drm/Kconfig
-@@ -106,3 +106,9 @@ config DRM_SAVAGE
- 	  Choose this option if you have a Savage3D/4/SuperSavage/Pro/Twister
- 	  chipset. If M is selected the module will be called savage.
+From f4e9f548d49b0bc9fbbfbee635f96e79a2f472ae Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied at voynix.(none)>
+Date: Thu, 6 Sep 2007 00:10:19 +1000
+Subject: [PATCH] drm: add nouveau latest code
+
+---
+diff -uNrp linux-2.6.23.noarch.old/drivers/char/drm/drm_bufs.c linux-2.6.23.noarch/drivers/char/drm/drm_bufs.c
+--- linux-2.6.23.noarch.old/drivers/char/drm/drm_bufs.c	2007-11-26 21:18:35.000000000 -0500
++++ linux-2.6.23.noarch/drivers/char/drm/drm_bufs.c	2007-11-26 21:16:13.000000000 -0500
+@@ -49,8 +49,8 @@ unsigned long drm_get_resource_len(struc
  
-+config DRM_NOUVEAU
-+	tristate "Nvidia video cards"
-+	depends on DRM && PCI
-+	help
-+	  Choose this option if you want to enable nouveau reverse engineered
-+          driver for nvidia chipset. The module will be called nouveau.
-diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
-index 6915a05..20b79d5 100644
---- a/drivers/char/drm/Makefile
-+++ b/drivers/char/drm/Makefile
-@@ -14,6 +14,14 @@ mga-objs    := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
- i810-objs   := i810_drv.o i810_dma.o
- i830-objs   := i830_drv.o i830_dma.o i830_irq.o
- i915-objs   := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
-+nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \
-+                nouveau_object.o nouveau_irq.o \
-+		nv04_timer.o \
-+		nv04_mc.o nv40_mc.o \
-+		nv04_fb.o nv10_fb.o nv40_fb.o \
-+		nv04_graph.o nv10_graph.o nv20_graph.o nv30_graph.o \
-+		nv40_graph.o
-+
- radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
- sis-objs    := sis_drv.o sis_mm.o
- savage-objs := savage_drv.o savage_bci.o savage_state.o
-@@ -25,6 +33,7 @@ radeon-objs += radeon_ioc32.o
- mga-objs    += mga_ioc32.o
- r128-objs   += r128_ioc32.o
- i915-objs   += i915_ioc32.o
-+nouveau-objs += nouveau_ioc32.o
- endif
+ EXPORT_SYMBOL(drm_get_resource_len);
  
- obj-$(CONFIG_DRM)	+= drm.o
-@@ -38,5 +47,6 @@ obj-$(CONFIG_DRM_I915)  += i915.o
- obj-$(CONFIG_DRM_SIS)   += sis.o
- obj-$(CONFIG_DRM_SAVAGE)+= savage.o
- obj-$(CONFIG_DRM_VIA)	+=via.o
-+obj-$(CONFIG_DRM_NOUVEAU) += nouveau.o
+-static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
+-					     drm_local_map_t *map)
++struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
++					   drm_local_map_t *map)
+ {
+ 	struct drm_map_list *entry;
+ 	list_for_each_entry(entry, &dev->maplist, head) {
+@@ -63,6 +63,7 @@ static struct drm_map_list *drm_find_mat
  
+ 	return NULL;
+ }
++EXPORT_SYMBOL(drm_find_matching_map);
  
-diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
-index a6828cc..f3da5c4 100644
---- a/drivers/char/drm/drm_bufs.c
-+++ b/drivers/char/drm/drm_bufs.c
-@@ -400,6 +400,7 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
+ static int drm_map_handle(struct drm_device *dev, struct drm_hash_item *hash,
+ 			  unsigned long user_token, int hashed_handle)
+diff -uNrp linux-2.6.23.noarch.old/drivers/char/drm/drm_irq.c linux-2.6.23.noarch/drivers/char/drm/drm_irq.c
+--- linux-2.6.23.noarch.old/drivers/char/drm/drm_irq.c	2007-11-26 21:18:35.000000000 -0500
++++ linux-2.6.23.noarch/drivers/char/drm/drm_irq.c	2007-11-26 21:16:13.000000000 -0500
+@@ -81,7 +81,7 @@ int drm_irq_by_busid(struct drm_device *
+  * \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions
+  * before and after the installation.
+  */
+-static int drm_irq_install(struct drm_device * dev)
++int drm_irq_install(struct drm_device * dev)
+ {
+ 	int ret;
+ 	unsigned long sh_flags = 0;
+@@ -141,6 +141,7 @@ static int drm_irq_install(struct drm_de
  
- 	return ret;
+ 	return 0;
  }
-+EXPORT_SYMBOL(drm_rmmap);
++EXPORT_SYMBOL(drm_irq_install);
  
- /* The rmmap ioctl appears to be unnecessary.  All mappings are torn down on
-  * the last close of the device, and this is necessary for cleanup when things
-diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
-index ad54b84..87ccae5 100644
---- a/drivers/char/drm/drm_pciids.h
-+++ b/drivers/char/drm/drm_pciids.h
-@@ -296,5 +296,236 @@
- 	{0x8086, 0x2982, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
- 	{0x8086, 0x2992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
- 	{0x8086, 0x29a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+ /**
+  * Uninstall the IRQ handler.
+diff -uNrp linux-2.6.23.noarch.old/drivers/char/drm/drm_pciids.h linux-2.6.23.noarch/drivers/char/drm/drm_pciids.h
+--- linux-2.6.23.noarch.old/drivers/char/drm/drm_pciids.h	2007-11-26 21:18:35.000000000 -0500
++++ linux-2.6.23.noarch/drivers/char/drm/drm_pciids.h	2007-11-26 21:24:20.000000000 -0500
+@@ -311,3 +311,265 @@
+ 	{0x8086, 0x2a02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+ 	{0x8086, 0x2a12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+ 	{0, 0, 0}
 +
 +#define nouveau_PCI_IDS \
 +	{0x10de, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_03}, \
@@ -96,6 +83,7 @@
 +	{0x10de, 0x0091, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0092, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0093, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
++	{0x10de, 0x0095, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0098, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0099, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x009d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
@@ -134,12 +122,15 @@
 +	{0x10de, 0x0140, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0141, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0142, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
++	{0x10de, 0x0143, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
++	{0x10de, 0x0147, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0148, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x014a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
++	{0x10de, 0x014c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x014d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_17}, \
 +	{0x10de, 0x014e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x014f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
@@ -147,6 +138,7 @@
 +	{0x10de, 0x0151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_15}, \
 +	{0x10de, 0x0152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_15}, \
 +	{0x10de, 0x0153, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_15}, \
++	{0x10de, 0x0160, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0161, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0162, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0163, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
@@ -155,6 +147,7 @@
 +	{0x10de, 0x0166, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0167, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x0169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0170, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_17}, \
 +	{0x10de, 0x0171, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_17}, \
 +	{0x10de, 0x0172, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_17}, \
@@ -182,13 +175,21 @@
 +	{0x10de, 0x018d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_17}, \
 +	{0x10de, 0x0191, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_50}, \
 +	{0x10de, 0x0193, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_50}, \
++	{0x10de, 0x0194, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_50}, \
++	{0x10de, 0x019d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_50}, \
++	{0x10de, 0x019e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_50}, \
 +	{0x10de, 0x01a0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_11|NV_NFORCE}, \
 +	{0x10de, 0x01d1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x01d3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x01d6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x01d7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x01d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x01d9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x01da, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x01db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x01dc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x01dd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x01de, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x01df, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x01f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_17|NV_NFORCE2}, \
 +	{0x10de, 0x0200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_20}, \
@@ -200,9 +201,12 @@
 +	{0x10de, 0x0215, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0218, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_40}, \
 +	{0x10de, 0x0221, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x0222, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
 +	{0x10de, 0x0244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
++	{0x10de, 0x0247, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NV_44}, \
[...12786 lines suppressed...]
++					 NV50_PUNK_BAR_CFG_BASE_VALID);
++	NV_WRITE(NV50_PUNK_BAR1_CTXDMA, 0);
++	NV_WRITE(NV50_PUNK_BAR3_CTXDMA, (priv->pramin_bar->instance >> 4) |
++					NV50_PUNK_BAR3_CTXDMA_VALID);
++
++	/* Assume that praying isn't enough, check that we can re-read the
++	 * entire fake channel back from the PRAMIN BAR */
++	for (i = 0; i < c_size; i+=4) {
++		if (NV_READ(NV_RAMIN + i) != NV_RI32(i)) {
++			DRM_ERROR("Error reading back PRAMIN at 0x%08x\n", i);
++			return -EINVAL;
++		}
++	}
++
++	/* Global PRAMIN heap */
++	if (nouveau_mem_init_heap(&dev_priv->ramin_heap,
++				  c_size, dev_priv->ramin->size - c_size)) {
++		dev_priv->ramin_heap = NULL;
++		DRM_ERROR("Failed to init RAMIN heap\n");
++	}
++
++	/*XXX: incorrect, but needed to make hash func "work" */
++	dev_priv->ramht_offset = 0x10000;
++	dev_priv->ramht_bits   = 9;
++	dev_priv->ramht_size   = (1 << dev_priv->ramht_bits);
++	return 0;
++}
++
++void
++nv50_instmem_takedown(struct drm_device *dev)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++	nv50_instmem_priv *priv = dev_priv->Engine.instmem.priv;
++	struct nouveau_channel *chan = dev_priv->fifos[0];
++	int i;
++
++	DRM_DEBUG("\n");
++
++	if (!priv)
++		return;
++
++	/* Restore state from before init */
++	for (i = 0x1700; i <= 0x1710; i+=4)
++		NV_WRITE(i, priv->save1700[(i-0x1700)/4]);
++
++	nouveau_gpuobj_ref_del(dev, &priv->pramin_bar);
++	nouveau_gpuobj_ref_del(dev, &priv->pramin_pt);
++
++	/* Destroy dummy channel */
++	if (chan) {
++		nouveau_gpuobj_del(dev, &chan->vm_pd);
++		nouveau_gpuobj_ref_del(dev, &chan->ramfc);
++		nouveau_gpuobj_ref_del(dev, &chan->ramin);
++		nouveau_mem_takedown(&chan->ramin_heap);
++
++		dev_priv->fifos[0] = dev_priv->fifos[127] = NULL;
++		drm_free(chan, sizeof(*chan), DRM_MEM_DRIVER);
++	}
++
++	dev_priv->Engine.instmem.priv = NULL;
++	drm_free(priv, sizeof(*priv), DRM_MEM_DRIVER);
++}
++
++int
++nv50_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj, uint32_t *sz)
++{
++	if (gpuobj->im_backing)
++		return -EINVAL;
++
++	*sz = (*sz + (NV50_INSTMEM_PAGE_SIZE-1)) & ~(NV50_INSTMEM_PAGE_SIZE-1);
++	if (*sz == 0)
++		return -EINVAL;
++
++	gpuobj->im_backing = nouveau_mem_alloc(dev, NV50_INSTMEM_PAGE_SIZE,
++					       *sz, NOUVEAU_MEM_FB,
++					       (struct drm_file *)-2);
++	if (!gpuobj->im_backing) {
++		DRM_ERROR("Couldn't allocate vram to back PRAMIN pages\n");
++		return -ENOMEM;
++	}
++
++	return 0;
++}
++
++void
++nv50_instmem_clear(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++
++	if (gpuobj && gpuobj->im_backing) {
++		if (gpuobj->im_bound)
++			dev_priv->Engine.instmem.unbind(dev, gpuobj);
++		nouveau_mem_free(dev, gpuobj->im_backing);
++		gpuobj->im_backing = NULL;
++	}	
++}
++
++int
++nv50_instmem_bind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++	nv50_instmem_priv *priv = dev_priv->Engine.instmem.priv;
++	uint32_t pte, pte_end, vram;
++
++	if (!gpuobj->im_backing || !gpuobj->im_pramin || gpuobj->im_bound)
++		return -EINVAL;
++
++	DRM_DEBUG("st=0x%0llx sz=0x%0llx\n",
++		  gpuobj->im_pramin->start, gpuobj->im_pramin->size);
++
++	pte     = (gpuobj->im_pramin->start >> 12) << 3;
++	pte_end = ((gpuobj->im_pramin->size >> 12) << 3) + pte;
++	vram    = gpuobj->im_backing->start;
++
++	DRM_DEBUG("pramin=0x%llx, pte=%d, pte_end=%d\n",
++		  gpuobj->im_pramin->start, pte, pte_end);
++	DRM_DEBUG("first vram page: 0x%llx\n",
++		  gpuobj->im_backing->start);
++
++	while (pte < pte_end) {
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 0)/4, vram | 1);
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 4)/4, 0x00000000);
++
++		pte += 8;
++		vram += NV50_INSTMEM_PAGE_SIZE;
++	}
++
++	gpuobj->im_bound = 1;
++	return 0;
++}
++
++int
++nv50_instmem_unbind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++	nv50_instmem_priv *priv = dev_priv->Engine.instmem.priv;
++	uint32_t pte, pte_end;
++
++	if (gpuobj->im_bound == 0)
++		return -EINVAL;
++
++	pte     = (gpuobj->im_pramin->start >> 12) << 3;
++	pte_end = ((gpuobj->im_pramin->size >> 12) << 3) + pte;
++	while (pte < pte_end) {
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 0)/4, 0x00000009);
++		INSTANCE_WR(priv->pramin_pt->gpuobj, (pte + 4)/4, 0x00000000);
++		pte += 8;
++	}
++
++	gpuobj->im_bound = 0;
++	return 0;
++}
++
+diff -uNrp linux-2.6.23.noarch.old/drivers/char/drm/nv50_mc.c linux-2.6.23.noarch/drivers/char/drm/nv50_mc.c
+--- linux-2.6.23.noarch.old/drivers/char/drm/nv50_mc.c	1969-12-31 19:00:00.000000000 -0500
++++ linux-2.6.23.noarch/drivers/char/drm/nv50_mc.c	2007-11-26 21:16:13.000000000 -0500
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (C) 2007 Ben Skeggs.
++ * All Rights Reserved.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining
++ * a copy of this software and associated documentation files (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 (including the
++ * next paragraph) 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 COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS 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 "drmP.h"
++#include "drm.h"
++#include "nouveau_drv.h"
++
++int
++nv50_mc_init(struct drm_device *dev)
++{
++	struct drm_nouveau_private *dev_priv = dev->dev_private;
++
++	NV_WRITE(NV03_PMC_ENABLE, 0xFFFFFFFF);
++
++	return 0;
++}
++
++void nv50_mc_takedown(struct drm_device *dev)
++{
++}


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/sources,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- sources	18 Jan 2008 19:14:27 -0000	1.11
+++ sources	18 Feb 2008 16:55:17 -0000	1.11.2.1
@@ -1,4 +1,2 @@
-1b515f588078dfa7f4bab2634bd17e80  linux-2.6.21.tar.bz2
-b9c8734471a454806c77f040fcf9869b  patch-2.6.21.7.bz2
-0b7a1468bcd3353b77494cbf0e97d2e4  linux-2.6.21.7-xen-3.1.0.patch.bz2
+3f23ad4b69d0a552042d1ed0f4399857  linux-2.6.24.tar.bz2
 4aa57328d0802a063fa67dfc063da30e  xen-3.2.0.tar.gz

xen-build-id.patch:

Index: xen-build-id.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/xen-build-id.patch,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- xen-build-id.patch	29 Oct 2007 17:29:06 -0000	1.2
+++ xen-build-id.patch	18 Feb 2008 16:55:17 -0000	1.2.4.1
@@ -1,8 +1,20 @@
-Index: xen-3.1.0-rc7-7041b52471c3/Config.mk
-===================================================================
---- xen-3.1.0-rc7-7041b52471c3.orig/Config.mk
-+++ xen-3.1.0-rc7-7041b52471c3/Config.mk
-@@ -52,6 +52,12 @@ define cc-ver-check-closure
+diff -up xen-3.2.0/xen/Rules.mk.build-id xen-3.2.0/xen/Rules.mk
+--- xen-3.2.0/xen/Rules.mk.build-id	2008-01-16 18:34:59.000000000 +0000
++++ xen-3.2.0/xen/Rules.mk	2008-02-13 18:26:21.000000000 +0000
+@@ -84,6 +84,9 @@ CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y
+ AFLAGS   := $(strip $(AFLAGS) $(AFLAGS-y))
+ AFLAGS   += $(patsubst -std=gnu%,,$(CFLAGS))
+ 
++# Use --build-id when linking directly; normally the compiler would pass it.
++LDFLAGS_DIRECT += $(call ld-option,$(CC),--build-id,)
++
+ # LDFLAGS are only passed directly to $(LD)
+ LDFLAGS  := $(strip $(LDFLAGS) $(LDFLAGS_DIRECT))
+ 
+diff -up xen-3.2.0/Config.mk.build-id xen-3.2.0/Config.mk
+--- xen-3.2.0/Config.mk.build-id	2008-01-16 18:34:59.000000000 +0000
++++ xen-3.2.0/Config.mk	2008-02-13 18:26:21.000000000 +0000
+@@ -57,6 +57,12 @@ define cc-ver-check-closure
      endif
  endef
  
@@ -15,17 +27,3 @@
  ifneq ($(debug),y)
  CFLAGS += -DNDEBUG
  else
-Index: xen-3.1.0-rc7-7041b52471c3/xen/Rules.mk
-===================================================================
---- xen-3.1.0-rc7-7041b52471c3.orig/xen/Rules.mk
-+++ xen-3.1.0-rc7-7041b52471c3/xen/Rules.mk
-@@ -72,6 +72,9 @@ CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y
- AFLAGS   := $(strip $(AFLAGS) $(AFLAGS-y))
- AFLAGS   += $(patsubst -std=gnu%,,$(CFLAGS))
- 
-+# Use --build-id when linking directly; normally the compiler would pass it.
-+LDFLAGS_DIRECT += $(call ld-option,$(CC),--build-id,)
-+
- # LDFLAGS are only passed directly to $(LD)
- LDFLAGS  := $(strip $(LDFLAGS) $(LDFLAGS_DIRECT))
- 

xen-compile-fix.patch:

Index: xen-compile-fix.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/xen-compile-fix.patch,v
retrieving revision 1.3
retrieving revision 1.3.8.1
diff -u -r1.3 -r1.3.8.1
--- xen-compile-fix.patch	13 Sep 2007 19:20:29 -0000	1.3
+++ xen-compile-fix.patch	18 Feb 2008 16:55:17 -0000	1.3.8.1
@@ -1,13 +1,12 @@
-Index: xen-3.1.0/xen/include/asm-x86/hvm/hvm.h
-===================================================================
---- xen-3.1.0/xen/include/asm-x86/hvm/hvm.h
-+++ xen-3.1.0/xen/include/asm-x86/hvm/hvm.h
-@@ -183,7 +183,7 @@ hvm_long_mode_enabled(struct vcpu *v)
-     return hvm_funcs.long_mode_enabled(v);
- }
+diff -up xen-3.2.0/xen/include/asm-x86/hvm/hvm.h.compile-fix xen-3.2.0/xen/include/asm-x86/hvm/hvm.h
+--- xen-3.2.0/xen/include/asm-x86/hvm/hvm.h.compile-fix	2008-02-13 18:21:43.000000000 +0000
++++ xen-3.2.0/xen/include/asm-x86/hvm/hvm.h	2008-02-13 18:25:14.000000000 +0000
+@@ -155,7 +155,7 @@ u64 hvm_get_guest_tsc(struct vcpu *v);
+ #define hvm_long_mode_enabled(v) \
+     ((v)->arch.hvm_vcpu.guest_efer & EFER_LMA)
  #else
 -#define hvm_long_mode_enabled(v) (v,0)
 +#define hvm_long_mode_enabled(v) 0
  #endif
  
-  static inline int
+ enum hvm_intblk

xen-syms-build-id.patch:

Index: xen-syms-build-id.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel-xen-2.6/devel/xen-syms-build-id.patch,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- xen-syms-build-id.patch	29 Oct 2007 17:29:06 -0000	1.2
+++ xen-syms-build-id.patch	18 Feb 2008 16:55:17 -0000	1.2.4.1
@@ -1,7 +1,6 @@
 From: Eduardo Habkost <ehabkost at redhat.com>
 Subject: Add build-id section to xen-syms
 
-
 This needs some changes on xen.lds.S and to mkelf32. The linker script
 need a .notes section and a note phdr. mkelf32 needs to support a input
 file containing more than one phdr and ignore the note phdr.
@@ -10,12 +9,9 @@
 xen hypervisor image that boots doesn't have the build-id information,
 but the build-id section is a requirement of Fedora's find-debuginfo.sh.
 
-
----
-Index: xen-3.1.0-rc7-7041b52471c3/xen/arch/x86/boot/mkelf32.c
-===================================================================
---- xen-3.1.0-rc7-7041b52471c3.orig/xen/arch/x86/boot/mkelf32.c
-+++ xen-3.1.0-rc7-7041b52471c3/xen/arch/x86/boot/mkelf32.c
+diff -up xen-3.2.0/xen/arch/x86/boot/mkelf32.c.syms-build-id xen-3.2.0/xen/arch/x86/boot/mkelf32.c
+--- xen-3.2.0/xen/arch/x86/boot/mkelf32.c.syms-build-id	2008-01-16 18:34:59.000000000 +0000
++++ xen-3.2.0/xen/arch/x86/boot/mkelf32.c	2008-02-13 18:27:05.000000000 +0000
 @@ -229,10 +229,11 @@ int main(int argc, char **argv)
  {
      u64        final_exec_addr;
@@ -134,11 +130,10 @@
      /*
       * End the image on a page boundary. This gets round alignment bugs
       * in the boot- or chain-loader (e.g., kexec on the XenoBoot CD).
-Index: xen-3.1.0-rc7-7041b52471c3/xen/arch/x86/x86_32/xen.lds.S
-===================================================================
---- xen-3.1.0-rc7-7041b52471c3.orig/xen/arch/x86/x86_32/xen.lds.S
-+++ xen-3.1.0-rc7-7041b52471c3/xen/arch/x86/x86_32/xen.lds.S
-@@ -15,6 +15,7 @@ ENTRY(start)
+diff -up xen-3.2.0/xen/arch/x86/x86_64/xen.lds.S.syms-build-id xen-3.2.0/xen/arch/x86/x86_64/xen.lds.S
+--- xen-3.2.0/xen/arch/x86/x86_64/xen.lds.S.syms-build-id	2008-01-16 18:34:59.000000000 +0000
++++ xen-3.2.0/xen/arch/x86/x86_64/xen.lds.S	2008-02-13 18:27:05.000000000 +0000
+@@ -13,6 +13,7 @@ ENTRY(start)
  PHDRS
  {
    text PT_LOAD ;
@@ -146,17 +141,16 @@
  }
  SECTIONS
  {
-@@ -96,4 +97,5 @@ SECTIONS
+@@ -99,4 +100,5 @@ SECTIONS
    .stab.index 0 : { *(.stab.index) }
    .stab.indexstr 0 : { *(.stab.indexstr) }
    .comment 0 : { *(.comment) }
 +  .notes : { *(.note*) } :note
  }
-Index: xen-3.1.0-rc7-7041b52471c3/xen/arch/x86/x86_64/xen.lds.S
-===================================================================
---- xen-3.1.0-rc7-7041b52471c3.orig/xen/arch/x86/x86_64/xen.lds.S
-+++ xen-3.1.0-rc7-7041b52471c3/xen/arch/x86/x86_64/xen.lds.S
-@@ -13,6 +13,7 @@ ENTRY(start)
+diff -up xen-3.2.0/xen/arch/x86/x86_32/xen.lds.S.syms-build-id xen-3.2.0/xen/arch/x86/x86_32/xen.lds.S
+--- xen-3.2.0/xen/arch/x86/x86_32/xen.lds.S.syms-build-id	2008-01-16 18:34:59.000000000 +0000
++++ xen-3.2.0/xen/arch/x86/x86_32/xen.lds.S	2008-02-13 18:27:05.000000000 +0000
+@@ -15,6 +15,7 @@ ENTRY(start)
  PHDRS
  {
    text PT_LOAD ;
@@ -164,7 +158,7 @@
  }
  SECTIONS
  {
-@@ -94,4 +95,5 @@ SECTIONS
+@@ -101,4 +102,5 @@ SECTIONS
    .stab.index 0 : { *(.stab.index) }
    .stab.indexstr 0 : { *(.stab.indexstr) }
    .comment 0 : { *(.comment) }


--- config-olpc-generic DELETED ---


--- git-wireless-dev.patch DELETED ---


--- kernel-2.6.21.7-i686-xen.config DELETED ---


--- kernel-2.6.21.7-x86_64-xen.config DELETED ---


--- linux-2.6-2110_scsi-sd-printing.patch DELETED ---


--- linux-2.6-2111_sd-start-stop.patch DELETED ---


--- linux-2.6-2112_libata-suspend.patch DELETED ---


--- linux-2.6-2113_libata-spindown-compat.patch DELETED ---


--- linux-2.6-2114_libata-shutdown-warning.patch DELETED ---


--- linux-2.6-2115_libata-spindown-status.patch DELETED ---


--- linux-2.6-2116_libata-remove-spindown-compat.patch DELETED ---


--- linux-2.6-2117_sata-via-suspend.patch DELETED ---


--- linux-2.6-2118_scsi-constants.patch DELETED ---


--- linux-2.6-3w-9xxx-mem_len.patch DELETED ---


--- linux-2.6-PT_LOAD-align.patch DELETED ---


--- linux-2.6-acpi-boot-regression.patch DELETED ---


--- linux-2.6-acpi-config_pm-poweroff.patch DELETED ---


--- linux-2.6-acpi-dock-oops.patch DELETED ---


--- linux-2.6-acpi-keep-tsc-stable-when-lapic-timer-c2-ok-is-set.patch DELETED ---


--- linux-2.6-acpi-preserve-ebx-in-acpi_copy_wakeup_routine.patch DELETED ---


--- linux-2.6-acpi-unblacklist-dell-gx240.patch DELETED ---


--- linux-2.6-amd-disabled-svm-detect-msr-1.patch DELETED ---


--- linux-2.6-amd-disabled-svm-detect.patch DELETED ---


--- linux-2.6-ata-call-check-dma-with-qc-prepared.patch DELETED ---


--- linux-2.6-ata-use-pio-for-non-16-byte-xfers.patch DELETED ---


--- linux-2.6-bcm43xx-pci-neuter.patch DELETED ---


--- linux-2.6-cell-spu-device-tree.patch DELETED ---


--- linux-2.6-cell-spufs-fixes.patch DELETED ---


--- linux-2.6-clockevents-fix-resume-logic.patch DELETED ---


--- linux-2.6-common-uevent.patch DELETED ---


--- linux-2.6-crap-sysfs-workaround.patch DELETED ---


--- linux-2.6-crash-driver-xen.patch DELETED ---


--- linux-2.6-cve-2008-0600.patch DELETED ---


--- linux-2.6-debug-boot-delay.patch DELETED ---


--- linux-2.6-debug-extra-warnings.patch DELETED ---


--- linux-2.6-debug-must_check.patch DELETED ---


--- linux-2.6-debug-slab-backtrace.patch DELETED ---


--- linux-2.6-debug-sysfs-crash-debugging-xen.patch DELETED ---


--- linux-2.6-debug-sysfs-crash-debugging.patch DELETED ---


--- linux-2.6-defaults-nonmi.patch DELETED ---


--- linux-2.6-defaults-pci_no_msi_mmconf.patch DELETED ---


--- linux-2.6-defaults-unicode-vt.patch DELETED ---


--- linux-2.6-devmem-xen.patch DELETED ---


--- linux-2.6-disable-netback-checksum.patch DELETED ---


--- linux-2.6-dvb-spinlock.patch DELETED ---


--- linux-2.6-execshield-xen.patch DELETED ---


--- linux-2.6-firewire-be32-fix.patch DELETED ---


--- linux-2.6-firewire.patch DELETED ---


--- linux-2.6-fix-pmops-1.patch DELETED ---


--- linux-2.6-fix-pmops-2.patch DELETED ---


--- linux-2.6-fix-pmops-3.patch DELETED ---


--- linux-2.6-fix-pmops-4.patch DELETED ---


--- linux-2.6-gfs2-update.patch DELETED ---


--- linux-2.6-i82875-edac-pci-setup.patch DELETED ---


--- linux-2.6-i965gm-support.patch DELETED ---


--- linux-2.6-ibmvscsi-schizo.patch DELETED ---


--- linux-2.6-kvm-19.patch DELETED ---


--- linux-2.6-kvm-reinit-real-mode-tss.patch DELETED ---


--- linux-2.6-libata-atiixp-ids.patch DELETED ---


--- linux-2.6-libata-hpa.patch DELETED ---


--- linux-2.6-libata-ich8m-add-pciid.patch DELETED ---


--- linux-2.6-libata-ncq-blacklist-2.6.22-rc7.patch DELETED ---


--- linux-2.6-libata-pata-hpt3x2n-correct-revision-boundary.patch DELETED ---


--- linux-2.6-libata-pata-pcmcia-new-ident.patch DELETED ---


--- linux-2.6-libata-pata-sis-fix-timing.patch DELETED ---


--- linux-2.6-libata-pata_dma-param.patch DELETED ---


--- linux-2.6-libata-pata_it821x-partly-fix-dma.patch DELETED ---


--- linux-2.6-libata-sata_nv-adma.patch DELETED ---


--- linux-2.6-libata-sata_nv-wildcard-removal.patch DELETED ---


--- linux-2.6-libata-setxfer.patch DELETED ---


--- linux-2.6-libata_ali_max_dma_speed.patch DELETED ---


--- linux-2.6-libertas.diff DELETED ---


--- linux-2.6-mm-udf-fixes.patch DELETED ---


--- linux-2.6-modsign-core.patch DELETED ---


--- linux-2.6-modsign-crypto.patch DELETED ---


--- linux-2.6-modsign-include.patch DELETED ---


--- linux-2.6-modsign-ksign.patch DELETED ---


--- linux-2.6-modsign-mpilib.patch DELETED ---


--- linux-2.6-modsign-script.patch DELETED ---


--- linux-2.6-modsign-verify.patch DELETED ---


--- linux-2.6-module_version.patch DELETED ---


--- linux-2.6-mpc52xx-fec.patch DELETED ---


--- linux-2.6-mpc52xx-sdma.patch DELETED ---


--- linux-2.6-net-e1000-no-msi-warning.patch DELETED ---


--- linux-2.6-netdev-e1000e-01.patch DELETED ---


--- linux-2.6-netdev-e1000e-02.patch DELETED ---


--- linux-2.6-netdev-e1000e-03.patch DELETED ---


--- linux-2.6-netdev-e1000e-04.patch DELETED ---


--- linux-2.6-netdev-e1000e-05.patch DELETED ---


--- linux-2.6-netdev-e1000e-06.patch DELETED ---


--- linux-2.6-netdev-e1000e-07.patch DELETED ---


--- linux-2.6-netdev-e1000e-08.patch DELETED ---


--- linux-2.6-netdev-e1000e-09.patch DELETED ---


--- linux-2.6-netdev-e1000e-10.patch DELETED ---


--- linux-2.6-netdev-e1000e-backport.patch DELETED ---


--- linux-2.6-nfs-missing-braces.patch DELETED ---


--- linux-2.6-nfs-noreaddirplus.patch DELETED ---


--- linux-2.6-olpc-touchpad.diff DELETED ---


--- linux-2.6-ondemand-timer.patch DELETED ---


--- linux-2.6-oprofile-0.9.3.patch DELETED ---


--- linux-2.6-optimise-spinlock-debug.patch DELETED ---


--- linux-2.6-pmac-zilog.patch DELETED ---


--- linux-2.6-powermac-generic-suspend-1.patch DELETED ---


--- linux-2.6-powermac-generic-suspend-2.patch DELETED ---


--- linux-2.6-powermac-generic-suspend-3.patch DELETED ---


--- linux-2.6-powermac-generic-suspend-4.patch DELETED ---


--- linux-2.6-powerpc-reserve-initrd-1.patch DELETED ---


--- linux-2.6-powerpc-reserve-initrd-2.patch DELETED ---


--- linux-2.6-powerpc-slabalign.patch DELETED ---


--- linux-2.6-ppc-data-exception.patch DELETED ---


--- linux-2.6-proc-self-maps-fix.patch DELETED ---


--- linux-2.6-ps3-clear-spu-irq.patch DELETED ---


--- linux-2.6-ps3-device-init.patch DELETED ---


--- linux-2.6-ps3-ethernet-autoload.patch DELETED ---


--- linux-2.6-ps3-ethernet-modular.patch DELETED ---


--- linux-2.6-ps3-gelic-wireless.patch DELETED ---


--- linux-2.6-ps3-gelic.patch DELETED ---


--- linux-2.6-ps3-kexec.patch DELETED ---


--- linux-2.6-ps3-legacy-ioport.patch DELETED ---


--- linux-2.6-ps3-memory-probe.patch DELETED ---


--- linux-2.6-ps3-smp-boot.patch DELETED ---


--- linux-2.6-ps3-sound-autoload.patch DELETED ---


--- linux-2.6-ps3-sound.patch DELETED ---


--- linux-2.6-ps3-stable-patches.patch DELETED ---


--- linux-2.6-ps3-storage.patch DELETED ---


--- linux-2.6-ps3-system-bus-rework-2.patch DELETED ---


--- linux-2.6-ps3-system-bus-rework.patch DELETED ---


--- linux-2.6-ps3-usb-autoload.patch DELETED ---


--- linux-2.6-ps3-wrap-spu-runctl.patch DELETED ---


--- linux-2.6-ps3av-export-header.patch DELETED ---


--- linux-2.6-ps3fb-panic.patch DELETED ---


--- linux-2.6-raid-autorun.patch DELETED ---


--- linux-2.6-scsi-bounce-isa.patch DELETED ---


--- linux-2.6-sha_alignment.patch DELETED ---


--- linux-2.6-softirq-printout-irq-trace-events.patch DELETED ---


--- linux-2.6-softlockup-disable.patch DELETED ---


--- linux-2.6-sumversion-limits-dot-h.patch DELETED ---


--- linux-2.6-suspend-ordering.patch DELETED ---


--- linux-2.6-sysfs-inode-allocator-oops.patch DELETED ---


--- linux-2.6-udf-2.6.22-rc2-1-udf_data_corruption.patch DELETED ---


--- linux-2.6-udf-2.6.22-rc4-1-udf_block_leak.patch DELETED ---


--- linux-2.6-uevent-ebus.patch DELETED ---


--- linux-2.6-uevent-macio.patch DELETED ---


--- linux-2.6-uevent-of_platform.patch DELETED ---


--- linux-2.6-usb-autosuspend-default-disable.patch DELETED ---


--- linux-2.6-use-build-id-ld-option.patch DELETED ---


--- linux-2.6-utrace-ptrace-compat-xen.patch DELETED ---


--- linux-2.6-utrace-recalc_sigpending_and_wake.patch DELETED ---


--- linux-2.6-utrace-sig_kernel-macros.patch DELETED ---


--- linux-2.6-utrace-tracehook-xen.patch DELETED ---


--- linux-2.6-vm-invalidate_mapping_pages-cond-resched.patch DELETED ---


--- linux-2.6-vm-silence-atomic-alloc-failures.patch DELETED ---


--- linux-2.6-wakeups-hdaps.patch DELETED ---


--- linux-2.6-x86-64-edac-support.patch DELETED ---


--- linux-2.6-x86-64_pmtrace.patch DELETED ---


--- linux-2.6-x86-dell-hpet.patch DELETED ---


--- linux-2.6-x86-dont-delete-cpu_devs-data.patch DELETED ---


--- linux-2.6-x86-fsc-interrupt-controller-quirk.patch DELETED ---


--- linux-2.6-x86-vga-vidfail.patch DELETED ---


--- linux-2.6-x86_64-silence-up-apic-errors-xen.patch DELETED ---


--- linux-2.6-x86_64-silence-up-apic-errors.patch DELETED ---


--- linux-2.6-xen-backwards-time.patch DELETED ---


--- linux-2.6-xen-blkfront-wait-add.patch DELETED ---


--- linux-2.6-xen-fix-irq-warn-mismerge.patch DELETED ---


--- linux-2.6-xen-irq_vector-uninitialize.patch DELETED ---


--- linux-2.6-xen-paravirt-nographics-pvfb-fix.patch DELETED ---


--- linux-2.6-xen-privcmd-use-nopfn.patch DELETED ---


--- linux-2.6-xen-sleazy-fpu-i386.patch DELETED ---


--- linux-2.6-xen-sleazy-fpu-x86_64.patch DELETED ---


--- linux-2.6.20.tar.bz2.sign DELETED ---




More information about the fedora-extras-commits mailing list