diff --git a/[refs] b/[refs] index 00909d23257d..dabf9615385f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d20ead9e86881bc7ae84e385f47b5196b7d93aac +refs/heads/master: 00cedfa67b3ab1588e2665eabd9843a3d8dd1dfc diff --git a/trunk/.gitignore b/trunk/.gitignore index 22fb8fa9bc3d..27c3e839b54e 100644 --- a/trunk/.gitignore +++ b/trunk/.gitignore @@ -26,7 +26,6 @@ vmlinux* !vmlinux.lds.S System.map Module.symvers -!.gitignore # # Generated include files diff --git a/trunk/Documentation/filesystems/proc.txt b/trunk/Documentation/filesystems/proc.txt index e5c1df52a876..4a37e25e694c 100644 --- a/trunk/Documentation/filesystems/proc.txt +++ b/trunk/Documentation/filesystems/proc.txt @@ -347,35 +347,7 @@ connects the CPUs in a SMP system. This means that an error has been detected, the IO-APIC automatically retry the transmission, so it should not be a big problem, but you should read the SMP-FAQ. -In 2.6.2* /proc/interrupts was expanded again. This time the goal was for -/proc/interrupts to display every IRQ vector in use by the system, not -just those considered 'most important'. The new vectors are: - - THR -- interrupt raised when a machine check threshold counter - (typically counting ECC corrected errors of memory or cache) exceeds - a configurable threshold. Only available on some systems. - - TRM -- a thermal event interrupt occurs when a temperature threshold - has been exceeded for the CPU. This interrupt may also be generated - when the temperature drops back to normal. - - SPU -- a spurious interrupt is some interrupt that was raised then lowered - by some IO device before it could be fully processed by the APIC. Hence - the APIC sees the interrupt but does not know what device it came from. - For this case the APIC will generate the interrupt with a IRQ vector - of 0xff. This might also be generated by chipset bugs. - - RES, CAL, TLB -- rescheduling, call and TLB flush interrupts are - sent from one CPU to another per the needs of the OS. Typically, - their statistics are used by kernel developers and interested users to - determine the occurance of interrupt of the given type. - -The above IRQ vectors are displayed only when relevent. For example, -the threshold vector does not exist on x86_64 platforms. Others are -suppressed when the system is a uniprocessor. As of this writing, only -i386 and x86_64 platforms support the new IRQ vector displays. - -Of some interest is the introduction of the /proc/irq directory to 2.4. +In this context it could be interesting to note the new irq directory in 2.4. It could be used to set IRQ to CPU affinity, this means that you can "hook" an IRQ to only one CPU, or to exclude a CPU of handling IRQs. The contents of the irq subdir is one subdir for each IRQ, and one file; prof_cpu_mask diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index 98cf90f2631d..63bda3637085 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -994,8 +994,6 @@ and is between 256 and 4096 characters. It is defined in the file mce [X86-32] Machine Check Exception - mce=option [X86-64] See Documentation/x86_64/boot-options.txt - md= [HW] RAID subsystems devices and level See Documentation/md.txt. diff --git a/trunk/Makefile b/trunk/Makefile index 529b9048d97e..ed65de7078c7 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1325,8 +1325,8 @@ ALLSOURCE_ARCHS := $(ARCH) $(SRCARCH) endif define find-sources - ( for arch in $(ALLSOURCE_ARCHS) ; do \ - find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \ + ( for ARCH in $(ALLSOURCE_ARCHS) ; do \ + find $(__srctree)arch/$${SRCARCH} $(RCS_FIND_IGNORE) \ -name $1 -print; \ done ; \ find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ @@ -1334,8 +1334,8 @@ define find-sources find $(__srctree)include $(RCS_FIND_IGNORE) \ \( -name config -o -name 'asm-*' \) -prune \ -o -name $1 -print; \ - for arch in $(ALLINCLUDE_ARCHS) ; do \ - find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \ + for ARCH in $(ALLINCLUDE_ARCHS) ; do \ + find $(__srctree)include/asm-$${SRCARCH} $(RCS_FIND_IGNORE) \ -name $1 -print; \ done ; \ find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ diff --git a/trunk/arch/i386/.gitignore b/trunk/arch/i386/.gitignore deleted file mode 100644 index 36ef4c374d25..000000000000 --- a/trunk/arch/i386/.gitignore +++ /dev/null @@ -1 +0,0 @@ -boot diff --git a/trunk/arch/i386/Kconfig b/trunk/arch/i386/Kconfig index b84d5050e92e..7a95c58947e4 100644 --- a/trunk/arch/i386/Kconfig +++ b/trunk/arch/i386/Kconfig @@ -146,7 +146,6 @@ config X86_ELAN config X86_VOYAGER bool "Voyager (NCR)" - select SMP if !BROKEN help Voyager is an MCA-based 32-way capable SMP architecture proprietary to NCR Corp. Machine classes 345x/35xx/4100/51xx are Voyager-based. diff --git a/trunk/arch/i386/Kconfig.cpu b/trunk/arch/i386/Kconfig.cpu index 0e2adadf5905..11a24d54f27b 100644 --- a/trunk/arch/i386/Kconfig.cpu +++ b/trunk/arch/i386/Kconfig.cpu @@ -109,42 +109,16 @@ config MCORE2 help Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx) CPUs. You can distinguish newer from older Xeons by the CPU family - in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo) + in /proc/cpuinfo. Newer ones have 6. config MPENTIUM4 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" help Select this for Intel Pentium 4 chips. This includes the - Pentium 4, Pentium D, P4-based Celeron and Xeon, and - Pentium-4 M (not Pentium M) chips. This option enables compile - flags optimized for the chip, uses the correct cache line size, and - applies any applicable optimizations. - - CPUIDs: F[0-6][1-A] (in /proc/cpuinfo show = cpu family : 15 ) - - Select this for: - Pentiums (Pentium 4, Pentium D, Celeron, Celeron D) corename: - -Willamette - -Northwood - -Mobile Pentium 4 - -Mobile Pentium 4 M - -Extreme Edition (Gallatin) - -Prescott - -Prescott 2M - -Cedar Mill - -Presler - -Smithfiled - Xeons (Intel Xeon, Xeon MP, Xeon LV, Xeon MV) corename: - -Foster - -Prestonia - -Gallatin - -Nocona - -Irwindale - -Cranford - -Potomac - -Paxville - -Dempsey - + Pentium 4, P4-based Celeron and Xeon, and Pentium-4 M + (not Pentium M) chips. This option enables compile flags + optimized for the chip, uses the correct cache shift, and + applies any applicable Pentium III optimizations. config MK6 bool "K6/K6-II/K6-III" diff --git a/trunk/arch/mips/au1000/Kconfig b/trunk/arch/mips/au1000/Kconfig index a23d4154da01..29c95d97217d 100644 --- a/trunk/arch/mips/au1000/Kconfig +++ b/trunk/arch/mips/au1000/Kconfig @@ -137,7 +137,6 @@ config SOC_AU1200 config SOC_AU1X00 bool select 64BIT_PHYS_ADDR - select IRQ_CPU select SYS_HAS_CPU_MIPS32_R1 select SYS_SUPPORTS_32BIT_KERNEL select SYS_SUPPORTS_APM_EMULATION diff --git a/trunk/arch/mips/au1000/common/irq.c b/trunk/arch/mips/au1000/common/irq.c index 59e932a928d2..c00f308fd505 100644 --- a/trunk/arch/mips/au1000/common/irq.c +++ b/trunk/arch/mips/au1000/common/irq.c @@ -1,10 +1,11 @@ /* + * BRIEF MODULE DESCRIPTION + * Au1000 interrupt routines. + * * Copyright 2001 MontaVista Software Inc. * Author: MontaVista Software, Inc. * ppopov@mvista.com or source@mvista.com * - * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) - * * 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 @@ -31,7 +32,6 @@ #include #include -#include #include #include #ifdef CONFIG_MIPS_PB1000 @@ -44,7 +44,7 @@ #define EXT_INTC1_REQ1 5 /* IP 5 */ #define MIPS_TIMER_IP 7 /* IP 7 */ -void (*board_init_irq)(void) __initdata = NULL; +void (*board_init_irq)(void); static DEFINE_SPINLOCK(irq_lock); @@ -134,14 +134,12 @@ void restore_au1xxx_intctl(void) inline void local_enable_irq(unsigned int irq_nr) { - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; - - if (bit >= 32) { - au_writel(1 << (bit - 32), IC1_MASKSET); - au_writel(1 << (bit - 32), IC1_WAKESET); + if (irq_nr > AU1000_LAST_INTC0_INT) { + au_writel(1 << (irq_nr - 32), IC1_MASKSET); + au_writel(1 << (irq_nr - 32), IC1_WAKESET); } else { - au_writel(1 << bit, IC0_MASKSET); - au_writel(1 << bit, IC0_WAKESET); + au_writel(1 << irq_nr, IC0_MASKSET); + au_writel(1 << irq_nr, IC0_WAKESET); } au_sync(); } @@ -149,14 +147,12 @@ inline void local_enable_irq(unsigned int irq_nr) inline void local_disable_irq(unsigned int irq_nr) { - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; - - if (bit >= 32) { - au_writel(1 << (bit - 32), IC1_MASKCLR); - au_writel(1 << (bit - 32), IC1_WAKECLR); + if (irq_nr > AU1000_LAST_INTC0_INT) { + au_writel(1 << (irq_nr - 32), IC1_MASKCLR); + au_writel(1 << (irq_nr - 32), IC1_WAKECLR); } else { - au_writel(1 << bit, IC0_MASKCLR); - au_writel(1 << bit, IC0_WAKECLR); + au_writel(1 << irq_nr, IC0_MASKCLR); + au_writel(1 << irq_nr, IC0_WAKECLR); } au_sync(); } @@ -164,14 +160,12 @@ inline void local_disable_irq(unsigned int irq_nr) static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr) { - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; - - if (bit >= 32) { - au_writel(1 << (bit - 32), IC1_RISINGCLR); - au_writel(1 << (bit - 32), IC1_MASKCLR); + if (irq_nr > AU1000_LAST_INTC0_INT) { + au_writel(1 << (irq_nr - 32), IC1_RISINGCLR); + au_writel(1 << (irq_nr - 32), IC1_MASKCLR); } else { - au_writel(1 << bit, IC0_RISINGCLR); - au_writel(1 << bit, IC0_MASKCLR); + au_writel(1 << irq_nr, IC0_RISINGCLR); + au_writel(1 << irq_nr, IC0_MASKCLR); } au_sync(); } @@ -179,14 +173,12 @@ static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr) static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr) { - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; - - if (bit >= 32) { - au_writel(1 << (bit - 32), IC1_FALLINGCLR); - au_writel(1 << (bit - 32), IC1_MASKCLR); + if (irq_nr > AU1000_LAST_INTC0_INT) { + au_writel(1 << (irq_nr - 32), IC1_FALLINGCLR); + au_writel(1 << (irq_nr - 32), IC1_MASKCLR); } else { - au_writel(1 << bit, IC0_FALLINGCLR); - au_writel(1 << bit, IC0_MASKCLR); + au_writel(1 << irq_nr, IC0_FALLINGCLR); + au_writel(1 << irq_nr, IC0_MASKCLR); } au_sync(); } @@ -194,20 +186,17 @@ static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr) static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr) { - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; - - /* - * This may assume that we don't get interrupts from + /* This may assume that we don't get interrupts from * both edges at once, or if we do, that we don't care. */ - if (bit >= 32) { - au_writel(1 << (bit - 32), IC1_FALLINGCLR); - au_writel(1 << (bit - 32), IC1_RISINGCLR); - au_writel(1 << (bit - 32), IC1_MASKCLR); + if (irq_nr > AU1000_LAST_INTC0_INT) { + au_writel(1 << (irq_nr - 32), IC1_FALLINGCLR); + au_writel(1 << (irq_nr - 32), IC1_RISINGCLR); + au_writel(1 << (irq_nr - 32), IC1_MASKCLR); } else { - au_writel(1 << bit, IC0_FALLINGCLR); - au_writel(1 << bit, IC0_RISINGCLR); - au_writel(1 << bit, IC0_MASKCLR); + au_writel(1 << irq_nr, IC0_FALLINGCLR); + au_writel(1 << irq_nr, IC0_RISINGCLR); + au_writel(1 << irq_nr, IC0_MASKCLR); } au_sync(); } @@ -224,8 +213,10 @@ static inline void mask_and_ack_level_irq(unsigned int irq_nr) au_sync(); } #endif + return; } + static void end_irq(unsigned int irq_nr) { if (!(irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS))) @@ -350,118 +341,114 @@ void startup_match20_interrupt(irq_handler_t handler) } #endif -static void __init setup_local_irq(unsigned int irq_nr, int type, int int_req) +static void setup_local_irq(unsigned int irq_nr, int type, int int_req) { - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; - - if (irq_nr > AU1000_MAX_INTR) - return; - + if (irq_nr > AU1000_MAX_INTR) return; /* Config2[n], Config1[n], Config0[n] */ - if (bit >= 32) { + if (irq_nr > AU1000_LAST_INTC0_INT) { switch (type) { case INTC_INT_RISE_EDGE: /* 0:0:1 */ - au_writel(1 << (bit - 32), IC1_CFG2CLR); - au_writel(1 << (bit - 32), IC1_CFG1CLR); - au_writel(1 << (bit - 32), IC1_CFG0SET); + au_writel(1 << (irq_nr - 32), IC1_CFG2CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG1CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG0SET); set_irq_chip(irq_nr, &rise_edge_irq_type); break; case INTC_INT_FALL_EDGE: /* 0:1:0 */ - au_writel(1 << (bit - 32), IC1_CFG2CLR); - au_writel(1 << (bit - 32), IC1_CFG1SET); - au_writel(1 << (bit - 32), IC1_CFG0CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG2CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG1SET); + au_writel(1 << (irq_nr - 32), IC1_CFG0CLR); set_irq_chip(irq_nr, &fall_edge_irq_type); break; case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */ - au_writel(1 << (bit - 32), IC1_CFG2CLR); - au_writel(1 << (bit - 32), IC1_CFG1SET); - au_writel(1 << (bit - 32), IC1_CFG0SET); + au_writel(1 << (irq_nr - 32), IC1_CFG2CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG1SET); + au_writel(1 << (irq_nr - 32), IC1_CFG0SET); set_irq_chip(irq_nr, &either_edge_irq_type); break; case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ - au_writel(1 << (bit - 32), IC1_CFG2SET); - au_writel(1 << (bit - 32), IC1_CFG1CLR); - au_writel(1 << (bit - 32), IC1_CFG0SET); + au_writel(1 << (irq_nr - 32), IC1_CFG2SET); + au_writel(1 << (irq_nr - 32), IC1_CFG1CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG0SET); set_irq_chip(irq_nr, &level_irq_type); break; case INTC_INT_LOW_LEVEL: /* 1:1:0 */ - au_writel(1 << (bit - 32), IC1_CFG2SET); - au_writel(1 << (bit - 32), IC1_CFG1SET); - au_writel(1 << (bit - 32), IC1_CFG0CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG2SET); + au_writel(1 << (irq_nr - 32), IC1_CFG1SET); + au_writel(1 << (irq_nr - 32), IC1_CFG0CLR); set_irq_chip(irq_nr, &level_irq_type); break; case INTC_INT_DISABLED: /* 0:0:0 */ - au_writel(1 << (bit - 32), IC1_CFG0CLR); - au_writel(1 << (bit - 32), IC1_CFG1CLR); - au_writel(1 << (bit - 32), IC1_CFG2CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG0CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG1CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG2CLR); break; default: /* disable the interrupt */ printk(KERN_WARNING "unexpected int type %d (irq %d)\n", type, irq_nr); - au_writel(1 << (bit - 32), IC1_CFG0CLR); - au_writel(1 << (bit - 32), IC1_CFG1CLR); - au_writel(1 << (bit - 32), IC1_CFG2CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG0CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG1CLR); + au_writel(1 << (irq_nr - 32), IC1_CFG2CLR); return; } if (int_req) /* assign to interrupt request 1 */ - au_writel(1 << (bit - 32), IC1_ASSIGNCLR); + au_writel(1 << (irq_nr - 32), IC1_ASSIGNCLR); else /* assign to interrupt request 0 */ - au_writel(1 << (bit - 32), IC1_ASSIGNSET); - au_writel(1 << (bit - 32), IC1_SRCSET); - au_writel(1 << (bit - 32), IC1_MASKCLR); - au_writel(1 << (bit - 32), IC1_WAKECLR); + au_writel(1 << (irq_nr - 32), IC1_ASSIGNSET); + au_writel(1 << (irq_nr - 32), IC1_SRCSET); + au_writel(1 << (irq_nr - 32), IC1_MASKCLR); + au_writel(1 << (irq_nr - 32), IC1_WAKECLR); } else { switch (type) { case INTC_INT_RISE_EDGE: /* 0:0:1 */ - au_writel(1 << bit, IC0_CFG2CLR); - au_writel(1 << bit, IC0_CFG1CLR); - au_writel(1 << bit, IC0_CFG0SET); + au_writel(1 << irq_nr, IC0_CFG2CLR); + au_writel(1 << irq_nr, IC0_CFG1CLR); + au_writel(1 << irq_nr, IC0_CFG0SET); set_irq_chip(irq_nr, &rise_edge_irq_type); break; case INTC_INT_FALL_EDGE: /* 0:1:0 */ - au_writel(1 << bit, IC0_CFG2CLR); - au_writel(1 << bit, IC0_CFG1SET); - au_writel(1 << bit, IC0_CFG0CLR); + au_writel(1 << irq_nr, IC0_CFG2CLR); + au_writel(1 << irq_nr, IC0_CFG1SET); + au_writel(1 << irq_nr, IC0_CFG0CLR); set_irq_chip(irq_nr, &fall_edge_irq_type); break; case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */ - au_writel(1 << bit, IC0_CFG2CLR); - au_writel(1 << bit, IC0_CFG1SET); - au_writel(1 << bit, IC0_CFG0SET); + au_writel(1 << irq_nr, IC0_CFG2CLR); + au_writel(1 << irq_nr, IC0_CFG1SET); + au_writel(1 << irq_nr, IC0_CFG0SET); set_irq_chip(irq_nr, &either_edge_irq_type); break; case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ - au_writel(1 << bit, IC0_CFG2SET); - au_writel(1 << bit, IC0_CFG1CLR); - au_writel(1 << bit, IC0_CFG0SET); + au_writel(1 << irq_nr, IC0_CFG2SET); + au_writel(1 << irq_nr, IC0_CFG1CLR); + au_writel(1 << irq_nr, IC0_CFG0SET); set_irq_chip(irq_nr, &level_irq_type); break; case INTC_INT_LOW_LEVEL: /* 1:1:0 */ - au_writel(1 << bit, IC0_CFG2SET); - au_writel(1 << bit, IC0_CFG1SET); - au_writel(1 << bit, IC0_CFG0CLR); + au_writel(1 << irq_nr, IC0_CFG2SET); + au_writel(1 << irq_nr, IC0_CFG1SET); + au_writel(1 << irq_nr, IC0_CFG0CLR); set_irq_chip(irq_nr, &level_irq_type); break; case INTC_INT_DISABLED: /* 0:0:0 */ - au_writel(1 << bit, IC0_CFG0CLR); - au_writel(1 << bit, IC0_CFG1CLR); - au_writel(1 << bit, IC0_CFG2CLR); + au_writel(1 << irq_nr, IC0_CFG0CLR); + au_writel(1 << irq_nr, IC0_CFG1CLR); + au_writel(1 << irq_nr, IC0_CFG2CLR); break; default: /* disable the interrupt */ printk(KERN_WARNING "unexpected int type %d (irq %d)\n", type, irq_nr); - au_writel(1 << bit, IC0_CFG0CLR); - au_writel(1 << bit, IC0_CFG1CLR); - au_writel(1 << bit, IC0_CFG2CLR); + au_writel(1 << irq_nr, IC0_CFG0CLR); + au_writel(1 << irq_nr, IC0_CFG1CLR); + au_writel(1 << irq_nr, IC0_CFG2CLR); return; } if (int_req) /* assign to interrupt request 1 */ - au_writel(1 << bit, IC0_ASSIGNCLR); + au_writel(1 << irq_nr, IC0_ASSIGNCLR); else /* assign to interrupt request 0 */ - au_writel(1 << bit, IC0_ASSIGNSET); - au_writel(1 << bit, IC0_SRCSET); - au_writel(1 << bit, IC0_MASKCLR); - au_writel(1 << bit, IC0_WAKECLR); + au_writel(1 << irq_nr, IC0_ASSIGNSET); + au_writel(1 << irq_nr, IC0_SRCSET); + au_writel(1 << irq_nr, IC0_MASKCLR); + au_writel(1 << irq_nr, IC0_WAKECLR); } au_sync(); } @@ -474,8 +461,8 @@ static void __init setup_local_irq(unsigned int irq_nr, int type, int int_req) static void intc0_req0_irqdispatch(void) { + int irq = 0; static unsigned long intc0_req0; - unsigned int bit; intc0_req0 |= au_readl(IC0_REQ0INT); @@ -494,25 +481,25 @@ static void intc0_req0_irqdispatch(void) return; } #endif - bit = ffs(intc0_req0); - intc0_req0 &= ~(1 << bit); - do_IRQ(MIPS_CPU_IRQ_BASE + bit); + irq = ffs(intc0_req0); + intc0_req0 &= ~(1 << irq); + do_IRQ(irq); } static void intc0_req1_irqdispatch(void) { + int irq = 0; static unsigned long intc0_req1; - unsigned int bit; intc0_req1 |= au_readl(IC0_REQ1INT); if (!intc0_req1) return; - bit = ffs(intc0_req1); - intc0_req1 &= ~(1 << bit); - do_IRQ(bit); + irq = ffs(intc0_req1); + intc0_req1 &= ~(1 << irq); + do_IRQ(irq); } @@ -522,41 +509,43 @@ static void intc0_req1_irqdispatch(void) */ static void intc1_req0_irqdispatch(void) { + int irq = 0; static unsigned long intc1_req0; - unsigned int bit; intc1_req0 |= au_readl(IC1_REQ0INT); if (!intc1_req0) return; - bit = ffs(intc1_req0); - intc1_req0 &= ~(1 << bit); - do_IRQ(MIPS_CPU_IRQ_BASE + 32 + bit); + irq = ffs(intc1_req0); + intc1_req0 &= ~(1 << irq); + irq += 32; + do_IRQ(irq); } static void intc1_req1_irqdispatch(void) { + int irq = 0; static unsigned long intc1_req1; - unsigned int bit; intc1_req1 |= au_readl(IC1_REQ1INT); if (!intc1_req1) return; - bit = ffs(intc1_req1); - intc1_req1 &= ~(1 << bit); - do_IRQ(MIPS_CPU_IRQ_BASE + 32 + bit); + irq = ffs(intc1_req1); + intc1_req1 &= ~(1 << irq); + irq += 32; + do_IRQ(irq); } asmlinkage void plat_irq_dispatch(void) { - unsigned int pending = read_c0_status() & read_c0_cause(); + unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; if (pending & CAUSEF_IP7) - do_IRQ(MIPS_CPU_IRQ_BASE + 7); + do_IRQ(63); else if (pending & CAUSEF_IP2) intc0_req0_irqdispatch(); else if (pending & CAUSEF_IP3) @@ -572,15 +561,17 @@ asmlinkage void plat_irq_dispatch(void) void __init arch_init_irq(void) { int i; + unsigned long cp0_status; struct au1xxx_irqmap *imp; extern struct au1xxx_irqmap au1xxx_irq_map[]; extern struct au1xxx_irqmap au1xxx_ic0_map[]; extern int au1xxx_nr_irqs; extern int au1xxx_ic0_nr_irqs; - /* - * Initialize interrupt controllers to a safe state. - */ + cp0_status = read_c0_status(); + + /* Initialize interrupt controllers to a safe state. + */ au_writel(0xffffffff, IC0_CFG0CLR); au_writel(0xffffffff, IC0_CFG1CLR); au_writel(0xffffffff, IC0_CFG2CLR); @@ -603,20 +594,16 @@ void __init arch_init_irq(void) au_writel(0xffffffff, IC1_RISINGCLR); au_writel(0x00000000, IC1_TESTBIT); - mips_cpu_irq_init(); - - /* - * Initialize IC0, which is fixed per processor. - */ + /* Initialize IC0, which is fixed per processor. + */ imp = au1xxx_ic0_map; for (i = 0; i < au1xxx_ic0_nr_irqs; i++) { setup_local_irq(imp->im_irq, imp->im_type, imp->im_request); imp++; } - /* - * Now set up the irq mapping for the board. - */ + /* Now set up the irq mapping for the board. + */ imp = au1xxx_irq_map; for (i = 0; i < au1xxx_nr_irqs; i++) { setup_local_irq(imp->im_irq, imp->im_type, imp->im_request); @@ -628,5 +615,5 @@ void __init arch_init_irq(void) /* Board specific IRQ initialization. */ if (board_init_irq) - board_init_irq(); + (*board_init_irq)(); } diff --git a/trunk/arch/mips/au1000/common/power.c b/trunk/arch/mips/au1000/common/power.c index 54047d69b820..6f57f72a7d57 100644 --- a/trunk/arch/mips/au1000/common/power.c +++ b/trunk/arch/mips/au1000/common/power.c @@ -403,9 +403,9 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file, } - /* - * We don't want _any_ interrupts other than match20. Otherwise our - * au1000_calibrate_delay() calculation will be off, potentially a lot. + /* We don't want _any_ interrupts other than + * match20. Otherwise our au1000_calibrate_delay() + * calculation will be off, potentially a lot. */ intc0_mask = save_local_and_disable(0); intc1_mask = save_local_and_disable(1); @@ -414,7 +414,6 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file, au1000_calibrate_delay(); restore_local_and_enable(0, intc0_mask); restore_local_and_enable(1, intc1_mask); - return retval; } diff --git a/trunk/arch/mips/au1000/pb1200/irqmap.c b/trunk/arch/mips/au1000/pb1200/irqmap.c index 5f48b0603796..3bee274445f5 100644 --- a/trunk/arch/mips/au1000/pb1200/irqmap.c +++ b/trunk/arch/mips/au1000/pb1200/irqmap.c @@ -74,7 +74,7 @@ irqreturn_t pb1200_cascade_handler( int irq, void *dev_id) bcsr->int_status = bisr; for( ; bisr; bisr &= (bisr-1) ) { - extirq_nr = PB1200_INT_BEGIN + ffs(bisr); + extirq_nr = PB1200_INT_BEGIN + au_ffs(bisr); /* Ack and dispatch IRQ */ do_IRQ(extirq_nr); } diff --git a/trunk/arch/mips/configs/mtx1_defconfig b/trunk/arch/mips/configs/mtx1_defconfig index b536d7c63790..0280ef389d8d 100644 --- a/trunk/arch/mips/configs/mtx1_defconfig +++ b/trunk/arch/mips/configs/mtx1_defconfig @@ -3021,7 +3021,7 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_DEBUG_FS is not set # CONFIG_HEADERS_CHECK is not set # CONFIG_DEBUG_KERNEL is not set -CONFIG_CROSSCOMPILE=y +# CONFIG_CROSSCOMPILE is not set CONFIG_CMDLINE="" CONFIG_SYS_SUPPORTS_KGDB=y diff --git a/trunk/arch/mips/kernel/head.S b/trunk/arch/mips/kernel/head.S index bf164a562acb..e46782b0ebc8 100644 --- a/trunk/arch/mips/kernel/head.S +++ b/trunk/arch/mips/kernel/head.S @@ -140,7 +140,7 @@ EXPORT(_stext) -#ifdef CONFIG_BOOT_RAW +#ifndef CONFIG_BOOT_RAW /* * Give us a fighting chance of running if execution beings at the * kernel load address. This is needed because this platform does @@ -149,8 +149,6 @@ EXPORT(_stext) __INIT #endif - __INIT_REFOK - NESTED(kernel_entry, 16, sp) # kernel entry point kernel_entry_setup # cpu specific setup diff --git a/trunk/arch/mips/kernel/time.c b/trunk/arch/mips/kernel/time.c index e4b5e647b142..05b365167a09 100644 --- a/trunk/arch/mips/kernel/time.c +++ b/trunk/arch/mips/kernel/time.c @@ -391,50 +391,6 @@ static void mips_event_handler(struct clock_event_device *dev) { } -/* - * FIXME: This doesn't hold for the relocated E9000 compare interrupt. - */ -static int c0_compare_int_pending(void) -{ - return (read_c0_cause() >> cp0_compare_irq) & 0x100; -} - -static int c0_compare_int_usable(void) -{ - const unsigned int delta = 0x300000; - unsigned int cnt; - - /* - * IP7 already pending? Try to clear it by acking the timer. - */ - if (c0_compare_int_pending()) { - write_c0_compare(read_c0_compare()); - irq_disable_hazard(); - if (c0_compare_int_pending()) - return 0; - } - - cnt = read_c0_count(); - cnt += delta; - write_c0_compare(cnt); - - while ((long)(read_c0_count() - cnt) <= 0) - ; /* Wait for expiry */ - - if (!c0_compare_int_pending()) - return 0; - - write_c0_compare(read_c0_compare()); - irq_disable_hazard(); - if (c0_compare_int_pending()) - return 0; - - /* - * Feels like a real count / compare timer. - */ - return 1; -} - void __cpuinit mips_clockevent_init(void) { uint64_t mips_freq = mips_hpt_frequency; @@ -456,9 +412,6 @@ void __cpuinit mips_clockevent_init(void) return; #endif - if (!c0_compare_int_usable()) - return; - cd = &per_cpu(mips_clockevent_device, cpu); cd->name = "MIPS"; diff --git a/trunk/arch/mips/kernel/traps.c b/trunk/arch/mips/kernel/traps.c index bbf01b81a4ff..9c0c478d71ac 100644 --- a/trunk/arch/mips/kernel/traps.c +++ b/trunk/arch/mips/kernel/traps.c @@ -9,10 +9,9 @@ * Copyright (C) 1999 Silicon Graphics, Inc. * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com * Copyright (C) 2000, 01 MIPS Technologies, Inc. - * Copyright (C) 2002, 2003, 2004, 2005, 2007 Maciej W. Rozycki + * Copyright (C) 2002, 2003, 2004, 2005 Maciej W. Rozycki */ #include -#include #include #include #include @@ -411,7 +410,7 @@ asmlinkage void do_be(struct pt_regs *regs) } /* - * ll/sc, rdhwr, sync emulation + * ll/sc emulation */ #define OPCODE 0xfc000000 @@ -420,11 +419,9 @@ asmlinkage void do_be(struct pt_regs *regs) #define OFFSET 0x0000ffff #define LL 0xc0000000 #define SC 0xe0000000 -#define SPEC0 0x00000000 #define SPEC3 0x7c000000 #define RD 0x0000f800 #define FUNC 0x0000003f -#define SYNC 0x0000000f #define RDHWR 0x0000003b /* @@ -435,10 +432,11 @@ unsigned long ll_bit; static struct task_struct *ll_task = NULL; -static inline int simulate_ll(struct pt_regs *regs, unsigned int opcode) +static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode) { unsigned long value, __user *vaddr; long offset; + int signal = 0; /* * analyse the ll instruction that just caused a ri exception @@ -453,10 +451,14 @@ static inline int simulate_ll(struct pt_regs *regs, unsigned int opcode) vaddr = (unsigned long __user *) ((unsigned long)(regs->regs[(opcode & BASE) >> 21]) + offset); - if ((unsigned long)vaddr & 3) - return SIGBUS; - if (get_user(value, vaddr)) - return SIGSEGV; + if ((unsigned long)vaddr & 3) { + signal = SIGBUS; + goto sig; + } + if (get_user(value, vaddr)) { + signal = SIGSEGV; + goto sig; + } preempt_disable(); @@ -469,16 +471,22 @@ static inline int simulate_ll(struct pt_regs *regs, unsigned int opcode) preempt_enable(); + compute_return_epc(regs); + regs->regs[(opcode & RT) >> 16] = value; - return 0; + return; + +sig: + force_sig(signal, current); } -static inline int simulate_sc(struct pt_regs *regs, unsigned int opcode) +static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode) { unsigned long __user *vaddr; unsigned long reg; long offset; + int signal = 0; /* * analyse the sc instruction that just caused a ri exception @@ -494,25 +502,34 @@ static inline int simulate_sc(struct pt_regs *regs, unsigned int opcode) ((unsigned long)(regs->regs[(opcode & BASE) >> 21]) + offset); reg = (opcode & RT) >> 16; - if ((unsigned long)vaddr & 3) - return SIGBUS; + if ((unsigned long)vaddr & 3) { + signal = SIGBUS; + goto sig; + } preempt_disable(); if (ll_bit == 0 || ll_task != current) { + compute_return_epc(regs); regs->regs[reg] = 0; preempt_enable(); - return 0; + return; } preempt_enable(); - if (put_user(regs->regs[reg], vaddr)) - return SIGSEGV; + if (put_user(regs->regs[reg], vaddr)) { + signal = SIGSEGV; + goto sig; + } + compute_return_epc(regs); regs->regs[reg] = 1; - return 0; + return; + +sig: + force_sig(signal, current); } /* @@ -522,14 +539,27 @@ static inline int simulate_sc(struct pt_regs *regs, unsigned int opcode) * few processors such as NEC's VR4100 throw reserved instruction exceptions * instead, so we're doing the emulation thing in both exception handlers. */ -static int simulate_llsc(struct pt_regs *regs, unsigned int opcode) +static inline int simulate_llsc(struct pt_regs *regs) { - if ((opcode & OPCODE) == LL) - return simulate_ll(regs, opcode); - if ((opcode & OPCODE) == SC) - return simulate_sc(regs, opcode); + unsigned int opcode; + + if (get_user(opcode, (unsigned int __user *) exception_epc(regs))) + goto out_sigsegv; + + if ((opcode & OPCODE) == LL) { + simulate_ll(regs, opcode); + return 0; + } + if ((opcode & OPCODE) == SC) { + simulate_sc(regs, opcode); + return 0; + } + + return -EFAULT; /* Strange things going on ... */ - return -1; /* Must be something else ... */ +out_sigsegv: + force_sig(SIGSEGV, current); + return -EFAULT; } /* @@ -537,9 +567,16 @@ static int simulate_llsc(struct pt_regs *regs, unsigned int opcode) * registers not implemented in hardware. The only current use of this * is the thread area pointer. */ -static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode) +static inline int simulate_rdhwr(struct pt_regs *regs) { struct thread_info *ti = task_thread_info(current); + unsigned int opcode; + + if (get_user(opcode, (unsigned int __user *) exception_epc(regs))) + goto out_sigsegv; + + if (unlikely(compute_return_epc(regs))) + return -EFAULT; if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) { int rd = (opcode & RD) >> 11; @@ -549,20 +586,16 @@ static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode) regs->regs[rt] = ti->tp_value; return 0; default: - return -1; + return -EFAULT; } } /* Not ours. */ - return -1; -} - -static int simulate_sync(struct pt_regs *regs, unsigned int opcode) -{ - if ((opcode & OPCODE) == SPEC0 && (opcode & FUNC) == SYNC) - return 0; + return -EFAULT; - return -1; /* Must be something else ... */ +out_sigsegv: + force_sig(SIGSEGV, current); + return -EFAULT; } asmlinkage void do_ov(struct pt_regs *regs) @@ -734,35 +767,16 @@ asmlinkage void do_tr(struct pt_regs *regs) asmlinkage void do_ri(struct pt_regs *regs) { - unsigned int __user *epc = (unsigned int __user *)exception_epc(regs); - unsigned long old_epc = regs->cp0_epc; - unsigned int opcode = 0; - int status = -1; - die_if_kernel("Reserved instruction in kernel code", regs); - if (unlikely(compute_return_epc(regs) < 0)) - return; - - if (unlikely(get_user(opcode, epc) < 0)) - status = SIGSEGV; - - if (!cpu_has_llsc && status < 0) - status = simulate_llsc(regs, opcode); - - if (status < 0) - status = simulate_rdhwr(regs, opcode); - - if (status < 0) - status = simulate_sync(regs, opcode); + if (!cpu_has_llsc) + if (!simulate_llsc(regs)) + return; - if (status < 0) - status = SIGILL; + if (!simulate_rdhwr(regs)) + return; - if (unlikely(status > 0)) { - regs->cp0_epc = old_epc; /* Undo skip-over. */ - force_sig(status, current); - } + force_sig(SIGILL, current); } /* @@ -794,11 +808,7 @@ static void mt_ase_fp_affinity(void) asmlinkage void do_cpu(struct pt_regs *regs) { - unsigned int __user *epc; - unsigned long old_epc; - unsigned int opcode; unsigned int cpid; - int status; die_if_kernel("do_cpu invoked from kernel context!", regs); @@ -806,32 +816,14 @@ asmlinkage void do_cpu(struct pt_regs *regs) switch (cpid) { case 0: - epc = (unsigned int __user *)exception_epc(regs); - old_epc = regs->cp0_epc; - opcode = 0; - status = -1; + if (!cpu_has_llsc) + if (!simulate_llsc(regs)) + return; - if (unlikely(compute_return_epc(regs) < 0)) + if (!simulate_rdhwr(regs)) return; - if (unlikely(get_user(opcode, epc) < 0)) - status = SIGSEGV; - - if (!cpu_has_llsc && status < 0) - status = simulate_llsc(regs, opcode); - - if (status < 0) - status = simulate_rdhwr(regs, opcode); - - if (status < 0) - status = SIGILL; - - if (unlikely(status > 0)) { - regs->cp0_epc = old_epc; /* Undo skip-over. */ - force_sig(status, current); - } - - return; + break; case 1: if (used_math()) /* Using the FPU again. */ diff --git a/trunk/arch/mips/sgi-ip22/ip22-time.c b/trunk/arch/mips/sgi-ip22/ip22-time.c index 10e505491655..9b9bffd2e8fb 100644 --- a/trunk/arch/mips/sgi-ip22/ip22-time.c +++ b/trunk/arch/mips/sgi-ip22/ip22-time.c @@ -192,3 +192,12 @@ void indy_8254timer_irq(void) ArcEnterInteractiveMode(); irq_exit(); } + +void __init plat_timer_setup(struct irqaction *irq) +{ + /* over-write the handler, we use our own way */ + irq->handler = no_action; + + /* setup irqaction */ + setup_irq(SGI_TIMER_IRQ, irq); +} diff --git a/trunk/arch/mips/sibyte/bcm1480/time.c b/trunk/arch/mips/sibyte/bcm1480/time.c index 5b4bfbbb5a24..40d7126cd5bf 100644 --- a/trunk/arch/mips/sibyte/bcm1480/time.c +++ b/trunk/arch/mips/sibyte/bcm1480/time.c @@ -84,7 +84,7 @@ static void sibyte_set_mode(enum clock_event_mode mode, void __iomem *timer_cfg, *timer_init; timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); - timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)); + timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); switch (mode) { case CLOCK_EVT_MODE_PERIODIC: diff --git a/trunk/arch/mips/sibyte/sb1250/time.c b/trunk/arch/mips/sibyte/sb1250/time.c index fe11fed8e0d7..38199ad8fc54 100644 --- a/trunk/arch/mips/sibyte/sb1250/time.c +++ b/trunk/arch/mips/sibyte/sb1250/time.c @@ -83,7 +83,7 @@ static void sibyte_set_mode(enum clock_event_mode mode, void __iomem *timer_cfg, *timer_init; timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); - timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)); + timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); switch(mode) { case CLOCK_EVT_MODE_PERIODIC: @@ -111,7 +111,7 @@ sibyte_next_event(unsigned long delta, struct clock_event_device *evt) void __iomem *timer_cfg, *timer_init; timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); - timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)); + timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); __raw_writeq(0, timer_cfg); __raw_writeq(delta, timer_init); @@ -155,7 +155,7 @@ static void sibyte_set_mode(enum clock_event_mode mode, void __iomem *timer_cfg, *timer_init; timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); - timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)); + timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); switch (mode) { case CLOCK_EVT_MODE_PERIODIC: @@ -183,7 +183,7 @@ sibyte_next_event(unsigned long delta, struct clock_event_device *evt) void __iomem *timer_cfg, *timer_init; timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); - timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)); + timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); __raw_writeq(0, timer_cfg); __raw_writeq(delta, timer_init); diff --git a/trunk/arch/x86/ia32/Makefile b/trunk/arch/x86/ia32/Makefile index e2edda255a84..cdae36435e21 100644 --- a/trunk/arch/x86/ia32/Makefile +++ b/trunk/arch/x86/ia32/Makefile @@ -18,35 +18,18 @@ $(obj)/syscall32_syscall.o: \ $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so) # Teach kbuild about targets -targets := $(foreach F,$(addprefix vsyscall-,sysenter syscall),\ - $F.o $F.so $F.so.dbg) +targets := $(foreach F,sysenter syscall,vsyscall-$F.o vsyscall-$F.so) # The DSO images are built using a special linker script quiet_cmd_syscall = SYSCALL $@ - cmd_syscall = $(CC) -m32 -nostdlib -shared \ + cmd_syscall = $(CC) -m32 -nostdlib -shared -s \ $(call ld-option, -Wl$(comma)--hash-style=sysv) \ -Wl,-soname=linux-gate.so.1 -o $@ \ -Wl,-T,$(filter-out FORCE,$^) -$(obj)/%.so: OBJCOPYFLAGS := -S -$(obj)/%.so: $(obj)/%.so.dbg FORCE - $(call if_changed,objcopy) - -$(obj)/vsyscall-sysenter.so.dbg $(obj)/vsyscall-syscall.so.dbg: \ -$(obj)/vsyscall-%.so.dbg: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE +$(obj)/vsyscall-sysenter.so $(obj)/vsyscall-syscall.so: \ +$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE $(call if_changed,syscall) AFLAGS_vsyscall-sysenter.o = -m32 -Wa,-32 AFLAGS_vsyscall-syscall.o = -m32 -Wa,-32 - -vdsos := vdso32-sysenter.so vdso32-syscall.so - -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(@:vdso32-%.so=$(obj)/vsyscall-%.so.dbg) \ - $(MODLIB)/vdso/$@ - -$(vdsos): - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: $(vdsos) diff --git a/trunk/arch/x86/ia32/ia32_aout.c b/trunk/arch/x86/ia32/ia32_aout.c index f82e1a94fcb7..7cf1c29bf90e 100644 --- a/trunk/arch/x86/ia32/ia32_aout.c +++ b/trunk/arch/x86/ia32/ia32_aout.c @@ -420,8 +420,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) (regs)->eflags = 0x200; (regs)->cs = __USER32_CS; (regs)->ss = __USER32_DS; - regs->r8 = regs->r9 = regs->r10 = regs->r11 = - regs->r12 = regs->r13 = regs->r14 = regs->r15 = 0; set_fs(USER_DS); if (unlikely(current->ptrace & PT_PTRACED)) { if (current->ptrace & PT_TRACE_EXEC) diff --git a/trunk/arch/x86/ia32/ia32_binfmt.c b/trunk/arch/x86/ia32/ia32_binfmt.c index 118b9f9ff499..d3c53e8b05c0 100644 --- a/trunk/arch/x86/ia32/ia32_binfmt.c +++ b/trunk/arch/x86/ia32/ia32_binfmt.c @@ -112,8 +112,11 @@ struct elf_prpsinfo char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; +#define __STR(x) #x +#define STR(x) __STR(x) + #define _GET_SEG(x) \ - ({ __u32 seg; asm("movl %%" __stringify(x) ",%0" : "=r"(seg)); seg; }) + ({ __u32 seg; asm("movl %%" STR(x) ",%0" : "=r"(seg)); seg; }) /* Assumes current==process to be dumped */ #define ELF_CORE_COPY_REGS(pr_reg, regs) \ diff --git a/trunk/arch/x86/ia32/ptrace32.c b/trunk/arch/x86/ia32/ptrace32.c index f52770ef0ee3..4a233ad6269c 100644 --- a/trunk/arch/x86/ia32/ptrace32.c +++ b/trunk/arch/x86/ia32/ptrace32.c @@ -228,8 +228,6 @@ static long ptrace32_siginfo(unsigned request, u32 pid, u32 addr, u32 data) return ret; } -#define COMPAT_GDT_ENTRY_TLS_MIN 6 - asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) { struct task_struct *child; @@ -248,6 +246,8 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) case PTRACE_SYSCALL: case PTRACE_OLDSETOPTIONS: case PTRACE_SETOPTIONS: + case PTRACE_SET_THREAD_AREA: + case PTRACE_GET_THREAD_AREA: return sys_ptrace(request, pid, addr, data); default: @@ -271,12 +271,6 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) case PTRACE_SETSIGINFO: case PTRACE_GETSIGINFO: return ptrace32_siginfo(request, pid, addr, data); - - case PTRACE_SET_THREAD_AREA: - case PTRACE_GET_THREAD_AREA: - return sys_ptrace(request, pid, - addr + GDT_ENTRY_TLS_MIN - COMPAT_GDT_ENTRY_TLS_MIN, - data); } child = ptrace_get_task_struct(pid); diff --git a/trunk/arch/x86/kernel/.gitignore b/trunk/arch/x86/kernel/.gitignore index 4ea38a39aed4..40836ad9079c 100644 --- a/trunk/arch/x86/kernel/.gitignore +++ b/trunk/arch/x86/kernel/.gitignore @@ -1,2 +1 @@ vsyscall.lds -vsyscall_32.lds diff --git a/trunk/arch/x86/kernel/Makefile b/trunk/arch/x86/kernel/Makefile index 38573340b143..45855c97923e 100644 --- a/trunk/arch/x86/kernel/Makefile +++ b/trunk/arch/x86/kernel/Makefile @@ -3,7 +3,3 @@ include ${srctree}/arch/x86/kernel/Makefile_32 else include ${srctree}/arch/x86/kernel/Makefile_64 endif - -# Workaround to delete .lds files with make clean -# The problem is that we do not enter Makefile_32 with make clean. -clean-files := vsyscall*.lds vsyscall*.so diff --git a/trunk/arch/x86/kernel/Makefile_32 b/trunk/arch/x86/kernel/Makefile_32 index a3fa11f8f460..7ff02063b858 100644 --- a/trunk/arch/x86/kernel/Makefile_32 +++ b/trunk/arch/x86/kernel/Makefile_32 @@ -51,7 +51,7 @@ obj-$(CONFIG_SCx200) += scx200_32.o # We must build both images before we can assemble it. # 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,int80 sysenter,vsyscall-$F.o vsyscall-$F.so) targets += vsyscall-note_32.o vsyscall_32.lds # The DSO images are built using a special linker script. diff --git a/trunk/arch/x86/kernel/alternative.c b/trunk/arch/x86/kernel/alternative.c index 3bd2688bd443..11b03d3c6fda 100644 --- a/trunk/arch/x86/kernel/alternative.c +++ b/trunk/arch/x86/kernel/alternative.c @@ -63,11 +63,11 @@ __setup("noreplace-paravirt", setup_noreplace_paravirt); /* Use inline assembly to define this because the nops are defined as inline assembly strings in the include files and we cannot get them easily into strings. */ -asm("\t.section .rodata, \"a\"\nintelnops: " +asm("\t.data\nintelnops: " GENERIC_NOP1 GENERIC_NOP2 GENERIC_NOP3 GENERIC_NOP4 GENERIC_NOP5 GENERIC_NOP6 GENERIC_NOP7 GENERIC_NOP8); -extern const unsigned char intelnops[]; -static const unsigned char *const intel_nops[ASM_NOP_MAX+1] = { +extern unsigned char intelnops[]; +static unsigned char *intel_nops[ASM_NOP_MAX+1] = { NULL, intelnops, intelnops + 1, @@ -81,11 +81,11 @@ static const unsigned char *const intel_nops[ASM_NOP_MAX+1] = { #endif #ifdef K8_NOP1 -asm("\t.section .rodata, \"a\"\nk8nops: " +asm("\t.data\nk8nops: " K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6 K8_NOP7 K8_NOP8); -extern const unsigned char k8nops[]; -static const unsigned char *const k8_nops[ASM_NOP_MAX+1] = { +extern unsigned char k8nops[]; +static unsigned char *k8_nops[ASM_NOP_MAX+1] = { NULL, k8nops, k8nops + 1, @@ -99,11 +99,11 @@ static const unsigned char *const k8_nops[ASM_NOP_MAX+1] = { #endif #ifdef K7_NOP1 -asm("\t.section .rodata, \"a\"\nk7nops: " +asm("\t.data\nk7nops: " K7_NOP1 K7_NOP2 K7_NOP3 K7_NOP4 K7_NOP5 K7_NOP6 K7_NOP7 K7_NOP8); -extern const unsigned char k7nops[]; -static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = { +extern unsigned char k7nops[]; +static unsigned char *k7_nops[ASM_NOP_MAX+1] = { NULL, k7nops, k7nops + 1, @@ -116,49 +116,28 @@ static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = { }; #endif -#ifdef P6_NOP1 -asm("\t.section .rodata, \"a\"\np6nops: " - P6_NOP1 P6_NOP2 P6_NOP3 P6_NOP4 P6_NOP5 P6_NOP6 - P6_NOP7 P6_NOP8); -extern const unsigned char p6nops[]; -static const unsigned char *const p6_nops[ASM_NOP_MAX+1] = { - NULL, - p6nops, - p6nops + 1, - p6nops + 1 + 2, - p6nops + 1 + 2 + 3, - p6nops + 1 + 2 + 3 + 4, - p6nops + 1 + 2 + 3 + 4 + 5, - p6nops + 1 + 2 + 3 + 4 + 5 + 6, - p6nops + 1 + 2 + 3 + 4 + 5 + 6 + 7, -}; -#endif - #ifdef CONFIG_X86_64 extern char __vsyscall_0; -static inline const unsigned char*const * find_nop_table(void) +static inline unsigned char** find_nop_table(void) { - return boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || - boot_cpu_data.x86 < 6 ? k8_nops : p6_nops; + return k8_nops; } #else /* CONFIG_X86_64 */ -static const struct nop { +static struct nop { int cpuid; - const unsigned char *const *noptable; + unsigned char **noptable; } noptypes[] = { { X86_FEATURE_K8, k8_nops }, { X86_FEATURE_K7, k7_nops }, - { X86_FEATURE_P4, p6_nops }, - { X86_FEATURE_P3, p6_nops }, { -1, NULL } }; -static const unsigned char*const * find_nop_table(void) +static unsigned char** find_nop_table(void) { - const unsigned char *const *noptable = intel_nops; + unsigned char **noptable = intel_nops; int i; for (i = 0; noptypes[i].cpuid >= 0; i++) { @@ -175,7 +154,7 @@ static const unsigned char*const * find_nop_table(void) /* Use this to add nops to a buffer, then text_poke the whole buffer. */ static void add_nops(void *insns, unsigned int len) { - const unsigned char *const *noptable = find_nop_table(); + unsigned char **noptable = find_nop_table(); while (len > 0) { unsigned int noplen = len; @@ -390,8 +369,8 @@ void apply_paravirt(struct paravirt_patch_site *start, BUG_ON(p->len > MAX_PATCH_LEN); /* prep the buffer with the original instructions */ memcpy(insnbuf, p->instr, p->len); - used = pv_init_ops.patch(p->instrtype, p->clobbers, insnbuf, - (unsigned long)p->instr, p->len); + used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf, + (unsigned long)p->instr, p->len); BUG_ON(used > p->len); @@ -436,6 +415,9 @@ void __init alternative_instructions(void) alternatives_smp_unlock(__smp_locks, __smp_locks_end, _text, _etext); } + free_init_pages("SMP alternatives", + (unsigned long)__smp_locks, + (unsigned long)__smp_locks_end); } else { alternatives_smp_module_add(NULL, "core kernel", __smp_locks, __smp_locks_end, @@ -446,11 +428,6 @@ void __init alternative_instructions(void) apply_paravirt(__parainstructions, __parainstructions_end); local_irq_restore(flags); - if (smp_alt_once) - free_init_pages("SMP alternatives", - (unsigned long)__smp_locks, - (unsigned long)__smp_locks_end); - restart_nmi(); #ifdef CONFIG_X86_MCE restart_mce(); diff --git a/trunk/arch/x86/kernel/apic_32.c b/trunk/arch/x86/kernel/apic_32.c index 793341fffc81..3d67ae18d762 100644 --- a/trunk/arch/x86/kernel/apic_32.c +++ b/trunk/arch/x86/kernel/apic_32.c @@ -1277,7 +1277,6 @@ void smp_spurious_interrupt(struct pt_regs *regs) /* see sw-dev-man vol 3, chapter 7.4.13.5 */ printk(KERN_INFO "spurious APIC interrupt on CPU#%d, " "should never happen.\n", smp_processor_id()); - __get_cpu_var(irq_stat).irq_spurious_count++; irq_exit(); } diff --git a/trunk/arch/x86/kernel/apic_64.c b/trunk/arch/x86/kernel/apic_64.c index f47bc493dba9..09b82093bc75 100644 --- a/trunk/arch/x86/kernel/apic_64.c +++ b/trunk/arch/x86/kernel/apic_64.c @@ -974,12 +974,15 @@ void __init setup_boot_APIC_clock (void) */ void __cpuinit check_boot_apic_timer_broadcast(void) { + struct clock_event_device *levt = &per_cpu(lapic_events, boot_cpu_id); + if (!disable_apic_timer || (lapic_clockevent.features & CLOCK_EVT_FEAT_DUMMY)) return; printk(KERN_INFO "AMD C1E detected late. Force timer broadcast.\n"); lapic_clockevent.features |= CLOCK_EVT_FEAT_DUMMY; + levt->features |= CLOCK_EVT_FEAT_DUMMY; local_irq_enable(); clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, &boot_cpu_id); @@ -1140,7 +1143,6 @@ asmlinkage void smp_spurious_interrupt(void) if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f))) ack_APIC_irq(); - add_pda(irq_spurious_count, 1); irq_exit(); } diff --git a/trunk/arch/x86/kernel/asm-offsets_32.c b/trunk/arch/x86/kernel/asm-offsets_32.c index f1b7cdda82b3..8029742c0fc1 100644 --- a/trunk/arch/x86/kernel/asm-offsets_32.c +++ b/trunk/arch/x86/kernel/asm-offsets_32.c @@ -116,14 +116,12 @@ void foo(void) #ifdef CONFIG_PARAVIRT BLANK(); - OFFSET(PARAVIRT_enabled, pv_info, paravirt_enabled); - OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops); - OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops); - OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable); - OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable); - OFFSET(PV_CPU_iret, pv_cpu_ops, iret); - OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit); - OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0); + OFFSET(PARAVIRT_enabled, paravirt_ops, paravirt_enabled); + OFFSET(PARAVIRT_irq_disable, paravirt_ops, irq_disable); + OFFSET(PARAVIRT_irq_enable, paravirt_ops, irq_enable); + OFFSET(PARAVIRT_irq_enable_sysexit, paravirt_ops, irq_enable_sysexit); + OFFSET(PARAVIRT_iret, paravirt_ops, iret); + OFFSET(PARAVIRT_read_cr0, paravirt_ops, read_cr0); #endif #ifdef CONFIG_XEN diff --git a/trunk/arch/x86/kernel/cpu/amd.c b/trunk/arch/x86/kernel/cpu/amd.c index 5f8af875f457..dcf6bbb1c7c0 100644 --- a/trunk/arch/x86/kernel/cpu/amd.c +++ b/trunk/arch/x86/kernel/cpu/amd.c @@ -4,7 +4,6 @@ #include #include #include -#include #include "cpu.h" @@ -46,17 +45,13 @@ static __cpuinit int amd_apic_timer_broken(void) case CPUID_XFAM_10H: case CPUID_XFAM_11H: rdmsr(MSR_K8_ENABLE_C1E, lo, hi); - if (lo & ENABLE_C1E_MASK) { - if (smp_processor_id() != boot_cpu_physical_apicid) - printk(KERN_INFO "AMD C1E detected late. " - " Force timer broadcast.\n"); + if (lo & ENABLE_C1E_MASK) return 1; - } - break; - default: - /* err on the side of caution */ + break; + default: + /* err on the side of caution */ return 1; - } + } return 0; } #endif diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c index f3686a5f2308..7decd6a50ffa 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/powernow-k7.c @@ -565,7 +565,7 @@ static unsigned int powernow_get(unsigned int cpu) } -static int __init acer_cpufreq_pst(const struct dmi_system_id *d) +static int __init acer_cpufreq_pst(struct dmi_system_id *d) { printk(KERN_WARNING "%s laptop with broken PST tables in BIOS detected.\n", d->ident); printk(KERN_WARNING "You need to downgrade to 3A21 (09/09/2002), or try a newer BIOS than 3A71 (01/20/2003)\n"); diff --git a/trunk/arch/x86/kernel/cpu/intel.c b/trunk/arch/x86/kernel/cpu/intel.c index cc8c501b9f39..dc4e08147b1f 100644 --- a/trunk/arch/x86/kernel/cpu/intel.c +++ b/trunk/arch/x86/kernel/cpu/intel.c @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -20,6 +19,8 @@ #include #endif +extern int trap_init_f00f_bug(void); + #ifdef CONFIG_X86_INTEL_USERCOPY /* * Alignment at which movsl is preferred for bulk memory copies. @@ -94,20 +95,6 @@ static int __cpuinit num_cpu_cores(struct cpuinfo_x86 *c) return 1; } -#ifdef CONFIG_X86_F00F_BUG -static void __cpuinit trap_init_f00f_bug(void) -{ - __set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO); - - /* - * Update the IDT descriptor and reload the IDT so that - * it uses the read-only mapped virtual address. - */ - idt_descr.address = fix_to_virt(FIX_F00F_IDT); - load_idt(&idt_descr); -} -#endif - static void __cpuinit init_intel(struct cpuinfo_x86 *c) { unsigned int l2 = 0; diff --git a/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c b/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c index 1826395ebeeb..db6c25aa5776 100644 --- a/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/trunk/arch/x86/kernel/cpu/intel_cacheinfo.c @@ -170,15 +170,15 @@ union l3_cache { unsigned val; }; -static unsigned short assocs[] __cpuinitdata = { +static const unsigned short assocs[] = { [1] = 1, [2] = 2, [4] = 4, [6] = 8, [8] = 16, [0xa] = 32, [0xb] = 48, [0xc] = 64, [0xf] = 0xffff // ?? }; -static unsigned char levels[] __cpuinitdata = { 1, 1, 2, 3 }; -static unsigned char types[] __cpuinitdata = { 1, 2, 3, 3 }; +static const unsigned char levels[] = { 1, 1, 2, 3 }; +static const unsigned char types[] = { 1, 2, 3, 3 }; static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, union _cpuid4_leaf_ebx *ebx, @@ -493,8 +493,8 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) } } #else -static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) {} -static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) {} +static void __init cache_shared_cpu_map_setup(unsigned int cpu, int index) {} +static void __init cache_remove_shared_cpu_map(unsigned int cpu, int index) {} #endif static void free_cache_attributes(unsigned int cpu) @@ -794,9 +794,8 @@ static int __cpuinit cache_sysfs_init(void) register_hotcpu_notifier(&cacheinfo_cpu_notifier); for_each_online_cpu(i) { - struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); - - cache_add_dev(sys_dev); + cacheinfo_cpu_callback(&cacheinfo_cpu_notifier, CPU_ONLINE, + (void *)(long)i); } return 0; diff --git a/trunk/arch/x86/kernel/cpu/mcheck/p4.c b/trunk/arch/x86/kernel/cpu/mcheck/p4.c index be4dabfee1f5..1509edfb2313 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/p4.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/p4.c @@ -61,7 +61,6 @@ fastcall void smp_thermal_interrupt(struct pt_regs *regs) { irq_enter(); vendor_thermal_interrupt(regs); - __get_cpu_var(irq_stat).irq_thermal_count++; irq_exit(); } diff --git a/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c b/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c index 494d320d909b..1203dc5ab87a 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -152,7 +152,7 @@ static __cpuinit int thermal_throttle_cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } -static struct notifier_block thermal_throttle_cpu_notifier __cpuinitdata = +static struct notifier_block thermal_throttle_cpu_notifier = { .notifier_call = thermal_throttle_cpu_callback, }; diff --git a/trunk/arch/x86/kernel/cpu/mtrr/main.c b/trunk/arch/x86/kernel/cpu/mtrr/main.c index 5e4be30ff903..c48b6fea5ab4 100644 --- a/trunk/arch/x86/kernel/cpu/mtrr/main.c +++ b/trunk/arch/x86/kernel/cpu/mtrr/main.c @@ -738,7 +738,13 @@ void mtrr_ap_init(void) */ void mtrr_save_state(void) { - smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1); + int cpu = get_cpu(); + + if (cpu == 0) + mtrr_save_fixed_ranges(NULL); + else + smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1); + put_cpu(); } static int __init mtrr_init_finialize(void) diff --git a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c index 54cdbf1a40f1..93fecd4b03de 100644 --- a/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/trunk/arch/x86/kernel/cpu/perfctr-watchdog.c @@ -34,7 +34,7 @@ struct wd_ops { u64 checkbit; }; -static const struct wd_ops *wd_ops; +static struct wd_ops *wd_ops; /* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) @@ -317,7 +317,7 @@ static void single_msr_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz) write_watchdog_counter(wd->perfctr_msr, NULL, nmi_hz); } -static const struct wd_ops k7_wd_ops = { +static struct wd_ops k7_wd_ops = { .reserve = single_msr_reserve, .unreserve = single_msr_unreserve, .setup = setup_k7_watchdog, @@ -380,7 +380,7 @@ static void p6_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz) write_watchdog_counter32(wd->perfctr_msr, NULL,nmi_hz); } -static const struct wd_ops p6_wd_ops = { +static struct wd_ops p6_wd_ops = { .reserve = single_msr_reserve, .unreserve = single_msr_unreserve, .setup = setup_p6_watchdog, @@ -532,7 +532,7 @@ static void p4_rearm(struct nmi_watchdog_ctlblk *wd, unsigned nmi_hz) write_watchdog_counter(wd->perfctr_msr, NULL, nmi_hz); } -static const struct wd_ops p4_wd_ops = { +static struct wd_ops p4_wd_ops = { .reserve = p4_reserve, .unreserve = p4_unreserve, .setup = setup_p4_watchdog, @@ -550,8 +550,6 @@ static const struct wd_ops p4_wd_ops = { #define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL #define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK -static struct wd_ops intel_arch_wd_ops; - static int setup_intel_arch_watchdog(unsigned nmi_hz) { unsigned int ebx; @@ -593,11 +591,11 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz) wd->perfctr_msr = perfctr_msr; wd->evntsel_msr = evntsel_msr; wd->cccr_msr = 0; //unused - intel_arch_wd_ops.checkbit = 1ULL << (eax.split.bit_width - 1); + wd_ops->checkbit = 1ULL << (eax.split.bit_width - 1); return 1; } -static struct wd_ops intel_arch_wd_ops __read_mostly = { +static struct wd_ops intel_arch_wd_ops = { .reserve = single_msr_reserve, .unreserve = single_msr_unreserve, .setup = setup_intel_arch_watchdog, diff --git a/trunk/arch/x86/kernel/cpuid.c b/trunk/arch/x86/kernel/cpuid.c index 70dcf912d9fb..f4548c93ccf5 100644 --- a/trunk/arch/x86/kernel/cpuid.c +++ b/trunk/arch/x86/kernel/cpuid.c @@ -43,6 +43,8 @@ static struct class *cpuid_class; +#ifdef CONFIG_SMP + struct cpuid_command { u32 reg; u32 *data; @@ -60,11 +62,25 @@ static inline void do_cpuid(int cpu, u32 reg, u32 * data) { struct cpuid_command cmd; - cmd.reg = reg; - cmd.data = data; + preempt_disable(); + if (cpu == smp_processor_id()) { + cpuid(reg, &data[0], &data[1], &data[2], &data[3]); + } else { + cmd.reg = reg; + cmd.data = data; - smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1); + smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1); + } + preempt_enable(); } +#else /* ! CONFIG_SMP */ + +static inline void do_cpuid(int cpu, u32 reg, u32 * data) +{ + cpuid(reg, &data[0], &data[1], &data[2], &data[3]); +} + +#endif /* ! CONFIG_SMP */ static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) { @@ -134,7 +150,7 @@ static const struct file_operations cpuid_fops = { .open = cpuid_open, }; -static int __cpuinit cpuid_device_create(int i) +static int cpuid_device_create(int i) { int err = 0; struct device *dev; @@ -145,9 +161,7 @@ static int __cpuinit cpuid_device_create(int i) return err; } -static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb, - unsigned long action, - void *hcpu) +static int cpuid_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/trunk/arch/x86/kernel/entry_32.S b/trunk/arch/x86/kernel/entry_32.S index dc7f938e5015..8099fea0a72f 100644 --- a/trunk/arch/x86/kernel/entry_32.S +++ b/trunk/arch/x86/kernel/entry_32.S @@ -437,7 +437,7 @@ ldt_ss: * is still available to implement the setting of the high * 16-bits in the INTERRUPT_RETURN paravirt-op. */ - cmpl $0, pv_info+PARAVIRT_enabled + cmpl $0, paravirt_ops+PARAVIRT_enabled jne restore_nocheck #endif diff --git a/trunk/arch/x86/kernel/entry_64.S b/trunk/arch/x86/kernel/entry_64.S index 3a058bb16409..f1cacd4897f7 100644 --- a/trunk/arch/x86/kernel/entry_64.S +++ b/trunk/arch/x86/kernel/entry_64.S @@ -988,7 +988,7 @@ child_rip: movq %rsi, %rdi call *%rax # exit - mov %eax, %edi + xorl %edi, %edi call do_exit CFI_ENDPROC ENDPROC(child_rip) diff --git a/trunk/arch/x86/kernel/genapic_64.c b/trunk/arch/x86/kernel/genapic_64.c index 4ae03e3e8294..47496a40e84f 100644 --- a/trunk/arch/x86/kernel/genapic_64.c +++ b/trunk/arch/x86/kernel/genapic_64.c @@ -29,6 +29,8 @@ u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; EXPORT_SYMBOL(x86_cpu_to_apicid); +u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; + struct genapic __read_mostly *genapic = &apic_flat; /* diff --git a/trunk/arch/x86/kernel/genapic_flat_64.c b/trunk/arch/x86/kernel/genapic_flat_64.c index 91c7526768ee..ecb01eefdd27 100644 --- a/trunk/arch/x86/kernel/genapic_flat_64.c +++ b/trunk/arch/x86/kernel/genapic_flat_64.c @@ -52,6 +52,7 @@ static void flat_init_apic_ldr(void) num = smp_processor_id(); id = 1UL << num; + x86_cpu_to_log_apicid[num] = id; apic_write(APIC_DFR, APIC_DFR_FLAT); val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; val |= SET_APIC_LOGICAL_ID(id); diff --git a/trunk/arch/x86/kernel/head_32.S b/trunk/arch/x86/kernel/head_32.S index 39677965e161..9150ca9b5f80 100644 --- a/trunk/arch/x86/kernel/head_32.S +++ b/trunk/arch/x86/kernel/head_32.S @@ -51,15 +51,6 @@ */ LOW_PAGES = 1<<(32-PAGE_SHIFT_asm) -/* - * To preserve the DMA pool in PAGEALLOC kernels, we'll allocate - * pagetables from above the 16MB DMA limit, so we'll have to set - * up pagetables 16MB more (worst-case): - */ -#ifdef CONFIG_DEBUG_PAGEALLOC -LOW_PAGES = LOW_PAGES + 0x1000000 -#endif - #if PTRS_PER_PMD > 1 PAGE_TABLE_SIZE = (LOW_PAGES / PTRS_PER_PMD) + PTRS_PER_PGD #else @@ -452,7 +443,6 @@ early_page_fault: early_fault: cld #ifdef CONFIG_PRINTK - pusha movl $(__KERNEL_DS),%eax movl %eax,%ds movl %eax,%es @@ -544,15 +534,8 @@ int_msg: .asciz "Unknown interrupt or fault at EIP %p %p %p\n" fault_msg: - .ascii \ -/* fault info: */ "BUG: Int %d: CR2 %p\n" \ -/* pusha regs: */ " EDI %p ESI %p EBP %p ESP %p\n" \ - " EBX %p EDX %p ECX %p EAX %p\n" \ -/* fault frame: */ " err %p EIP %p CS %p flg %p\n" \ - \ - "Stack: %p %p %p %p %p %p %p %p\n" \ - " %p %p %p %p %p %p %p %p\n" \ - " %p %p %p %p %p %p %p %p\n" + .ascii "Int %d: CR2 %p err %p EIP %p CS %p flags %p\n" + .asciz "Stack: %p %p %p %p %p %p %p %p\n" #include "../../x86/xen/xen-head.S" diff --git a/trunk/arch/x86/kernel/i386_ksyms_32.c b/trunk/arch/x86/kernel/i386_ksyms_32.c index edd39ccf139e..e3d4b73bfdb0 100644 --- a/trunk/arch/x86/kernel/i386_ksyms_32.c +++ b/trunk/arch/x86/kernel/i386_ksyms_32.c @@ -1,5 +1,4 @@ #include -#include #include #include diff --git a/trunk/arch/x86/kernel/i8259_32.c b/trunk/arch/x86/kernel/i8259_32.c index d34a10cc13a7..679bb33acbf1 100644 --- a/trunk/arch/x86/kernel/i8259_32.c +++ b/trunk/arch/x86/kernel/i8259_32.c @@ -349,11 +349,7 @@ static irqreturn_t math_error_irq(int cpl, void *dev_id) * New motherboards sometimes make IRQ 13 be a PCI interrupt, * so allow interrupt sharing. */ -static struct irqaction fpu_irq = { - .handler = math_error_irq, - .mask = CPU_MASK_NONE, - .name = "fpu", -}; +static struct irqaction fpu_irq = { math_error_irq, 0, CPU_MASK_NONE, "fpu", NULL, NULL }; void __init init_ISA_irqs (void) { diff --git a/trunk/arch/x86/kernel/i8259_64.c b/trunk/arch/x86/kernel/i8259_64.c index 3f27ea0b9816..eb72976cc13c 100644 --- a/trunk/arch/x86/kernel/i8259_64.c +++ b/trunk/arch/x86/kernel/i8259_64.c @@ -395,11 +395,7 @@ device_initcall(i8259A_init_sysfs); * IRQ2 is cascade interrupt to second interrupt controller */ -static struct irqaction irq2 = { - .handler = no_action, - .mask = CPU_MASK_NONE, - .name = "cascade", -}; +static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; DEFINE_PER_CPU(vector_irq_t, vector_irq) = { [0 ... IRQ0_VECTOR - 1] = -1, [IRQ0_VECTOR] = 0, diff --git a/trunk/arch/x86/kernel/io_apic_32.c b/trunk/arch/x86/kernel/io_apic_32.c index 5f10c7189534..4ee1e5ee9b57 100644 --- a/trunk/arch/x86/kernel/io_apic_32.c +++ b/trunk/arch/x86/kernel/io_apic_32.c @@ -1296,11 +1296,6 @@ static void __init setup_IO_APIC_irqs(void) continue; } - if (!first_notcon) { - apic_printk(APIC_VERBOSE, " not connected.\n"); - first_notcon = 1; - } - entry.trigger = irq_trigger(idx); entry.polarity = irq_polarity(idx); diff --git a/trunk/arch/x86/kernel/io_apic_64.c b/trunk/arch/x86/kernel/io_apic_64.c index 1c2c7bf6a9d3..966fa1062491 100644 --- a/trunk/arch/x86/kernel/io_apic_64.c +++ b/trunk/arch/x86/kernel/io_apic_64.c @@ -875,10 +875,6 @@ static void __init setup_IO_APIC_irqs(void) apic_printk(APIC_VERBOSE, ", %d-%d", mp_ioapics[apic].mpc_apicid, pin); continue; } - if (!first_notcon) { - apic_printk(APIC_VERBOSE, " not connected.\n"); - first_notcon = 1; - } irq = pin_2_irq(idx, apic, pin); add_pin_to_irq(irq, apic, pin); @@ -889,7 +885,7 @@ static void __init setup_IO_APIC_irqs(void) } if (!first_notcon) - apic_printk(APIC_VERBOSE, " not connected.\n"); + apic_printk(APIC_VERBOSE," not connected.\n"); } /* @@ -1849,7 +1845,7 @@ static struct sysdev_class ioapic_sysdev_class = { static int __init ioapic_init_sysfs(void) { struct sys_device * dev; - int i, size, error; + int i, size, error = 0; error = sysdev_class_register(&ioapic_sysdev_class); if (error) @@ -1858,11 +1854,12 @@ static int __init ioapic_init_sysfs(void) for (i = 0; i < nr_ioapics; i++ ) { size = sizeof(struct sys_device) + nr_ioapic_registers[i] * sizeof(struct IO_APIC_route_entry); - mp_ioapic_data[i] = kzalloc(size, GFP_KERNEL); + mp_ioapic_data[i] = kmalloc(size, GFP_KERNEL); if (!mp_ioapic_data[i]) { printk(KERN_ERR "Can't suspend/resume IOAPIC %d\n", i); continue; } + memset(mp_ioapic_data[i], 0, size); dev = &mp_ioapic_data[i]->dev; dev->id = i; dev->cls = &ioapic_sysdev_class; diff --git a/trunk/arch/x86/kernel/irq_32.c b/trunk/arch/x86/kernel/irq_32.c index d3fde94f7345..e173b763f148 100644 --- a/trunk/arch/x86/kernel/irq_32.c +++ b/trunk/arch/x86/kernel/irq_32.c @@ -255,17 +255,9 @@ int show_interrupts(struct seq_file *p, void *v) } if (i < NR_IRQS) { - unsigned any_count = 0; - spin_lock_irqsave(&irq_desc[i].lock, flags); -#ifndef CONFIG_SMP - any_count = kstat_irqs(i); -#else - for_each_online_cpu(j) - any_count |= kstat_cpu(j).irqs[i]; -#endif action = irq_desc[i].action; - if (!action && !any_count) + if (!action) goto skip; seq_printf(p, "%3d: ",i); #ifndef CONFIG_SMP @@ -276,12 +268,10 @@ int show_interrupts(struct seq_file *p, void *v) #endif seq_printf(p, " %8s", irq_desc[i].chip->name); seq_printf(p, "-%-8s", irq_desc[i].name); + seq_printf(p, " %s", action->name); - if (action) { - seq_printf(p, " %s", action->name); - while ((action = action->next) != NULL) - seq_printf(p, ", %s", action->name); - } + for (action=action->next; action; action = action->next) + seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); skip: @@ -290,41 +280,14 @@ int show_interrupts(struct seq_file *p, void *v) seq_printf(p, "NMI: "); for_each_online_cpu(j) seq_printf(p, "%10u ", nmi_count(j)); - seq_printf(p, " Non-maskable interrupts\n"); + seq_putc(p, '\n'); #ifdef CONFIG_X86_LOCAL_APIC seq_printf(p, "LOC: "); for_each_online_cpu(j) seq_printf(p, "%10u ", per_cpu(irq_stat,j).apic_timer_irqs); - seq_printf(p, " Local timer interrupts\n"); -#endif -#ifdef CONFIG_SMP - seq_printf(p, "RES: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", - per_cpu(irq_stat,j).irq_resched_count); - seq_printf(p, " Rescheduling interrupts\n"); - seq_printf(p, "CAL: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", - per_cpu(irq_stat,j).irq_call_count); - seq_printf(p, " function call interrupts\n"); - seq_printf(p, "TLB: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", - per_cpu(irq_stat,j).irq_tlb_count); - seq_printf(p, " TLB shootdowns\n"); + seq_putc(p, '\n'); #endif - seq_printf(p, "TRM: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", - per_cpu(irq_stat,j).irq_thermal_count); - seq_printf(p, " Thermal event interrupts\n"); - seq_printf(p, "SPU: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", - per_cpu(irq_stat,j).irq_spurious_count); - seq_printf(p, " Spurious interrupts\n"); seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); #if defined(CONFIG_X86_IO_APIC) seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); diff --git a/trunk/arch/x86/kernel/irq_64.c b/trunk/arch/x86/kernel/irq_64.c index 6b5c730d67b9..865669efc540 100644 --- a/trunk/arch/x86/kernel/irq_64.c +++ b/trunk/arch/x86/kernel/irq_64.c @@ -62,17 +62,9 @@ int show_interrupts(struct seq_file *p, void *v) } if (i < NR_IRQS) { - unsigned any_count = 0; - spin_lock_irqsave(&irq_desc[i].lock, flags); -#ifndef CONFIG_SMP - any_count = kstat_irqs(i); -#else - for_each_online_cpu(j) - any_count |= kstat_cpu(j).irqs[i]; -#endif action = irq_desc[i].action; - if (!action && !any_count) + if (!action) goto skip; seq_printf(p, "%3d: ",i); #ifndef CONFIG_SMP @@ -84,11 +76,9 @@ int show_interrupts(struct seq_file *p, void *v) seq_printf(p, " %8s", irq_desc[i].chip->name); seq_printf(p, "-%-8s", irq_desc[i].name); - if (action) { - seq_printf(p, " %s", action->name); - while ((action = action->next) != NULL) - seq_printf(p, ", %s", action->name); - } + seq_printf(p, " %s", action->name); + for (action=action->next; action; action = action->next) + seq_printf(p, ", %s", action->name); seq_putc(p, '\n'); skip: spin_unlock_irqrestore(&irq_desc[i].lock, flags); @@ -96,37 +86,11 @@ int show_interrupts(struct seq_file *p, void *v) seq_printf(p, "NMI: "); for_each_online_cpu(j) seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); - seq_printf(p, " Non-maskable interrupts\n"); + seq_putc(p, '\n'); seq_printf(p, "LOC: "); for_each_online_cpu(j) seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs); - seq_printf(p, " Local timer interrupts\n"); -#ifdef CONFIG_SMP - seq_printf(p, "RES: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", cpu_pda(j)->irq_resched_count); - seq_printf(p, " Rescheduling interrupts\n"); - seq_printf(p, "CAL: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count); - seq_printf(p, " function call interrupts\n"); - seq_printf(p, "TLB: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count); - seq_printf(p, " TLB shootdowns\n"); -#endif - seq_printf(p, "TRM: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", cpu_pda(j)->irq_thermal_count); - seq_printf(p, " Thermal event interrupts\n"); - seq_printf(p, "THR: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", cpu_pda(j)->irq_threshold_count); - seq_printf(p, " Threshold APIC interrupts\n"); - seq_printf(p, "SPU: "); - for_each_online_cpu(j) - seq_printf(p, "%10u ", cpu_pda(j)->irq_spurious_count); - seq_printf(p, " Spurious interrupts\n"); + seq_putc(p, '\n'); seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); } return 0; diff --git a/trunk/arch/x86/kernel/ldt_32.c b/trunk/arch/x86/kernel/ldt_32.c index 9ff90a27c45f..a8b18421863a 100644 --- a/trunk/arch/x86/kernel/ldt_32.c +++ b/trunk/arch/x86/kernel/ldt_32.c @@ -92,13 +92,13 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) struct mm_struct * old_mm; int retval = 0; - mutex_init(&mm->context.lock); + init_MUTEX(&mm->context.sem); mm->context.size = 0; old_mm = current->mm; if (old_mm && old_mm->context.size > 0) { - mutex_lock(&old_mm->context.lock); + down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); - mutex_unlock(&old_mm->context.lock); + up(&old_mm->context.sem); } return retval; } @@ -130,7 +130,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; - mutex_lock(&mm->context.lock); + down(&mm->context.sem); size = mm->context.size*LDT_ENTRY_SIZE; if (size > bytecount) size = bytecount; @@ -138,7 +138,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) err = 0; if (copy_to_user(ptr, mm->context.ldt, size)) err = -EFAULT; - mutex_unlock(&mm->context.lock); + up(&mm->context.sem); if (err < 0) goto error_return; if (size != bytecount) { @@ -194,7 +194,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) goto out; } - mutex_lock(&mm->context.lock); + down(&mm->context.sem); if (ldt_info.entry_number >= mm->context.size) { error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); if (error < 0) @@ -221,7 +221,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) error = 0; out_unlock: - mutex_unlock(&mm->context.lock); + up(&mm->context.sem); out: return error; } diff --git a/trunk/arch/x86/kernel/ldt_64.c b/trunk/arch/x86/kernel/ldt_64.c index 60e57abb8e90..3796523d616a 100644 --- a/trunk/arch/x86/kernel/ldt_64.c +++ b/trunk/arch/x86/kernel/ldt_64.c @@ -96,13 +96,13 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) struct mm_struct * old_mm; int retval = 0; - mutex_init(&mm->context.lock); + init_MUTEX(&mm->context.sem); mm->context.size = 0; old_mm = current->mm; if (old_mm && old_mm->context.size > 0) { - mutex_lock(&old_mm->context.lock); + down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); - mutex_unlock(&old_mm->context.lock); + up(&old_mm->context.sem); } return retval; } @@ -133,7 +133,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES) bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES; - mutex_lock(&mm->context.lock); + down(&mm->context.sem); size = mm->context.size*LDT_ENTRY_SIZE; if (size > bytecount) size = bytecount; @@ -141,7 +141,7 @@ static int read_ldt(void __user * ptr, unsigned long bytecount) err = 0; if (copy_to_user(ptr, mm->context.ldt, size)) err = -EFAULT; - mutex_unlock(&mm->context.lock); + up(&mm->context.sem); if (err < 0) goto error_return; if (size != bytecount) { @@ -193,7 +193,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) goto out; } - mutex_lock(&mm->context.lock); + down(&mm->context.sem); if (ldt_info.entry_number >= (unsigned)mm->context.size) { error = alloc_ldt(¤t->mm->context, ldt_info.entry_number+1, 1); if (error < 0) @@ -223,7 +223,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode) error = 0; out_unlock: - mutex_unlock(&mm->context.lock); + up(&mm->context.sem); out: return error; } diff --git a/trunk/arch/x86/kernel/mce_64.c b/trunk/arch/x86/kernel/mce_64.c index 8ca8f8648969..97d2b757d6bd 100644 --- a/trunk/arch/x86/kernel/mce_64.c +++ b/trunk/arch/x86/kernel/mce_64.c @@ -695,6 +695,8 @@ static int __init mcheck_disable(char *str) mce=nobootlog Don't log MCEs from before booting. */ static int __init mcheck_enable(char *str) { + if (*str == '=') + str++; if (!strcmp(str, "off")) mce_dont_init = 1; else if (!strcmp(str, "bootlog") || !strcmp(str,"nobootlog")) @@ -707,7 +709,7 @@ static int __init mcheck_enable(char *str) } __setup("nomce", mcheck_disable); -__setup("mce=", mcheck_enable); +__setup("mce", mcheck_enable); /* * Sysfs support diff --git a/trunk/arch/x86/kernel/mce_amd_64.c b/trunk/arch/x86/kernel/mce_amd_64.c index 0d2afd96aca4..805b62b1e0df 100644 --- a/trunk/arch/x86/kernel/mce_amd_64.c +++ b/trunk/arch/x86/kernel/mce_amd_64.c @@ -237,7 +237,6 @@ asmlinkage void mce_threshold_interrupt(void) } } out: - add_pda(irq_threshold_count, 1); irq_exit(); } diff --git a/trunk/arch/x86/kernel/mce_intel_64.c b/trunk/arch/x86/kernel/mce_intel_64.c index c17eaf5dd6dd..6551505d8a2c 100644 --- a/trunk/arch/x86/kernel/mce_intel_64.c +++ b/trunk/arch/x86/kernel/mce_intel_64.c @@ -26,7 +26,6 @@ asmlinkage void smp_thermal_interrupt(void) if (therm_throt_process(msr_val & 1)) mce_log_therm_throt_event(smp_processor_id(), msr_val); - add_pda(irq_thermal_count, 1); irq_exit(); } diff --git a/trunk/arch/x86/kernel/msr.c b/trunk/arch/x86/kernel/msr.c index df85c9c13601..c044de310b69 100644 --- a/trunk/arch/x86/kernel/msr.c +++ b/trunk/arch/x86/kernel/msr.c @@ -133,7 +133,7 @@ static const struct file_operations msr_fops = { .open = msr_open, }; -static int __cpuinit msr_device_create(int i) +static int msr_device_create(int i) { int err = 0; struct device *dev; @@ -144,7 +144,7 @@ static int __cpuinit msr_device_create(int i) return err; } -static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb, +static int msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; diff --git a/trunk/arch/x86/kernel/paravirt_32.c b/trunk/arch/x86/kernel/paravirt_32.c index 6a80d67c2121..739cfb207dd7 100644 --- a/trunk/arch/x86/kernel/paravirt_32.c +++ b/trunk/arch/x86/kernel/paravirt_32.c @@ -42,33 +42,32 @@ void _paravirt_nop(void) static void __init default_banner(void) { printk(KERN_INFO "Booting paravirtualized kernel on %s\n", - pv_info.name); + paravirt_ops.name); } char *memory_setup(void) { - return pv_init_ops.memory_setup(); + return paravirt_ops.memory_setup(); } /* Simple instruction patching code. */ -#define DEF_NATIVE(ops, name, code) \ - extern const char start_##ops##_##name[], end_##ops##_##name[]; \ - asm("start_" #ops "_" #name ": " code "; end_" #ops "_" #name ":") - -DEF_NATIVE(pv_irq_ops, irq_disable, "cli"); -DEF_NATIVE(pv_irq_ops, irq_enable, "sti"); -DEF_NATIVE(pv_irq_ops, restore_fl, "push %eax; popf"); -DEF_NATIVE(pv_irq_ops, save_fl, "pushf; pop %eax"); -DEF_NATIVE(pv_cpu_ops, iret, "iret"); -DEF_NATIVE(pv_cpu_ops, irq_enable_sysexit, "sti; sysexit"); -DEF_NATIVE(pv_mmu_ops, read_cr2, "mov %cr2, %eax"); -DEF_NATIVE(pv_mmu_ops, write_cr3, "mov %eax, %cr3"); -DEF_NATIVE(pv_mmu_ops, read_cr3, "mov %cr3, %eax"); -DEF_NATIVE(pv_cpu_ops, clts, "clts"); -DEF_NATIVE(pv_cpu_ops, read_tsc, "rdtsc"); - -/* Undefined instruction for dealing with missing ops pointers. */ -static const unsigned char ud2a[] = { 0x0f, 0x0b }; +#define DEF_NATIVE(name, code) \ + extern const char start_##name[], end_##name[]; \ + asm("start_" #name ": " code "; end_" #name ":") + +DEF_NATIVE(irq_disable, "cli"); +DEF_NATIVE(irq_enable, "sti"); +DEF_NATIVE(restore_fl, "push %eax; popf"); +DEF_NATIVE(save_fl, "pushf; pop %eax"); +DEF_NATIVE(iret, "iret"); +DEF_NATIVE(irq_enable_sysexit, "sti; sysexit"); +DEF_NATIVE(read_cr2, "mov %cr2, %eax"); +DEF_NATIVE(write_cr3, "mov %eax, %cr3"); +DEF_NATIVE(read_cr3, "mov %cr3, %eax"); +DEF_NATIVE(clts, "clts"); +DEF_NATIVE(read_tsc, "rdtsc"); + +DEF_NATIVE(ud2a, "ud2a"); static unsigned native_patch(u8 type, u16 clobbers, void *ibuf, unsigned long addr, unsigned len) @@ -77,29 +76,37 @@ static unsigned native_patch(u8 type, u16 clobbers, void *ibuf, unsigned ret; switch(type) { -#define SITE(ops, x) \ - case PARAVIRT_PATCH(ops.x): \ - start = start_##ops##_##x; \ - end = end_##ops##_##x; \ - goto patch_site - - SITE(pv_irq_ops, irq_disable); - SITE(pv_irq_ops, irq_enable); - SITE(pv_irq_ops, restore_fl); - SITE(pv_irq_ops, save_fl); - SITE(pv_cpu_ops, iret); - SITE(pv_cpu_ops, irq_enable_sysexit); - SITE(pv_mmu_ops, read_cr2); - SITE(pv_mmu_ops, read_cr3); - SITE(pv_mmu_ops, write_cr3); - SITE(pv_cpu_ops, clts); - SITE(pv_cpu_ops, read_tsc); +#define SITE(x) case PARAVIRT_PATCH(x): start = start_##x; end = end_##x; goto patch_site + SITE(irq_disable); + SITE(irq_enable); + SITE(restore_fl); + SITE(save_fl); + SITE(iret); + SITE(irq_enable_sysexit); + SITE(read_cr2); + SITE(read_cr3); + SITE(write_cr3); + SITE(clts); + SITE(read_tsc); #undef SITE patch_site: ret = paravirt_patch_insns(ibuf, len, start, end); break; + case PARAVIRT_PATCH(make_pgd): + case PARAVIRT_PATCH(make_pte): + case PARAVIRT_PATCH(pgd_val): + case PARAVIRT_PATCH(pte_val): +#ifdef CONFIG_X86_PAE + case PARAVIRT_PATCH(make_pmd): + case PARAVIRT_PATCH(pmd_val): +#endif + /* These functions end up returning exactly what + they're passed, in the same registers. */ + ret = paravirt_patch_nop(); + break; + default: ret = paravirt_patch_default(type, clobbers, ibuf, addr, len); break; @@ -143,7 +150,7 @@ unsigned paravirt_patch_call(void *insnbuf, return 5; } -unsigned paravirt_patch_jmp(void *insnbuf, const void *target, +unsigned paravirt_patch_jmp(const void *target, void *insnbuf, unsigned long addr, unsigned len) { struct branch *b = insnbuf; @@ -158,37 +165,22 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target, return 5; } -/* Neat trick to map patch type back to the call within the - * corresponding structure. */ -static void *get_call_destination(u8 type) -{ - struct paravirt_patch_template tmpl = { - .pv_init_ops = pv_init_ops, - .pv_time_ops = pv_time_ops, - .pv_cpu_ops = pv_cpu_ops, - .pv_irq_ops = pv_irq_ops, - .pv_apic_ops = pv_apic_ops, - .pv_mmu_ops = pv_mmu_ops, - }; - return *((void **)&tmpl + type); -} - unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf, unsigned long addr, unsigned len) { - void *opfunc = get_call_destination(type); + void *opfunc = *((void **)¶virt_ops + type); unsigned ret; if (opfunc == NULL) /* If there's no function, patch it with a ud2a (BUG) */ - ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a)); + ret = paravirt_patch_insns(insnbuf, len, start_ud2a, end_ud2a); else if (opfunc == paravirt_nop) /* If the operation is a nop, then nop the callsite */ ret = paravirt_patch_nop(); - else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) || - type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit)) + else if (type == PARAVIRT_PATCH(iret) || + type == PARAVIRT_PATCH(irq_enable_sysexit)) /* If operation requires a jmp, then jmp */ - ret = paravirt_patch_jmp(insnbuf, opfunc, addr, len); + ret = paravirt_patch_jmp(opfunc, insnbuf, addr, len); else /* Otherwise call the function; assume target could clobber any caller-save reg */ @@ -213,7 +205,7 @@ unsigned paravirt_patch_insns(void *insnbuf, unsigned len, void init_IRQ(void) { - pv_irq_ops.init_IRQ(); + paravirt_ops.init_IRQ(); } static void native_flush_tlb(void) @@ -241,7 +233,7 @@ extern void native_irq_enable_sysexit(void); static int __init print_banner(void) { - pv_init_ops.banner(); + paravirt_ops.banner(); return 0; } core_initcall(print_banner); @@ -281,96 +273,47 @@ int paravirt_disable_iospace(void) return ret; } -static DEFINE_PER_CPU(enum paravirt_lazy_mode, paravirt_lazy_mode) = PARAVIRT_LAZY_NONE; - -static inline void enter_lazy(enum paravirt_lazy_mode mode) -{ - BUG_ON(x86_read_percpu(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE); - BUG_ON(preemptible()); - - x86_write_percpu(paravirt_lazy_mode, mode); -} - -void paravirt_leave_lazy(enum paravirt_lazy_mode mode) -{ - BUG_ON(x86_read_percpu(paravirt_lazy_mode) != mode); - BUG_ON(preemptible()); - - x86_write_percpu(paravirt_lazy_mode, PARAVIRT_LAZY_NONE); -} - -void paravirt_enter_lazy_mmu(void) -{ - enter_lazy(PARAVIRT_LAZY_MMU); -} - -void paravirt_leave_lazy_mmu(void) -{ - paravirt_leave_lazy(PARAVIRT_LAZY_MMU); -} - -void paravirt_enter_lazy_cpu(void) -{ - enter_lazy(PARAVIRT_LAZY_CPU); -} - -void paravirt_leave_lazy_cpu(void) -{ - paravirt_leave_lazy(PARAVIRT_LAZY_CPU); -} - -enum paravirt_lazy_mode paravirt_get_lazy_mode(void) -{ - return x86_read_percpu(paravirt_lazy_mode); -} - -struct pv_info pv_info = { +struct paravirt_ops paravirt_ops = { .name = "bare hardware", .paravirt_enabled = 0, .kernel_rpl = 0, .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */ -}; -struct pv_init_ops pv_init_ops = { - .patch = native_patch, + .patch = native_patch, .banner = default_banner, .arch_setup = paravirt_nop, .memory_setup = machine_specific_memory_setup, -}; - -struct pv_time_ops pv_time_ops = { - .time_init = hpet_time_init, .get_wallclock = native_get_wallclock, .set_wallclock = native_set_wallclock, - .sched_clock = native_sched_clock, - .get_cpu_khz = native_calculate_cpu_khz, -}; - -struct pv_irq_ops pv_irq_ops = { + .time_init = hpet_time_init, .init_IRQ = native_init_IRQ, - .save_fl = native_save_fl, - .restore_fl = native_restore_fl, - .irq_disable = native_irq_disable, - .irq_enable = native_irq_enable, - .safe_halt = native_safe_halt, - .halt = native_halt, -}; -struct pv_cpu_ops pv_cpu_ops = { .cpuid = native_cpuid, .get_debugreg = native_get_debugreg, .set_debugreg = native_set_debugreg, .clts = native_clts, .read_cr0 = native_read_cr0, .write_cr0 = native_write_cr0, + .read_cr2 = native_read_cr2, + .write_cr2 = native_write_cr2, + .read_cr3 = native_read_cr3, + .write_cr3 = native_write_cr3, .read_cr4 = native_read_cr4, .read_cr4_safe = native_read_cr4_safe, .write_cr4 = native_write_cr4, + .save_fl = native_save_fl, + .restore_fl = native_restore_fl, + .irq_disable = native_irq_disable, + .irq_enable = native_irq_enable, + .safe_halt = native_safe_halt, + .halt = native_halt, .wbinvd = native_wbinvd, .read_msr = native_read_msr_safe, .write_msr = native_write_msr_safe, .read_tsc = native_read_tsc, .read_pmc = native_read_pmc, + .sched_clock = native_sched_clock, + .get_cpu_khz = native_calculate_cpu_khz, .load_tr_desc = native_load_tr_desc, .set_ldt = native_set_ldt, .load_gdt = native_load_gdt, @@ -384,19 +327,9 @@ struct pv_cpu_ops pv_cpu_ops = { .write_idt_entry = write_dt_entry, .load_esp0 = native_load_esp0, - .irq_enable_sysexit = native_irq_enable_sysexit, - .iret = native_iret, - .set_iopl_mask = native_set_iopl_mask, .io_delay = native_io_delay, - .lazy_mode = { - .enter = paravirt_nop, - .leave = paravirt_nop, - }, -}; - -struct pv_apic_ops pv_apic_ops = { #ifdef CONFIG_X86_LOCAL_APIC .apic_write = native_apic_write, .apic_write_atomic = native_apic_write_atomic, @@ -405,17 +338,11 @@ struct pv_apic_ops pv_apic_ops = { .setup_secondary_clock = setup_secondary_APIC_clock, .startup_ipi_hook = paravirt_nop, #endif -}; + .set_lazy_mode = paravirt_nop, -struct pv_mmu_ops pv_mmu_ops = { .pagetable_setup_start = native_pagetable_setup_start, .pagetable_setup_done = native_pagetable_setup_done, - .read_cr2 = native_read_cr2, - .write_cr2 = native_write_cr2, - .read_cr3 = native_read_cr3, - .write_cr3 = native_write_cr3, - .flush_tlb_user = native_flush_tlb, .flush_tlb_kernel = native_flush_tlb_global, .flush_tlb_single = native_flush_tlb_single, @@ -454,19 +381,12 @@ struct pv_mmu_ops pv_mmu_ops = { .make_pte = native_make_pte, .make_pgd = native_make_pgd, + .irq_enable_sysexit = native_irq_enable_sysexit, + .iret = native_iret, + .dup_mmap = paravirt_nop, .exit_mmap = paravirt_nop, .activate_mm = paravirt_nop, - - .lazy_mode = { - .enter = paravirt_nop, - .leave = paravirt_nop, - }, }; -EXPORT_SYMBOL_GPL(pv_time_ops); -EXPORT_SYMBOL_GPL(pv_cpu_ops); -EXPORT_SYMBOL_GPL(pv_mmu_ops); -EXPORT_SYMBOL_GPL(pv_apic_ops); -EXPORT_SYMBOL_GPL(pv_info); -EXPORT_SYMBOL (pv_irq_ops); +EXPORT_SYMBOL(paravirt_ops); diff --git a/trunk/arch/x86/kernel/pci-calgary_64.c b/trunk/arch/x86/kernel/pci-calgary_64.c index 5098f58063a5..a50b787b3bfa 100644 --- a/trunk/arch/x86/kernel/pci-calgary_64.c +++ b/trunk/arch/x86/kernel/pci-calgary_64.c @@ -222,10 +222,10 @@ static inline unsigned int num_dma_pages(unsigned long dma, unsigned int dmalen) return npages; } -static inline int translation_enabled(struct iommu_table *tbl) +static inline int translate_phb(struct pci_dev* dev) { - /* only PHBs with translation enabled have an IOMMU table */ - return (tbl != NULL); + int disabled = bus_info[dev->bus->number].translation_disabled; + return !disabled; } static void iommu_range_reserve(struct iommu_table *tbl, @@ -388,7 +388,7 @@ static void calgary_unmap_sg(struct device *dev, struct scatterlist *s; int i; - if (!translation_enabled(tbl)) + if (!translate_phb(to_pci_dev(dev))) return; for_each_sg(sglist, s, nelems, i) { @@ -428,7 +428,7 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg, unsigned long entry; int i; - if (!translation_enabled(tbl)) + if (!translate_phb(to_pci_dev(dev))) return calgary_nontranslate_map_sg(dev, sg, nelems, direction); for_each_sg(sg, s, nelems, i) { @@ -474,7 +474,7 @@ static dma_addr_t calgary_map_single(struct device *dev, void *vaddr, uaddr = (unsigned long)vaddr; npages = num_dma_pages(uaddr, size); - if (translation_enabled(tbl)) + if (translate_phb(to_pci_dev(dev))) dma_handle = iommu_alloc(tbl, vaddr, npages, direction); else dma_handle = virt_to_bus(vaddr); @@ -488,7 +488,7 @@ static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle, struct iommu_table *tbl = find_iommu_table(dev); unsigned int npages; - if (!translation_enabled(tbl)) + if (!translate_phb(to_pci_dev(dev))) return; npages = num_dma_pages(dma_handle, size); @@ -513,7 +513,7 @@ static void* calgary_alloc_coherent(struct device *dev, size_t size, goto error; memset(ret, 0, size); - if (translation_enabled(tbl)) { + if (translate_phb(to_pci_dev(dev))) { /* set up tces to cover the allocated range */ mapping = iommu_alloc(tbl, ret, npages, DMA_BIDIRECTIONAL); if (mapping == bad_dma_address) @@ -1194,7 +1194,7 @@ static int __init calgary_init(void) { int ret; struct pci_dev *dev = NULL; - struct calgary_bus_info *info; + void *tce_space; ret = calgary_locate_bbars(); if (ret) @@ -1206,14 +1206,12 @@ static int __init calgary_init(void) break; if (!is_cal_pci_dev(dev->device)) continue; - - info = &bus_info[dev->bus->number]; - if (info->translation_disabled) { + if (!translate_phb(dev)) { calgary_init_one_nontraslated(dev); continue; } - - if (!info->tce_space && !translate_empty_slots) + tce_space = bus_info[dev->bus->number].tce_space; + if (!tce_space && !translate_empty_slots) continue; ret = calgary_init_one(dev); @@ -1231,13 +1229,11 @@ static int __init calgary_init(void) break; if (!is_cal_pci_dev(dev->device)) continue; - - info = &bus_info[dev->bus->number]; - if (info->translation_disabled) { + if (!translate_phb(dev)) { pci_dev_put(dev); continue; } - if (!info->tce_space && !translate_empty_slots) + if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) continue; calgary_disable_translation(dev); @@ -1550,7 +1546,7 @@ static void __init calgary_fixup_one_tce_space(struct pci_dev *dev) static int __init calgary_fixup_tce_spaces(void) { struct pci_dev *dev = NULL; - struct calgary_bus_info *info; + void *tce_space; if (no_iommu || swiotlb || !calgary_detected) return -ENODEV; @@ -1563,12 +1559,11 @@ static int __init calgary_fixup_tce_spaces(void) break; if (!is_cal_pci_dev(dev->device)) continue; - - info = &bus_info[dev->bus->number]; - if (info->translation_disabled) + if (!translate_phb(dev)) continue; - if (!info->tce_space) + tce_space = bus_info[dev->bus->number].tce_space; + if (!tce_space) continue; calgary_fixup_one_tce_space(dev); diff --git a/trunk/arch/x86/kernel/pci-dma_32.c b/trunk/arch/x86/kernel/pci-dma_32.c index 51330321a5d3..0aae2f3847a5 100644 --- a/trunk/arch/x86/kernel/pci-dma_32.c +++ b/trunk/arch/x86/kernel/pci-dma_32.c @@ -12,6 +12,7 @@ #include #include #include +#include #include struct dma_coherent_mem { diff --git a/trunk/arch/x86/kernel/pci-dma_64.c b/trunk/arch/x86/kernel/pci-dma_64.c index b2b42bdb0a15..9576a2eb375e 100644 --- a/trunk/arch/x86/kernel/pci-dma_64.c +++ b/trunk/arch/x86/kernel/pci-dma_64.c @@ -51,9 +51,11 @@ dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order) { struct page *page; int node; - - node = dev_to_node(dev); - if (node == -1) +#ifdef CONFIG_PCI + if (dev->bus == &pci_bus_type) + node = pcibus_to_node(to_pci_dev(dev)->bus); + else +#endif node = numa_node_id(); if (node < first_node(node_online_map)) diff --git a/trunk/arch/x86/kernel/pci-gart_64.c b/trunk/arch/x86/kernel/pci-gart_64.c index 5cdfab65e93f..cfcc84e6c350 100644 --- a/trunk/arch/x86/kernel/pci-gart_64.c +++ b/trunk/arch/x86/kernel/pci-gart_64.c @@ -8,7 +8,6 @@ * See Documentation/DMA-mapping.txt for the interface specification. * * Copyright 2002 Andi Kleen, SuSE Labs. - * Subject to the GNU General Public License v2 only. */ #include @@ -376,8 +375,7 @@ static inline int dma_map_cont(struct scatterlist *start, int nelems, * DMA map all entries in a scatterlist. * Merge chunks that have page aligned sizes into a continuous mapping. */ -static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, - int dir) +int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) { int i; int out; diff --git a/trunk/arch/x86/kernel/ptrace_32.c b/trunk/arch/x86/kernel/ptrace_32.c index 99102ec5fade..8622b9cd3e38 100644 --- a/trunk/arch/x86/kernel/ptrace_32.c +++ b/trunk/arch/x86/kernel/ptrace_32.c @@ -165,7 +165,7 @@ static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_ seg &= ~7UL; - mutex_lock(&child->mm->context.lock); + down(&child->mm->context.sem); if (unlikely((seg >> 3) >= child->mm->context.size)) addr = -1L; /* bogus selector, access would fault */ else { @@ -179,7 +179,7 @@ static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_ addr &= 0xffff; addr += base; } - mutex_unlock(&child->mm->context.lock); + up(&child->mm->context.sem); } return addr; } diff --git a/trunk/arch/x86/kernel/ptrace_64.c b/trunk/arch/x86/kernel/ptrace_64.c index 607085f3f08a..86321ee6da93 100644 --- a/trunk/arch/x86/kernel/ptrace_64.c +++ b/trunk/arch/x86/kernel/ptrace_64.c @@ -103,7 +103,7 @@ unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *r seg &= ~7UL; - mutex_lock(&child->mm->context.lock); + down(&child->mm->context.sem); if (unlikely((seg >> 3) >= child->mm->context.size)) addr = -1L; /* bogus selector, access would fault */ else { @@ -117,7 +117,7 @@ unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *r addr &= 0xffff; addr += base; } - mutex_unlock(&child->mm->context.lock); + up(&child->mm->context.sem); } return addr; diff --git a/trunk/arch/x86/kernel/setup_64.c b/trunk/arch/x86/kernel/setup_64.c index 5a19f0cc5b67..8159bf0be17a 100644 --- a/trunk/arch/x86/kernel/setup_64.c +++ b/trunk/arch/x86/kernel/setup_64.c @@ -604,7 +604,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) level = cpuid_eax(1); if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); - if (c->x86 == 0x10 || c->x86 == 0x11) + if (c->x86 == 0x10) set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); /* Enable workaround for FXSAVE leak */ @@ -968,7 +968,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) * applications want to get the raw CPUID data, they should access * /dev/cpu//cpuid instead. */ - static const char *const x86_cap_flags[] = { + static char *x86_cap_flags[] = { /* Intel-defined */ "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", @@ -1022,7 +1022,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; - static const char *const x86_power_flags[] = { + static char *x86_power_flags[] = { "ts", /* temperature sensor */ "fid", /* frequency id control */ "vid", /* voltage id control */ diff --git a/trunk/arch/x86/kernel/signal_32.c b/trunk/arch/x86/kernel/signal_32.c index 0d79df3c5631..d01d51fcce2a 100644 --- a/trunk/arch/x86/kernel/signal_32.c +++ b/trunk/arch/x86/kernel/signal_32.c @@ -385,6 +385,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, regs->edx = (unsigned long) 0; regs->ecx = (unsigned long) 0; + set_fs(USER_DS); regs->xds = __USER_DS; regs->xes = __USER_DS; regs->xss = __USER_DS; @@ -478,6 +479,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, regs->edx = (unsigned long) &frame->info; regs->ecx = (unsigned long) &frame->uc; + set_fs(USER_DS); regs->xds = __USER_DS; regs->xes = __USER_DS; regs->xss = __USER_DS; diff --git a/trunk/arch/x86/kernel/smp_32.c b/trunk/arch/x86/kernel/smp_32.c index 791d9f8036ae..2d35d8502029 100644 --- a/trunk/arch/x86/kernel/smp_32.c +++ b/trunk/arch/x86/kernel/smp_32.c @@ -342,7 +342,6 @@ fastcall void smp_invalidate_interrupt(struct pt_regs *regs) smp_mb__after_clear_bit(); out: put_cpu_no_resched(); - __get_cpu_var(irq_stat).irq_tlb_count++; } void native_flush_tlb_others(const cpumask_t *cpumaskp, struct mm_struct *mm, @@ -641,7 +640,6 @@ static void native_smp_send_stop(void) fastcall void smp_reschedule_interrupt(struct pt_regs *regs) { ack_APIC_irq(); - __get_cpu_var(irq_stat).irq_resched_count++; } fastcall void smp_call_function_interrupt(struct pt_regs *regs) @@ -662,7 +660,6 @@ fastcall void smp_call_function_interrupt(struct pt_regs *regs) */ irq_enter(); (*func)(info); - __get_cpu_var(irq_stat).irq_call_count++; irq_exit(); if (wait) { @@ -708,10 +705,3 @@ struct smp_ops smp_ops = { .smp_send_reschedule = native_smp_send_reschedule, .smp_call_function_mask = native_smp_call_function_mask, }; - -int smp_call_function_mask(cpumask_t mask, void (*func) (void *info), - void *info, int wait) -{ - return smp_ops.smp_call_function_mask(mask, func, info, wait); -} -EXPORT_SYMBOL(smp_call_function_mask); diff --git a/trunk/arch/x86/kernel/smp_64.c b/trunk/arch/x86/kernel/smp_64.c index 5c2964727d19..df4a82812adb 100644 --- a/trunk/arch/x86/kernel/smp_64.c +++ b/trunk/arch/x86/kernel/smp_64.c @@ -163,7 +163,6 @@ asmlinkage void smp_invalidate_interrupt(struct pt_regs *regs) out: ack_APIC_irq(); cpu_clear(cpu, f->flush_cpumask); - add_pda(irq_tlb_count, 1); } static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, @@ -494,7 +493,6 @@ void smp_send_stop(void) asmlinkage void smp_reschedule_interrupt(void) { ack_APIC_irq(); - add_pda(irq_resched_count, 1); } asmlinkage void smp_call_function_interrupt(void) @@ -516,7 +514,6 @@ asmlinkage void smp_call_function_interrupt(void) exit_idle(); irq_enter(); (*func)(info); - add_pda(irq_call_count, 1); irq_exit(); if (wait) { mb(); diff --git a/trunk/arch/x86/kernel/smpboot_32.c b/trunk/arch/x86/kernel/smpboot_32.c index be3faac04719..31fc08bd15ef 100644 --- a/trunk/arch/x86/kernel/smpboot_32.c +++ b/trunk/arch/x86/kernel/smpboot_32.c @@ -102,8 +102,8 @@ u8 apicid_2_node[MAX_APICID]; * Trampoline 80x86 program as an array. */ -extern const unsigned char trampoline_data []; -extern const unsigned char trampoline_end []; +extern unsigned char trampoline_data []; +extern unsigned char trampoline_end []; static unsigned char *trampoline_base; static int trampoline_exec; @@ -118,7 +118,7 @@ DEFINE_PER_CPU(int, cpu_state) = { 0 }; * has made sure it's suitably aligned. */ -static unsigned long __cpuinit setup_trampoline(void) +static unsigned long __devinit setup_trampoline(void) { memcpy(trampoline_base, trampoline_data, trampoline_end - trampoline_data); return virt_to_phys(trampoline_base); @@ -1021,12 +1021,6 @@ static void __init smp_boot_cpus(unsigned int max_cpus) if (!max_cpus) { smp_found_config = 0; printk(KERN_INFO "SMP mode deactivated, forcing use of dummy APIC emulation.\n"); - - if (nmi_watchdog == NMI_LOCAL_APIC) { - printk(KERN_INFO "activating minimal APIC for NMI watchdog use.\n"); - connect_bsp_APIC(); - setup_local_APIC(); - } smpboot_clear_io_apic_irqs(); phys_cpu_present_map = physid_mask_of_physid(0); cpu_set(0, per_cpu(cpu_sibling_map, 0)); diff --git a/trunk/arch/x86/kernel/smpboot_64.c b/trunk/arch/x86/kernel/smpboot_64.c index e351ac4ab5b1..0faa0a0af272 100644 --- a/trunk/arch/x86/kernel/smpboot_64.c +++ b/trunk/arch/x86/kernel/smpboot_64.c @@ -102,8 +102,8 @@ EXPORT_PER_CPU_SYMBOL(cpu_core_map); * Trampoline 80x86 program as an array. */ -extern const unsigned char trampoline_data[]; -extern const unsigned char trampoline_end[]; +extern unsigned char trampoline_data[]; +extern unsigned char trampoline_end[]; /* State of each CPU */ DEFINE_PER_CPU(int, cpu_state) = { 0 }; @@ -695,6 +695,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) cpu_clear(cpu, cpu_present_map); cpu_clear(cpu, cpu_possible_map); x86_cpu_to_apicid[cpu] = BAD_APICID; + x86_cpu_to_log_apicid[cpu] = BAD_APICID; return -EIO; } diff --git a/trunk/arch/x86/kernel/stacktrace.c b/trunk/arch/x86/kernel/stacktrace.c index 6fa6cf036c70..413e527cdeb9 100644 --- a/trunk/arch/x86/kernel/stacktrace.c +++ b/trunk/arch/x86/kernel/stacktrace.c @@ -33,7 +33,7 @@ static void save_stack_address(void *data, unsigned long addr) trace->entries[trace->nr_entries++] = addr; } -static const struct stacktrace_ops save_stack_ops = { +static struct stacktrace_ops save_stack_ops = { .warning = save_stack_warning, .warning_symbol = save_stack_warning_symbol, .stack = save_stack_stack, diff --git a/trunk/arch/x86/kernel/tce_64.c b/trunk/arch/x86/kernel/tce_64.c index 9e540fee7009..e3f2569b2c44 100644 --- a/trunk/arch/x86/kernel/tce_64.c +++ b/trunk/arch/x86/kernel/tce_64.c @@ -40,9 +40,9 @@ static inline void flush_tce(void* tceaddr) { /* a single tce can't cross a cache line */ if (cpu_has_clflush) - clflush(tceaddr); + asm volatile("clflush (%0)" :: "r" (tceaddr)); else - wbinvd(); + asm volatile("wbinvd":::"memory"); } void tce_build(struct iommu_table *tbl, unsigned long index, diff --git a/trunk/arch/x86/kernel/topology.c b/trunk/arch/x86/kernel/topology.c index 8caa0b777466..c25f23eb397c 100644 --- a/trunk/arch/x86/kernel/topology.c +++ b/trunk/arch/x86/kernel/topology.c @@ -44,15 +44,15 @@ int arch_register_cpu(int num) * Also certain PCI quirks require not to enable hotplug control * for all CPU's. */ -#ifdef CONFIG_HOTPLUG_CPU - if (num) + if (num && enable_cpu_hotplug) cpu_devices[num].cpu.hotpluggable = 1; -#endif return register_cpu(&cpu_devices[num].cpu, num); } #ifdef CONFIG_HOTPLUG_CPU +int enable_cpu_hotplug = 1; + void arch_unregister_cpu(int num) { return unregister_cpu(&cpu_devices[num].cpu); } diff --git a/trunk/arch/x86/kernel/trampoline_32.S b/trunk/arch/x86/kernel/trampoline_32.S index 9bcc1c6aca3d..f62815f8d06a 100644 --- a/trunk/arch/x86/kernel/trampoline_32.S +++ b/trunk/arch/x86/kernel/trampoline_32.S @@ -36,11 +36,11 @@ #include #include +.data + /* We can free up trampoline after bootup if cpu hotplug is not supported. */ #ifndef CONFIG_HOTPLUG_CPU .section ".init.data","aw",@progbits -#else -.section .rodata,"a",@progbits #endif .code16 diff --git a/trunk/arch/x86/kernel/trampoline_64.S b/trunk/arch/x86/kernel/trampoline_64.S index e30b67c6a9f5..607983b0d27b 100644 --- a/trunk/arch/x86/kernel/trampoline_64.S +++ b/trunk/arch/x86/kernel/trampoline_64.S @@ -33,12 +33,7 @@ #include #include -/* We can free up trampoline after bootup if cpu hotplug is not supported. */ -#ifndef CONFIG_HOTPLUG_CPU -.section .init.data, "aw", @progbits -#else -.section .rodata, "a", @progbits -#endif +.data .code16 diff --git a/trunk/arch/x86/kernel/traps_32.c b/trunk/arch/x86/kernel/traps_32.c index b132d3957dfc..05c27ecaf2a7 100644 --- a/trunk/arch/x86/kernel/traps_32.c +++ b/trunk/arch/x86/kernel/traps_32.c @@ -112,7 +112,7 @@ struct stack_frame { static inline unsigned long print_context_stack(struct thread_info *tinfo, unsigned long *stack, unsigned long ebp, - const struct stacktrace_ops *ops, void *data) + struct stacktrace_ops *ops, void *data) { #ifdef CONFIG_FRAME_POINTER struct stack_frame *frame = (struct stack_frame *)ebp; @@ -149,7 +149,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo, void dump_trace(struct task_struct *task, struct pt_regs *regs, unsigned long *stack, - const struct stacktrace_ops *ops, void *data) + struct stacktrace_ops *ops, void *data) { unsigned long ebp = 0; @@ -221,7 +221,7 @@ static void print_trace_address(void *data, unsigned long addr) touch_nmi_watchdog(); } -static const struct stacktrace_ops print_trace_ops = { +static struct stacktrace_ops print_trace_ops = { .warning = print_trace_warning, .warning_symbol = print_trace_warning_symbol, .stack = print_trace_stack, @@ -398,24 +398,31 @@ void die(const char * str, struct pt_regs * regs, long err) local_save_flags(flags); if (++die.lock_owner_depth < 3) { + int nl = 0; unsigned long esp; unsigned short ss; report_bug(regs->eip, regs); - printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, - ++die_counter); + printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); #ifdef CONFIG_PREEMPT - printk("PREEMPT "); + printk(KERN_EMERG "PREEMPT "); + nl = 1; #endif #ifdef CONFIG_SMP + if (!nl) + printk(KERN_EMERG); printk("SMP "); + nl = 1; #endif #ifdef CONFIG_DEBUG_PAGEALLOC + if (!nl) + printk(KERN_EMERG); printk("DEBUG_PAGEALLOC"); + nl = 1; #endif - printk("\n"); - + if (nl) + printk("\n"); if (notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV) != NOTIFY_STOP) { @@ -1105,6 +1112,20 @@ asmlinkage void math_emulate(long arg) #endif /* CONFIG_MATH_EMULATION */ +#ifdef CONFIG_X86_F00F_BUG +void __init trap_init_f00f_bug(void) +{ + __set_fixmap(FIX_F00F_IDT, __pa(&idt_table), PAGE_KERNEL_RO); + + /* + * Update the IDT descriptor and reload the IDT so that + * it uses the read-only mapped virtual address. + */ + idt_descr.address = fix_to_virt(FIX_F00F_IDT); + load_idt(&idt_descr); +} +#endif + /* * This needs to use 'idt_table' rather than 'idt', and * thus use the _nonmapped_ version of the IDT, as the diff --git a/trunk/arch/x86/kernel/traps_64.c b/trunk/arch/x86/kernel/traps_64.c index b4a9b3db1994..bc7116acf8ff 100644 --- a/trunk/arch/x86/kernel/traps_64.c +++ b/trunk/arch/x86/kernel/traps_64.c @@ -215,7 +215,7 @@ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, - const struct stacktrace_ops *ops, void *data) + struct stacktrace_ops *ops, void *data) { const unsigned cpu = get_cpu(); unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; @@ -336,7 +336,7 @@ static void print_trace_address(void *data, unsigned long addr) printk_address(addr); } -static const struct stacktrace_ops print_trace_ops = { +static struct stacktrace_ops print_trace_ops = { .warning = print_trace_warning, .warning_symbol = print_trace_warning_symbol, .stack = print_trace_stack, diff --git a/trunk/arch/x86/kernel/tsc_32.c b/trunk/arch/x86/kernel/tsc_32.c index e87a3939ed40..b85ad754f70e 100644 --- a/trunk/arch/x86/kernel/tsc_32.c +++ b/trunk/arch/x86/kernel/tsc_32.c @@ -349,10 +349,10 @@ __cpuinit int unsynchronized_tsc(void) static void __init check_geode_tsc_reliable(void) { - unsigned long res_low, res_high; + unsigned long val; - rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high); - if (res_low & RTSC_SUSP) + rdmsrl(MSR_GEODE_BUSCONT_CONF0, val); + if ((val & RTSC_SUSP)) clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY; } #else diff --git a/trunk/arch/x86/kernel/vmi_32.c b/trunk/arch/x86/kernel/vmi_32.c index f02bad68abaa..18673e0f193b 100644 --- a/trunk/arch/x86/kernel/vmi_32.c +++ b/trunk/arch/x86/kernel/vmi_32.c @@ -134,21 +134,21 @@ static unsigned vmi_patch(u8 type, u16 clobbers, void *insns, unsigned long eip, unsigned len) { switch (type) { - case PARAVIRT_PATCH(pv_irq_ops.irq_disable): + case PARAVIRT_PATCH(irq_disable): return patch_internal(VMI_CALL_DisableInterrupts, len, insns, eip); - case PARAVIRT_PATCH(pv_irq_ops.irq_enable): + case PARAVIRT_PATCH(irq_enable): return patch_internal(VMI_CALL_EnableInterrupts, len, insns, eip); - case PARAVIRT_PATCH(pv_irq_ops.restore_fl): + case PARAVIRT_PATCH(restore_fl): return patch_internal(VMI_CALL_SetInterruptMask, len, insns, eip); - case PARAVIRT_PATCH(pv_irq_ops.save_fl): + case PARAVIRT_PATCH(save_fl): return patch_internal(VMI_CALL_GetInterruptMask, len, insns, eip); - case PARAVIRT_PATCH(pv_cpu_ops.iret): + case PARAVIRT_PATCH(iret): return patch_internal(VMI_CALL_IRET, len, insns, eip); - case PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit): + case PARAVIRT_PATCH(irq_enable_sysexit): return patch_internal(VMI_CALL_SYSEXIT, len, insns, eip); default: break; @@ -552,22 +552,24 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip, } #endif -static void vmi_enter_lazy_cpu(void) +static void vmi_set_lazy_mode(enum paravirt_lazy_mode mode) { - paravirt_enter_lazy_cpu(); - vmi_ops.set_lazy_mode(2); -} + static DEFINE_PER_CPU(enum paravirt_lazy_mode, lazy_mode); -static void vmi_enter_lazy_mmu(void) -{ - paravirt_enter_lazy_mmu(); - vmi_ops.set_lazy_mode(1); -} + if (!vmi_ops.set_lazy_mode) + return; -static void vmi_leave_lazy(void) -{ - paravirt_leave_lazy(paravirt_get_lazy_mode()); - vmi_ops.set_lazy_mode(0); + /* Modes should never nest or overlap */ + BUG_ON(__get_cpu_var(lazy_mode) && !(mode == PARAVIRT_LAZY_NONE || + mode == PARAVIRT_LAZY_FLUSH)); + + if (mode == PARAVIRT_LAZY_FLUSH) { + vmi_ops.set_lazy_mode(0); + vmi_ops.set_lazy_mode(__get_cpu_var(lazy_mode)); + } else { + vmi_ops.set_lazy_mode(mode); + __get_cpu_var(lazy_mode) = mode; + } } static inline int __init check_vmi_rom(struct vrom_header *rom) @@ -688,9 +690,9 @@ do { \ reloc = call_vrom_long_func(vmi_rom, get_reloc, \ VMI_CALL_##vmicall); \ if (rel->type == VMI_RELOCATION_CALL_REL) \ - opname = (void *)rel->eip; \ + paravirt_ops.opname = (void *)rel->eip; \ else if (rel->type == VMI_RELOCATION_NOP) \ - opname = (void *)vmi_nop; \ + paravirt_ops.opname = (void *)vmi_nop; \ else if (rel->type != VMI_RELOCATION_NONE) \ printk(KERN_WARNING "VMI: Unknown relocation " \ "type %d for " #vmicall"\n",\ @@ -710,7 +712,7 @@ do { \ VMI_CALL_##vmicall); \ BUG_ON(rel->type == VMI_RELOCATION_JUMP_REL); \ if (rel->type == VMI_RELOCATION_CALL_REL) { \ - opname = wrapper; \ + paravirt_ops.opname = wrapper; \ vmi_ops.cache = (void *)rel->eip; \ } \ } while (0) @@ -730,11 +732,11 @@ static inline int __init activate_vmi(void) } savesegment(cs, kernel_cs); - pv_info.paravirt_enabled = 1; - pv_info.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK; - pv_info.name = "vmi"; + paravirt_ops.paravirt_enabled = 1; + paravirt_ops.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK; - pv_init_ops.patch = vmi_patch; + paravirt_ops.patch = vmi_patch; + paravirt_ops.name = "vmi"; /* * Many of these operations are ABI compatible with VMI. @@ -752,26 +754,26 @@ static inline int __init activate_vmi(void) */ /* CPUID is special, so very special it gets wrapped like a present */ - para_wrap(pv_cpu_ops.cpuid, vmi_cpuid, cpuid, CPUID); - - para_fill(pv_cpu_ops.clts, CLTS); - para_fill(pv_cpu_ops.get_debugreg, GetDR); - para_fill(pv_cpu_ops.set_debugreg, SetDR); - para_fill(pv_cpu_ops.read_cr0, GetCR0); - para_fill(pv_mmu_ops.read_cr2, GetCR2); - para_fill(pv_mmu_ops.read_cr3, GetCR3); - para_fill(pv_cpu_ops.read_cr4, GetCR4); - para_fill(pv_cpu_ops.write_cr0, SetCR0); - para_fill(pv_mmu_ops.write_cr2, SetCR2); - para_fill(pv_mmu_ops.write_cr3, SetCR3); - para_fill(pv_cpu_ops.write_cr4, SetCR4); - para_fill(pv_irq_ops.save_fl, GetInterruptMask); - para_fill(pv_irq_ops.restore_fl, SetInterruptMask); - para_fill(pv_irq_ops.irq_disable, DisableInterrupts); - para_fill(pv_irq_ops.irq_enable, EnableInterrupts); - - para_fill(pv_cpu_ops.wbinvd, WBINVD); - para_fill(pv_cpu_ops.read_tsc, RDTSC); + para_wrap(cpuid, vmi_cpuid, cpuid, CPUID); + + para_fill(clts, CLTS); + para_fill(get_debugreg, GetDR); + para_fill(set_debugreg, SetDR); + para_fill(read_cr0, GetCR0); + para_fill(read_cr2, GetCR2); + para_fill(read_cr3, GetCR3); + para_fill(read_cr4, GetCR4); + para_fill(write_cr0, SetCR0); + para_fill(write_cr2, SetCR2); + para_fill(write_cr3, SetCR3); + para_fill(write_cr4, SetCR4); + para_fill(save_fl, GetInterruptMask); + para_fill(restore_fl, SetInterruptMask); + para_fill(irq_disable, DisableInterrupts); + para_fill(irq_enable, EnableInterrupts); + + para_fill(wbinvd, WBINVD); + para_fill(read_tsc, RDTSC); /* The following we emulate with trap and emulate for now */ /* paravirt_ops.read_msr = vmi_rdmsr */ @@ -779,38 +781,29 @@ static inline int __init activate_vmi(void) /* paravirt_ops.rdpmc = vmi_rdpmc */ /* TR interface doesn't pass TR value, wrap */ - para_wrap(pv_cpu_ops.load_tr_desc, vmi_set_tr, set_tr, SetTR); + para_wrap(load_tr_desc, vmi_set_tr, set_tr, SetTR); /* LDT is special, too */ - para_wrap(pv_cpu_ops.set_ldt, vmi_set_ldt, _set_ldt, SetLDT); - - para_fill(pv_cpu_ops.load_gdt, SetGDT); - para_fill(pv_cpu_ops.load_idt, SetIDT); - para_fill(pv_cpu_ops.store_gdt, GetGDT); - para_fill(pv_cpu_ops.store_idt, GetIDT); - para_fill(pv_cpu_ops.store_tr, GetTR); - pv_cpu_ops.load_tls = vmi_load_tls; - para_fill(pv_cpu_ops.write_ldt_entry, WriteLDTEntry); - para_fill(pv_cpu_ops.write_gdt_entry, WriteGDTEntry); - para_fill(pv_cpu_ops.write_idt_entry, WriteIDTEntry); - para_wrap(pv_cpu_ops.load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); - para_fill(pv_cpu_ops.set_iopl_mask, SetIOPLMask); - para_fill(pv_cpu_ops.io_delay, IODelay); - - para_wrap(pv_cpu_ops.lazy_mode.enter, vmi_enter_lazy_cpu, - set_lazy_mode, SetLazyMode); - para_wrap(pv_cpu_ops.lazy_mode.leave, vmi_leave_lazy, - set_lazy_mode, SetLazyMode); - - para_wrap(pv_mmu_ops.lazy_mode.enter, vmi_enter_lazy_mmu, - set_lazy_mode, SetLazyMode); - para_wrap(pv_mmu_ops.lazy_mode.leave, vmi_leave_lazy, - set_lazy_mode, SetLazyMode); + para_wrap(set_ldt, vmi_set_ldt, _set_ldt, SetLDT); + + para_fill(load_gdt, SetGDT); + para_fill(load_idt, SetIDT); + para_fill(store_gdt, GetGDT); + para_fill(store_idt, GetIDT); + para_fill(store_tr, GetTR); + paravirt_ops.load_tls = vmi_load_tls; + para_fill(write_ldt_entry, WriteLDTEntry); + para_fill(write_gdt_entry, WriteGDTEntry); + para_fill(write_idt_entry, WriteIDTEntry); + para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); + para_fill(set_iopl_mask, SetIOPLMask); + para_fill(io_delay, IODelay); + para_wrap(set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode); /* user and kernel flush are just handled with different flags to FlushTLB */ - para_wrap(pv_mmu_ops.flush_tlb_user, vmi_flush_tlb_user, _flush_tlb, FlushTLB); - para_wrap(pv_mmu_ops.flush_tlb_kernel, vmi_flush_tlb_kernel, _flush_tlb, FlushTLB); - para_fill(pv_mmu_ops.flush_tlb_single, InvalPage); + para_wrap(flush_tlb_user, vmi_flush_tlb_user, _flush_tlb, FlushTLB); + para_wrap(flush_tlb_kernel, vmi_flush_tlb_kernel, _flush_tlb, FlushTLB); + para_fill(flush_tlb_single, InvalPage); /* * Until a standard flag format can be agreed on, we need to @@ -826,41 +819,41 @@ static inline int __init activate_vmi(void) #endif if (vmi_ops.set_pte) { - pv_mmu_ops.set_pte = vmi_set_pte; - pv_mmu_ops.set_pte_at = vmi_set_pte_at; - pv_mmu_ops.set_pmd = vmi_set_pmd; + paravirt_ops.set_pte = vmi_set_pte; + paravirt_ops.set_pte_at = vmi_set_pte_at; + paravirt_ops.set_pmd = vmi_set_pmd; #ifdef CONFIG_X86_PAE - pv_mmu_ops.set_pte_atomic = vmi_set_pte_atomic; - pv_mmu_ops.set_pte_present = vmi_set_pte_present; - pv_mmu_ops.set_pud = vmi_set_pud; - pv_mmu_ops.pte_clear = vmi_pte_clear; - pv_mmu_ops.pmd_clear = vmi_pmd_clear; + paravirt_ops.set_pte_atomic = vmi_set_pte_atomic; + paravirt_ops.set_pte_present = vmi_set_pte_present; + paravirt_ops.set_pud = vmi_set_pud; + paravirt_ops.pte_clear = vmi_pte_clear; + paravirt_ops.pmd_clear = vmi_pmd_clear; #endif } if (vmi_ops.update_pte) { - pv_mmu_ops.pte_update = vmi_update_pte; - pv_mmu_ops.pte_update_defer = vmi_update_pte_defer; + paravirt_ops.pte_update = vmi_update_pte; + paravirt_ops.pte_update_defer = vmi_update_pte_defer; } vmi_ops.allocate_page = vmi_get_function(VMI_CALL_AllocatePage); if (vmi_ops.allocate_page) { - pv_mmu_ops.alloc_pt = vmi_allocate_pt; - pv_mmu_ops.alloc_pd = vmi_allocate_pd; - pv_mmu_ops.alloc_pd_clone = vmi_allocate_pd_clone; + paravirt_ops.alloc_pt = vmi_allocate_pt; + paravirt_ops.alloc_pd = vmi_allocate_pd; + paravirt_ops.alloc_pd_clone = vmi_allocate_pd_clone; } vmi_ops.release_page = vmi_get_function(VMI_CALL_ReleasePage); if (vmi_ops.release_page) { - pv_mmu_ops.release_pt = vmi_release_pt; - pv_mmu_ops.release_pd = vmi_release_pd; + paravirt_ops.release_pt = vmi_release_pt; + paravirt_ops.release_pd = vmi_release_pd; } /* Set linear is needed in all cases */ vmi_ops.set_linear_mapping = vmi_get_function(VMI_CALL_SetLinearMapping); #ifdef CONFIG_HIGHPTE if (vmi_ops.set_linear_mapping) - pv_mmu_ops.kmap_atomic_pte = vmi_kmap_atomic_pte; + paravirt_ops.kmap_atomic_pte = vmi_kmap_atomic_pte; #endif /* @@ -870,17 +863,17 @@ static inline int __init activate_vmi(void) * the backend. They are performance critical anyway, so requiring * a patch is not a big problem. */ - pv_cpu_ops.irq_enable_sysexit = (void *)0xfeedbab0; - pv_cpu_ops.iret = (void *)0xbadbab0; + paravirt_ops.irq_enable_sysexit = (void *)0xfeedbab0; + paravirt_ops.iret = (void *)0xbadbab0; #ifdef CONFIG_SMP - para_wrap(pv_apic_ops.startup_ipi_hook, vmi_startup_ipi_hook, set_initial_ap_state, SetInitialAPState); + para_wrap(startup_ipi_hook, vmi_startup_ipi_hook, set_initial_ap_state, SetInitialAPState); #endif #ifdef CONFIG_X86_LOCAL_APIC - para_fill(pv_apic_ops.apic_read, APICRead); - para_fill(pv_apic_ops.apic_write, APICWrite); - para_fill(pv_apic_ops.apic_write_atomic, APICWrite); + para_fill(apic_read, APICRead); + para_fill(apic_write, APICWrite); + para_fill(apic_write_atomic, APICWrite); #endif /* @@ -898,15 +891,15 @@ static inline int __init activate_vmi(void) vmi_timer_ops.set_alarm = vmi_get_function(VMI_CALL_SetAlarm); vmi_timer_ops.cancel_alarm = vmi_get_function(VMI_CALL_CancelAlarm); - pv_time_ops.time_init = vmi_time_init; - pv_time_ops.get_wallclock = vmi_get_wallclock; - pv_time_ops.set_wallclock = vmi_set_wallclock; + paravirt_ops.time_init = vmi_time_init; + paravirt_ops.get_wallclock = vmi_get_wallclock; + paravirt_ops.set_wallclock = vmi_set_wallclock; #ifdef CONFIG_X86_LOCAL_APIC - pv_apic_ops.setup_boot_clock = vmi_time_bsp_init; - pv_apic_ops.setup_secondary_clock = vmi_time_ap_init; + paravirt_ops.setup_boot_clock = vmi_time_bsp_init; + paravirt_ops.setup_secondary_clock = vmi_time_ap_init; #endif - pv_time_ops.sched_clock = vmi_sched_clock; - pv_time_ops.get_cpu_khz = vmi_cpu_khz; + paravirt_ops.sched_clock = vmi_sched_clock; + paravirt_ops.get_cpu_khz = vmi_cpu_khz; /* We have true wallclock functions; disable CMOS clock sync */ no_sync_cmos_clock = 1; @@ -915,7 +908,7 @@ static inline int __init activate_vmi(void) disable_vmi_timer = 1; } - para_fill(pv_irq_ops.safe_halt, Halt); + para_fill(safe_halt, Halt); /* * Alternative instruction rewriting doesn't happen soon enough diff --git a/trunk/arch/x86/kernel/vsyscall_64.c b/trunk/arch/x86/kernel/vsyscall_64.c index 8a67e282cb5e..93847d848157 100644 --- a/trunk/arch/x86/kernel/vsyscall_64.c +++ b/trunk/arch/x86/kernel/vsyscall_64.c @@ -78,6 +78,7 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; vsyscall_gtod_data.sys_tz = sys_tz; + vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); } @@ -288,7 +289,7 @@ static void __cpuinit vsyscall_set_cpu(int cpu) unsigned long *d; unsigned long node = 0; #ifdef CONFIG_NUMA - node = cpu_to_node(cpu); + node = cpu_to_node[cpu]; #endif if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) write_rdtscp_aux((node << 12) | cpu); diff --git a/trunk/arch/x86/lib/bitstr_64.c b/trunk/arch/x86/lib/bitstr_64.c index 7445caf1b5de..24676609a6ac 100644 --- a/trunk/arch/x86/lib/bitstr_64.c +++ b/trunk/arch/x86/lib/bitstr_64.c @@ -14,7 +14,7 @@ find_next_zero_string(unsigned long *bitmap, long start, long nbits, int len) /* could test bitsliced, but it's hardly worth it */ end = n+len; - if (end > nbits) + if (end >= nbits) return -1; for (i = n+1; i < end; i++) { if (test_bit(i, bitmap)) { diff --git a/trunk/arch/x86/lib/msr-on-cpu.c b/trunk/arch/x86/lib/msr-on-cpu.c index 57d043fa893e..7767962f25d3 100644 --- a/trunk/arch/x86/lib/msr-on-cpu.c +++ b/trunk/arch/x86/lib/msr-on-cpu.c @@ -26,18 +26,27 @@ static void __rdmsr_safe_on_cpu(void *info) static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) { int err = 0; - struct msr_info rv; - - rv.msr_no = msr_no; - if (safe) { - smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 0, 1); - err = rv.err; - } else { - smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1); + preempt_disable(); + if (smp_processor_id() == cpu) + if (safe) + err = rdmsr_safe(msr_no, l, h); + else + rdmsr(msr_no, *l, *h); + else { + struct msr_info rv; + + rv.msr_no = msr_no; + if (safe) { + smp_call_function_single(cpu, __rdmsr_safe_on_cpu, + &rv, 0, 1); + err = rv.err; + } else { + smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1); + } + *l = rv.l; + *h = rv.h; } - *l = rv.l; - *h = rv.h; - + preempt_enable(); return err; } @@ -58,18 +67,27 @@ static void __wrmsr_safe_on_cpu(void *info) static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) { int err = 0; - struct msr_info rv; - - rv.msr_no = msr_no; - rv.l = l; - rv.h = h; - if (safe) { - smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 0, 1); - err = rv.err; - } else { - smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1); + preempt_disable(); + if (smp_processor_id() == cpu) + if (safe) + err = wrmsr_safe(msr_no, l, h); + else + wrmsr(msr_no, l, h); + else { + struct msr_info rv; + + rv.msr_no = msr_no; + rv.l = l; + rv.h = h; + if (safe) { + smp_call_function_single(cpu, __wrmsr_safe_on_cpu, + &rv, 0, 1); + err = rv.err; + } else { + smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1); + } } - + preempt_enable(); return err; } diff --git a/trunk/arch/x86/lib/rwlock_64.S b/trunk/arch/x86/lib/rwlock_64.S index 05ea55f71405..0cde1f807314 100644 --- a/trunk/arch/x86/lib/rwlock_64.S +++ b/trunk/arch/x86/lib/rwlock_64.S @@ -2,7 +2,7 @@ #include #include -#include +#include #include /* rdi: pointer to rwlock_t */ diff --git a/trunk/arch/x86/lib/semaphore_32.S b/trunk/arch/x86/lib/semaphore_32.S index 444fba400983..c01eb39c0b43 100644 --- a/trunk/arch/x86/lib/semaphore_32.S +++ b/trunk/arch/x86/lib/semaphore_32.S @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include #include /* diff --git a/trunk/arch/x86/lib/string_32.c b/trunk/arch/x86/lib/string_32.c index c2c0504a3071..2c773fefa3dd 100644 --- a/trunk/arch/x86/lib/string_32.c +++ b/trunk/arch/x86/lib/string_32.c @@ -160,6 +160,26 @@ char *strchr(const char * s, int c) EXPORT_SYMBOL(strchr); #endif +#ifdef __HAVE_ARCH_STRRCHR +char *strrchr(const char * s, int c) +{ + int d0, d1; + char * res; + asm volatile( "movb %%al,%%ah\n" + "1:\tlodsb\n\t" + "cmpb %%ah,%%al\n\t" + "jne 2f\n\t" + "leal -1(%%esi),%0\n" + "2:\ttestb %%al,%%al\n\t" + "jne 1b" + :"=g" (res), "=&S" (d0), "=&a" (d1) + :"0" (0),"1" (s),"2" (c) + :"memory"); + return res; +} +EXPORT_SYMBOL(strrchr); +#endif + #ifdef __HAVE_ARCH_STRLEN size_t strlen(const char * s) { diff --git a/trunk/arch/x86/mach-default/setup.c b/trunk/arch/x86/mach-default/setup.c index 3f08010f3517..1bd82983986d 100644 --- a/trunk/arch/x86/mach-default/setup.c +++ b/trunk/arch/x86/mach-default/setup.c @@ -35,11 +35,7 @@ void __init pre_intr_init_hook(void) /* * IRQ2 is cascade interrupt to second interrupt controller */ -static struct irqaction irq2 = { - .handler = no_action, - .mask = CPU_MASK_NONE, - .name = "cascade", -}; +static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; /** * intr_init_hook - post gate setup interrupt initialisation diff --git a/trunk/arch/x86/mach-es7000/es7000plat.c b/trunk/arch/x86/mach-es7000/es7000plat.c index f5d6f7d8b86e..ab99072d3f9a 100644 --- a/trunk/arch/x86/mach-es7000/es7000plat.c +++ b/trunk/arch/x86/mach-es7000/es7000plat.c @@ -46,11 +46,11 @@ * ES7000 Globals */ -static volatile unsigned long *psai = NULL; -static struct mip_reg *mip_reg; -static struct mip_reg *host_reg; -static int mip_port; -static unsigned long mip_addr, host_addr; +volatile unsigned long *psai = NULL; +struct mip_reg *mip_reg; +struct mip_reg *host_reg; +int mip_port; +unsigned long mip_addr, host_addr; /* * GSI override for ES7000 platforms. @@ -288,8 +288,28 @@ es7000_start_cpu(int cpu, unsigned long eip) } +int +es7000_stop_cpu(int cpu) +{ + int startup; + + if (psai == NULL) + return -1; + + startup= (0x1000000 | cpu); + + while ((*psai & 0xff00ffff) != startup) + ; + + startup = (*psai & 0xff0000) >> 16; + *psai &= 0xffffff; + + return 0; + +} + void __init -es7000_sw_apic(void) +es7000_sw_apic() { if (es7000_plat) { int mip_status; diff --git a/trunk/arch/x86/mach-generic/probe.c b/trunk/arch/x86/mach-generic/probe.c index 4121d1551800..74f3da634423 100644 --- a/trunk/arch/x86/mach-generic/probe.c +++ b/trunk/arch/x86/mach-generic/probe.c @@ -22,7 +22,7 @@ extern struct genapic apic_default; struct genapic *genapic = &apic_default; -static struct genapic *apic_probe[] __initdata = { +struct genapic *apic_probe[] __initdata = { &apic_summit, &apic_bigsmp, &apic_es7000, diff --git a/trunk/arch/x86/mach-voyager/setup.c b/trunk/arch/x86/mach-voyager/setup.c index 3bef977cb29b..a0ab4002abcd 100644 --- a/trunk/arch/x86/mach-voyager/setup.c +++ b/trunk/arch/x86/mach-voyager/setup.c @@ -18,11 +18,7 @@ void __init pre_intr_init_hook(void) /* * IRQ2 is cascade interrupt to second interrupt controller */ -static struct irqaction irq2 = { - .handler = no_action, - .mask = CPU_MASK_NONE, - .name = "cascade", -}; +static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; void __init intr_init_hook(void) { diff --git a/trunk/arch/x86/mach-voyager/voyager_smp.c b/trunk/arch/x86/mach-voyager/voyager_smp.c index e4928aa6bdfb..b87f8548e75a 100644 --- a/trunk/arch/x86/mach-voyager/voyager_smp.c +++ b/trunk/arch/x86/mach-voyager/voyager_smp.c @@ -442,8 +442,8 @@ static __u32 __init setup_trampoline(void) { /* these two are global symbols in trampoline.S */ - extern const __u8 trampoline_end[]; - extern const __u8 trampoline_data[]; + extern __u8 trampoline_end[]; + extern __u8 trampoline_data[]; memcpy((__u8 *)trampoline_base, trampoline_data, trampoline_end - trampoline_data); @@ -1037,7 +1037,6 @@ smp_call_function_interrupt(void) */ irq_enter(); (*func)(info); - __get_cpu_var(irq_stat).irq_call_count++; irq_exit(); if (wait) { mb(); diff --git a/trunk/arch/x86/mm/discontig_32.c b/trunk/arch/x86/mm/discontig_32.c index 13893772cc48..b1e45457d4ef 100644 --- a/trunk/arch/x86/mm/discontig_32.c +++ b/trunk/arch/x86/mm/discontig_32.c @@ -103,14 +103,14 @@ extern unsigned long highend_pfn, highstart_pfn; #define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE) -static unsigned long node_remap_start_pfn[MAX_NUMNODES]; +unsigned long node_remap_start_pfn[MAX_NUMNODES]; unsigned long node_remap_size[MAX_NUMNODES]; -static unsigned long node_remap_offset[MAX_NUMNODES]; -static void *node_remap_start_vaddr[MAX_NUMNODES]; +unsigned long node_remap_offset[MAX_NUMNODES]; +void *node_remap_start_vaddr[MAX_NUMNODES]; void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags); -static void *node_remap_end_vaddr[MAX_NUMNODES]; -static void *node_remap_alloc_vaddr[MAX_NUMNODES]; +void *node_remap_end_vaddr[MAX_NUMNODES]; +void *node_remap_alloc_vaddr[MAX_NUMNODES]; static unsigned long kva_start_pfn; static unsigned long kva_pages; /* diff --git a/trunk/arch/x86/mm/fault_32.c b/trunk/arch/x86/mm/fault_32.c index 6555c3d14371..c686ae20fd6b 100644 --- a/trunk/arch/x86/mm/fault_32.c +++ b/trunk/arch/x86/mm/fault_32.c @@ -105,7 +105,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs, LDT and other horrors are only used in user space. */ if (seg & (1<<2)) { /* Must lock the LDT while reading it. */ - mutex_lock(¤t->mm->context.lock); + down(¤t->mm->context.sem); desc = current->mm->context.ldt; desc = (void *)desc + (seg & ~7); } else { @@ -118,7 +118,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs, base = get_desc_base((unsigned long *)desc); if (seg & (1<<2)) { - mutex_unlock(¤t->mm->context.lock); + up(¤t->mm->context.sem); } else put_cpu(); @@ -539,22 +539,23 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, printk(KERN_ALERT "BUG: unable to handle kernel paging" " request"); printk(" at virtual address %08lx\n",address); - printk(KERN_ALERT "printing eip: %08lx ", regs->eip); + printk(KERN_ALERT " printing eip:\n"); + printk("%08lx\n", regs->eip); page = read_cr3(); page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT]; #ifdef CONFIG_X86_PAE - printk("*pdpt = %016Lx ", page); + printk(KERN_ALERT "*pdpt = %016Lx\n", page); if ((page >> PAGE_SHIFT) < max_low_pfn && page & _PAGE_PRESENT) { page &= PAGE_MASK; page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT) & (PTRS_PER_PMD - 1)]; - printk(KERN_ALERT "*pde = %016Lx ", page); + printk(KERN_ALERT "*pde = %016Lx\n", page); page &= ~_PAGE_NX; } #else - printk("*pde = %08lx ", page); + printk(KERN_ALERT "*pde = %08lx\n", page); #endif /* @@ -568,10 +569,8 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs, page &= PAGE_MASK; page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)]; - printk("*pte = %0*Lx ", sizeof(page)*2, (u64)page); + printk(KERN_ALERT "*pte = %0*Lx\n", sizeof(page)*2, (u64)page); } - - printk("\n"); } tsk->thread.cr2 = address; diff --git a/trunk/arch/x86/mm/init_32.c b/trunk/arch/x86/mm/init_32.c index c7d19471261d..dda4e83649a0 100644 --- a/trunk/arch/x86/mm/init_32.c +++ b/trunk/arch/x86/mm/init_32.c @@ -85,20 +85,13 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd) static pte_t * __init one_page_table_init(pmd_t *pmd) { if (!(pmd_val(*pmd) & _PAGE_PRESENT)) { - pte_t *page_table = NULL; - -#ifdef CONFIG_DEBUG_PAGEALLOC - page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); -#endif - if (!page_table) - page_table = - (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); + pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); paravirt_alloc_pt(&init_mm, __pa(page_table) >> PAGE_SHIFT); set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); BUG_ON(page_table != pte_offset_kernel(pmd, 0)); } - + return pte_offset_kernel(pmd, 0); } @@ -748,12 +741,24 @@ struct kmem_cache *pmd_cache; void __init pgtable_cache_init(void) { - if (PTRS_PER_PMD > 1) + size_t pgd_size = PTRS_PER_PGD*sizeof(pgd_t); + + if (PTRS_PER_PMD > 1) { pmd_cache = kmem_cache_create("pmd", - PTRS_PER_PMD*sizeof(pmd_t), - PTRS_PER_PMD*sizeof(pmd_t), - SLAB_PANIC, - pmd_ctor); + PTRS_PER_PMD*sizeof(pmd_t), + PTRS_PER_PMD*sizeof(pmd_t), + SLAB_PANIC, + pmd_ctor); + if (!SHARED_KERNEL_PMD) { + /* If we're in PAE mode and have a non-shared + kernel pmd, then the pgd size must be a + page size. This is because the pgd_list + links through the page structure, so there + can only be one pgd per page for this to + work. */ + pgd_size = PAGE_SIZE; + } + } } /* diff --git a/trunk/arch/x86/mm/numa_64.c b/trunk/arch/x86/mm/numa_64.c index 5eec5e56d07f..6da235522269 100644 --- a/trunk/arch/x86/mm/numa_64.c +++ b/trunk/arch/x86/mm/numa_64.c @@ -166,7 +166,7 @@ early_node_mem(int nodeid, unsigned long start, unsigned long end, return __va(mem); ptr = __alloc_bootmem_nopanic(size, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)); - if (ptr == NULL) { + if (ptr == 0) { printk(KERN_ERR "Cannot find %lu bytes in node %d\n", size, nodeid); return NULL; @@ -261,7 +261,7 @@ void __init numa_init_array(void) We round robin the existing nodes. */ rr = first_node(node_online_map); for (i = 0; i < NR_CPUS; i++) { - if (cpu_to_node(i) != NUMA_NO_NODE) + if (cpu_to_node[i] != NUMA_NO_NODE) continue; numa_set_node(i, rr); rr = next_node(rr, node_online_map); @@ -543,7 +543,7 @@ __cpuinit void numa_add_cpu(int cpu) void __cpuinit numa_set_node(int cpu, int node) { cpu_pda(cpu)->nodenumber = node; - cpu_to_node(cpu) = node; + cpu_to_node[cpu] = node; } unsigned long __init numa_free_all_bootmem(void) diff --git a/trunk/arch/x86/mm/pageattr_32.c b/trunk/arch/x86/mm/pageattr_32.c index 260073c07600..4241a74d16c8 100644 --- a/trunk/arch/x86/mm/pageattr_32.c +++ b/trunk/arch/x86/mm/pageattr_32.c @@ -70,10 +70,10 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot, static void cache_flush_page(struct page *p) { - void *adr = page_address(p); + unsigned long adr = (unsigned long)page_address(p); int i; for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) - clflush(adr+i); + asm volatile("clflush (%0)" :: "r" (adr + i)); } static void flush_kernel_map(void *arg) diff --git a/trunk/arch/x86/mm/pageattr_64.c b/trunk/arch/x86/mm/pageattr_64.c index 8a4f65bf956e..10b9809ce821 100644 --- a/trunk/arch/x86/mm/pageattr_64.c +++ b/trunk/arch/x86/mm/pageattr_64.c @@ -65,7 +65,7 @@ static void cache_flush_page(void *adr) { int i; for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size) - clflush(adr+i); + asm volatile("clflush (%0)" :: "r" (adr + i)); } static void flush_kernel_map(void *arg) @@ -148,7 +148,6 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, split = split_large_page(address, prot, ref_prot2); if (!split) return -ENOMEM; - pgprot_val(ref_prot2) &= ~_PAGE_NX; set_pte(kpte, mk_pte(split, ref_prot2)); kpte_page = split; } diff --git a/trunk/arch/x86/mm/pgtable_32.c b/trunk/arch/x86/mm/pgtable_32.c index be61a1d845a4..ef1f6cd3ea66 100644 --- a/trunk/arch/x86/mm/pgtable_32.c +++ b/trunk/arch/x86/mm/pgtable_32.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -40,8 +39,6 @@ void show_mem(void) for_each_online_pgdat(pgdat) { pgdat_resize_lock(pgdat, &flags); for (i = 0; i < pgdat->node_spanned_pages; ++i) { - if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) - touch_nmi_watchdog(); page = pgdat_page_nr(pgdat, i); total++; if (PageHighMem(page)) @@ -100,7 +97,8 @@ static void set_pte_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) } pte = pte_offset_kernel(pmd, vaddr); if (pgprot_val(flags)) - set_pte_present(&init_mm, vaddr, pte, pfn_pte(pfn, flags)); + /* stored as-is, to permit clearing entries */ + set_pte(pte, pfn_pte(pfn, flags)); else pte_clear(&init_mm, vaddr, pte); diff --git a/trunk/arch/x86/mm/srat_64.c b/trunk/arch/x86/mm/srat_64.c index 56089ccc3949..acdf03e19146 100644 --- a/trunk/arch/x86/mm/srat_64.c +++ b/trunk/arch/x86/mm/srat_64.c @@ -431,9 +431,9 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) setup_node_bootmem(i, nodes[i].start, nodes[i].end); for (i = 0; i < NR_CPUS; i++) { - if (cpu_to_node(i) == NUMA_NO_NODE) + if (cpu_to_node[i] == NUMA_NO_NODE) continue; - if (!node_isset(cpu_to_node(i), node_possible_map)) + if (!node_isset(cpu_to_node[i], node_possible_map)) numa_set_node(i, NUMA_NO_NODE); } numa_init_array(); diff --git a/trunk/arch/x86/oprofile/nmi_int.c b/trunk/arch/x86/oprofile/nmi_int.c index 2d0eeac7251f..11b7a51566a8 100644 --- a/trunk/arch/x86/oprofile/nmi_int.c +++ b/trunk/arch/x86/oprofile/nmi_int.c @@ -269,6 +269,7 @@ static void nmi_cpu_shutdown(void * dummy) apic_write(APIC_LVTPC, saved_lvtpc[cpu]); apic_write(APIC_LVTERR, v); nmi_restore_registers(msrs); + model->shutdown(msrs); } @@ -277,7 +278,6 @@ static void nmi_shutdown(void) nmi_enabled = 0; on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1); unregister_die_notifier(&profile_exceptions_nb); - model->shutdown(cpu_msrs); free_msrs(); } diff --git a/trunk/arch/x86/pci/common.c b/trunk/arch/x86/pci/common.c index f4386990b150..2d71bbc411d2 100644 --- a/trunk/arch/x86/pci/common.c +++ b/trunk/arch/x86/pci/common.c @@ -289,22 +289,6 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c G1"), }, }, - { - .callback = set_bf_sort, - .ident = "HP ProLiant DL385 G2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "HP"), - DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"), - }, - }, - { - .callback = set_bf_sort, - .ident = "HP ProLiant DL585 G2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "HP"), - DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"), - }, - }, #ifdef __i386__ { .callback = assign_all_busses, diff --git a/trunk/arch/x86/vdso/Makefile b/trunk/arch/x86/vdso/Makefile index 7a2ba4583939..dcd6bb9e0bb3 100644 --- a/trunk/arch/x86/vdso/Makefile +++ b/trunk/arch/x86/vdso/Makefile @@ -13,7 +13,7 @@ vobjs := $(foreach F,$(vobjs-y),$(obj)/$F) $(obj)/vdso.o: $(obj)/vdso.so -targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) vdso-syms.o +targets += vdso.so vdso.lds $(vobjs-y) vdso-syms.o # The DSO images are built using a special linker script. quiet_cmd_syscall = SYSCALL $@ @@ -26,19 +26,12 @@ vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \ $(call ld-option, -Wl$(comma)--hash-style=sysv) \ -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 SYSCFLAGS_vdso.so = $(vdso-flags) -SYSCFLAGS_vdso.so.dbg = $(vdso-flags) $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so $(obj)/vdso.so: $(src)/vdso.lds $(vobjs) FORCE - -$(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE $(call if_changed,syscall) -$(obj)/%.so: OBJCOPYFLAGS := -S -$(obj)/%.so: $(obj)/%.so.dbg FORCE - $(call if_changed,objcopy) - CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64 $(obj)/vclock_gettime.o: KBUILD_CFLAGS = $(CFL) @@ -54,11 +47,3 @@ $(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o SYSCFLAGS_vdso-syms.o = -r -d $(obj)/vdso-syms.o: $(src)/vdso.lds $(vobjs) FORCE $(call if_changed,syscall) - -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ -vdso.so: - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso.so diff --git a/trunk/arch/x86/vdso/vdso.lds.S b/trunk/arch/x86/vdso/vdso.lds.S index 667d3245d972..b9a60e665d08 100644 --- a/trunk/arch/x86/vdso/vdso.lds.S +++ b/trunk/arch/x86/vdso/vdso.lds.S @@ -26,16 +26,13 @@ SECTIONS is insufficient, ld -shared will barf. Just increase it here. */ . = VDSO_PRELINK + VDSO_TEXT_OFFSET; - .text : { *(.text*) } :text - .rodata : { *(.rodata*) } :text - .data : { - *(.data*) - *(.sdata*) - *(.bss*) - *(.dynbss*) - } :text + .text : { *(.text) } :text + .text.ptr : { *(.text.ptr) } :text + . = VDSO_PRELINK + 0x900; + .data : { *(.data) } :text + .bss : { *(.bss) } :text - .altinstructions : { *(.altinstructions) } :text + .altinstructions : { *(.altinstructions) } :text .altinstr_replacement : { *(.altinstr_replacement) } :text .note : { *(.note.*) } :text :note @@ -45,6 +42,7 @@ SECTIONS .useless : { *(.got.plt) *(.got) *(.gnu.linkonce.d.*) + *(.dynbss) *(.gnu.linkonce.b.*) } :text } diff --git a/trunk/arch/x86/vdso/vvar.c b/trunk/arch/x86/vdso/vvar.c index 1b7e703684f9..6fc22219a472 100644 --- a/trunk/arch/x86/vdso/vvar.c +++ b/trunk/arch/x86/vdso/vvar.c @@ -8,5 +8,5 @@ #include #include -#define VEXTERN(x) typeof (__ ## x) *const vdso_ ## x = (void *)VMAGIC; +#define VEXTERN(x) typeof (__ ## x) *vdso_ ## x = (void *)VMAGIC; #include "vextern.h" diff --git a/trunk/arch/x86/xen/enlighten.c b/trunk/arch/x86/xen/enlighten.c index 94c39aaf695f..493a083f6886 100644 --- a/trunk/arch/x86/xen/enlighten.c +++ b/trunk/arch/x86/xen/enlighten.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -51,25 +52,11 @@ EXPORT_SYMBOL_GPL(hypercall_page); +DEFINE_PER_CPU(enum paravirt_lazy_mode, xen_lazy_mode); + DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info); - -/* - * Note about cr3 (pagetable base) values: - * - * xen_cr3 contains the current logical cr3 value; it contains the - * last set cr3. This may not be the current effective cr3, because - * its update may be being lazily deferred. However, a vcpu looking - * at its own cr3 can use this value knowing that it everything will - * be self-consistent. - * - * xen_current_cr3 contains the actual vcpu cr3; it is set once the - * hypercall to set the vcpu cr3 is complete (so it may be a little - * out of date, but it will never be set early). If one vcpu is - * looking at another vcpu's cr3 value, it should use this variable. - */ -DEFINE_PER_CPU(unsigned long, xen_cr3); /* cr3 stored as physaddr */ -DEFINE_PER_CPU(unsigned long, xen_current_cr3); /* actual vcpu cr3 */ +DEFINE_PER_CPU(unsigned long, xen_cr3); struct start_info *xen_start_info; EXPORT_SYMBOL_GPL(xen_start_info); @@ -113,7 +100,7 @@ static void __init xen_vcpu_setup(int cpu) info.mfn = virt_to_mfn(vcpup); info.offset = offset_in_page(vcpup); - printk(KERN_DEBUG "trying to map vcpu_info %d at %p, mfn %llx, offset %d\n", + printk(KERN_DEBUG "trying to map vcpu_info %d at %p, mfn %x, offset %d\n", cpu, vcpup, info.mfn, info.offset); /* Check to see if the hypervisor will put the vcpu_info @@ -137,7 +124,7 @@ static void __init xen_vcpu_setup(int cpu) static void __init xen_banner(void) { printk(KERN_INFO "Booting paravirtualized kernel on %s\n", - pv_info.name); + paravirt_ops.name); printk(KERN_INFO "Hypervisor signature: %s\n", xen_start_info->magic); } @@ -262,10 +249,29 @@ static void xen_halt(void) xen_safe_halt(); } -static void xen_leave_lazy(void) +static void xen_set_lazy_mode(enum paravirt_lazy_mode mode) { - paravirt_leave_lazy(paravirt_get_lazy_mode()); + BUG_ON(preemptible()); + + switch (mode) { + case PARAVIRT_LAZY_NONE: + BUG_ON(x86_read_percpu(xen_lazy_mode) == PARAVIRT_LAZY_NONE); + break; + + case PARAVIRT_LAZY_MMU: + case PARAVIRT_LAZY_CPU: + BUG_ON(x86_read_percpu(xen_lazy_mode) != PARAVIRT_LAZY_NONE); + break; + + case PARAVIRT_LAZY_FLUSH: + /* flush if necessary, but don't change state */ + if (x86_read_percpu(xen_lazy_mode) != PARAVIRT_LAZY_NONE) + xen_mc_flush(); + return; + } + xen_mc_flush(); + x86_write_percpu(xen_lazy_mode, mode); } static unsigned long xen_store_tr(void) @@ -352,7 +358,7 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu) * loaded properly. This will go away as soon as Xen has been * modified to not save/restore %gs for normal hypercalls. */ - if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU) + if (xen_get_lazy_mode() == PARAVIRT_LAZY_CPU) loadsegment(gs, 0); } @@ -626,36 +632,32 @@ static unsigned long xen_read_cr3(void) return x86_read_percpu(xen_cr3); } -static void set_current_cr3(void *v) -{ - x86_write_percpu(xen_current_cr3, (unsigned long)v); -} - static void xen_write_cr3(unsigned long cr3) { - struct mmuext_op *op; - struct multicall_space mcs; - unsigned long mfn = pfn_to_mfn(PFN_DOWN(cr3)); - BUG_ON(preemptible()); - mcs = xen_mc_entry(sizeof(*op)); /* disables interrupts */ + if (cr3 == x86_read_percpu(xen_cr3)) { + /* just a simple tlb flush */ + xen_flush_tlb(); + return; + } - /* Update while interrupts are disabled, so its atomic with - respect to ipis */ x86_write_percpu(xen_cr3, cr3); - op = mcs.args; - op->cmd = MMUEXT_NEW_BASEPTR; - op->arg1.mfn = mfn; - MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); + { + struct mmuext_op *op; + struct multicall_space mcs = xen_mc_entry(sizeof(*op)); + unsigned long mfn = pfn_to_mfn(PFN_DOWN(cr3)); + + op = mcs.args; + op->cmd = MMUEXT_NEW_BASEPTR; + op->arg1.mfn = mfn; - /* Update xen_update_cr3 once the batch has actually - been submitted. */ - xen_mc_callback(set_current_cr3, (void *)cr3); + MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); - xen_mc_issue(PARAVIRT_LAZY_CPU); /* interrupts restored */ + xen_mc_issue(PARAVIRT_LAZY_CPU); + } } /* Early in boot, while setting up the initial pagetable, assume @@ -666,15 +668,6 @@ static __init void xen_alloc_pt_init(struct mm_struct *mm, u32 pfn) make_lowmem_page_readonly(__va(PFN_PHYS(pfn))); } -static void pin_pagetable_pfn(unsigned level, unsigned long pfn) -{ - struct mmuext_op op; - op.cmd = level; - op.arg1.mfn = pfn_to_mfn(pfn); - if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF)) - BUG(); -} - /* This needs to make sure the new pte page is pinned iff its being attached to a pinned pagetable. */ static void xen_alloc_pt(struct mm_struct *mm, u32 pfn) @@ -684,10 +677,9 @@ static void xen_alloc_pt(struct mm_struct *mm, u32 pfn) if (PagePinned(virt_to_page(mm->pgd))) { SetPagePinned(page); - if (!PageHighMem(page)) { + if (!PageHighMem(page)) make_lowmem_page_readonly(__va(PFN_PHYS(pfn))); - pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn); - } else + else /* make sure there are no stray mappings of this page */ kmap_flush_unused(); @@ -700,10 +692,8 @@ static void xen_release_pt(u32 pfn) struct page *page = pfn_to_page(pfn); if (PagePinned(page)) { - if (!PageHighMem(page)) { - pin_pagetable_pfn(MMUEXT_UNPIN_TABLE, pfn); + if (!PageHighMem(page)) make_lowmem_page_readwrite(__va(PFN_PHYS(pfn))); - } } } @@ -748,7 +738,7 @@ static __init void xen_pagetable_setup_start(pgd_t *base) pgd_t *xen_pgd = (pgd_t *)xen_start_info->pt_base; /* special set_pte for pagetable initialization */ - pv_mmu_ops.set_pte = xen_set_pte_init; + paravirt_ops.set_pte = xen_set_pte_init; init_mm.pgd = base; /* @@ -795,8 +785,8 @@ static __init void xen_pagetable_setup_done(pgd_t *base) { /* This will work as long as patching hasn't happened yet (which it hasn't) */ - pv_mmu_ops.alloc_pt = xen_alloc_pt; - pv_mmu_ops.set_pte = xen_set_pte; + paravirt_ops.alloc_pt = xen_alloc_pt; + paravirt_ops.set_pte = xen_set_pte; if (!xen_feature(XENFEAT_auto_translated_physmap)) { /* @@ -818,15 +808,15 @@ static __init void xen_pagetable_setup_done(pgd_t *base) /* Actually pin the pagetable down, but we can't set PG_pinned yet because the page structures don't exist yet. */ { - unsigned level; - + struct mmuext_op op; #ifdef CONFIG_X86_PAE - level = MMUEXT_PIN_L3_TABLE; + op.cmd = MMUEXT_PIN_L3_TABLE; #else - level = MMUEXT_PIN_L2_TABLE; + op.cmd = MMUEXT_PIN_L3_TABLE; #endif - - pin_pagetable_pfn(level, PFN_DOWN(__pa(base))); + op.arg1.mfn = pfn_to_mfn(PFN_DOWN(__pa(base))); + if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF)) + BUG(); } } @@ -843,12 +833,12 @@ void __init xen_setup_vcpu_info_placement(void) if (have_vcpu_info_placement) { printk(KERN_INFO "Xen: using vcpu_info placement\n"); - pv_irq_ops.save_fl = xen_save_fl_direct; - pv_irq_ops.restore_fl = xen_restore_fl_direct; - pv_irq_ops.irq_disable = xen_irq_disable_direct; - pv_irq_ops.irq_enable = xen_irq_enable_direct; - pv_mmu_ops.read_cr2 = xen_read_cr2_direct; - pv_cpu_ops.iret = xen_iret_direct; + paravirt_ops.save_fl = xen_save_fl_direct; + paravirt_ops.restore_fl = xen_restore_fl_direct; + paravirt_ops.irq_disable = xen_irq_disable_direct; + paravirt_ops.irq_enable = xen_irq_enable_direct; + paravirt_ops.read_cr2 = xen_read_cr2_direct; + paravirt_ops.iret = xen_iret_direct; } } @@ -860,8 +850,8 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf, start = end = reloc = NULL; -#define SITE(op, x) \ - case PARAVIRT_PATCH(op.x): \ +#define SITE(x) \ + case PARAVIRT_PATCH(x): \ if (have_vcpu_info_placement) { \ start = (char *)xen_##x##_direct; \ end = xen_##x##_direct_end; \ @@ -870,10 +860,10 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf, goto patch_site switch (type) { - SITE(pv_irq_ops, irq_enable); - SITE(pv_irq_ops, irq_disable); - SITE(pv_irq_ops, save_fl); - SITE(pv_irq_ops, restore_fl); + SITE(irq_enable); + SITE(irq_disable); + SITE(save_fl); + SITE(restore_fl); #undef SITE patch_site: @@ -905,32 +895,26 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf, return ret; } -static const struct pv_info xen_info __initdata = { +static const struct paravirt_ops xen_paravirt_ops __initdata = { .paravirt_enabled = 1, .shared_kernel_pmd = 0, .name = "Xen", -}; + .banner = xen_banner, -static const struct pv_init_ops xen_init_ops __initdata = { .patch = xen_patch, - .banner = xen_banner, .memory_setup = xen_memory_setup, .arch_setup = xen_arch_setup, + .init_IRQ = xen_init_IRQ, .post_allocator_init = xen_mark_init_mm_pinned, -}; -static const struct pv_time_ops xen_time_ops __initdata = { .time_init = xen_time_init, - .set_wallclock = xen_set_wallclock, .get_wallclock = xen_get_wallclock, .get_cpu_khz = xen_cpu_khz, .sched_clock = xen_sched_clock, -}; -static const struct pv_cpu_ops xen_cpu_ops __initdata = { .cpuid = xen_cpuid, .set_debugreg = xen_set_debugreg, @@ -941,10 +925,22 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = { .read_cr0 = native_read_cr0, .write_cr0 = native_write_cr0, + .read_cr2 = xen_read_cr2, + .write_cr2 = xen_write_cr2, + + .read_cr3 = xen_read_cr3, + .write_cr3 = xen_write_cr3, + .read_cr4 = native_read_cr4, .read_cr4_safe = native_read_cr4_safe, .write_cr4 = xen_write_cr4, + .save_fl = xen_save_fl, + .restore_fl = xen_restore_fl, + .irq_disable = xen_irq_disable, + .irq_enable = xen_irq_enable, + .safe_halt = xen_safe_halt, + .halt = xen_halt, .wbinvd = native_wbinvd, .read_msr = native_read_msr_safe, @@ -973,23 +969,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = { .set_iopl_mask = xen_set_iopl_mask, .io_delay = xen_io_delay, - .lazy_mode = { - .enter = paravirt_enter_lazy_cpu, - .leave = xen_leave_lazy, - }, -}; - -static const struct pv_irq_ops xen_irq_ops __initdata = { - .init_IRQ = xen_init_IRQ, - .save_fl = xen_save_fl, - .restore_fl = xen_restore_fl, - .irq_disable = xen_irq_disable, - .irq_enable = xen_irq_enable, - .safe_halt = xen_safe_halt, - .halt = xen_halt, -}; - -static const struct pv_apic_ops xen_apic_ops __initdata = { #ifdef CONFIG_X86_LOCAL_APIC .apic_write = xen_apic_write, .apic_write_atomic = xen_apic_write, @@ -998,17 +977,6 @@ static const struct pv_apic_ops xen_apic_ops __initdata = { .setup_secondary_clock = paravirt_nop, .startup_ipi_hook = paravirt_nop, #endif -}; - -static const struct pv_mmu_ops xen_mmu_ops __initdata = { - .pagetable_setup_start = xen_pagetable_setup_start, - .pagetable_setup_done = xen_pagetable_setup_done, - - .read_cr2 = xen_read_cr2, - .write_cr2 = xen_write_cr2, - - .read_cr3 = xen_read_cr3, - .write_cr3 = xen_write_cr3, .flush_tlb_user = xen_flush_tlb, .flush_tlb_kernel = xen_flush_tlb, @@ -1018,6 +986,9 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = { .pte_update = paravirt_nop, .pte_update_defer = paravirt_nop, + .pagetable_setup_start = xen_pagetable_setup_start, + .pagetable_setup_done = xen_pagetable_setup_done, + .alloc_pt = xen_alloc_pt_init, .release_pt = xen_release_pt, .alloc_pd = paravirt_nop, @@ -1053,10 +1024,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = { .dup_mmap = xen_dup_mmap, .exit_mmap = xen_exit_mmap, - .lazy_mode = { - .enter = paravirt_enter_lazy_mmu, - .leave = xen_leave_lazy, - }, + .set_lazy_mode = xen_set_lazy_mode, }; #ifdef CONFIG_SMP @@ -1112,17 +1080,6 @@ static const struct machine_ops __initdata xen_machine_ops = { }; -static void __init xen_reserve_top(void) -{ - unsigned long top = HYPERVISOR_VIRT_START; - struct xen_platform_parameters pp; - - if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) - top = pp.virt_start; - - reserve_top_address(-top + 2 * PAGE_SIZE); -} - /* First C function to be called on Xen boot */ asmlinkage void __init xen_start_kernel(void) { @@ -1134,14 +1091,7 @@ asmlinkage void __init xen_start_kernel(void) BUG_ON(memcmp(xen_start_info->magic, "xen-3.0", 7) != 0); /* Install Xen paravirt ops */ - pv_info = xen_info; - pv_init_ops = xen_init_ops; - pv_time_ops = xen_time_ops; - pv_cpu_ops = xen_cpu_ops; - pv_irq_ops = xen_irq_ops; - pv_apic_ops = xen_apic_ops; - pv_mmu_ops = xen_mmu_ops; - + paravirt_ops = xen_paravirt_ops; machine_ops = xen_machine_ops; #ifdef CONFIG_SMP @@ -1163,7 +1113,6 @@ asmlinkage void __init xen_start_kernel(void) /* keep using Xen gdt for now; no urgent need to change it */ x86_write_percpu(xen_cr3, __pa(pgd)); - x86_write_percpu(xen_current_cr3, __pa(pgd)); #ifdef CONFIG_SMP /* Don't do the full vcpu_info placement stuff until we have a @@ -1175,12 +1124,12 @@ asmlinkage void __init xen_start_kernel(void) xen_setup_vcpu_info_placement(); #endif - pv_info.kernel_rpl = 1; + paravirt_ops.kernel_rpl = 1; if (xen_feature(XENFEAT_supervisor_mode_kernel)) - pv_info.kernel_rpl = 0; + paravirt_ops.kernel_rpl = 0; /* set the limit of our address space */ - xen_reserve_top(); + reserve_top_address(-HYPERVISOR_VIRT_START + 2 * PAGE_SIZE); /* set up basic CPUID stuff */ cpu_detect(&new_cpu_data); diff --git a/trunk/arch/x86/xen/mmu.c b/trunk/arch/x86/xen/mmu.c index b2e32f9d0071..874db0cd1d2a 100644 --- a/trunk/arch/x86/xen/mmu.c +++ b/trunk/arch/x86/xen/mmu.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -154,7 +155,7 @@ void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) { if (mm == current->mm || mm == &init_mm) { - if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) { + if (xen_get_lazy_mode() == PARAVIRT_LAZY_MMU) { struct multicall_space mcs; mcs = xen_mc_entry(0); @@ -303,12 +304,7 @@ pgd_t xen_make_pgd(unsigned long pgd) } #endif /* CONFIG_X86_PAE */ -enum pt_level { - PT_PGD, - PT_PUD, - PT_PMD, - PT_PTE -}; + /* (Yet another) pagetable walker. This one is intended for pinning a @@ -320,7 +316,7 @@ enum pt_level { FIXADDR_TOP. But the important bit is that we don't pin beyond there, because then we start getting into Xen's ptes. */ -static int pgd_walk(pgd_t *pgd_base, int (*func)(struct page *, enum pt_level), +static int pgd_walk(pgd_t *pgd_base, int (*func)(struct page *, unsigned), unsigned long limit) { pgd_t *pgd = pgd_base; @@ -345,7 +341,7 @@ static int pgd_walk(pgd_t *pgd_base, int (*func)(struct page *, enum pt_level), pud = pud_offset(pgd, 0); if (PTRS_PER_PUD > 1) /* not folded */ - flush |= (*func)(virt_to_page(pud), PT_PUD); + flush |= (*func)(virt_to_page(pud), 0); for (; addr != pud_limit; pud++, addr = pud_next) { pmd_t *pmd; @@ -364,7 +360,7 @@ static int pgd_walk(pgd_t *pgd_base, int (*func)(struct page *, enum pt_level), pmd = pmd_offset(pud, 0); if (PTRS_PER_PMD > 1) /* not folded */ - flush |= (*func)(virt_to_page(pmd), PT_PMD); + flush |= (*func)(virt_to_page(pmd), 0); for (; addr != pmd_limit; pmd++) { addr += (PAGE_SIZE * PTRS_PER_PTE); @@ -376,47 +372,17 @@ static int pgd_walk(pgd_t *pgd_base, int (*func)(struct page *, enum pt_level), if (pmd_none(*pmd)) continue; - flush |= (*func)(pmd_page(*pmd), PT_PTE); + flush |= (*func)(pmd_page(*pmd), 0); } } } - flush |= (*func)(virt_to_page(pgd_base), PT_PGD); + flush |= (*func)(virt_to_page(pgd_base), UVMF_TLB_FLUSH); return flush; } -static spinlock_t *lock_pte(struct page *page) -{ - spinlock_t *ptl = NULL; - -#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS - ptl = __pte_lockptr(page); - spin_lock(ptl); -#endif - - return ptl; -} - -static void do_unlock(void *v) -{ - spinlock_t *ptl = v; - spin_unlock(ptl); -} - -static void xen_do_pin(unsigned level, unsigned long pfn) -{ - struct mmuext_op *op; - struct multicall_space mcs; - - mcs = __xen_mc_entry(sizeof(*op)); - op = mcs.args; - op->cmd = level; - op->arg1.mfn = pfn_to_mfn(pfn); - MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); -} - -static int pin_page(struct page *page, enum pt_level level) +static int pin_page(struct page *page, unsigned flags) { unsigned pgfl = test_and_set_bit(PG_pinned, &page->flags); int flush; @@ -431,26 +397,12 @@ static int pin_page(struct page *page, enum pt_level level) void *pt = lowmem_page_address(page); unsigned long pfn = page_to_pfn(page); struct multicall_space mcs = __xen_mc_entry(0); - spinlock_t *ptl; flush = 0; - ptl = NULL; - if (level == PT_PTE) - ptl = lock_pte(page); - MULTI_update_va_mapping(mcs.mc, (unsigned long)pt, pfn_pte(pfn, PAGE_KERNEL_RO), - level == PT_PGD ? UVMF_TLB_FLUSH : 0); - - if (level == PT_PTE) - xen_do_pin(MMUEXT_PIN_L1_TABLE, pfn); - - if (ptl) { - /* Queue a deferred unlock for when this batch - is completed. */ - xen_mc_callback(do_unlock, ptl); - } + flags); } return flush; @@ -461,7 +413,8 @@ static int pin_page(struct page *page, enum pt_level level) read-only, and can be pinned. */ void xen_pgd_pin(pgd_t *pgd) { - unsigned level; + struct multicall_space mcs; + struct mmuext_op *op; xen_mc_batch(); @@ -472,13 +425,16 @@ void xen_pgd_pin(pgd_t *pgd) xen_mc_batch(); } + mcs = __xen_mc_entry(sizeof(*op)); + op = mcs.args; + #ifdef CONFIG_X86_PAE - level = MMUEXT_PIN_L3_TABLE; + op->cmd = MMUEXT_PIN_L3_TABLE; #else - level = MMUEXT_PIN_L2_TABLE; + op->cmd = MMUEXT_PIN_L2_TABLE; #endif - - xen_do_pin(level, PFN_DOWN(__pa(pgd))); + op->arg1.mfn = pfn_to_mfn(PFN_DOWN(__pa(pgd))); + MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); xen_mc_issue(0); } @@ -486,7 +442,7 @@ void xen_pgd_pin(pgd_t *pgd) /* The init_mm pagetable is really pinned as soon as its created, but that's before we have page structures to store the bits. So do all the book-keeping now. */ -static __init int mark_pinned(struct page *page, enum pt_level level) +static __init int mark_pinned(struct page *page, unsigned flags) { SetPagePinned(page); return 0; @@ -497,32 +453,18 @@ void __init xen_mark_init_mm_pinned(void) pgd_walk(init_mm.pgd, mark_pinned, FIXADDR_TOP); } -static int unpin_page(struct page *page, enum pt_level level) +static int unpin_page(struct page *page, unsigned flags) { unsigned pgfl = test_and_clear_bit(PG_pinned, &page->flags); if (pgfl && !PageHighMem(page)) { void *pt = lowmem_page_address(page); unsigned long pfn = page_to_pfn(page); - spinlock_t *ptl = NULL; - struct multicall_space mcs; - - if (level == PT_PTE) { - ptl = lock_pte(page); - - xen_do_pin(MMUEXT_UNPIN_TABLE, pfn); - } - - mcs = __xen_mc_entry(0); + struct multicall_space mcs = __xen_mc_entry(0); MULTI_update_va_mapping(mcs.mc, (unsigned long)pt, pfn_pte(pfn, PAGE_KERNEL), - level == PT_PGD ? UVMF_TLB_FLUSH : 0); - - if (ptl) { - /* unlock when batch completed */ - xen_mc_callback(do_unlock, ptl); - } + flags); } return 0; /* never need to flush on unpin */ @@ -531,9 +473,18 @@ static int unpin_page(struct page *page, enum pt_level level) /* Release a pagetables pages back as normal RW */ static void xen_pgd_unpin(pgd_t *pgd) { + struct mmuext_op *op; + struct multicall_space mcs; + xen_mc_batch(); - xen_do_pin(MMUEXT_UNPIN_TABLE, PFN_DOWN(__pa(pgd))); + mcs = __xen_mc_entry(sizeof(*op)); + + op = mcs.args; + op->cmd = MMUEXT_UNPIN_TABLE; + op->arg1.mfn = pfn_to_mfn(PFN_DOWN(__pa(pgd))); + + MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); pgd_walk(pgd, unpin_page, TASK_SIZE); @@ -564,43 +515,20 @@ static void drop_other_mm_ref(void *info) if (__get_cpu_var(cpu_tlbstate).active_mm == mm) leave_mm(smp_processor_id()); - - /* If this cpu still has a stale cr3 reference, then make sure - it has been flushed. */ - if (x86_read_percpu(xen_current_cr3) == __pa(mm->pgd)) { - load_cr3(swapper_pg_dir); - arch_flush_lazy_cpu_mode(); - } } static void drop_mm_ref(struct mm_struct *mm) { - cpumask_t mask; - unsigned cpu; - if (current->active_mm == mm) { if (current->mm == mm) load_cr3(swapper_pg_dir); else leave_mm(smp_processor_id()); - arch_flush_lazy_cpu_mode(); } - /* Get the "official" set of cpus referring to our pagetable. */ - mask = mm->cpu_vm_mask; - - /* It's possible that a vcpu may have a stale reference to our - cr3, because its in lazy mode, and it hasn't yet flushed - its set of pending hypercalls yet. In this case, we can - look at its actual current cr3 value, and force it to flush - if needed. */ - for_each_online_cpu(cpu) { - if (per_cpu(xen_current_cr3, cpu) == __pa(mm->pgd)) - cpu_set(cpu, mask); - } - - if (!cpus_empty(mask)) - xen_smp_call_function_mask(mask, drop_other_mm_ref, mm, 1); + if (!cpus_empty(mm->cpu_vm_mask)) + xen_smp_call_function_mask(mm->cpu_vm_mask, drop_other_mm_ref, + mm, 1); } #else static void drop_mm_ref(struct mm_struct *mm) @@ -635,6 +563,5 @@ void xen_exit_mmap(struct mm_struct *mm) /* pgd may not be pinned in the error exit path of execve */ if (PagePinned(virt_to_page(mm->pgd))) xen_pgd_unpin(mm->pgd); - spin_unlock(&mm->page_table_lock); } diff --git a/trunk/arch/x86/xen/multicalls.c b/trunk/arch/x86/xen/multicalls.c index 5e6f36f6d876..c837e8e463db 100644 --- a/trunk/arch/x86/xen/multicalls.c +++ b/trunk/arch/x86/xen/multicalls.c @@ -26,22 +26,13 @@ #include "multicalls.h" -#define MC_DEBUG 1 - #define MC_BATCH 32 #define MC_ARGS (MC_BATCH * 16 / sizeof(u64)) struct mc_buffer { struct multicall_entry entries[MC_BATCH]; -#if MC_DEBUG - struct multicall_entry debug[MC_BATCH]; -#endif u64 args[MC_ARGS]; - struct callback { - void (*fn)(void *); - void *data; - } callbacks[MC_BATCH]; - unsigned mcidx, argidx, cbidx; + unsigned mcidx, argidx; }; static DEFINE_PER_CPU(struct mc_buffer, mc_buffer); @@ -52,7 +43,6 @@ void xen_mc_flush(void) struct mc_buffer *b = &__get_cpu_var(mc_buffer); int ret = 0; unsigned long flags; - int i; BUG_ON(preemptible()); @@ -61,31 +51,13 @@ void xen_mc_flush(void) local_irq_save(flags); if (b->mcidx) { -#if MC_DEBUG - memcpy(b->debug, b->entries, - b->mcidx * sizeof(struct multicall_entry)); -#endif + int i; if (HYPERVISOR_multicall(b->entries, b->mcidx) != 0) BUG(); for (i = 0; i < b->mcidx; i++) if (b->entries[i].result < 0) ret++; - -#if MC_DEBUG - if (ret) { - printk(KERN_ERR "%d multicall(s) failed: cpu %d\n", - ret, smp_processor_id()); - for(i = 0; i < b->mcidx; i++) { - printk(" call %2d/%d: op=%lu arg=[%lx] result=%ld\n", - i+1, b->mcidx, - b->debug[i].op, - b->debug[i].args[0], - b->entries[i].result); - } - } -#endif - b->mcidx = 0; b->argidx = 0; } else @@ -93,13 +65,6 @@ void xen_mc_flush(void) local_irq_restore(flags); - for(i = 0; i < b->cbidx; i++) { - struct callback *cb = &b->callbacks[i]; - - (*cb->fn)(cb->data); - } - b->cbidx = 0; - BUG_ON(ret); } @@ -123,16 +88,3 @@ struct multicall_space __xen_mc_entry(size_t args) return ret; } - -void xen_mc_callback(void (*fn)(void *), void *data) -{ - struct mc_buffer *b = &__get_cpu_var(mc_buffer); - struct callback *cb; - - if (b->cbidx == MC_BATCH) - xen_mc_flush(); - - cb = &b->callbacks[b->cbidx++]; - cb->fn = fn; - cb->data = data; -} diff --git a/trunk/arch/x86/xen/multicalls.h b/trunk/arch/x86/xen/multicalls.h index 8bae996d99a3..e6f7530b156c 100644 --- a/trunk/arch/x86/xen/multicalls.h +++ b/trunk/arch/x86/xen/multicalls.h @@ -35,14 +35,11 @@ void xen_mc_flush(void); /* Issue a multicall if we're not in a lazy mode */ static inline void xen_mc_issue(unsigned mode) { - if ((paravirt_get_lazy_mode() & mode) == 0) + if ((xen_get_lazy_mode() & mode) == 0) xen_mc_flush(); /* restore flags saved in xen_mc_batch */ local_irq_restore(x86_read_percpu(xen_mc_irq_flags)); } -/* Set up a callback to be called when the current batch is flushed */ -void xen_mc_callback(void (*fn)(void *), void *data); - #endif /* _XEN_MULTICALLS_H */ diff --git a/trunk/arch/x86/xen/smp.c b/trunk/arch/x86/xen/smp.c index c1b131bcdcbe..4fa33c27ccb6 100644 --- a/trunk/arch/x86/xen/smp.c +++ b/trunk/arch/x86/xen/smp.c @@ -356,7 +356,6 @@ static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id) */ irq_enter(); (*func)(info); - __get_cpu_var(irq_stat).irq_call_count++; irq_exit(); if (wait) { @@ -371,8 +370,7 @@ int xen_smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info, int wait) { struct call_data_struct data; - int cpus, cpu; - bool yield; + int cpus; /* Holding any lock stops cpus from going down. */ spin_lock(&call_lock); @@ -401,14 +399,9 @@ int xen_smp_call_function_mask(cpumask_t mask, void (*func)(void *), /* Send a message to other CPUs and wait for them to respond */ xen_send_IPI_mask(mask, XEN_CALL_FUNCTION_VECTOR); - /* Make sure other vcpus get a chance to run if they need to. */ - yield = false; - for_each_cpu_mask(cpu, mask) - if (xen_vcpu_stolen(cpu)) - yield = true; - - if (yield) - HYPERVISOR_sched_op(SCHEDOP_yield, 0); + /* Make sure other vcpus get a chance to run. + XXX too severe? Maybe we should check the other CPU's states? */ + HYPERVISOR_sched_op(SCHEDOP_yield, 0); /* Wait for response */ while (atomic_read(&data.started) != cpus || diff --git a/trunk/arch/x86/xen/time.c b/trunk/arch/x86/xen/time.c index d083ff5ef088..dfd6db69ead5 100644 --- a/trunk/arch/x86/xen/time.c +++ b/trunk/arch/x86/xen/time.c @@ -105,12 +105,6 @@ static void get_runstate_snapshot(struct vcpu_runstate_info *res) } while (get64(&state->state_entry_time) != state_time); } -/* return true when a vcpu could run but has no real cpu to run on */ -bool xen_vcpu_stolen(int vcpu) -{ - return per_cpu(runstate, vcpu).state == RUNSTATE_runnable; -} - static void setup_runstate_info(int cpu) { struct vcpu_register_runstate_memory_area area; diff --git a/trunk/arch/x86/xen/xen-ops.h b/trunk/arch/x86/xen/xen-ops.h index b02a909bfd4c..b9aaea45f07f 100644 --- a/trunk/arch/x86/xen/xen-ops.h +++ b/trunk/arch/x86/xen/xen-ops.h @@ -11,7 +11,6 @@ void xen_copy_trap_info(struct trap_info *traps); DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); DECLARE_PER_CPU(unsigned long, xen_cr3); -DECLARE_PER_CPU(unsigned long, xen_current_cr3); extern struct start_info *xen_start_info; extern struct shared_info *HYPERVISOR_shared_info; @@ -28,10 +27,15 @@ unsigned long xen_get_wallclock(void); int xen_set_wallclock(unsigned long time); unsigned long long xen_sched_clock(void); -bool xen_vcpu_stolen(int vcpu); - void xen_mark_init_mm_pinned(void); +DECLARE_PER_CPU(enum paravirt_lazy_mode, xen_lazy_mode); + +static inline unsigned xen_get_lazy_mode(void) +{ + return x86_read_percpu(xen_lazy_mode); +} + void __init xen_fill_possible_map(void); void __init xen_setup_vcpu_info_placement(void); diff --git a/trunk/arch/x86_64/Kconfig b/trunk/arch/x86_64/Kconfig index 43fafe9e9c08..d681be88ae5d 100644 --- a/trunk/arch/x86_64/Kconfig +++ b/trunk/arch/x86_64/Kconfig @@ -175,12 +175,14 @@ config MK8 config MPSC bool "Intel P4 / older Netburst based Xeon" help - Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey - Xeon CPUs with Intel 64bit which is compatible with x86-64. + Optimize for Intel Pentium 4 and older Nocona/Dempsey Xeon CPUs + with Intel Extended Memory 64 Technology(EM64T). For details see + . Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the Netburst core and shouldn't use this option. You can distinguish them using the cpu family field - in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one. + in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one + (this rule only applies to systems that support EM64T) config MCORE2 bool "Intel Core2 / newer Xeon" @@ -188,7 +190,8 @@ config MCORE2 Optimize for Intel Core2 and newer Xeons (51xx) You can distinguish the newer Xeons from the older ones using the cpu family field in /proc/cpuinfo. 15 is an older Xeon - (use CONFIG_MPSC then), 6 is a newer one. + (use CONFIG_MPSC then), 6 is a newer one. This rule only + applies to CPUs that support EM64T. config GENERIC_CPU bool "Generic-x86-64" @@ -473,9 +476,8 @@ config HPET_TIMER . config HPET_EMULATE_RTC - bool + bool "Provide RTC interrupt" depends on HPET_TIMER && RTC=y - default y # Mark as embedded because too many people got it wrong. # The code disables itself when not needed. diff --git a/trunk/arch/x86_64/Makefile b/trunk/arch/x86_64/Makefile index 03e1ede27b85..9daa32d1d2a1 100644 --- a/trunk/arch/x86_64/Makefile +++ b/trunk/arch/x86_64/Makefile @@ -110,15 +110,9 @@ bzdisk: vmlinux fdimage fdimage144 fdimage288 isoimage: vmlinux $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ -install: vdso_install +install: $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ -vdso_install: -ifeq ($(CONFIG_IA32_EMULATION),y) - $(Q)$(MAKE) $(build)=arch/x86/ia32 $@ -endif - $(Q)$(MAKE) $(build)=arch/x86/vdso $@ - archclean: $(Q)rm -rf $(objtree)/arch/x86_64/boot $(Q)$(MAKE) $(clean)=$(boot) diff --git a/trunk/block/ll_rw_blk.c b/trunk/block/ll_rw_blk.c index 3935469e3662..9e3f3cc85d0d 100644 --- a/trunk/block/ll_rw_blk.c +++ b/trunk/block/ll_rw_blk.c @@ -1322,8 +1322,8 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist) { struct bio_vec *bvec, *bvprv; + struct scatterlist *next_sg, *sg; struct req_iterator iter; - struct scatterlist *sg; int nsegs, cluster; nsegs = 0; @@ -1333,7 +1333,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, * for each bio in rq */ bvprv = NULL; - sg = NULL; + sg = next_sg = &sglist[0]; rq_for_each_segment(bvec, rq, iter) { int nbytes = bvec->bv_len; @@ -1349,10 +1349,8 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, sg->length += nbytes; } else { new_segment: - if (!sg) - sg = sglist; - else - sg = sg_next(sg); + sg = next_sg; + next_sg = sg_next(sg); memset(sg, 0, sizeof(*sg)); sg->page = bvec->bv_page; diff --git a/trunk/drivers/char/agp/efficeon-agp.c b/trunk/drivers/char/agp/efficeon-agp.c index cac0009cebc1..d78cd09186aa 100644 --- a/trunk/drivers/char/agp/efficeon-agp.c +++ b/trunk/drivers/char/agp/efficeon-agp.c @@ -221,7 +221,7 @@ static int efficeon_create_gatt_table(struct agp_bridge_data *bridge) SetPageReserved(virt_to_page((char *)page)); for (offset = 0; offset < PAGE_SIZE; offset += clflush_chunk) - clflush((char *)page+offset); + asm volatile("clflush %0" : : "m" (*(char *)(page+offset))); efficeon_private.l1_table[index] = page; @@ -268,16 +268,15 @@ static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int t *page = insert; /* clflush is slow, so don't clflush until we have to */ - if (last_page && - (((unsigned long)page^(unsigned long)last_page) & - clflush_mask)) - clflush(last_page); + if ( last_page && + ((unsigned long)page^(unsigned long)last_page) & clflush_mask ) + asm volatile("clflush %0" : : "m" (*last_page)); last_page = page; } if ( last_page ) - clflush(last_page); + asm volatile("clflush %0" : : "m" (*last_page)); agp_bridge->driver->tlb_flush(mem); return 0; diff --git a/trunk/drivers/char/hvc_lguest.c b/trunk/drivers/char/hvc_lguest.c index efccb2155830..3d6bd0baa56d 100644 --- a/trunk/drivers/char/hvc_lguest.c +++ b/trunk/drivers/char/hvc_lguest.c @@ -115,7 +115,7 @@ static struct hv_ops lguest_cons = { * (0), and the struct hv_ops containing the put_chars() function. */ static int __init cons_init(void) { - if (strcmp(pv_info.name, "lguest") != 0) + if (strcmp(paravirt_ops.name, "lguest") != 0) return 0; return hvc_instantiate(0, 0, &lguest_cons); diff --git a/trunk/drivers/lguest/core.c b/trunk/drivers/lguest/core.c index a0788c12b392..4a315f08a567 100644 --- a/trunk/drivers/lguest/core.c +++ b/trunk/drivers/lguest/core.c @@ -248,8 +248,8 @@ static void unmap_switcher(void) } /*H:130 Our Guest is usually so well behaved; it never tries to do things it - * isn't allowed to. Unfortunately, Linux's paravirtual infrastructure isn't - * quite complete, because it doesn't contain replacements for the Intel I/O + * isn't allowed to. Unfortunately, "struct paravirt_ops" isn't quite + * complete, because it doesn't contain replacements for the Intel I/O * instructions. As a result, the Guest sometimes fumbles across one during * the boot process as it probes for various things which are usually attached * to a PC. @@ -694,7 +694,7 @@ static int __init init(void) /* Lguest can't run under Xen, VMI or itself. It does Tricky Stuff. */ if (paravirt_enabled()) { - printk("lguest is afraid of %s\n", pv_info.name); + printk("lguest is afraid of %s\n", paravirt_ops.name); return -EPERM; } diff --git a/trunk/drivers/lguest/lguest.c b/trunk/drivers/lguest/lguest.c index 3ba337dde857..4a579c840301 100644 --- a/trunk/drivers/lguest/lguest.c +++ b/trunk/drivers/lguest/lguest.c @@ -23,7 +23,7 @@ * * So how does the kernel know it's a Guest? The Guest starts at a special * entry point marked with a magic string, which sets up a few things then - * calls here. We replace the native functions various "paravirt" structures + * calls here. We replace the native functions in "struct paravirt_ops" * with our Guest versions, then boot like normal. :*/ /* @@ -97,17 +97,29 @@ static cycle_t clock_base; * them as a batch when lazy_mode is eventually turned off. Because hypercalls * are reasonably expensive, batching them up makes sense. For example, a * large mmap might update dozens of page table entries: that code calls - * paravirt_enter_lazy_mmu(), does the dozen updates, then calls - * lguest_leave_lazy_mode(). + * lguest_lazy_mode(PARAVIRT_LAZY_MMU), does the dozen updates, then calls + * lguest_lazy_mode(PARAVIRT_LAZY_NONE). * * So, when we're in lazy mode, we call async_hypercall() to store the call for * future processing. When lazy mode is turned off we issue a hypercall to * flush the stored calls. - */ -static void lguest_leave_lazy_mode(void) + * + * There's also a hack where "mode" is set to "PARAVIRT_LAZY_FLUSH" which + * indicates we're to flush any outstanding calls immediately. This is used + * when an interrupt handler does a kmap_atomic(): the page table changes must + * happen immediately even if we're in the middle of a batch. Usually we're + * not, though, so there's nothing to do. */ +static enum paravirt_lazy_mode lazy_mode; /* Note: not SMP-safe! */ +static void lguest_lazy_mode(enum paravirt_lazy_mode mode) { - paravirt_leave_lazy(paravirt_get_lazy_mode()); - hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0); + if (mode == PARAVIRT_LAZY_FLUSH) { + if (unlikely(lazy_mode != PARAVIRT_LAZY_NONE)) + hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0); + } else { + lazy_mode = mode; + if (mode == PARAVIRT_LAZY_NONE) + hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0); + } } static void lazy_hcall(unsigned long call, @@ -115,7 +127,7 @@ static void lazy_hcall(unsigned long call, unsigned long arg2, unsigned long arg3) { - if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) + if (lazy_mode == PARAVIRT_LAZY_NONE) hcall(call, arg1, arg2, arg3); else async_hcall(call, arg1, arg2, arg3); @@ -319,7 +331,7 @@ static void lguest_load_tls(struct thread_struct *t, unsigned int cpu) } /*G:038 That's enough excitement for now, back to ploughing through each of - * the different pv_ops structures (we're about 1/3 of the way through). + * the paravirt_ops (we're about 1/3 of the way through). * * This is the Local Descriptor Table, another weird Intel thingy. Linux only * uses this for some strange applications like Wine. We don't do anything @@ -546,7 +558,7 @@ static void lguest_set_pte(pte_t *ptep, pte_t pteval) lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0); } -/* Unfortunately for Lguest, the pv_mmu_ops for page tables were based on +/* Unfortunately for Lguest, the paravirt_ops for page tables were based on * native page table operations. On native hardware you can set a new page * table entry whenever you want, but if you want to remove one you have to do * a TLB flush (a TLB is a little cache of page table entries kept by the CPU). @@ -770,7 +782,7 @@ static void lguest_time_init(void) clocksource_register(&lguest_clock); /* Now we've set up our clock, we can use it as the scheduler clock */ - pv_time_ops.sched_clock = lguest_sched_clock; + paravirt_ops.sched_clock = lguest_sched_clock; /* We can't set cpumask in the initializer: damn C limitations! Set it * here and register our timer device. */ @@ -892,7 +904,7 @@ static __init char *lguest_memory_setup(void) /*G:050 * Patching (Powerfully Placating Performance Pedants) * - * We have already seen that pv_ops structures let us replace simple + * We have already seen that "struct paravirt_ops" lets us replace simple * native instructions with calls to the appropriate back end all throughout * the kernel. This allows the same kernel to run as a Guest and as a native * kernel, but it's slow because of all the indirect branches. @@ -917,10 +929,10 @@ static const struct lguest_insns { const char *start, *end; } lguest_insns[] = { - [PARAVIRT_PATCH(pv_irq_ops.irq_disable)] = { lgstart_cli, lgend_cli }, - [PARAVIRT_PATCH(pv_irq_ops.irq_enable)] = { lgstart_sti, lgend_sti }, - [PARAVIRT_PATCH(pv_irq_ops.restore_fl)] = { lgstart_popf, lgend_popf }, - [PARAVIRT_PATCH(pv_irq_ops.save_fl)] = { lgstart_pushf, lgend_pushf }, + [PARAVIRT_PATCH(irq_disable)] = { lgstart_cli, lgend_cli }, + [PARAVIRT_PATCH(irq_enable)] = { lgstart_sti, lgend_sti }, + [PARAVIRT_PATCH(restore_fl)] = { lgstart_popf, lgend_popf }, + [PARAVIRT_PATCH(save_fl)] = { lgstart_pushf, lgend_pushf }, }; /* Now our patch routine is fairly simple (based on the native one in @@ -947,9 +959,9 @@ static unsigned lguest_patch(u8 type, u16 clobber, void *ibuf, return insn_len; } -/*G:030 Once we get to lguest_init(), we know we're a Guest. The pv_ops - * structures in the kernel provide points for (almost) every routine we have - * to override to avoid privileged instructions. */ +/*G:030 Once we get to lguest_init(), we know we're a Guest. The paravirt_ops + * structure in the kernel provides a single point for (almost) every routine + * we have to override to avoid privileged instructions. */ __init void lguest_init(void *boot) { /* Copy boot parameters first: the Launcher put the physical location @@ -964,70 +976,54 @@ __init void lguest_init(void *boot) /* We're under lguest, paravirt is enabled, and we're running at * privilege level 1, not 0 as normal. */ - pv_info.name = "lguest"; - pv_info.paravirt_enabled = 1; - pv_info.kernel_rpl = 1; + paravirt_ops.name = "lguest"; + paravirt_ops.paravirt_enabled = 1; + paravirt_ops.kernel_rpl = 1; /* We set up all the lguest overrides for sensitive operations. These * are detailed with the operations themselves. */ - - /* interrupt-related operations */ - pv_irq_ops.init_IRQ = lguest_init_IRQ; - pv_irq_ops.save_fl = save_fl; - pv_irq_ops.restore_fl = restore_fl; - pv_irq_ops.irq_disable = irq_disable; - pv_irq_ops.irq_enable = irq_enable; - pv_irq_ops.safe_halt = lguest_safe_halt; - - /* init-time operations */ - pv_init_ops.memory_setup = lguest_memory_setup; - pv_init_ops.patch = lguest_patch; - - /* Intercepts of various cpu instructions */ - pv_cpu_ops.load_gdt = lguest_load_gdt; - pv_cpu_ops.cpuid = lguest_cpuid; - pv_cpu_ops.load_idt = lguest_load_idt; - pv_cpu_ops.iret = lguest_iret; - pv_cpu_ops.load_esp0 = lguest_load_esp0; - pv_cpu_ops.load_tr_desc = lguest_load_tr_desc; - pv_cpu_ops.set_ldt = lguest_set_ldt; - pv_cpu_ops.load_tls = lguest_load_tls; - pv_cpu_ops.set_debugreg = lguest_set_debugreg; - pv_cpu_ops.clts = lguest_clts; - pv_cpu_ops.read_cr0 = lguest_read_cr0; - pv_cpu_ops.write_cr0 = lguest_write_cr0; - pv_cpu_ops.read_cr4 = lguest_read_cr4; - pv_cpu_ops.write_cr4 = lguest_write_cr4; - pv_cpu_ops.write_gdt_entry = lguest_write_gdt_entry; - pv_cpu_ops.write_idt_entry = lguest_write_idt_entry; - pv_cpu_ops.wbinvd = lguest_wbinvd; - pv_cpu_ops.lazy_mode.enter = paravirt_enter_lazy_cpu; - pv_cpu_ops.lazy_mode.leave = lguest_leave_lazy_mode; - - /* pagetable management */ - pv_mmu_ops.write_cr3 = lguest_write_cr3; - pv_mmu_ops.flush_tlb_user = lguest_flush_tlb_user; - pv_mmu_ops.flush_tlb_single = lguest_flush_tlb_single; - pv_mmu_ops.flush_tlb_kernel = lguest_flush_tlb_kernel; - pv_mmu_ops.set_pte = lguest_set_pte; - pv_mmu_ops.set_pte_at = lguest_set_pte_at; - pv_mmu_ops.set_pmd = lguest_set_pmd; - pv_mmu_ops.read_cr2 = lguest_read_cr2; - pv_mmu_ops.read_cr3 = lguest_read_cr3; - pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu; - pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mode; - + paravirt_ops.save_fl = save_fl; + paravirt_ops.restore_fl = restore_fl; + paravirt_ops.irq_disable = irq_disable; + paravirt_ops.irq_enable = irq_enable; + paravirt_ops.load_gdt = lguest_load_gdt; + paravirt_ops.memory_setup = lguest_memory_setup; + paravirt_ops.cpuid = lguest_cpuid; + paravirt_ops.write_cr3 = lguest_write_cr3; + paravirt_ops.flush_tlb_user = lguest_flush_tlb_user; + paravirt_ops.flush_tlb_single = lguest_flush_tlb_single; + paravirt_ops.flush_tlb_kernel = lguest_flush_tlb_kernel; + paravirt_ops.set_pte = lguest_set_pte; + paravirt_ops.set_pte_at = lguest_set_pte_at; + paravirt_ops.set_pmd = lguest_set_pmd; #ifdef CONFIG_X86_LOCAL_APIC - /* apic read/write intercepts */ - pv_apic_ops.apic_write = lguest_apic_write; - pv_apic_ops.apic_write_atomic = lguest_apic_write; - pv_apic_ops.apic_read = lguest_apic_read; + paravirt_ops.apic_write = lguest_apic_write; + paravirt_ops.apic_write_atomic = lguest_apic_write; + paravirt_ops.apic_read = lguest_apic_read; #endif - - /* time operations */ - pv_time_ops.get_wallclock = lguest_get_wallclock; - pv_time_ops.time_init = lguest_time_init; - + paravirt_ops.load_idt = lguest_load_idt; + paravirt_ops.iret = lguest_iret; + paravirt_ops.load_esp0 = lguest_load_esp0; + paravirt_ops.load_tr_desc = lguest_load_tr_desc; + paravirt_ops.set_ldt = lguest_set_ldt; + paravirt_ops.load_tls = lguest_load_tls; + paravirt_ops.set_debugreg = lguest_set_debugreg; + paravirt_ops.clts = lguest_clts; + paravirt_ops.read_cr0 = lguest_read_cr0; + paravirt_ops.write_cr0 = lguest_write_cr0; + paravirt_ops.init_IRQ = lguest_init_IRQ; + paravirt_ops.read_cr2 = lguest_read_cr2; + paravirt_ops.read_cr3 = lguest_read_cr3; + paravirt_ops.read_cr4 = lguest_read_cr4; + paravirt_ops.write_cr4 = lguest_write_cr4; + paravirt_ops.write_gdt_entry = lguest_write_gdt_entry; + paravirt_ops.write_idt_entry = lguest_write_idt_entry; + paravirt_ops.patch = lguest_patch; + paravirt_ops.safe_halt = lguest_safe_halt; + paravirt_ops.get_wallclock = lguest_get_wallclock; + paravirt_ops.time_init = lguest_time_init; + paravirt_ops.set_lazy_mode = lguest_lazy_mode; + paravirt_ops.wbinvd = lguest_wbinvd; /* Now is a good time to look at the implementations of these functions * before returning to the rest of lguest_init(). */ diff --git a/trunk/drivers/lguest/lguest_bus.c b/trunk/drivers/lguest/lguest_bus.c index 57329788f8a7..9e7752cc8002 100644 --- a/trunk/drivers/lguest/lguest_bus.c +++ b/trunk/drivers/lguest/lguest_bus.c @@ -201,7 +201,7 @@ static void scan_devices(void) * "struct lguest_device_desc" array. */ static int __init lguest_bus_init(void) { - if (strcmp(pv_info.name, "lguest") != 0) + if (strcmp(paravirt_ops.name, "lguest") != 0) return 0; /* Devices are in a single page above top of "normal" mem */ diff --git a/trunk/drivers/mmc/core/mmc.c b/trunk/drivers/mmc/core/mmc.c index 65fe28860f54..68c0e3b2f0e8 100644 --- a/trunk/drivers/mmc/core/mmc.c +++ b/trunk/drivers/mmc/core/mmc.c @@ -213,7 +213,8 @@ static int mmc_read_ext_csd(struct mmc_card *card) printk(KERN_ERR "%s: unrecognised EXT_CSD structure " "version %d\n", mmc_hostname(card->host), ext_csd_struct); - return -EINVAL; + err = -EINVAL; + goto out; } if (ext_csd_struct >= 2) { diff --git a/trunk/drivers/scsi/scsi_lib.c b/trunk/drivers/scsi/scsi_lib.c index aac8a02cbe80..0c86be71bb33 100644 --- a/trunk/drivers/scsi/scsi_lib.c +++ b/trunk/drivers/scsi/scsi_lib.c @@ -764,8 +764,6 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) if (unlikely(!sgl)) goto enomem; - memset(sgl, 0, sizeof(*sgl) * sgp->size); - /* * first loop through, set initial index and return value */ diff --git a/trunk/drivers/video/Kconfig b/trunk/drivers/video/Kconfig index b3bf4ecc983a..efe474e2cc3b 100644 --- a/trunk/drivers/video/Kconfig +++ b/trunk/drivers/video/Kconfig @@ -15,6 +15,7 @@ config VGASTATE config VIDEO_OUTPUT_CONTROL tristate "Lowlevel video output switch controls" + default m help This framework adds support for low-level control of the video output switch. diff --git a/trunk/include/asm-mips/mach-au1x00/au1000.h b/trunk/include/asm-mips/mach-au1x00/au1000.h index 3bdce9126f16..b37baf8cf624 100644 --- a/trunk/include/asm-mips/mach-au1x00/au1000.h +++ b/trunk/include/asm-mips/mach-au1x00/au1000.h @@ -40,9 +40,7 @@ #include #include - #include -#include /* cpu pipeline flush */ void static inline au_sync(void) @@ -525,67 +523,63 @@ extern struct au1xxx_irqmap au1xxx_irq_map[]; /* Interrupt Numbers */ /* Au1000 */ #ifdef CONFIG_SOC_AU1000 -enum soc_au1000_ints { - AU1000_FIRST_INT = MIPS_CPU_IRQ_BASE, - AU1000_UART0_INT = AU1000_FIRST_INT, - AU1000_UART1_INT, /* au1000 */ - AU1000_UART2_INT, /* au1000 */ - AU1000_UART3_INT, - AU1000_SSI0_INT, /* au1000 */ - AU1000_SSI1_INT, /* au1000 */ - AU1000_DMA_INT_BASE, - - AU1000_TOY_INT = AU1000_FIRST_INT + 14, - AU1000_TOY_MATCH0_INT, - AU1000_TOY_MATCH1_INT, - AU1000_TOY_MATCH2_INT, - AU1000_RTC_INT, - AU1000_RTC_MATCH0_INT, - AU1000_RTC_MATCH1_INT, - AU1000_RTC_MATCH2_INT, - AU1000_IRDA_TX_INT, /* au1000 */ - AU1000_IRDA_RX_INT, /* au1000 */ - AU1000_USB_DEV_REQ_INT, - AU1000_USB_DEV_SUS_INT, - AU1000_USB_HOST_INT, - AU1000_ACSYNC_INT, - AU1000_MAC0_DMA_INT, - AU1000_MAC1_DMA_INT, - AU1000_I2S_UO_INT, /* au1000 */ - AU1000_AC97C_INT, - AU1000_GPIO_0, - AU1000_GPIO_1, - AU1000_GPIO_2, - AU1000_GPIO_3, - AU1000_GPIO_4, - AU1000_GPIO_5, - AU1000_GPIO_6, - AU1000_GPIO_7, - AU1000_GPIO_8, - AU1000_GPIO_9, - AU1000_GPIO_10, - AU1000_GPIO_11, - AU1000_GPIO_12, - AU1000_GPIO_13, - AU1000_GPIO_14, - AU1000_GPIO_15, - AU1000_GPIO_16, - AU1000_GPIO_17, - AU1000_GPIO_18, - AU1000_GPIO_19, - AU1000_GPIO_20, - AU1000_GPIO_21, - AU1000_GPIO_22, - AU1000_GPIO_23, - AU1000_GPIO_24, - AU1000_GPIO_25, - AU1000_GPIO_26, - AU1000_GPIO_27, - AU1000_GPIO_28, - AU1000_GPIO_29, - AU1000_GPIO_30, - AU1000_GPIO_31, -}; +#define AU1000_UART0_INT 0 +#define AU1000_UART1_INT 1 /* au1000 */ +#define AU1000_UART2_INT 2 /* au1000 */ +#define AU1000_UART3_INT 3 +#define AU1000_SSI0_INT 4 /* au1000 */ +#define AU1000_SSI1_INT 5 /* au1000 */ +#define AU1000_DMA_INT_BASE 6 +#define AU1000_TOY_INT 14 +#define AU1000_TOY_MATCH0_INT 15 +#define AU1000_TOY_MATCH1_INT 16 +#define AU1000_TOY_MATCH2_INT 17 +#define AU1000_RTC_INT 18 +#define AU1000_RTC_MATCH0_INT 19 +#define AU1000_RTC_MATCH1_INT 20 +#define AU1000_RTC_MATCH2_INT 21 +#define AU1000_IRDA_TX_INT 22 /* au1000 */ +#define AU1000_IRDA_RX_INT 23 /* au1000 */ +#define AU1000_USB_DEV_REQ_INT 24 +#define AU1000_USB_DEV_SUS_INT 25 +#define AU1000_USB_HOST_INT 26 +#define AU1000_ACSYNC_INT 27 +#define AU1000_MAC0_DMA_INT 28 +#define AU1000_MAC1_DMA_INT 29 +#define AU1000_I2S_UO_INT 30 /* au1000 */ +#define AU1000_AC97C_INT 31 +#define AU1000_GPIO_0 32 +#define AU1000_GPIO_1 33 +#define AU1000_GPIO_2 34 +#define AU1000_GPIO_3 35 +#define AU1000_GPIO_4 36 +#define AU1000_GPIO_5 37 +#define AU1000_GPIO_6 38 +#define AU1000_GPIO_7 39 +#define AU1000_GPIO_8 40 +#define AU1000_GPIO_9 41 +#define AU1000_GPIO_10 42 +#define AU1000_GPIO_11 43 +#define AU1000_GPIO_12 44 +#define AU1000_GPIO_13 45 +#define AU1000_GPIO_14 46 +#define AU1000_GPIO_15 47 +#define AU1000_GPIO_16 48 +#define AU1000_GPIO_17 49 +#define AU1000_GPIO_18 50 +#define AU1000_GPIO_19 51 +#define AU1000_GPIO_20 52 +#define AU1000_GPIO_21 53 +#define AU1000_GPIO_22 54 +#define AU1000_GPIO_23 55 +#define AU1000_GPIO_24 56 +#define AU1000_GPIO_25 57 +#define AU1000_GPIO_26 58 +#define AU1000_GPIO_27 59 +#define AU1000_GPIO_28 60 +#define AU1000_GPIO_29 61 +#define AU1000_GPIO_30 62 +#define AU1000_GPIO_31 63 #define UART0_ADDR 0xB1100000 #define UART1_ADDR 0xB1200000 @@ -604,65 +598,61 @@ enum soc_au1000_ints { /* Au1500 */ #ifdef CONFIG_SOC_AU1500 -enum soc_au1500_ints { - AU1500_FIRST_INT = MIPS_CPU_IRQ_BASE, - AU1500_UART0_INT = AU1500_FIRST_INT, - AU1000_PCI_INTA, /* au1500 */ - AU1000_PCI_INTB, /* au1500 */ - AU1500_UART3_INT, - AU1000_PCI_INTC, /* au1500 */ - AU1000_PCI_INTD, /* au1500 */ - AU1000_DMA_INT_BASE, - - AU1000_TOY_INT = AU1500_FIRST_INT + 14, - AU1000_TOY_MATCH0_INT, - AU1000_TOY_MATCH1_INT, - AU1000_TOY_MATCH2_INT, - AU1000_RTC_INT, - AU1000_RTC_MATCH0_INT, - AU1000_RTC_MATCH1_INT, - AU1000_RTC_MATCH2_INT, - AU1500_PCI_ERR_INT, - AU1000_USB_DEV_REQ_INT, - AU1000_USB_DEV_SUS_INT, - AU1000_USB_HOST_INT, - AU1000_ACSYNC_INT, - AU1500_MAC0_DMA_INT, - AU1500_MAC1_DMA_INT, - AU1000_AC97C_INT = AU1500_FIRST_INT + 31, - AU1000_GPIO_0, - AU1000_GPIO_1, - AU1000_GPIO_2, - AU1000_GPIO_3, - AU1000_GPIO_4, - AU1000_GPIO_5, - AU1000_GPIO_6, - AU1000_GPIO_7, - AU1000_GPIO_8, - AU1000_GPIO_9, - AU1000_GPIO_10, - AU1000_GPIO_11, - AU1000_GPIO_12, - AU1000_GPIO_13, - AU1000_GPIO_14, - AU1000_GPIO_15, - AU1500_GPIO_200, - AU1500_GPIO_201, - AU1500_GPIO_202, - AU1500_GPIO_203, - AU1500_GPIO_20, - AU1500_GPIO_204, - AU1500_GPIO_205, - AU1500_GPIO_23, - AU1500_GPIO_24, - AU1500_GPIO_25, - AU1500_GPIO_26, - AU1500_GPIO_27, - AU1500_GPIO_28, - AU1500_GPIO_206, - AU1500_GPIO_207, - AU1500_GPIO_208_215, -}; +#define AU1500_UART0_INT 0 +#define AU1000_PCI_INTA 1 /* au1500 */ +#define AU1000_PCI_INTB 2 /* au1500 */ +#define AU1500_UART3_INT 3 +#define AU1000_PCI_INTC 4 /* au1500 */ +#define AU1000_PCI_INTD 5 /* au1500 */ +#define AU1000_DMA_INT_BASE 6 +#define AU1000_TOY_INT 14 +#define AU1000_TOY_MATCH0_INT 15 +#define AU1000_TOY_MATCH1_INT 16 +#define AU1000_TOY_MATCH2_INT 17 +#define AU1000_RTC_INT 18 +#define AU1000_RTC_MATCH0_INT 19 +#define AU1000_RTC_MATCH1_INT 20 +#define AU1000_RTC_MATCH2_INT 21 +#define AU1500_PCI_ERR_INT 22 +#define AU1000_USB_DEV_REQ_INT 24 +#define AU1000_USB_DEV_SUS_INT 25 +#define AU1000_USB_HOST_INT 26 +#define AU1000_ACSYNC_INT 27 +#define AU1500_MAC0_DMA_INT 28 +#define AU1500_MAC1_DMA_INT 29 +#define AU1000_AC97C_INT 31 +#define AU1000_GPIO_0 32 +#define AU1000_GPIO_1 33 +#define AU1000_GPIO_2 34 +#define AU1000_GPIO_3 35 +#define AU1000_GPIO_4 36 +#define AU1000_GPIO_5 37 +#define AU1000_GPIO_6 38 +#define AU1000_GPIO_7 39 +#define AU1000_GPIO_8 40 +#define AU1000_GPIO_9 41 +#define AU1000_GPIO_10 42 +#define AU1000_GPIO_11 43 +#define AU1000_GPIO_12 44 +#define AU1000_GPIO_13 45 +#define AU1000_GPIO_14 46 +#define AU1000_GPIO_15 47 +#define AU1500_GPIO_200 48 +#define AU1500_GPIO_201 49 +#define AU1500_GPIO_202 50 +#define AU1500_GPIO_203 51 +#define AU1500_GPIO_20 52 +#define AU1500_GPIO_204 53 +#define AU1500_GPIO_205 54 +#define AU1500_GPIO_23 55 +#define AU1500_GPIO_24 56 +#define AU1500_GPIO_25 57 +#define AU1500_GPIO_26 58 +#define AU1500_GPIO_27 59 +#define AU1500_GPIO_28 60 +#define AU1500_GPIO_206 61 +#define AU1500_GPIO_207 62 +#define AU1500_GPIO_208_215 63 /* shortcuts */ #define INTA AU1000_PCI_INTA @@ -685,67 +675,63 @@ enum soc_au1500_ints { /* Au1100 */ #ifdef CONFIG_SOC_AU1100 -enum soc_au1100_ints { - AU1100_FIRST_INT = MIPS_CPU_IRQ_BASE, - AU1100_UART0_INT, - AU1100_UART1_INT, - AU1100_SD_INT, - AU1100_UART3_INT, - AU1000_SSI0_INT, - AU1000_SSI1_INT, - AU1000_DMA_INT_BASE, - - AU1000_TOY_INT = AU1100_FIRST_INT + 14, - AU1000_TOY_MATCH0_INT, - AU1000_TOY_MATCH1_INT, - AU1000_TOY_MATCH2_INT, - AU1000_RTC_INT, - AU1000_RTC_MATCH0_INT, - AU1000_RTC_MATCH1_INT, - AU1000_RTC_MATCH2_INT, - AU1000_IRDA_TX_INT, - AU1000_IRDA_RX_INT, - AU1000_USB_DEV_REQ_INT, - AU1000_USB_DEV_SUS_INT, - AU1000_USB_HOST_INT, - AU1000_ACSYNC_INT, - AU1100_MAC0_DMA_INT, - AU1100_GPIO_208_215, - AU1100_LCD_INT, - AU1000_AC97C_INT, - AU1000_GPIO_0, - AU1000_GPIO_1, - AU1000_GPIO_2, - AU1000_GPIO_3, - AU1000_GPIO_4, - AU1000_GPIO_5, - AU1000_GPIO_6, - AU1000_GPIO_7, - AU1000_GPIO_8, - AU1000_GPIO_9, - AU1000_GPIO_10, - AU1000_GPIO_11, - AU1000_GPIO_12, - AU1000_GPIO_13, - AU1000_GPIO_14, - AU1000_GPIO_15, - AU1000_GPIO_16, - AU1000_GPIO_17, - AU1000_GPIO_18, - AU1000_GPIO_19, - AU1000_GPIO_20, - AU1000_GPIO_21, - AU1000_GPIO_22, - AU1000_GPIO_23, - AU1000_GPIO_24, - AU1000_GPIO_25, - AU1000_GPIO_26, - AU1000_GPIO_27, - AU1000_GPIO_28, - AU1000_GPIO_29, - AU1000_GPIO_30, - AU1000_GPIO_31, -}; +#define AU1100_UART0_INT 0 +#define AU1100_UART1_INT 1 +#define AU1100_SD_INT 2 +#define AU1100_UART3_INT 3 +#define AU1000_SSI0_INT 4 +#define AU1000_SSI1_INT 5 +#define AU1000_DMA_INT_BASE 6 +#define AU1000_TOY_INT 14 +#define AU1000_TOY_MATCH0_INT 15 +#define AU1000_TOY_MATCH1_INT 16 +#define AU1000_TOY_MATCH2_INT 17 +#define AU1000_RTC_INT 18 +#define AU1000_RTC_MATCH0_INT 19 +#define AU1000_RTC_MATCH1_INT 20 +#define AU1000_RTC_MATCH2_INT 21 +#define AU1000_IRDA_TX_INT 22 +#define AU1000_IRDA_RX_INT 23 +#define AU1000_USB_DEV_REQ_INT 24 +#define AU1000_USB_DEV_SUS_INT 25 +#define AU1000_USB_HOST_INT 26 +#define AU1000_ACSYNC_INT 27 +#define AU1100_MAC0_DMA_INT 28 +#define AU1100_GPIO_208_215 29 +#define AU1100_LCD_INT 30 +#define AU1000_AC97C_INT 31 +#define AU1000_GPIO_0 32 +#define AU1000_GPIO_1 33 +#define AU1000_GPIO_2 34 +#define AU1000_GPIO_3 35 +#define AU1000_GPIO_4 36 +#define AU1000_GPIO_5 37 +#define AU1000_GPIO_6 38 +#define AU1000_GPIO_7 39 +#define AU1000_GPIO_8 40 +#define AU1000_GPIO_9 41 +#define AU1000_GPIO_10 42 +#define AU1000_GPIO_11 43 +#define AU1000_GPIO_12 44 +#define AU1000_GPIO_13 45 +#define AU1000_GPIO_14 46 +#define AU1000_GPIO_15 47 +#define AU1000_GPIO_16 48 +#define AU1000_GPIO_17 49 +#define AU1000_GPIO_18 50 +#define AU1000_GPIO_19 51 +#define AU1000_GPIO_20 52 +#define AU1000_GPIO_21 53 +#define AU1000_GPIO_22 54 +#define AU1000_GPIO_23 55 +#define AU1000_GPIO_24 56 +#define AU1000_GPIO_25 57 +#define AU1000_GPIO_26 58 +#define AU1000_GPIO_27 59 +#define AU1000_GPIO_28 60 +#define AU1000_GPIO_29 61 +#define AU1000_GPIO_30 62 +#define AU1000_GPIO_31 63 #define UART0_ADDR 0xB1100000 #define UART1_ADDR 0xB1200000 @@ -760,73 +746,69 @@ enum soc_au1100_ints { #endif /* CONFIG_SOC_AU1100 */ #ifdef CONFIG_SOC_AU1550 -enum soc_au1550_ints { - AU1550_FIRST_INT = MIPS_CPU_IRQ_BASE, - AU1550_UART0_INT = AU1550_FIRST_INT, - AU1550_PCI_INTA, - AU1550_PCI_INTB, - AU1550_DDMA_INT, - AU1550_CRYPTO_INT, - AU1550_PCI_INTC, - AU1550_PCI_INTD, - AU1550_PCI_RST_INT, - AU1550_UART1_INT, - AU1550_UART3_INT, - AU1550_PSC0_INT, - AU1550_PSC1_INT, - AU1550_PSC2_INT, - AU1550_PSC3_INT, - AU1000_TOY_INT, - AU1000_TOY_MATCH0_INT, - AU1000_TOY_MATCH1_INT, - AU1000_TOY_MATCH2_INT, - AU1000_RTC_INT, - AU1000_RTC_MATCH0_INT, - AU1000_RTC_MATCH1_INT, - AU1000_RTC_MATCH2_INT, - - AU1550_NAND_INT = AU1550_FIRST_INT + 23, - AU1550_USB_DEV_REQ_INT, - AU1000_USB_DEV_REQ_INT = AU1550_USB_DEV_REQ_INT, - AU1550_USB_DEV_SUS_INT, - AU1000_USB_DEV_SUS_INT = AU1550_USB_DEV_SUS_INT, - AU1550_USB_HOST_INT, - AU1000_USB_HOST_INT = AU1550_USB_HOST_INT, - AU1550_MAC0_DMA_INT, - AU1550_MAC1_DMA_INT, - AU1000_GPIO_0 = AU1550_FIRST_INT + 32, - AU1000_GPIO_1, - AU1000_GPIO_2, - AU1000_GPIO_3, - AU1000_GPIO_4, - AU1000_GPIO_5, - AU1000_GPIO_6, - AU1000_GPIO_7, - AU1000_GPIO_8, - AU1000_GPIO_9, - AU1000_GPIO_10, - AU1000_GPIO_11, - AU1000_GPIO_12, - AU1000_GPIO_13, - AU1000_GPIO_14, - AU1000_GPIO_15, - AU1550_GPIO_200, - AU1500_GPIO_201_205, /* Logical or of GPIO201:205 */ - AU1500_GPIO_16, - AU1500_GPIO_17, - AU1500_GPIO_20, - AU1500_GPIO_21, - AU1500_GPIO_22, - AU1500_GPIO_23, - AU1500_GPIO_24, - AU1500_GPIO_25, - AU1500_GPIO_26, - AU1500_GPIO_27, - AU1500_GPIO_28, - AU1500_GPIO_206, - AU1500_GPIO_207, - AU1500_GPIO_208_218, /* Logical or of GPIO208:218 */ -}; +#define AU1550_UART0_INT 0 +#define AU1550_PCI_INTA 1 +#define AU1550_PCI_INTB 2 +#define AU1550_DDMA_INT 3 +#define AU1550_CRYPTO_INT 4 +#define AU1550_PCI_INTC 5 +#define AU1550_PCI_INTD 6 +#define AU1550_PCI_RST_INT 7 +#define AU1550_UART1_INT 8 +#define AU1550_UART3_INT 9 +#define AU1550_PSC0_INT 10 +#define AU1550_PSC1_INT 11 +#define AU1550_PSC2_INT 12 +#define AU1550_PSC3_INT 13 +#define AU1000_TOY_INT 14 +#define AU1000_TOY_MATCH0_INT 15 +#define AU1000_TOY_MATCH1_INT 16 +#define AU1000_TOY_MATCH2_INT 17 +#define AU1000_RTC_INT 18 +#define AU1000_RTC_MATCH0_INT 19 +#define AU1000_RTC_MATCH1_INT 20 +#define AU1000_RTC_MATCH2_INT 21 +#define AU1550_NAND_INT 23 +#define AU1550_USB_DEV_REQ_INT 24 +#define AU1550_USB_DEV_SUS_INT 25 +#define AU1550_USB_HOST_INT 26 +#define AU1000_USB_DEV_REQ_INT AU1550_USB_DEV_REQ_INT +#define AU1000_USB_DEV_SUS_INT AU1550_USB_DEV_SUS_INT +#define AU1000_USB_HOST_INT AU1550_USB_HOST_INT +#define AU1550_MAC0_DMA_INT 27 +#define AU1550_MAC1_DMA_INT 28 +#define AU1000_GPIO_0 32 +#define AU1000_GPIO_1 33 +#define AU1000_GPIO_2 34 +#define AU1000_GPIO_3 35 +#define AU1000_GPIO_4 36 +#define AU1000_GPIO_5 37 +#define AU1000_GPIO_6 38 +#define AU1000_GPIO_7 39 +#define AU1000_GPIO_8 40 +#define AU1000_GPIO_9 41 +#define AU1000_GPIO_10 42 +#define AU1000_GPIO_11 43 +#define AU1000_GPIO_12 44 +#define AU1000_GPIO_13 45 +#define AU1000_GPIO_14 46 +#define AU1000_GPIO_15 47 +#define AU1550_GPIO_200 48 +#define AU1500_GPIO_201_205 49 // Logical or of GPIO201:205 +#define AU1500_GPIO_16 50 +#define AU1500_GPIO_17 51 +#define AU1500_GPIO_20 52 +#define AU1500_GPIO_21 53 +#define AU1500_GPIO_22 54 +#define AU1500_GPIO_23 55 +#define AU1500_GPIO_24 56 +#define AU1500_GPIO_25 57 +#define AU1500_GPIO_26 58 +#define AU1500_GPIO_27 59 +#define AU1500_GPIO_28 60 +#define AU1500_GPIO_206 61 +#define AU1500_GPIO_207 62 +#define AU1500_GPIO_208_218 63 // Logical or of GPIO208:218 /* shortcuts */ #define INTA AU1550_PCI_INTA @@ -850,74 +832,70 @@ enum soc_au1550_ints { #endif /* CONFIG_SOC_AU1550 */ #ifdef CONFIG_SOC_AU1200 -enum soc_au1200_ints { - AU1200_FIRST_INT = MIPS_CPU_IRQ_BASE, - AU1200_UART0_INT = AU1200_FIRST_INT, - AU1200_SWT_INT, - AU1200_SD_INT, - AU1200_DDMA_INT, - AU1200_MAE_BE_INT, - AU1200_GPIO_200, - AU1200_GPIO_201, - AU1200_GPIO_202, - AU1200_UART1_INT, - AU1200_MAE_FE_INT, - AU1200_PSC0_INT, - AU1200_PSC1_INT, - AU1200_AES_INT, - AU1200_CAMERA_INT, - AU1000_TOY_INT, - AU1000_TOY_MATCH0_INT, - AU1000_TOY_MATCH1_INT, - AU1000_TOY_MATCH2_INT, - AU1000_RTC_INT, - AU1000_RTC_MATCH0_INT, - AU1000_RTC_MATCH1_INT, - AU1000_RTC_MATCH2_INT, - - AU1200_NAND_INT = AU1200_FIRST_INT + 23, - AU1200_GPIO_204, - AU1200_GPIO_205, - AU1200_GPIO_206, - AU1200_GPIO_207, - AU1200_GPIO_208_215, /* Logical OR of 208:215 */ - AU1200_USB_INT, - AU1000_USB_HOST_INT = AU1200_USB_INT, - AU1200_LCD_INT, - AU1200_MAE_BOTH_INT, - AU1000_GPIO_0, - AU1000_GPIO_1, - AU1000_GPIO_2, - AU1000_GPIO_3, - AU1000_GPIO_4, - AU1000_GPIO_5, - AU1000_GPIO_6, - AU1000_GPIO_7, - AU1000_GPIO_8, - AU1000_GPIO_9, - AU1000_GPIO_10, - AU1000_GPIO_11, - AU1000_GPIO_12, - AU1000_GPIO_13, - AU1000_GPIO_14, - AU1000_GPIO_15, - AU1000_GPIO_16, - AU1000_GPIO_17, - AU1000_GPIO_18, - AU1000_GPIO_19, - AU1000_GPIO_20, - AU1000_GPIO_21, - AU1000_GPIO_22, - AU1000_GPIO_23, - AU1000_GPIO_24, - AU1000_GPIO_25, - AU1000_GPIO_26, - AU1000_GPIO_27, - AU1000_GPIO_28, - AU1000_GPIO_29, - AU1000_GPIO_30, - AU1000_GPIO_31, -}; +#define AU1200_UART0_INT 0 +#define AU1200_SWT_INT 1 +#define AU1200_SD_INT 2 +#define AU1200_DDMA_INT 3 +#define AU1200_MAE_BE_INT 4 +#define AU1200_GPIO_200 5 +#define AU1200_GPIO_201 6 +#define AU1200_GPIO_202 7 +#define AU1200_UART1_INT 8 +#define AU1200_MAE_FE_INT 9 +#define AU1200_PSC0_INT 10 +#define AU1200_PSC1_INT 11 +#define AU1200_AES_INT 12 +#define AU1200_CAMERA_INT 13 +#define AU1000_TOY_INT 14 +#define AU1000_TOY_MATCH0_INT 15 +#define AU1000_TOY_MATCH1_INT 16 +#define AU1000_TOY_MATCH2_INT 17 +#define AU1000_RTC_INT 18 +#define AU1000_RTC_MATCH0_INT 19 +#define AU1000_RTC_MATCH1_INT 20 +#define AU1000_RTC_MATCH2_INT 21 +#define AU1200_NAND_INT 23 +#define AU1200_GPIO_204 24 +#define AU1200_GPIO_205 25 +#define AU1200_GPIO_206 26 +#define AU1200_GPIO_207 27 +#define AU1200_GPIO_208_215 28 // Logical OR of 208:215 +#define AU1200_USB_INT 29 +#define AU1000_USB_HOST_INT AU1200_USB_INT +#define AU1200_LCD_INT 30 +#define AU1200_MAE_BOTH_INT 31 +#define AU1000_GPIO_0 32 +#define AU1000_GPIO_1 33 +#define AU1000_GPIO_2 34 +#define AU1000_GPIO_3 35 +#define AU1000_GPIO_4 36 +#define AU1000_GPIO_5 37 +#define AU1000_GPIO_6 38 +#define AU1000_GPIO_7 39 +#define AU1000_GPIO_8 40 +#define AU1000_GPIO_9 41 +#define AU1000_GPIO_10 42 +#define AU1000_GPIO_11 43 +#define AU1000_GPIO_12 44 +#define AU1000_GPIO_13 45 +#define AU1000_GPIO_14 46 +#define AU1000_GPIO_15 47 +#define AU1000_GPIO_16 48 +#define AU1000_GPIO_17 49 +#define AU1000_GPIO_18 50 +#define AU1000_GPIO_19 51 +#define AU1000_GPIO_20 52 +#define AU1000_GPIO_21 53 +#define AU1000_GPIO_22 54 +#define AU1000_GPIO_23 55 +#define AU1000_GPIO_24 56 +#define AU1000_GPIO_25 57 +#define AU1000_GPIO_26 58 +#define AU1000_GPIO_27 59 +#define AU1000_GPIO_28 60 +#define AU1000_GPIO_29 61 +#define AU1000_GPIO_30 62 +#define AU1000_GPIO_31 63 #define UART0_ADDR 0xB1100000 #define UART1_ADDR 0xB1200000 @@ -948,12 +926,10 @@ enum soc_au1200_ints { #endif /* CONFIG_SOC_AU1200 */ -#define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 0) -#define AU1000_INTC0_INT_LAST (MIPS_CPU_IRQ_BASE + 31) -#define AU1000_INTC1_INT_BASE (MIPS_CPU_IRQ_BASE + 32) -#define AU1000_INTC1_INT_LAST (MIPS_CPU_IRQ_BASE + 63) -#define AU1000_MAX_INTR (MIPS_CPU_IRQ_BASE + 63) -#define INTX 0xFF /* not valid */ +#define AU1000_LAST_INTC0_INT 31 +#define AU1000_LAST_INTC1_INT 63 +#define AU1000_MAX_INTR 63 +#define INTX 0xFF /* not valid */ /* Programmable Counters 0 and 1 */ #define SYS_BASE 0xB1900000 diff --git a/trunk/include/asm-mips/mach-db1x00/db1200.h b/trunk/include/asm-mips/mach-db1x00/db1200.h index 050eae87ff01..647fdb54cc1d 100644 --- a/trunk/include/asm-mips/mach-db1x00/db1200.h +++ b/trunk/include/asm-mips/mach-db1x00/db1200.h @@ -181,34 +181,29 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; #define NAND_PHYS_ADDR 0x20000000 /* - * External Interrupts for Pb1200 as of 8/6/2004. - * Bit positions in the CPLD registers can be calculated by taking - * the interrupt define and subtracting the DB1200_INT_BEGIN value. - * - * Example: IDE bis pos is = 64 - 64 - * ETH bit pos is = 65 - 64 + * External Interrupts for Pb1200 as of 8/6/2004. + * Bit positions in the CPLD registers can be calculated by taking + * the interrupt define and subtracting the DB1200_INT_BEGIN value. + * *example: IDE bis pos is = 64 - 64 + ETH bit pos is = 65 - 64 */ -enum external_pb1200_ints { - DB1200_INT_BEGIN = AU1000_MAX_INTR + 1, - - DB1200_IDE_INT = DB1200_INT_BEGIN, - DB1200_ETH_INT, - DB1200_PC0_INT, - DB1200_PC0_STSCHG_INT, - DB1200_PC1_INT, - DB1200_PC1_STSCHG_INT, - DB1200_DC_INT, - DB1200_FLASHBUSY_INT, - DB1200_PC0_INSERT_INT, - DB1200_PC0_EJECT_INT, - DB1200_PC1_INSERT_INT, - DB1200_PC1_EJECT_INT, - DB1200_SD0_INSERT_INT, - DB1200_SD0_EJECT_INT, - - DB1200_INT_END = DB1200_INT_BEGIN + 15, -}; - +#define DB1200_INT_BEGIN (AU1000_LAST_INTC1_INT + 1) +#define DB1200_IDE_INT (DB1200_INT_BEGIN + 0) +#define DB1200_ETH_INT (DB1200_INT_BEGIN + 1) +#define DB1200_PC0_INT (DB1200_INT_BEGIN + 2) +#define DB1200_PC0_STSCHG_INT (DB1200_INT_BEGIN + 3) +#define DB1200_PC1_INT (DB1200_INT_BEGIN + 4) +#define DB1200_PC1_STSCHG_INT (DB1200_INT_BEGIN + 5) +#define DB1200_DC_INT (DB1200_INT_BEGIN + 6) +#define DB1200_FLASHBUSY_INT (DB1200_INT_BEGIN + 7) +#define DB1200_PC0_INSERT_INT (DB1200_INT_BEGIN + 8) +#define DB1200_PC0_EJECT_INT (DB1200_INT_BEGIN + 9) +#define DB1200_PC1_INSERT_INT (DB1200_INT_BEGIN + 10) +#define DB1200_PC1_EJECT_INT (DB1200_INT_BEGIN + 11) +#define DB1200_SD0_INSERT_INT (DB1200_INT_BEGIN + 12) +#define DB1200_SD0_EJECT_INT (DB1200_INT_BEGIN + 13) + +#define DB1200_INT_END (DB1200_INT_BEGIN + 15) /* For drivers/pcmcia/au1000_db1x00.c */ diff --git a/trunk/include/asm-mips/mach-pb1x00/pb1200.h b/trunk/include/asm-mips/mach-pb1x00/pb1200.h index d9f384acfea9..409d443322c1 100644 --- a/trunk/include/asm-mips/mach-pb1x00/pb1200.h +++ b/trunk/include/asm-mips/mach-pb1x00/pb1200.h @@ -217,35 +217,31 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR; /* - * External Interrupts for Pb1200 as of 8/6/2004. - * Bit positions in the CPLD registers can be calculated by taking - * the interrupt define and subtracting the PB1200_INT_BEGIN value. - * - * Example: IDE bis pos is = 64 - 64 - * ETH bit pos is = 65 - 64 + * External Interrupts for Pb1200 as of 8/6/2004. + * Bit positions in the CPLD registers can be calculated by taking + * the interrupt define and subtracting the PB1200_INT_BEGIN value. + * *example: IDE bis pos is = 64 - 64 + ETH bit pos is = 65 - 64 */ -enum external_pb1200_ints { - PB1200_INT_BEGIN = AU1000_MAX_INTR + 1, - - PB1200_IDE_INT = PB1200_INT_BEGIN, - PB1200_ETH_INT, - PB1200_PC0_INT, - PB1200_PC0_STSCHG_INT, - PB1200_PC1_INT, - PB1200_PC1_STSCHG_INT, - PB1200_DC_INT, - PB1200_FLASHBUSY_INT, - PB1200_PC0_INSERT_INT, - PB1200_PC0_EJECT_INT, - PB1200_PC1_INSERT_INT, - PB1200_PC1_EJECT_INT, - PB1200_SD0_INSERT_INT, - PB1200_SD0_EJECT_INT, - PB1200_SD1_INSERT_INT, - PB1200_SD1_EJECT_INT, - - PB1200_INT_END (PB1200_INT_BEGIN + 15) -}; +#define PB1200_INT_BEGIN (AU1000_LAST_INTC1_INT + 1) +#define PB1200_IDE_INT (PB1200_INT_BEGIN + 0) +#define PB1200_ETH_INT (PB1200_INT_BEGIN + 1) +#define PB1200_PC0_INT (PB1200_INT_BEGIN + 2) +#define PB1200_PC0_STSCHG_INT (PB1200_INT_BEGIN + 3) +#define PB1200_PC1_INT (PB1200_INT_BEGIN + 4) +#define PB1200_PC1_STSCHG_INT (PB1200_INT_BEGIN + 5) +#define PB1200_DC_INT (PB1200_INT_BEGIN + 6) +#define PB1200_FLASHBUSY_INT (PB1200_INT_BEGIN + 7) +#define PB1200_PC0_INSERT_INT (PB1200_INT_BEGIN + 8) +#define PB1200_PC0_EJECT_INT (PB1200_INT_BEGIN + 9) +#define PB1200_PC1_INSERT_INT (PB1200_INT_BEGIN + 10) +#define PB1200_PC1_EJECT_INT (PB1200_INT_BEGIN + 11) +#define PB1200_SD0_INSERT_INT (PB1200_INT_BEGIN + 12) +#define PB1200_SD0_EJECT_INT (PB1200_INT_BEGIN + 13) +#define PB1200_SD1_INSERT_INT (PB1200_INT_BEGIN + 14) +#define PB1200_SD1_EJECT_INT (PB1200_INT_BEGIN + 15) + +#define PB1200_INT_END (PB1200_INT_BEGIN + 15) /* For drivers/pcmcia/au1000_db1x00.c */ #define BOARD_PC0_INT PB1200_PC0_INT diff --git a/trunk/include/asm-um/alternative-asm.h b/trunk/include/asm-um/alternative-asm.i similarity index 65% rename from trunk/include/asm-um/alternative-asm.h rename to trunk/include/asm-um/alternative-asm.i index 9aa9fa2402a4..cae9faca132f 100644 --- a/trunk/include/asm-um/alternative-asm.h +++ b/trunk/include/asm-um/alternative-asm.i @@ -1,6 +1,6 @@ #ifndef __UM_ALTERNATIVE_ASM_I #define __UM_ALTERNATIVE_ASM_I -#include "asm/arch/alternative-asm.h" +#include "asm/arch/alternative-asm.i" #endif diff --git a/trunk/include/asm-um/frame.h b/trunk/include/asm-um/frame.i similarity index 64% rename from trunk/include/asm-um/frame.h rename to trunk/include/asm-um/frame.i index 8a8c1cb415b4..09d5dca5d928 100644 --- a/trunk/include/asm-um/frame.h +++ b/trunk/include/asm-um/frame.i @@ -1,6 +1,6 @@ #ifndef __UM_FRAME_I #define __UM_FRAME_I -#include "asm/arch/frame.h" +#include "asm/arch/frame.i" #endif diff --git a/trunk/include/asm-x86/Kbuild b/trunk/include/asm-x86/Kbuild index 559830ece755..80744dbcfafd 100644 --- a/trunk/include/asm-x86/Kbuild +++ b/trunk/include/asm-x86/Kbuild @@ -1,22 +1,40 @@ include include/asm-generic/Kbuild.asm header-y += boot.h +header-y += debugreg_32.h +header-y += debugreg_64.h header-y += debugreg.h +header-y += ldt_32.h +header-y += ldt_64.h header-y += ldt.h header-y += msr-index.h header-y += prctl.h +header-y += ptrace-abi_32.h +header-y += ptrace-abi_64.h header-y += ptrace-abi.h header-y += sigcontext32.h +header-y += ucontext_32.h +header-y += ucontext_64.h header-y += ucontext.h header-y += vsyscall32.h unifdef-y += a.out_32.h unifdef-y += a.out_64.h +unifdef-y += auxvec_32.h +unifdef-y += auxvec_64.h unifdef-y += byteorder_32.h unifdef-y += byteorder_64.h unifdef-y += elf_32.h unifdef-y += elf_64.h +unifdef-y += errno_32.h +unifdef-y += errno_64.h +unifdef-y += ioctls_32.h +unifdef-y += ioctls_64.h +unifdef-y += ipcbuf_32.h +unifdef-y += ipcbuf_64.h unifdef-y += mce.h +unifdef-y += mman_32.h +unifdef-y += mman_64.h unifdef-y += msgbuf_32.h unifdef-y += msgbuf_64.h unifdef-y += msr_32.h @@ -27,22 +45,40 @@ unifdef-y += mtrr_64.h unifdef-y += mtrr.h unifdef-y += page_32.h unifdef-y += page_64.h +unifdef-y += param_32.h +unifdef-y += param_64.h unifdef-y += posix_types_32.h unifdef-y += posix_types_64.h unifdef-y += ptrace_32.h unifdef-y += ptrace_64.h +unifdef-y += resource_32.h +unifdef-y += resource_64.h +unifdef-y += sembuf_32.h +unifdef-y += sembuf_64.h unifdef-y += setup_32.h unifdef-y += setup_64.h unifdef-y += shmbuf_32.h unifdef-y += shmbuf_64.h +unifdef-y += shmparam_32.h +unifdef-y += shmparam_64.h unifdef-y += sigcontext_32.h unifdef-y += sigcontext_64.h +unifdef-y += siginfo_32.h +unifdef-y += siginfo_64.h unifdef-y += signal_32.h unifdef-y += signal_64.h +unifdef-y += sockios_32.h +unifdef-y += sockios_64.h unifdef-y += stat_32.h unifdef-y += stat_64.h unifdef-y += statfs_32.h unifdef-y += statfs_64.h +unifdef-y += termbits_32.h +unifdef-y += termbits_64.h +unifdef-y += termios_32.h +unifdef-y += termios_64.h +unifdef-y += types_32.h +unifdef-y += types_64.h unifdef-y += unistd_32.h unifdef-y += unistd_64.h unifdef-y += user_32.h diff --git a/trunk/include/asm-x86/agp.h b/trunk/include/asm-x86/agp.h index 62df2a9e7130..9348f1e4f6f1 100644 --- a/trunk/include/asm-x86/agp.h +++ b/trunk/include/asm-x86/agp.h @@ -1,40 +1,5 @@ -#ifndef _ASM_X86_AGP_H -#define _ASM_X86_AGP_H - -#include -#include - -/* - * Functions to keep the agpgart mappings coherent with the MMU. The - * GART gives the CPU a physical alias of pages in memory. The alias - * region is mapped uncacheable. Make sure there are no conflicting - * mappings with different cachability attributes for the same - * page. This avoids data corruption on some CPUs. - */ - -/* - * Caller's responsibility to call global_flush_tlb() for performance - * reasons - */ -#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE) -#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL) -#define flush_agp_mappings() global_flush_tlb() - -/* - * Could use CLFLUSH here if the cpu supports it. But then it would - * need to be called for each cacheline of the whole page so it may - * not be worth it. Would need a page for it. - */ -#define flush_agp_cache() wbinvd() - -/* Convert a physical address to an address suitable for the GART. */ -#define phys_to_gart(x) (x) -#define gart_to_phys(x) (x) - -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - +#ifdef CONFIG_X86_32 +# include "agp_32.h" +#else +# include "agp_64.h" #endif diff --git a/trunk/include/asm-x86/agp_32.h b/trunk/include/asm-x86/agp_32.h new file mode 100644 index 000000000000..6af173dbf123 --- /dev/null +++ b/trunk/include/asm-x86/agp_32.h @@ -0,0 +1,36 @@ +#ifndef AGP_H +#define AGP_H 1 + +#include +#include + +/* + * Functions to keep the agpgart mappings coherent with the MMU. + * The GART gives the CPU a physical alias of pages in memory. The alias region is + * mapped uncacheable. Make sure there are no conflicting mappings + * with different cachability attributes for the same page. This avoids + * data corruption on some CPUs. + */ + +/* Caller's responsibility to call global_flush_tlb() for + * performance reasons */ +#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE) +#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL) +#define flush_agp_mappings() global_flush_tlb() + +/* Could use CLFLUSH here if the cpu supports it. But then it would + need to be called for each cacheline of the whole page so it may not be + worth it. Would need a page for it. */ +#define flush_agp_cache() wbinvd() + +/* Convert a physical address to an address suitable for the GART. */ +#define phys_to_gart(x) (x) +#define gart_to_phys(x) (x) + +/* GATT allocation. Returns/accepts GATT kernel virtual address. */ +#define alloc_gatt_pages(order) \ + ((char *)__get_free_pages(GFP_KERNEL, (order))) +#define free_gatt_pages(table, order) \ + free_pages((unsigned long)(table), (order)) + +#endif diff --git a/trunk/include/asm-x86/agp_64.h b/trunk/include/asm-x86/agp_64.h new file mode 100644 index 000000000000..de338666f3f9 --- /dev/null +++ b/trunk/include/asm-x86/agp_64.h @@ -0,0 +1,34 @@ +#ifndef AGP_H +#define AGP_H 1 + +#include + +/* + * Functions to keep the agpgart mappings coherent. + * The GART gives the CPU a physical alias of memory. The alias is + * mapped uncacheable. Make sure there are no conflicting mappings + * with different cachability attributes for the same page. + */ + +/* Caller's responsibility to call global_flush_tlb() for + * performance reasons */ +#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE) +#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL) +#define flush_agp_mappings() global_flush_tlb() + +/* Could use CLFLUSH here if the cpu supports it. But then it would + need to be called for each cacheline of the whole page so it may not be + worth it. Would need a page for it. */ +#define flush_agp_cache() asm volatile("wbinvd":::"memory") + +/* Convert a physical address to an address suitable for the GART. */ +#define phys_to_gart(x) (x) +#define gart_to_phys(x) (x) + +/* GATT allocation. Returns/accepts GATT kernel virtual address. */ +#define alloc_gatt_pages(order) \ + ((char *)__get_free_pages(GFP_KERNEL, (order))) +#define free_gatt_pages(table, order) \ + free_pages((unsigned long)(table), (order)) + +#endif diff --git a/trunk/include/asm-x86/alternative-asm.h b/trunk/include/asm-x86/alternative-asm.h deleted file mode 100644 index e2077d343c33..000000000000 --- a/trunk/include/asm-x86/alternative-asm.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef __ASSEMBLY__ - -#ifdef CONFIG_X86_32 -# define X86_ALIGN .long -#else -# define X86_ALIGN .quad -#endif - -#ifdef CONFIG_SMP - .macro LOCK_PREFIX -1: lock - .section .smp_locks,"a" - .align 4 - X86_ALIGN 1b - .previous - .endm -#else - .macro LOCK_PREFIX - .endm -#endif - -#endif /* __ASSEMBLY__ */ diff --git a/trunk/include/asm-x86/alternative-asm.i b/trunk/include/asm-x86/alternative-asm.i new file mode 100644 index 000000000000..4f360cd3c888 --- /dev/null +++ b/trunk/include/asm-x86/alternative-asm.i @@ -0,0 +1,5 @@ +#ifdef CONFIG_X86_32 +# include "alternative-asm_32.i" +#else +# include "alternative-asm_64.i" +#endif diff --git a/trunk/include/asm-x86/alternative-asm_32.i b/trunk/include/asm-x86/alternative-asm_32.i new file mode 100644 index 000000000000..f0510209ccbe --- /dev/null +++ b/trunk/include/asm-x86/alternative-asm_32.i @@ -0,0 +1,12 @@ +#ifdef CONFIG_SMP + .macro LOCK_PREFIX +1: lock + .section .smp_locks,"a" + .align 4 + .long 1b + .previous + .endm +#else + .macro LOCK_PREFIX + .endm +#endif diff --git a/trunk/include/asm-x86/alternative-asm_64.i b/trunk/include/asm-x86/alternative-asm_64.i new file mode 100644 index 000000000000..0b3f1a2bb2cb --- /dev/null +++ b/trunk/include/asm-x86/alternative-asm_64.i @@ -0,0 +1,12 @@ +#ifdef CONFIG_SMP + .macro LOCK_PREFIX +1: lock + .section .smp_locks,"a" + .align 8 + .quad 1b + .previous + .endm +#else + .macro LOCK_PREFIX + .endm +#endif diff --git a/trunk/include/asm-x86/atomic_64.h b/trunk/include/asm-x86/atomic_64.h index 2d20a7a19f62..f2e64634fa48 100644 --- a/trunk/include/asm-x86/atomic_64.h +++ b/trunk/include/asm-x86/atomic_64.h @@ -206,7 +206,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v) /* An 64bit atomic type */ -typedef struct { long counter; } atomic64_t; +typedef struct { volatile long counter; } atomic64_t; #define ATOMIC64_INIT(i) { (i) } diff --git a/trunk/include/asm-x86/auxvec.h b/trunk/include/asm-x86/auxvec.h index 87f5e6d5a020..7ff866f829ca 100644 --- a/trunk/include/asm-x86/auxvec.h +++ b/trunk/include/asm-x86/auxvec.h @@ -1,12 +1,13 @@ -#ifndef _ASM_X86_AUXVEC_H -#define _ASM_X86_AUXVEC_H -/* - * Architecture-neutral AT_ values in 0-17, leave some room - * for more of them, start the x86-specific ones at 32. - */ -#ifdef __i386__ -#define AT_SYSINFO 32 -#endif -#define AT_SYSINFO_EHDR 33 - +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "auxvec_32.h" +# else +# include "auxvec_64.h" +# endif +#else +# ifdef __i386__ +# include "auxvec_32.h" +# else +# include "auxvec_64.h" +# endif #endif diff --git a/trunk/include/asm-x86/auxvec_32.h b/trunk/include/asm-x86/auxvec_32.h new file mode 100644 index 000000000000..395e13016bfb --- /dev/null +++ b/trunk/include/asm-x86/auxvec_32.h @@ -0,0 +1,11 @@ +#ifndef __ASMi386_AUXVEC_H +#define __ASMi386_AUXVEC_H + +/* + * Architecture-neutral AT_ values in 0-17, leave some room + * for more of them, start the x86-specific ones at 32. + */ +#define AT_SYSINFO 32 +#define AT_SYSINFO_EHDR 33 + +#endif diff --git a/trunk/include/asm-x86/auxvec_64.h b/trunk/include/asm-x86/auxvec_64.h new file mode 100644 index 000000000000..1d5ab0d03950 --- /dev/null +++ b/trunk/include/asm-x86/auxvec_64.h @@ -0,0 +1,6 @@ +#ifndef __ASM_X86_64_AUXVEC_H +#define __ASM_X86_64_AUXVEC_H + +#define AT_SYSINFO_EHDR 33 + +#endif diff --git a/trunk/include/asm-x86/bitops_64.h b/trunk/include/asm-x86/bitops_64.h index 1d7d9b4bcacb..d4dbbe5f7bd9 100644 --- a/trunk/include/asm-x86/bitops_64.h +++ b/trunk/include/asm-x86/bitops_64.h @@ -260,7 +260,7 @@ extern long find_first_bit(const unsigned long * addr, unsigned long size); extern long find_next_bit(const unsigned long * addr, long size, long offset); /* return index of first bet set in val or max when no bit is set */ -static inline long __scanbit(unsigned long val, unsigned long max) +static inline unsigned long __scanbit(unsigned long val, unsigned long max) { asm("bsfq %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max)); return val; diff --git a/trunk/include/asm-x86/bug.h b/trunk/include/asm-x86/bug.h index fd8bdc639c48..c655d7f3a5e0 100644 --- a/trunk/include/asm-x86/bug.h +++ b/trunk/include/asm-x86/bug.h @@ -1,42 +1,5 @@ -#ifndef _ASM_X86_BUG_H -#define _ASM_X86_BUG_H - -#ifdef CONFIG_BUG -#define HAVE_ARCH_BUG - -#ifdef CONFIG_DEBUG_BUGVERBOSE - #ifdef CONFIG_X86_32 -# define __BUG_C0 "2:\t.long 1b, %c0\n" +# include "bug_32.h" #else -# define __BUG_C0 "2:\t.quad 1b, %c0\n" -#endif - -#define BUG() \ - do { \ - asm volatile("1:\tud2\n" \ - ".pushsection __bug_table,\"a\"\n" \ - __BUG_C0 \ - "\t.word %c1, 0\n" \ - "\t.org 2b+%c2\n" \ - ".popsection" \ - : : "i" (__FILE__), "i" (__LINE__), \ - "i" (sizeof(struct bug_entry))); \ - for(;;) ; \ - } while(0) - -#else -#define BUG() \ - do { \ - asm volatile("ud2"); \ - for(;;) ; \ - } while(0) -#endif - -void out_of_line_bug(void); -#else /* CONFIG_BUG */ -static inline void out_of_line_bug(void) { } -#endif /* !CONFIG_BUG */ - -#include +# include "bug_64.h" #endif diff --git a/trunk/include/asm-x86/bug_32.h b/trunk/include/asm-x86/bug_32.h new file mode 100644 index 000000000000..b0fd78ca2619 --- /dev/null +++ b/trunk/include/asm-x86/bug_32.h @@ -0,0 +1,37 @@ +#ifndef _I386_BUG_H +#define _I386_BUG_H + + +/* + * Tell the user there is some problem. + * The offending file and line are encoded encoded in the __bug_table section. + */ + +#ifdef CONFIG_BUG +#define HAVE_ARCH_BUG + +#ifdef CONFIG_DEBUG_BUGVERBOSE +#define BUG() \ + do { \ + asm volatile("1:\tud2\n" \ + ".pushsection __bug_table,\"a\"\n" \ + "2:\t.long 1b, %c0\n" \ + "\t.word %c1, 0\n" \ + "\t.org 2b+%c2\n" \ + ".popsection" \ + : : "i" (__FILE__), "i" (__LINE__), \ + "i" (sizeof(struct bug_entry))); \ + for(;;) ; \ + } while(0) + +#else +#define BUG() \ + do { \ + asm volatile("ud2"); \ + for(;;) ; \ + } while(0) +#endif +#endif + +#include +#endif diff --git a/trunk/include/asm-x86/bug_64.h b/trunk/include/asm-x86/bug_64.h new file mode 100644 index 000000000000..682606414913 --- /dev/null +++ b/trunk/include/asm-x86/bug_64.h @@ -0,0 +1,34 @@ +#ifndef __ASM_X8664_BUG_H +#define __ASM_X8664_BUG_H 1 + +#ifdef CONFIG_BUG +#define HAVE_ARCH_BUG + +#ifdef CONFIG_DEBUG_BUGVERBOSE +#define BUG() \ + do { \ + asm volatile("1:\tud2\n" \ + ".pushsection __bug_table,\"a\"\n" \ + "2:\t.quad 1b, %c0\n" \ + "\t.word %c1, 0\n" \ + "\t.org 2b+%c2\n" \ + ".popsection" \ + : : "i" (__FILE__), "i" (__LINE__), \ + "i" (sizeof(struct bug_entry))); \ + for(;;) ; \ + } while(0) +#else +#define BUG() \ + do { \ + asm volatile("ud2"); \ + for(;;) ; \ + } while(0) +#endif + +void out_of_line_bug(void); +#else +static inline void out_of_line_bug(void) { } +#endif + +#include +#endif diff --git a/trunk/include/asm-x86/bugs.h b/trunk/include/asm-x86/bugs.h index aac8317420af..ddf42d36dd50 100644 --- a/trunk/include/asm-x86/bugs.h +++ b/trunk/include/asm-x86/bugs.h @@ -1,6 +1,5 @@ -#ifndef _ASM_X86_BUGS_H -#define _ASM_X86_BUGS_H - -void check_bugs(void); - -#endif /* _ASM_X86_BUGS_H */ +#ifdef CONFIG_X86_32 +# include "bugs_32.h" +#else +# include "bugs_64.h" +#endif diff --git a/trunk/include/asm-x86/bugs_32.h b/trunk/include/asm-x86/bugs_32.h new file mode 100644 index 000000000000..d28979ff73be --- /dev/null +++ b/trunk/include/asm-x86/bugs_32.h @@ -0,0 +1,12 @@ +/* + * This is included by init/main.c to check for architecture-dependent bugs. + * + * Needs: + * void check_bugs(void); + */ +#ifndef _ASM_I386_BUG_H +#define _ASM_I386_BUG_H + +void check_bugs(void); + +#endif /* _ASM_I386_BUG_H */ diff --git a/trunk/include/asm-x86/bugs_64.h b/trunk/include/asm-x86/bugs_64.h new file mode 100644 index 000000000000..b33dc04d8f42 --- /dev/null +++ b/trunk/include/asm-x86/bugs_64.h @@ -0,0 +1,6 @@ +#ifndef _ASM_X86_64_BUGS_H +#define _ASM_X86_64_BUGS_H + +void check_bugs(void); + +#endif /* _ASM_X86_64_BUGS_H */ diff --git a/trunk/include/asm-x86/cache.h b/trunk/include/asm-x86/cache.h index 1e0bac86f38f..c36d190ac9d8 100644 --- a/trunk/include/asm-x86/cache.h +++ b/trunk/include/asm-x86/cache.h @@ -1,20 +1,5 @@ -#ifndef _ARCH_X86_CACHE_H -#define _ARCH_X86_CACHE_H - -/* L1 cache line size */ -#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) -#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) - -#define __read_mostly __attribute__((__section__(".data.read_mostly"))) - -#ifdef CONFIG_X86_VSMP -/* vSMP Internode cacheline shift */ -#define INTERNODE_CACHE_SHIFT (12) -#ifdef CONFIG_SMP -#define __cacheline_aligned_in_smp \ - __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) \ - __attribute__((__section__(".data.page_aligned"))) -#endif -#endif - +#ifdef CONFIG_X86_32 +# include "cache_32.h" +#else +# include "cache_64.h" #endif diff --git a/trunk/include/asm-x86/cache_32.h b/trunk/include/asm-x86/cache_32.h new file mode 100644 index 000000000000..57c62f414158 --- /dev/null +++ b/trunk/include/asm-x86/cache_32.h @@ -0,0 +1,14 @@ +/* + * include/asm-i386/cache.h + */ +#ifndef __ARCH_I386_CACHE_H +#define __ARCH_I386_CACHE_H + + +/* L1 cache line size */ +#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) +#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) + +#define __read_mostly __attribute__((__section__(".data.read_mostly"))) + +#endif diff --git a/trunk/include/asm-x86/cache_64.h b/trunk/include/asm-x86/cache_64.h new file mode 100644 index 000000000000..052df758ae61 --- /dev/null +++ b/trunk/include/asm-x86/cache_64.h @@ -0,0 +1,26 @@ +/* + * include/asm-x86_64/cache.h + */ +#ifndef __ARCH_X8664_CACHE_H +#define __ARCH_X8664_CACHE_H + + +/* L1 cache line size */ +#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) +#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) + +#ifdef CONFIG_X86_VSMP + +/* vSMP Internode cacheline shift */ +#define INTERNODE_CACHE_SHIFT (12) +#ifdef CONFIG_SMP +#define __cacheline_aligned_in_smp \ + __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) \ + __attribute__((__section__(".data.page_aligned"))) +#endif + +#endif + +#define __read_mostly __attribute__((__section__(".data.read_mostly"))) + +#endif diff --git a/trunk/include/asm-x86/cacheflush.h b/trunk/include/asm-x86/cacheflush.h index b3d43de44c59..e2df3b55034a 100644 --- a/trunk/include/asm-x86/cacheflush.h +++ b/trunk/include/asm-x86/cacheflush.h @@ -1,40 +1,5 @@ -#ifndef _ASM_X86_CACHEFLUSH_H -#define _ASM_X86_CACHEFLUSH_H - -/* Keep includes the same across arches. */ -#include - -/* Caches aren't brain-dead on the intel. */ -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_dup_mm(mm) do { } while (0) -#define flush_cache_range(vma, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) -#define flush_dcache_page(page) do { } while (0) -#define flush_dcache_mmap_lock(mapping) do { } while (0) -#define flush_dcache_mmap_unlock(mapping) do { } while (0) -#define flush_icache_range(start, end) do { } while (0) -#define flush_icache_page(vma,pg) do { } while (0) -#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) -#define flush_cache_vmap(start, end) do { } while (0) -#define flush_cache_vunmap(start, end) do { } while (0) - -#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) -#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) - -void global_flush_tlb(void); -int change_page_attr(struct page *page, int numpages, pgprot_t prot); -int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot); - -#ifdef CONFIG_DEBUG_PAGEALLOC -/* internal debugging function */ -void kernel_map_pages(struct page *page, int numpages, int enable); -#endif - -#ifdef CONFIG_DEBUG_RODATA -void mark_rodata_ro(void); -#endif - +#ifdef CONFIG_X86_32 +# include "cacheflush_32.h" +#else +# include "cacheflush_64.h" #endif diff --git a/trunk/include/asm-x86/cacheflush_32.h b/trunk/include/asm-x86/cacheflush_32.h new file mode 100644 index 000000000000..74e03c8f2e51 --- /dev/null +++ b/trunk/include/asm-x86/cacheflush_32.h @@ -0,0 +1,39 @@ +#ifndef _I386_CACHEFLUSH_H +#define _I386_CACHEFLUSH_H + +/* Keep includes the same across arches. */ +#include + +/* Caches aren't brain-dead on the intel. */ +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_dup_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) +#define flush_icache_page(vma,pg) do { } while (0) +#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + +void global_flush_tlb(void); +int change_page_attr(struct page *page, int numpages, pgprot_t prot); + +#ifdef CONFIG_DEBUG_PAGEALLOC +/* internal debugging function */ +void kernel_map_pages(struct page *page, int numpages, int enable); +#endif + +#ifdef CONFIG_DEBUG_RODATA +void mark_rodata_ro(void); +#endif + +#endif /* _I386_CACHEFLUSH_H */ diff --git a/trunk/include/asm-x86/cacheflush_64.h b/trunk/include/asm-x86/cacheflush_64.h new file mode 100644 index 000000000000..ab1cb5c7dc92 --- /dev/null +++ b/trunk/include/asm-x86/cacheflush_64.h @@ -0,0 +1,35 @@ +#ifndef _X8664_CACHEFLUSH_H +#define _X8664_CACHEFLUSH_H + +/* Keep includes the same across arches. */ +#include + +/* Caches aren't brain-dead on the intel. */ +#define flush_cache_all() do { } while (0) +#define flush_cache_mm(mm) do { } while (0) +#define flush_cache_dup_mm(mm) do { } while (0) +#define flush_cache_range(vma, start, end) do { } while (0) +#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) +#define flush_dcache_page(page) do { } while (0) +#define flush_dcache_mmap_lock(mapping) do { } while (0) +#define flush_dcache_mmap_unlock(mapping) do { } while (0) +#define flush_icache_range(start, end) do { } while (0) +#define flush_icache_page(vma,pg) do { } while (0) +#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) +#define flush_cache_vmap(start, end) do { } while (0) +#define flush_cache_vunmap(start, end) do { } while (0) + +#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) +#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) + +void global_flush_tlb(void); +int change_page_attr(struct page *page, int numpages, pgprot_t prot); +int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot); + +#ifdef CONFIG_DEBUG_RODATA +void mark_rodata_ro(void); +#endif + +#endif /* _X8664_CACHEFLUSH_H */ diff --git a/trunk/include/asm-x86/cpu.h b/trunk/include/asm-x86/cpu.h index b1bc7b1b64b0..9d914e1e4aad 100644 --- a/trunk/include/asm-x86/cpu.h +++ b/trunk/include/asm-x86/cpu.h @@ -13,6 +13,9 @@ struct i386_cpu { extern int arch_register_cpu(int num); #ifdef CONFIG_HOTPLUG_CPU extern void arch_unregister_cpu(int); +extern int enable_cpu_hotplug; +#else +#define enable_cpu_hotplug 0 #endif DECLARE_PER_CPU(int, cpu_state); diff --git a/trunk/include/asm-x86/cputime.h b/trunk/include/asm-x86/cputime.h index 6d68ad7e0ea3..87c37cf6b707 100644 --- a/trunk/include/asm-x86/cputime.h +++ b/trunk/include/asm-x86/cputime.h @@ -1 +1,5 @@ -#include +#ifdef CONFIG_X86_32 +# include "cputime_32.h" +#else +# include "cputime_64.h" +#endif diff --git a/trunk/include/asm-x86/cputime_32.h b/trunk/include/asm-x86/cputime_32.h new file mode 100644 index 000000000000..398ed7cd171d --- /dev/null +++ b/trunk/include/asm-x86/cputime_32.h @@ -0,0 +1,6 @@ +#ifndef __I386_CPUTIME_H +#define __I386_CPUTIME_H + +#include + +#endif /* __I386_CPUTIME_H */ diff --git a/trunk/include/asm-x86/cputime_64.h b/trunk/include/asm-x86/cputime_64.h new file mode 100644 index 000000000000..a07012dc5a3c --- /dev/null +++ b/trunk/include/asm-x86/cputime_64.h @@ -0,0 +1,6 @@ +#ifndef __X86_64_CPUTIME_H +#define __X86_64_CPUTIME_H + +#include + +#endif /* __X86_64_CPUTIME_H */ diff --git a/trunk/include/asm-x86/debugreg.h b/trunk/include/asm-x86/debugreg.h index c6344d572b03..b6ce7e4fa002 100644 --- a/trunk/include/asm-x86/debugreg.h +++ b/trunk/include/asm-x86/debugreg.h @@ -1,70 +1,13 @@ -#ifndef _ASM_X86_DEBUGREG_H -#define _ASM_X86_DEBUGREG_H - - -/* Indicate the register numbers for a number of the specific - debug registers. Registers 0-3 contain the addresses we wish to trap on */ -#define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */ -#define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */ - -#define DR_STATUS 6 /* u_debugreg[DR_STATUS] */ -#define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */ - -/* Define a few things for the status register. We can use this to determine - which debugging register was responsible for the trap. The other bits - are either reserved or not of interest to us. */ - -#define DR_TRAP0 (0x1) /* db0 */ -#define DR_TRAP1 (0x2) /* db1 */ -#define DR_TRAP2 (0x4) /* db2 */ -#define DR_TRAP3 (0x8) /* db3 */ - -#define DR_STEP (0x4000) /* single-step */ -#define DR_SWITCH (0x8000) /* task switch */ - -/* Now define a bunch of things for manipulating the control register. - The top two bytes of the control register consist of 4 fields of 4 - bits - each field corresponds to one of the four debug registers, - and indicates what types of access we trap on, and how large the data - field is that we are looking at */ - -#define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */ -#define DR_CONTROL_SIZE 4 /* 4 control bits per register */ - -#define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */ -#define DR_RW_WRITE (0x1) -#define DR_RW_READ (0x3) - -#define DR_LEN_1 (0x0) /* Settings for data length to trap on */ -#define DR_LEN_2 (0x4) -#define DR_LEN_4 (0xC) -#define DR_LEN_8 (0x8) - -/* The low byte to the control register determine which registers are - enabled. There are 4 fields of two bits. One bit is "local", meaning - that the processor will reset the bit after a task switch and the other - is global meaning that we have to explicitly reset the bit. With linux, - you can use either one, since we explicitly zero the register when we enter - kernel mode. */ - -#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */ -#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */ -#define DR_ENABLE_SIZE 2 /* 2 enable bits per register */ - -#define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */ -#define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */ - -/* The second byte to the control register has a few special things. - We can slow the instruction pipeline for instructions coming via the - gdt or the ldt if we want to. I am not sure why this is an advantage */ - -#ifdef __i386__ -#define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "debugreg_32.h" +# else +# include "debugreg_64.h" +# endif #else -#define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */ -#endif - -#define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ -#define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ - +# ifdef __i386__ +# include "debugreg_32.h" +# else +# include "debugreg_64.h" +# endif #endif diff --git a/trunk/include/asm-x86/debugreg_32.h b/trunk/include/asm-x86/debugreg_32.h new file mode 100644 index 000000000000..f0b2b06ae0f7 --- /dev/null +++ b/trunk/include/asm-x86/debugreg_32.h @@ -0,0 +1,64 @@ +#ifndef _I386_DEBUGREG_H +#define _I386_DEBUGREG_H + + +/* Indicate the register numbers for a number of the specific + debug registers. Registers 0-3 contain the addresses we wish to trap on */ +#define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */ +#define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */ + +#define DR_STATUS 6 /* u_debugreg[DR_STATUS] */ +#define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */ + +/* Define a few things for the status register. We can use this to determine + which debugging register was responsible for the trap. The other bits + are either reserved or not of interest to us. */ + +#define DR_TRAP0 (0x1) /* db0 */ +#define DR_TRAP1 (0x2) /* db1 */ +#define DR_TRAP2 (0x4) /* db2 */ +#define DR_TRAP3 (0x8) /* db3 */ + +#define DR_STEP (0x4000) /* single-step */ +#define DR_SWITCH (0x8000) /* task switch */ + +/* Now define a bunch of things for manipulating the control register. + The top two bytes of the control register consist of 4 fields of 4 + bits - each field corresponds to one of the four debug registers, + and indicates what types of access we trap on, and how large the data + field is that we are looking at */ + +#define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */ +#define DR_CONTROL_SIZE 4 /* 4 control bits per register */ + +#define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */ +#define DR_RW_WRITE (0x1) +#define DR_RW_READ (0x3) + +#define DR_LEN_1 (0x0) /* Settings for data length to trap on */ +#define DR_LEN_2 (0x4) +#define DR_LEN_4 (0xC) + +/* The low byte to the control register determine which registers are + enabled. There are 4 fields of two bits. One bit is "local", meaning + that the processor will reset the bit after a task switch and the other + is global meaning that we have to explicitly reset the bit. With linux, + you can use either one, since we explicitly zero the register when we enter + kernel mode. */ + +#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */ +#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */ +#define DR_ENABLE_SIZE 2 /* 2 enable bits per register */ + +#define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */ +#define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */ + +/* The second byte to the control register has a few special things. + We can slow the instruction pipeline for instructions coming via the + gdt or the ldt if we want to. I am not sure why this is an advantage */ + +#define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */ +#define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ +#define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ + +#endif diff --git a/trunk/include/asm-x86/debugreg_64.h b/trunk/include/asm-x86/debugreg_64.h new file mode 100644 index 000000000000..bd1aab1d8c4a --- /dev/null +++ b/trunk/include/asm-x86/debugreg_64.h @@ -0,0 +1,65 @@ +#ifndef _X86_64_DEBUGREG_H +#define _X86_64_DEBUGREG_H + + +/* Indicate the register numbers for a number of the specific + debug registers. Registers 0-3 contain the addresses we wish to trap on */ +#define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */ +#define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */ + +#define DR_STATUS 6 /* u_debugreg[DR_STATUS] */ +#define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */ + +/* Define a few things for the status register. We can use this to determine + which debugging register was responsible for the trap. The other bits + are either reserved or not of interest to us. */ + +#define DR_TRAP0 (0x1) /* db0 */ +#define DR_TRAP1 (0x2) /* db1 */ +#define DR_TRAP2 (0x4) /* db2 */ +#define DR_TRAP3 (0x8) /* db3 */ + +#define DR_STEP (0x4000) /* single-step */ +#define DR_SWITCH (0x8000) /* task switch */ + +/* Now define a bunch of things for manipulating the control register. + The top two bytes of the control register consist of 4 fields of 4 + bits - each field corresponds to one of the four debug registers, + and indicates what types of access we trap on, and how large the data + field is that we are looking at */ + +#define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */ +#define DR_CONTROL_SIZE 4 /* 4 control bits per register */ + +#define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */ +#define DR_RW_WRITE (0x1) +#define DR_RW_READ (0x3) + +#define DR_LEN_1 (0x0) /* Settings for data length to trap on */ +#define DR_LEN_2 (0x4) +#define DR_LEN_4 (0xC) +#define DR_LEN_8 (0x8) + +/* The low byte to the control register determine which registers are + enabled. There are 4 fields of two bits. One bit is "local", meaning + that the processor will reset the bit after a task switch and the other + is global meaning that we have to explicitly reset the bit. With linux, + you can use either one, since we explicitly zero the register when we enter + kernel mode. */ + +#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */ +#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */ +#define DR_ENABLE_SIZE 2 /* 2 enable bits per register */ + +#define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */ +#define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */ + +/* The second byte to the control register has a few special things. + We can slow the instruction pipeline for instructions coming via the + gdt or the ldt if we want to. I am not sure why this is an advantage */ + +#define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */ +#define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */ +#define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */ + +#endif diff --git a/trunk/include/asm-x86/delay.h b/trunk/include/asm-x86/delay.h index d11d47fc1a0e..10f2c71d622b 100644 --- a/trunk/include/asm-x86/delay.h +++ b/trunk/include/asm-x86/delay.h @@ -1,31 +1,5 @@ -#ifndef _ASM_X86_DELAY_H -#define _ASM_X86_DELAY_H - -/* - * Copyright (C) 1993 Linus Torvalds - * - * Delay routines calling functions in arch/x86/lib/delay.c - */ - -/* Undefined functions to get compile-time errors */ -extern void __bad_udelay(void); -extern void __bad_ndelay(void); - -extern void __udelay(unsigned long usecs); -extern void __ndelay(unsigned long nsecs); -extern void __const_udelay(unsigned long usecs); -extern void __delay(unsigned long loops); - -/* 0x10c7 is 2**32 / 1000000 (rounded up) */ -#define udelay(n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ - __udelay(n)) - -/* 0x5 is 2**32 / 1000000000 (rounded up) */ -#define ndelay(n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ - __ndelay(n)) - -void use_tsc_delay(void); - -#endif /* _ASM_X86_DELAY_H */ +#ifdef CONFIG_X86_32 +# include "delay_32.h" +#else +# include "delay_64.h" +#endif diff --git a/trunk/include/asm-x86/delay_32.h b/trunk/include/asm-x86/delay_32.h new file mode 100644 index 000000000000..9ae5e3782ed8 --- /dev/null +++ b/trunk/include/asm-x86/delay_32.h @@ -0,0 +1,31 @@ +#ifndef _I386_DELAY_H +#define _I386_DELAY_H + +/* + * Copyright (C) 1993 Linus Torvalds + * + * Delay routines calling functions in arch/i386/lib/delay.c + */ + +/* Undefined functions to get compile-time errors */ +extern void __bad_udelay(void); +extern void __bad_ndelay(void); + +extern void __udelay(unsigned long usecs); +extern void __ndelay(unsigned long nsecs); +extern void __const_udelay(unsigned long usecs); +extern void __delay(unsigned long loops); + +/* 0x10c7 is 2**32 / 1000000 (rounded up) */ +#define udelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ + __udelay(n)) + +/* 0x5 is 2**32 / 1000000000 (rounded up) */ +#define ndelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ + __ndelay(n)) + +void use_tsc_delay(void); + +#endif /* defined(_I386_DELAY_H) */ diff --git a/trunk/include/asm-x86/delay_64.h b/trunk/include/asm-x86/delay_64.h new file mode 100644 index 000000000000..c2669f1f5529 --- /dev/null +++ b/trunk/include/asm-x86/delay_64.h @@ -0,0 +1,30 @@ +#ifndef _X8664_DELAY_H +#define _X8664_DELAY_H + +/* + * Copyright (C) 1993 Linus Torvalds + * + * Delay routines calling functions in arch/x86_64/lib/delay.c + */ + +/* Undefined functions to get compile-time errors */ +extern void __bad_udelay(void); +extern void __bad_ndelay(void); + +extern void __udelay(unsigned long usecs); +extern void __ndelay(unsigned long nsecs); +extern void __const_udelay(unsigned long usecs); +extern void __delay(unsigned long loops); + +/* 0x10c7 is 2**32 / 1000000 (rounded up) */ +#define udelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ + __udelay(n)) + +/* 0x5 is 2**32 / 1000000000 (rounded up) */ +#define ndelay(n) (__builtin_constant_p(n) ? \ + ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ + __ndelay(n)) + + +#endif /* defined(_X8664_DELAY_H) */ diff --git a/trunk/include/asm-x86/device.h b/trunk/include/asm-x86/device.h index d9ee5e52e91b..e2bcf7c7dcee 100644 --- a/trunk/include/asm-x86/device.h +++ b/trunk/include/asm-x86/device.h @@ -1,10 +1,5 @@ -#ifndef _ASM_X86_DEVICE_H -#define _ASM_X86_DEVICE_H - -struct dev_archdata { -#ifdef CONFIG_ACPI - void *acpi_handle; +#ifdef CONFIG_X86_32 +# include "device_32.h" +#else +# include "device_64.h" #endif -}; - -#endif /* _ASM_X86_DEVICE_H */ diff --git a/trunk/include/asm-x86/device_32.h b/trunk/include/asm-x86/device_32.h new file mode 100644 index 000000000000..849604c70e6b --- /dev/null +++ b/trunk/include/asm-x86/device_32.h @@ -0,0 +1,15 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#ifndef _ASM_I386_DEVICE_H +#define _ASM_I386_DEVICE_H + +struct dev_archdata { +#ifdef CONFIG_ACPI + void *acpi_handle; +#endif +}; + +#endif /* _ASM_I386_DEVICE_H */ diff --git a/trunk/include/asm-x86/device_64.h b/trunk/include/asm-x86/device_64.h new file mode 100644 index 000000000000..3afa03f33a36 --- /dev/null +++ b/trunk/include/asm-x86/device_64.h @@ -0,0 +1,15 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#ifndef _ASM_X86_64_DEVICE_H +#define _ASM_X86_64_DEVICE_H + +struct dev_archdata { +#ifdef CONFIG_ACPI + void *acpi_handle; +#endif +}; + +#endif /* _ASM_X86_64_DEVICE_H */ diff --git a/trunk/include/asm-x86/dmi.h b/trunk/include/asm-x86/dmi.h index 8e2b0e6aa8e7..c9e4e8ebc270 100644 --- a/trunk/include/asm-x86/dmi.h +++ b/trunk/include/asm-x86/dmi.h @@ -1,35 +1,5 @@ -#ifndef _ASM_X86_DMI_H -#define _ASM_X86_DMI_H - -#include - #ifdef CONFIG_X86_32 - -/* Use early IO mappings for DMI because it's initialized early */ -#define dmi_ioremap bt_ioremap -#define dmi_iounmap bt_iounmap -#define dmi_alloc alloc_bootmem - -#else /* CONFIG_X86_32 */ - -#define DMI_MAX_DATA 2048 - -extern int dmi_alloc_index; -extern char dmi_alloc_data[DMI_MAX_DATA]; - -/* This is so early that there is no good way to allocate dynamic memory. - Allocate data in an BSS array. */ -static inline void *dmi_alloc(unsigned len) -{ - int idx = dmi_alloc_index; - if ((dmi_alloc_index += len) > DMI_MAX_DATA) - return NULL; - return dmi_alloc_data + idx; -} - -#define dmi_ioremap early_ioremap -#define dmi_iounmap early_iounmap - -#endif - +# include "dmi_32.h" +#else +# include "dmi_64.h" #endif diff --git a/trunk/include/asm-x86/dmi_32.h b/trunk/include/asm-x86/dmi_32.h new file mode 100644 index 000000000000..38d4eeb7fc7e --- /dev/null +++ b/trunk/include/asm-x86/dmi_32.h @@ -0,0 +1,11 @@ +#ifndef _ASM_DMI_H +#define _ASM_DMI_H 1 + +#include + +/* Use early IO mappings for DMI because it's initialized early */ +#define dmi_ioremap bt_ioremap +#define dmi_iounmap bt_iounmap +#define dmi_alloc alloc_bootmem + +#endif diff --git a/trunk/include/asm-x86/dmi_64.h b/trunk/include/asm-x86/dmi_64.h new file mode 100644 index 000000000000..d02e32e3c3f0 --- /dev/null +++ b/trunk/include/asm-x86/dmi_64.h @@ -0,0 +1,24 @@ +#ifndef _ASM_DMI_H +#define _ASM_DMI_H 1 + +#include + +#define DMI_MAX_DATA 2048 + +extern int dmi_alloc_index; +extern char dmi_alloc_data[DMI_MAX_DATA]; + +/* This is so early that there is no good way to allocate dynamic memory. + Allocate data in an BSS array. */ +static inline void *dmi_alloc(unsigned len) +{ + int idx = dmi_alloc_index; + if ((dmi_alloc_index += len) > DMI_MAX_DATA) + return NULL; + return dmi_alloc_data + idx; +} + +#define dmi_ioremap early_ioremap +#define dmi_iounmap early_iounmap + +#endif diff --git a/trunk/include/asm-x86/edac.h b/trunk/include/asm-x86/edac.h index cf3200a745ad..f8b888e140b0 100644 --- a/trunk/include/asm-x86/edac.h +++ b/trunk/include/asm-x86/edac.h @@ -1,18 +1,5 @@ -#ifndef _ASM_X86_EDAC_H -#define _ASM_X86_EDAC_H - -/* ECC atomic, DMA, SMP and interrupt safe scrub function */ - -static __inline__ void atomic_scrub(void *va, u32 size) -{ - u32 i, *virt_addr = va; - - /* - * Very carefully read and write to memory atomically so we - * are interrupt, DMA and SMP safe. - */ - for (i = 0; i < size / 4; i++, virt_addr++) - __asm__ __volatile__("lock; addl $0, %0"::"m"(*virt_addr)); -} - +#ifdef CONFIG_X86_32 +# include "edac_32.h" +#else +# include "edac_64.h" #endif diff --git a/trunk/include/asm-x86/edac_32.h b/trunk/include/asm-x86/edac_32.h new file mode 100644 index 000000000000..3e7dd0ab68ce --- /dev/null +++ b/trunk/include/asm-x86/edac_32.h @@ -0,0 +1,18 @@ +#ifndef ASM_EDAC_H +#define ASM_EDAC_H + +/* ECC atomic, DMA, SMP and interrupt safe scrub function */ + +static __inline__ void atomic_scrub(void *va, u32 size) +{ + unsigned long *virt_addr = va; + u32 i; + + for (i = 0; i < size / 4; i++, virt_addr++) + /* Very carefully read and write to memory atomically + * so we are interrupt, DMA and SMP safe. + */ + __asm__ __volatile__("lock; addl $0, %0"::"m"(*virt_addr)); +} + +#endif diff --git a/trunk/include/asm-x86/edac_64.h b/trunk/include/asm-x86/edac_64.h new file mode 100644 index 000000000000..cad1cd42b4ee --- /dev/null +++ b/trunk/include/asm-x86/edac_64.h @@ -0,0 +1,18 @@ +#ifndef ASM_EDAC_H +#define ASM_EDAC_H + +/* ECC atomic, DMA, SMP and interrupt safe scrub function */ + +static __inline__ void atomic_scrub(void *va, u32 size) +{ + unsigned int *virt_addr = va; + u32 i; + + for (i = 0; i < size / 4; i++, virt_addr++) + /* Very carefully read and write to memory atomically + * so we are interrupt, DMA and SMP safe. + */ + __asm__ __volatile__("lock; addl $0, %0"::"m"(*virt_addr)); +} + +#endif diff --git a/trunk/include/asm-x86/errno.h b/trunk/include/asm-x86/errno.h index 4c82b503d92f..9d511be8e573 100644 --- a/trunk/include/asm-x86/errno.h +++ b/trunk/include/asm-x86/errno.h @@ -1 +1,13 @@ -#include +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "errno_32.h" +# else +# include "errno_64.h" +# endif +#else +# ifdef __i386__ +# include "errno_32.h" +# else +# include "errno_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/errno_32.h b/trunk/include/asm-x86/errno_32.h new file mode 100644 index 000000000000..969b34374728 --- /dev/null +++ b/trunk/include/asm-x86/errno_32.h @@ -0,0 +1,6 @@ +#ifndef _I386_ERRNO_H +#define _I386_ERRNO_H + +#include + +#endif diff --git a/trunk/include/asm-x86/errno_64.h b/trunk/include/asm-x86/errno_64.h new file mode 100644 index 000000000000..311182129e32 --- /dev/null +++ b/trunk/include/asm-x86/errno_64.h @@ -0,0 +1,6 @@ +#ifndef _X8664_ERRNO_H +#define _X8664_ERRNO_H + +#include + +#endif diff --git a/trunk/include/asm-x86/fb.h b/trunk/include/asm-x86/fb.h index 53018464aea6..238c7ca45877 100644 --- a/trunk/include/asm-x86/fb.h +++ b/trunk/include/asm-x86/fb.h @@ -1,21 +1,5 @@ -#ifndef _ASM_X86_FB_H -#define _ASM_X86_FB_H - -#include -#include -#include - -static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, - unsigned long off) -{ - if (boot_cpu_data.x86 > 3) - pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; -} - #ifdef CONFIG_X86_32 -extern int fb_is_primary_device(struct fb_info *info); +# include "fb_32.h" #else -static inline int fb_is_primary_device(struct fb_info *info) { return 0; } +# include "fb_64.h" #endif - -#endif /* _ASM_X86_FB_H */ diff --git a/trunk/include/asm-x86/fb_32.h b/trunk/include/asm-x86/fb_32.h new file mode 100644 index 000000000000..d1c6297d4a61 --- /dev/null +++ b/trunk/include/asm-x86/fb_32.h @@ -0,0 +1,17 @@ +#ifndef _ASM_FB_H_ +#define _ASM_FB_H_ + +#include +#include +#include + +extern int fb_is_primary_device(struct fb_info *info); + +static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, + unsigned long off) +{ + if (boot_cpu_data.x86 > 3) + pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; +} + +#endif /* _ASM_FB_H_ */ diff --git a/trunk/include/asm-x86/fb_64.h b/trunk/include/asm-x86/fb_64.h new file mode 100644 index 000000000000..60548e651d12 --- /dev/null +++ b/trunk/include/asm-x86/fb_64.h @@ -0,0 +1,19 @@ +#ifndef _ASM_FB_H_ +#define _ASM_FB_H_ +#include +#include +#include + +static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, + unsigned long off) +{ + if (boot_cpu_data.x86 > 3) + pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; +} + +static inline int fb_is_primary_device(struct fb_info *info) +{ + return 0; +} + +#endif /* _ASM_FB_H_ */ diff --git a/trunk/include/asm-x86/floppy.h b/trunk/include/asm-x86/floppy.h index a48d7153c097..aecbb6dca21d 100644 --- a/trunk/include/asm-x86/floppy.h +++ b/trunk/include/asm-x86/floppy.h @@ -1,278 +1,5 @@ -/* - * Architecture specific parts of the Floppy driver - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 1995 - */ -#ifndef _ASM_X86_FLOPPY_H -#define _ASM_X86_FLOPPY_H - -#include - -/* - * The DMA channel used by the floppy controller cannot access data at - * addresses >= 16MB - * - * Went back to the 1MB limit, as some people had problems with the floppy - * driver otherwise. It doesn't matter much for performance anyway, as most - * floppy accesses go through the track buffer. - */ -#define _CROSS_64KB(a,s,vdma) \ -(!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)) - -#define CROSS_64KB(a,s) _CROSS_64KB(a,s,use_virtual_dma & 1) - - -#define SW fd_routine[use_virtual_dma&1] -#define CSW fd_routine[can_use_virtual_dma & 1] - - -#define fd_inb(port) inb_p(port) -#define fd_outb(value,port) outb_p(value,port) - -#define fd_request_dma() CSW._request_dma(FLOPPY_DMA,"floppy") -#define fd_free_dma() CSW._free_dma(FLOPPY_DMA) -#define fd_enable_irq() enable_irq(FLOPPY_IRQ) -#define fd_disable_irq() disable_irq(FLOPPY_IRQ) -#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) -#define fd_get_dma_residue() SW._get_dma_residue(FLOPPY_DMA) -#define fd_dma_mem_alloc(size) SW._dma_mem_alloc(size) -#define fd_dma_setup(addr, size, mode, io) SW._dma_setup(addr, size, mode, io) - -#define FLOPPY_CAN_FALLBACK_ON_NODMA - -static int virtual_dma_count; -static int virtual_dma_residue; -static char *virtual_dma_addr; -static int virtual_dma_mode; -static int doing_pdma; - -static irqreturn_t floppy_hardint(int irq, void *dev_id) -{ - register unsigned char st; - -#undef TRACE_FLPY_INT - -#ifdef TRACE_FLPY_INT - static int calls=0; - static int bytes=0; - static int dma_wait=0; +#ifdef CONFIG_X86_32 +# include "floppy_32.h" +#else +# include "floppy_64.h" #endif - if (!doing_pdma) - return floppy_interrupt(irq, dev_id); - -#ifdef TRACE_FLPY_INT - if(!calls) - bytes = virtual_dma_count; -#endif - - { - register int lcount; - register char *lptr; - - st = 1; - for(lcount=virtual_dma_count, lptr=virtual_dma_addr; - lcount; lcount--, lptr++) { - st=inb(virtual_dma_port+4) & 0xa0 ; - if(st != 0xa0) - break; - if(virtual_dma_mode) - outb_p(*lptr, virtual_dma_port+5); - else - *lptr = inb_p(virtual_dma_port+5); - } - virtual_dma_count = lcount; - virtual_dma_addr = lptr; - st = inb(virtual_dma_port+4); - } - -#ifdef TRACE_FLPY_INT - calls++; -#endif - if(st == 0x20) - return IRQ_HANDLED; - if(!(st & 0x20)) { - virtual_dma_residue += virtual_dma_count; - virtual_dma_count=0; -#ifdef TRACE_FLPY_INT - printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", - virtual_dma_count, virtual_dma_residue, calls, bytes, - dma_wait); - calls = 0; - dma_wait=0; -#endif - doing_pdma = 0; - floppy_interrupt(irq, dev_id); - return IRQ_HANDLED; - } -#ifdef TRACE_FLPY_INT - if(!virtual_dma_count) - dma_wait++; -#endif - return IRQ_HANDLED; -} - -static void fd_disable_dma(void) -{ - if(! (can_use_virtual_dma & 1)) - disable_dma(FLOPPY_DMA); - doing_pdma = 0; - virtual_dma_residue += virtual_dma_count; - virtual_dma_count=0; -} - -static int vdma_request_dma(unsigned int dmanr, const char * device_id) -{ - return 0; -} - -static void vdma_nop(unsigned int dummy) -{ -} - - -static int vdma_get_dma_residue(unsigned int dummy) -{ - return virtual_dma_count + virtual_dma_residue; -} - - -static int fd_request_irq(void) -{ - if(can_use_virtual_dma) - return request_irq(FLOPPY_IRQ, floppy_hardint, - IRQF_DISABLED, "floppy", NULL); - else - return request_irq(FLOPPY_IRQ, floppy_interrupt, - IRQF_DISABLED, "floppy", NULL); -} - -static unsigned long dma_mem_alloc(unsigned long size) -{ - return __get_dma_pages(GFP_KERNEL|__GFP_NORETRY,get_order(size)); -} - - -static unsigned long vdma_mem_alloc(unsigned long size) -{ - return (unsigned long) vmalloc(size); - -} - -#define nodma_mem_alloc(size) vdma_mem_alloc(size) - -static void _fd_dma_mem_free(unsigned long addr, unsigned long size) -{ - if((unsigned long) addr >= (unsigned long) high_memory) - vfree((void *)addr); - else - free_pages(addr, get_order(size)); -} - -#define fd_dma_mem_free(addr, size) _fd_dma_mem_free(addr, size) - -static void _fd_chose_dma_mode(char *addr, unsigned long size) -{ - if(can_use_virtual_dma == 2) { - if((unsigned long) addr >= (unsigned long) high_memory || - isa_virt_to_bus(addr) >= 0x1000000 || - _CROSS_64KB(addr, size, 0)) - use_virtual_dma = 1; - else - use_virtual_dma = 0; - } else { - use_virtual_dma = can_use_virtual_dma & 1; - } -} - -#define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size) - - -static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io) -{ - doing_pdma = 1; - virtual_dma_port = io; - virtual_dma_mode = (mode == DMA_MODE_WRITE); - virtual_dma_addr = addr; - virtual_dma_count = size; - virtual_dma_residue = 0; - return 0; -} - -static int hard_dma_setup(char *addr, unsigned long size, int mode, int io) -{ -#ifdef FLOPPY_SANITY_CHECK - if (CROSS_64KB(addr, size)) { - printk("DMA crossing 64-K boundary %p-%p\n", addr, addr+size); - return -1; - } -#endif - /* actual, physical DMA */ - doing_pdma = 0; - clear_dma_ff(FLOPPY_DMA); - set_dma_mode(FLOPPY_DMA,mode); - set_dma_addr(FLOPPY_DMA,isa_virt_to_bus(addr)); - set_dma_count(FLOPPY_DMA,size); - enable_dma(FLOPPY_DMA); - return 0; -} - -static struct fd_routine_l { - int (*_request_dma)(unsigned int dmanr, const char * device_id); - void (*_free_dma)(unsigned int dmanr); - int (*_get_dma_residue)(unsigned int dummy); - unsigned long (*_dma_mem_alloc) (unsigned long size); - int (*_dma_setup)(char *addr, unsigned long size, int mode, int io); -} fd_routine[] = { - { - request_dma, - free_dma, - get_dma_residue, - dma_mem_alloc, - hard_dma_setup - }, - { - vdma_request_dma, - vdma_nop, - vdma_get_dma_residue, - vdma_mem_alloc, - vdma_dma_setup - } -}; - - -static int FDC1 = 0x3f0; -static int FDC2 = -1; - -/* - * Floppy types are stored in the rtc's CMOS RAM and so rtc_lock - * is needed to prevent corrupted CMOS RAM in case "insmod floppy" - * coincides with another rtc CMOS user. Paul G. - */ -#define FLOPPY0_TYPE ({ \ - unsigned long flags; \ - unsigned char val; \ - spin_lock_irqsave(&rtc_lock, flags); \ - val = (CMOS_READ(0x10) >> 4) & 15; \ - spin_unlock_irqrestore(&rtc_lock, flags); \ - val; \ -}) - -#define FLOPPY1_TYPE ({ \ - unsigned long flags; \ - unsigned char val; \ - spin_lock_irqsave(&rtc_lock, flags); \ - val = CMOS_READ(0x10) & 15; \ - spin_unlock_irqrestore(&rtc_lock, flags); \ - val; \ -}) - -#define N_FDC 2 -#define N_DRIVE 8 - -#define EXTRA_FLOPPY_PARAMS - -#endif /* _ASM_X86_FLOPPY_H */ diff --git a/trunk/include/asm-x86/floppy_32.h b/trunk/include/asm-x86/floppy_32.h new file mode 100644 index 000000000000..99583b39d216 --- /dev/null +++ b/trunk/include/asm-x86/floppy_32.h @@ -0,0 +1,280 @@ +/* + * Architecture specific parts of the Floppy driver + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995 + */ +#ifndef __ASM_I386_FLOPPY_H +#define __ASM_I386_FLOPPY_H + +#include + + +/* + * The DMA channel used by the floppy controller cannot access data at + * addresses >= 16MB + * + * Went back to the 1MB limit, as some people had problems with the floppy + * driver otherwise. It doesn't matter much for performance anyway, as most + * floppy accesses go through the track buffer. + */ +#define _CROSS_64KB(a,s,vdma) \ +(!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)) + +#define CROSS_64KB(a,s) _CROSS_64KB(a,s,use_virtual_dma & 1) + + +#define SW fd_routine[use_virtual_dma&1] +#define CSW fd_routine[can_use_virtual_dma & 1] + + +#define fd_inb(port) inb_p(port) +#define fd_outb(value,port) outb_p(value,port) + +#define fd_request_dma() CSW._request_dma(FLOPPY_DMA,"floppy") +#define fd_free_dma() CSW._free_dma(FLOPPY_DMA) +#define fd_enable_irq() enable_irq(FLOPPY_IRQ) +#define fd_disable_irq() disable_irq(FLOPPY_IRQ) +#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) +#define fd_get_dma_residue() SW._get_dma_residue(FLOPPY_DMA) +#define fd_dma_mem_alloc(size) SW._dma_mem_alloc(size) +#define fd_dma_setup(addr, size, mode, io) SW._dma_setup(addr, size, mode, io) + +#define FLOPPY_CAN_FALLBACK_ON_NODMA + +static int virtual_dma_count; +static int virtual_dma_residue; +static char *virtual_dma_addr; +static int virtual_dma_mode; +static int doing_pdma; + +static irqreturn_t floppy_hardint(int irq, void *dev_id) +{ + register unsigned char st; + +#undef TRACE_FLPY_INT + +#ifdef TRACE_FLPY_INT + static int calls=0; + static int bytes=0; + static int dma_wait=0; +#endif + if (!doing_pdma) + return floppy_interrupt(irq, dev_id); + +#ifdef TRACE_FLPY_INT + if(!calls) + bytes = virtual_dma_count; +#endif + + { + register int lcount; + register char *lptr; + + st = 1; + for(lcount=virtual_dma_count, lptr=virtual_dma_addr; + lcount; lcount--, lptr++) { + st=inb(virtual_dma_port+4) & 0xa0 ; + if(st != 0xa0) + break; + if(virtual_dma_mode) + outb_p(*lptr, virtual_dma_port+5); + else + *lptr = inb_p(virtual_dma_port+5); + } + virtual_dma_count = lcount; + virtual_dma_addr = lptr; + st = inb(virtual_dma_port+4); + } + +#ifdef TRACE_FLPY_INT + calls++; +#endif + if(st == 0x20) + return IRQ_HANDLED; + if(!(st & 0x20)) { + virtual_dma_residue += virtual_dma_count; + virtual_dma_count=0; +#ifdef TRACE_FLPY_INT + printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", + virtual_dma_count, virtual_dma_residue, calls, bytes, + dma_wait); + calls = 0; + dma_wait=0; +#endif + doing_pdma = 0; + floppy_interrupt(irq, dev_id); + return IRQ_HANDLED; + } +#ifdef TRACE_FLPY_INT + if(!virtual_dma_count) + dma_wait++; +#endif + return IRQ_HANDLED; +} + +static void fd_disable_dma(void) +{ + if(! (can_use_virtual_dma & 1)) + disable_dma(FLOPPY_DMA); + doing_pdma = 0; + virtual_dma_residue += virtual_dma_count; + virtual_dma_count=0; +} + +static int vdma_request_dma(unsigned int dmanr, const char * device_id) +{ + return 0; +} + +static void vdma_nop(unsigned int dummy) +{ +} + + +static int vdma_get_dma_residue(unsigned int dummy) +{ + return virtual_dma_count + virtual_dma_residue; +} + + +static int fd_request_irq(void) +{ + if(can_use_virtual_dma) + return request_irq(FLOPPY_IRQ, floppy_hardint, + IRQF_DISABLED, "floppy", NULL); + else + return request_irq(FLOPPY_IRQ, floppy_interrupt, + IRQF_DISABLED, "floppy", NULL); + +} + +static unsigned long dma_mem_alloc(unsigned long size) +{ + return __get_dma_pages(GFP_KERNEL,get_order(size)); +} + + +static unsigned long vdma_mem_alloc(unsigned long size) +{ + return (unsigned long) vmalloc(size); + +} + +#define nodma_mem_alloc(size) vdma_mem_alloc(size) + +static void _fd_dma_mem_free(unsigned long addr, unsigned long size) +{ + if((unsigned int) addr >= (unsigned int) high_memory) + vfree((void *)addr); + else + free_pages(addr, get_order(size)); +} + +#define fd_dma_mem_free(addr, size) _fd_dma_mem_free(addr, size) + +static void _fd_chose_dma_mode(char *addr, unsigned long size) +{ + if(can_use_virtual_dma == 2) { + if((unsigned int) addr >= (unsigned int) high_memory || + isa_virt_to_bus(addr) >= 0x1000000 || + _CROSS_64KB(addr, size, 0)) + use_virtual_dma = 1; + else + use_virtual_dma = 0; + } else { + use_virtual_dma = can_use_virtual_dma & 1; + } +} + +#define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size) + + +static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io) +{ + doing_pdma = 1; + virtual_dma_port = io; + virtual_dma_mode = (mode == DMA_MODE_WRITE); + virtual_dma_addr = addr; + virtual_dma_count = size; + virtual_dma_residue = 0; + return 0; +} + +static int hard_dma_setup(char *addr, unsigned long size, int mode, int io) +{ +#ifdef FLOPPY_SANITY_CHECK + if (CROSS_64KB(addr, size)) { + printk("DMA crossing 64-K boundary %p-%p\n", addr, addr+size); + return -1; + } +#endif + /* actual, physical DMA */ + doing_pdma = 0; + clear_dma_ff(FLOPPY_DMA); + set_dma_mode(FLOPPY_DMA,mode); + set_dma_addr(FLOPPY_DMA,isa_virt_to_bus(addr)); + set_dma_count(FLOPPY_DMA,size); + enable_dma(FLOPPY_DMA); + return 0; +} + +static struct fd_routine_l { + int (*_request_dma)(unsigned int dmanr, const char * device_id); + void (*_free_dma)(unsigned int dmanr); + int (*_get_dma_residue)(unsigned int dummy); + unsigned long (*_dma_mem_alloc) (unsigned long size); + int (*_dma_setup)(char *addr, unsigned long size, int mode, int io); +} fd_routine[] = { + { + request_dma, + free_dma, + get_dma_residue, + dma_mem_alloc, + hard_dma_setup + }, + { + vdma_request_dma, + vdma_nop, + vdma_get_dma_residue, + vdma_mem_alloc, + vdma_dma_setup + } +}; + + +static int FDC1 = 0x3f0; +static int FDC2 = -1; + +/* + * Floppy types are stored in the rtc's CMOS RAM and so rtc_lock + * is needed to prevent corrupted CMOS RAM in case "insmod floppy" + * coincides with another rtc CMOS user. Paul G. + */ +#define FLOPPY0_TYPE ({ \ + unsigned long flags; \ + unsigned char val; \ + spin_lock_irqsave(&rtc_lock, flags); \ + val = (CMOS_READ(0x10) >> 4) & 15; \ + spin_unlock_irqrestore(&rtc_lock, flags); \ + val; \ +}) + +#define FLOPPY1_TYPE ({ \ + unsigned long flags; \ + unsigned char val; \ + spin_lock_irqsave(&rtc_lock, flags); \ + val = CMOS_READ(0x10) & 15; \ + spin_unlock_irqrestore(&rtc_lock, flags); \ + val; \ +}) + +#define N_FDC 2 +#define N_DRIVE 8 + +#define EXTRA_FLOPPY_PARAMS + +#endif /* __ASM_I386_FLOPPY_H */ diff --git a/trunk/include/asm-x86/floppy_64.h b/trunk/include/asm-x86/floppy_64.h new file mode 100644 index 000000000000..d993380dcb47 --- /dev/null +++ b/trunk/include/asm-x86/floppy_64.h @@ -0,0 +1,279 @@ +/* + * Architecture specific parts of the Floppy driver + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995 + */ +#ifndef __ASM_X86_64_FLOPPY_H +#define __ASM_X86_64_FLOPPY_H + +#include + + +/* + * The DMA channel used by the floppy controller cannot access data at + * addresses >= 16MB + * + * Went back to the 1MB limit, as some people had problems with the floppy + * driver otherwise. It doesn't matter much for performance anyway, as most + * floppy accesses go through the track buffer. + */ +#define _CROSS_64KB(a,s,vdma) \ +(!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)) + +#define CROSS_64KB(a,s) _CROSS_64KB(a,s,use_virtual_dma & 1) + + +#define SW fd_routine[use_virtual_dma&1] +#define CSW fd_routine[can_use_virtual_dma & 1] + + +#define fd_inb(port) inb_p(port) +#define fd_outb(value,port) outb_p(value,port) + +#define fd_request_dma() CSW._request_dma(FLOPPY_DMA,"floppy") +#define fd_free_dma() CSW._free_dma(FLOPPY_DMA) +#define fd_enable_irq() enable_irq(FLOPPY_IRQ) +#define fd_disable_irq() disable_irq(FLOPPY_IRQ) +#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) +#define fd_get_dma_residue() SW._get_dma_residue(FLOPPY_DMA) +#define fd_dma_mem_alloc(size) SW._dma_mem_alloc(size) +#define fd_dma_setup(addr, size, mode, io) SW._dma_setup(addr, size, mode, io) + +#define FLOPPY_CAN_FALLBACK_ON_NODMA + +static int virtual_dma_count; +static int virtual_dma_residue; +static char *virtual_dma_addr; +static int virtual_dma_mode; +static int doing_pdma; + +static irqreturn_t floppy_hardint(int irq, void *dev_id) +{ + register unsigned char st; + +#undef TRACE_FLPY_INT + +#ifdef TRACE_FLPY_INT + static int calls=0; + static int bytes=0; + static int dma_wait=0; +#endif + if (!doing_pdma) + return floppy_interrupt(irq, dev_id); + +#ifdef TRACE_FLPY_INT + if(!calls) + bytes = virtual_dma_count; +#endif + + { + register int lcount; + register char *lptr; + + st = 1; + for(lcount=virtual_dma_count, lptr=virtual_dma_addr; + lcount; lcount--, lptr++) { + st=inb(virtual_dma_port+4) & 0xa0 ; + if(st != 0xa0) + break; + if(virtual_dma_mode) + outb_p(*lptr, virtual_dma_port+5); + else + *lptr = inb_p(virtual_dma_port+5); + } + virtual_dma_count = lcount; + virtual_dma_addr = lptr; + st = inb(virtual_dma_port+4); + } + +#ifdef TRACE_FLPY_INT + calls++; +#endif + if(st == 0x20) + return IRQ_HANDLED; + if(!(st & 0x20)) { + virtual_dma_residue += virtual_dma_count; + virtual_dma_count=0; +#ifdef TRACE_FLPY_INT + printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", + virtual_dma_count, virtual_dma_residue, calls, bytes, + dma_wait); + calls = 0; + dma_wait=0; +#endif + doing_pdma = 0; + floppy_interrupt(irq, dev_id); + return IRQ_HANDLED; + } +#ifdef TRACE_FLPY_INT + if(!virtual_dma_count) + dma_wait++; +#endif + return IRQ_HANDLED; +} + +static void fd_disable_dma(void) +{ + if(! (can_use_virtual_dma & 1)) + disable_dma(FLOPPY_DMA); + doing_pdma = 0; + virtual_dma_residue += virtual_dma_count; + virtual_dma_count=0; +} + +static int vdma_request_dma(unsigned int dmanr, const char * device_id) +{ + return 0; +} + +static void vdma_nop(unsigned int dummy) +{ +} + + +static int vdma_get_dma_residue(unsigned int dummy) +{ + return virtual_dma_count + virtual_dma_residue; +} + + +static int fd_request_irq(void) +{ + if(can_use_virtual_dma) + return request_irq(FLOPPY_IRQ, floppy_hardint, + IRQF_DISABLED, "floppy", NULL); + else + return request_irq(FLOPPY_IRQ, floppy_interrupt, + IRQF_DISABLED, "floppy", NULL); +} + +static unsigned long dma_mem_alloc(unsigned long size) +{ + return __get_dma_pages(GFP_KERNEL|__GFP_NORETRY,get_order(size)); +} + + +static unsigned long vdma_mem_alloc(unsigned long size) +{ + return (unsigned long) vmalloc(size); + +} + +#define nodma_mem_alloc(size) vdma_mem_alloc(size) + +static void _fd_dma_mem_free(unsigned long addr, unsigned long size) +{ + if((unsigned long) addr >= (unsigned long) high_memory) + vfree((void *)addr); + else + free_pages(addr, get_order(size)); +} + +#define fd_dma_mem_free(addr, size) _fd_dma_mem_free(addr, size) + +static void _fd_chose_dma_mode(char *addr, unsigned long size) +{ + if(can_use_virtual_dma == 2) { + if((unsigned long) addr >= (unsigned long) high_memory || + isa_virt_to_bus(addr) >= 0x1000000 || + _CROSS_64KB(addr, size, 0)) + use_virtual_dma = 1; + else + use_virtual_dma = 0; + } else { + use_virtual_dma = can_use_virtual_dma & 1; + } +} + +#define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size) + + +static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io) +{ + doing_pdma = 1; + virtual_dma_port = io; + virtual_dma_mode = (mode == DMA_MODE_WRITE); + virtual_dma_addr = addr; + virtual_dma_count = size; + virtual_dma_residue = 0; + return 0; +} + +static int hard_dma_setup(char *addr, unsigned long size, int mode, int io) +{ +#ifdef FLOPPY_SANITY_CHECK + if (CROSS_64KB(addr, size)) { + printk("DMA crossing 64-K boundary %p-%p\n", addr, addr+size); + return -1; + } +#endif + /* actual, physical DMA */ + doing_pdma = 0; + clear_dma_ff(FLOPPY_DMA); + set_dma_mode(FLOPPY_DMA,mode); + set_dma_addr(FLOPPY_DMA,isa_virt_to_bus(addr)); + set_dma_count(FLOPPY_DMA,size); + enable_dma(FLOPPY_DMA); + return 0; +} + +static struct fd_routine_l { + int (*_request_dma)(unsigned int dmanr, const char * device_id); + void (*_free_dma)(unsigned int dmanr); + int (*_get_dma_residue)(unsigned int dummy); + unsigned long (*_dma_mem_alloc) (unsigned long size); + int (*_dma_setup)(char *addr, unsigned long size, int mode, int io); +} fd_routine[] = { + { + request_dma, + free_dma, + get_dma_residue, + dma_mem_alloc, + hard_dma_setup + }, + { + vdma_request_dma, + vdma_nop, + vdma_get_dma_residue, + vdma_mem_alloc, + vdma_dma_setup + } +}; + + +static int FDC1 = 0x3f0; +static int FDC2 = -1; + +/* + * Floppy types are stored in the rtc's CMOS RAM and so rtc_lock + * is needed to prevent corrupted CMOS RAM in case "insmod floppy" + * coincides with another rtc CMOS user. Paul G. + */ +#define FLOPPY0_TYPE ({ \ + unsigned long flags; \ + unsigned char val; \ + spin_lock_irqsave(&rtc_lock, flags); \ + val = (CMOS_READ(0x10) >> 4) & 15; \ + spin_unlock_irqrestore(&rtc_lock, flags); \ + val; \ +}) + +#define FLOPPY1_TYPE ({ \ + unsigned long flags; \ + unsigned char val; \ + spin_lock_irqsave(&rtc_lock, flags); \ + val = CMOS_READ(0x10) & 15; \ + spin_unlock_irqrestore(&rtc_lock, flags); \ + val; \ +}) + +#define N_FDC 2 +#define N_DRIVE 8 + +#define EXTRA_FLOPPY_PARAMS + +#endif /* __ASM_X86_64_FLOPPY_H */ diff --git a/trunk/include/asm-x86/frame.h b/trunk/include/asm-x86/frame.i similarity index 89% rename from trunk/include/asm-x86/frame.h rename to trunk/include/asm-x86/frame.i index 06850a7194e1..03620251ae17 100644 --- a/trunk/include/asm-x86/frame.h +++ b/trunk/include/asm-x86/frame.i @@ -1,5 +1,3 @@ -#ifdef __ASSEMBLY__ - #include /* The annotation hides the frame from the unwinder and makes it look @@ -23,5 +21,3 @@ .macro ENDFRAME .endm #endif - -#endif /* __ASSEMBLY__ */ diff --git a/trunk/include/asm-x86/hardirq_32.h b/trunk/include/asm-x86/hardirq_32.h index 4f85f0f4b563..34649585bb59 100644 --- a/trunk/include/asm-x86/hardirq_32.h +++ b/trunk/include/asm-x86/hardirq_32.h @@ -10,14 +10,10 @@ typedef struct { unsigned int __nmi_count; /* arch dependent */ unsigned int apic_timer_irqs; /* arch dependent */ unsigned int irq0_irqs; - unsigned int irq_resched_count; - unsigned int irq_call_count; - unsigned int irq_tlb_count; - unsigned int irq_thermal_count; - unsigned int irq_spurious_count; } ____cacheline_aligned irq_cpustat_t; DECLARE_PER_CPU(irq_cpustat_t, irq_stat); +extern irq_cpustat_t irq_stat[]; #define __ARCH_IRQ_STAT #define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member) diff --git a/trunk/include/asm-x86/hw_irq_64.h b/trunk/include/asm-x86/hw_irq_64.h index a470d59da678..09dfc18a6dd0 100644 --- a/trunk/include/asm-x86/hw_irq_64.h +++ b/trunk/include/asm-x86/hw_irq_64.h @@ -40,22 +40,22 @@ /* * Vectors 0x30-0x3f are used for ISA interrupts. */ -#define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10) -#define IRQ1_VECTOR (IRQ0_VECTOR + 1) -#define IRQ2_VECTOR (IRQ0_VECTOR + 2) -#define IRQ3_VECTOR (IRQ0_VECTOR + 3) -#define IRQ4_VECTOR (IRQ0_VECTOR + 4) -#define IRQ5_VECTOR (IRQ0_VECTOR + 5) -#define IRQ6_VECTOR (IRQ0_VECTOR + 6) -#define IRQ7_VECTOR (IRQ0_VECTOR + 7) -#define IRQ8_VECTOR (IRQ0_VECTOR + 8) -#define IRQ9_VECTOR (IRQ0_VECTOR + 9) -#define IRQ10_VECTOR (IRQ0_VECTOR + 10) -#define IRQ11_VECTOR (IRQ0_VECTOR + 11) -#define IRQ12_VECTOR (IRQ0_VECTOR + 12) -#define IRQ13_VECTOR (IRQ0_VECTOR + 13) -#define IRQ14_VECTOR (IRQ0_VECTOR + 14) -#define IRQ15_VECTOR (IRQ0_VECTOR + 15) +#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10 +#define IRQ1_VECTOR IRQ0_VECTOR + 1 +#define IRQ2_VECTOR IRQ0_VECTOR + 2 +#define IRQ3_VECTOR IRQ0_VECTOR + 3 +#define IRQ4_VECTOR IRQ0_VECTOR + 4 +#define IRQ5_VECTOR IRQ0_VECTOR + 5 +#define IRQ6_VECTOR IRQ0_VECTOR + 6 +#define IRQ7_VECTOR IRQ0_VECTOR + 7 +#define IRQ8_VECTOR IRQ0_VECTOR + 8 +#define IRQ9_VECTOR IRQ0_VECTOR + 9 +#define IRQ10_VECTOR IRQ0_VECTOR + 10 +#define IRQ11_VECTOR IRQ0_VECTOR + 11 +#define IRQ12_VECTOR IRQ0_VECTOR + 12 +#define IRQ13_VECTOR IRQ0_VECTOR + 13 +#define IRQ14_VECTOR IRQ0_VECTOR + 14 +#define IRQ15_VECTOR IRQ0_VECTOR + 15 /* * Special IRQ vectors used by the SMP architecture, 0xf0-0xff @@ -148,6 +148,9 @@ extern atomic_t irq_mis_count; #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) +#define __STR(x) #x +#define STR(x) __STR(x) + #include #define IRQ_NAME2(nr) nr##_interrupt(void) diff --git a/trunk/include/asm-x86/intel_arch_perfmon.h b/trunk/include/asm-x86/intel_arch_perfmon.h index fa0fd068bc2e..4f6d4e6bf57e 100644 --- a/trunk/include/asm-x86/intel_arch_perfmon.h +++ b/trunk/include/asm-x86/intel_arch_perfmon.h @@ -1,31 +1,5 @@ -#ifndef _ASM_X86_INTEL_ARCH_PERFMON_H -#define _ASM_X86_INTEL_ARCH_PERFMON_H - -#define MSR_ARCH_PERFMON_PERFCTR0 0xc1 -#define MSR_ARCH_PERFMON_PERFCTR1 0xc2 - -#define MSR_ARCH_PERFMON_EVENTSEL0 0x186 -#define MSR_ARCH_PERFMON_EVENTSEL1 0x187 - -#define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22) -#define ARCH_PERFMON_EVENTSEL_INT (1 << 20) -#define ARCH_PERFMON_EVENTSEL_OS (1 << 17) -#define ARCH_PERFMON_EVENTSEL_USR (1 << 16) - -#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) -#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) -#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) -#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ - (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) - -union cpuid10_eax { - struct { - unsigned int version_id:8; - unsigned int num_counters:8; - unsigned int bit_width:8; - unsigned int mask_length:8; - } split; - unsigned int full; -}; - -#endif /* _ASM_X86_INTEL_ARCH_PERFMON_H */ +#ifdef CONFIG_X86_32 +# include "intel_arch_perfmon_32.h" +#else +# include "intel_arch_perfmon_64.h" +#endif diff --git a/trunk/include/asm-x86/intel_arch_perfmon_32.h b/trunk/include/asm-x86/intel_arch_perfmon_32.h new file mode 100644 index 000000000000..b52cd60a075b --- /dev/null +++ b/trunk/include/asm-x86/intel_arch_perfmon_32.h @@ -0,0 +1,31 @@ +#ifndef X86_INTEL_ARCH_PERFMON_H +#define X86_INTEL_ARCH_PERFMON_H 1 + +#define MSR_ARCH_PERFMON_PERFCTR0 0xc1 +#define MSR_ARCH_PERFMON_PERFCTR1 0xc2 + +#define MSR_ARCH_PERFMON_EVENTSEL0 0x186 +#define MSR_ARCH_PERFMON_EVENTSEL1 0x187 + +#define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22) +#define ARCH_PERFMON_EVENTSEL_INT (1 << 20) +#define ARCH_PERFMON_EVENTSEL_OS (1 << 17) +#define ARCH_PERFMON_EVENTSEL_USR (1 << 16) + +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ + (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) + +union cpuid10_eax { + struct { + unsigned int version_id:8; + unsigned int num_counters:8; + unsigned int bit_width:8; + unsigned int mask_length:8; + } split; + unsigned int full; +}; + +#endif /* X86_INTEL_ARCH_PERFMON_H */ diff --git a/trunk/include/asm-x86/intel_arch_perfmon_64.h b/trunk/include/asm-x86/intel_arch_perfmon_64.h new file mode 100644 index 000000000000..8633331420ec --- /dev/null +++ b/trunk/include/asm-x86/intel_arch_perfmon_64.h @@ -0,0 +1,31 @@ +#ifndef X86_64_INTEL_ARCH_PERFMON_H +#define X86_64_INTEL_ARCH_PERFMON_H 1 + +#define MSR_ARCH_PERFMON_PERFCTR0 0xc1 +#define MSR_ARCH_PERFMON_PERFCTR1 0xc2 + +#define MSR_ARCH_PERFMON_EVENTSEL0 0x186 +#define MSR_ARCH_PERFMON_EVENTSEL1 0x187 + +#define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22) +#define ARCH_PERFMON_EVENTSEL_INT (1 << 20) +#define ARCH_PERFMON_EVENTSEL_OS (1 << 17) +#define ARCH_PERFMON_EVENTSEL_USR (1 << 16) + +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) +#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ + (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) + +union cpuid10_eax { + struct { + unsigned int version_id:8; + unsigned int num_counters:8; + unsigned int bit_width:8; + unsigned int mask_length:8; + } split; + unsigned int full; +}; + +#endif /* X86_64_INTEL_ARCH_PERFMON_H */ diff --git a/trunk/include/asm-x86/io_32.h b/trunk/include/asm-x86/io_32.h index fe881cd1e6f4..4ea7b1ad3c1d 100644 --- a/trunk/include/asm-x86/io_32.h +++ b/trunk/include/asm-x86/io_32.h @@ -199,22 +199,17 @@ static inline void writel(unsigned int b, volatile void __iomem *addr) #define mmiowb() -static inline void -memset_io(volatile void __iomem *addr, unsigned char val, int count) +static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) { - memset((void __force *)addr, val, count); + memset((void __force *) addr, val, count); } - -static inline void -memcpy_fromio(void *dst, const volatile void __iomem *src, int count) +static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) { - __memcpy(dst, (const void __force *)src, count); + __memcpy(dst, (void __force *) src, count); } - -static inline void -memcpy_toio(volatile void __iomem *dst, const void *src, int count) +static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) { - __memcpy((void __force *)dst, src, count); + __memcpy((void __force *) dst, src, count); } /* diff --git a/trunk/include/asm-x86/ioctls.h b/trunk/include/asm-x86/ioctls.h index 93c894dc5154..1e0fd48f18bc 100644 --- a/trunk/include/asm-x86/ioctls.h +++ b/trunk/include/asm-x86/ioctls.h @@ -1,87 +1,13 @@ -#ifndef _ASM_X86_IOCTLS_H -#define _ASM_X86_IOCTLS_H - -#include - -/* 0x54 is just a magic number to make these relatively unique ('T') */ - -#define TCGETS 0x5401 -#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */ -#define TCSETSW 0x5403 -#define TCSETSF 0x5404 -#define TCGETA 0x5405 -#define TCSETA 0x5406 -#define TCSETAW 0x5407 -#define TCSETAF 0x5408 -#define TCSBRK 0x5409 -#define TCXONC 0x540A -#define TCFLSH 0x540B -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E -#define TIOCGPGRP 0x540F -#define TIOCSPGRP 0x5410 -#define TIOCOUTQ 0x5411 -#define TIOCSTI 0x5412 -#define TIOCGWINSZ 0x5413 -#define TIOCSWINSZ 0x5414 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define FIONREAD 0x541B -#define TIOCINQ FIONREAD -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 -#define FIONBIO 0x5421 -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ -#define TIOCGSID 0x5429 /* Return the session ID of FD */ -#define TCGETS2 _IOR('T',0x2A, struct termios2) -#define TCSETS2 _IOW('T',0x2B, struct termios2) -#define TCSETSW2 _IOW('T',0x2C, struct termios2) -#define TCSETSF2 _IOW('T',0x2D, struct termios2) -#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ - -#define FIONCLEX 0x5450 -#define FIOCLEX 0x5451 -#define FIOASYNC 0x5452 -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ -#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ -#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ -#define FIOQSIZE 0x5460 - -/* Used for packet mode */ -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 - -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ - +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "ioctls_32.h" +# else +# include "ioctls_64.h" +# endif +#else +# ifdef __i386__ +# include "ioctls_32.h" +# else +# include "ioctls_64.h" +# endif #endif diff --git a/trunk/include/asm-x86/ioctls_32.h b/trunk/include/asm-x86/ioctls_32.h new file mode 100644 index 000000000000..ef5878762dc9 --- /dev/null +++ b/trunk/include/asm-x86/ioctls_32.h @@ -0,0 +1,87 @@ +#ifndef __ARCH_I386_IOCTLS_H__ +#define __ARCH_I386_IOCTLS_H__ + +#include + +/* 0x54 is just a magic number to make these relatively unique ('T') */ + +#define TCGETS 0x5401 +#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */ +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ +/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ +#define TCGETS2 _IOR('T',0x2A, struct termios2) +#define TCSETS2 _IOW('T',0x2B, struct termios2) +#define TCSETSW2 _IOW('T',0x2C, struct termios2) +#define TCSETSF2 _IOW('T',0x2D, struct termios2) +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ +#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ +#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ +#define FIOQSIZE 0x5460 + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +#endif diff --git a/trunk/include/asm-x86/ioctls_64.h b/trunk/include/asm-x86/ioctls_64.h new file mode 100644 index 000000000000..3fc0b15a0d7e --- /dev/null +++ b/trunk/include/asm-x86/ioctls_64.h @@ -0,0 +1,86 @@ +#ifndef __ARCH_X8664_IOCTLS_H__ +#define __ARCH_X8664_IOCTLS_H__ + +#include + +/* 0x54 is just a magic number to make these relatively unique ('T') */ + +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +#define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ +#define TCGETS2 _IOR('T',0x2A, struct termios2) +#define TCSETS2 _IOW('T',0x2B, struct termios2) +#define TCSETSW2 _IOW('T',0x2C, struct termios2) +#define TCSETSF2 _IOW('T',0x2D, struct termios2) +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + +#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ +#define FIOCLEX 0x5451 +#define FIOASYNC 0x5452 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ +#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ +#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ +#define FIOQSIZE 0x5460 + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +#endif diff --git a/trunk/include/asm-x86/ipcbuf.h b/trunk/include/asm-x86/ipcbuf.h index 2adf8b39a40b..eb2e448c6e28 100644 --- a/trunk/include/asm-x86/ipcbuf.h +++ b/trunk/include/asm-x86/ipcbuf.h @@ -1,29 +1,13 @@ -#ifndef _ASM_X86_IPCBUF_H -#define _ASM_X86_IPCBUF_H - -/* - * The ipc64_perm structure for x86 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 32-bit mode_t and seq - * - 2 miscellaneous 32-bit values - */ - -struct ipc64_perm -{ - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; - __kernel_mode_t mode; - unsigned short __pad1; - unsigned short seq; - unsigned short __pad2; - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* _ASM_X86_IPCBUF_H */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "ipcbuf_32.h" +# else +# include "ipcbuf_64.h" +# endif +#else +# ifdef __i386__ +# include "ipcbuf_32.h" +# else +# include "ipcbuf_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/ipcbuf_32.h b/trunk/include/asm-x86/ipcbuf_32.h new file mode 100644 index 000000000000..0dcad4f84c2a --- /dev/null +++ b/trunk/include/asm-x86/ipcbuf_32.h @@ -0,0 +1,29 @@ +#ifndef __i386_IPCBUF_H__ +#define __i386_IPCBUF_H__ + +/* + * The ipc64_perm structure for i386 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 32-bit mode_t and seq + * - 2 miscellaneous 32-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + unsigned short __pad1; + unsigned short seq; + unsigned short __pad2; + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* __i386_IPCBUF_H__ */ diff --git a/trunk/include/asm-x86/ipcbuf_64.h b/trunk/include/asm-x86/ipcbuf_64.h new file mode 100644 index 000000000000..470cf85e3ba8 --- /dev/null +++ b/trunk/include/asm-x86/ipcbuf_64.h @@ -0,0 +1,29 @@ +#ifndef __x86_64_IPCBUF_H__ +#define __x86_64_IPCBUF_H__ + +/* + * The ipc64_perm structure for x86_64 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 32-bit mode_t and seq + * - 2 miscellaneous 32-bit values + */ + +struct ipc64_perm +{ + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + unsigned short __pad1; + unsigned short seq; + unsigned short __pad2; + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif /* __x86_64_IPCBUF_H__ */ diff --git a/trunk/include/asm-x86/kdebug.h b/trunk/include/asm-x86/kdebug.h index e2f9b62e535e..38479106c259 100644 --- a/trunk/include/asm-x86/kdebug.h +++ b/trunk/include/asm-x86/kdebug.h @@ -1,33 +1,5 @@ -#ifndef _ASM_X86_KDEBUG_H -#define _ASM_X86_KDEBUG_H - -#include - -struct pt_regs; - -/* Grossly misnamed. */ -enum die_val { - DIE_OOPS = 1, - DIE_INT3, - DIE_DEBUG, - DIE_PANIC, - DIE_NMI, - DIE_DIE, - DIE_NMIWATCHDOG, - DIE_KERNELDEBUG, - DIE_TRAP, - DIE_GPF, - DIE_CALL, - DIE_NMI_IPI, - DIE_PAGE_FAULT, -}; - -extern void printk_address(unsigned long address); -extern void die(const char *,struct pt_regs *,long); -extern void __die(const char *,struct pt_regs *,long); -extern void show_registers(struct pt_regs *regs); -extern void dump_pagetable(unsigned long); -extern unsigned long oops_begin(void); -extern void oops_end(unsigned long); - +#ifdef CONFIG_X86_32 +# include "kdebug_32.h" +#else +# include "kdebug_64.h" #endif diff --git a/trunk/include/asm-x86/kdebug_32.h b/trunk/include/asm-x86/kdebug_32.h new file mode 100644 index 000000000000..181d437eef4b --- /dev/null +++ b/trunk/include/asm-x86/kdebug_32.h @@ -0,0 +1,27 @@ +#ifndef _I386_KDEBUG_H +#define _I386_KDEBUG_H 1 + +/* + * Aug-05 2004 Ported by Prasanna S Panchamukhi + * from x86_64 architecture. + */ + +struct pt_regs; + +/* Grossly misnamed. */ +enum die_val { + DIE_OOPS = 1, + DIE_INT3, + DIE_DEBUG, + DIE_PANIC, + DIE_NMI, + DIE_DIE, + DIE_NMIWATCHDOG, + DIE_KERNELDEBUG, + DIE_TRAP, + DIE_GPF, + DIE_CALL, + DIE_NMI_IPI, +}; + +#endif diff --git a/trunk/include/asm-x86/kdebug_64.h b/trunk/include/asm-x86/kdebug_64.h new file mode 100644 index 000000000000..df413e05375e --- /dev/null +++ b/trunk/include/asm-x86/kdebug_64.h @@ -0,0 +1,32 @@ +#ifndef _X86_64_KDEBUG_H +#define _X86_64_KDEBUG_H 1 + +#include + +struct pt_regs; + +/* Grossly misnamed. */ +enum die_val { + DIE_OOPS = 1, + DIE_INT3, + DIE_DEBUG, + DIE_PANIC, + DIE_NMI, + DIE_DIE, + DIE_NMIWATCHDOG, + DIE_KERNELDEBUG, + DIE_TRAP, + DIE_GPF, + DIE_CALL, + DIE_NMI_IPI, +}; + +extern void printk_address(unsigned long address); +extern void die(const char *,struct pt_regs *,long); +extern void __die(const char *,struct pt_regs *,long); +extern void show_registers(struct pt_regs *regs); +extern void dump_pagetable(unsigned long); +extern unsigned long oops_begin(void); +extern void oops_end(unsigned long); + +#endif diff --git a/trunk/include/asm-x86/kmap_types.h b/trunk/include/asm-x86/kmap_types.h index 5f4174132a22..e4ec724b298e 100644 --- a/trunk/include/asm-x86/kmap_types.h +++ b/trunk/include/asm-x86/kmap_types.h @@ -1,29 +1,5 @@ -#ifndef _ASM_X86_KMAP_TYPES_H -#define _ASM_X86_KMAP_TYPES_H - -#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM) -# define D(n) __KM_FENCE_##n , +#ifdef CONFIG_X86_32 +# include "kmap_types_32.h" #else -# define D(n) -#endif - -enum km_type { -D(0) KM_BOUNCE_READ, -D(1) KM_SKB_SUNRPC_DATA, -D(2) KM_SKB_DATA_SOFTIRQ, -D(3) KM_USER0, -D(4) KM_USER1, -D(5) KM_BIO_SRC_IRQ, -D(6) KM_BIO_DST_IRQ, -D(7) KM_PTE0, -D(8) KM_PTE1, -D(9) KM_IRQ0, -D(10) KM_IRQ1, -D(11) KM_SOFTIRQ0, -D(12) KM_SOFTIRQ1, -D(13) KM_TYPE_NR -}; - -#undef D - +# include "kmap_types_64.h" #endif diff --git a/trunk/include/asm-x86/kmap_types_32.h b/trunk/include/asm-x86/kmap_types_32.h new file mode 100644 index 000000000000..806aae3c5338 --- /dev/null +++ b/trunk/include/asm-x86/kmap_types_32.h @@ -0,0 +1,30 @@ +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + + +#ifdef CONFIG_DEBUG_HIGHMEM +# define D(n) __KM_FENCE_##n , +#else +# define D(n) +#endif + +enum km_type { +D(0) KM_BOUNCE_READ, +D(1) KM_SKB_SUNRPC_DATA, +D(2) KM_SKB_DATA_SOFTIRQ, +D(3) KM_USER0, +D(4) KM_USER1, +D(5) KM_BIO_SRC_IRQ, +D(6) KM_BIO_DST_IRQ, +D(7) KM_PTE0, +D(8) KM_PTE1, +D(9) KM_IRQ0, +D(10) KM_IRQ1, +D(11) KM_SOFTIRQ0, +D(12) KM_SOFTIRQ1, +D(13) KM_TYPE_NR +}; + +#undef D + +#endif diff --git a/trunk/include/asm-x86/kmap_types_64.h b/trunk/include/asm-x86/kmap_types_64.h new file mode 100644 index 000000000000..7486338c6cea --- /dev/null +++ b/trunk/include/asm-x86/kmap_types_64.h @@ -0,0 +1,19 @@ +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + +enum km_type { + KM_BOUNCE_READ, + KM_SKB_SUNRPC_DATA, + KM_SKB_DATA_SOFTIRQ, + KM_USER0, + KM_USER1, + KM_BIO_SRC_IRQ, + KM_BIO_DST_IRQ, + KM_IRQ0, + KM_IRQ1, + KM_SOFTIRQ0, + KM_SOFTIRQ1, + KM_TYPE_NR +}; + +#endif diff --git a/trunk/include/asm-x86/ldt.h b/trunk/include/asm-x86/ldt.h index 20c597242b53..3d9cc20d2ba4 100644 --- a/trunk/include/asm-x86/ldt.h +++ b/trunk/include/asm-x86/ldt.h @@ -1,40 +1,13 @@ -/* - * ldt.h - * - * Definitions of structures used with the modify_ldt system call. - */ -#ifndef _ASM_X86_LDT_H -#define _ASM_X86_LDT_H - -/* Maximum number of LDT entries supported. */ -#define LDT_ENTRIES 8192 -/* The size of each LDT entry. */ -#define LDT_ENTRY_SIZE 8 - -#ifndef __ASSEMBLY__ -/* - * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS - * not to the default values if you still want to do syscalls. This - * call is more for 32bit mode therefore. - */ -struct user_desc { - unsigned int entry_number; - unsigned int base_addr; - unsigned int limit; - unsigned int seg_32bit:1; - unsigned int contents:2; - unsigned int read_exec_only:1; - unsigned int limit_in_pages:1; - unsigned int seg_not_present:1; - unsigned int useable:1; -#ifdef __x86_64__ - unsigned int lm:1; -#endif -}; - -#define MODIFY_LDT_CONTENTS_DATA 0 -#define MODIFY_LDT_CONTENTS_STACK 1 -#define MODIFY_LDT_CONTENTS_CODE 2 - -#endif /* !__ASSEMBLY__ */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "ldt_32.h" +# else +# include "ldt_64.h" +# endif +#else +# ifdef __i386__ +# include "ldt_32.h" +# else +# include "ldt_64.h" +# endif #endif diff --git a/trunk/include/asm-x86/ldt_32.h b/trunk/include/asm-x86/ldt_32.h new file mode 100644 index 000000000000..e9d3de1dee6c --- /dev/null +++ b/trunk/include/asm-x86/ldt_32.h @@ -0,0 +1,32 @@ +/* + * ldt.h + * + * Definitions of structures used with the modify_ldt system call. + */ +#ifndef _LINUX_LDT_H +#define _LINUX_LDT_H + +/* Maximum number of LDT entries supported. */ +#define LDT_ENTRIES 8192 +/* The size of each LDT entry. */ +#define LDT_ENTRY_SIZE 8 + +#ifndef __ASSEMBLY__ +struct user_desc { + unsigned int entry_number; + unsigned long base_addr; + unsigned int limit; + unsigned int seg_32bit:1; + unsigned int contents:2; + unsigned int read_exec_only:1; + unsigned int limit_in_pages:1; + unsigned int seg_not_present:1; + unsigned int useable:1; +}; + +#define MODIFY_LDT_CONTENTS_DATA 0 +#define MODIFY_LDT_CONTENTS_STACK 1 +#define MODIFY_LDT_CONTENTS_CODE 2 + +#endif /* !__ASSEMBLY__ */ +#endif diff --git a/trunk/include/asm-x86/ldt_64.h b/trunk/include/asm-x86/ldt_64.h new file mode 100644 index 000000000000..9ef647b890d2 --- /dev/null +++ b/trunk/include/asm-x86/ldt_64.h @@ -0,0 +1,36 @@ +/* + * ldt.h + * + * Definitions of structures used with the modify_ldt system call. + */ +#ifndef _LINUX_LDT_H +#define _LINUX_LDT_H + +/* Maximum number of LDT entries supported. */ +#define LDT_ENTRIES 8192 +/* The size of each LDT entry. */ +#define LDT_ENTRY_SIZE 8 + +#ifndef __ASSEMBLY__ +/* Note on 64bit base and limit is ignored and you cannot set + DS/ES/CS not to the default values if you still want to do syscalls. This + call is more for 32bit mode therefore. */ +struct user_desc { + unsigned int entry_number; + unsigned int base_addr; + unsigned int limit; + unsigned int seg_32bit:1; + unsigned int contents:2; + unsigned int read_exec_only:1; + unsigned int limit_in_pages:1; + unsigned int seg_not_present:1; + unsigned int useable:1; + unsigned int lm:1; +}; + +#define MODIFY_LDT_CONTENTS_DATA 0 +#define MODIFY_LDT_CONTENTS_STACK 1 +#define MODIFY_LDT_CONTENTS_CODE 2 + +#endif /* !__ASSEMBLY__ */ +#endif diff --git a/trunk/include/asm-x86/mach-default/mach_apicdef.h b/trunk/include/asm-x86/mach-default/mach_apicdef.h index ae9841319094..7bcb350c3ee8 100644 --- a/trunk/include/asm-x86/mach-default/mach_apicdef.h +++ b/trunk/include/asm-x86/mach-default/mach_apicdef.h @@ -1,17 +1,11 @@ #ifndef __ASM_MACH_APICDEF_H #define __ASM_MACH_APICDEF_H -#include - #define APIC_ID_MASK (0xF<<24) static inline unsigned get_apic_id(unsigned long x) { - unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); - if (APIC_XAPIC(ver)) - return (((x)>>24)&0xFF); - else - return (((x)>>24)&0xF); + return (((x)>>24)&0xF); } #define GET_APIC_ID(x) get_apic_id(x) diff --git a/trunk/include/asm-x86/mach-visws/cobalt.h b/trunk/include/asm-x86/mach-visws/cobalt.h index 995258831b7f..33c36225a042 100644 --- a/trunk/include/asm-x86/mach-visws/cobalt.h +++ b/trunk/include/asm-x86/mach-visws/cobalt.h @@ -94,22 +94,22 @@ #define CO_IRQ_8259 CO_IRQ(CO_APIC_8259) #ifdef CONFIG_X86_VISWS_APIC -static inline void co_cpu_write(unsigned long reg, unsigned long v) +extern __inline void co_cpu_write(unsigned long reg, unsigned long v) { *((volatile unsigned long *)(CO_CPU_VADDR+reg))=v; } -static inline unsigned long co_cpu_read(unsigned long reg) +extern __inline unsigned long co_cpu_read(unsigned long reg) { return *((volatile unsigned long *)(CO_CPU_VADDR+reg)); } -static inline void co_apic_write(unsigned long reg, unsigned long v) +extern __inline void co_apic_write(unsigned long reg, unsigned long v) { *((volatile unsigned long *)(CO_APIC_VADDR+reg))=v; } -static inline unsigned long co_apic_read(unsigned long reg) +extern __inline unsigned long co_apic_read(unsigned long reg) { return *((volatile unsigned long *)(CO_APIC_VADDR+reg)); } diff --git a/trunk/include/asm-x86/mach-visws/lithium.h b/trunk/include/asm-x86/mach-visws/lithium.h index dfcd4f07ab85..d443e68d0066 100644 --- a/trunk/include/asm-x86/mach-visws/lithium.h +++ b/trunk/include/asm-x86/mach-visws/lithium.h @@ -29,22 +29,22 @@ #define LI_INTD 0x0080 /* More special purpose macros... */ -static inline void li_pcia_write16(unsigned long reg, unsigned short v) +extern __inline void li_pcia_write16(unsigned long reg, unsigned short v) { *((volatile unsigned short *)(LI_PCIA_VADDR+reg))=v; } -static inline unsigned short li_pcia_read16(unsigned long reg) +extern __inline unsigned short li_pcia_read16(unsigned long reg) { return *((volatile unsigned short *)(LI_PCIA_VADDR+reg)); } -static inline void li_pcib_write16(unsigned long reg, unsigned short v) +extern __inline void li_pcib_write16(unsigned long reg, unsigned short v) { *((volatile unsigned short *)(LI_PCIB_VADDR+reg))=v; } -static inline unsigned short li_pcib_read16(unsigned long reg) +extern __inline unsigned short li_pcib_read16(unsigned long reg) { return *((volatile unsigned short *)(LI_PCIB_VADDR+reg)); } diff --git a/trunk/include/asm-x86/mce.h b/trunk/include/asm-x86/mce.h index df304fd89c27..cc8ca389912e 100644 --- a/trunk/include/asm-x86/mce.h +++ b/trunk/include/asm-x86/mce.h @@ -1,129 +1,5 @@ -#ifndef _ASM_X86_MCE_H -#define _ASM_X86_MCE_H - -#ifdef __x86_64__ - -#include -#include - -/* - * Machine Check support for x86 - */ - -#define MCG_CTL_P (1UL<<8) /* MCG_CAP register available */ - -#define MCG_STATUS_RIPV (1UL<<0) /* restart ip valid */ -#define MCG_STATUS_EIPV (1UL<<1) /* eip points to correct instruction */ -#define MCG_STATUS_MCIP (1UL<<2) /* machine check in progress */ - -#define MCI_STATUS_VAL (1UL<<63) /* valid error */ -#define MCI_STATUS_OVER (1UL<<62) /* previous errors lost */ -#define MCI_STATUS_UC (1UL<<61) /* uncorrected error */ -#define MCI_STATUS_EN (1UL<<60) /* error enabled */ -#define MCI_STATUS_MISCV (1UL<<59) /* misc error reg. valid */ -#define MCI_STATUS_ADDRV (1UL<<58) /* addr reg. valid */ -#define MCI_STATUS_PCC (1UL<<57) /* processor context corrupt */ - -/* Fields are zero when not available */ -struct mce { - __u64 status; - __u64 misc; - __u64 addr; - __u64 mcgstatus; - __u64 rip; - __u64 tsc; /* cpu time stamp counter */ - __u64 res1; /* for future extension */ - __u64 res2; /* dito. */ - __u8 cs; /* code segment */ - __u8 bank; /* machine check bank */ - __u8 cpu; /* cpu that raised the error */ - __u8 finished; /* entry is valid */ - __u32 pad; -}; - -/* - * This structure contains all data related to the MCE log. Also - * carries a signature to make it easier to find from external - * debugging tools. Each entry is only valid when its finished flag - * is set. - */ - -#define MCE_LOG_LEN 32 - -struct mce_log { - char signature[12]; /* "MACHINECHECK" */ - unsigned len; /* = MCE_LOG_LEN */ - unsigned next; - unsigned flags; - unsigned pad0; - struct mce entry[MCE_LOG_LEN]; -}; - -#define MCE_OVERFLOW 0 /* bit 0 in flags means overflow */ - -#define MCE_LOG_SIGNATURE "MACHINECHECK" - -#define MCE_GET_RECORD_LEN _IOR('M', 1, int) -#define MCE_GET_LOG_LEN _IOR('M', 2, int) -#define MCE_GETCLEAR_FLAGS _IOR('M', 3, int) - -/* Software defined banks */ -#define MCE_EXTENDED_BANK 128 -#define MCE_THERMAL_BANK MCE_EXTENDED_BANK + 0 - -#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1) /* MCE_AMD */ -#define K8_MCE_THRESHOLD_BANK_0 (MCE_THRESHOLD_BASE + 0 * 9) -#define K8_MCE_THRESHOLD_BANK_1 (MCE_THRESHOLD_BASE + 1 * 9) -#define K8_MCE_THRESHOLD_BANK_2 (MCE_THRESHOLD_BASE + 2 * 9) -#define K8_MCE_THRESHOLD_BANK_3 (MCE_THRESHOLD_BASE + 3 * 9) -#define K8_MCE_THRESHOLD_BANK_4 (MCE_THRESHOLD_BASE + 4 * 9) -#define K8_MCE_THRESHOLD_BANK_5 (MCE_THRESHOLD_BASE + 5 * 9) -#define K8_MCE_THRESHOLD_DRAM_ECC (MCE_THRESHOLD_BANK_4 + 0) - -#endif /* __x86_64__ */ - -#ifdef __KERNEL__ - #ifdef CONFIG_X86_32 -#ifdef CONFIG_X86_MCE -extern void mcheck_init(struct cpuinfo_x86 *c); +# include "mce_32.h" #else -#define mcheck_init(c) do {} while(0) -#endif - -extern int mce_disabled; - -#else /* CONFIG_X86_32 */ - -#include - -void mce_log(struct mce *m); -DECLARE_PER_CPU(struct sys_device, device_mce); - -#ifdef CONFIG_X86_MCE_INTEL -void mce_intel_feature_init(struct cpuinfo_x86 *c); -#else -static inline void mce_intel_feature_init(struct cpuinfo_x86 *c) { } -#endif - -#ifdef CONFIG_X86_MCE_AMD -void mce_amd_feature_init(struct cpuinfo_x86 *c); -#else -static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) { } -#endif - -void mce_log_therm_throt_event(unsigned int cpu, __u64 status); - -extern atomic_t mce_entry; - -extern void do_machine_check(struct pt_regs *, long); -extern int mce_notify_user(void); - -#endif /* !CONFIG_X86_32 */ - -extern void stop_mce(void); -extern void restart_mce(void); - -#endif /* __KERNEL__ */ - +# include "mce_64.h" #endif diff --git a/trunk/include/asm-x86/mce_32.h b/trunk/include/asm-x86/mce_32.h new file mode 100644 index 000000000000..d56d89742e8f --- /dev/null +++ b/trunk/include/asm-x86/mce_32.h @@ -0,0 +1,11 @@ +#ifdef CONFIG_X86_MCE +extern void mcheck_init(struct cpuinfo_x86 *c); +#else +#define mcheck_init(c) do {} while(0) +#endif + +extern int mce_disabled; + +extern void stop_mce(void); +extern void restart_mce(void); + diff --git a/trunk/include/asm-x86/mce_64.h b/trunk/include/asm-x86/mce_64.h new file mode 100644 index 000000000000..7bc030a1996d --- /dev/null +++ b/trunk/include/asm-x86/mce_64.h @@ -0,0 +1,115 @@ +#ifndef _ASM_MCE_H +#define _ASM_MCE_H 1 + +#include +#include + +/* + * Machine Check support for x86 + */ + +#define MCG_CTL_P (1UL<<8) /* MCG_CAP register available */ + +#define MCG_STATUS_RIPV (1UL<<0) /* restart ip valid */ +#define MCG_STATUS_EIPV (1UL<<1) /* eip points to correct instruction */ +#define MCG_STATUS_MCIP (1UL<<2) /* machine check in progress */ + +#define MCI_STATUS_VAL (1UL<<63) /* valid error */ +#define MCI_STATUS_OVER (1UL<<62) /* previous errors lost */ +#define MCI_STATUS_UC (1UL<<61) /* uncorrected error */ +#define MCI_STATUS_EN (1UL<<60) /* error enabled */ +#define MCI_STATUS_MISCV (1UL<<59) /* misc error reg. valid */ +#define MCI_STATUS_ADDRV (1UL<<58) /* addr reg. valid */ +#define MCI_STATUS_PCC (1UL<<57) /* processor context corrupt */ + +/* Fields are zero when not available */ +struct mce { + __u64 status; + __u64 misc; + __u64 addr; + __u64 mcgstatus; + __u64 rip; + __u64 tsc; /* cpu time stamp counter */ + __u64 res1; /* for future extension */ + __u64 res2; /* dito. */ + __u8 cs; /* code segment */ + __u8 bank; /* machine check bank */ + __u8 cpu; /* cpu that raised the error */ + __u8 finished; /* entry is valid */ + __u32 pad; +}; + +/* + * This structure contains all data related to the MCE log. + * Also carries a signature to make it easier to find from external debugging tools. + * Each entry is only valid when its finished flag is set. + */ + +#define MCE_LOG_LEN 32 + +struct mce_log { + char signature[12]; /* "MACHINECHECK" */ + unsigned len; /* = MCE_LOG_LEN */ + unsigned next; + unsigned flags; + unsigned pad0; + struct mce entry[MCE_LOG_LEN]; +}; + +#define MCE_OVERFLOW 0 /* bit 0 in flags means overflow */ + +#define MCE_LOG_SIGNATURE "MACHINECHECK" + +#define MCE_GET_RECORD_LEN _IOR('M', 1, int) +#define MCE_GET_LOG_LEN _IOR('M', 2, int) +#define MCE_GETCLEAR_FLAGS _IOR('M', 3, int) + +/* Software defined banks */ +#define MCE_EXTENDED_BANK 128 +#define MCE_THERMAL_BANK MCE_EXTENDED_BANK + 0 + +#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1) /* MCE_AMD */ +#define K8_MCE_THRESHOLD_BANK_0 (MCE_THRESHOLD_BASE + 0 * 9) +#define K8_MCE_THRESHOLD_BANK_1 (MCE_THRESHOLD_BASE + 1 * 9) +#define K8_MCE_THRESHOLD_BANK_2 (MCE_THRESHOLD_BASE + 2 * 9) +#define K8_MCE_THRESHOLD_BANK_3 (MCE_THRESHOLD_BASE + 3 * 9) +#define K8_MCE_THRESHOLD_BANK_4 (MCE_THRESHOLD_BASE + 4 * 9) +#define K8_MCE_THRESHOLD_BANK_5 (MCE_THRESHOLD_BASE + 5 * 9) +#define K8_MCE_THRESHOLD_DRAM_ECC (MCE_THRESHOLD_BANK_4 + 0) + +#ifdef __KERNEL__ +#include + +void mce_log(struct mce *m); +DECLARE_PER_CPU(struct sys_device, device_mce); + +#ifdef CONFIG_X86_MCE_INTEL +void mce_intel_feature_init(struct cpuinfo_x86 *c); +#else +static inline void mce_intel_feature_init(struct cpuinfo_x86 *c) +{ +} +#endif + +#ifdef CONFIG_X86_MCE_AMD +void mce_amd_feature_init(struct cpuinfo_x86 *c); +#else +static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) +{ +} +#endif + +void mce_log_therm_throt_event(unsigned int cpu, __u64 status); + +extern atomic_t mce_entry; + +extern void do_machine_check(struct pt_regs *, long); + +extern int mce_notify_user(void); + +extern void stop_mce(void); +extern void restart_mce(void); + +#endif + +#endif diff --git a/trunk/include/asm-x86/mman.h b/trunk/include/asm-x86/mman.h index c1682b542daf..322db07e82c3 100644 --- a/trunk/include/asm-x86/mman.h +++ b/trunk/include/asm-x86/mman.h @@ -1,19 +1,13 @@ -#ifndef _ASM_X86_MMAN_H -#define _ASM_X86_MMAN_H - -#include - -#define MAP_32BIT 0x40 /* only give out 32bit addresses */ - -#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define MAP_LOCKED 0x2000 /* pages are locked */ -#define MAP_NORESERVE 0x4000 /* don't check for reservations */ -#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000 /* do not block on IO */ - -#define MCL_CURRENT 1 /* lock all current mappings */ -#define MCL_FUTURE 2 /* lock all future mappings */ - -#endif /* _ASM_X86_MMAN_H */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "mman_32.h" +# else +# include "mman_64.h" +# endif +#else +# ifdef __i386__ +# include "mman_32.h" +# else +# include "mman_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/mman_32.h b/trunk/include/asm-x86/mman_32.h new file mode 100644 index 000000000000..8fd9d7ab7faf --- /dev/null +++ b/trunk/include/asm-x86/mman_32.h @@ -0,0 +1,17 @@ +#ifndef __I386_MMAN_H__ +#define __I386_MMAN_H__ + +#include + +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_LOCKED 0x2000 /* pages are locked */ +#define MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000 /* do not block on IO */ + +#define MCL_CURRENT 1 /* lock all current mappings */ +#define MCL_FUTURE 2 /* lock all future mappings */ + +#endif /* __I386_MMAN_H__ */ diff --git a/trunk/include/asm-x86/mman_64.h b/trunk/include/asm-x86/mman_64.h new file mode 100644 index 000000000000..dd5cb0534d37 --- /dev/null +++ b/trunk/include/asm-x86/mman_64.h @@ -0,0 +1,19 @@ +#ifndef __X8664_MMAN_H__ +#define __X8664_MMAN_H__ + +#include + +#define MAP_32BIT 0x40 /* only give out 32bit addresses */ + +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_LOCKED 0x2000 /* pages are locked */ +#define MAP_NORESERVE 0x4000 /* don't check for reservations */ +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000 /* do not block on IO */ + +#define MCL_CURRENT 1 /* lock all current mappings */ +#define MCL_FUTURE 2 /* lock all future mappings */ + +#endif diff --git a/trunk/include/asm-x86/mmu_32.h b/trunk/include/asm-x86/mmu_32.h index 5e249c51ef56..8358dd3df7aa 100644 --- a/trunk/include/asm-x86/mmu_32.h +++ b/trunk/include/asm-x86/mmu_32.h @@ -1,7 +1,7 @@ #ifndef __i386_MMU_H #define __i386_MMU_H -#include +#include /* * The i386 doesn't have a mmu context, but * we put the segment information here. @@ -10,7 +10,7 @@ */ typedef struct { int size; - struct mutex lock; + struct semaphore sem; void *ldt; void *vdso; } mm_context_t; diff --git a/trunk/include/asm-x86/mmu_64.h b/trunk/include/asm-x86/mmu_64.h index 024357c27222..d2cd4a9d984d 100644 --- a/trunk/include/asm-x86/mmu_64.h +++ b/trunk/include/asm-x86/mmu_64.h @@ -2,7 +2,7 @@ #define __x86_64_MMU_H #include -#include +#include /* * The x86_64 doesn't have a mmu context, but @@ -14,7 +14,7 @@ typedef struct { void *ldt; rwlock_t ldtlock; int size; - struct mutex lock; + struct semaphore sem; void *vdso; } mm_context_t; diff --git a/trunk/include/asm-x86/namei.h b/trunk/include/asm-x86/namei.h index 415ef5d9550e..732f8f0b3dcd 100644 --- a/trunk/include/asm-x86/namei.h +++ b/trunk/include/asm-x86/namei.h @@ -1,11 +1,5 @@ -#ifndef _ASM_X86_NAMEI_H -#define _ASM_X86_NAMEI_H - -/* This dummy routine maybe changed to something useful - * for /usr/gnemul/ emulation stuff. - * Look at asm-sparc/namei.h for details. - */ - -#define __emul_prefix() NULL - -#endif /* _ASM_X86_NAMEI_H */ +#ifdef CONFIG_X86_32 +# include "namei_32.h" +#else +# include "namei_64.h" +#endif diff --git a/trunk/include/asm-x86/namei_32.h b/trunk/include/asm-x86/namei_32.h new file mode 100644 index 000000000000..814865088617 --- /dev/null +++ b/trunk/include/asm-x86/namei_32.h @@ -0,0 +1,17 @@ +/* $Id: namei.h,v 1.1 1996/12/13 14:48:21 jj Exp $ + * linux/include/asm-i386/namei.h + * + * Included from linux/fs/namei.c + */ + +#ifndef __I386_NAMEI_H +#define __I386_NAMEI_H + +/* This dummy routine maybe changed to something useful + * for /usr/gnemul/ emulation stuff. + * Look at asm-sparc/namei.h for details. + */ + +#define __emul_prefix() NULL + +#endif /* __I386_NAMEI_H */ diff --git a/trunk/include/asm-x86/namei_64.h b/trunk/include/asm-x86/namei_64.h new file mode 100644 index 000000000000..bef239f5318f --- /dev/null +++ b/trunk/include/asm-x86/namei_64.h @@ -0,0 +1,11 @@ +#ifndef __X8664_NAMEI_H +#define __X8664_NAMEI_H + +/* This dummy routine maybe changed to something useful + * for /usr/gnemul/ emulation stuff. + * Look at asm-sparc/namei.h for details. + */ + +#define __emul_prefix() NULL + +#endif diff --git a/trunk/include/asm-x86/numa_64.h b/trunk/include/asm-x86/numa_64.h index 0cc5c97a7fc9..933ff11ece15 100644 --- a/trunk/include/asm-x86/numa_64.h +++ b/trunk/include/asm-x86/numa_64.h @@ -2,7 +2,6 @@ #define _ASM_X8664_NUMA_H 1 #include -#include struct bootnode { u64 start,end; @@ -20,7 +19,7 @@ extern void numa_set_node(int cpu, int node); extern void srat_reserve_add_area(int nodeid); extern int hotadd_percent; -extern unsigned char apicid_to_node[MAX_LOCAL_APIC]; +extern unsigned char apicid_to_node[256]; #ifdef CONFIG_NUMA extern void __init init_cpu_to_node(void); diff --git a/trunk/include/asm-x86/param.h b/trunk/include/asm-x86/param.h index c996ec4da0c8..640851bab124 100644 --- a/trunk/include/asm-x86/param.h +++ b/trunk/include/asm-x86/param.h @@ -1,22 +1,13 @@ -#ifndef _ASM_X86_PARAM_H -#define _ASM_X86_PARAM_H - #ifdef __KERNEL__ -# define HZ CONFIG_HZ /* Internal kernel timer frequency */ -# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ -# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ +# ifdef CONFIG_X86_32 +# include "param_32.h" +# else +# include "param_64.h" +# endif +#else +# ifdef __i386__ +# include "param_32.h" +# else +# include "param_64.h" +# endif #endif - -#ifndef HZ -#define HZ 100 -#endif - -#define EXEC_PAGESIZE 4096 - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - -#endif /* _ASM_X86_PARAM_H */ diff --git a/trunk/include/asm-x86/param_32.h b/trunk/include/asm-x86/param_32.h new file mode 100644 index 000000000000..21b32466fcdc --- /dev/null +++ b/trunk/include/asm-x86/param_32.h @@ -0,0 +1,22 @@ +#ifndef _ASMi386_PARAM_H +#define _ASMi386_PARAM_H + +#ifdef __KERNEL__ +# define HZ CONFIG_HZ /* Internal kernel timer frequency */ +# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ +#endif + +#ifndef HZ +#define HZ 100 +#endif + +#define EXEC_PAGESIZE 4096 + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#endif diff --git a/trunk/include/asm-x86/param_64.h b/trunk/include/asm-x86/param_64.h new file mode 100644 index 000000000000..a728786c3c7c --- /dev/null +++ b/trunk/include/asm-x86/param_64.h @@ -0,0 +1,22 @@ +#ifndef _ASMx86_64_PARAM_H +#define _ASMx86_64_PARAM_H + +#ifdef __KERNEL__ +# define HZ CONFIG_HZ /* Internal kernel timer frequency */ +# define USER_HZ 100 /* .. some user interfaces are in "ticks */ +#define CLOCKS_PER_SEC (USER_HZ) /* like times() */ +#endif + +#ifndef HZ +#define HZ 100 +#endif + +#define EXEC_PAGESIZE 4096 + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#endif diff --git a/trunk/include/asm-x86/paravirt.h b/trunk/include/asm-x86/paravirt.h index f59d370c5df4..9fa3fa9e62d1 100644 --- a/trunk/include/asm-x86/paravirt.h +++ b/trunk/include/asm-x86/paravirt.h @@ -25,22 +25,27 @@ struct tss_struct; struct mm_struct; struct desc_struct; -/* general info */ -struct pv_info { +/* Lazy mode for batching updates / context switch */ +enum paravirt_lazy_mode { + PARAVIRT_LAZY_NONE = 0, + PARAVIRT_LAZY_MMU = 1, + PARAVIRT_LAZY_CPU = 2, + PARAVIRT_LAZY_FLUSH = 3, +}; + +struct paravirt_ops +{ unsigned int kernel_rpl; int shared_kernel_pmd; - int paravirt_enabled; + int paravirt_enabled; const char *name; -}; -struct pv_init_ops { /* - * Patch may replace one of the defined code sequences with - * arbitrary code, subject to the same register constraints. - * This generally means the code is not free to clobber any - * registers other than EAX. The patch function should return - * the number of bytes of code generated, as we nop pad the - * rest in generic code. + * Patch may replace one of the defined code sequences with arbitrary + * code, subject to the same register constraints. This generally + * means the code is not free to clobber any registers other than EAX. + * The patch function should return the number of bytes of code + * generated, as we nop pad the rest in generic code. */ unsigned (*patch)(u8 type, u16 clobber, void *insnbuf, unsigned long addr, unsigned len); @@ -50,29 +55,29 @@ struct pv_init_ops { char *(*memory_setup)(void); void (*post_allocator_init)(void); - /* Print a banner to identify the environment */ - void (*banner)(void); -}; - + void (*init_IRQ)(void); + void (*time_init)(void); -struct pv_lazy_ops { - /* Set deferred update mode, used for batching operations. */ - void (*enter)(void); - void (*leave)(void); -}; + /* + * Called before/after init_mm pagetable setup. setup_start + * may reset %cr3, and may pre-install parts of the pagetable; + * pagetable setup is expected to preserve any existing + * mapping. + */ + void (*pagetable_setup_start)(pgd_t *pgd_base); + void (*pagetable_setup_done)(pgd_t *pgd_base); -struct pv_time_ops { - void (*time_init)(void); + /* Print a banner to identify the environment */ + void (*banner)(void); /* Set and set time of day */ unsigned long (*get_wallclock)(void); int (*set_wallclock)(unsigned long); - unsigned long long (*sched_clock)(void); - unsigned long (*get_cpu_khz)(void); -}; + /* cpuid emulation, mostly so that caps bits can be disabled */ + void (*cpuid)(unsigned int *eax, unsigned int *ebx, + unsigned int *ecx, unsigned int *edx); -struct pv_cpu_ops { /* hooks for various privileged instructions */ unsigned long (*get_debugreg)(int regno); void (*set_debugreg)(int regno, unsigned long value); @@ -82,10 +87,41 @@ struct pv_cpu_ops { unsigned long (*read_cr0)(void); void (*write_cr0)(unsigned long); + unsigned long (*read_cr2)(void); + void (*write_cr2)(unsigned long); + + unsigned long (*read_cr3)(void); + void (*write_cr3)(unsigned long); + unsigned long (*read_cr4_safe)(void); unsigned long (*read_cr4)(void); void (*write_cr4)(unsigned long); + /* + * Get/set interrupt state. save_fl and restore_fl are only + * expected to use X86_EFLAGS_IF; all other bits + * returned from save_fl are undefined, and may be ignored by + * restore_fl. + */ + unsigned long (*save_fl)(void); + void (*restore_fl)(unsigned long); + void (*irq_disable)(void); + void (*irq_enable)(void); + void (*safe_halt)(void); + void (*halt)(void); + + void (*wbinvd)(void); + + /* MSR, PMC and TSR operations. + err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ + u64 (*read_msr)(unsigned int msr, int *err); + int (*write_msr)(unsigned int msr, u64 val); + + u64 (*read_tsc)(void); + u64 (*read_pmc)(void); + unsigned long long (*sched_clock)(void); + unsigned long (*get_cpu_khz)(void); + /* Segment descriptor handling */ void (*load_tr_desc)(void); void (*load_gdt)(const struct Xgt_desc_struct *); @@ -104,47 +140,18 @@ struct pv_cpu_ops { void (*load_esp0)(struct tss_struct *tss, struct thread_struct *t); void (*set_iopl_mask)(unsigned mask); - - void (*wbinvd)(void); void (*io_delay)(void); - /* cpuid emulation, mostly so that caps bits can be disabled */ - void (*cpuid)(unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx); - - /* MSR, PMC and TSR operations. - err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ - u64 (*read_msr)(unsigned int msr, int *err); - int (*write_msr)(unsigned int msr, u64 val); - - u64 (*read_tsc)(void); - u64 (*read_pmc)(void); - - /* These two are jmp to, not actually called. */ - void (*irq_enable_sysexit)(void); - void (*iret)(void); - - struct pv_lazy_ops lazy_mode; -}; - -struct pv_irq_ops { - void (*init_IRQ)(void); - /* - * Get/set interrupt state. save_fl and restore_fl are only - * expected to use X86_EFLAGS_IF; all other bits - * returned from save_fl are undefined, and may be ignored by - * restore_fl. + * Hooks for intercepting the creation/use/destruction of an + * mm_struct. */ - unsigned long (*save_fl)(void); - void (*restore_fl)(unsigned long); - void (*irq_disable)(void); - void (*irq_enable)(void); - void (*safe_halt)(void); - void (*halt)(void); -}; + void (*activate_mm)(struct mm_struct *prev, + struct mm_struct *next); + void (*dup_mmap)(struct mm_struct *oldmm, + struct mm_struct *mm); + void (*exit_mmap)(struct mm_struct *mm); -struct pv_apic_ops { #ifdef CONFIG_X86_LOCAL_APIC /* * Direct APIC operations, principally for VMI. Ideally @@ -160,34 +167,6 @@ struct pv_apic_ops { unsigned long start_eip, unsigned long start_esp); #endif -}; - -struct pv_mmu_ops { - /* - * Called before/after init_mm pagetable setup. setup_start - * may reset %cr3, and may pre-install parts of the pagetable; - * pagetable setup is expected to preserve any existing - * mapping. - */ - void (*pagetable_setup_start)(pgd_t *pgd_base); - void (*pagetable_setup_done)(pgd_t *pgd_base); - - unsigned long (*read_cr2)(void); - void (*write_cr2)(unsigned long); - - unsigned long (*read_cr3)(void); - void (*write_cr3)(unsigned long); - - /* - * Hooks for intercepting the creation/use/destruction of an - * mm_struct. - */ - void (*activate_mm)(struct mm_struct *prev, - struct mm_struct *next); - void (*dup_mmap)(struct mm_struct *oldmm, - struct mm_struct *mm); - void (*exit_mmap)(struct mm_struct *mm); - /* TLB operations */ void (*flush_tlb_user)(void); @@ -212,12 +191,15 @@ struct pv_mmu_ops { void (*pte_update_defer)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); +#ifdef CONFIG_HIGHPTE + void *(*kmap_atomic_pte)(struct page *page, enum km_type type); +#endif + #ifdef CONFIG_X86_PAE void (*set_pte_atomic)(pte_t *ptep, pte_t pteval); - void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte); + void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); void (*set_pud)(pud_t *pudp, pud_t pudval); - void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); + void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); void (*pmd_clear)(pmd_t *pmdp); unsigned long long (*pte_val)(pte_t); @@ -235,40 +217,21 @@ struct pv_mmu_ops { pgd_t (*make_pgd)(unsigned long pgd); #endif -#ifdef CONFIG_HIGHPTE - void *(*kmap_atomic_pte)(struct page *page, enum km_type type); -#endif - - struct pv_lazy_ops lazy_mode; -}; + /* Set deferred update mode, used for batching operations. */ + void (*set_lazy_mode)(enum paravirt_lazy_mode mode); -/* This contains all the paravirt structures: we get a convenient - * number for each function using the offset which we use to indicate - * what to patch. */ -struct paravirt_patch_template -{ - struct pv_init_ops pv_init_ops; - struct pv_time_ops pv_time_ops; - struct pv_cpu_ops pv_cpu_ops; - struct pv_irq_ops pv_irq_ops; - struct pv_apic_ops pv_apic_ops; - struct pv_mmu_ops pv_mmu_ops; + /* These two are jmp to, not actually called. */ + void (*irq_enable_sysexit)(void); + void (*iret)(void); }; -extern struct pv_info pv_info; -extern struct pv_init_ops pv_init_ops; -extern struct pv_time_ops pv_time_ops; -extern struct pv_cpu_ops pv_cpu_ops; -extern struct pv_irq_ops pv_irq_ops; -extern struct pv_apic_ops pv_apic_ops; -extern struct pv_mmu_ops pv_mmu_ops; +extern struct paravirt_ops paravirt_ops; #define PARAVIRT_PATCH(x) \ - (offsetof(struct paravirt_patch_template, x) / sizeof(void *)) + (offsetof(struct paravirt_ops, x) / sizeof(void *)) -#define paravirt_type(op) \ - [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \ - [paravirt_opptr] "m" (op) +#define paravirt_type(type) \ + [paravirt_typenum] "i" (PARAVIRT_PATCH(type)) #define paravirt_clobber(clobber) \ [paravirt_clobber] "i" (clobber) @@ -295,7 +258,7 @@ unsigned paravirt_patch_call(void *insnbuf, const void *target, u16 tgt_clobbers, unsigned long addr, u16 site_clobbers, unsigned len); -unsigned paravirt_patch_jmp(void *insnbuf, const void *target, +unsigned paravirt_patch_jmp(const void *target, void *insnbuf, unsigned long addr, unsigned len); unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf, unsigned long addr, unsigned len); @@ -308,14 +271,14 @@ int paravirt_disable_iospace(void); /* * This generates an indirect call based on the operation type number. * The type number, computed in PARAVIRT_PATCH, is derived from the - * offset into the paravirt_patch_template structure, and can therefore be - * freely converted back into a structure offset. + * offset into the paravirt_ops structure, and can therefore be freely + * converted back into a structure offset. */ -#define PARAVIRT_CALL "call *%[paravirt_opptr];" +#define PARAVIRT_CALL "call *(paravirt_ops+%c[paravirt_typenum]*4);" /* - * These macros are intended to wrap calls through one of the paravirt - * ops structs, so that they can be later identified and patched at + * These macros are intended to wrap calls into a paravirt_ops + * operation, so that they can be later identified and patched at * runtime. * * Normally, a call to a pv_op function is a simple indirect call: @@ -338,7 +301,7 @@ int paravirt_disable_iospace(void); * The call instruction itself is marked by placing its start address * and size into the .parainstructions section, so that * apply_paravirt() in arch/i386/kernel/alternative.c can do the - * appropriate patching under the control of the backend pv_init_ops + * appropriate patching under the control of the backend paravirt_ops * implementation. * * Unfortunately there's no way to get gcc to generate the args setup @@ -446,36 +409,36 @@ int paravirt_disable_iospace(void); static inline int paravirt_enabled(void) { - return pv_info.paravirt_enabled; + return paravirt_ops.paravirt_enabled; } static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread) { - PVOP_VCALL2(pv_cpu_ops.load_esp0, tss, thread); + PVOP_VCALL2(load_esp0, tss, thread); } -#define ARCH_SETUP pv_init_ops.arch_setup(); +#define ARCH_SETUP paravirt_ops.arch_setup(); static inline unsigned long get_wallclock(void) { - return PVOP_CALL0(unsigned long, pv_time_ops.get_wallclock); + return PVOP_CALL0(unsigned long, get_wallclock); } static inline int set_wallclock(unsigned long nowtime) { - return PVOP_CALL1(int, pv_time_ops.set_wallclock, nowtime); + return PVOP_CALL1(int, set_wallclock, nowtime); } static inline void (*choose_time_init(void))(void) { - return pv_time_ops.time_init; + return paravirt_ops.time_init; } /* The paravirtualized CPUID instruction. */ static inline void __cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { - PVOP_VCALL4(pv_cpu_ops.cpuid, eax, ebx, ecx, edx); + PVOP_VCALL4(cpuid, eax, ebx, ecx, edx); } /* @@ -483,87 +446,87 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx, */ static inline unsigned long paravirt_get_debugreg(int reg) { - return PVOP_CALL1(unsigned long, pv_cpu_ops.get_debugreg, reg); + return PVOP_CALL1(unsigned long, get_debugreg, reg); } #define get_debugreg(var, reg) var = paravirt_get_debugreg(reg) static inline void set_debugreg(unsigned long val, int reg) { - PVOP_VCALL2(pv_cpu_ops.set_debugreg, reg, val); + PVOP_VCALL2(set_debugreg, reg, val); } static inline void clts(void) { - PVOP_VCALL0(pv_cpu_ops.clts); + PVOP_VCALL0(clts); } static inline unsigned long read_cr0(void) { - return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr0); + return PVOP_CALL0(unsigned long, read_cr0); } static inline void write_cr0(unsigned long x) { - PVOP_VCALL1(pv_cpu_ops.write_cr0, x); + PVOP_VCALL1(write_cr0, x); } static inline unsigned long read_cr2(void) { - return PVOP_CALL0(unsigned long, pv_mmu_ops.read_cr2); + return PVOP_CALL0(unsigned long, read_cr2); } static inline void write_cr2(unsigned long x) { - PVOP_VCALL1(pv_mmu_ops.write_cr2, x); + PVOP_VCALL1(write_cr2, x); } static inline unsigned long read_cr3(void) { - return PVOP_CALL0(unsigned long, pv_mmu_ops.read_cr3); + return PVOP_CALL0(unsigned long, read_cr3); } static inline void write_cr3(unsigned long x) { - PVOP_VCALL1(pv_mmu_ops.write_cr3, x); + PVOP_VCALL1(write_cr3, x); } static inline unsigned long read_cr4(void) { - return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr4); + return PVOP_CALL0(unsigned long, read_cr4); } static inline unsigned long read_cr4_safe(void) { - return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr4_safe); + return PVOP_CALL0(unsigned long, read_cr4_safe); } static inline void write_cr4(unsigned long x) { - PVOP_VCALL1(pv_cpu_ops.write_cr4, x); + PVOP_VCALL1(write_cr4, x); } static inline void raw_safe_halt(void) { - PVOP_VCALL0(pv_irq_ops.safe_halt); + PVOP_VCALL0(safe_halt); } static inline void halt(void) { - PVOP_VCALL0(pv_irq_ops.safe_halt); + PVOP_VCALL0(safe_halt); } static inline void wbinvd(void) { - PVOP_VCALL0(pv_cpu_ops.wbinvd); + PVOP_VCALL0(wbinvd); } -#define get_kernel_rpl() (pv_info.kernel_rpl) +#define get_kernel_rpl() (paravirt_ops.kernel_rpl) static inline u64 paravirt_read_msr(unsigned msr, int *err) { - return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err); + return PVOP_CALL2(u64, read_msr, msr, err); } static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) { - return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high); + return PVOP_CALL3(int, write_msr, msr, low, high); } /* These should all do BUG_ON(_err), but our headers are too tangled. */ @@ -597,7 +560,7 @@ static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high) static inline u64 paravirt_read_tsc(void) { - return PVOP_CALL0(u64, pv_cpu_ops.read_tsc); + return PVOP_CALL0(u64, read_tsc); } #define rdtscl(low) do { \ @@ -609,15 +572,15 @@ static inline u64 paravirt_read_tsc(void) static inline unsigned long long paravirt_sched_clock(void) { - return PVOP_CALL0(unsigned long long, pv_time_ops.sched_clock); + return PVOP_CALL0(unsigned long long, sched_clock); } -#define calculate_cpu_khz() (pv_time_ops.get_cpu_khz()) +#define calculate_cpu_khz() (paravirt_ops.get_cpu_khz()) #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) static inline unsigned long long paravirt_read_pmc(int counter) { - return PVOP_CALL1(u64, pv_cpu_ops.read_pmc, counter); + return PVOP_CALL1(u64, read_pmc, counter); } #define rdpmc(counter,low,high) do { \ @@ -628,61 +591,61 @@ static inline unsigned long long paravirt_read_pmc(int counter) static inline void load_TR_desc(void) { - PVOP_VCALL0(pv_cpu_ops.load_tr_desc); + PVOP_VCALL0(load_tr_desc); } static inline void load_gdt(const struct Xgt_desc_struct *dtr) { - PVOP_VCALL1(pv_cpu_ops.load_gdt, dtr); + PVOP_VCALL1(load_gdt, dtr); } static inline void load_idt(const struct Xgt_desc_struct *dtr) { - PVOP_VCALL1(pv_cpu_ops.load_idt, dtr); + PVOP_VCALL1(load_idt, dtr); } static inline void set_ldt(const void *addr, unsigned entries) { - PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries); + PVOP_VCALL2(set_ldt, addr, entries); } static inline void store_gdt(struct Xgt_desc_struct *dtr) { - PVOP_VCALL1(pv_cpu_ops.store_gdt, dtr); + PVOP_VCALL1(store_gdt, dtr); } static inline void store_idt(struct Xgt_desc_struct *dtr) { - PVOP_VCALL1(pv_cpu_ops.store_idt, dtr); + PVOP_VCALL1(store_idt, dtr); } static inline unsigned long paravirt_store_tr(void) { - return PVOP_CALL0(unsigned long, pv_cpu_ops.store_tr); + return PVOP_CALL0(unsigned long, store_tr); } #define store_tr(tr) ((tr) = paravirt_store_tr()) static inline void load_TLS(struct thread_struct *t, unsigned cpu) { - PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu); + PVOP_VCALL2(load_tls, t, cpu); } static inline void write_ldt_entry(void *dt, int entry, u32 low, u32 high) { - PVOP_VCALL4(pv_cpu_ops.write_ldt_entry, dt, entry, low, high); + PVOP_VCALL4(write_ldt_entry, dt, entry, low, high); } static inline void write_gdt_entry(void *dt, int entry, u32 low, u32 high) { - PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, low, high); + PVOP_VCALL4(write_gdt_entry, dt, entry, low, high); } static inline void write_idt_entry(void *dt, int entry, u32 low, u32 high) { - PVOP_VCALL4(pv_cpu_ops.write_idt_entry, dt, entry, low, high); + PVOP_VCALL4(write_idt_entry, dt, entry, low, high); } static inline void set_iopl_mask(unsigned mask) { - PVOP_VCALL1(pv_cpu_ops.set_iopl_mask, mask); + PVOP_VCALL1(set_iopl_mask, mask); } /* The paravirtualized I/O functions */ static inline void slow_down_io(void) { - pv_cpu_ops.io_delay(); + paravirt_ops.io_delay(); #ifdef REALLY_SLOW_IO - pv_cpu_ops.io_delay(); - pv_cpu_ops.io_delay(); - pv_cpu_ops.io_delay(); + paravirt_ops.io_delay(); + paravirt_ops.io_delay(); + paravirt_ops.io_delay(); #endif } @@ -692,120 +655,121 @@ static inline void slow_down_io(void) { */ static inline void apic_write(unsigned long reg, unsigned long v) { - PVOP_VCALL2(pv_apic_ops.apic_write, reg, v); + PVOP_VCALL2(apic_write, reg, v); } static inline void apic_write_atomic(unsigned long reg, unsigned long v) { - PVOP_VCALL2(pv_apic_ops.apic_write_atomic, reg, v); + PVOP_VCALL2(apic_write_atomic, reg, v); } static inline unsigned long apic_read(unsigned long reg) { - return PVOP_CALL1(unsigned long, pv_apic_ops.apic_read, reg); + return PVOP_CALL1(unsigned long, apic_read, reg); } static inline void setup_boot_clock(void) { - PVOP_VCALL0(pv_apic_ops.setup_boot_clock); + PVOP_VCALL0(setup_boot_clock); } static inline void setup_secondary_clock(void) { - PVOP_VCALL0(pv_apic_ops.setup_secondary_clock); + PVOP_VCALL0(setup_secondary_clock); } #endif static inline void paravirt_post_allocator_init(void) { - if (pv_init_ops.post_allocator_init) - (*pv_init_ops.post_allocator_init)(); + if (paravirt_ops.post_allocator_init) + (*paravirt_ops.post_allocator_init)(); } static inline void paravirt_pagetable_setup_start(pgd_t *base) { - (*pv_mmu_ops.pagetable_setup_start)(base); + if (paravirt_ops.pagetable_setup_start) + (*paravirt_ops.pagetable_setup_start)(base); } static inline void paravirt_pagetable_setup_done(pgd_t *base) { - (*pv_mmu_ops.pagetable_setup_done)(base); + if (paravirt_ops.pagetable_setup_done) + (*paravirt_ops.pagetable_setup_done)(base); } #ifdef CONFIG_SMP static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip, unsigned long start_esp) { - PVOP_VCALL3(pv_apic_ops.startup_ipi_hook, - phys_apicid, start_eip, start_esp); + PVOP_VCALL3(startup_ipi_hook, phys_apicid, start_eip, start_esp); } #endif static inline void paravirt_activate_mm(struct mm_struct *prev, struct mm_struct *next) { - PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next); + PVOP_VCALL2(activate_mm, prev, next); } static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) { - PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm); + PVOP_VCALL2(dup_mmap, oldmm, mm); } static inline void arch_exit_mmap(struct mm_struct *mm) { - PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm); + PVOP_VCALL1(exit_mmap, mm); } static inline void __flush_tlb(void) { - PVOP_VCALL0(pv_mmu_ops.flush_tlb_user); + PVOP_VCALL0(flush_tlb_user); } static inline void __flush_tlb_global(void) { - PVOP_VCALL0(pv_mmu_ops.flush_tlb_kernel); + PVOP_VCALL0(flush_tlb_kernel); } static inline void __flush_tlb_single(unsigned long addr) { - PVOP_VCALL1(pv_mmu_ops.flush_tlb_single, addr); + PVOP_VCALL1(flush_tlb_single, addr); } static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, unsigned long va) { - PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va); + PVOP_VCALL3(flush_tlb_others, &cpumask, mm, va); } static inline void paravirt_alloc_pt(struct mm_struct *mm, unsigned pfn) { - PVOP_VCALL2(pv_mmu_ops.alloc_pt, mm, pfn); + PVOP_VCALL2(alloc_pt, mm, pfn); } static inline void paravirt_release_pt(unsigned pfn) { - PVOP_VCALL1(pv_mmu_ops.release_pt, pfn); + PVOP_VCALL1(release_pt, pfn); } static inline void paravirt_alloc_pd(unsigned pfn) { - PVOP_VCALL1(pv_mmu_ops.alloc_pd, pfn); + PVOP_VCALL1(alloc_pd, pfn); } static inline void paravirt_alloc_pd_clone(unsigned pfn, unsigned clonepfn, unsigned start, unsigned count) { - PVOP_VCALL4(pv_mmu_ops.alloc_pd_clone, pfn, clonepfn, start, count); + PVOP_VCALL4(alloc_pd_clone, pfn, clonepfn, start, count); } static inline void paravirt_release_pd(unsigned pfn) { - PVOP_VCALL1(pv_mmu_ops.release_pd, pfn); + PVOP_VCALL1(release_pd, pfn); } #ifdef CONFIG_HIGHPTE static inline void *kmap_atomic_pte(struct page *page, enum km_type type) { unsigned long ret; - ret = PVOP_CALL2(unsigned long, pv_mmu_ops.kmap_atomic_pte, page, type); + ret = PVOP_CALL2(unsigned long, kmap_atomic_pte, page, type); return (void *)ret; } #endif @@ -813,191 +777,162 @@ static inline void *kmap_atomic_pte(struct page *page, enum km_type type) static inline void pte_update(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { - PVOP_VCALL3(pv_mmu_ops.pte_update, mm, addr, ptep); + PVOP_VCALL3(pte_update, mm, addr, ptep); } static inline void pte_update_defer(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { - PVOP_VCALL3(pv_mmu_ops.pte_update_defer, mm, addr, ptep); + PVOP_VCALL3(pte_update_defer, mm, addr, ptep); } #ifdef CONFIG_X86_PAE static inline pte_t __pte(unsigned long long val) { - unsigned long long ret = PVOP_CALL2(unsigned long long, - pv_mmu_ops.make_pte, + unsigned long long ret = PVOP_CALL2(unsigned long long, make_pte, val, val >> 32); return (pte_t) { ret, ret >> 32 }; } static inline pmd_t __pmd(unsigned long long val) { - return (pmd_t) { PVOP_CALL2(unsigned long long, pv_mmu_ops.make_pmd, - val, val >> 32) }; + return (pmd_t) { PVOP_CALL2(unsigned long long, make_pmd, val, val >> 32) }; } static inline pgd_t __pgd(unsigned long long val) { - return (pgd_t) { PVOP_CALL2(unsigned long long, pv_mmu_ops.make_pgd, - val, val >> 32) }; + return (pgd_t) { PVOP_CALL2(unsigned long long, make_pgd, val, val >> 32) }; } static inline unsigned long long pte_val(pte_t x) { - return PVOP_CALL2(unsigned long long, pv_mmu_ops.pte_val, - x.pte_low, x.pte_high); + return PVOP_CALL2(unsigned long long, pte_val, x.pte_low, x.pte_high); } static inline unsigned long long pmd_val(pmd_t x) { - return PVOP_CALL2(unsigned long long, pv_mmu_ops.pmd_val, - x.pmd, x.pmd >> 32); + return PVOP_CALL2(unsigned long long, pmd_val, x.pmd, x.pmd >> 32); } static inline unsigned long long pgd_val(pgd_t x) { - return PVOP_CALL2(unsigned long long, pv_mmu_ops.pgd_val, - x.pgd, x.pgd >> 32); + return PVOP_CALL2(unsigned long long, pgd_val, x.pgd, x.pgd >> 32); } static inline void set_pte(pte_t *ptep, pte_t pteval) { - PVOP_VCALL3(pv_mmu_ops.set_pte, ptep, pteval.pte_low, pteval.pte_high); + PVOP_VCALL3(set_pte, ptep, pteval.pte_low, pteval.pte_high); } static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) { /* 5 arg words */ - pv_mmu_ops.set_pte_at(mm, addr, ptep, pteval); + paravirt_ops.set_pte_at(mm, addr, ptep, pteval); } static inline void set_pte_atomic(pte_t *ptep, pte_t pteval) { - PVOP_VCALL3(pv_mmu_ops.set_pte_atomic, ptep, - pteval.pte_low, pteval.pte_high); + PVOP_VCALL3(set_pte_atomic, ptep, pteval.pte_low, pteval.pte_high); } static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { /* 5 arg words */ - pv_mmu_ops.set_pte_present(mm, addr, ptep, pte); + paravirt_ops.set_pte_present(mm, addr, ptep, pte); } static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval) { - PVOP_VCALL3(pv_mmu_ops.set_pmd, pmdp, - pmdval.pmd, pmdval.pmd >> 32); + PVOP_VCALL3(set_pmd, pmdp, pmdval.pmd, pmdval.pmd >> 32); } static inline void set_pud(pud_t *pudp, pud_t pudval) { - PVOP_VCALL3(pv_mmu_ops.set_pud, pudp, - pudval.pgd.pgd, pudval.pgd.pgd >> 32); + PVOP_VCALL3(set_pud, pudp, pudval.pgd.pgd, pudval.pgd.pgd >> 32); } static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { - PVOP_VCALL3(pv_mmu_ops.pte_clear, mm, addr, ptep); + PVOP_VCALL3(pte_clear, mm, addr, ptep); } static inline void pmd_clear(pmd_t *pmdp) { - PVOP_VCALL1(pv_mmu_ops.pmd_clear, pmdp); + PVOP_VCALL1(pmd_clear, pmdp); } #else /* !CONFIG_X86_PAE */ static inline pte_t __pte(unsigned long val) { - return (pte_t) { PVOP_CALL1(unsigned long, pv_mmu_ops.make_pte, val) }; + return (pte_t) { PVOP_CALL1(unsigned long, make_pte, val) }; } static inline pgd_t __pgd(unsigned long val) { - return (pgd_t) { PVOP_CALL1(unsigned long, pv_mmu_ops.make_pgd, val) }; + return (pgd_t) { PVOP_CALL1(unsigned long, make_pgd, val) }; } static inline unsigned long pte_val(pte_t x) { - return PVOP_CALL1(unsigned long, pv_mmu_ops.pte_val, x.pte_low); + return PVOP_CALL1(unsigned long, pte_val, x.pte_low); } static inline unsigned long pgd_val(pgd_t x) { - return PVOP_CALL1(unsigned long, pv_mmu_ops.pgd_val, x.pgd); + return PVOP_CALL1(unsigned long, pgd_val, x.pgd); } static inline void set_pte(pte_t *ptep, pte_t pteval) { - PVOP_VCALL2(pv_mmu_ops.set_pte, ptep, pteval.pte_low); + PVOP_VCALL2(set_pte, ptep, pteval.pte_low); } static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) { - PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pteval.pte_low); + PVOP_VCALL4(set_pte_at, mm, addr, ptep, pteval.pte_low); } static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval) { - PVOP_VCALL2(pv_mmu_ops.set_pmd, pmdp, pmdval.pud.pgd.pgd); + PVOP_VCALL2(set_pmd, pmdp, pmdval.pud.pgd.pgd); } #endif /* CONFIG_X86_PAE */ -/* Lazy mode for batching updates / context switch */ -enum paravirt_lazy_mode { - PARAVIRT_LAZY_NONE, - PARAVIRT_LAZY_MMU, - PARAVIRT_LAZY_CPU, -}; - -enum paravirt_lazy_mode paravirt_get_lazy_mode(void); -void paravirt_enter_lazy_cpu(void); -void paravirt_leave_lazy_cpu(void); -void paravirt_enter_lazy_mmu(void); -void paravirt_leave_lazy_mmu(void); -void paravirt_leave_lazy(enum paravirt_lazy_mode mode); - #define __HAVE_ARCH_ENTER_LAZY_CPU_MODE static inline void arch_enter_lazy_cpu_mode(void) { - PVOP_VCALL0(pv_cpu_ops.lazy_mode.enter); + PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_CPU); } static inline void arch_leave_lazy_cpu_mode(void) { - PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave); + PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_NONE); } static inline void arch_flush_lazy_cpu_mode(void) { - if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)) { - arch_leave_lazy_cpu_mode(); - arch_enter_lazy_cpu_mode(); - } + PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_FLUSH); } #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE static inline void arch_enter_lazy_mmu_mode(void) { - PVOP_VCALL0(pv_mmu_ops.lazy_mode.enter); + PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_MMU); } static inline void arch_leave_lazy_mmu_mode(void) { - PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); + PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_NONE); } static inline void arch_flush_lazy_mmu_mode(void) { - if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU)) { - arch_leave_lazy_mmu_mode(); - arch_enter_lazy_mmu_mode(); - } + PVOP_VCALL1(set_lazy_mode, PARAVIRT_LAZY_FLUSH); } void _paravirt_nop(void); @@ -1022,7 +957,7 @@ static inline unsigned long __raw_local_save_flags(void) PARAVIRT_CALL "popl %%edx; popl %%ecx") : "=a"(f) - : paravirt_type(pv_irq_ops.save_fl), + : paravirt_type(save_fl), paravirt_clobber(CLBR_EAX) : "memory", "cc"); return f; @@ -1035,7 +970,7 @@ static inline void raw_local_irq_restore(unsigned long f) "popl %%edx; popl %%ecx") : "=a"(f) : "0"(f), - paravirt_type(pv_irq_ops.restore_fl), + paravirt_type(restore_fl), paravirt_clobber(CLBR_EAX) : "memory", "cc"); } @@ -1046,7 +981,7 @@ static inline void raw_local_irq_disable(void) PARAVIRT_CALL "popl %%edx; popl %%ecx") : - : paravirt_type(pv_irq_ops.irq_disable), + : paravirt_type(irq_disable), paravirt_clobber(CLBR_EAX) : "memory", "eax", "cc"); } @@ -1057,7 +992,7 @@ static inline void raw_local_irq_enable(void) PARAVIRT_CALL "popl %%edx; popl %%ecx") : - : paravirt_type(pv_irq_ops.irq_enable), + : paravirt_type(irq_enable), paravirt_clobber(CLBR_EAX) : "memory", "eax", "cc"); } @@ -1073,23 +1008,21 @@ static inline unsigned long __raw_local_irq_save(void) #define CLI_STRING \ _paravirt_alt("pushl %%ecx; pushl %%edx;" \ - "call *%[paravirt_cli_opptr];" \ + "call *paravirt_ops+%c[paravirt_cli_type]*4;" \ "popl %%edx; popl %%ecx", \ "%c[paravirt_cli_type]", "%c[paravirt_clobber]") #define STI_STRING \ _paravirt_alt("pushl %%ecx; pushl %%edx;" \ - "call *%[paravirt_sti_opptr];" \ + "call *paravirt_ops+%c[paravirt_sti_type]*4;" \ "popl %%edx; popl %%ecx", \ "%c[paravirt_sti_type]", "%c[paravirt_clobber]") #define CLI_STI_CLOBBERS , "%eax" #define CLI_STI_INPUT_ARGS \ , \ - [paravirt_cli_type] "i" (PARAVIRT_PATCH(pv_irq_ops.irq_disable)), \ - [paravirt_cli_opptr] "m" (pv_irq_ops.irq_disable), \ - [paravirt_sti_type] "i" (PARAVIRT_PATCH(pv_irq_ops.irq_enable)), \ - [paravirt_sti_opptr] "m" (pv_irq_ops.irq_enable), \ + [paravirt_cli_type] "i" (PARAVIRT_PATCH(irq_disable)), \ + [paravirt_sti_type] "i" (PARAVIRT_PATCH(irq_enable)), \ paravirt_clobber(CLBR_EAX) /* Make sure as little as possible of this mess escapes. */ @@ -1109,7 +1042,7 @@ static inline unsigned long __raw_local_irq_save(void) #else /* __ASSEMBLY__ */ -#define PARA_PATCH(struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4) +#define PARA_PATCH(off) ((off) / 4) #define PARA_SITE(ptype, clobbers, ops) \ 771:; \ @@ -1122,29 +1055,29 @@ static inline unsigned long __raw_local_irq_save(void) .short clobbers; \ .popsection -#define INTERRUPT_RETURN \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \ - jmp *%cs:pv_cpu_ops+PV_CPU_iret) +#define INTERRUPT_RETURN \ + PARA_SITE(PARA_PATCH(PARAVIRT_iret), CLBR_NONE, \ + jmp *%cs:paravirt_ops+PARAVIRT_iret) #define DISABLE_INTERRUPTS(clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \ + PARA_SITE(PARA_PATCH(PARAVIRT_irq_disable), clobbers, \ pushl %eax; pushl %ecx; pushl %edx; \ - call *%cs:pv_irq_ops+PV_IRQ_irq_disable; \ + call *%cs:paravirt_ops+PARAVIRT_irq_disable; \ popl %edx; popl %ecx; popl %eax) \ #define ENABLE_INTERRUPTS(clobbers) \ - PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \ + PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable), clobbers, \ pushl %eax; pushl %ecx; pushl %edx; \ - call *%cs:pv_irq_ops+PV_IRQ_irq_enable; \ + call *%cs:paravirt_ops+PARAVIRT_irq_enable; \ popl %edx; popl %ecx; popl %eax) -#define ENABLE_INTERRUPTS_SYSEXIT \ - PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_irq_enable_sysexit), CLBR_NONE,\ - jmp *%cs:pv_cpu_ops+PV_CPU_irq_enable_sysexit) +#define ENABLE_INTERRUPTS_SYSEXIT \ + PARA_SITE(PARA_PATCH(PARAVIRT_irq_enable_sysexit), CLBR_NONE, \ + jmp *%cs:paravirt_ops+PARAVIRT_irq_enable_sysexit) #define GET_CR0_INTO_EAX \ push %ecx; push %edx; \ - call *pv_cpu_ops+PV_CPU_read_cr0; \ + call *paravirt_ops+PARAVIRT_read_cr0; \ pop %edx; pop %ecx #endif /* __ASSEMBLY__ */ diff --git a/trunk/include/asm-x86/parport.h b/trunk/include/asm-x86/parport.h index 019cbca24a38..2a31157349c9 100644 --- a/trunk/include/asm-x86/parport.h +++ b/trunk/include/asm-x86/parport.h @@ -1,10 +1,5 @@ -#ifndef _ASM_X86_PARPORT_H -#define _ASM_X86_PARPORT_H - -static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); -static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) -{ - return parport_pc_find_isa_ports (autoirq, autodma); -} - -#endif /* _ASM_X86_PARPORT_H */ +#ifdef CONFIG_X86_32 +# include "parport_32.h" +#else +# include "parport_64.h" +#endif diff --git a/trunk/include/asm-x86/parport_32.h b/trunk/include/asm-x86/parport_32.h new file mode 100644 index 000000000000..fa0e321e498e --- /dev/null +++ b/trunk/include/asm-x86/parport_32.h @@ -0,0 +1,18 @@ +/* + * parport.h: ia32-specific parport initialisation + * + * Copyright (C) 1999, 2000 Tim Waugh + * + * This file should only be included by drivers/parport/parport_pc.c. + */ + +#ifndef _ASM_I386_PARPORT_H +#define _ASM_I386_PARPORT_H 1 + +static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); +static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) +{ + return parport_pc_find_isa_ports (autoirq, autodma); +} + +#endif /* !(_ASM_I386_PARPORT_H) */ diff --git a/trunk/include/asm-x86/parport_64.h b/trunk/include/asm-x86/parport_64.h new file mode 100644 index 000000000000..7135ef977c96 --- /dev/null +++ b/trunk/include/asm-x86/parport_64.h @@ -0,0 +1,18 @@ +/* + * parport.h: ia32-specific parport initialisation + * + * Copyright (C) 1999, 2000 Tim Waugh + * + * This file should only be included by drivers/parport/parport_pc.c. + */ + +#ifndef _ASM_X8664_PARPORT_H +#define _ASM_X8664_PARPORT_H 1 + +static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); +static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) +{ + return parport_pc_find_isa_ports (autoirq, autodma); +} + +#endif diff --git a/trunk/include/asm-x86/pda.h b/trunk/include/asm-x86/pda.h index 35962bbe5e72..fb49f80eb94f 100644 --- a/trunk/include/asm-x86/pda.h +++ b/trunk/include/asm-x86/pda.h @@ -30,12 +30,6 @@ struct x8664_pda { struct mm_struct *active_mm; unsigned apic_timer_irqs; unsigned irq0_irqs; - unsigned irq_resched_count; - unsigned irq_call_count; - unsigned irq_tlb_count; - unsigned irq_thermal_count; - unsigned irq_threshold_count; - unsigned irq_spurious_count; } ____cacheline_aligned_in_smp; extern struct x8664_pda *_cpu_pda[]; diff --git a/trunk/include/asm-x86/pgtable-3level-defs.h b/trunk/include/asm-x86/pgtable-3level-defs.h index 448ac9516314..c0df89f66e8b 100644 --- a/trunk/include/asm-x86/pgtable-3level-defs.h +++ b/trunk/include/asm-x86/pgtable-3level-defs.h @@ -2,7 +2,7 @@ #define _I386_PGTABLE_3LEVEL_DEFS_H #ifdef CONFIG_PARAVIRT -#define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd) +#define SHARED_KERNEL_PMD (paravirt_ops.shared_kernel_pmd) #else #define SHARED_KERNEL_PMD 1 #endif diff --git a/trunk/include/asm-x86/processor_32.h b/trunk/include/asm-x86/processor_32.h index 83800e7496ee..3845fe72383e 100644 --- a/trunk/include/asm-x86/processor_32.h +++ b/trunk/include/asm-x86/processor_32.h @@ -595,9 +595,7 @@ static inline void load_esp0(struct tss_struct *tss, struct thread_struct *threa * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx * resulting in stale register contents being returned. */ -static inline void cpuid(unsigned int op, - unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) +static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { *eax = op; *ecx = 0; @@ -605,9 +603,8 @@ static inline void cpuid(unsigned int op, } /* Some CPUID calls want 'count' to be placed in ecx */ -static inline void cpuid_count(unsigned int op, int count, - unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) +static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, + int *edx) { *eax = op; *ecx = count; @@ -677,17 +674,6 @@ static inline unsigned int cpuid_edx(unsigned int op) #define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" #define K7_NOP8 K7_NOP7 ASM_NOP1 -/* P6 nops */ -/* uses eax dependencies (Intel-recommended choice) */ -#define P6_NOP1 GENERIC_NOP1 -#define P6_NOP2 ".byte 0x66,0x90\n" -#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" -#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" -#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" -#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" -#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" -#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" - #ifdef CONFIG_MK8 #define ASM_NOP1 K8_NOP1 #define ASM_NOP2 K8_NOP2 @@ -706,17 +692,6 @@ static inline unsigned int cpuid_edx(unsigned int op) #define ASM_NOP6 K7_NOP6 #define ASM_NOP7 K7_NOP7 #define ASM_NOP8 K7_NOP8 -#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \ - defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \ - defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4) -#define ASM_NOP1 P6_NOP1 -#define ASM_NOP2 P6_NOP2 -#define ASM_NOP3 P6_NOP3 -#define ASM_NOP4 P6_NOP4 -#define ASM_NOP5 P6_NOP5 -#define ASM_NOP6 P6_NOP6 -#define ASM_NOP7 P6_NOP7 -#define ASM_NOP8 P6_NOP8 #else #define ASM_NOP1 GENERIC_NOP1 #define ASM_NOP2 GENERIC_NOP2 diff --git a/trunk/include/asm-x86/processor_64.h b/trunk/include/asm-x86/processor_64.h index f422becbddd9..31f579b828f2 100644 --- a/trunk/include/asm-x86/processor_64.h +++ b/trunk/include/asm-x86/processor_64.h @@ -334,16 +334,6 @@ struct extended_sigtable { }; -#if defined(CONFIG_MPSC) || defined(CONFIG_MCORE2) -#define ASM_NOP1 P6_NOP1 -#define ASM_NOP2 P6_NOP2 -#define ASM_NOP3 P6_NOP3 -#define ASM_NOP4 P6_NOP4 -#define ASM_NOP5 P6_NOP5 -#define ASM_NOP6 P6_NOP6 -#define ASM_NOP7 P6_NOP7 -#define ASM_NOP8 P6_NOP8 -#else #define ASM_NOP1 K8_NOP1 #define ASM_NOP2 K8_NOP2 #define ASM_NOP3 K8_NOP3 @@ -352,7 +342,6 @@ struct extended_sigtable { #define ASM_NOP6 K8_NOP6 #define ASM_NOP7 K8_NOP7 #define ASM_NOP8 K8_NOP8 -#endif /* Opteron nops */ #define K8_NOP1 ".byte 0x90\n" @@ -364,17 +353,6 @@ struct extended_sigtable { #define K8_NOP7 K8_NOP4 K8_NOP3 #define K8_NOP8 K8_NOP4 K8_NOP4 -/* P6 nops */ -/* uses eax dependencies (Intel-recommended choice) */ -#define P6_NOP1 ".byte 0x90\n" -#define P6_NOP2 ".byte 0x66,0x90\n" -#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" -#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n" -#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n" -#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n" -#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n" -#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n" - #define ASM_NOP_MAX 8 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ @@ -411,6 +389,11 @@ static inline void prefetchw(void *x) #define cpu_relax() rep_nop() +static inline void serialize_cpu(void) +{ + __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); +} + static inline void __monitor(const void *eax, unsigned long ecx, unsigned long edx) { diff --git a/trunk/include/asm-x86/ptrace-abi.h b/trunk/include/asm-x86/ptrace-abi.h index 7524e1233833..6824c49def1c 100644 --- a/trunk/include/asm-x86/ptrace-abi.h +++ b/trunk/include/asm-x86/ptrace-abi.h @@ -1,81 +1,13 @@ -#ifndef _ASM_X86_PTRACE_ABI_H -#define _ASM_X86_PTRACE_ABI_H - -#ifdef __i386__ - -#define EBX 0 -#define ECX 1 -#define EDX 2 -#define ESI 3 -#define EDI 4 -#define EBP 5 -#define EAX 6 -#define DS 7 -#define ES 8 -#define FS 9 -#define GS 10 -#define ORIG_EAX 11 -#define EIP 12 -#define CS 13 -#define EFL 14 -#define UESP 15 -#define SS 16 -#define FRAME_SIZE 17 - -#else /* __i386__ */ - -#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) -#define R15 0 -#define R14 8 -#define R13 16 -#define R12 24 -#define RBP 32 -#define RBX 40 -/* arguments: interrupts/non tracing syscalls only save upto here*/ -#define R11 48 -#define R10 56 -#define R9 64 -#define R8 72 -#define RAX 80 -#define RCX 88 -#define RDX 96 -#define RSI 104 -#define RDI 112 -#define ORIG_RAX 120 /* = ERROR */ -/* end of arguments */ -/* cpu exception frame or undefined in case of fast syscall. */ -#define RIP 128 -#define CS 136 -#define EFLAGS 144 -#define RSP 152 -#define SS 160 -#define ARGOFFSET R11 -#endif /* __ASSEMBLY__ */ - -/* top of stack page */ -#define FRAME_SIZE 168 - -#endif /* !__i386__ */ - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 -#define PTRACE_GETFPXREGS 18 -#define PTRACE_SETFPXREGS 19 - -#define PTRACE_OLDSETOPTIONS 21 - -/* only useful for access 32bit programs / kernels */ -#define PTRACE_GET_THREAD_AREA 25 -#define PTRACE_SET_THREAD_AREA 26 - -#ifdef __x86_64__ -# define PTRACE_ARCH_PRCTL 30 +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "ptrace-abi_32.h" +# else +# include "ptrace-abi_64.h" +# endif #else -# define PTRACE_SYSEMU 31 -# define PTRACE_SYSEMU_SINGLESTEP 32 -#endif - +# ifdef __i386__ +# include "ptrace-abi_32.h" +# else +# include "ptrace-abi_64.h" +# endif #endif diff --git a/trunk/include/asm-x86/ptrace-abi_32.h b/trunk/include/asm-x86/ptrace-abi_32.h new file mode 100644 index 000000000000..a44901817a26 --- /dev/null +++ b/trunk/include/asm-x86/ptrace-abi_32.h @@ -0,0 +1,39 @@ +#ifndef I386_PTRACE_ABI_H +#define I386_PTRACE_ABI_H + +#define EBX 0 +#define ECX 1 +#define EDX 2 +#define ESI 3 +#define EDI 4 +#define EBP 5 +#define EAX 6 +#define DS 7 +#define ES 8 +#define FS 9 +#define GS 10 +#define ORIG_EAX 11 +#define EIP 12 +#define CS 13 +#define EFL 14 +#define UESP 15 +#define SS 16 +#define FRAME_SIZE 17 + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_GETFPXREGS 18 +#define PTRACE_SETFPXREGS 19 + +#define PTRACE_OLDSETOPTIONS 21 + +#define PTRACE_GET_THREAD_AREA 25 +#define PTRACE_SET_THREAD_AREA 26 + +#define PTRACE_SYSEMU 31 +#define PTRACE_SYSEMU_SINGLESTEP 32 + +#endif diff --git a/trunk/include/asm-x86/ptrace-abi_64.h b/trunk/include/asm-x86/ptrace-abi_64.h new file mode 100644 index 000000000000..19184b0806b1 --- /dev/null +++ b/trunk/include/asm-x86/ptrace-abi_64.h @@ -0,0 +1,51 @@ +#ifndef _X86_64_PTRACE_ABI_H +#define _X86_64_PTRACE_ABI_H + +#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) +#define R15 0 +#define R14 8 +#define R13 16 +#define R12 24 +#define RBP 32 +#define RBX 40 +/* arguments: interrupts/non tracing syscalls only save upto here*/ +#define R11 48 +#define R10 56 +#define R9 64 +#define R8 72 +#define RAX 80 +#define RCX 88 +#define RDX 96 +#define RSI 104 +#define RDI 112 +#define ORIG_RAX 120 /* = ERROR */ +/* end of arguments */ +/* cpu exception frame or undefined in case of fast syscall. */ +#define RIP 128 +#define CS 136 +#define EFLAGS 144 +#define RSP 152 +#define SS 160 +#define ARGOFFSET R11 +#endif /* __ASSEMBLY__ */ + +/* top of stack page */ +#define FRAME_SIZE 168 + +#define PTRACE_OLDSETOPTIONS 21 + +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 +#define PTRACE_GETFPXREGS 18 +#define PTRACE_SETFPXREGS 19 + +/* only useful for access 32bit programs */ +#define PTRACE_GET_THREAD_AREA 25 +#define PTRACE_SET_THREAD_AREA 26 + +#define PTRACE_ARCH_PRCTL 30 /* arch_prctl for child */ + +#endif diff --git a/trunk/include/asm-x86/resource.h b/trunk/include/asm-x86/resource.h index 04bc4db8921b..732410a8c02a 100644 --- a/trunk/include/asm-x86/resource.h +++ b/trunk/include/asm-x86/resource.h @@ -1 +1,13 @@ -#include +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "resource_32.h" +# else +# include "resource_64.h" +# endif +#else +# ifdef __i386__ +# include "resource_32.h" +# else +# include "resource_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/resource_32.h b/trunk/include/asm-x86/resource_32.h new file mode 100644 index 000000000000..6c1ea37c7718 --- /dev/null +++ b/trunk/include/asm-x86/resource_32.h @@ -0,0 +1,6 @@ +#ifndef _I386_RESOURCE_H +#define _I386_RESOURCE_H + +#include + +#endif diff --git a/trunk/include/asm-x86/resource_64.h b/trunk/include/asm-x86/resource_64.h new file mode 100644 index 000000000000..f40b40623234 --- /dev/null +++ b/trunk/include/asm-x86/resource_64.h @@ -0,0 +1,6 @@ +#ifndef _X8664_RESOURCE_H +#define _X8664_RESOURCE_H + +#include + +#endif diff --git a/trunk/include/asm-x86/rtc.h b/trunk/include/asm-x86/rtc.h index f71c3b0ed360..1f0c98eb2e38 100644 --- a/trunk/include/asm-x86/rtc.h +++ b/trunk/include/asm-x86/rtc.h @@ -1 +1,5 @@ -#include +#ifdef CONFIG_X86_32 +# include "rtc_32.h" +#else +# include "rtc_64.h" +#endif diff --git a/trunk/include/asm-x86/rtc_32.h b/trunk/include/asm-x86/rtc_32.h new file mode 100644 index 000000000000..ffd02109a0e5 --- /dev/null +++ b/trunk/include/asm-x86/rtc_32.h @@ -0,0 +1,10 @@ +#ifndef _I386_RTC_H +#define _I386_RTC_H + +/* + * x86 uses the default access methods for the RTC. + */ + +#include + +#endif diff --git a/trunk/include/asm-x86/rtc_64.h b/trunk/include/asm-x86/rtc_64.h new file mode 100644 index 000000000000..18ed713ac7de --- /dev/null +++ b/trunk/include/asm-x86/rtc_64.h @@ -0,0 +1,10 @@ +#ifndef _X86_64_RTC_H +#define _X86_64_RTC_H + +/* + * x86 uses the default access methods for the RTC. + */ + +#include + +#endif diff --git a/trunk/include/asm-x86/rwlock.h b/trunk/include/asm-x86/rwlock.h index f2b64a429e6b..a3be7d8364af 100644 --- a/trunk/include/asm-x86/rwlock.h +++ b/trunk/include/asm-x86/rwlock.h @@ -1,9 +1,5 @@ -#ifndef _ASM_X86_RWLOCK_H -#define _ASM_X86_RWLOCK_H - -#define RW_LOCK_BIAS 0x01000000 -#define RW_LOCK_BIAS_STR "0x01000000" - -/* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */ - -#endif /* _ASM_X86_RWLOCK_H */ +#ifdef CONFIG_X86_32 +# include "rwlock_32.h" +#else +# include "rwlock_64.h" +#endif diff --git a/trunk/include/asm-x86/rwlock_32.h b/trunk/include/asm-x86/rwlock_32.h new file mode 100644 index 000000000000..c3e5db32fa48 --- /dev/null +++ b/trunk/include/asm-x86/rwlock_32.h @@ -0,0 +1,25 @@ +/* include/asm-i386/rwlock.h + * + * Helpers used by both rw spinlocks and rw semaphores. + * + * Based in part on code from semaphore.h and + * spinlock.h Copyright 1996 Linus Torvalds. + * + * Copyright 1999 Red Hat, Inc. + * + * Written by Benjamin LaHaise. + * + * 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. + */ +#ifndef _ASM_I386_RWLOCK_H +#define _ASM_I386_RWLOCK_H + +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" + +/* Code is in asm-i386/spinlock.h */ + +#endif diff --git a/trunk/include/asm-x86/rwlock_64.h b/trunk/include/asm-x86/rwlock_64.h new file mode 100644 index 000000000000..72aeebed920b --- /dev/null +++ b/trunk/include/asm-x86/rwlock_64.h @@ -0,0 +1,26 @@ +/* include/asm-x86_64/rwlock.h + * + * Helpers used by both rw spinlocks and rw semaphores. + * + * Based in part on code from semaphore.h and + * spinlock.h Copyright 1996 Linus Torvalds. + * + * Copyright 1999 Red Hat, Inc. + * Copyright 2001,2002 SuSE labs + * + * Written by Benjamin LaHaise. + * + * 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. + */ +#ifndef _ASM_X86_64_RWLOCK_H +#define _ASM_X86_64_RWLOCK_H + +#define RW_LOCK_BIAS 0x01000000 +#define RW_LOCK_BIAS_STR "0x01000000" + +/* Actual code is in asm/spinlock.h or in arch/x86_64/lib/rwlock.S */ + +#endif diff --git a/trunk/include/asm-x86/sections.h b/trunk/include/asm-x86/sections.h index 2b8c5160388f..ae6c69d9be3f 100644 --- a/trunk/include/asm-x86/sections.h +++ b/trunk/include/asm-x86/sections.h @@ -1 +1,5 @@ -#include +#ifdef CONFIG_X86_32 +# include "sections_32.h" +#else +# include "sections_64.h" +#endif diff --git a/trunk/include/asm-x86/sections_32.h b/trunk/include/asm-x86/sections_32.h new file mode 100644 index 000000000000..2dcbb92918b2 --- /dev/null +++ b/trunk/include/asm-x86/sections_32.h @@ -0,0 +1,7 @@ +#ifndef _I386_SECTIONS_H +#define _I386_SECTIONS_H + +/* nothing to see, move along */ +#include + +#endif diff --git a/trunk/include/asm-x86/sections_64.h b/trunk/include/asm-x86/sections_64.h new file mode 100644 index 000000000000..c746d9f1e70c --- /dev/null +++ b/trunk/include/asm-x86/sections_64.h @@ -0,0 +1,7 @@ +#ifndef _X8664_SECTIONS_H +#define _X8664_SECTIONS_H + +/* nothing to see, move along */ +#include + +#endif diff --git a/trunk/include/asm-x86/sembuf.h b/trunk/include/asm-x86/sembuf.h index ee50c801f7b7..e42c971e383f 100644 --- a/trunk/include/asm-x86/sembuf.h +++ b/trunk/include/asm-x86/sembuf.h @@ -1,24 +1,13 @@ -#ifndef _ASM_X86_SEMBUF_H -#define _ASM_X86_SEMBUF_H - -/* - * The semid64_ds structure for x86 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ - __kernel_time_t sem_otime; /* last semop time */ - unsigned long __unused1; - __kernel_time_t sem_ctime; /* last change time */ - unsigned long __unused2; - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused3; - unsigned long __unused4; -}; - -#endif /* _ASM_X86_SEMBUF_H */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "sembuf_32.h" +# else +# include "sembuf_64.h" +# endif +#else +# ifdef __i386__ +# include "sembuf_32.h" +# else +# include "sembuf_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/sembuf_32.h b/trunk/include/asm-x86/sembuf_32.h new file mode 100644 index 000000000000..323835166c14 --- /dev/null +++ b/trunk/include/asm-x86/sembuf_32.h @@ -0,0 +1,25 @@ +#ifndef _I386_SEMBUF_H +#define _I386_SEMBUF_H + +/* + * The semid64_ds structure for i386 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + __kernel_time_t sem_otime; /* last semop time */ + unsigned long __unused1; + __kernel_time_t sem_ctime; /* last change time */ + unsigned long __unused2; + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _I386_SEMBUF_H */ diff --git a/trunk/include/asm-x86/sembuf_64.h b/trunk/include/asm-x86/sembuf_64.h new file mode 100644 index 000000000000..63b52925ae2a --- /dev/null +++ b/trunk/include/asm-x86/sembuf_64.h @@ -0,0 +1,25 @@ +#ifndef _X86_64_SEMBUF_H +#define _X86_64_SEMBUF_H + +/* + * The semid64_ds structure for x86_64 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 64-bit time_t to solve y2038 problem + * - 2 miscellaneous 32-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + __kernel_time_t sem_otime; /* last semop time */ + unsigned long __unused1; + __kernel_time_t sem_ctime; /* last change time */ + unsigned long __unused2; + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* _X86_64_SEMBUF_H */ diff --git a/trunk/include/asm-x86/serial.h b/trunk/include/asm-x86/serial.h index 628c801535ea..cf1b05227b29 100644 --- a/trunk/include/asm-x86/serial.h +++ b/trunk/include/asm-x86/serial.h @@ -1,29 +1,5 @@ -#ifndef _ASM_X86_SERIAL_H -#define _ASM_X86_SERIAL_H - -/* - * This assumes you have a 1.8432 MHz clock for your UART. - * - * It'd be nice if someone built a serial card with a 24.576 MHz - * clock, since the 16550A is capable of handling a top speed of 1.5 - * megabits/second; but this requires the faster clock. - */ -#define BASE_BAUD ( 1843200 / 16 ) - -/* Standard COM flags (except for COM4, because of the 8514 problem) */ -#ifdef CONFIG_SERIAL_DETECT_IRQ -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) -#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) +#ifdef CONFIG_X86_32 +# include "serial_32.h" #else -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) -#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF +# include "serial_64.h" #endif - -#define SERIAL_PORT_DFNS \ - /* UART CLK PORT IRQ FLAGS */ \ - { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ - { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ - { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ - { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ - -#endif /* _ASM_X86_SERIAL_H */ diff --git a/trunk/include/asm-x86/serial_32.h b/trunk/include/asm-x86/serial_32.h new file mode 100644 index 000000000000..bd67480ca109 --- /dev/null +++ b/trunk/include/asm-x86/serial_32.h @@ -0,0 +1,29 @@ +/* + * include/asm-i386/serial.h + */ + + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD ( 1843200 / 16 ) + +/* Standard COM flags (except for COM4, because of the 8514 problem) */ +#ifdef CONFIG_SERIAL_DETECT_IRQ +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) +#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) +#else +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF +#endif + +#define SERIAL_PORT_DFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ diff --git a/trunk/include/asm-x86/serial_64.h b/trunk/include/asm-x86/serial_64.h new file mode 100644 index 000000000000..b0496e0d72a6 --- /dev/null +++ b/trunk/include/asm-x86/serial_64.h @@ -0,0 +1,29 @@ +/* + * include/asm-x86_64/serial.h + */ + + +/* + * This assumes you have a 1.8432 MHz clock for your UART. + * + * It'd be nice if someone built a serial card with a 24.576 MHz + * clock, since the 16550A is capable of handling a top speed of 1.5 + * megabits/second; but this requires the faster clock. + */ +#define BASE_BAUD ( 1843200 / 16 ) + +/* Standard COM flags (except for COM4, because of the 8514 problem) */ +#ifdef CONFIG_SERIAL_DETECT_IRQ +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) +#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) +#else +#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) +#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF +#endif + +#define SERIAL_PORT_DFNS \ + /* UART CLK PORT IRQ FLAGS */ \ + { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ + { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ + { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ + { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ diff --git a/trunk/include/asm-x86/shmparam.h b/trunk/include/asm-x86/shmparam.h index 0880cf0917b9..165627cc5345 100644 --- a/trunk/include/asm-x86/shmparam.h +++ b/trunk/include/asm-x86/shmparam.h @@ -1,6 +1,13 @@ -#ifndef _ASM_X86_SHMPARAM_H -#define _ASM_X86_SHMPARAM_H - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _ASM_X86_SHMPARAM_H */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "shmparam_32.h" +# else +# include "shmparam_64.h" +# endif +#else +# ifdef __i386__ +# include "shmparam_32.h" +# else +# include "shmparam_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/shmparam_32.h b/trunk/include/asm-x86/shmparam_32.h new file mode 100644 index 000000000000..786243a5b319 --- /dev/null +++ b/trunk/include/asm-x86/shmparam_32.h @@ -0,0 +1,6 @@ +#ifndef _ASMI386_SHMPARAM_H +#define _ASMI386_SHMPARAM_H + +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ + +#endif /* _ASMI386_SHMPARAM_H */ diff --git a/trunk/include/asm-x86/shmparam_64.h b/trunk/include/asm-x86/shmparam_64.h new file mode 100644 index 000000000000..d7021620dcb7 --- /dev/null +++ b/trunk/include/asm-x86/shmparam_64.h @@ -0,0 +1,6 @@ +#ifndef _ASMX8664_SHMPARAM_H +#define _ASMX8664_SHMPARAM_H + +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ + +#endif /* _ASMX8664_SHMPARAM_H */ diff --git a/trunk/include/asm-x86/siginfo.h b/trunk/include/asm-x86/siginfo.h index a477bea0c2a1..0b8e4bb47d25 100644 --- a/trunk/include/asm-x86/siginfo.h +++ b/trunk/include/asm-x86/siginfo.h @@ -1,10 +1,13 @@ -#ifndef _ASM_X86_SIGINFO_H -#define _ASM_X86_SIGINFO_H - -#ifdef __x86_64__ -# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) -#endif - -#include - +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "siginfo_32.h" +# else +# include "siginfo_64.h" +# endif +#else +# ifdef __i386__ +# include "siginfo_32.h" +# else +# include "siginfo_64.h" +# endif #endif diff --git a/trunk/include/asm-x86/siginfo_32.h b/trunk/include/asm-x86/siginfo_32.h new file mode 100644 index 000000000000..fe18f98fccfa --- /dev/null +++ b/trunk/include/asm-x86/siginfo_32.h @@ -0,0 +1,6 @@ +#ifndef _I386_SIGINFO_H +#define _I386_SIGINFO_H + +#include + +#endif diff --git a/trunk/include/asm-x86/siginfo_64.h b/trunk/include/asm-x86/siginfo_64.h new file mode 100644 index 000000000000..d09a1e6e7246 --- /dev/null +++ b/trunk/include/asm-x86/siginfo_64.h @@ -0,0 +1,8 @@ +#ifndef _X8664_SIGINFO_H +#define _X8664_SIGINFO_H + +#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) + +#include + +#endif diff --git a/trunk/include/asm-x86/smp_32.h b/trunk/include/asm-x86/smp_32.h index ee46038d126c..955dd7c8538f 100644 --- a/trunk/include/asm-x86/smp_32.h +++ b/trunk/include/asm-x86/smp_32.h @@ -92,9 +92,12 @@ static inline void smp_send_reschedule(int cpu) { smp_ops.smp_send_reschedule(cpu); } -extern int smp_call_function_mask(cpumask_t mask, - void (*func) (void *info), void *info, - int wait); +static inline int smp_call_function_mask(cpumask_t mask, + void (*func) (void *info), void *info, + int wait) +{ + return smp_ops.smp_call_function_mask(mask, func, info, wait); +} void native_smp_prepare_boot_cpu(void); void native_smp_prepare_cpus(unsigned int max_cpus); diff --git a/trunk/include/asm-x86/smp_64.h b/trunk/include/asm-x86/smp_64.h index d30e9b684fdd..f5bcee1c0927 100644 --- a/trunk/include/asm-x86/smp_64.h +++ b/trunk/include/asm-x86/smp_64.h @@ -85,6 +85,7 @@ static inline int hard_smp_processor_id(void) * the real APIC ID <-> CPU # mapping. */ extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */ +extern u8 x86_cpu_to_log_apicid[NR_CPUS]; extern u8 bios_cpu_apicid[]; static inline int cpu_present_to_apicid(int mps_cpu) diff --git a/trunk/include/asm-x86/sockios.h b/trunk/include/asm-x86/sockios.h index 49cc72b5d3c9..5a134fc70b9c 100644 --- a/trunk/include/asm-x86/sockios.h +++ b/trunk/include/asm-x86/sockios.h @@ -1,13 +1,13 @@ -#ifndef _ASM_X86_SOCKIOS_H -#define _ASM_X86_SOCKIOS_H - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 0x8901 -#define SIOCSPGRP 0x8902 -#define FIOGETOWN 0x8903 -#define SIOCGPGRP 0x8904 -#define SIOCATMARK 0x8905 -#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ -#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ - -#endif /* _ASM_X86_SOCKIOS_H */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "sockios_32.h" +# else +# include "sockios_64.h" +# endif +#else +# ifdef __i386__ +# include "sockios_32.h" +# else +# include "sockios_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/sockios_32.h b/trunk/include/asm-x86/sockios_32.h new file mode 100644 index 000000000000..ff528c7d255c --- /dev/null +++ b/trunk/include/asm-x86/sockios_32.h @@ -0,0 +1,13 @@ +#ifndef __ARCH_I386_SOCKIOS__ +#define __ARCH_I386_SOCKIOS__ + +/* Socket-level I/O control calls. */ +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ +#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ + +#endif diff --git a/trunk/include/asm-x86/sockios_64.h b/trunk/include/asm-x86/sockios_64.h new file mode 100644 index 000000000000..d726ba2513e3 --- /dev/null +++ b/trunk/include/asm-x86/sockios_64.h @@ -0,0 +1,13 @@ +#ifndef __ARCH_X8664_SOCKIOS__ +#define __ARCH_X8664_SOCKIOS__ + +/* Socket-level I/O control calls. */ +#define FIOSETOWN 0x8901 +#define SIOCSPGRP 0x8902 +#define FIOGETOWN 0x8903 +#define SIOCGPGRP 0x8904 +#define SIOCATMARK 0x8905 +#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ +#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ + +#endif diff --git a/trunk/include/asm-x86/stacktrace.h b/trunk/include/asm-x86/stacktrace.h index 70dd5bae3235..6f0b54594307 100644 --- a/trunk/include/asm-x86/stacktrace.h +++ b/trunk/include/asm-x86/stacktrace.h @@ -15,6 +15,6 @@ struct stacktrace_ops { }; void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, - const struct stacktrace_ops *ops, void *data); + struct stacktrace_ops *ops, void *data); #endif diff --git a/trunk/include/asm-x86/string_32.h b/trunk/include/asm-x86/string_32.h index 55bfa308f900..a9b64453bdf5 100644 --- a/trunk/include/asm-x86/string_32.h +++ b/trunk/include/asm-x86/string_32.h @@ -26,6 +26,9 @@ extern int strncmp(const char *cs, const char *ct, size_t count); #define __HAVE_ARCH_STRCHR extern char *strchr(const char *s, int c); +#define __HAVE_ARCH_STRRCHR +extern char *strrchr(const char *s, int c); + #define __HAVE_ARCH_STRLEN extern size_t strlen(const char *s); diff --git a/trunk/include/asm-x86/system_32.h b/trunk/include/asm-x86/system_32.h index db6283eb5e46..d84e593b7dfc 100644 --- a/trunk/include/asm-x86/system_32.h +++ b/trunk/include/asm-x86/system_32.h @@ -142,7 +142,7 @@ static inline unsigned long native_read_cr4_safe(void) { unsigned long val; /* This could fault if %cr4 does not exist */ - asm volatile("1: movl %%cr4, %0 \n" + asm("1: movl %%cr4, %0 \n" "2: \n" ".section __ex_table,\"a\" \n" ".long 1b,2b \n" @@ -161,10 +161,6 @@ static inline void native_wbinvd(void) asm volatile("wbinvd": : :"memory"); } -static inline void clflush(volatile void *__p) -{ - asm volatile("clflush %0" : "+m" (*(char __force *)__p)); -} #ifdef CONFIG_PARAVIRT #include diff --git a/trunk/include/asm-x86/system_64.h b/trunk/include/asm-x86/system_64.h index 4cb23848d460..5022aecc333d 100644 --- a/trunk/include/asm-x86/system_64.h +++ b/trunk/include/asm-x86/system_64.h @@ -7,6 +7,9 @@ #ifdef __KERNEL__ +#define __STR(x) #x +#define STR(x) __STR(x) + #define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t" #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" @@ -82,7 +85,7 @@ static inline void write_cr0(unsigned long val) static inline unsigned long read_cr2(void) { unsigned long cr2; - asm volatile("movq %%cr2,%0" : "=r" (cr2)); + asm("movq %%cr2,%0" : "=r" (cr2)); return cr2; } @@ -94,7 +97,7 @@ static inline void write_cr2(unsigned long val) static inline unsigned long read_cr3(void) { unsigned long cr3; - asm volatile("movq %%cr3,%0" : "=r" (cr3)); + asm("movq %%cr3,%0" : "=r" (cr3)); return cr3; } @@ -106,7 +109,7 @@ static inline void write_cr3(unsigned long val) static inline unsigned long read_cr4(void) { unsigned long cr4; - asm volatile("movq %%cr4,%0" : "=r" (cr4)); + asm("movq %%cr4,%0" : "=r" (cr4)); return cr4; } @@ -118,7 +121,7 @@ static inline void write_cr4(unsigned long val) static inline unsigned long read_cr8(void) { unsigned long cr8; - asm volatile("movq %%cr8,%0" : "=r" (cr8)); + asm("movq %%cr8,%0" : "=r" (cr8)); return cr8; } @@ -134,11 +137,6 @@ static inline void write_cr8(unsigned long val) #endif /* __KERNEL__ */ -static inline void clflush(volatile void *__p) -{ - asm volatile("clflush %0" : "+m" (*(char __force *)__p)); -} - #define nop() __asm__ __volatile__ ("nop") #ifdef CONFIG_SMP diff --git a/trunk/include/asm-x86/termbits.h b/trunk/include/asm-x86/termbits.h index af1b70ea440f..69f3080e2a1d 100644 --- a/trunk/include/asm-x86/termbits.h +++ b/trunk/include/asm-x86/termbits.h @@ -1,198 +1,13 @@ -#ifndef _ASM_X86_TERMBITS_H -#define _ASM_X86_TERMBITS_H - -#include - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; - -struct termios2 { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -}; - -struct ktermios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 -#define IUTF8 0040000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#define CBAUDEX 0010000 -#define BOTHER 0010000 /* non standard rate */ -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define B500000 0010005 -#define B576000 0010006 -#define B921600 0010007 -#define B1000000 0010010 -#define B1152000 0010011 -#define B1500000 0010012 -#define B2000000 0010013 -#define B2500000 0010014 -#define B3000000 0010015 -#define B3500000 0010016 -#define B4000000 0010017 -#define CIBAUD 002003600000 /* input baud rate */ -#define CMSPAR 010000000000 /* mark or space (stick) parity */ -#define CRTSCTS 020000000000 /* flow control */ - -#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -#endif /* _ASM_X86_TERMBITS_H */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "termbits_32.h" +# else +# include "termbits_64.h" +# endif +#else +# ifdef __i386__ +# include "termbits_32.h" +# else +# include "termbits_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/termbits_32.h b/trunk/include/asm-x86/termbits_32.h new file mode 100644 index 000000000000..a21700352e7b --- /dev/null +++ b/trunk/include/asm-x86/termbits_32.h @@ -0,0 +1,198 @@ +#ifndef __ARCH_I386_TERMBITS_H__ +#define __ARCH_I386_TERMBITS_H__ + +#include + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 19 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +}; + +struct termios2 { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +struct ktermios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +/* c_cflag bit meaning */ +#define CBAUD 0010017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#define CBAUDEX 0010000 +#define BOTHER 0010000 +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define CIBAUD 002003600000 +#define CMSPAR 010000000000 /* mark or space (stick) parity */ +#define CRTSCTS 020000000000 /* flow control */ + +#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#define XCASE 0000004 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#endif diff --git a/trunk/include/asm-x86/termbits_64.h b/trunk/include/asm-x86/termbits_64.h new file mode 100644 index 000000000000..7405756dd41b --- /dev/null +++ b/trunk/include/asm-x86/termbits_64.h @@ -0,0 +1,198 @@ +#ifndef __ARCH_X8664_TERMBITS_H__ +#define __ARCH_X8664_TERMBITS_H__ + +#include + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 19 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +}; + +struct termios2 { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +struct ktermios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VTIME 5 +#define VMIN 6 +#define VSWTC 7 +#define VSTART 8 +#define VSTOP 9 +#define VSUSP 10 +#define VEOL 11 +#define VREPRINT 12 +#define VDISCARD 13 +#define VWERASE 14 +#define VLNEXT 15 +#define VEOL2 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IUCLC 0001000 +#define IXON 0002000 +#define IXANY 0004000 +#define IXOFF 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define OLCUC 0000002 +#define ONLCR 0000004 +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 +#define OFILL 0000100 +#define OFDEL 0000200 +#define NLDLY 0000400 +#define NL0 0000000 +#define NL1 0000400 +#define CRDLY 0003000 +#define CR0 0000000 +#define CR1 0001000 +#define CR2 0002000 +#define CR3 0003000 +#define TABDLY 0014000 +#define TAB0 0000000 +#define TAB1 0004000 +#define TAB2 0010000 +#define TAB3 0014000 +#define XTABS 0014000 +#define BSDLY 0020000 +#define BS0 0000000 +#define BS1 0020000 +#define VTDLY 0040000 +#define VT0 0000000 +#define VT1 0040000 +#define FFDLY 0100000 +#define FF0 0000000 +#define FF1 0100000 + +/* c_cflag bit meaning */ +#define CBAUD 0010017 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CSIZE 0000060 +#define CS5 0000000 +#define CS6 0000020 +#define CS7 0000040 +#define CS8 0000060 +#define CSTOPB 0000100 +#define CREAD 0000200 +#define PARENB 0000400 +#define PARODD 0001000 +#define HUPCL 0002000 +#define CLOCAL 0004000 +#define CBAUDEX 0010000 +#define BOTHER 0010000 /* non standard rate */ +#define B57600 0010001 +#define B115200 0010002 +#define B230400 0010003 +#define B460800 0010004 +#define B500000 0010005 +#define B576000 0010006 +#define B921600 0010007 +#define B1000000 0010010 +#define B1152000 0010011 +#define B1500000 0010012 +#define B2000000 0010013 +#define B2500000 0010014 +#define B3000000 0010015 +#define B3500000 0010016 +#define B4000000 0010017 +#define CIBAUD 002003600000 /* input baud rate */ +#define CMSPAR 010000000000 /* mark or space (stick) parity */ +#define CRTSCTS 020000000000 /* flow control */ + +#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ + +/* c_lflag bits */ +#define ISIG 0000001 +#define ICANON 0000002 +#define XCASE 0000004 +#define ECHO 0000010 +#define ECHOE 0000020 +#define ECHOK 0000040 +#define ECHONL 0000100 +#define NOFLSH 0000200 +#define TOSTOP 0000400 +#define ECHOCTL 0001000 +#define ECHOPRT 0002000 +#define ECHOKE 0004000 +#define FLUSHO 0010000 +#define PENDIN 0040000 +#define IEXTEN 0100000 + +/* tcflow() and TCXONC use these */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* tcflush() and TCFLSH use these */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* tcsetattr uses these */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#endif diff --git a/trunk/include/asm-x86/termios.h b/trunk/include/asm-x86/termios.h index d501748700d2..a4f4ae20a591 100644 --- a/trunk/include/asm-x86/termios.h +++ b/trunk/include/asm-x86/termios.h @@ -1,97 +1,13 @@ -#ifndef _ASM_X86_TERMIOS_H -#define _ASM_X86_TERMIOS_H - -#include -#include - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - #ifdef __KERNEL__ - -/* intr=^C quit=^\ erase=del kill=^U - eof=^D vtime=\0 vmin=\1 sxtc=\0 - start=^Q stop=^S susp=^Z eol=\0 - reprint=^R discard=^U werase=^W lnext=^V - eol2=\0 -*/ -#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp,&(termio)->x); \ - *(unsigned short *) &(termios)->x = __tmp; \ -} - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ - SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) \ - copy_from_user(k, u, sizeof(struct termios2)) - -#define kernel_termios_to_user_termios(u, k) \ - copy_to_user(u, k, sizeof(struct termios2)) - -#define user_termios_to_kernel_termios_1(k, u) \ - copy_from_user(k, u, sizeof(struct termios)) - -#define kernel_termios_to_user_termios_1(u, k) \ - copy_to_user(u, k, sizeof(struct termios)) - -#endif /* __KERNEL__ */ - -#endif /* _ASM_X86_TERMIOS_H */ +# ifdef CONFIG_X86_32 +# include "termios_32.h" +# else +# include "termios_64.h" +# endif +#else +# ifdef __i386__ +# include "termios_32.h" +# else +# include "termios_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/termios_32.h b/trunk/include/asm-x86/termios_32.h new file mode 100644 index 000000000000..6fdb2c841b73 --- /dev/null +++ b/trunk/include/asm-x86/termios_32.h @@ -0,0 +1,90 @@ +#ifndef _I386_TERMIOS_H +#define _I386_TERMIOS_H + +#include +#include + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +#ifdef __KERNEL__ + +/* intr=^C quit=^\ erase=del kill=^U + eof=^D vtime=\0 vmin=\1 sxtc=\0 + start=^Q stop=^S susp=^Z eol=\0 + reprint=^R discard=^U werase=^W lnext=^V + eol2=\0 +*/ +#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" + +/* + * Translate a "termio" structure into a "termios". Ugh. + */ +#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ + unsigned short __tmp; \ + get_user(__tmp,&(termio)->x); \ + *(unsigned short *) &(termios)->x = __tmp; \ +} + +#define user_termio_to_kernel_termios(termios, termio) \ +({ \ + SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ +}) + +/* + * Translate a "termios" structure into a "termio". Ugh. + */ +#define kernel_termios_to_user_termio(termio, termios) \ +({ \ + put_user((termios)->c_iflag, &(termio)->c_iflag); \ + put_user((termios)->c_oflag, &(termio)->c_oflag); \ + put_user((termios)->c_cflag, &(termio)->c_cflag); \ + put_user((termios)->c_lflag, &(termio)->c_lflag); \ + put_user((termios)->c_line, &(termio)->c_line); \ + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ +}) + +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2)) +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2)) +#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) +#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) + +#endif /* __KERNEL__ */ + +#endif /* _I386_TERMIOS_H */ diff --git a/trunk/include/asm-x86/termios_64.h b/trunk/include/asm-x86/termios_64.h new file mode 100644 index 000000000000..35ee59b78329 --- /dev/null +++ b/trunk/include/asm-x86/termios_64.h @@ -0,0 +1,90 @@ +#ifndef _X8664_TERMIOS_H +#define _X8664_TERMIOS_H + +#include +#include + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 8 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +#ifdef __KERNEL__ + +/* intr=^C quit=^\ erase=del kill=^U + eof=^D vtime=\0 vmin=\1 sxtc=\0 + start=^Q stop=^S susp=^Z eol=\0 + reprint=^R discard=^U werase=^W lnext=^V + eol2=\0 +*/ +#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" + +/* + * Translate a "termio" structure into a "termios". Ugh. + */ +#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ + unsigned short __tmp; \ + get_user(__tmp,&(termio)->x); \ + *(unsigned short *) &(termios)->x = __tmp; \ +} + +#define user_termio_to_kernel_termios(termios, termio) \ +({ \ + SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ +}) + +/* + * Translate a "termios" structure into a "termio". Ugh. + */ +#define kernel_termios_to_user_termio(termio, termios) \ +({ \ + put_user((termios)->c_iflag, &(termio)->c_iflag); \ + put_user((termios)->c_oflag, &(termio)->c_oflag); \ + put_user((termios)->c_cflag, &(termio)->c_cflag); \ + put_user((termios)->c_lflag, &(termio)->c_lflag); \ + put_user((termios)->c_line, &(termio)->c_line); \ + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ +}) + +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2)) +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2)) +#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) +#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) + +#endif /* __KERNEL__ */ + +#endif /* _X8664_TERMIOS_H */ diff --git a/trunk/include/asm-x86/tlb.h b/trunk/include/asm-x86/tlb.h index e4e9e2d07a93..7d55c3762b43 100644 --- a/trunk/include/asm-x86/tlb.h +++ b/trunk/include/asm-x86/tlb.h @@ -1,11 +1,5 @@ -#ifndef _ASM_X86_TLB_H -#define _ASM_X86_TLB_H - -#define tlb_start_vma(tlb, vma) do { } while (0) -#define tlb_end_vma(tlb, vma) do { } while (0) -#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) -#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) - -#include - +#ifdef CONFIG_X86_32 +# include "tlb_32.h" +#else +# include "tlb_64.h" #endif diff --git a/trunk/include/asm-x86/tlb_32.h b/trunk/include/asm-x86/tlb_32.h new file mode 100644 index 000000000000..c006c5c92bea --- /dev/null +++ b/trunk/include/asm-x86/tlb_32.h @@ -0,0 +1,20 @@ +#ifndef _I386_TLB_H +#define _I386_TLB_H + +/* + * x86 doesn't need any special per-pte or + * per-vma handling.. + */ +#define tlb_start_vma(tlb, vma) do { } while (0) +#define tlb_end_vma(tlb, vma) do { } while (0) +#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) + +/* + * .. because we flush the whole mm when it + * fills up. + */ +#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) + +#include + +#endif diff --git a/trunk/include/asm-x86/tlb_64.h b/trunk/include/asm-x86/tlb_64.h new file mode 100644 index 000000000000..cd4c3c590a0e --- /dev/null +++ b/trunk/include/asm-x86/tlb_64.h @@ -0,0 +1,13 @@ +#ifndef TLB_H +#define TLB_H 1 + + +#define tlb_start_vma(tlb, vma) do { } while (0) +#define tlb_end_vma(tlb, vma) do { } while (0) +#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) + +#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) + +#include + +#endif diff --git a/trunk/include/asm-x86/types.h b/trunk/include/asm-x86/types.h index 63733f315688..a777a9b83974 100644 --- a/trunk/include/asm-x86/types.h +++ b/trunk/include/asm-x86/types.h @@ -1,70 +1,13 @@ -#ifndef _ASM_X86_TYPES_H -#define _ASM_X86_TYPES_H - -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -#ifdef __i386__ -# ifdef __GNUC__ -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -# endif -#else -typedef __signed__ long long __s64; -typedef unsigned long long __u64; -#endif - -#endif /* __ASSEMBLY__ */ - -/* - * These aren't exported outside the kernel to avoid name space clashes - */ #ifdef __KERNEL__ - -#ifdef CONFIG_X86_32 -# define BITS_PER_LONG 32 -#else -# define BITS_PER_LONG 64 -#endif - -#ifndef __ASSEMBLY__ - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - -typedef u64 dma64_addr_t; -#if defined(CONFIG_X86_64) || defined(CONFIG_HIGHMEM64G) -/* DMA addresses come in 32-bit and 64-bit flavours. */ -typedef u64 dma_addr_t; +# ifdef CONFIG_X86_32 +# include "types_32.h" +# else +# include "types_64.h" +# endif #else -typedef u32 dma_addr_t; -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __KERNEL__ */ - +# ifdef __i386__ +# include "types_32.h" +# else +# include "types_64.h" +# endif #endif diff --git a/trunk/include/asm-x86/types_32.h b/trunk/include/asm-x86/types_32.h new file mode 100644 index 000000000000..faca1922c4c3 --- /dev/null +++ b/trunk/include/asm-x86/types_32.h @@ -0,0 +1,64 @@ +#ifndef _I386_TYPES_H +#define _I386_TYPES_H + +#ifndef __ASSEMBLY__ + +typedef unsigned short umode_t; + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#if defined(__GNUC__) +__extension__ typedef __signed__ long long __s64; +__extension__ typedef unsigned long long __u64; +#endif + +#endif /* __ASSEMBLY__ */ + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +#define BITS_PER_LONG 32 + +#ifndef __ASSEMBLY__ + + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +/* DMA addresses come in generic and 64-bit flavours. */ + +#ifdef CONFIG_HIGHMEM64G +typedef u64 dma_addr_t; +#else +typedef u32 dma_addr_t; +#endif +typedef u64 dma64_addr_t; + +#endif /* __ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif diff --git a/trunk/include/asm-x86/types_64.h b/trunk/include/asm-x86/types_64.h new file mode 100644 index 000000000000..2d4491aae281 --- /dev/null +++ b/trunk/include/asm-x86/types_64.h @@ -0,0 +1,55 @@ +#ifndef _X86_64_TYPES_H +#define _X86_64_TYPES_H + +#ifndef __ASSEMBLY__ + +typedef unsigned short umode_t; + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +typedef __signed__ long long __s64; +typedef unsigned long long __u64; + +#endif /* __ASSEMBLY__ */ + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +#define BITS_PER_LONG 64 + +#ifndef __ASSEMBLY__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +typedef u64 dma64_addr_t; +typedef u64 dma_addr_t; + +#endif /* __ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif diff --git a/trunk/include/asm-x86/ucontext.h b/trunk/include/asm-x86/ucontext.h index 50a79f7fcde9..175c8cb59731 100644 --- a/trunk/include/asm-x86/ucontext.h +++ b/trunk/include/asm-x86/ucontext.h @@ -1,12 +1,13 @@ -#ifndef _ASM_X86_UCONTEXT_H -#define _ASM_X86_UCONTEXT_H - -struct ucontext { - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - struct sigcontext uc_mcontext; - sigset_t uc_sigmask; /* mask last for extensibility */ -}; - -#endif /* _ASM_X86_UCONTEXT_H */ +#ifdef __KERNEL__ +# ifdef CONFIG_X86_32 +# include "ucontext_32.h" +# else +# include "ucontext_64.h" +# endif +#else +# ifdef __i386__ +# include "ucontext_32.h" +# else +# include "ucontext_64.h" +# endif +#endif diff --git a/trunk/include/asm-x86/ucontext_32.h b/trunk/include/asm-x86/ucontext_32.h new file mode 100644 index 000000000000..b0db36925f55 --- /dev/null +++ b/trunk/include/asm-x86/ucontext_32.h @@ -0,0 +1,12 @@ +#ifndef _ASMi386_UCONTEXT_H +#define _ASMi386_UCONTEXT_H + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif /* !_ASMi386_UCONTEXT_H */ diff --git a/trunk/include/asm-x86/ucontext_64.h b/trunk/include/asm-x86/ucontext_64.h new file mode 100644 index 000000000000..159a3da9e112 --- /dev/null +++ b/trunk/include/asm-x86/ucontext_64.h @@ -0,0 +1,12 @@ +#ifndef _ASMX8664_UCONTEXT_H +#define _ASMX8664_UCONTEXT_H + +struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + sigset_t uc_sigmask; /* mask last for extensibility */ +}; + +#endif diff --git a/trunk/include/asm-x86/unaligned.h b/trunk/include/asm-x86/unaligned.h index 913598d4f761..68067150fbcb 100644 --- a/trunk/include/asm-x86/unaligned.h +++ b/trunk/include/asm-x86/unaligned.h @@ -1,37 +1,5 @@ -#ifndef _ASM_X86_UNALIGNED_H -#define _ASM_X86_UNALIGNED_H - -/* - * The x86 can do unaligned accesses itself. - * - * The strange macros are there to make sure these can't - * be misused in a way that makes them not work on other - * architectures where unaligned accesses aren't as simple. - */ - -/** - * get_unaligned - get value from possibly mis-aligned location - * @ptr: pointer to value - * - * This macro should be used for accessing values larger in size than - * single bytes at locations that are expected to be improperly aligned, - * e.g. retrieving a u16 value from a location not u16-aligned. - * - * Note that unaligned accesses can be very expensive on some architectures. - */ -#define get_unaligned(ptr) (*(ptr)) - -/** - * put_unaligned - put value to a possibly mis-aligned location - * @val: value to place - * @ptr: pointer to location - * - * This macro should be used for placing values larger in size than - * single bytes at locations that are expected to be improperly aligned, - * e.g. writing a u16 value to a location not u16-aligned. - * - * Note that unaligned accesses can be very expensive on some architectures. - */ -#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) - -#endif /* _ASM_X86_UNALIGNED_H */ +#ifdef CONFIG_X86_32 +# include "unaligned_32.h" +#else +# include "unaligned_64.h" +#endif diff --git a/trunk/include/asm-x86/unaligned_32.h b/trunk/include/asm-x86/unaligned_32.h new file mode 100644 index 000000000000..7acd7957621e --- /dev/null +++ b/trunk/include/asm-x86/unaligned_32.h @@ -0,0 +1,37 @@ +#ifndef __I386_UNALIGNED_H +#define __I386_UNALIGNED_H + +/* + * The i386 can do unaligned accesses itself. + * + * The strange macros are there to make sure these can't + * be misused in a way that makes them not work on other + * architectures where unaligned accesses aren't as simple. + */ + +/** + * get_unaligned - get value from possibly mis-aligned location + * @ptr: pointer to value + * + * This macro should be used for accessing values larger in size than + * single bytes at locations that are expected to be improperly aligned, + * e.g. retrieving a u16 value from a location not u16-aligned. + * + * Note that unaligned accesses can be very expensive on some architectures. + */ +#define get_unaligned(ptr) (*(ptr)) + +/** + * put_unaligned - put value to a possibly mis-aligned location + * @val: value to place + * @ptr: pointer to location + * + * This macro should be used for placing values larger in size than + * single bytes at locations that are expected to be improperly aligned, + * e.g. writing a u16 value to a location not u16-aligned. + * + * Note that unaligned accesses can be very expensive on some architectures. + */ +#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) + +#endif diff --git a/trunk/include/asm-x86/unaligned_64.h b/trunk/include/asm-x86/unaligned_64.h new file mode 100644 index 000000000000..d4bf78dc6f39 --- /dev/null +++ b/trunk/include/asm-x86/unaligned_64.h @@ -0,0 +1,37 @@ +#ifndef __X8664_UNALIGNED_H +#define __X8664_UNALIGNED_H + +/* + * The x86-64 can do unaligned accesses itself. + * + * The strange macros are there to make sure these can't + * be misused in a way that makes them not work on other + * architectures where unaligned accesses aren't as simple. + */ + +/** + * get_unaligned - get value from possibly mis-aligned location + * @ptr: pointer to value + * + * This macro should be used for accessing values larger in size than + * single bytes at locations that are expected to be improperly aligned, + * e.g. retrieving a u16 value from a location not u16-aligned. + * + * Note that unaligned accesses can be very expensive on some architectures. + */ +#define get_unaligned(ptr) (*(ptr)) + +/** + * put_unaligned - put value to a possibly mis-aligned location + * @val: value to place + * @ptr: pointer to location + * + * This macro should be used for placing values larger in size than + * single bytes at locations that are expected to be improperly aligned, + * e.g. writing a u16 value to a location not u16-aligned. + * + * Note that unaligned accesses can be very expensive on some architectures. + */ +#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) + +#endif diff --git a/trunk/include/asm-x86/unistd_64.h b/trunk/include/asm-x86/unistd_64.h index 5ff4d3e24c34..fc4e73f5f1fa 100644 --- a/trunk/include/asm-x86/unistd_64.h +++ b/trunk/include/asm-x86/unistd_64.h @@ -2,638 +2,635 @@ #define _ASM_X86_64_UNISTD_H_ #ifndef __SYSCALL -#define __SYSCALL(a,b) +#define __SYSCALL(a,b) #endif /* * This file contains the system call numbers. - * + * * Note: holes are not allowed. */ /* at least 8 syscall per cacheline */ -#define __NR_read 0 +#define __NR_read 0 __SYSCALL(__NR_read, sys_read) -#define __NR_write 1 +#define __NR_write 1 __SYSCALL(__NR_write, sys_write) -#define __NR_open 2 +#define __NR_open 2 __SYSCALL(__NR_open, sys_open) -#define __NR_close 3 +#define __NR_close 3 __SYSCALL(__NR_close, sys_close) -#define __NR_stat 4 +#define __NR_stat 4 __SYSCALL(__NR_stat, sys_newstat) -#define __NR_fstat 5 +#define __NR_fstat 5 __SYSCALL(__NR_fstat, sys_newfstat) -#define __NR_lstat 6 +#define __NR_lstat 6 __SYSCALL(__NR_lstat, sys_newlstat) -#define __NR_poll 7 +#define __NR_poll 7 __SYSCALL(__NR_poll, sys_poll) -#define __NR_lseek 8 +#define __NR_lseek 8 __SYSCALL(__NR_lseek, sys_lseek) -#define __NR_mmap 9 +#define __NR_mmap 9 __SYSCALL(__NR_mmap, sys_mmap) -#define __NR_mprotect 10 +#define __NR_mprotect 10 __SYSCALL(__NR_mprotect, sys_mprotect) -#define __NR_munmap 11 +#define __NR_munmap 11 __SYSCALL(__NR_munmap, sys_munmap) -#define __NR_brk 12 +#define __NR_brk 12 __SYSCALL(__NR_brk, sys_brk) -#define __NR_rt_sigaction 13 +#define __NR_rt_sigaction 13 __SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) -#define __NR_rt_sigprocmask 14 +#define __NR_rt_sigprocmask 14 __SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) -#define __NR_rt_sigreturn 15 +#define __NR_rt_sigreturn 15 __SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn) -#define __NR_ioctl 16 +#define __NR_ioctl 16 __SYSCALL(__NR_ioctl, sys_ioctl) -#define __NR_pread64 17 +#define __NR_pread64 17 __SYSCALL(__NR_pread64, sys_pread64) -#define __NR_pwrite64 18 +#define __NR_pwrite64 18 __SYSCALL(__NR_pwrite64, sys_pwrite64) -#define __NR_readv 19 +#define __NR_readv 19 __SYSCALL(__NR_readv, sys_readv) -#define __NR_writev 20 +#define __NR_writev 20 __SYSCALL(__NR_writev, sys_writev) -#define __NR_access 21 +#define __NR_access 21 __SYSCALL(__NR_access, sys_access) -#define __NR_pipe 22 +#define __NR_pipe 22 __SYSCALL(__NR_pipe, sys_pipe) -#define __NR_select 23 +#define __NR_select 23 __SYSCALL(__NR_select, sys_select) -#define __NR_sched_yield 24 +#define __NR_sched_yield 24 __SYSCALL(__NR_sched_yield, sys_sched_yield) -#define __NR_mremap 25 +#define __NR_mremap 25 __SYSCALL(__NR_mremap, sys_mremap) -#define __NR_msync 26 +#define __NR_msync 26 __SYSCALL(__NR_msync, sys_msync) -#define __NR_mincore 27 +#define __NR_mincore 27 __SYSCALL(__NR_mincore, sys_mincore) -#define __NR_madvise 28 +#define __NR_madvise 28 __SYSCALL(__NR_madvise, sys_madvise) -#define __NR_shmget 29 +#define __NR_shmget 29 __SYSCALL(__NR_shmget, sys_shmget) -#define __NR_shmat 30 +#define __NR_shmat 30 __SYSCALL(__NR_shmat, sys_shmat) -#define __NR_shmctl 31 +#define __NR_shmctl 31 __SYSCALL(__NR_shmctl, sys_shmctl) -#define __NR_dup 32 +#define __NR_dup 32 __SYSCALL(__NR_dup, sys_dup) -#define __NR_dup2 33 +#define __NR_dup2 33 __SYSCALL(__NR_dup2, sys_dup2) -#define __NR_pause 34 +#define __NR_pause 34 __SYSCALL(__NR_pause, sys_pause) -#define __NR_nanosleep 35 +#define __NR_nanosleep 35 __SYSCALL(__NR_nanosleep, sys_nanosleep) -#define __NR_getitimer 36 +#define __NR_getitimer 36 __SYSCALL(__NR_getitimer, sys_getitimer) -#define __NR_alarm 37 +#define __NR_alarm 37 __SYSCALL(__NR_alarm, sys_alarm) -#define __NR_setitimer 38 +#define __NR_setitimer 38 __SYSCALL(__NR_setitimer, sys_setitimer) -#define __NR_getpid 39 +#define __NR_getpid 39 __SYSCALL(__NR_getpid, sys_getpid) -#define __NR_sendfile 40 +#define __NR_sendfile 40 __SYSCALL(__NR_sendfile, sys_sendfile64) -#define __NR_socket 41 +#define __NR_socket 41 __SYSCALL(__NR_socket, sys_socket) -#define __NR_connect 42 +#define __NR_connect 42 __SYSCALL(__NR_connect, sys_connect) -#define __NR_accept 43 +#define __NR_accept 43 __SYSCALL(__NR_accept, sys_accept) -#define __NR_sendto 44 +#define __NR_sendto 44 __SYSCALL(__NR_sendto, sys_sendto) -#define __NR_recvfrom 45 +#define __NR_recvfrom 45 __SYSCALL(__NR_recvfrom, sys_recvfrom) -#define __NR_sendmsg 46 +#define __NR_sendmsg 46 __SYSCALL(__NR_sendmsg, sys_sendmsg) -#define __NR_recvmsg 47 +#define __NR_recvmsg 47 __SYSCALL(__NR_recvmsg, sys_recvmsg) -#define __NR_shutdown 48 +#define __NR_shutdown 48 __SYSCALL(__NR_shutdown, sys_shutdown) -#define __NR_bind 49 +#define __NR_bind 49 __SYSCALL(__NR_bind, sys_bind) -#define __NR_listen 50 +#define __NR_listen 50 __SYSCALL(__NR_listen, sys_listen) -#define __NR_getsockname 51 +#define __NR_getsockname 51 __SYSCALL(__NR_getsockname, sys_getsockname) -#define __NR_getpeername 52 +#define __NR_getpeername 52 __SYSCALL(__NR_getpeername, sys_getpeername) -#define __NR_socketpair 53 +#define __NR_socketpair 53 __SYSCALL(__NR_socketpair, sys_socketpair) -#define __NR_setsockopt 54 +#define __NR_setsockopt 54 __SYSCALL(__NR_setsockopt, sys_setsockopt) -#define __NR_getsockopt 55 +#define __NR_getsockopt 55 __SYSCALL(__NR_getsockopt, sys_getsockopt) -#define __NR_clone 56 +#define __NR_clone 56 __SYSCALL(__NR_clone, stub_clone) -#define __NR_fork 57 -__SYSCALL(__NR_fork, stub_fork) -#define __NR_vfork 58 +#define __NR_fork 57 +__SYSCALL(__NR_fork, stub_fork) +#define __NR_vfork 58 __SYSCALL(__NR_vfork, stub_vfork) -#define __NR_execve 59 +#define __NR_execve 59 __SYSCALL(__NR_execve, stub_execve) -#define __NR_exit 60 +#define __NR_exit 60 __SYSCALL(__NR_exit, sys_exit) -#define __NR_wait4 61 +#define __NR_wait4 61 __SYSCALL(__NR_wait4, sys_wait4) -#define __NR_kill 62 +#define __NR_kill 62 __SYSCALL(__NR_kill, sys_kill) -#define __NR_uname 63 +#define __NR_uname 63 __SYSCALL(__NR_uname, sys_uname) -#define __NR_semget 64 +#define __NR_semget 64 __SYSCALL(__NR_semget, sys_semget) -#define __NR_semop 65 +#define __NR_semop 65 __SYSCALL(__NR_semop, sys_semop) -#define __NR_semctl 66 +#define __NR_semctl 66 __SYSCALL(__NR_semctl, sys_semctl) -#define __NR_shmdt 67 +#define __NR_shmdt 67 __SYSCALL(__NR_shmdt, sys_shmdt) -#define __NR_msgget 68 +#define __NR_msgget 68 __SYSCALL(__NR_msgget, sys_msgget) -#define __NR_msgsnd 69 +#define __NR_msgsnd 69 __SYSCALL(__NR_msgsnd, sys_msgsnd) -#define __NR_msgrcv 70 +#define __NR_msgrcv 70 __SYSCALL(__NR_msgrcv, sys_msgrcv) -#define __NR_msgctl 71 +#define __NR_msgctl 71 __SYSCALL(__NR_msgctl, sys_msgctl) -#define __NR_fcntl 72 +#define __NR_fcntl 72 __SYSCALL(__NR_fcntl, sys_fcntl) -#define __NR_flock 73 +#define __NR_flock 73 __SYSCALL(__NR_flock, sys_flock) -#define __NR_fsync 74 +#define __NR_fsync 74 __SYSCALL(__NR_fsync, sys_fsync) -#define __NR_fdatasync 75 +#define __NR_fdatasync 75 __SYSCALL(__NR_fdatasync, sys_fdatasync) -#define __NR_truncate 76 +#define __NR_truncate 76 __SYSCALL(__NR_truncate, sys_truncate) -#define __NR_ftruncate 77 +#define __NR_ftruncate 77 __SYSCALL(__NR_ftruncate, sys_ftruncate) -#define __NR_getdents 78 +#define __NR_getdents 78 __SYSCALL(__NR_getdents, sys_getdents) -#define __NR_getcwd 79 +#define __NR_getcwd 79 __SYSCALL(__NR_getcwd, sys_getcwd) -#define __NR_chdir 80 +#define __NR_chdir 80 __SYSCALL(__NR_chdir, sys_chdir) -#define __NR_fchdir 81 +#define __NR_fchdir 81 __SYSCALL(__NR_fchdir, sys_fchdir) -#define __NR_rename 82 +#define __NR_rename 82 __SYSCALL(__NR_rename, sys_rename) -#define __NR_mkdir 83 +#define __NR_mkdir 83 __SYSCALL(__NR_mkdir, sys_mkdir) -#define __NR_rmdir 84 +#define __NR_rmdir 84 __SYSCALL(__NR_rmdir, sys_rmdir) -#define __NR_creat 85 +#define __NR_creat 85 __SYSCALL(__NR_creat, sys_creat) -#define __NR_link 86 +#define __NR_link 86 __SYSCALL(__NR_link, sys_link) -#define __NR_unlink 87 +#define __NR_unlink 87 __SYSCALL(__NR_unlink, sys_unlink) -#define __NR_symlink 88 +#define __NR_symlink 88 __SYSCALL(__NR_symlink, sys_symlink) -#define __NR_readlink 89 +#define __NR_readlink 89 __SYSCALL(__NR_readlink, sys_readlink) -#define __NR_chmod 90 +#define __NR_chmod 90 __SYSCALL(__NR_chmod, sys_chmod) -#define __NR_fchmod 91 +#define __NR_fchmod 91 __SYSCALL(__NR_fchmod, sys_fchmod) -#define __NR_chown 92 +#define __NR_chown 92 __SYSCALL(__NR_chown, sys_chown) -#define __NR_fchown 93 +#define __NR_fchown 93 __SYSCALL(__NR_fchown, sys_fchown) -#define __NR_lchown 94 +#define __NR_lchown 94 __SYSCALL(__NR_lchown, sys_lchown) -#define __NR_umask 95 +#define __NR_umask 95 __SYSCALL(__NR_umask, sys_umask) -#define __NR_gettimeofday 96 +#define __NR_gettimeofday 96 __SYSCALL(__NR_gettimeofday, sys_gettimeofday) -#define __NR_getrlimit 97 +#define __NR_getrlimit 97 __SYSCALL(__NR_getrlimit, sys_getrlimit) -#define __NR_getrusage 98 +#define __NR_getrusage 98 __SYSCALL(__NR_getrusage, sys_getrusage) -#define __NR_sysinfo 99 +#define __NR_sysinfo 99 __SYSCALL(__NR_sysinfo, sys_sysinfo) -#define __NR_times 100 +#define __NR_times 100 __SYSCALL(__NR_times, sys_times) -#define __NR_ptrace 101 +#define __NR_ptrace 101 __SYSCALL(__NR_ptrace, sys_ptrace) -#define __NR_getuid 102 +#define __NR_getuid 102 __SYSCALL(__NR_getuid, sys_getuid) -#define __NR_syslog 103 +#define __NR_syslog 103 __SYSCALL(__NR_syslog, sys_syslog) /* at the very end the stuff that never runs during the benchmarks */ -#define __NR_getgid 104 +#define __NR_getgid 104 __SYSCALL(__NR_getgid, sys_getgid) -#define __NR_setuid 105 +#define __NR_setuid 105 __SYSCALL(__NR_setuid, sys_setuid) -#define __NR_setgid 106 +#define __NR_setgid 106 __SYSCALL(__NR_setgid, sys_setgid) -#define __NR_geteuid 107 +#define __NR_geteuid 107 __SYSCALL(__NR_geteuid, sys_geteuid) -#define __NR_getegid 108 +#define __NR_getegid 108 __SYSCALL(__NR_getegid, sys_getegid) -#define __NR_setpgid 109 +#define __NR_setpgid 109 __SYSCALL(__NR_setpgid, sys_setpgid) -#define __NR_getppid 110 +#define __NR_getppid 110 __SYSCALL(__NR_getppid, sys_getppid) -#define __NR_getpgrp 111 +#define __NR_getpgrp 111 __SYSCALL(__NR_getpgrp, sys_getpgrp) -#define __NR_setsid 112 +#define __NR_setsid 112 __SYSCALL(__NR_setsid, sys_setsid) -#define __NR_setreuid 113 +#define __NR_setreuid 113 __SYSCALL(__NR_setreuid, sys_setreuid) -#define __NR_setregid 114 +#define __NR_setregid 114 __SYSCALL(__NR_setregid, sys_setregid) -#define __NR_getgroups 115 +#define __NR_getgroups 115 __SYSCALL(__NR_getgroups, sys_getgroups) -#define __NR_setgroups 116 +#define __NR_setgroups 116 __SYSCALL(__NR_setgroups, sys_setgroups) -#define __NR_setresuid 117 +#define __NR_setresuid 117 __SYSCALL(__NR_setresuid, sys_setresuid) -#define __NR_getresuid 118 +#define __NR_getresuid 118 __SYSCALL(__NR_getresuid, sys_getresuid) -#define __NR_setresgid 119 +#define __NR_setresgid 119 __SYSCALL(__NR_setresgid, sys_setresgid) -#define __NR_getresgid 120 +#define __NR_getresgid 120 __SYSCALL(__NR_getresgid, sys_getresgid) -#define __NR_getpgid 121 +#define __NR_getpgid 121 __SYSCALL(__NR_getpgid, sys_getpgid) -#define __NR_setfsuid 122 +#define __NR_setfsuid 122 __SYSCALL(__NR_setfsuid, sys_setfsuid) -#define __NR_setfsgid 123 +#define __NR_setfsgid 123 __SYSCALL(__NR_setfsgid, sys_setfsgid) -#define __NR_getsid 124 +#define __NR_getsid 124 __SYSCALL(__NR_getsid, sys_getsid) -#define __NR_capget 125 +#define __NR_capget 125 __SYSCALL(__NR_capget, sys_capget) -#define __NR_capset 126 +#define __NR_capset 126 __SYSCALL(__NR_capset, sys_capset) -#define __NR_rt_sigpending 127 +#define __NR_rt_sigpending 127 __SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) -#define __NR_rt_sigtimedwait 128 +#define __NR_rt_sigtimedwait 128 __SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait) -#define __NR_rt_sigqueueinfo 129 +#define __NR_rt_sigqueueinfo 129 __SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo) -#define __NR_rt_sigsuspend 130 +#define __NR_rt_sigsuspend 130 __SYSCALL(__NR_rt_sigsuspend, stub_rt_sigsuspend) -#define __NR_sigaltstack 131 +#define __NR_sigaltstack 131 __SYSCALL(__NR_sigaltstack, stub_sigaltstack) -#define __NR_utime 132 +#define __NR_utime 132 __SYSCALL(__NR_utime, sys_utime) -#define __NR_mknod 133 +#define __NR_mknod 133 __SYSCALL(__NR_mknod, sys_mknod) /* Only needed for a.out */ -#define __NR_uselib 134 +#define __NR_uselib 134 __SYSCALL(__NR_uselib, sys_ni_syscall) -#define __NR_personality 135 +#define __NR_personality 135 __SYSCALL(__NR_personality, sys_personality) -#define __NR_ustat 136 +#define __NR_ustat 136 __SYSCALL(__NR_ustat, sys_ustat) -#define __NR_statfs 137 +#define __NR_statfs 137 __SYSCALL(__NR_statfs, sys_statfs) -#define __NR_fstatfs 138 +#define __NR_fstatfs 138 __SYSCALL(__NR_fstatfs, sys_fstatfs) -#define __NR_sysfs 139 +#define __NR_sysfs 139 __SYSCALL(__NR_sysfs, sys_sysfs) -#define __NR_getpriority 140 +#define __NR_getpriority 140 __SYSCALL(__NR_getpriority, sys_getpriority) -#define __NR_setpriority 141 +#define __NR_setpriority 141 __SYSCALL(__NR_setpriority, sys_setpriority) -#define __NR_sched_setparam 142 +#define __NR_sched_setparam 142 __SYSCALL(__NR_sched_setparam, sys_sched_setparam) -#define __NR_sched_getparam 143 +#define __NR_sched_getparam 143 __SYSCALL(__NR_sched_getparam, sys_sched_getparam) -#define __NR_sched_setscheduler 144 +#define __NR_sched_setscheduler 144 __SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) -#define __NR_sched_getscheduler 145 +#define __NR_sched_getscheduler 145 __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) -#define __NR_sched_get_priority_max 146 +#define __NR_sched_get_priority_max 146 __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) -#define __NR_sched_get_priority_min 147 +#define __NR_sched_get_priority_min 147 __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) -#define __NR_sched_rr_get_interval 148 +#define __NR_sched_rr_get_interval 148 __SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval) -#define __NR_mlock 149 +#define __NR_mlock 149 __SYSCALL(__NR_mlock, sys_mlock) -#define __NR_munlock 150 +#define __NR_munlock 150 __SYSCALL(__NR_munlock, sys_munlock) -#define __NR_mlockall 151 +#define __NR_mlockall 151 __SYSCALL(__NR_mlockall, sys_mlockall) -#define __NR_munlockall 152 +#define __NR_munlockall 152 __SYSCALL(__NR_munlockall, sys_munlockall) -#define __NR_vhangup 153 +#define __NR_vhangup 153 __SYSCALL(__NR_vhangup, sys_vhangup) -#define __NR_modify_ldt 154 +#define __NR_modify_ldt 154 __SYSCALL(__NR_modify_ldt, sys_modify_ldt) -#define __NR_pivot_root 155 +#define __NR_pivot_root 155 __SYSCALL(__NR_pivot_root, sys_pivot_root) -#define __NR__sysctl 156 +#define __NR__sysctl 156 __SYSCALL(__NR__sysctl, sys_sysctl) -#define __NR_prctl 157 +#define __NR_prctl 157 __SYSCALL(__NR_prctl, sys_prctl) -#define __NR_arch_prctl 158 -__SYSCALL(__NR_arch_prctl, sys_arch_prctl) +#define __NR_arch_prctl 158 +__SYSCALL(__NR_arch_prctl, sys_arch_prctl) -#define __NR_adjtimex 159 +#define __NR_adjtimex 159 __SYSCALL(__NR_adjtimex, sys_adjtimex) -#define __NR_setrlimit 160 +#define __NR_setrlimit 160 __SYSCALL(__NR_setrlimit, sys_setrlimit) -#define __NR_chroot 161 +#define __NR_chroot 161 __SYSCALL(__NR_chroot, sys_chroot) -#define __NR_sync 162 +#define __NR_sync 162 __SYSCALL(__NR_sync, sys_sync) -#define __NR_acct 163 +#define __NR_acct 163 __SYSCALL(__NR_acct, sys_acct) -#define __NR_settimeofday 164 +#define __NR_settimeofday 164 __SYSCALL(__NR_settimeofday, sys_settimeofday) -#define __NR_mount 165 +#define __NR_mount 165 __SYSCALL(__NR_mount, sys_mount) -#define __NR_umount2 166 +#define __NR_umount2 166 __SYSCALL(__NR_umount2, sys_umount) -#define __NR_swapon 167 +#define __NR_swapon 167 __SYSCALL(__NR_swapon, sys_swapon) -#define __NR_swapoff 168 +#define __NR_swapoff 168 __SYSCALL(__NR_swapoff, sys_swapoff) -#define __NR_reboot 169 +#define __NR_reboot 169 __SYSCALL(__NR_reboot, sys_reboot) -#define __NR_sethostname 170 +#define __NR_sethostname 170 __SYSCALL(__NR_sethostname, sys_sethostname) -#define __NR_setdomainname 171 +#define __NR_setdomainname 171 __SYSCALL(__NR_setdomainname, sys_setdomainname) -#define __NR_iopl 172 +#define __NR_iopl 172 __SYSCALL(__NR_iopl, stub_iopl) -#define __NR_ioperm 173 +#define __NR_ioperm 173 __SYSCALL(__NR_ioperm, sys_ioperm) -#define __NR_create_module 174 +#define __NR_create_module 174 __SYSCALL(__NR_create_module, sys_ni_syscall) -#define __NR_init_module 175 +#define __NR_init_module 175 __SYSCALL(__NR_init_module, sys_init_module) -#define __NR_delete_module 176 +#define __NR_delete_module 176 __SYSCALL(__NR_delete_module, sys_delete_module) -#define __NR_get_kernel_syms 177 +#define __NR_get_kernel_syms 177 __SYSCALL(__NR_get_kernel_syms, sys_ni_syscall) -#define __NR_query_module 178 +#define __NR_query_module 178 __SYSCALL(__NR_query_module, sys_ni_syscall) -#define __NR_quotactl 179 +#define __NR_quotactl 179 __SYSCALL(__NR_quotactl, sys_quotactl) -#define __NR_nfsservctl 180 +#define __NR_nfsservctl 180 __SYSCALL(__NR_nfsservctl, sys_nfsservctl) -/* reserved for LiS/STREAMS */ -#define __NR_getpmsg 181 +#define __NR_getpmsg 181 /* reserved for LiS/STREAMS */ __SYSCALL(__NR_getpmsg, sys_ni_syscall) -#define __NR_putpmsg 182 +#define __NR_putpmsg 182 /* reserved for LiS/STREAMS */ __SYSCALL(__NR_putpmsg, sys_ni_syscall) -/* reserved for AFS */ -#define __NR_afs_syscall 183 +#define __NR_afs_syscall 183 /* reserved for AFS */ __SYSCALL(__NR_afs_syscall, sys_ni_syscall) -/* reserved for tux */ -#define __NR_tuxcall 184 +#define __NR_tuxcall 184 /* reserved for tux */ __SYSCALL(__NR_tuxcall, sys_ni_syscall) -#define __NR_security 185 +#define __NR_security 185 __SYSCALL(__NR_security, sys_ni_syscall) -#define __NR_gettid 186 +#define __NR_gettid 186 __SYSCALL(__NR_gettid, sys_gettid) -#define __NR_readahead 187 +#define __NR_readahead 187 __SYSCALL(__NR_readahead, sys_readahead) -#define __NR_setxattr 188 +#define __NR_setxattr 188 __SYSCALL(__NR_setxattr, sys_setxattr) -#define __NR_lsetxattr 189 +#define __NR_lsetxattr 189 __SYSCALL(__NR_lsetxattr, sys_lsetxattr) -#define __NR_fsetxattr 190 +#define __NR_fsetxattr 190 __SYSCALL(__NR_fsetxattr, sys_fsetxattr) -#define __NR_getxattr 191 +#define __NR_getxattr 191 __SYSCALL(__NR_getxattr, sys_getxattr) -#define __NR_lgetxattr 192 +#define __NR_lgetxattr 192 __SYSCALL(__NR_lgetxattr, sys_lgetxattr) -#define __NR_fgetxattr 193 -__SYSCALL(__NR_fgetxattr, sys_fgetxattr) -#define __NR_listxattr 194 -__SYSCALL(__NR_listxattr, sys_listxattr) -#define __NR_llistxattr 195 -__SYSCALL(__NR_llistxattr, sys_llistxattr) -#define __NR_flistxattr 196 -__SYSCALL(__NR_flistxattr, sys_flistxattr) -#define __NR_removexattr 197 -__SYSCALL(__NR_removexattr, sys_removexattr) -#define __NR_lremovexattr 198 -__SYSCALL(__NR_lremovexattr, sys_lremovexattr) -#define __NR_fremovexattr 199 -__SYSCALL(__NR_fremovexattr, sys_fremovexattr) -#define __NR_tkill 200 -__SYSCALL(__NR_tkill, sys_tkill) -#define __NR_time 201 +#define __NR_fgetxattr 193 +__SYSCALL(__NR_fgetxattr, sys_fgetxattr) +#define __NR_listxattr 194 +__SYSCALL(__NR_listxattr, sys_listxattr) +#define __NR_llistxattr 195 +__SYSCALL(__NR_llistxattr, sys_llistxattr) +#define __NR_flistxattr 196 +__SYSCALL(__NR_flistxattr, sys_flistxattr) +#define __NR_removexattr 197 +__SYSCALL(__NR_removexattr, sys_removexattr) +#define __NR_lremovexattr 198 +__SYSCALL(__NR_lremovexattr, sys_lremovexattr) +#define __NR_fremovexattr 199 +__SYSCALL(__NR_fremovexattr, sys_fremovexattr) +#define __NR_tkill 200 +__SYSCALL(__NR_tkill, sys_tkill) +#define __NR_time 201 __SYSCALL(__NR_time, sys_time) -#define __NR_futex 202 +#define __NR_futex 202 __SYSCALL(__NR_futex, sys_futex) -#define __NR_sched_setaffinity 203 +#define __NR_sched_setaffinity 203 __SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity) -#define __NR_sched_getaffinity 204 +#define __NR_sched_getaffinity 204 __SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity) -#define __NR_set_thread_area 205 +#define __NR_set_thread_area 205 __SYSCALL(__NR_set_thread_area, sys_ni_syscall) /* use arch_prctl */ -#define __NR_io_setup 206 +#define __NR_io_setup 206 __SYSCALL(__NR_io_setup, sys_io_setup) -#define __NR_io_destroy 207 +#define __NR_io_destroy 207 __SYSCALL(__NR_io_destroy, sys_io_destroy) -#define __NR_io_getevents 208 +#define __NR_io_getevents 208 __SYSCALL(__NR_io_getevents, sys_io_getevents) -#define __NR_io_submit 209 +#define __NR_io_submit 209 __SYSCALL(__NR_io_submit, sys_io_submit) -#define __NR_io_cancel 210 +#define __NR_io_cancel 210 __SYSCALL(__NR_io_cancel, sys_io_cancel) -#define __NR_get_thread_area 211 +#define __NR_get_thread_area 211 __SYSCALL(__NR_get_thread_area, sys_ni_syscall) /* use arch_prctl */ -#define __NR_lookup_dcookie 212 +#define __NR_lookup_dcookie 212 __SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie) -#define __NR_epoll_create 213 +#define __NR_epoll_create 213 __SYSCALL(__NR_epoll_create, sys_epoll_create) -#define __NR_epoll_ctl_old 214 +#define __NR_epoll_ctl_old 214 __SYSCALL(__NR_epoll_ctl_old, sys_ni_syscall) -#define __NR_epoll_wait_old 215 +#define __NR_epoll_wait_old 215 __SYSCALL(__NR_epoll_wait_old, sys_ni_syscall) -#define __NR_remap_file_pages 216 +#define __NR_remap_file_pages 216 __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) -#define __NR_getdents64 217 +#define __NR_getdents64 217 __SYSCALL(__NR_getdents64, sys_getdents64) -#define __NR_set_tid_address 218 +#define __NR_set_tid_address 218 __SYSCALL(__NR_set_tid_address, sys_set_tid_address) -#define __NR_restart_syscall 219 +#define __NR_restart_syscall 219 __SYSCALL(__NR_restart_syscall, sys_restart_syscall) -#define __NR_semtimedop 220 +#define __NR_semtimedop 220 __SYSCALL(__NR_semtimedop, sys_semtimedop) -#define __NR_fadvise64 221 +#define __NR_fadvise64 221 __SYSCALL(__NR_fadvise64, sys_fadvise64) -#define __NR_timer_create 222 +#define __NR_timer_create 222 __SYSCALL(__NR_timer_create, sys_timer_create) -#define __NR_timer_settime 223 +#define __NR_timer_settime 223 __SYSCALL(__NR_timer_settime, sys_timer_settime) -#define __NR_timer_gettime 224 +#define __NR_timer_gettime 224 __SYSCALL(__NR_timer_gettime, sys_timer_gettime) -#define __NR_timer_getoverrun 225 +#define __NR_timer_getoverrun 225 __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) -#define __NR_timer_delete 226 +#define __NR_timer_delete 226 __SYSCALL(__NR_timer_delete, sys_timer_delete) -#define __NR_clock_settime 227 +#define __NR_clock_settime 227 __SYSCALL(__NR_clock_settime, sys_clock_settime) -#define __NR_clock_gettime 228 +#define __NR_clock_gettime 228 __SYSCALL(__NR_clock_gettime, sys_clock_gettime) -#define __NR_clock_getres 229 +#define __NR_clock_getres 229 __SYSCALL(__NR_clock_getres, sys_clock_getres) -#define __NR_clock_nanosleep 230 +#define __NR_clock_nanosleep 230 __SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep) -#define __NR_exit_group 231 +#define __NR_exit_group 231 __SYSCALL(__NR_exit_group, sys_exit_group) -#define __NR_epoll_wait 232 +#define __NR_epoll_wait 232 __SYSCALL(__NR_epoll_wait, sys_epoll_wait) -#define __NR_epoll_ctl 233 +#define __NR_epoll_ctl 233 __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) -#define __NR_tgkill 234 +#define __NR_tgkill 234 __SYSCALL(__NR_tgkill, sys_tgkill) -#define __NR_utimes 235 +#define __NR_utimes 235 __SYSCALL(__NR_utimes, sys_utimes) -#define __NR_vserver 236 +#define __NR_vserver 236 __SYSCALL(__NR_vserver, sys_ni_syscall) -#define __NR_mbind 237 +#define __NR_mbind 237 __SYSCALL(__NR_mbind, sys_mbind) -#define __NR_set_mempolicy 238 +#define __NR_set_mempolicy 238 __SYSCALL(__NR_set_mempolicy, sys_set_mempolicy) -#define __NR_get_mempolicy 239 +#define __NR_get_mempolicy 239 __SYSCALL(__NR_get_mempolicy, sys_get_mempolicy) -#define __NR_mq_open 240 +#define __NR_mq_open 240 __SYSCALL(__NR_mq_open, sys_mq_open) -#define __NR_mq_unlink 241 +#define __NR_mq_unlink 241 __SYSCALL(__NR_mq_unlink, sys_mq_unlink) -#define __NR_mq_timedsend 242 +#define __NR_mq_timedsend 242 __SYSCALL(__NR_mq_timedsend, sys_mq_timedsend) -#define __NR_mq_timedreceive 243 +#define __NR_mq_timedreceive 243 __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive) -#define __NR_mq_notify 244 +#define __NR_mq_notify 244 __SYSCALL(__NR_mq_notify, sys_mq_notify) -#define __NR_mq_getsetattr 245 +#define __NR_mq_getsetattr 245 __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) -#define __NR_kexec_load 246 +#define __NR_kexec_load 246 __SYSCALL(__NR_kexec_load, sys_kexec_load) -#define __NR_waitid 247 +#define __NR_waitid 247 __SYSCALL(__NR_waitid, sys_waitid) -#define __NR_add_key 248 +#define __NR_add_key 248 __SYSCALL(__NR_add_key, sys_add_key) -#define __NR_request_key 249 +#define __NR_request_key 249 __SYSCALL(__NR_request_key, sys_request_key) -#define __NR_keyctl 250 +#define __NR_keyctl 250 __SYSCALL(__NR_keyctl, sys_keyctl) -#define __NR_ioprio_set 251 +#define __NR_ioprio_set 251 __SYSCALL(__NR_ioprio_set, sys_ioprio_set) -#define __NR_ioprio_get 252 +#define __NR_ioprio_get 252 __SYSCALL(__NR_ioprio_get, sys_ioprio_get) -#define __NR_inotify_init 253 +#define __NR_inotify_init 253 __SYSCALL(__NR_inotify_init, sys_inotify_init) -#define __NR_inotify_add_watch 254 +#define __NR_inotify_add_watch 254 __SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) -#define __NR_inotify_rm_watch 255 +#define __NR_inotify_rm_watch 255 __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) -#define __NR_migrate_pages 256 +#define __NR_migrate_pages 256 __SYSCALL(__NR_migrate_pages, sys_migrate_pages) -#define __NR_openat 257 +#define __NR_openat 257 __SYSCALL(__NR_openat, sys_openat) -#define __NR_mkdirat 258 +#define __NR_mkdirat 258 __SYSCALL(__NR_mkdirat, sys_mkdirat) -#define __NR_mknodat 259 +#define __NR_mknodat 259 __SYSCALL(__NR_mknodat, sys_mknodat) -#define __NR_fchownat 260 +#define __NR_fchownat 260 __SYSCALL(__NR_fchownat, sys_fchownat) -#define __NR_futimesat 261 +#define __NR_futimesat 261 __SYSCALL(__NR_futimesat, sys_futimesat) -#define __NR_newfstatat 262 +#define __NR_newfstatat 262 __SYSCALL(__NR_newfstatat, sys_newfstatat) -#define __NR_unlinkat 263 +#define __NR_unlinkat 263 __SYSCALL(__NR_unlinkat, sys_unlinkat) -#define __NR_renameat 264 +#define __NR_renameat 264 __SYSCALL(__NR_renameat, sys_renameat) -#define __NR_linkat 265 +#define __NR_linkat 265 __SYSCALL(__NR_linkat, sys_linkat) -#define __NR_symlinkat 266 +#define __NR_symlinkat 266 __SYSCALL(__NR_symlinkat, sys_symlinkat) -#define __NR_readlinkat 267 +#define __NR_readlinkat 267 __SYSCALL(__NR_readlinkat, sys_readlinkat) -#define __NR_fchmodat 268 +#define __NR_fchmodat 268 __SYSCALL(__NR_fchmodat, sys_fchmodat) -#define __NR_faccessat 269 +#define __NR_faccessat 269 __SYSCALL(__NR_faccessat, sys_faccessat) -#define __NR_pselect6 270 +#define __NR_pselect6 270 __SYSCALL(__NR_pselect6, sys_pselect6) -#define __NR_ppoll 271 +#define __NR_ppoll 271 __SYSCALL(__NR_ppoll, sys_ppoll) -#define __NR_unshare 272 +#define __NR_unshare 272 __SYSCALL(__NR_unshare, sys_unshare) -#define __NR_set_robust_list 273 +#define __NR_set_robust_list 273 __SYSCALL(__NR_set_robust_list, sys_set_robust_list) -#define __NR_get_robust_list 274 +#define __NR_get_robust_list 274 __SYSCALL(__NR_get_robust_list, sys_get_robust_list) -#define __NR_splice 275 +#define __NR_splice 275 __SYSCALL(__NR_splice, sys_splice) -#define __NR_tee 276 +#define __NR_tee 276 __SYSCALL(__NR_tee, sys_tee) -#define __NR_sync_file_range 277 +#define __NR_sync_file_range 277 __SYSCALL(__NR_sync_file_range, sys_sync_file_range) -#define __NR_vmsplice 278 +#define __NR_vmsplice 278 __SYSCALL(__NR_vmsplice, sys_vmsplice) -#define __NR_move_pages 279 +#define __NR_move_pages 279 __SYSCALL(__NR_move_pages, sys_move_pages) -#define __NR_utimensat 280 +#define __NR_utimensat 280 __SYSCALL(__NR_utimensat, sys_utimensat) #define __IGNORE_getcpu /* implemented as a vsyscall */ -#define __NR_epoll_pwait 281 +#define __NR_epoll_pwait 281 __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait) -#define __NR_signalfd 282 +#define __NR_signalfd 282 __SYSCALL(__NR_signalfd, sys_signalfd) -#define __NR_timerfd 283 +#define __NR_timerfd 283 __SYSCALL(__NR_timerfd, sys_timerfd) -#define __NR_eventfd 284 +#define __NR_eventfd 284 __SYSCALL(__NR_eventfd, sys_eventfd) -#define __NR_fallocate 285 +#define __NR_fallocate 285 __SYSCALL(__NR_fallocate, sys_fallocate) #ifndef __NO_STUBS @@ -659,9 +656,26 @@ __SYSCALL(__NR_fallocate, sys_fallocate) #define __ARCH_WANT_SYS_RT_SIGSUSPEND #define __ARCH_WANT_SYS_TIME #define __ARCH_WANT_COMPAT_SYS_TIME -#endif /* __NO_STUBS */ #ifdef __KERNEL__ +#ifndef __ASSEMBLY__ + +#include +#include +#include +#include + +asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs); +struct sigaction; +asmlinkage long sys_rt_sigaction(int sig, + const struct sigaction __user *act, + struct sigaction __user *oact, + size_t sigsetsize); + +#endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ +#endif /* __NO_STUBS */ + /* * "Conditional" syscalls * @@ -669,6 +683,5 @@ __SYSCALL(__NR_fallocate, sys_fallocate) * but it doesn't work on all toolchains, so we just do it by hand */ #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") -#endif /* __KERNEL__ */ #endif /* _ASM_X86_64_UNISTD_H_ */ diff --git a/trunk/include/asm-x86/unwind.h b/trunk/include/asm-x86/unwind.h index 8b064bd9c553..7e4d7ad55208 100644 --- a/trunk/include/asm-x86/unwind.h +++ b/trunk/include/asm-x86/unwind.h @@ -1,13 +1,5 @@ -#ifndef _ASM_X86_UNWIND_H -#define _ASM_X86_UNWIND_H - -#define UNW_PC(frame) ((void)(frame), 0UL) -#define UNW_SP(frame) ((void)(frame), 0UL) -#define UNW_FP(frame) ((void)(frame), 0UL) - -static inline int arch_unw_user_mode(const void *info) -{ - return 0; -} - -#endif /* _ASM_X86_UNWIND_H */ +#ifdef CONFIG_X86_32 +# include "unwind_32.h" +#else +# include "unwind_64.h" +#endif diff --git a/trunk/include/asm-x86/unwind_32.h b/trunk/include/asm-x86/unwind_32.h new file mode 100644 index 000000000000..43c70c3de2f9 --- /dev/null +++ b/trunk/include/asm-x86/unwind_32.h @@ -0,0 +1,13 @@ +#ifndef _ASM_I386_UNWIND_H +#define _ASM_I386_UNWIND_H + +#define UNW_PC(frame) ((void)(frame), 0) +#define UNW_SP(frame) ((void)(frame), 0) +#define UNW_FP(frame) ((void)(frame), 0) + +static inline int arch_unw_user_mode(const void *info) +{ + return 0; +} + +#endif /* _ASM_I386_UNWIND_H */ diff --git a/trunk/include/asm-x86/unwind_64.h b/trunk/include/asm-x86/unwind_64.h new file mode 100644 index 000000000000..02710f6a4560 --- /dev/null +++ b/trunk/include/asm-x86/unwind_64.h @@ -0,0 +1,12 @@ +#ifndef _ASM_X86_64_UNWIND_H +#define _ASM_X86_64_UNWIND_H + +#define UNW_PC(frame) ((void)(frame), 0UL) +#define UNW_SP(frame) ((void)(frame), 0UL) + +static inline int arch_unw_user_mode(const void *info) +{ + return 0; +} + +#endif /* _ASM_X86_64_UNWIND_H */ diff --git a/trunk/include/xen/interface/vcpu.h b/trunk/include/xen/interface/vcpu.h index b05d8a6d9143..ff61ea365997 100644 --- a/trunk/include/xen/interface/vcpu.h +++ b/trunk/include/xen/interface/vcpu.h @@ -160,9 +160,8 @@ struct vcpu_set_singleshot_timer { */ #define VCPUOP_register_vcpu_info 10 /* arg == struct vcpu_info */ struct vcpu_register_vcpu_info { - uint64_t mfn; /* mfn of page to place vcpu_info */ - uint32_t offset; /* offset within page */ - uint32_t rsvd; /* unused */ + uint32_t mfn; /* mfn of page to place vcpu_info */ + uint32_t offset; /* offset within page */ }; #endif /* __XEN_PUBLIC_VCPU_H__ */ diff --git a/trunk/kernel/time/tick-broadcast.c b/trunk/kernel/time/tick-broadcast.c index 8cfb8b2ce773..fab9dd8bbd6b 100644 --- a/trunk/kernel/time/tick-broadcast.c +++ b/trunk/kernel/time/tick-broadcast.c @@ -222,8 +222,20 @@ static void tick_do_broadcast_on_off(void *why) if (!dev || !(dev->features & CLOCK_EVT_FEAT_C3STOP)) goto out; - if (!tick_device_is_functional(dev)) - goto out; + /* + * Defect device ? + */ + if (!tick_device_is_functional(dev)) { + /* + * AMD C1E wreckage fixup: + * + * Device was registered functional in the first + * place. Now the secondary CPU detected the C1E + * misfeature and notifies us to fix it up + */ + if (*reason != CLOCK_EVT_NOTIFY_BROADCAST_FORCE) + goto out; + } switch (*reason) { case CLOCK_EVT_NOTIFY_BROADCAST_ON: @@ -234,8 +246,6 @@ static void tick_do_broadcast_on_off(void *why) clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN); } - if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE) - dev->features |= CLOCK_EVT_FEAT_DUMMY; break; case CLOCK_EVT_NOTIFY_BROADCAST_OFF: if (cpu_isset(cpu, tick_broadcast_mask)) { diff --git a/trunk/mm/Kconfig b/trunk/mm/Kconfig index b1f03b0eb7f1..1cc6cada2bbf 100644 --- a/trunk/mm/Kconfig +++ b/trunk/mm/Kconfig @@ -155,6 +155,7 @@ config SPLIT_PTLOCK_CPUS int default "4096" if ARM && !CPU_CACHE_VIPT default "4096" if PARISC && !PA20 + default "4096" if XEN default "4" #