From: Andi Kleen Sync -mm* with my x86-64 tree. This fixes a lot of bugs. Most of that should be probably in Linus' tree too, but it isn't right now. - make it compile again in -mm* (MPI still caused problems) - Fix dependency for CONFIG_IOMMU_DEBUG - New defconfig, disable IOMMU_DEBUG in there - Syscall restart race fixes from i386 - Quieten old module syscalls - Fix 32bit truncate64 - Make cpuid compile as both modular and static object - Make ACPI compile again - Some swsusp updates from Pavel - Clean up questionable code in smp startup - Fix MCE decoding, always enable MCEs (untested right now) - Some more merges with i386 - Lots of IOMMU bug fixes: - work around mpt fusion bug in some quartets - disable panic_on_overflow by default - make iommu merge an option - disable sac_force by default, add an option - synchronize GART TLB flush - add iommu=fullflush option - force fullflush with 3ware controllers (kludge) - use normal dma mask for pci_alloc_consistent too (makes us bug-to-bug compatible with i386) - add some debugging code - fix precondition for iommu merging - fix handling of sg entries over multiple pages (Badari Pulavarti) - fix AGP with iommu - fix compilation with iommu disabled There is still one open issue that needs to be tracked down. - don't allow ring 3 code to access all memory in prefetch check - fix RBP offset in calling.h (Jim Houston) - extern inline -> static inline in header files - fix _syscall6 (Olaf Hering) - better code for safe_smp_processor_id() - support topology in sysfs arch/x86_64/Kconfig | 1 arch/x86_64/defconfig | 68 +++++++++++++++++++++-------- arch/x86_64/ia32/ia32_signal.c | 3 + arch/x86_64/ia32/ia32entry.S | 8 +-- arch/x86_64/ia32/sys_ia32.c | 33 ++++++++++---- arch/x86_64/ia32/syscall32.c | 4 + arch/x86_64/kernel/Makefile | 7 ++- arch/x86_64/kernel/acpi/boot.c | 29 ++++++++++++ arch/x86_64/kernel/acpi/sleep.c | 17 +++++++ arch/x86_64/kernel/acpi/wakeup.S | 21 +++++++-- arch/x86_64/kernel/apic.c | 6 +- arch/x86_64/kernel/bluesmoke.c | 59 +++++++++++-------------- arch/x86_64/kernel/e820.c | 4 - arch/x86_64/kernel/head.S | 19 +------- arch/x86_64/kernel/io_apic.c | 14 +++--- arch/x86_64/kernel/pci-gart.c | 89 ++++++++++++++++++++++++++++++++------- arch/x86_64/kernel/pci-nommu.c | 2 arch/x86_64/kernel/setup.c | 2 arch/x86_64/kernel/signal.c | 2 arch/x86_64/kernel/smpboot.c | 2 arch/x86_64/mm/fault.c | 3 + include/asm-x86_64/apic.h | 2 include/asm-x86_64/calling.h | 2 include/asm-x86_64/cpu.h | 1 include/asm-x86_64/desc.h | 2 include/asm-x86_64/fixmap.h | 2 include/asm-x86_64/io.h | 18 +++---- include/asm-x86_64/io_apic.h | 3 - include/asm-x86_64/memblk.h | 1 include/asm-x86_64/msr.h | 10 ++-- include/asm-x86_64/node.h | 1 include/asm-x86_64/pgalloc.h | 2 include/asm-x86_64/pgtable.h | 36 +++++++-------- include/asm-x86_64/processor.h | 4 - include/asm-x86_64/smp.h | 2 include/asm-x86_64/system.h | 2 include/asm-x86_64/topology.h | 1 include/asm-x86_64/uaccess.h | 2 include/asm-x86_64/unistd.h | 7 +-- 39 files changed, 327 insertions(+), 164 deletions(-) diff -puN arch/x86_64/defconfig~x86_64-update arch/x86_64/defconfig --- 25/arch/x86_64/defconfig~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/defconfig 2003-11-23 15:22:24.000000000 -0800 @@ -59,7 +59,6 @@ CONFIG_X86_CPUID=y CONFIG_X86_IO_APIC=y CONFIG_X86_LOCAL_APIC=y CONFIG_MTRR=y -# CONFIG_HUGETLB_PAGE is not set CONFIG_SMP=y # CONFIG_PREEMPT is not set CONFIG_K8_NUMA=y @@ -79,9 +78,9 @@ CONFIG_SOFTWARE_SUSPEND=y # # ACPI (Advanced Configuration and Power Interface) Support # -# CONFIG_ACPI_HT is not set CONFIG_ACPI=y CONFIG_ACPI_BOOT=y +CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_SLEEP=y CONFIG_ACPI_SLEEP_PROC_FS=y CONFIG_ACPI_AC=y @@ -94,11 +93,29 @@ CONFIG_ACPI_THERMAL=y CONFIG_ACPI_TOSHIBA=y CONFIG_ACPI_DEBUG=y CONFIG_ACPI_BUS=y -CONFIG_ACPI_INTERPRETER=y CONFIG_ACPI_EC=y CONFIG_ACPI_POWER=y CONFIG_ACPI_PCI=y CONFIG_ACPI_SYSTEM=y +CONFIG_ACPI_RELAXED_AML=y + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_PROC_INTF=y +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +# CONFIG_CPU_FREQ_24_API is not set +CONFIG_CPU_FREQ_TABLE=y + +# +# CPUFreq processor drivers +# +CONFIG_X86_POWERNOW_K8=y # # Bus options (PCI etc.) @@ -246,6 +263,7 @@ CONFIG_BLK_DEV_SD=y # 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 # CONFIG_SCSI_DMX3191D is not set @@ -325,7 +343,9 @@ CONFIG_IPV6_SCTP__=y # CONFIG_IP_SCTP is not set # CONFIG_ATM is not set # CONFIG_VLAN_8021Q is not set -# CONFIG_LLC is not set +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_NET_DIVERT is not set @@ -358,7 +378,7 @@ CONFIG_NETDEVICES=y # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y -# CONFIG_MII is not set +CONFIG_MII=y # CONFIG_HAPPYMEAL is not set # CONFIG_SUNGEM is not set # CONFIG_NET_VENDOR_3COM is not set @@ -388,7 +408,6 @@ CONFIG_8139TOO=m # CONFIG_SIS900 is not set # CONFIG_EPIC100 is not set # CONFIG_SUNDANCE is not set -# CONFIG_TLAN is not set # CONFIG_VIA_RHINE is not set # @@ -421,10 +440,10 @@ CONFIG_TIGON3=y # CONFIG_NET_RADIO is not set # -# Token Ring devices (depends on LLC=y) +# Token Ring devices # +# CONFIG_TR is not set # CONFIG_NET_FC is not set -# CONFIG_RCPCI is not set # CONFIG_SHAPER is not set # @@ -443,6 +462,11 @@ CONFIG_TIGON3=y # CONFIG_IRDA is not set # +# Bluetooth support +# +# CONFIG_BT is not set + +# # ISDN subsystem # # CONFIG_ISDN_BOOL is not set @@ -485,6 +509,7 @@ CONFIG_KEYBOARD_ATKBD=y # CONFIG_KEYBOARD_NEWTON is not set CONFIG_INPUT_MOUSE=y CONFIG_MOUSE_PS2=y +# CONFIG_MOUSE_PS2_SYNAPTICS is not set # CONFIG_MOUSE_SERIAL is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TOUCHSCREEN is not set @@ -504,6 +529,7 @@ CONFIG_HW_CONSOLE=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y # CONFIG_SERIAL_8250_ACPI is not set +CONFIG_SERIAL_8250_NR_UARTS=4 # CONFIG_SERIAL_8250_EXTENDED is not set # @@ -520,7 +546,11 @@ CONFIG_UNIX98_PTY_COUNT=256 # CONFIG_I2C is not set # -# I2C Hardware Sensors Mainboard support +# I2C Algorithms +# + +# +# I2C Hardware Bus support # # @@ -549,7 +579,6 @@ CONFIG_RTC=y # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set -# CONFIG_SONYPI is not set # # Ftape, the floppy tape device driver @@ -559,6 +588,7 @@ CONFIG_AGP_AMD64=y # CONFIG_DRM is not set # CONFIG_MWAVE is not set CONFIG_RAW_DRIVER=y +CONFIG_MAX_RAW_DEVS=256 CONFIG_HANGCHECK_TIMER=y # @@ -619,10 +649,13 @@ CONFIG_ISO9660_FS=y # Pseudo filesystems # CONFIG_PROC_FS=y +CONFIG_PROC_KCORE=y # CONFIG_DEVFS_FS is not set CONFIG_DEVPTS_FS=y # CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y +CONFIG_HUGETLBFS=y +CONFIG_HUGETLB_PAGE=y CONFIG_RAMFS=y # @@ -647,6 +680,7 @@ CONFIG_RAMFS=y CONFIG_NFS_FS=y CONFIG_NFS_V3=y # CONFIG_NFS_V4 is not set +# CONFIG_NFS_DIRECTIO is not set CONFIG_NFSD=y CONFIG_NFSD_V3=y # CONFIG_NFSD_V4 is not set @@ -707,13 +741,15 @@ CONFIG_SOUND_PRIME=y # CONFIG_SOUND_MAESTRO is not set # CONFIG_SOUND_MAESTRO3 is not set CONFIG_SOUND_ICH=y -# CONFIG_SOUND_RME96XX is not set # CONFIG_SOUND_SONICVIBES is not set # CONFIG_SOUND_TRIDENT is not set +# CONFIG_SOUND_MSNDCLAS is not set +# CONFIG_SOUND_MSNDPIN is not set # CONFIG_SOUND_VIA82CXXX is not set # CONFIG_SOUND_OSS is not set # CONFIG_SOUND_ALI5455 is not set # CONFIG_SOUND_FORTE is not set +# CONFIG_SOUND_RME96XX is not set # CONFIG_SOUND_AD1980 is not set # @@ -723,11 +759,6 @@ CONFIG_SOUND_ICH=y # CONFIG_USB_GADGET is not set # -# Bluetooth support -# -# CONFIG_BT is not set - -# # Profiling support # CONFIG_PROFILING=y @@ -743,8 +774,7 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_INIT_DEBUG is not set # CONFIG_DEBUG_INFO is not set # CONFIG_FRAME_POINTER is not set -CONFIG_IOMMU_DEBUG=y -CONFIG_IOMMU_LEAK=y +# CONFIG_IOMMU_DEBUG is not set CONFIG_MCE_DEBUG=y # @@ -760,4 +790,4 @@ CONFIG_MCE_DEBUG=y # # Library routines # -# CONFIG_CRC32 is not set +CONFIG_CRC32=y diff -puN arch/x86_64/ia32/ia32entry.S~x86_64-update arch/x86_64/ia32/ia32entry.S --- 25/arch/x86_64/ia32/ia32entry.S~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/ia32/ia32entry.S 2003-11-23 19:01:39.000000000 -0800 @@ -330,10 +330,10 @@ ia32_sys_call_table: .quad sys32_adjtimex .quad sys32_mprotect /* 125 */ .quad compat_sys_sigprocmask - .quad sys32_module_warning /* create_module */ + .quad quiet_ni_syscall /* create_module */ .quad sys_init_module .quad sys_delete_module - .quad sys32_module_warning /* 130 get_kernel_syms */ + .quad quiet_ni_syscall /* 130 get_kernel_syms */ .quad ni_syscall /* quotactl */ .quad sys_getpgid .quad sys_fchdir @@ -396,8 +396,8 @@ ia32_sys_call_table: .quad stub32_vfork /* 190 */ .quad compat_sys_getrlimit .quad sys32_mmap2 - .quad sys_truncate - .quad sys_ftruncate + .quad sys32_truncate64 + .quad sys32_ftruncate64 .quad sys32_stat64 /* 195 */ .quad sys32_lstat64 .quad sys32_fstat64 diff -puN arch/x86_64/ia32/ia32_signal.c~x86_64-update arch/x86_64/ia32/ia32_signal.c --- 25/arch/x86_64/ia32/ia32_signal.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/ia32/ia32_signal.c 2003-11-23 15:22:24.000000000 -0800 @@ -173,6 +173,9 @@ ia32_restore_sigcontext(struct pt_regs * { unsigned int err = 0; + /* Always make any pending restarted system calls return -EINTR */ + current_thread_info()->restart_block.fn = do_no_restart_syscall; + #if DEBUG_SIG printk("SIG restore_sigcontext: sc=%p err(%x) eip(%x) cs(%x) flg(%x)\n", sc, sc->err, sc->eip, sc->cs, sc->eflags); diff -puN arch/x86_64/ia32/syscall32.c~x86_64-update arch/x86_64/ia32/syscall32.c --- 25/arch/x86_64/ia32/syscall32.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/ia32/syscall32.c 2003-11-23 15:22:24.000000000 -0800 @@ -30,10 +30,12 @@ char *syscall32_page; int map_syscall32(struct mm_struct *mm, unsigned long address) { pte_t *pte; + pmd_t *pmd; int err = 0; + down_read(&mm->mmap_sem); spin_lock(&mm->page_table_lock); - pmd_t *pmd = pmd_alloc(mm, pgd_offset(mm, address), address); + pmd = pmd_alloc(mm, pgd_offset(mm, address), address); if (pmd && (pte = pte_alloc_map(mm, pmd, address)) != NULL) { if (pte_none(*pte)) { set_pte(pte, diff -puN arch/x86_64/ia32/sys_ia32.c~x86_64-update arch/x86_64/ia32/sys_ia32.c --- 25/arch/x86_64/ia32/sys_ia32.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/ia32/sys_ia32.c 2003-11-23 15:22:24.000000000 -0800 @@ -110,6 +110,22 @@ int cp_compat_stat(struct kstat *kbuf, s return 0; } +extern long sys_truncate(char *, loff_t); +extern long sys_ftruncate(int, loff_t); + +asmlinkage long +sys32_truncate64(char * filename, unsigned long offset_low, unsigned long offset_high) +{ + return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low); +} + + +asmlinkage long +sys32_ftruncate64(unsigned int fd, unsigned long offset_low, unsigned long offset_high) +{ + return sys_ftruncate(fd, ((loff_t) offset_high << 32) | offset_low); +} + /* Another set for IA32/LFS -- x86_64 struct stat is different due to support for 64bit inode numbers. */ @@ -1817,13 +1833,6 @@ long asmlinkage sys32_nfsservctl(int cmd } #endif -long sys32_module_warning(void) -{ - printk(KERN_INFO "%s: 32bit 2.4.x modutils not supported on 64bit kernel\n", - current->comm); - return -ENOSYS ; -} - extern long sys_io_setup(unsigned nr_reqs, aio_context_t *ctx); long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p) @@ -1989,12 +1998,16 @@ long sys32_fadvise64_64(int fd, __u32 of long sys32_vm86_warning(void) { + struct task_struct *me = current; + static char lastcomm[8]; + if (strcmp(lastcomm, me->comm)) { printk(KERN_INFO "%s: vm86 mode not supported on 64 bit kernel\n", - current->comm); - return -ENOSYS ; + me->comm); + strcpy(lastcomm, me->comm); + } + return -ENOSYS; } - struct exec_domain ia32_exec_domain = { .name = "linux/x86", .pers_low = PER_LINUX32, diff -puN arch/x86_64/Kconfig~x86_64-update arch/x86_64/Kconfig --- 25/arch/x86_64/Kconfig~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/Kconfig 2003-11-23 19:01:39.000000000 -0800 @@ -505,6 +505,7 @@ config FRAME_POINTER Normally you should say N. config IOMMU_DEBUG + depends on GART_IOMMU && DEBUG_KERNEL bool "Force IOMMU to on" help Force the IOMMU to on even when you have less than 4GB of memory and add diff -puN arch/x86_64/kernel/acpi/boot.c~x86_64-update arch/x86_64/kernel/acpi/boot.c --- 25/arch/x86_64/kernel/acpi/boot.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/acpi/boot.c 2003-11-23 15:22:24.000000000 -0800 @@ -267,7 +267,7 @@ acpi_parse_hpet ( * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) */ -static __initdata acpi_pic_sci_trigger; /* 0: level, 1: edge */ +static int __initdata acpi_pic_sci_trigger; /* 0: level, 1: edge */ void __init acpi_pic_sci_set_trigger(unsigned int irq) @@ -315,6 +315,33 @@ __setup("acpi_pic_sci=", acpi_pic_sci_se #endif /* CONFIG_ACPI_BUS */ +#ifdef CONFIG_ACPI_BUS +/* + * Set specified PIC IRQ to level triggered mode. + * + * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers + * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge. + * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0) + * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) + * + * As the BIOS should have done this for us, + * print a warning if the IRQ wasn't already set to level. + */ + +void acpi_pic_set_level_irq(unsigned int irq) +{ + unsigned char mask = 1 << (irq & 7); + unsigned int port = 0x4d0 + (irq >> 3); + unsigned char val = inb(port); + + if (!(val & mask)) { + printk(KERN_WARNING PREFIX "IRQ %d was Edge Triggered, " + "setting to Level Triggerd\n", irq); + outb(val | mask, port); + } +} +#endif /* CONFIG_ACPI_BUS */ + static unsigned long __init acpi_scan_rsdp ( unsigned long start, diff -puN arch/x86_64/kernel/acpi/sleep.c~x86_64-update arch/x86_64/kernel/acpi/sleep.c --- 25/arch/x86_64/kernel/acpi/sleep.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/acpi/sleep.c 2003-11-23 15:22:24.000000000 -0800 @@ -56,6 +56,7 @@ /* address in low memory of the wakeup routine. */ unsigned long acpi_wakeup_address = 0; +unsigned long acpi_video_flags; extern char wakeup_start, wakeup_end; extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); @@ -116,6 +117,22 @@ void __init acpi_reserve_bootmem(void) printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address); } +static int __init acpi_sleep_setup(char *str) +{ + while ((str != NULL) && (*str != '\0')) { + if (strncmp(str, "s3_bios", 7) == 0) + acpi_video_flags = 1; + if (strncmp(str, "s3_mode", 7) == 0) + acpi_video_flags |= 2; + str = strchr(str, ','); + if (str != NULL) + str += strspn(str, ", \t"); + } + return 1; +} + +__setup("acpi_sleep=", acpi_sleep_setup); + #endif /*CONFIG_ACPI_SLEEP*/ void acpi_pci_link_exit(void) {} diff -puN arch/x86_64/kernel/acpi/wakeup.S~x86_64-update arch/x86_64/kernel/acpi/wakeup.S --- 25/arch/x86_64/kernel/acpi/wakeup.S~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/acpi/wakeup.S 2003-11-23 15:22:24.000000000 -0800 @@ -41,7 +41,19 @@ wakeup_code: cmpl $0x12345678, %eax jne bogus_real_magic + testl $1, video_flags - wakeup_code + jz 1f lcall $0xc000,$3 + movw %cs, %ax + movw %ax, %ds # Bios might have played with that + movw %ax, %ss +1: + + testl $2, video_flags - wakeup_code + jz 1f + mov video_mode - wakeup_code, %ax + call mode_seta +1: movw $0xb800, %ax movw %ax,%fs @@ -250,6 +262,7 @@ real_save_gdt: .word 0 .quad 0 real_magic: .quad 0 video_mode: .quad 0 +video_flags: .quad 0 bogus_real_magic: movb $0xba,%al ; outb %al,$0x80 @@ -382,8 +395,10 @@ ENTRY(acpi_copy_wakeup_routine) movl %eax, saved_efer movl %edx, saved_efer2 -# movq saved_videomode, %rdx # FIXME: videomode - movq %rdx, video_mode - wakeup_start (,%rdi) + movl saved_video_mode, %edx + movl %edx, video_mode - wakeup_start (,%rdi) + movl acpi_video_flags, %edx + movl %edx, video_flags - wakeup_start (,%rdi) movq $0x12345678, real_magic - wakeup_start (,%rdi) movq $0x123456789abcdef0, %rdx movq %rdx, saved_magic @@ -415,8 +430,6 @@ do_suspend_lowlevel: .LFB5: subq $8, %rsp .LCFI2: - testl %edi, %edi - jne .L99 xorl %eax, %eax call save_processor_state diff -puN arch/x86_64/kernel/apic.c~x86_64-update arch/x86_64/kernel/apic.c --- 25/arch/x86_64/kernel/apic.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/apic.c 2003-11-23 15:22:24.000000000 -0800 @@ -42,6 +42,8 @@ static DEFINE_PER_CPU(int, prof_multipli static DEFINE_PER_CPU(int, prof_old_multiplier) = 1; static DEFINE_PER_CPU(int, prof_counter) = 1; +static void apic_pm_activate(void); + void enable_NMI_through_LVT0 (void * dummy) { unsigned int v, ver; @@ -435,6 +437,7 @@ void __init setup_local_APIC (void) if (nmi_watchdog == NMI_LOCAL_APIC) setup_apic_nmi_watchdog(); + apic_pm_activate(); } #ifdef CONFIG_PM @@ -556,7 +559,7 @@ device_initcall(init_lapic_sysfs); #else /* CONFIG_PM */ -static inline void apic_pm_activate(void) { } +static void apic_pm_activate(void) { } #endif /* CONFIG_PM */ @@ -579,7 +582,6 @@ static int __init detect_init_APIC (void if (nmi_watchdog != NMI_NONE) nmi_watchdog = NMI_LOCAL_APIC; - apic_pm_activate(); return 0; } diff -puN arch/x86_64/kernel/bluesmoke.c~x86_64-update arch/x86_64/kernel/bluesmoke.c --- 25/arch/x86_64/kernel/bluesmoke.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/bluesmoke.c 2003-11-23 15:22:24.000000000 -0800 @@ -200,11 +200,14 @@ static char *highbits[32] = { static void check_k8_nb(int header) { struct pci_dev *nb; + u32 statuslow, statushigh; + unsigned short errcode; + int i; + nb = find_k8_nb(); if (nb == NULL) return; - u32 statuslow, statushigh; pci_read_config_dword(nb, 0x48, &statuslow); pci_read_config_dword(nb, 0x4c, &statushigh); if (!(statushigh & (1<<31))) @@ -215,50 +218,42 @@ static void check_k8_nb(int header) printk(KERN_ERR "Northbridge status %08x%08x\n", statushigh,statuslow); - unsigned short errcode = statuslow & 0xffff; - switch (errcode >> 8) { - case 0: + printk(KERN_ERR " Error %s\n", extendederr[(statuslow >> 16) & 0xf]); + + errcode = statuslow & 0xffff; + switch ((statuslow >> 16) & 0xF) { + case 5: printk(KERN_ERR " GART TLB error %s %s\n", transaction[(errcode >> 2) & 3], cachelevel[errcode & 3]); break; - case 1: - if (errcode & (1<<11)) { - printk(KERN_ERR " bus error %s %s %s %s %s\n", - partproc[(errcode >> 10) & 0x3], - timeout[(errcode >> 9) & 1], + case 8: + printk(KERN_ERR " ECC error syndrome %x\n", + (((statuslow >> 24) & 0xff) << 8) | ((statushigh >> 15) & 0x7f)); + /*FALL THROUGH*/ + default: + printk(KERN_ERR " bus error %s, %s\n %s\n %s, %s\n", + partproc[(errcode >> 9) & 0x3], + timeout[(errcode >> 8) & 1], memtrans[(errcode >> 4) & 0xf], memoryio[(errcode >> 2) & 0x3], cachelevel[(errcode & 0x3)]); - } else if (errcode & (1<<8)) { - printk(KERN_ERR " memory error %s %s %s\n", - memtrans[(errcode >> 4) & 0xf], - transaction[(errcode >> 2) & 0x3], - cachelevel[(errcode & 0x3)]); - } else { - printk(KERN_ERR " unknown error code %x\n", errcode); - } - break; - } - if (statushigh & ((1<<14)|(1<<13))) - printk(KERN_ERR " ECC syndrome bits %x\n", - (((statuslow >> 24) & 0xff) << 8) | ((statushigh >> 15) & 0x7f)); - errcode = (statuslow >> 16) & 0xf; - printk(KERN_ERR " extended error %s\n", extendederr[(statuslow >> 16) & 0xf]); - /* should only print when it was a HyperTransport related error. */ printk(KERN_ERR " link number %x\n", (statushigh >> 4) & 3); + break; + } - int i; - for (i = 0; i < 32; i++) + for (i = 0; i < 32; i++) { + if (i == 26 || i == 28) + continue; if (highbits[i] && (statushigh & (1<rip, regs->rsp); - others: generic_machine_check(regs, error_code); @@ -373,6 +365,9 @@ static void __init k8_mcheck_init(struct wrmsrl(MSR_IA32_MC0_STATUS+4*i,0); } + if (cap & (1<<8)) + wrmsrl(MSR_IA32_MCG_CTL, 0xffffffffffffffffULL); + set_in_cr4(X86_CR4_MCE); if (mcheck_interval && (smp_processor_id() == 0)) { diff -puN arch/x86_64/kernel/e820.c~x86_64-update arch/x86_64/kernel/e820.c --- 25/arch/x86_64/kernel/e820.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/e820.c 2003-11-23 15:22:24.000000000 -0800 @@ -2,10 +2,6 @@ * Handle the memory map. * The functions here do the job until bootmem takes over. * $Id: e820.c,v 1.4 2002/09/19 19:25:32 ak Exp $ - - * AK: some of these functions are not used in 2.5 yet but they will be when - * NUMA is completely merged. - */ #include #include diff -puN arch/x86_64/kernel/head.S~x86_64-update arch/x86_64/kernel/head.S --- 25/arch/x86_64/kernel/head.S~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/head.S 2003-11-23 15:22:24.000000000 -0800 @@ -38,6 +38,9 @@ startup_32: movl %ebx,%ebp /* Save trampoline flag */ + movl $__KERNEL_DS,%eax + movl %eax,%ds + /* If the CPU doesn't support CPUID this will double fault. * Unfortunately it is hard to check for CPUID without a stack. */ @@ -114,25 +117,11 @@ reach_compatibility_mode: movl $(pGDT32 - __START_KERNEL_map), %eax lgdt (%eax) +second: movl $(ljumpvector - __START_KERNEL_map), %eax /* Finally jump in 64bit mode */ ljmp *(%eax) -second: - /* abuse syscall to get into 64bit mode. this way we don't need - a working low identity mapping just for the short 32bit roundtrip. - XXX kludge. this should not be needed. */ - movl $MSR_STAR,%ecx - xorl %eax,%eax - movl $(__USER32_CS<<16)|__KERNEL_CS,%edx - wrmsr - - movl $MSR_CSTAR,%ecx - movl $0xffffffff,%edx - movl $0x80100100,%eax # reach_long64 absolute - wrmsr - syscall - .code64 .org 0x100 reach_long64: diff -puN arch/x86_64/kernel/io_apic.c~x86_64-update arch/x86_64/kernel/io_apic.c --- 25/arch/x86_64/kernel/io_apic.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/io_apic.c 2003-11-23 15:22:24.000000000 -0800 @@ -147,6 +147,13 @@ void clear_IO_APIC_pin(unsigned int apic struct IO_APIC_route_entry entry; unsigned long flags; + /* Check delivery_mode to be sure we're not clearing an SMI pin */ + spin_lock_irqsave(&ioapic_lock, flags); + *(((int*)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); + *(((int*)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin); + spin_unlock_irqrestore(&ioapic_lock, flags); + if (entry.delivery_mode == dest_SMI) + return; /* * Disable it in the IO-APIC irq-routing table: */ @@ -1210,8 +1217,6 @@ static int __init timer_irq_works(void) */ #define enable_edge_ioapic_irq unmask_IO_APIC_irq -static void disable_edge_ioapic_irq (unsigned int irq) { /* nothing */ } - /* * Starting up a edge-triggered IO-APIC interrupt is * nasty - we need to make sure that we get the edge. @@ -1254,9 +1259,6 @@ static void ack_edge_ioapic_irq(unsigned ack_APIC_irq(); } -static void end_edge_ioapic_irq (unsigned int i) { /* nothing */ } - - /* * Level triggered interrupts can just be masked, * and shutting down and starting up the interrupt @@ -1341,8 +1343,6 @@ static void end_level_ioapic_irq (unsign } } -static void mask_and_ack_level_ioapic_irq (unsigned int irq) { /* nothing */ } - static void set_ioapic_affinity (unsigned int irq, cpumask_t mask) { unsigned long flags; diff -puN arch/x86_64/kernel/Makefile~x86_64-update arch/x86_64/kernel/Makefile --- 25/arch/x86_64/kernel/Makefile~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/Makefile 2003-11-23 15:22:24.000000000 -0800 @@ -18,13 +18,16 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o obj-$(CONFIG_PM) += suspend.o obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o +obj-$(CONFIG_CPU_FREQ) += cpufreq/ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o obj-$(CONFIG_MODULES) += module.o +obj-y += topology.o + bootflag-y += ../../i386/kernel/bootflag.o -cpuid-$(CONFIG_X86_CPUID) += ../../i386/kernel/cpuid.o +cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o +topology-y += ../../i386/mach-default/topology.o -obj-$(CONFIG_CPU_FREQ) += cpufreq/ diff -puN arch/x86_64/kernel/pci-gart.c~x86_64-update arch/x86_64/kernel/pci-gart.c --- 25/arch/x86_64/kernel/pci-gart.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/pci-gart.c 2003-11-23 15:22:24.000000000 -0800 @@ -31,6 +31,10 @@ #include #include +/* Workarounds for specific drivers */ +#define FUSION_WORKAROUND 1 +#define THREEWARE_WORKAROUND 1 + dma_addr_t bad_dma_address; unsigned long iommu_bus_base; /* GART remapping area (physical) */ @@ -44,12 +48,13 @@ static int no_agp; #ifdef CONFIG_IOMMU_DEBUG int panic_on_overflow = 1; int force_iommu = 1; -int sac_force_size = 0; #else -int panic_on_overflow = 1; /* for testing */ +int panic_on_overflow = 0; int force_iommu = 0; -int sac_force_size = 256*1024*1024; #endif +int iommu_merge = 1; +int iommu_sac_force = 0; +int iommu_fullflush = 0; /* Allocation bitmap for the remapping area */ static spinlock_t iommu_bitmap_lock = SPIN_LOCK_UNLOCKED; @@ -137,10 +142,15 @@ static void __flush_gart(struct pci_dev /* recheck flush count inside lock */ if (need_flush) { for (i = 0; northbridges[i]; i++) { + u32 w; if (bus >= 0 && !(cpu_isset_const(i, bus_cpumask))) continue; pci_write_config_dword(northbridges[i], 0x9c, northbridge_flush_word[i] | 1); + /* Make sure the hardware actually executed the flush. */ + do { + pci_read_config_dword(northbridges[i], 0x9c, &w); + } while (w & 1); flushed++; } if (!flushed) @@ -152,6 +162,8 @@ static void __flush_gart(struct pci_dev static inline void flush_gart(struct pci_dev *dev) { + if (iommu_fullflush) + need_flush = 1; if (need_flush) __flush_gart(dev); } @@ -174,11 +186,16 @@ void *pci_alloc_consistent(struct pci_de } else { dma_mask = hwdev->consistent_dma_mask; } + if (dma_mask == 0) dma_mask = 0xffffffff; if (dma_mask < 0xffffffff || no_iommu) gfp |= GFP_DMA; + /* Kludge to make it bug-to-bug compatible with i386. i386 + uses the normal dma_mask for alloc_consistent. */ + dma_mask &= hwdev->dma_mask; + memory = (void *)__get_free_pages(gfp, get_order(size)); if (memory == NULL) { return NULL; @@ -381,6 +398,16 @@ static int pci_map_sg_nonforce(struct pc return nents; } +static void dump_sg(struct scatterlist *sg, int stopat) +{ + int k; + for (k = 0; k < stopat; k++) + printk(KERN_EMERG "sg[%d] page:%p dma:%lx offset:%u length:%u\n", + k, + sg[k].page, (unsigned long)sg[k].dma_address, sg[k].offset, + sg[k].length); +} + /* Map multiple scatterlist entries continuous into the first. */ static int __pci_map_cont(struct scatterlist *sg, int start, int stopat, struct scatterlist *sout, unsigned long pages) @@ -394,7 +421,9 @@ static int __pci_map_cont(struct scatter for (i = start; i < stopat; i++) { struct scatterlist *s = &sg[i]; - unsigned long start_addr = s->dma_address; + unsigned long pages, addr; + unsigned long phys_addr = s->dma_address; + BUG_ON(i > start && s->offset); if (i == start) { *sout = *s; @@ -403,15 +432,23 @@ static int __pci_map_cont(struct scatter } else { sout->length += s->length; } - unsigned long addr = start_addr; - while (addr < start_addr + s->length) { + + addr = phys_addr; + pages = to_pages(s->offset, s->length); + while (pages--) { iommu_gatt_base[iommu_page] = GPTE_ENCODE(addr); SET_LEAK(iommu_page); addr += PAGE_SIZE; iommu_page++; } } - BUG_ON(iommu_page - iommu_start != pages); + if (iommu_page - iommu_start != pages) { + printk(KERN_EMERG + "iommu_page:%lx iommu_start:%lx pages:%lu start:%d stopat:%d\n", + iommu_page, iommu_start, pages, start, stopat); + dump_sg(sg, stopat); + panic("IOMMU confused"); + } return 0; } @@ -458,8 +495,8 @@ int pci_map_sg(struct pci_dev *dev, stru if (i > start) { struct scatterlist *ps = &sg[i-1]; /* Can only merge when the last chunk ends on a page - boundary. */ - if (!force_iommu || !need || (i-1 > start && ps->offset) || + boundary and the new one doesn't have an offset. */ + if (!iommu_merge || !need || s->offset || (ps->offset + ps->length) % PAGE_SIZE) { if (pci_map_cont(sg, start, i, sg+out, pages, need) < 0) @@ -539,19 +576,28 @@ int pci_dma_supported(struct pci_dev *de if (mask < 0x00ffffff) return 0; +#ifdef FUSION_WORKAROUND + if (dev->vendor == PCI_VENDOR_ID_LSI_LOGIC && mask > 0xffffffff) { + iommu_merge = 1; + return 0; + } +#endif +#ifdef THREEWARE_WORKAROUND + if (dev->vendor == PCI_VENDOR_ID_3WARE && mask <= 0xffffffff) + iommu_fullflush = 1; +#endif + /* Tell the device to use SAC when IOMMU force is on. This allows the driver to use cheaper accesses in some cases. Problem with this is that if we overflow the IOMMU area and return DAC as fallback address the device may not handle it correctly. - As a compromise we only do this if the IOMMU area is >= 256MB - which should make overflow unlikely enough. As a special case some controllers have a 39bit address mode that is as efficient as 32bit (aic79xx). Don't force SAC for these. Assume all masks <= 40 bits are of this type. Normally this doesn't make any difference, but gives more gentle handling of IOMMU overflow. */ - if (force_iommu && (mask > 0xffffffffffULL) && (iommu_size >= sac_force_size)){ + if (iommu_sac_force && (mask >= 0xffffffffffULL)) { printk(KERN_INFO "%s: Force SAC with mask %Lx\n", dev->slot_name,mask); return 0; } @@ -680,7 +726,7 @@ static int __init pci_iommu_init(void) unsigned long iommu_start; struct pci_dev *dev; -#ifndef CONFIG_AGP_AMD_8151 +#ifndef CONFIG_AGP_AMD64 no_agp = 1; #else /* Makefile puts PCI initialization via subsys_initcall first. */ @@ -776,7 +822,8 @@ static int __init pci_iommu_init(void) /* Must execute after PCI subsystem */ fs_initcall(pci_iommu_init); -/* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]] +/* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] + [,forcesac][,fullflush][,nomerge] size set size of iommu (in bytes) noagp don't initialize the AGP driver and use full aperture. off don't use the IOMMU @@ -784,6 +831,10 @@ fs_initcall(pci_iommu_init); memaper[=order] allocate an own aperture over RAM with size 32MB^order. noforce don't force IOMMU usage. Default. force Force IOMMU. + merge Do SG merging. Implies force (experimental) + nomerge Don't do SG merging. + forcesac For SAC mode for masks <40bits (experimental) + fullflush Flush IOMMU on each allocation (for testing) */ __init int iommu_setup(char *opt) { @@ -809,6 +860,16 @@ __init int iommu_setup(char *opt) panic_on_overflow = 1; if (!memcmp(p, "nopanic", 7)) panic_on_overflow = 0; + if (!memcmp(p, "merge", 5)) { + iommu_merge = 1; + force_iommu = 1; + } + if (!memcmp(p, "nomerge", 7)) + iommu_merge = 0; + if (!memcmp(p, "forcesac", 8)) + iommu_sac_force = 1; + if (!memcmp(p, "fullflush", 9)) + iommu_fullflush = 1; #ifdef CONFIG_IOMMU_LEAK if (!memcmp(p,"leak", 4)) { leak_trace = 1; diff -puN arch/x86_64/kernel/pci-nommu.c~x86_64-update arch/x86_64/kernel/pci-nommu.c --- 25/arch/x86_64/kernel/pci-nommu.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/pci-nommu.c 2003-11-23 15:22:24.000000000 -0800 @@ -4,6 +4,8 @@ #include #include +int iommu_merge = 0; + /* * Dummy IO MMU functions */ diff -puN arch/x86_64/kernel/setup.c~x86_64-update arch/x86_64/kernel/setup.c --- 25/arch/x86_64/kernel/setup.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/setup.c 2003-11-23 15:22:24.000000000 -0800 @@ -332,6 +332,7 @@ __setup("noreplacement", noreplacement_s void __init setup_arch(char **cmdline_p) { unsigned long low_mem_size; + unsigned long kernel_end; ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); drive_info = DRIVE_INFO; @@ -380,7 +381,6 @@ void __init setup_arch(char **cmdline_p) (table_end - table_start) << PAGE_SHIFT); /* reserve kernel */ - unsigned long kernel_end; kernel_end = round_up(__pa_symbol(&_end),PAGE_SIZE); reserve_bootmem_generic(HIGH_MEMORY, kernel_end - HIGH_MEMORY); diff -puN arch/x86_64/kernel/signal.c~x86_64-update arch/x86_64/kernel/signal.c --- 25/arch/x86_64/kernel/signal.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/signal.c 2003-11-23 15:22:24.000000000 -0800 @@ -93,6 +93,8 @@ restore_sigcontext(struct pt_regs *regs, { unsigned int err = 0; + /* Always make any pending restarted system calls return -EINTR */ + current_thread_info()->restart_block.fn = do_no_restart_syscall; #define COPY(x) err |= __get_user(regs->x, &sc->x) diff -puN arch/x86_64/kernel/smpboot.c~x86_64-update arch/x86_64/kernel/smpboot.c --- 25/arch/x86_64/kernel/smpboot.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/smpboot.c 2003-11-23 15:22:24.000000000 -0800 @@ -54,7 +54,7 @@ #include /* Bitmask of currently online CPUs */ -cpumask_t cpu_online_map; +cpumask_t cpu_online_map = { 1 }; static cpumask_t cpu_callin_map; cpumask_t cpu_callout_map; diff -puN arch/x86_64/mm/fault.c~x86_64-update arch/x86_64/mm/fault.c --- 25/arch/x86_64/mm/fault.c~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/arch/x86_64/mm/fault.c 2003-11-23 15:22:24.000000000 -0800 @@ -73,6 +73,9 @@ static int is_prefetch(struct pt_regs *r if (regs->cs & (1<<2)) return 0; + if ((regs->cs & 3) != 0 && regs->rip >= TASK_SIZE) + return 0; + while (scan_more && instr < max_instr) { unsigned char opcode; unsigned char instr_hi; diff -puN include/asm-x86_64/apic.h~x86_64-update include/asm-x86_64/apic.h --- 25/include/asm-x86_64/apic.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/apic.h 2003-11-23 15:22:24.000000000 -0800 @@ -79,7 +79,7 @@ extern void disable_lapic_nmi_watchdog(v extern void enable_lapic_nmi_watchdog(void); extern void disable_timer_nmi_watchdog(void); extern void enable_timer_nmi_watchdog(void); -extern inline void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); +extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); extern int APIC_init_uniprocessor (void); extern void disable_APIC_timer(void); extern void enable_APIC_timer(void); diff -puN include/asm-x86_64/calling.h~x86_64-update include/asm-x86_64/calling.h --- 25/include/asm-x86_64/calling.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/calling.h 2003-11-23 15:22:24.000000000 -0800 @@ -8,7 +8,7 @@ #define R14 8 #define R13 16 #define R12 24 -#define RBP 36 +#define RBP 32 #define RBX 40 /* arguments: interrupts/non tracing syscalls only save upto here*/ #define R11 48 diff -puN /dev/null include/asm-x86_64/cpu.h --- /dev/null 2002-08-30 16:31:37.000000000 -0700 +++ 25-akpm/include/asm-x86_64/cpu.h 2003-11-23 15:22:24.000000000 -0800 @@ -0,0 +1 @@ +#include diff -puN include/asm-x86_64/desc.h~x86_64-update include/asm-x86_64/desc.h --- 25/include/asm-x86_64/desc.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/desc.h 2003-11-23 15:22:24.000000000 -0800 @@ -190,7 +190,7 @@ static inline void load_TLS(struct threa /* * load one particular LDT into the current CPU */ -extern inline void load_LDT_nolock (mm_context_t *pc, int cpu) +static inline void load_LDT_nolock (mm_context_t *pc, int cpu) { int count = pc->size; diff -puN include/asm-x86_64/fixmap.h~x86_64-update include/asm-x86_64/fixmap.h --- 25/include/asm-x86_64/fixmap.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/fixmap.h 2003-11-23 15:22:24.000000000 -0800 @@ -76,7 +76,7 @@ extern void __this_fixmap_does_not_exist * directly without translation, we catch the bug with a NULL-deference * kernel oops. Illegal ranges of incoming indices are caught too. */ -extern inline unsigned long fix_to_virt(const unsigned int idx) +static inline unsigned long fix_to_virt(const unsigned int idx) { /* * this branch gets completely eliminated after inlining, diff -puN include/asm-x86_64/io_apic.h~x86_64-update include/asm-x86_64/io_apic.h --- 25/include/asm-x86_64/io_apic.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/io_apic.h 2003-11-23 15:22:24.000000000 -0800 @@ -184,14 +184,13 @@ static inline void end_edge_ioapic_irq ( #define disable_level_ioapic mask_IO_APIC_irq #define mask_and_ack_level_ioapic mask_and_ack_level_ioapic_irq #define end_level_ioapic end_level_ioapic_irq -#define set_ioapic_affinity set_ioapic_affinity_irq #define startup_edge_ioapic startup_edge_ioapic_irq #define shutdown_edge_ioapic disable_edge_ioapic_irq #define enable_edge_ioapic unmask_IO_APIC_irq #define disable_edge_ioapic disable_edge_ioapic_irq #define ack_edge_ioapic ack_edge_ioapic_irq -#define end_edge_ioapic end_edge_ioapic_irq +//#define end_edge_ioapic end_edge_ioapic_irq void enable_NMI_through_LVT0 (void * dummy); diff -puN include/asm-x86_64/io.h~x86_64-update include/asm-x86_64/io.h --- 25/include/asm-x86_64/io.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/io.h 2003-11-23 15:22:24.000000000 -0800 @@ -52,7 +52,7 @@ * Talk about misusing macros.. */ #define __OUT1(s,x) \ -extern inline void out##s(unsigned x value, unsigned short port) { +static inline void out##s(unsigned x value, unsigned short port) { #define __OUT2(s,s1,s2) \ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" @@ -62,7 +62,7 @@ __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (va __OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ #define __IN1(s) \ -extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; +static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; #define __IN2(s,s1,s2) \ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" @@ -72,12 +72,12 @@ __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : " __IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ #define __INS(s) \ -extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ +static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ { __asm__ __volatile__ ("rep ; ins" #s \ : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } #define __OUTS(s) \ -extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ +static inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ { __asm__ __volatile__ ("rep ; outs" #s \ : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } @@ -125,12 +125,12 @@ __OUTS(l) * Change virtual addresses to physical addresses and vv. * These are pretty trivial */ -extern inline unsigned long virt_to_phys(volatile void * address) +static inline unsigned long virt_to_phys(volatile void * address) { return __pa(address); } -extern inline void * phys_to_virt(unsigned long address) +static inline void * phys_to_virt(unsigned long address) { return __va(address); } @@ -148,7 +148,7 @@ extern inline void * phys_to_virt(unsign extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); -extern inline void * ioremap (unsigned long offset, unsigned long size) +static inline void * ioremap (unsigned long offset, unsigned long size) { return __ioremap(offset, size, 0); } @@ -304,8 +304,8 @@ out: /* Disable vmerge for now. Need to fix the block layer code to check for non iommu addresses first. When the IOMMU is force it is safe to enable. */ -extern int force_iommu; -#define BIO_VERMGE_BOUNDARY (force_iommu ? 4096 : 0) +extern int iommu_merge; +#define BIO_VMERGE_BOUNDARY (iommu_merge ? 4096 : 0) #endif /* __KERNEL__ */ diff -puN /dev/null include/asm-x86_64/memblk.h --- /dev/null 2002-08-30 16:31:37.000000000 -0700 +++ 25-akpm/include/asm-x86_64/memblk.h 2003-11-23 15:22:24.000000000 -0800 @@ -0,0 +1 @@ +#include diff -puN include/asm-x86_64/msr.h~x86_64-update include/asm-x86_64/msr.h --- 25/include/asm-x86_64/msr.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/msr.h 2003-11-23 15:22:24.000000000 -0800 @@ -67,7 +67,7 @@ : "=a" (low), "=d" (high) \ : "c" (counter)) -extern inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) +static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx) { __asm__("cpuid" : "=a" (*eax), @@ -80,7 +80,7 @@ extern inline void cpuid(int op, int *ea /* * CPUID functions returning a single datum */ -extern inline unsigned int cpuid_eax(unsigned int op) +static inline unsigned int cpuid_eax(unsigned int op) { unsigned int eax; @@ -90,7 +90,7 @@ extern inline unsigned int cpuid_eax(uns : "bx", "cx", "dx"); return eax; } -extern inline unsigned int cpuid_ebx(unsigned int op) +static inline unsigned int cpuid_ebx(unsigned int op) { unsigned int eax, ebx; @@ -100,7 +100,7 @@ extern inline unsigned int cpuid_ebx(uns : "cx", "dx" ); return ebx; } -extern inline unsigned int cpuid_ecx(unsigned int op) +static inline unsigned int cpuid_ecx(unsigned int op) { unsigned int eax, ecx; @@ -110,7 +110,7 @@ extern inline unsigned int cpuid_ecx(uns : "bx", "dx" ); return ecx; } -extern inline unsigned int cpuid_edx(unsigned int op) +static inline unsigned int cpuid_edx(unsigned int op) { unsigned int eax, edx; diff -puN /dev/null include/asm-x86_64/node.h --- /dev/null 2002-08-30 16:31:37.000000000 -0700 +++ 25-akpm/include/asm-x86_64/node.h 2003-11-23 15:22:24.000000000 -0800 @@ -0,0 +1 @@ +#include diff -puN include/asm-x86_64/pgalloc.h~x86_64-update include/asm-x86_64/pgalloc.h --- 25/include/asm-x86_64/pgalloc.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/pgalloc.h 2003-11-23 15:22:24.000000000 -0800 @@ -69,7 +69,7 @@ extern __inline__ void pte_free_kernel(p free_page((unsigned long)pte); } -extern inline void pte_free(struct page *pte) +static inline void pte_free(struct page *pte) { __free_page(pte); } diff -puN include/asm-x86_64/pgtable.h~x86_64-update include/asm-x86_64/pgtable.h --- 25/include/asm-x86_64/pgtable.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/pgtable.h 2003-11-23 15:22:24.000000000 -0800 @@ -71,7 +71,7 @@ extern unsigned long empty_zero_page[102 #define pml4_none(x) (!pml4_val(x)) #define pgd_none(x) (!pgd_val(x)) -extern inline int pgd_present(pgd_t pgd) { return !pgd_none(pgd); } +static inline int pgd_present(pgd_t pgd) { return !pgd_none(pgd); } static inline void set_pte(pte_t *dst, pte_t val) { @@ -88,7 +88,7 @@ static inline void set_pgd(pgd_t *dst, p pgd_val(*dst) = pgd_val(val); } -extern inline void pgd_clear (pgd_t * pgd) +static inline void pgd_clear (pgd_t * pgd) { set_pgd(pgd, __pgd(0)); } @@ -242,23 +242,23 @@ static inline pte_t pfn_pte(unsigned lon * Undefined behaviour if not.. */ static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } -extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } -extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } -extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } -extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } -extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } +static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } +static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } +static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } +static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } +static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } -extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } -extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } -extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } -extern inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } -extern inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } -extern inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } -extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } -extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } -extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } -extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } +static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } +static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } +static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } +static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } +static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } +static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } +static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } +static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } +static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } +static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } static inline int ptep_test_and_clear_dirty(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); } static inline int ptep_test_and_clear_young(pte_t *ptep) { return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); } static inline void ptep_set_wrprotect(pte_t *ptep) { clear_bit(_PAGE_BIT_RW, ptep); } @@ -359,7 +359,7 @@ static inline pte_t mk_pte_phys(unsigned } /* Change flags of a PTE */ -extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) +static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { pte_val(pte) &= _PAGE_CHG_MASK; pte_val(pte) |= pgprot_val(newprot); diff -puN include/asm-x86_64/processor.h~x86_64-update include/asm-x86_64/processor.h --- 25/include/asm-x86_64/processor.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/processor.h 2003-11-23 15:22:24.000000000 -0800 @@ -304,13 +304,13 @@ extern unsigned long get_wchan(struct ta #define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ -extern inline void rep_nop(void) +static inline void rep_nop(void) { __asm__ __volatile__("rep;nop": : :"memory"); } /* Stop speculative execution */ -extern inline void sync_core(void) +static inline void sync_core(void) { int tmp; asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); diff -puN include/asm-x86_64/smp.h~x86_64-update include/asm-x86_64/smp.h --- 25/include/asm-x86_64/smp.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/smp.h 2003-11-23 15:22:24.000000000 -0800 @@ -74,7 +74,7 @@ extern __inline int hard_smp_processor_i return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); } -#define safe_smp_processor_id() (cpuid_ebx(1) >> 24) +#define safe_smp_processor_id() (disable_apic ? 0 : hard_smp_processor_id()) #define cpu_online(cpu) cpu_isset(cpu, cpu_online_map) #endif /* !ASSEMBLY */ diff -puN include/asm-x86_64/system.h~x86_64-update include/asm-x86_64/system.h --- 25/include/asm-x86_64/system.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/system.h 2003-11-23 15:22:24.000000000 -0800 @@ -188,7 +188,7 @@ static inline void write_cr4(unsigned lo #define __xg(x) ((volatile long *)(x)) -extern inline void set_64bit(volatile unsigned long *ptr, unsigned long val) +static inline void set_64bit(volatile unsigned long *ptr, unsigned long val) { *ptr = val; } diff -puN include/asm-x86_64/topology.h~x86_64-update include/asm-x86_64/topology.h --- 25/include/asm-x86_64/topology.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/topology.h 2003-11-23 15:22:24.000000000 -0800 @@ -23,6 +23,7 @@ extern unsigned long cpu_online_map; static inline unsigned long pcibus_to_cpumask(int bus) { + BUG_ON(bus >= MAX_MP_BUSSES); return mp_bus_to_cpumask[bus] & cpu_online_map; } diff -puN include/asm-x86_64/uaccess.h~x86_64-update include/asm-x86_64/uaccess.h --- 25/include/asm-x86_64/uaccess.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/uaccess.h 2003-11-23 15:22:24.000000000 -0800 @@ -48,7 +48,7 @@ #define access_ok(type,addr,size) (__range_not_ok(addr,size) == 0) -extern inline int verify_area(int type, const void * addr, unsigned long size) +static inline int verify_area(int type, const void * addr, unsigned long size) { return access_ok(type,addr,size) ? 0 : -EFAULT; } diff -puN include/asm-x86_64/unistd.h~x86_64-update include/asm-x86_64/unistd.h --- 25/include/asm-x86_64/unistd.h~x86_64-update 2003-11-23 15:22:24.000000000 -0800 +++ 25-akpm/include/asm-x86_64/unistd.h 2003-11-23 15:22:24.000000000 -0800 @@ -532,6 +532,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill) __SYSCALL(__NR_utimes, sys_utimes) #define __NR_vserver 236 __SYSCALL(__NR_vserver, sys_ni_syscall) +/* 237,238,239 reserved for NUMA API */ #define __NR_syscall_max __NR_vserver #ifndef __NO_STUBS @@ -623,11 +624,11 @@ __syscall_return(type,__res); \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ { \ long __res; \ -__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9" __syscall \ +__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; " __syscall \ : "=a" (__res) \ : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \ - "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5), \ - "g" ((long)(arg6),) : \ + "d" ((long)(arg3)), "g" ((long)(arg4)), "g" ((long)(arg5)), \ + "g" ((long)(arg6)) : \ __syscall_clobber,"r8","r10","r9" ); \ __syscall_return(type,__res); \ } _