aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86_64')
-rw-r--r--include/asm-x86_64/bitops.h2
-rw-r--r--include/asm-x86_64/bootsetup.h2
-rw-r--r--include/asm-x86_64/dma-mapping.h3
-rw-r--r--include/asm-x86_64/e820.h2
-rw-r--r--include/asm-x86_64/hpet.h7
-rw-r--r--include/asm-x86_64/hw_irq.h27
-rw-r--r--include/asm-x86_64/io.h2
-rw-r--r--include/asm-x86_64/io_apic.h14
-rw-r--r--include/asm-x86_64/mce.h2
-rw-r--r--include/asm-x86_64/mmzone.h18
-rw-r--r--include/asm-x86_64/mutex.h6
-rw-r--r--include/asm-x86_64/pgalloc.h5
-rw-r--r--include/asm-x86_64/pgtable.h9
-rw-r--r--include/asm-x86_64/proto.h6
-rw-r--r--include/asm-x86_64/setup.h2
-rw-r--r--include/asm-x86_64/termios.h18
-rw-r--r--include/asm-x86_64/timex.h35
-rw-r--r--include/asm-x86_64/tsc.h66
-rw-r--r--include/asm-x86_64/uaccess.h18
-rw-r--r--include/asm-x86_64/vsyscall.h34
20 files changed, 155 insertions, 123 deletions
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index 8da9609070f4..d4dbbe5f7bd9 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -7,7 +7,7 @@
7 7
8#include <asm/alternative.h> 8#include <asm/alternative.h>
9 9
10#if __GNUC__ < 4 || __GNUC_MINOR__ < 1 10#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
11/* Technically wrong, but this avoids compilation errors on some gcc 11/* Technically wrong, but this avoids compilation errors on some gcc
12 versions. */ 12 versions. */
13#define ADDR "=m" (*(volatile long *) addr) 13#define ADDR "=m" (*(volatile long *) addr)
diff --git a/include/asm-x86_64/bootsetup.h b/include/asm-x86_64/bootsetup.h
index b829f7b534be..7b1c3ad155fd 100644
--- a/include/asm-x86_64/bootsetup.h
+++ b/include/asm-x86_64/bootsetup.h
@@ -31,7 +31,7 @@ extern char x86_boot_params[BOOT_PARAM_SIZE];
31#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF)) 31#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
32#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) 32#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
33#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) 33#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
34#define COMMAND_LINE saved_command_line 34#define COMMAND_LINE boot_command_line
35 35
36#define RAMDISK_IMAGE_START_MASK 0x07FF 36#define RAMDISK_IMAGE_START_MASK 0x07FF
37#define RAMDISK_PROMPT_FLAG 0x8000 37#define RAMDISK_PROMPT_FLAG 0x8000
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index 49dbab09ef2b..d2af227f06d0 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -66,6 +66,9 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
66#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 66#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
67#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 67#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
68 68
69#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
70#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
71
69extern void *dma_alloc_coherent(struct device *dev, size_t size, 72extern void *dma_alloc_coherent(struct device *dev, size_t size,
70 dma_addr_t *dma_handle, gfp_t gfp); 73 dma_addr_t *dma_handle, gfp_t gfp);
71extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 74extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index fa2086774105..6216fa3f2802 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -46,6 +46,7 @@ extern void e820_mark_nosave_regions(void);
46extern void e820_print_map(char *who); 46extern void e820_print_map(char *who);
47extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type); 47extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
48extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type); 48extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
49extern unsigned long e820_hole_size(unsigned long start, unsigned long end);
49 50
50extern void e820_setup_gap(void); 51extern void e820_setup_gap(void);
51extern void e820_register_active_regions(int nid, 52extern void e820_register_active_regions(int nid,
@@ -56,6 +57,7 @@ extern void finish_e820_parsing(void);
56extern struct e820map e820; 57extern struct e820map e820;
57 58
58extern unsigned ebda_addr, ebda_size; 59extern unsigned ebda_addr, ebda_size;
60extern unsigned long nodemap_addr, nodemap_size;
59#endif/*!__ASSEMBLY__*/ 61#endif/*!__ASSEMBLY__*/
60 62
61#endif/*__E820_HEADER*/ 63#endif/*__E820_HEADER*/
diff --git a/include/asm-x86_64/hpet.h b/include/asm-x86_64/hpet.h
index b39098408b69..59a66f084611 100644
--- a/include/asm-x86_64/hpet.h
+++ b/include/asm-x86_64/hpet.h
@@ -56,8 +56,15 @@
56extern int is_hpet_enabled(void); 56extern int is_hpet_enabled(void);
57extern int hpet_rtc_timer_init(void); 57extern int hpet_rtc_timer_init(void);
58extern int apic_is_clustered_box(void); 58extern int apic_is_clustered_box(void);
59extern int hpet_arch_init(void);
60extern int hpet_timer_stop_set_go(unsigned long tick);
61extern int hpet_reenable(void);
62extern unsigned int hpet_calibrate_tsc(void);
59 63
60extern int hpet_use_timer; 64extern int hpet_use_timer;
65extern unsigned long hpet_address;
66extern unsigned long hpet_period;
67extern unsigned long hpet_tick;
61 68
62#ifdef CONFIG_HPET_EMULATE_RTC 69#ifdef CONFIG_HPET_EMULATE_RTC
63extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); 70extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 179cce755aa7..2e4b7a5ed1c4 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -32,9 +32,30 @@
32#define IA32_SYSCALL_VECTOR 0x80 32#define IA32_SYSCALL_VECTOR 0x80
33 33
34 34
35/* Reserve the lowest usable priority level 0x20 - 0x2f for triggering
36 * cleanup after irq migration.
37 */
38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
39
35/* 40/*
36 * Vectors 0x20-0x2f are used for ISA interrupts. 41 * Vectors 0x20-0x2f are used for ISA interrupts.
37 */ 42 */
43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10
44#define IRQ1_VECTOR IRQ0_VECTOR + 1
45#define IRQ2_VECTOR IRQ0_VECTOR + 2
46#define IRQ3_VECTOR IRQ0_VECTOR + 3
47#define IRQ4_VECTOR IRQ0_VECTOR + 4
48#define IRQ5_VECTOR IRQ0_VECTOR + 5
49#define IRQ6_VECTOR IRQ0_VECTOR + 6
50#define IRQ7_VECTOR IRQ0_VECTOR + 7
51#define IRQ8_VECTOR IRQ0_VECTOR + 8
52#define IRQ9_VECTOR IRQ0_VECTOR + 9
53#define IRQ10_VECTOR IRQ0_VECTOR + 10
54#define IRQ11_VECTOR IRQ0_VECTOR + 11
55#define IRQ12_VECTOR IRQ0_VECTOR + 12
56#define IRQ13_VECTOR IRQ0_VECTOR + 13
57#define IRQ14_VECTOR IRQ0_VECTOR + 14
58#define IRQ15_VECTOR IRQ0_VECTOR + 15
38 59
39/* 60/*
40 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff 61 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
@@ -66,10 +87,10 @@
66 87
67/* 88/*
68 * First APIC vector available to drivers: (vectors 0x30-0xee) 89 * First APIC vector available to drivers: (vectors 0x30-0xee)
69 * we start at 0x31 to spread out vectors evenly between priority 90 * we start at 0x41 to spread out vectors evenly between priority
70 * levels. (0x80 is the syscall vector) 91 * levels. (0x80 is the syscall vector)
71 */ 92 */
72#define FIRST_DEVICE_VECTOR 0x31 93#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
73#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */ 94#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
74 95
75 96
@@ -91,7 +112,7 @@ extern void enable_8259A_irq(unsigned int irq);
91extern int i8259A_irq_pending(unsigned int irq); 112extern int i8259A_irq_pending(unsigned int irq);
92extern void make_8259A_irq(unsigned int irq); 113extern void make_8259A_irq(unsigned int irq);
93extern void init_8259A(int aeoi); 114extern void init_8259A(int aeoi);
94extern void FASTCALL(send_IPI_self(int vector)); 115extern void send_IPI_self(int vector);
95extern void init_VISWS_APIC_irqs(void); 116extern void init_VISWS_APIC_irqs(void);
96extern void setup_IO_APIC(void); 117extern void setup_IO_APIC(void);
97extern void disable_IO_APIC(void); 118extern void disable_IO_APIC(void);
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index f5d84bb7c948..de2cd9a2303a 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -100,7 +100,7 @@ __OUTS(l)
100 100
101#define IO_SPACE_LIMIT 0xffff 101#define IO_SPACE_LIMIT 0xffff
102 102
103#if defined(__KERNEL__) && __x86_64__ 103#if defined(__KERNEL__) && defined(__x86_64__)
104 104
105#include <linux/vmalloc.h> 105#include <linux/vmalloc.h>
106 106
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index 561ecbfd4cb5..f4fb238c89f1 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -85,18 +85,8 @@ struct IO_APIC_route_entry {
85 mask : 1, /* 0: enabled, 1: disabled */ 85 mask : 1, /* 0: enabled, 1: disabled */
86 __reserved_2 : 15; 86 __reserved_2 : 15;
87 87
88 union { struct { __u32 88 __u32 __reserved_3 : 24,
89 __reserved_1 : 24, 89 dest : 8;
90 physical_dest : 4,
91 __reserved_2 : 4;
92 } physical;
93
94 struct { __u32
95 __reserved_1 : 24,
96 logical_dest : 8;
97 } logical;
98 } dest;
99
100} __attribute__ ((packed)); 90} __attribute__ ((packed));
101 91
102/* 92/*
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h
index 5a11146d6d9c..177e92b4019b 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -103,6 +103,8 @@ void mce_log_therm_throt_event(unsigned int cpu, __u64 status);
103 103
104extern atomic_t mce_entry; 104extern atomic_t mce_entry;
105 105
106extern void do_machine_check(struct pt_regs *, long);
107
106#endif 108#endif
107 109
108#endif 110#endif
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index c38ebdf6f426..fb558fb1d211 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -11,24 +11,25 @@
11 11
12#include <asm/smp.h> 12#include <asm/smp.h>
13 13
14/* Should really switch to dynamic allocation at some point */
15#define NODEMAPSIZE 0x4fff
16
17/* Simple perfect hash to map physical addresses to node numbers */ 14/* Simple perfect hash to map physical addresses to node numbers */
18struct memnode { 15struct memnode {
19 int shift; 16 int shift;
20 u8 map[NODEMAPSIZE]; 17 unsigned int mapsize;
21} ____cacheline_aligned; 18 u8 *map;
19 u8 embedded_map[64-16];
20} ____cacheline_aligned; /* total size = 64 bytes */
22extern struct memnode memnode; 21extern struct memnode memnode;
23#define memnode_shift memnode.shift 22#define memnode_shift memnode.shift
24#define memnodemap memnode.map 23#define memnodemap memnode.map
24#define memnodemapsize memnode.mapsize
25 25
26extern struct pglist_data *node_data[]; 26extern struct pglist_data *node_data[];
27 27
28static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) 28static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
29{ 29{
30 unsigned nid; 30 unsigned nid;
31 VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE); 31 VIRTUAL_BUG_ON(!memnodemap);
32 VIRTUAL_BUG_ON((addr >> memnode_shift) >= memnodemapsize);
32 nid = memnodemap[addr >> memnode_shift]; 33 nid = memnodemap[addr >> memnode_shift];
33 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); 34 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
34 return nid; 35 return nid;
@@ -46,5 +47,10 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
46extern int pfn_valid(unsigned long pfn); 47extern int pfn_valid(unsigned long pfn);
47#endif 48#endif
48 49
50#ifdef CONFIG_NUMA_EMU
51#define FAKE_NODE_MIN_SIZE (64*1024*1024)
52#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1ul))
53#endif
54
49#endif 55#endif
50#endif 56#endif
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h
index 16396b1de3e4..6c2949a3c677 100644
--- a/include/asm-x86_64/mutex.h
+++ b/include/asm-x86_64/mutex.h
@@ -21,7 +21,7 @@ do { \
21 unsigned long dummy; \ 21 unsigned long dummy; \
22 \ 22 \
23 typecheck(atomic_t *, v); \ 23 typecheck(atomic_t *, v); \
24 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 24 typecheck_fn(void (*)(atomic_t *), fail_fn); \
25 \ 25 \
26 __asm__ __volatile__( \ 26 __asm__ __volatile__( \
27 LOCK_PREFIX " decl (%%rdi) \n" \ 27 LOCK_PREFIX " decl (%%rdi) \n" \
@@ -47,7 +47,7 @@ do { \
47 */ 47 */
48static inline int 48static inline int
49__mutex_fastpath_lock_retval(atomic_t *count, 49__mutex_fastpath_lock_retval(atomic_t *count,
50 int fastcall (*fail_fn)(atomic_t *)) 50 int (*fail_fn)(atomic_t *))
51{ 51{
52 if (unlikely(atomic_dec_return(count) < 0)) 52 if (unlikely(atomic_dec_return(count) < 0))
53 return fail_fn(count); 53 return fail_fn(count);
@@ -67,7 +67,7 @@ do { \
67 unsigned long dummy; \ 67 unsigned long dummy; \
68 \ 68 \
69 typecheck(atomic_t *, v); \ 69 typecheck(atomic_t *, v); \
70 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 70 typecheck_fn(void (*)(atomic_t *), fail_fn); \
71 \ 71 \
72 __asm__ __volatile__( \ 72 __asm__ __volatile__( \
73 LOCK_PREFIX " incl (%%rdi) \n" \ 73 LOCK_PREFIX " incl (%%rdi) \n" \
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index 43d4c333a8b1..4e28b6060a5e 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -18,11 +18,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); 18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)));
19} 19}
20 20
21static inline pmd_t *get_pmd(void)
22{
23 return (pmd_t *)get_zeroed_page(GFP_KERNEL);
24}
25
26static inline void pmd_free(pmd_t *pmd) 21static inline void pmd_free(pmd_t *pmd)
27{ 22{
28 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 23 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 59901c690a0d..730bd6028416 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -359,15 +359,6 @@ static inline int pmd_large(pmd_t pte) {
359#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 359#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
360#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE) 360#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE)
361 361
362/* physical address -> PTE */
363static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
364{
365 pte_t pte;
366 pte_val(pte) = physpage | pgprot_val(pgprot);
367 pte_val(pte) &= __supported_pte_mask;
368 return pte;
369}
370
371/* Change flags of a PTE */ 362/* Change flags of a PTE */
372static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 363static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
373{ 364{
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index a6d2ff5c69b7..f54f3abf93ce 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -45,11 +45,7 @@ extern u32 pmtmr_ioport;
45#else 45#else
46#define pmtmr_ioport 0 46#define pmtmr_ioport 0
47#endif 47#endif
48extern unsigned long long monotonic_base;
49extern int sysctl_vsyscall;
50extern int nohpet; 48extern int nohpet;
51extern unsigned long vxtime_hz;
52extern void time_init_gtod(void);
53 49
54extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); 50extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
55 51
@@ -91,8 +87,6 @@ extern void check_efer(void);
91 87
92extern int unhandled_signal(struct task_struct *tsk, int sig); 88extern int unhandled_signal(struct task_struct *tsk, int sig);
93 89
94extern int unsynchronized_tsc(void);
95
96extern void select_idle_routine(const struct cpuinfo_x86 *c); 90extern void select_idle_routine(const struct cpuinfo_x86 *c);
97 91
98extern unsigned long table_start, table_end; 92extern unsigned long table_start, table_end;
diff --git a/include/asm-x86_64/setup.h b/include/asm-x86_64/setup.h
index 985d4e3c79da..eaeff73d6c10 100644
--- a/include/asm-x86_64/setup.h
+++ b/include/asm-x86_64/setup.h
@@ -1,6 +1,6 @@
1#ifndef _x8664_SETUP_H 1#ifndef _x8664_SETUP_H
2#define _x8664_SETUP_H 2#define _x8664_SETUP_H
3 3
4#define COMMAND_LINE_SIZE 256 4#define COMMAND_LINE_SIZE 2048
5 5
6#endif 6#endif
diff --git a/include/asm-x86_64/termios.h b/include/asm-x86_64/termios.h
index 443b225537f0..35ee59b78329 100644
--- a/include/asm-x86_64/termios.h
+++ b/include/asm-x86_64/termios.h
@@ -39,24 +39,6 @@ struct termio {
39 39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41 41
42/* line disciplines */
43#define N_TTY 0
44#define N_SLIP 1
45#define N_MOUSE 2
46#define N_PPP 3
47#define N_STRIP 4
48#define N_AX25 5
49#define N_X25 6 /* X.25 async */
50#define N_6PACK 7
51#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
52#define N_R3964 9 /* Reserved for Simatic R3964 module */
53#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
54#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
55#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
56#define N_HDLC 13 /* synchronous HDLC */
57#define N_SYNC_PPP 14 /* synchronous PPP */
58#define N_HCI 15 /* Bluetooth HCI UART */
59
60#ifdef __KERNEL__ 42#ifdef __KERNEL__
61 43
62/* intr=^C quit=^\ erase=del kill=^U 44/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
index b9e5320b7625..8c6808a3fba4 100644
--- a/include/asm-x86_64/timex.h
+++ b/include/asm-x86_64/timex.h
@@ -12,38 +12,21 @@
12#include <asm/hpet.h> 12#include <asm/hpet.h>
13#include <asm/system.h> 13#include <asm/system.h>
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/tsc.h>
15#include <linux/compiler.h> 16#include <linux/compiler.h>
16 17
17#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ 18#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */
18 19
19typedef unsigned long long cycles_t;
20
21static inline cycles_t get_cycles (void)
22{
23 unsigned long long ret;
24
25 rdtscll(ret);
26 return ret;
27}
28
29/* Like get_cycles, but make sure the CPU is synchronized. */
30static __always_inline cycles_t get_cycles_sync(void)
31{
32 unsigned long long ret;
33 unsigned eax;
34 /* Don't do an additional sync on CPUs where we know
35 RDTSC is already synchronous. */
36 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
37 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
38 rdtscll(ret);
39 return ret;
40}
41
42extern unsigned int cpu_khz;
43
44extern int read_current_timer(unsigned long *timer_value); 20extern int read_current_timer(unsigned long *timer_value);
45#define ARCH_HAS_READ_CURRENT_TIMER 1 21#define ARCH_HAS_READ_CURRENT_TIMER 1
46 22
47extern struct vxtime_data vxtime; 23#define USEC_PER_TICK (USEC_PER_SEC / HZ)
24#define NSEC_PER_TICK (NSEC_PER_SEC / HZ)
25#define FSEC_PER_TICK (FSEC_PER_SEC / HZ)
26
27#define NS_SCALE 10 /* 2^10, carefully chosen */
28#define US_SCALE 32 /* 2^32, arbitralrily chosen */
48 29
30extern void mark_tsc_unstable(void);
31extern void set_cyc2ns_scale(unsigned long khz);
49#endif 32#endif
diff --git a/include/asm-x86_64/tsc.h b/include/asm-x86_64/tsc.h
new file mode 100644
index 000000000000..9a0a368852c7
--- /dev/null
+++ b/include/asm-x86_64/tsc.h
@@ -0,0 +1,66 @@
1/*
2 * linux/include/asm-x86_64/tsc.h
3 *
4 * x86_64 TSC related functions
5 */
6#ifndef _ASM_x86_64_TSC_H
7#define _ASM_x86_64_TSC_H
8
9#include <asm/processor.h>
10
11/*
12 * Standard way to access the cycle counter.
13 */
14typedef unsigned long long cycles_t;
15
16extern unsigned int cpu_khz;
17extern unsigned int tsc_khz;
18
19static inline cycles_t get_cycles(void)
20{
21 unsigned long long ret = 0;
22
23#ifndef CONFIG_X86_TSC
24 if (!cpu_has_tsc)
25 return 0;
26#endif
27
28#if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
29 rdtscll(ret);
30#endif
31 return ret;
32}
33
34/* Like get_cycles, but make sure the CPU is synchronized. */
35static __always_inline cycles_t get_cycles_sync(void)
36{
37 unsigned long long ret;
38#ifdef X86_FEATURE_SYNC_RDTSC
39 unsigned eax;
40
41 /*
42 * Don't do an additional sync on CPUs where we know
43 * RDTSC is already synchronous:
44 */
45 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
46 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
47#else
48 sync_core();
49#endif
50 rdtscll(ret);
51
52 return ret;
53}
54
55extern void tsc_init(void);
56extern void mark_tsc_unstable(void);
57extern int unsynchronized_tsc(void);
58
59/*
60 * Boot-time check whether the TSCs are synchronized across
61 * all CPUs/cores:
62 */
63extern void check_tsc_sync_source(int cpu);
64extern void check_tsc_sync_target(void);
65
66#endif
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index c0eac519840b..1981f70fcad1 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -37,11 +37,11 @@
37 * Uhhuh, this needs 65-bit arithmetic. We have a carry.. 37 * Uhhuh, this needs 65-bit arithmetic. We have a carry..
38 */ 38 */
39#define __range_not_ok(addr,size) ({ \ 39#define __range_not_ok(addr,size) ({ \
40 unsigned long flag,sum; \ 40 unsigned long flag,roksum; \
41 __chk_user_ptr(addr); \ 41 __chk_user_ptr(addr); \
42 asm("# range_ok\n\r" \ 42 asm("# range_ok\n\r" \
43 "addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0" \ 43 "addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0" \
44 :"=&r" (flag), "=r" (sum) \ 44 :"=&r" (flag), "=r" (roksum) \
45 :"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \ 45 :"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \
46 flag; }) 46 flag; })
47 47
@@ -367,4 +367,18 @@ __copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
367 return copy_user_generic((__force void *)dst, src, size); 367 return copy_user_generic((__force void *)dst, src, size);
368} 368}
369 369
370#define ARCH_HAS_NOCACHE_UACCESS 1
371extern long __copy_user_nocache(void *dst, const void __user *src, unsigned size, int zerorest);
372
373static inline int __copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
374{
375 might_sleep();
376 return __copy_user_nocache(dst, (__force void *)src, size, 1);
377}
378
379static inline int __copy_from_user_inatomic_nocache(void *dst, const void __user *src, unsigned size)
380{
381 return __copy_user_nocache(dst, (__force void *)src, size, 0);
382}
383
370#endif /* __X86_64_UACCESS_H */ 384#endif /* __X86_64_UACCESS_H */
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index 05cb8dd200de..82b4afe65c91 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -16,51 +16,27 @@ enum vsyscall_num {
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17#include <linux/seqlock.h> 17#include <linux/seqlock.h>
18 18
19#define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))
20#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16))) 19#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16)))
21#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) 20#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
22#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16)))
23#define __section_sysctl_vsyscall __attribute__ ((unused, __section__ (".sysctl_vsyscall"), aligned(16)))
24#define __section_xtime __attribute__ ((unused, __section__ (".xtime"), aligned(16)))
25#define __section_xtime_lock __attribute__ ((unused, __section__ (".xtime_lock"), aligned(16)))
26 21
27#define VXTIME_TSC 1 22/* Definitions for CONFIG_GENERIC_TIME definitions */
28#define VXTIME_HPET 2 23#define __section_vsyscall_gtod_data __attribute__ \
29#define VXTIME_PMTMR 3 24 ((unused, __section__ (".vsyscall_gtod_data"),aligned(16)))
25#define __vsyscall_fn __attribute__ ((unused,__section__(".vsyscall_fn")))
30 26
31#define VGETCPU_RDTSCP 1 27#define VGETCPU_RDTSCP 1
32#define VGETCPU_LSL 2 28#define VGETCPU_LSL 2
33 29
34struct vxtime_data {
35 long hpet_address; /* HPET base address */
36 int last;
37 unsigned long last_tsc;
38 long quot;
39 long tsc_quot;
40 int mode;
41};
42
43#define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a) 30#define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
44#define hpet_writel(d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a) 31#define hpet_writel(d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
45 32
46/* vsyscall space (readonly) */
47extern struct vxtime_data __vxtime;
48extern int __vgetcpu_mode; 33extern int __vgetcpu_mode;
49extern struct timespec __xtime;
50extern volatile unsigned long __jiffies; 34extern volatile unsigned long __jiffies;
51extern struct timezone __sys_tz;
52extern seqlock_t __xtime_lock;
53 35
54/* kernel space (writeable) */ 36/* kernel space (writeable) */
55extern struct vxtime_data vxtime;
56extern int vgetcpu_mode; 37extern int vgetcpu_mode;
57extern struct timezone sys_tz; 38extern struct timezone sys_tz;
58extern int sysctl_vsyscall; 39extern struct vsyscall_gtod_data_t vsyscall_gtod_data;
59extern seqlock_t xtime_lock;
60
61extern int sysctl_vsyscall;
62
63#define ARCH_HAVE_XTIME_LOCK 1
64 40
65#endif /* __KERNEL__ */ 41#endif /* __KERNEL__ */
66 42