aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/hp/common/sba_iommu.c4
-rw-r--r--arch/ia64/hp/sim/hpsim_irq.c9
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/atomic.h2
-rw-r--r--arch/ia64/include/asm/bitsperlong.h8
-rw-r--r--arch/ia64/include/asm/dma-mapping.h110
-rw-r--r--arch/ia64/include/asm/gcc_intrin.h18
-rw-r--r--arch/ia64/include/asm/hw_irq.h4
-rw-r--r--arch/ia64/include/asm/iommu.h5
-rw-r--r--arch/ia64/include/asm/kmap_types.h24
-rw-r--r--arch/ia64/include/asm/kvm_host.h6
-rw-r--r--arch/ia64/include/asm/mca.h38
-rw-r--r--arch/ia64/include/asm/meminit.h18
-rw-r--r--arch/ia64/include/asm/mman.h2
-rw-r--r--arch/ia64/include/asm/pal.h24
-rw-r--r--arch/ia64/include/asm/pci.h13
-rw-r--r--arch/ia64/include/asm/pgtable.h2
-rw-r--r--arch/ia64/include/asm/processor.h56
-rw-r--r--arch/ia64/include/asm/sal.h8
-rw-r--r--arch/ia64/include/asm/signal.h2
-rw-r--r--arch/ia64/include/asm/sn/sn_sal.h2
-rw-r--r--arch/ia64/include/asm/suspend.h1
-rw-r--r--arch/ia64/include/asm/types.h20
-rw-r--r--arch/ia64/include/asm/unistd.h4
-rw-r--r--arch/ia64/kernel/acpi-processor.c12
-rw-r--r--arch/ia64/kernel/acpi.c5
-rw-r--r--arch/ia64/kernel/efi.c10
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/kernel/init_task.c4
-rw-r--r--arch/ia64/kernel/iosapic.c20
-rw-r--r--arch/ia64/kernel/irq.c2
-rw-r--r--arch/ia64/kernel/irq_ia64.c5
-rw-r--r--arch/ia64/kernel/irq_lsapic.c2
-rw-r--r--arch/ia64/kernel/mca.c23
-rw-r--r--arch/ia64/kernel/module.c14
-rw-r--r--arch/ia64/kernel/msi_ia64.c18
-rw-r--r--arch/ia64/kernel/palinfo.c68
-rw-r--r--arch/ia64/kernel/paravirt_patchlist.c2
-rw-r--r--arch/ia64/kernel/pci-dma.c4
-rw-r--r--arch/ia64/kernel/pci-swiotlb.c2
-rw-r--r--arch/ia64/kernel/perfmon.c8
-rw-r--r--arch/ia64/kernel/setup.c32
-rw-r--r--arch/ia64/kernel/smp.c2
-rw-r--r--arch/ia64/kernel/smpboot.c4
-rw-r--r--arch/ia64/kernel/time.c2
-rw-r--r--arch/ia64/kernel/topology.c4
-rw-r--r--arch/ia64/kernel/uncached.c6
-rw-r--r--arch/ia64/kvm/Kconfig2
-rw-r--r--arch/ia64/kvm/kvm-ia64.c263
-rw-r--r--arch/ia64/kvm/kvm_fw.c28
-rw-r--r--arch/ia64/kvm/lapic.h6
-rw-r--r--arch/ia64/kvm/optvfault.S30
-rw-r--r--arch/ia64/kvm/process.c5
-rw-r--r--arch/ia64/kvm/vcpu.c20
-rw-r--r--arch/ia64/kvm/vmm.c12
-rw-r--r--arch/ia64/kvm/vmm_ivt.S18
-rw-r--r--arch/ia64/kvm/vtlb.c3
-rw-r--r--arch/ia64/mm/contig.c9
-rw-r--r--arch/ia64/mm/extable.c28
-rw-r--r--arch/ia64/mm/fault.c2
-rw-r--r--arch/ia64/mm/init.c15
-rw-r--r--arch/ia64/mm/tlb.c4
-rw-r--r--arch/ia64/pci/pci.c16
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c4
-rw-r--r--arch/ia64/sn/kernel/io_common.c2
-rw-r--r--arch/ia64/sn/kernel/irq.c10
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c8
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c4
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c2
-rw-r--r--arch/ia64/sn/kernel/tiocx.c2
-rw-r--r--arch/ia64/sn/pci/pci_dma.c3
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c2
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c6
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c6
-rw-r--r--arch/ia64/xen/irq_xen.c2
76 files changed, 628 insertions, 516 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 294a3b13ecac..170042b420d4 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -28,6 +28,7 @@ config IA64
28 select HAVE_DMA_ATTRS 28 select HAVE_DMA_ATTRS
29 select HAVE_KVM 29 select HAVE_KVM
30 select HAVE_ARCH_TRACEHOOK 30 select HAVE_ARCH_TRACEHOOK
31 select HAVE_DMA_API_DEBUG
31 default y 32 default y
32 help 33 help
33 The Itanium Processor Family is Intel's 64-bit successor to 34 The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 56ceb68eb99d..8cfb001092ab 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1131,7 +1131,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
1131#ifdef CONFIG_NUMA 1131#ifdef CONFIG_NUMA
1132 { 1132 {
1133 struct page *page; 1133 struct page *page;
1134 page = alloc_pages_node(ioc->node == MAX_NUMNODES ? 1134 page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ?
1135 numa_node_id() : ioc->node, flags, 1135 numa_node_id() : ioc->node, flags,
1136 get_order(size)); 1136 get_order(size));
1137 1137
@@ -1787,7 +1787,7 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = {
1787}; 1787};
1788 1788
1789static struct ioc * __init 1789static struct ioc * __init
1790ioc_init(u64 hpa, void *handle) 1790ioc_init(unsigned long hpa, void *handle)
1791{ 1791{
1792 struct ioc *ioc; 1792 struct ioc *ioc;
1793 struct ioc_iommu *info; 1793 struct ioc_iommu *info;
diff --git a/arch/ia64/hp/sim/hpsim_irq.c b/arch/ia64/hp/sim/hpsim_irq.c
index cc0a3182db3c..b272261d77cc 100644
--- a/arch/ia64/hp/sim/hpsim_irq.c
+++ b/arch/ia64/hp/sim/hpsim_irq.c
@@ -21,12 +21,13 @@ hpsim_irq_noop (unsigned int irq)
21{ 21{
22} 22}
23 23
24static void 24static int
25hpsim_set_affinity_noop(unsigned int a, const struct cpumask *b) 25hpsim_set_affinity_noop(unsigned int a, const struct cpumask *b)
26{ 26{
27 return 0;
27} 28}
28 29
29static struct hw_interrupt_type irq_type_hp_sim = { 30static struct irq_chip irq_type_hp_sim = {
30 .name = "hpsim", 31 .name = "hpsim",
31 .startup = hpsim_irq_startup, 32 .startup = hpsim_irq_startup,
32 .shutdown = hpsim_irq_noop, 33 .shutdown = hpsim_irq_noop,
@@ -40,12 +41,12 @@ static struct hw_interrupt_type irq_type_hp_sim = {
40void __init 41void __init
41hpsim_irq_init (void) 42hpsim_irq_init (void)
42{ 43{
43 irq_desc_t *idesc; 44 struct irq_desc *idesc;
44 int i; 45 int i;
45 46
46 for (i = 0; i < NR_IRQS; ++i) { 47 for (i = 0; i < NR_IRQS; ++i) {
47 idesc = irq_desc + i; 48 idesc = irq_desc + i;
48 if (idesc->chip == &no_irq_type) 49 if (idesc->chip == &no_irq_chip)
49 idesc->chip = &irq_type_hp_sim; 50 idesc->chip = &irq_type_hp_sim;
50 } 51 }
51} 52}
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index ccbe8ae47a61..c7d0a71b9242 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -2,7 +2,6 @@ include include/asm-generic/Kbuild.asm
2 2
3header-y += break.h 3header-y += break.h
4header-y += fpu.h 4header-y += fpu.h
5header-y += fpswa.h
6header-y += ia64regs.h 5header-y += ia64regs.h
7header-y += intel_intrin.h 6header-y += intel_intrin.h
8header-y += perfmon_default_smpl.h 7header-y += perfmon_default_smpl.h
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h
index d37292bd9875..88405cb0832a 100644
--- a/arch/ia64/include/asm/atomic.h
+++ b/arch/ia64/include/asm/atomic.h
@@ -216,5 +216,5 @@ atomic64_add_negative (__s64 i, atomic64_t *v)
216#define smp_mb__before_atomic_inc() barrier() 216#define smp_mb__before_atomic_inc() barrier()
217#define smp_mb__after_atomic_inc() barrier() 217#define smp_mb__after_atomic_inc() barrier()
218 218
219#include <asm-generic/atomic.h> 219#include <asm-generic/atomic-long.h>
220#endif /* _ASM_IA64_ATOMIC_H */ 220#endif /* _ASM_IA64_ATOMIC_H */
diff --git a/arch/ia64/include/asm/bitsperlong.h b/arch/ia64/include/asm/bitsperlong.h
new file mode 100644
index 000000000000..ec4db3c970b7
--- /dev/null
+++ b/arch/ia64/include/asm/bitsperlong.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_IA64_BITSPERLONG_H
2#define __ASM_IA64_BITSPERLONG_H
3
4#define __BITS_PER_LONG 64
5
6#include <asm-generic/bitsperlong.h>
7
8#endif /* __ASM_IA64_BITSPERLONG_H */
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 36c0009dbece..5a61b5c2e18f 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -8,6 +8,7 @@
8#include <asm/machvec.h> 8#include <asm/machvec.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <asm/swiotlb.h> 10#include <asm/swiotlb.h>
11#include <linux/dma-debug.h>
11 12
12#define ARCH_HAS_DMA_GET_REQUIRED_MASK 13#define ARCH_HAS_DMA_GET_REQUIRED_MASK
13 14
@@ -24,95 +25,28 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
24 dma_addr_t *daddr, gfp_t gfp) 25 dma_addr_t *daddr, gfp_t gfp)
25{ 26{
26 struct dma_map_ops *ops = platform_dma_get_ops(dev); 27 struct dma_map_ops *ops = platform_dma_get_ops(dev);
27 return ops->alloc_coherent(dev, size, daddr, gfp); 28 void *caddr;
29
30 caddr = ops->alloc_coherent(dev, size, daddr, gfp);
31 debug_dma_alloc_coherent(dev, size, *daddr, caddr);
32 return caddr;
28} 33}
29 34
30static inline void dma_free_coherent(struct device *dev, size_t size, 35static inline void dma_free_coherent(struct device *dev, size_t size,
31 void *caddr, dma_addr_t daddr) 36 void *caddr, dma_addr_t daddr)
32{ 37{
33 struct dma_map_ops *ops = platform_dma_get_ops(dev); 38 struct dma_map_ops *ops = platform_dma_get_ops(dev);
39 debug_dma_free_coherent(dev, size, caddr, daddr);
34 ops->free_coherent(dev, size, caddr, daddr); 40 ops->free_coherent(dev, size, caddr, daddr);
35} 41}
36 42
37#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 43#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
38#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 44#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
39 45
40static inline dma_addr_t dma_map_single_attrs(struct device *dev, 46#define get_dma_ops(dev) platform_dma_get_ops(dev)
41 void *caddr, size_t size, 47#define flush_write_buffers()
42 enum dma_data_direction dir,
43 struct dma_attrs *attrs)
44{
45 struct dma_map_ops *ops = platform_dma_get_ops(dev);
46 return ops->map_page(dev, virt_to_page(caddr),
47 (unsigned long)caddr & ~PAGE_MASK, size,
48 dir, attrs);
49}
50
51static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t daddr,
52 size_t size,
53 enum dma_data_direction dir,
54 struct dma_attrs *attrs)
55{
56 struct dma_map_ops *ops = platform_dma_get_ops(dev);
57 ops->unmap_page(dev, daddr, size, dir, attrs);
58}
59
60#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
61#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL)
62
63static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
64 int nents, enum dma_data_direction dir,
65 struct dma_attrs *attrs)
66{
67 struct dma_map_ops *ops = platform_dma_get_ops(dev);
68 return ops->map_sg(dev, sgl, nents, dir, attrs);
69}
70
71static inline void dma_unmap_sg_attrs(struct device *dev,
72 struct scatterlist *sgl, int nents,
73 enum dma_data_direction dir,
74 struct dma_attrs *attrs)
75{
76 struct dma_map_ops *ops = platform_dma_get_ops(dev);
77 ops->unmap_sg(dev, sgl, nents, dir, attrs);
78}
79
80#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
81#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
82
83static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t daddr,
84 size_t size,
85 enum dma_data_direction dir)
86{
87 struct dma_map_ops *ops = platform_dma_get_ops(dev);
88 ops->sync_single_for_cpu(dev, daddr, size, dir);
89}
90
91static inline void dma_sync_sg_for_cpu(struct device *dev,
92 struct scatterlist *sgl,
93 int nents, enum dma_data_direction dir)
94{
95 struct dma_map_ops *ops = platform_dma_get_ops(dev);
96 ops->sync_sg_for_cpu(dev, sgl, nents, dir);
97}
98 48
99static inline void dma_sync_single_for_device(struct device *dev, 49#include <asm-generic/dma-mapping-common.h>
100 dma_addr_t daddr,
101 size_t size,
102 enum dma_data_direction dir)
103{
104 struct dma_map_ops *ops = platform_dma_get_ops(dev);
105 ops->sync_single_for_device(dev, daddr, size, dir);
106}
107
108static inline void dma_sync_sg_for_device(struct device *dev,
109 struct scatterlist *sgl,
110 int nents,
111 enum dma_data_direction dir)
112{
113 struct dma_map_ops *ops = platform_dma_get_ops(dev);
114 ops->sync_sg_for_device(dev, sgl, nents, dir);
115}
116 50
117static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr) 51static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
118{ 52{
@@ -120,30 +54,6 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
120 return ops->mapping_error(dev, daddr); 54 return ops->mapping_error(dev, daddr);
121} 55}
122 56
123static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
124 size_t offset, size_t size,
125 enum dma_data_direction dir)
126{
127 struct dma_map_ops *ops = platform_dma_get_ops(dev);
128 return ops->map_page(dev, page, offset, size, dir, NULL);
129}
130
131static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
132 size_t size, enum dma_data_direction dir)
133{
134 dma_unmap_single(dev, addr, size, dir);
135}
136
137/*
138 * Rest of this file is part of the "Advanced DMA API". Use at your own risk.
139 * See Documentation/DMA-API.txt for details.
140 */
141
142#define dma_sync_single_range_for_cpu(dev, dma_handle, offset, size, dir) \
143 dma_sync_single_for_cpu(dev, dma_handle, size, dir)
144#define dma_sync_single_range_for_device(dev, dma_handle, offset, size, dir) \
145 dma_sync_single_for_device(dev, dma_handle, size, dir)
146
147static inline int dma_supported(struct device *dev, u64 mask) 57static inline int dma_supported(struct device *dev, u64 mask)
148{ 58{
149 struct dma_map_ops *ops = platform_dma_get_ops(dev); 59 struct dma_map_ops *ops = platform_dma_get_ops(dev);
diff --git a/arch/ia64/include/asm/gcc_intrin.h b/arch/ia64/include/asm/gcc_intrin.h
index c2c5fd8fcac4..21ddee54adae 100644
--- a/arch/ia64/include/asm/gcc_intrin.h
+++ b/arch/ia64/include/asm/gcc_intrin.h
@@ -388,7 +388,7 @@ register unsigned long ia64_r13 asm ("r13") __used;
388 388
389#define ia64_native_thash(addr) \ 389#define ia64_native_thash(addr) \
390({ \ 390({ \
391 __u64 ia64_intri_res; \ 391 unsigned long ia64_intri_res; \
392 asm volatile ("thash %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \ 392 asm volatile ("thash %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \
393 ia64_intri_res; \ 393 ia64_intri_res; \
394}) 394})
@@ -419,7 +419,7 @@ register unsigned long ia64_r13 asm ("r13") __used;
419 419
420#define ia64_tpa(addr) \ 420#define ia64_tpa(addr) \
421({ \ 421({ \
422 __u64 ia64_pa; \ 422 unsigned long ia64_pa; \
423 asm volatile ("tpa %0 = %1" : "=r"(ia64_pa) : "r"(addr) : "memory"); \ 423 asm volatile ("tpa %0 = %1" : "=r"(ia64_pa) : "r"(addr) : "memory"); \
424 ia64_pa; \ 424 ia64_pa; \
425}) 425})
@@ -444,35 +444,35 @@ register unsigned long ia64_r13 asm ("r13") __used;
444 444
445#define ia64_native_get_cpuid(index) \ 445#define ia64_native_get_cpuid(index) \
446({ \ 446({ \
447 __u64 ia64_intri_res; \ 447 unsigned long ia64_intri_res; \
448 asm volatile ("mov %0=cpuid[%r1]" : "=r"(ia64_intri_res) : "rO"(index)); \ 448 asm volatile ("mov %0=cpuid[%r1]" : "=r"(ia64_intri_res) : "rO"(index)); \
449 ia64_intri_res; \ 449 ia64_intri_res; \
450}) 450})
451 451
452#define __ia64_get_dbr(index) \ 452#define __ia64_get_dbr(index) \
453({ \ 453({ \
454 __u64 ia64_intri_res; \ 454 unsigned long ia64_intri_res; \
455 asm volatile ("mov %0=dbr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ 455 asm volatile ("mov %0=dbr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
456 ia64_intri_res; \ 456 ia64_intri_res; \
457}) 457})
458 458
459#define ia64_get_ibr(index) \ 459#define ia64_get_ibr(index) \
460({ \ 460({ \
461 __u64 ia64_intri_res; \ 461 unsigned long ia64_intri_res; \
462 asm volatile ("mov %0=ibr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ 462 asm volatile ("mov %0=ibr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
463 ia64_intri_res; \ 463 ia64_intri_res; \
464}) 464})
465 465
466#define ia64_get_pkr(index) \ 466#define ia64_get_pkr(index) \
467({ \ 467({ \
468 __u64 ia64_intri_res; \ 468 unsigned long ia64_intri_res; \
469 asm volatile ("mov %0=pkr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ 469 asm volatile ("mov %0=pkr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
470 ia64_intri_res; \ 470 ia64_intri_res; \
471}) 471})
472 472
473#define ia64_get_pmc(index) \ 473#define ia64_get_pmc(index) \
474({ \ 474({ \
475 __u64 ia64_intri_res; \ 475 unsigned long ia64_intri_res; \
476 asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ 476 asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
477 ia64_intri_res; \ 477 ia64_intri_res; \
478}) 478})
@@ -480,14 +480,14 @@ register unsigned long ia64_r13 asm ("r13") __used;
480 480
481#define ia64_native_get_pmd(index) \ 481#define ia64_native_get_pmd(index) \
482({ \ 482({ \
483 __u64 ia64_intri_res; \ 483 unsigned long ia64_intri_res; \
484 asm volatile ("mov %0=pmd[%1]" : "=r"(ia64_intri_res) : "r"(index)); \ 484 asm volatile ("mov %0=pmd[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
485 ia64_intri_res; \ 485 ia64_intri_res; \
486}) 486})
487 487
488#define ia64_native_get_rr(index) \ 488#define ia64_native_get_rr(index) \
489({ \ 489({ \
490 __u64 ia64_intri_res; \ 490 unsigned long ia64_intri_res; \
491 asm volatile ("mov %0=rr[%1]" : "=r"(ia64_intri_res) : "r" (index)); \ 491 asm volatile ("mov %0=rr[%1]" : "=r"(ia64_intri_res) : "r" (index)); \
492 ia64_intri_res; \ 492 ia64_intri_res; \
493}) 493})
diff --git a/arch/ia64/include/asm/hw_irq.h b/arch/ia64/include/asm/hw_irq.h
index 5c99cbcb8a0d..91619b31dbf5 100644
--- a/arch/ia64/include/asm/hw_irq.h
+++ b/arch/ia64/include/asm/hw_irq.h
@@ -106,7 +106,7 @@ extern struct irq_cfg irq_cfg[NR_IRQS];
106#define irq_to_domain(x) irq_cfg[(x)].domain 106#define irq_to_domain(x) irq_cfg[(x)].domain
107DECLARE_PER_CPU(int[IA64_NUM_VECTORS], vector_irq); 107DECLARE_PER_CPU(int[IA64_NUM_VECTORS], vector_irq);
108 108
109extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ 109extern struct irq_chip irq_type_ia64_lsapic; /* CPU-internal interrupt controller */
110 110
111#ifdef CONFIG_PARAVIRT_GUEST 111#ifdef CONFIG_PARAVIRT_GUEST
112#include <asm/paravirt.h> 112#include <asm/paravirt.h>
@@ -146,7 +146,7 @@ static inline void ia64_native_resend_irq(unsigned int vector)
146 * Default implementations for the irq-descriptor API: 146 * Default implementations for the irq-descriptor API:
147 */ 147 */
148 148
149extern irq_desc_t irq_desc[NR_IRQS]; 149extern struct irq_desc irq_desc[NR_IRQS];
150 150
151#ifndef CONFIG_IA64_GENERIC 151#ifndef CONFIG_IA64_GENERIC
152static inline ia64_vector __ia64_irq_to_vector(int irq) 152static inline ia64_vector __ia64_irq_to_vector(int irq)
diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h
index 0490794fe4aa..745e095fe82e 100644
--- a/arch/ia64/include/asm/iommu.h
+++ b/arch/ia64/include/asm/iommu.h
@@ -9,6 +9,11 @@ extern void pci_iommu_shutdown(void);
9extern void no_iommu_init(void); 9extern void no_iommu_init(void);
10extern int force_iommu, no_iommu; 10extern int force_iommu, no_iommu;
11extern int iommu_detected; 11extern int iommu_detected;
12#ifdef CONFIG_DMAR
13extern int iommu_pass_through;
14#else
15#define iommu_pass_through (0)
16#endif
12extern void iommu_dma_init(void); 17extern void iommu_dma_init(void);
13extern void machvec_init(const char *name); 18extern void machvec_init(const char *name);
14 19
diff --git a/arch/ia64/include/asm/kmap_types.h b/arch/ia64/include/asm/kmap_types.h
index 5d1658aa2b3b..05d5f9996105 100644
--- a/arch/ia64/include/asm/kmap_types.h
+++ b/arch/ia64/include/asm/kmap_types.h
@@ -1,30 +1,12 @@
1#ifndef _ASM_IA64_KMAP_TYPES_H 1#ifndef _ASM_IA64_KMAP_TYPES_H
2#define _ASM_IA64_KMAP_TYPES_H 2#define _ASM_IA64_KMAP_TYPES_H
3 3
4
5#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef CONFIG_DEBUG_HIGHMEM
6# define D(n) __KM_FENCE_##n , 5#define __WITH_KM_FENCE
7#else
8# define D(n)
9#endif 6#endif
10 7
11enum km_type { 8#include <asm-generic/kmap_types.h>
12D(0) KM_BOUNCE_READ,
13D(1) KM_SKB_SUNRPC_DATA,
14D(2) KM_SKB_DATA_SOFTIRQ,
15D(3) KM_USER0,
16D(4) KM_USER1,
17D(5) KM_BIO_SRC_IRQ,
18D(6) KM_BIO_DST_IRQ,
19D(7) KM_PTE0,
20D(8) KM_PTE1,
21D(9) KM_IRQ0,
22D(10) KM_IRQ1,
23D(11) KM_SOFTIRQ0,
24D(12) KM_SOFTIRQ1,
25D(13) KM_TYPE_NR
26};
27 9
28#undef D 10#undef __WITH_KM_FENCE
29 11
30#endif /* _ASM_IA64_KMAP_TYPES_H */ 12#endif /* _ASM_IA64_KMAP_TYPES_H */
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 4542651e6acb..5f43697aed30 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -371,6 +371,7 @@ struct kvm_vcpu_arch {
371 int last_run_cpu; 371 int last_run_cpu;
372 int vmm_tr_slot; 372 int vmm_tr_slot;
373 int vm_tr_slot; 373 int vm_tr_slot;
374 int sn_rtc_tr_slot;
374 375
375#define KVM_MP_STATE_RUNNABLE 0 376#define KVM_MP_STATE_RUNNABLE 0
376#define KVM_MP_STATE_UNINITIALIZED 1 377#define KVM_MP_STATE_UNINITIALIZED 1
@@ -465,6 +466,7 @@ struct kvm_arch {
465 unsigned long vmm_init_rr; 466 unsigned long vmm_init_rr;
466 467
467 int online_vcpus; 468 int online_vcpus;
469 int is_sn2;
468 470
469 struct kvm_ioapic *vioapic; 471 struct kvm_ioapic *vioapic;
470 struct kvm_vm_stat stat; 472 struct kvm_vm_stat stat;
@@ -472,6 +474,7 @@ struct kvm_arch {
472 474
473 struct list_head assigned_dev_head; 475 struct list_head assigned_dev_head;
474 struct iommu_domain *iommu_domain; 476 struct iommu_domain *iommu_domain;
477 int iommu_flags;
475 struct hlist_head irq_ack_notifier_list; 478 struct hlist_head irq_ack_notifier_list;
476 479
477 unsigned long irq_sources_bitmap; 480 unsigned long irq_sources_bitmap;
@@ -578,6 +581,8 @@ struct kvm_vmm_info{
578 kvm_vmm_entry *vmm_entry; 581 kvm_vmm_entry *vmm_entry;
579 kvm_tramp_entry *tramp_entry; 582 kvm_tramp_entry *tramp_entry;
580 unsigned long vmm_ivt; 583 unsigned long vmm_ivt;
584 unsigned long patch_mov_ar;
585 unsigned long patch_mov_ar_sn2;
581}; 586};
582 587
583int kvm_highest_pending_irq(struct kvm_vcpu *vcpu); 588int kvm_highest_pending_irq(struct kvm_vcpu *vcpu);
@@ -585,7 +590,6 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu);
585int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); 590int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
586void kvm_sal_emul(struct kvm_vcpu *vcpu); 591void kvm_sal_emul(struct kvm_vcpu *vcpu);
587 592
588static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {}
589#endif /* __ASSEMBLY__*/ 593#endif /* __ASSEMBLY__*/
590 594
591#endif 595#endif
diff --git a/arch/ia64/include/asm/mca.h b/arch/ia64/include/asm/mca.h
index 18a4321349a3..44a0b53df900 100644
--- a/arch/ia64/include/asm/mca.h
+++ b/arch/ia64/include/asm/mca.h
@@ -72,39 +72,39 @@ typedef struct ia64_mc_info_s {
72struct ia64_sal_os_state { 72struct ia64_sal_os_state {
73 73
74 /* SAL to OS */ 74 /* SAL to OS */
75 u64 os_gp; /* GP of the os registered with the SAL, physical */ 75 unsigned long os_gp; /* GP of the os registered with the SAL, physical */
76 u64 pal_proc; /* PAL_PROC entry point, physical */ 76 unsigned long pal_proc; /* PAL_PROC entry point, physical */
77 u64 sal_proc; /* SAL_PROC entry point, physical */ 77 unsigned long sal_proc; /* SAL_PROC entry point, physical */
78 u64 rv_rc; /* MCA - Rendezvous state, INIT - reason code */ 78 unsigned long rv_rc; /* MCA - Rendezvous state, INIT - reason code */
79 u64 proc_state_param; /* from R18 */ 79 unsigned long proc_state_param; /* from R18 */
80 u64 monarch; /* 1 for a monarch event, 0 for a slave */ 80 unsigned long monarch; /* 1 for a monarch event, 0 for a slave */
81 81
82 /* common */ 82 /* common */
83 u64 sal_ra; /* Return address in SAL, physical */ 83 unsigned long sal_ra; /* Return address in SAL, physical */
84 u64 sal_gp; /* GP of the SAL - physical */ 84 unsigned long sal_gp; /* GP of the SAL - physical */
85 pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */ 85 pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */
86 /* Previous values of IA64_KR(CURRENT) and IA64_KR(CURRENT_STACK). 86 /* Previous values of IA64_KR(CURRENT) and IA64_KR(CURRENT_STACK).
87 * Note: if the MCA/INIT recovery code wants to resume to a new context 87 * Note: if the MCA/INIT recovery code wants to resume to a new context
88 * then it must change these values to reflect the new kernel stack. 88 * then it must change these values to reflect the new kernel stack.
89 */ 89 */
90 u64 prev_IA64_KR_CURRENT; /* previous value of IA64_KR(CURRENT) */ 90 unsigned long prev_IA64_KR_CURRENT; /* previous value of IA64_KR(CURRENT) */
91 u64 prev_IA64_KR_CURRENT_STACK; 91 unsigned long prev_IA64_KR_CURRENT_STACK;
92 struct task_struct *prev_task; /* previous task, NULL if it is not useful */ 92 struct task_struct *prev_task; /* previous task, NULL if it is not useful */
93 /* Some interrupt registers are not saved in minstate, pt_regs or 93 /* Some interrupt registers are not saved in minstate, pt_regs or
94 * switch_stack. Because MCA/INIT can occur when interrupts are 94 * switch_stack. Because MCA/INIT can occur when interrupts are
95 * disabled, we need to save the additional interrupt registers over 95 * disabled, we need to save the additional interrupt registers over
96 * MCA/INIT and resume. 96 * MCA/INIT and resume.
97 */ 97 */
98 u64 isr; 98 unsigned long isr;
99 u64 ifa; 99 unsigned long ifa;
100 u64 itir; 100 unsigned long itir;
101 u64 iipa; 101 unsigned long iipa;
102 u64 iim; 102 unsigned long iim;
103 u64 iha; 103 unsigned long iha;
104 104
105 /* OS to SAL */ 105 /* OS to SAL */
106 u64 os_status; /* OS status to SAL, enum below */ 106 unsigned long os_status; /* OS status to SAL, enum below */
107 u64 context; /* 0 if return to same context 107 unsigned long context; /* 0 if return to same context
108 1 if return to new context */ 108 1 if return to new context */
109}; 109};
110 110
@@ -150,7 +150,7 @@ extern void ia64_slave_init_handler(void);
150extern void ia64_mca_cmc_vector_setup(void); 150extern void ia64_mca_cmc_vector_setup(void);
151extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *)); 151extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *));
152extern void ia64_unreg_MCA_extension(void); 152extern void ia64_unreg_MCA_extension(void);
153extern u64 ia64_get_rnat(u64 *); 153extern unsigned long ia64_get_rnat(unsigned long *);
154extern void ia64_mca_printk(const char * fmt, ...) 154extern void ia64_mca_printk(const char * fmt, ...)
155 __attribute__ ((format (printf, 1, 2))); 155 __attribute__ ((format (printf, 1, 2)));
156 156
diff --git a/arch/ia64/include/asm/meminit.h b/arch/ia64/include/asm/meminit.h
index c0cea375620a..688a812c017d 100644
--- a/arch/ia64/include/asm/meminit.h
+++ b/arch/ia64/include/asm/meminit.h
@@ -25,8 +25,8 @@
25#define IA64_MAX_RSVD_REGIONS 9 25#define IA64_MAX_RSVD_REGIONS 9
26 26
27struct rsvd_region { 27struct rsvd_region {
28 unsigned long start; /* virtual address of beginning of element */ 28 u64 start; /* virtual address of beginning of element */
29 unsigned long end; /* virtual address of end of element + 1 */ 29 u64 end; /* virtual address of end of element + 1 */
30}; 30};
31 31
32extern struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1]; 32extern struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
@@ -35,13 +35,13 @@ extern int num_rsvd_regions;
35extern void find_memory (void); 35extern void find_memory (void);
36extern void reserve_memory (void); 36extern void reserve_memory (void);
37extern void find_initrd (void); 37extern void find_initrd (void);
38extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg); 38extern int filter_rsvd_memory (u64 start, u64 end, void *arg);
39extern int filter_memory (unsigned long start, unsigned long end, void *arg); 39extern int filter_memory (u64 start, u64 end, void *arg);
40extern unsigned long efi_memmap_init(unsigned long *s, unsigned long *e); 40extern unsigned long efi_memmap_init(u64 *s, u64 *e);
41extern int find_max_min_low_pfn (unsigned long , unsigned long, void *); 41extern int find_max_min_low_pfn (u64, u64, void *);
42 42
43extern unsigned long vmcore_find_descriptor_size(unsigned long address); 43extern unsigned long vmcore_find_descriptor_size(unsigned long address);
44extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end); 44extern int reserve_elfcorehdr(u64 *start, u64 *end);
45 45
46/* 46/*
47 * For rounding an address to the next IA64_GRANULE_SIZE or order 47 * For rounding an address to the next IA64_GRANULE_SIZE or order
@@ -63,8 +63,8 @@ extern int register_active_ranges(u64 start, u64 len, int nid);
63# define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */ 63# define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */
64 extern unsigned long vmalloc_end; 64 extern unsigned long vmalloc_end;
65 extern struct page *vmem_map; 65 extern struct page *vmem_map;
66 extern int find_largest_hole (u64 start, u64 end, void *arg); 66 extern int find_largest_hole(u64 start, u64 end, void *arg);
67 extern int create_mem_map_page_table (u64 start, u64 end, void *arg); 67 extern int create_mem_map_page_table(u64 start, u64 end, void *arg);
68 extern int vmemmap_find_next_valid_pfn(int, int); 68 extern int vmemmap_find_next_valid_pfn(int, int);
69#else 69#else
70static inline int vmemmap_find_next_valid_pfn(int node, int i) 70static inline int vmemmap_find_next_valid_pfn(int node, int i)
diff --git a/arch/ia64/include/asm/mman.h b/arch/ia64/include/asm/mman.h
index c73b87832a1e..48cf8b98a0b4 100644
--- a/arch/ia64/include/asm/mman.h
+++ b/arch/ia64/include/asm/mman.h
@@ -8,7 +8,7 @@
8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
9 */ 9 */
10 10
11#include <asm-generic/mman.h> 11#include <asm-generic/mman-common.h>
12 12
13#define MAP_GROWSDOWN 0x00100 /* stack-like segment */ 13#define MAP_GROWSDOWN 0x00100 /* stack-like segment */
14#define MAP_GROWSUP 0x00200 /* register stack-like segment */ 14#define MAP_GROWSUP 0x00200 /* register stack-like segment */
diff --git a/arch/ia64/include/asm/pal.h b/arch/ia64/include/asm/pal.h
index 67b02901ead4..6a292505b396 100644
--- a/arch/ia64/include/asm/pal.h
+++ b/arch/ia64/include/asm/pal.h
@@ -989,8 +989,8 @@ ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr)
989} 989}
990 990
991/* Return summary information about the hierarchy of caches controlled by the processor */ 991/* Return summary information about the hierarchy of caches controlled by the processor */
992static inline s64 992static inline long ia64_pal_cache_summary(unsigned long *cache_levels,
993ia64_pal_cache_summary (u64 *cache_levels, u64 *unique_caches) 993 unsigned long *unique_caches)
994{ 994{
995 struct ia64_pal_retval iprv; 995 struct ia64_pal_retval iprv;
996 PAL_CALL(iprv, PAL_CACHE_SUMMARY, 0, 0, 0); 996 PAL_CALL(iprv, PAL_CACHE_SUMMARY, 0, 0, 0);
@@ -1038,8 +1038,8 @@ ia64_pal_copy_pal (u64 target_addr, u64 alloc_size, u64 processor, u64 *pal_proc
1038} 1038}
1039 1039
1040/* Return the number of instruction and data debug register pairs */ 1040/* Return the number of instruction and data debug register pairs */
1041static inline s64 1041static inline long ia64_pal_debug_info(unsigned long *inst_regs,
1042ia64_pal_debug_info (u64 *inst_regs, u64 *data_regs) 1042 unsigned long *data_regs)
1043{ 1043{
1044 struct ia64_pal_retval iprv; 1044 struct ia64_pal_retval iprv;
1045 PAL_CALL(iprv, PAL_DEBUG_INFO, 0, 0, 0); 1045 PAL_CALL(iprv, PAL_DEBUG_INFO, 0, 0, 0);
@@ -1074,8 +1074,7 @@ ia64_pal_fixed_addr (u64 *global_unique_addr)
1074} 1074}
1075 1075
1076/* Get base frequency of the platform if generated by the processor */ 1076/* Get base frequency of the platform if generated by the processor */
1077static inline s64 1077static inline long ia64_pal_freq_base(unsigned long *platform_base_freq)
1078ia64_pal_freq_base (u64 *platform_base_freq)
1079{ 1078{
1080 struct ia64_pal_retval iprv; 1079 struct ia64_pal_retval iprv;
1081 PAL_CALL(iprv, PAL_FREQ_BASE, 0, 0, 0); 1080 PAL_CALL(iprv, PAL_FREQ_BASE, 0, 0, 0);
@@ -1437,7 +1436,7 @@ ia64_pal_proc_set_features (u64 feature_select)
1437 * possible. 1436 * possible.
1438 */ 1437 */
1439typedef struct ia64_ptce_info_s { 1438typedef struct ia64_ptce_info_s {
1440 u64 base; 1439 unsigned long base;
1441 u32 count[2]; 1440 u32 count[2];
1442 u32 stride[2]; 1441 u32 stride[2];
1443} ia64_ptce_info_t; 1442} ia64_ptce_info_t;
@@ -1478,9 +1477,9 @@ ia64_pal_register_info (u64 info_request, u64 *reg_info_1, u64 *reg_info_2)
1478} 1477}
1479 1478
1480typedef union pal_hints_u { 1479typedef union pal_hints_u {
1481 u64 ph_data; 1480 unsigned long ph_data;
1482 struct { 1481 struct {
1483 u64 si : 1, 1482 unsigned long si : 1,
1484 li : 1, 1483 li : 1,
1485 reserved : 62; 1484 reserved : 62;
1486 } pal_hints_s; 1485 } pal_hints_s;
@@ -1489,8 +1488,8 @@ typedef union pal_hints_u {
1489/* Return information about the register stack and RSE for this processor 1488/* Return information about the register stack and RSE for this processor
1490 * implementation. 1489 * implementation.
1491 */ 1490 */
1492static inline s64 1491static inline long ia64_pal_rse_info(unsigned long *num_phys_stacked,
1493ia64_pal_rse_info (u64 *num_phys_stacked, pal_hints_u_t *hints) 1492 pal_hints_u_t *hints)
1494{ 1493{
1495 struct ia64_pal_retval iprv; 1494 struct ia64_pal_retval iprv;
1496 PAL_CALL(iprv, PAL_RSE_INFO, 0, 0, 0); 1495 PAL_CALL(iprv, PAL_RSE_INFO, 0, 0, 0);
@@ -1608,8 +1607,7 @@ ia64_pal_vm_info (u64 tc_level, u64 tc_type, pal_tc_info_u_t *tc_info, u64 *tc_
1608/* Get page size information about the virtual memory characteristics of the processor 1607/* Get page size information about the virtual memory characteristics of the processor
1609 * implementation. 1608 * implementation.
1610 */ 1609 */
1611static inline s64 1610static inline s64 ia64_pal_vm_page_size(u64 *tr_pages, u64 *vw_pages)
1612ia64_pal_vm_page_size (u64 *tr_pages, u64 *vw_pages)
1613{ 1611{
1614 struct ia64_pal_retval iprv; 1612 struct ia64_pal_retval iprv;
1615 PAL_CALL(iprv, PAL_VM_PAGE_SIZE, 0, 0, 0); 1613 PAL_CALL(iprv, PAL_VM_PAGE_SIZE, 0, 0, 0);
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 1d660d89db0d..fcfca56bb850 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -135,19 +135,6 @@ extern void pcibios_resource_to_bus(struct pci_dev *dev,
135extern void pcibios_bus_to_resource(struct pci_dev *dev, 135extern void pcibios_bus_to_resource(struct pci_dev *dev,
136 struct resource *res, struct pci_bus_region *region); 136 struct resource *res, struct pci_bus_region *region);
137 137
138static inline struct resource *
139pcibios_select_root(struct pci_dev *pdev, struct resource *res)
140{
141 struct resource *root = NULL;
142
143 if (res->flags & IORESOURCE_IO)
144 root = &ioport_resource;
145 if (res->flags & IORESOURCE_MEM)
146 root = &iomem_resource;
147
148 return root;
149}
150
151#define pcibios_scan_all_fns(a, b) 0 138#define pcibios_scan_all_fns(a, b) 0
152 139
153#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 140#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
index 7a9bff47564f..0a9cc73d35c7 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -146,6 +146,8 @@
146#define PAGE_GATE __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_X_RX) 146#define PAGE_GATE __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_X_RX)
147#define PAGE_KERNEL __pgprot(__DIRTY_BITS | _PAGE_PL_0 | _PAGE_AR_RWX) 147#define PAGE_KERNEL __pgprot(__DIRTY_BITS | _PAGE_PL_0 | _PAGE_AR_RWX)
148#define PAGE_KERNELRX __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_RX) 148#define PAGE_KERNELRX __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_RX)
149#define PAGE_KERNEL_UC __pgprot(__DIRTY_BITS | _PAGE_PL_0 | _PAGE_AR_RWX | \
150 _PAGE_MA_UC)
149 151
150# ifndef __ASSEMBLY__ 152# ifndef __ASSEMBLY__
151 153
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index f88fa054d01d..3eaeedf1aef2 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -187,40 +187,40 @@ union ia64_rr {
187 * state comes earlier: 187 * state comes earlier:
188 */ 188 */
189struct cpuinfo_ia64 { 189struct cpuinfo_ia64 {
190 __u32 softirq_pending; 190 unsigned int softirq_pending;
191 __u64 itm_delta; /* # of clock cycles between clock ticks */ 191 unsigned long itm_delta; /* # of clock cycles between clock ticks */
192 __u64 itm_next; /* interval timer mask value to use for next clock tick */ 192 unsigned long itm_next; /* interval timer mask value to use for next clock tick */
193 __u64 nsec_per_cyc; /* (1000000000<<IA64_NSEC_PER_CYC_SHIFT)/itc_freq */ 193 unsigned long nsec_per_cyc; /* (1000000000<<IA64_NSEC_PER_CYC_SHIFT)/itc_freq */
194 __u64 unimpl_va_mask; /* mask of unimplemented virtual address bits (from PAL) */ 194 unsigned long unimpl_va_mask; /* mask of unimplemented virtual address bits (from PAL) */
195 __u64 unimpl_pa_mask; /* mask of unimplemented physical address bits (from PAL) */ 195 unsigned long unimpl_pa_mask; /* mask of unimplemented physical address bits (from PAL) */
196 __u64 itc_freq; /* frequency of ITC counter */ 196 unsigned long itc_freq; /* frequency of ITC counter */
197 __u64 proc_freq; /* frequency of processor */ 197 unsigned long proc_freq; /* frequency of processor */
198 __u64 cyc_per_usec; /* itc_freq/1000000 */ 198 unsigned long cyc_per_usec; /* itc_freq/1000000 */
199 __u64 ptce_base; 199 unsigned long ptce_base;
200 __u32 ptce_count[2]; 200 unsigned int ptce_count[2];
201 __u32 ptce_stride[2]; 201 unsigned int ptce_stride[2];
202 struct task_struct *ksoftirqd; /* kernel softirq daemon for this CPU */ 202 struct task_struct *ksoftirqd; /* kernel softirq daemon for this CPU */
203 203
204#ifdef CONFIG_SMP 204#ifdef CONFIG_SMP
205 __u64 loops_per_jiffy; 205 unsigned long loops_per_jiffy;
206 int cpu; 206 int cpu;
207 __u32 socket_id; /* physical processor socket id */ 207 unsigned int socket_id; /* physical processor socket id */
208 __u16 core_id; /* core id */ 208 unsigned short core_id; /* core id */
209 __u16 thread_id; /* thread id */ 209 unsigned short thread_id; /* thread id */
210 __u16 num_log; /* Total number of logical processors on 210 unsigned short num_log; /* Total number of logical processors on
211 * this socket that were successfully booted */ 211 * this socket that were successfully booted */
212 __u8 cores_per_socket; /* Cores per processor socket */ 212 unsigned char cores_per_socket; /* Cores per processor socket */
213 __u8 threads_per_core; /* Threads per core */ 213 unsigned char threads_per_core; /* Threads per core */
214#endif 214#endif
215 215
216 /* CPUID-derived information: */ 216 /* CPUID-derived information: */
217 __u64 ppn; 217 unsigned long ppn;
218 __u64 features; 218 unsigned long features;
219 __u8 number; 219 unsigned char number;
220 __u8 revision; 220 unsigned char revision;
221 __u8 model; 221 unsigned char model;
222 __u8 family; 222 unsigned char family;
223 __u8 archrev; 223 unsigned char archrev;
224 char vendor[16]; 224 char vendor[16];
225 char *model_name; 225 char *model_name;
226 226
@@ -329,8 +329,8 @@ struct thread_struct {
329#else 329#else
330# define INIT_THREAD_PM 330# define INIT_THREAD_PM
331#endif 331#endif
332 __u64 dbr[IA64_NUM_DBG_REGS]; 332 unsigned long dbr[IA64_NUM_DBG_REGS];
333 __u64 ibr[IA64_NUM_DBG_REGS]; 333 unsigned long ibr[IA64_NUM_DBG_REGS];
334 struct ia64_fpreg fph[96]; /* saved/loaded on demand */ 334 struct ia64_fpreg fph[96]; /* saved/loaded on demand */
335}; 335};
336 336
diff --git a/arch/ia64/include/asm/sal.h b/arch/ia64/include/asm/sal.h
index 966797a97c94..d19ddba4e327 100644
--- a/arch/ia64/include/asm/sal.h
+++ b/arch/ia64/include/asm/sal.h
@@ -106,10 +106,10 @@ struct ia64_sal_retval {
106 * informational value should be printed (e.g., "reboot for 106 * informational value should be printed (e.g., "reboot for
107 * change to take effect"). 107 * change to take effect").
108 */ 108 */
109 s64 status; 109 long status;
110 u64 v0; 110 unsigned long v0;
111 u64 v1; 111 unsigned long v1;
112 u64 v2; 112 unsigned long v2;
113}; 113};
114 114
115typedef struct ia64_sal_retval (*ia64_sal_handler) (u64, ...); 115typedef struct ia64_sal_retval (*ia64_sal_handler) (u64, ...);
diff --git a/arch/ia64/include/asm/signal.h b/arch/ia64/include/asm/signal.h
index 4f5ca5643cb1..b166248d49a4 100644
--- a/arch/ia64/include/asm/signal.h
+++ b/arch/ia64/include/asm/signal.h
@@ -114,7 +114,7 @@
114 114
115#endif /* __KERNEL__ */ 115#endif /* __KERNEL__ */
116 116
117#include <asm-generic/signal.h> 117#include <asm-generic/signal-defs.h>
118 118
119# ifndef __ASSEMBLY__ 119# ifndef __ASSEMBLY__
120 120
diff --git a/arch/ia64/include/asm/sn/sn_sal.h b/arch/ia64/include/asm/sn/sn_sal.h
index e310fc0135dc..1f5ff470a5a1 100644
--- a/arch/ia64/include/asm/sn/sn_sal.h
+++ b/arch/ia64/include/asm/sn/sn_sal.h
@@ -929,7 +929,7 @@ ia64_sn_sysctl_tio_clock_reset(nasid_t nasid)
929/* 929/*
930 * Get the associated ioboard type for a given nasid. 930 * Get the associated ioboard type for a given nasid.
931 */ 931 */
932static inline s64 932static inline long
933ia64_sn_sysctl_ioboard_get(nasid_t nasid, u16 *ioboard) 933ia64_sn_sysctl_ioboard_get(nasid_t nasid, u16 *ioboard)
934{ 934{
935 struct ia64_sal_retval isrv; 935 struct ia64_sal_retval isrv;
diff --git a/arch/ia64/include/asm/suspend.h b/arch/ia64/include/asm/suspend.h
deleted file mode 100644
index b05bbb6074e2..000000000000
--- a/arch/ia64/include/asm/suspend.h
+++ /dev/null
@@ -1 +0,0 @@
1/* dummy (must be non-empty to prevent prejudicial removal...) */
diff --git a/arch/ia64/include/asm/types.h b/arch/ia64/include/asm/types.h
index e36b3716e718..bcd260e597de 100644
--- a/arch/ia64/include/asm/types.h
+++ b/arch/ia64/include/asm/types.h
@@ -2,10 +2,11 @@
2#define _ASM_IA64_TYPES_H 2#define _ASM_IA64_TYPES_H
3 3
4/* 4/*
5 * This file is never included by application software unless explicitly requested (e.g., 5 * This file is never included by application software unless explicitly
6 * via linux/types.h) in which case the application is Linux specific so (user-) name 6 * requested (e.g., via linux/types.h) in which case the application is
7 * space pollution is not a major issue. However, for interoperability, libraries still 7 * Linux specific so (user-) name space pollution is not a major issue.
8 * need to be careful to avoid a name clashes. 8 * However, for interoperability, libraries still need to be careful to
9 * avoid naming clashes.
9 * 10 *
10 * Based on <asm-alpha/types.h>. 11 * Based on <asm-alpha/types.h>.
11 * 12 *
@@ -13,16 +14,16 @@
13 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 14 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
14 */ 15 */
15 16
17#ifdef __KERNEL__
18#include <asm-generic/int-ll64.h>
19#else
16#include <asm-generic/int-l64.h> 20#include <asm-generic/int-l64.h>
21#endif
17 22
18#ifdef __ASSEMBLY__ 23#ifdef __ASSEMBLY__
19# define __IA64_UL(x) (x) 24# define __IA64_UL(x) (x)
20# define __IA64_UL_CONST(x) x 25# define __IA64_UL_CONST(x) x
21 26
22# ifdef __KERNEL__
23# define BITS_PER_LONG 64
24# endif
25
26#else 27#else
27# define __IA64_UL(x) ((unsigned long)(x)) 28# define __IA64_UL(x) ((unsigned long)(x))
28# define __IA64_UL_CONST(x) x##UL 29# define __IA64_UL_CONST(x) x##UL
@@ -34,10 +35,7 @@ typedef unsigned int umode_t;
34 */ 35 */
35# ifdef __KERNEL__ 36# ifdef __KERNEL__
36 37
37#define BITS_PER_LONG 64
38
39/* DMA addresses are 64-bits wide, in general. */ 38/* DMA addresses are 64-bits wide, in general. */
40
41typedef u64 dma_addr_t; 39typedef u64 dma_addr_t;
42 40
43# endif /* __KERNEL__ */ 41# endif /* __KERNEL__ */
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 10a9eb05f74d..5a5347f5c4e4 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -310,11 +310,12 @@
310#define __NR_inotify_init1 1318 310#define __NR_inotify_init1 1318
311#define __NR_preadv 1319 311#define __NR_preadv 1319
312#define __NR_pwritev 1320 312#define __NR_pwritev 1320
313#define __NR_rt_tgsigqueueinfo 1321
313 314
314#ifdef __KERNEL__ 315#ifdef __KERNEL__
315 316
316 317
317#define NR_syscalls 297 /* length of syscall table */ 318#define NR_syscalls 298 /* length of syscall table */
318 319
319/* 320/*
320 * The following defines stop scripts/checksyscalls.sh from complaining about 321 * The following defines stop scripts/checksyscalls.sh from complaining about
@@ -328,6 +329,7 @@
328#define __IGNORE_utime /* utimes() */ 329#define __IGNORE_utime /* utimes() */
329#define __IGNORE_getpgrp /* getpgid() */ 330#define __IGNORE_getpgrp /* getpgid() */
330#define __IGNORE_vfork /* clone() */ 331#define __IGNORE_vfork /* clone() */
332#define __IGNORE_umount2 /* umount() */
331 333
332#define __ARCH_WANT_SYS_RT_SIGACTION 334#define __ARCH_WANT_SYS_RT_SIGACTION
333#define __ARCH_WANT_SYS_RT_SIGSUSPEND 335#define __ARCH_WANT_SYS_RT_SIGSUSPEND
diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c
index cbe6cee5a550..dbda7bde6112 100644
--- a/arch/ia64/kernel/acpi-processor.c
+++ b/arch/ia64/kernel/acpi-processor.c
@@ -71,3 +71,15 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
71} 71}
72 72
73EXPORT_SYMBOL(arch_acpi_processor_init_pdc); 73EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
74
75void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
76{
77 if (pr->pdc) {
78 kfree(pr->pdc->pointer->buffer.pointer);
79 kfree(pr->pdc->pointer);
80 kfree(pr->pdc);
81 pr->pdc = NULL;
82 }
83}
84
85EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 5510317db37b..baec6f00f7f3 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -636,7 +636,7 @@ void __init acpi_numa_arch_fixup(void)
636 * success: return IRQ number (>=0) 636 * success: return IRQ number (>=0)
637 * failure: return < 0 637 * failure: return < 0
638 */ 638 */
639int acpi_register_gsi(u32 gsi, int triggering, int polarity) 639int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
640{ 640{
641 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM) 641 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
642 return gsi; 642 return gsi;
@@ -678,7 +678,8 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
678 678
679 fadt = (struct acpi_table_fadt *)fadt_header; 679 fadt = (struct acpi_table_fadt *)fadt_header;
680 680
681 acpi_register_gsi(fadt->sci_interrupt, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); 681 acpi_register_gsi(NULL, fadt->sci_interrupt, ACPI_LEVEL_SENSITIVE,
682 ACPI_ACTIVE_LOW);
682 return 0; 683 return 0;
683} 684}
684 685
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 7ef80e8161ce..c745d0aeb6e0 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -46,7 +46,7 @@ extern efi_status_t efi_call_phys (void *, ...);
46struct efi efi; 46struct efi efi;
47EXPORT_SYMBOL(efi); 47EXPORT_SYMBOL(efi);
48static efi_runtime_services_t *runtime; 48static efi_runtime_services_t *runtime;
49static unsigned long mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL; 49static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;
50 50
51#define efi_call_virt(f, args...) (*(f))(args) 51#define efi_call_virt(f, args...) (*(f))(args)
52 52
@@ -356,7 +356,7 @@ efi_get_pal_addr (void)
356 356
357 if (++pal_code_count > 1) { 357 if (++pal_code_count > 1) {
358 printk(KERN_ERR "Too many EFI Pal Code memory ranges, " 358 printk(KERN_ERR "Too many EFI Pal Code memory ranges, "
359 "dropped @ %lx\n", md->phys_addr); 359 "dropped @ %llx\n", md->phys_addr);
360 continue; 360 continue;
361 } 361 }
362 /* 362 /*
@@ -490,10 +490,10 @@ efi_init (void)
490 } 490 }
491 } 491 }
492 if (min_addr != 0UL) 492 if (min_addr != 0UL)
493 printk(KERN_INFO "Ignoring memory below %luMB\n", 493 printk(KERN_INFO "Ignoring memory below %lluMB\n",
494 min_addr >> 20); 494 min_addr >> 20);
495 if (max_addr != ~0UL) 495 if (max_addr != ~0UL)
496 printk(KERN_INFO "Ignoring memory above %luMB\n", 496 printk(KERN_INFO "Ignoring memory above %lluMB\n",
497 max_addr >> 20); 497 max_addr >> 20);
498 498
499 efi.systab = __va(ia64_boot_param->efi_systab); 499 efi.systab = __va(ia64_boot_param->efi_systab);
@@ -1066,7 +1066,7 @@ find_memmap_space (void)
1066 * parts exist, and are WB. 1066 * parts exist, and are WB.
1067 */ 1067 */
1068unsigned long 1068unsigned long
1069efi_memmap_init(unsigned long *s, unsigned long *e) 1069efi_memmap_init(u64 *s, u64 *e)
1070{ 1070{
1071 struct kern_memdesc *k, *prev = NULL; 1071 struct kern_memdesc *k, *prev = NULL;
1072 u64 contig_low=0, contig_high=0; 1072 u64 contig_low=0, contig_high=0;
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 7bebac0e1d44..d0e7d37017b4 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1805,6 +1805,7 @@ sys_call_table:
1805 data8 sys_inotify_init1 1805 data8 sys_inotify_init1
1806 data8 sys_preadv 1806 data8 sys_preadv
1807 data8 sys_pwritev // 1320 1807 data8 sys_pwritev // 1320
1808 data8 sys_rt_tgsigqueueinfo
1808 1809
1809 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1810 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1810#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1811#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/ia64/kernel/init_task.c b/arch/ia64/kernel/init_task.c
index 5b0e830c6f33..c475fc281be7 100644
--- a/arch/ia64/kernel/init_task.c
+++ b/arch/ia64/kernel/init_task.c
@@ -19,10 +19,6 @@
19 19
20static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 20static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
22struct mm_struct init_mm = INIT_MM(init_mm);
23
24EXPORT_SYMBOL(init_mm);
25
26/* 22/*
27 * Initial task structure. 23 * Initial task structure.
28 * 24 *
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 166e0d839fa0..c48b03f2b61d 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -329,7 +329,7 @@ unmask_irq (unsigned int irq)
329} 329}
330 330
331 331
332static void 332static int
333iosapic_set_affinity(unsigned int irq, const struct cpumask *mask) 333iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)
334{ 334{
335#ifdef CONFIG_SMP 335#ifdef CONFIG_SMP
@@ -343,15 +343,15 @@ iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)
343 343
344 cpu = cpumask_first_and(cpu_online_mask, mask); 344 cpu = cpumask_first_and(cpu_online_mask, mask);
345 if (cpu >= nr_cpu_ids) 345 if (cpu >= nr_cpu_ids)
346 return; 346 return -1;
347 347
348 if (irq_prepare_move(irq, cpu)) 348 if (irq_prepare_move(irq, cpu))
349 return; 349 return -1;
350 350
351 dest = cpu_physical_id(cpu); 351 dest = cpu_physical_id(cpu);
352 352
353 if (!iosapic_intr_info[irq].count) 353 if (!iosapic_intr_info[irq].count)
354 return; /* not an IOSAPIC interrupt */ 354 return -1; /* not an IOSAPIC interrupt */
355 355
356 set_irq_affinity_info(irq, dest, redir); 356 set_irq_affinity_info(irq, dest, redir);
357 357
@@ -376,7 +376,9 @@ iosapic_set_affinity(unsigned int irq, const struct cpumask *mask)
376 iosapic_write(iosapic, IOSAPIC_RTE_HIGH(rte_index), high32); 376 iosapic_write(iosapic, IOSAPIC_RTE_HIGH(rte_index), high32);
377 iosapic_write(iosapic, IOSAPIC_RTE_LOW(rte_index), low32); 377 iosapic_write(iosapic, IOSAPIC_RTE_LOW(rte_index), low32);
378 } 378 }
379
379#endif 380#endif
381 return 0;
380} 382}
381 383
382/* 384/*
@@ -449,7 +451,7 @@ iosapic_startup_edge_irq (unsigned int irq)
449static void 451static void
450iosapic_ack_edge_irq (unsigned int irq) 452iosapic_ack_edge_irq (unsigned int irq)
451{ 453{
452 irq_desc_t *idesc = irq_desc + irq; 454 struct irq_desc *idesc = irq_desc + irq;
453 455
454 irq_complete_move(irq); 456 irq_complete_move(irq);
455 move_native_irq(irq); 457 move_native_irq(irq);
@@ -598,8 +600,8 @@ static int
598register_intr (unsigned int gsi, int irq, unsigned char delivery, 600register_intr (unsigned int gsi, int irq, unsigned char delivery,
599 unsigned long polarity, unsigned long trigger) 601 unsigned long polarity, unsigned long trigger)
600{ 602{
601 irq_desc_t *idesc; 603 struct irq_desc *idesc;
602 struct hw_interrupt_type *irq_type; 604 struct irq_chip *irq_type;
603 int index; 605 int index;
604 struct iosapic_rte_info *rte; 606 struct iosapic_rte_info *rte;
605 607
@@ -648,7 +650,7 @@ register_intr (unsigned int gsi, int irq, unsigned char delivery,
648 650
649 idesc = irq_desc + irq; 651 idesc = irq_desc + irq;
650 if (irq_type != NULL && idesc->chip != irq_type) { 652 if (irq_type != NULL && idesc->chip != irq_type) {
651 if (idesc->chip != &no_irq_type) 653 if (idesc->chip != &no_irq_chip)
652 printk(KERN_WARNING 654 printk(KERN_WARNING
653 "%s: changing vector %d from %s to %s\n", 655 "%s: changing vector %d from %s to %s\n",
654 __func__, irq_to_vector(irq), 656 __func__, irq_to_vector(irq),
@@ -826,7 +828,7 @@ iosapic_unregister_intr (unsigned int gsi)
826{ 828{
827 unsigned long flags; 829 unsigned long flags;
828 int irq, index; 830 int irq, index;
829 irq_desc_t *idesc; 831 struct irq_desc *idesc;
830 u32 low32; 832 u32 low32;
831 unsigned long trigger, polarity; 833 unsigned long trigger, polarity;
832 unsigned int dest; 834 unsigned int dest;
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 7429752ef5ad..7d8951229e7c 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -130,7 +130,7 @@ unsigned int vectors_in_migration[NR_IRQS];
130 */ 130 */
131static void migrate_irqs(void) 131static void migrate_irqs(void)
132{ 132{
133 irq_desc_t *desc; 133 struct irq_desc *desc;
134 int irq, new_cpu; 134 int irq, new_cpu;
135 135
136 for (irq=0; irq < NR_IRQS; irq++) { 136 for (irq=0; irq < NR_IRQS; irq++) {
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index acc4d19ae62a..dd9d7b54f1a1 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -610,6 +610,9 @@ static struct irqaction ipi_irqaction = {
610 .name = "IPI" 610 .name = "IPI"
611}; 611};
612 612
613/*
614 * KVM uses this interrupt to force a cpu out of guest mode
615 */
613static struct irqaction resched_irqaction = { 616static struct irqaction resched_irqaction = {
614 .handler = dummy_handler, 617 .handler = dummy_handler,
615 .flags = IRQF_DISABLED, 618 .flags = IRQF_DISABLED,
@@ -627,7 +630,7 @@ static struct irqaction tlb_irqaction = {
627void 630void
628ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action) 631ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action)
629{ 632{
630 irq_desc_t *desc; 633 struct irq_desc *desc;
631 unsigned int irq; 634 unsigned int irq;
632 635
633 irq = vec; 636 irq = vec;
diff --git a/arch/ia64/kernel/irq_lsapic.c b/arch/ia64/kernel/irq_lsapic.c
index e56a7a36aca3..fc1549d4564d 100644
--- a/arch/ia64/kernel/irq_lsapic.c
+++ b/arch/ia64/kernel/irq_lsapic.c
@@ -33,7 +33,7 @@ static int lsapic_retrigger(unsigned int irq)
33 return 1; 33 return 1;
34} 34}
35 35
36struct hw_interrupt_type irq_type_ia64_lsapic = { 36struct irq_chip irq_type_ia64_lsapic = {
37 .name = "LSAPIC", 37 .name = "LSAPIC",
38 .startup = lsapic_noop_startup, 38 .startup = lsapic_noop_startup,
39 .shutdown = lsapic_noop, 39 .shutdown = lsapic_noop,
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 8f33a8840422..7b30d21c5190 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -850,7 +850,7 @@ EXPORT_SYMBOL(ia64_unreg_MCA_extension);
850 850
851 851
852static inline void 852static inline void
853copy_reg(const u64 *fr, u64 fnat, u64 *tr, u64 *tnat) 853copy_reg(const u64 *fr, u64 fnat, unsigned long *tr, unsigned long *tnat)
854{ 854{
855 u64 fslot, tslot, nat; 855 u64 fslot, tslot, nat;
856 *tr = *fr; 856 *tr = *fr;
@@ -914,9 +914,9 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
914 struct switch_stack *old_sw; 914 struct switch_stack *old_sw;
915 unsigned size = sizeof(struct pt_regs) + 915 unsigned size = sizeof(struct pt_regs) +
916 sizeof(struct switch_stack) + 16; 916 sizeof(struct switch_stack) + 16;
917 u64 *old_bspstore, *old_bsp; 917 unsigned long *old_bspstore, *old_bsp;
918 u64 *new_bspstore, *new_bsp; 918 unsigned long *new_bspstore, *new_bsp;
919 u64 old_unat, old_rnat, new_rnat, nat; 919 unsigned long old_unat, old_rnat, new_rnat, nat;
920 u64 slots, loadrs = regs->loadrs; 920 u64 slots, loadrs = regs->loadrs;
921 u64 r12 = ms->pmsa_gr[12-1], r13 = ms->pmsa_gr[13-1]; 921 u64 r12 = ms->pmsa_gr[12-1], r13 = ms->pmsa_gr[13-1];
922 u64 ar_bspstore = regs->ar_bspstore; 922 u64 ar_bspstore = regs->ar_bspstore;
@@ -968,10 +968,10 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
968 * loadrs for the new stack and save it in the new pt_regs, where 968 * loadrs for the new stack and save it in the new pt_regs, where
969 * ia64_old_stack() can get it. 969 * ia64_old_stack() can get it.
970 */ 970 */
971 old_bspstore = (u64 *)ar_bspstore; 971 old_bspstore = (unsigned long *)ar_bspstore;
972 old_bsp = (u64 *)ar_bsp; 972 old_bsp = (unsigned long *)ar_bsp;
973 slots = ia64_rse_num_regs(old_bspstore, old_bsp); 973 slots = ia64_rse_num_regs(old_bspstore, old_bsp);
974 new_bspstore = (u64 *)((u64)current + IA64_RBS_OFFSET); 974 new_bspstore = (unsigned long *)((u64)current + IA64_RBS_OFFSET);
975 new_bsp = ia64_rse_skip_regs(new_bspstore, slots); 975 new_bsp = ia64_rse_skip_regs(new_bspstore, slots);
976 regs->loadrs = (new_bsp - new_bspstore) * 8 << 16; 976 regs->loadrs = (new_bsp - new_bspstore) * 8 << 16;
977 977
@@ -1829,8 +1829,7 @@ ia64_mca_cpu_init(void *cpu_data)
1829 data = mca_bootmem(); 1829 data = mca_bootmem();
1830 first_time = 0; 1830 first_time = 0;
1831 } else 1831 } else
1832 data = page_address(alloc_pages_node(numa_node_id(), 1832 data = __get_free_pages(GFP_KERNEL, get_order(sz));
1833 GFP_KERNEL, get_order(sz)));
1834 if (!data) 1833 if (!data)
1835 panic("Could not allocate MCA memory for cpu %d\n", 1834 panic("Could not allocate MCA memory for cpu %d\n",
1836 cpu); 1835 cpu);
@@ -1918,9 +1917,9 @@ ia64_mca_init(void)
1918 ia64_fptr_t *init_hldlr_ptr_slave = (ia64_fptr_t *)ia64_os_init_dispatch_slave; 1917 ia64_fptr_t *init_hldlr_ptr_slave = (ia64_fptr_t *)ia64_os_init_dispatch_slave;
1919 ia64_fptr_t *mca_hldlr_ptr = (ia64_fptr_t *)ia64_os_mca_dispatch; 1918 ia64_fptr_t *mca_hldlr_ptr = (ia64_fptr_t *)ia64_os_mca_dispatch;
1920 int i; 1919 int i;
1921 s64 rc; 1920 long rc;
1922 struct ia64_sal_retval isrv; 1921 struct ia64_sal_retval isrv;
1923 u64 timeout = IA64_MCA_RENDEZ_TIMEOUT; /* platform specific */ 1922 unsigned long timeout = IA64_MCA_RENDEZ_TIMEOUT; /* platform specific */
1924 static struct notifier_block default_init_monarch_nb = { 1923 static struct notifier_block default_init_monarch_nb = {
1925 .notifier_call = default_monarch_init_process, 1924 .notifier_call = default_monarch_init_process,
1926 .priority = 0/* we need to notified last */ 1925 .priority = 0/* we need to notified last */
@@ -2093,7 +2092,7 @@ ia64_mca_late_init(void)
2093 cpe_poll_timer.function = ia64_mca_cpe_poll; 2092 cpe_poll_timer.function = ia64_mca_cpe_poll;
2094 2093
2095 { 2094 {
2096 irq_desc_t *desc; 2095 struct irq_desc *desc;
2097 unsigned int irq; 2096 unsigned int irq;
2098 2097
2099 if (cpe_vector >= 0) { 2098 if (cpe_vector >= 0) {
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index da3b0cf495a3..1481b0a28ca0 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -171,7 +171,8 @@ apply_imm60 (struct module *mod, struct insn *insn, uint64_t val)
171 return 0; 171 return 0;
172 } 172 }
173 if (val + ((uint64_t) 1 << 59) >= (1UL << 60)) { 173 if (val + ((uint64_t) 1 << 59) >= (1UL << 60)) {
174 printk(KERN_ERR "%s: value %ld out of IMM60 range\n", mod->name, (int64_t) val); 174 printk(KERN_ERR "%s: value %ld out of IMM60 range\n",
175 mod->name, (long) val);
175 return 0; 176 return 0;
176 } 177 }
177 ia64_patch_imm60((u64) insn, val); 178 ia64_patch_imm60((u64) insn, val);
@@ -182,7 +183,8 @@ static int
182apply_imm22 (struct module *mod, struct insn *insn, uint64_t val) 183apply_imm22 (struct module *mod, struct insn *insn, uint64_t val)
183{ 184{
184 if (val + (1 << 21) >= (1 << 22)) { 185 if (val + (1 << 21) >= (1 << 22)) {
185 printk(KERN_ERR "%s: value %li out of IMM22 range\n", mod->name, (int64_t)val); 186 printk(KERN_ERR "%s: value %li out of IMM22 range\n",
187 mod->name, (long)val);
186 return 0; 188 return 0;
187 } 189 }
188 ia64_patch((u64) insn, 0x01fffcfe000UL, ( ((val & 0x200000UL) << 15) /* bit 21 -> 36 */ 190 ia64_patch((u64) insn, 0x01fffcfe000UL, ( ((val & 0x200000UL) << 15) /* bit 21 -> 36 */
@@ -196,7 +198,8 @@ static int
196apply_imm21b (struct module *mod, struct insn *insn, uint64_t val) 198apply_imm21b (struct module *mod, struct insn *insn, uint64_t val)
197{ 199{
198 if (val + (1 << 20) >= (1 << 21)) { 200 if (val + (1 << 20) >= (1 << 21)) {
199 printk(KERN_ERR "%s: value %li out of IMM21b range\n", mod->name, (int64_t)val); 201 printk(KERN_ERR "%s: value %li out of IMM21b range\n",
202 mod->name, (long)val);
200 return 0; 203 return 0;
201 } 204 }
202 ia64_patch((u64) insn, 0x11ffffe000UL, ( ((val & 0x100000UL) << 16) /* bit 20 -> 36 */ 205 ia64_patch((u64) insn, 0x11ffffe000UL, ( ((val & 0x100000UL) << 16) /* bit 20 -> 36 */
@@ -701,8 +704,9 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,
701 case RV_PCREL2: 704 case RV_PCREL2:
702 if (r_type == R_IA64_PCREL21BI) { 705 if (r_type == R_IA64_PCREL21BI) {
703 if (!is_internal(mod, val)) { 706 if (!is_internal(mod, val)) {
704 printk(KERN_ERR "%s: %s reloc against non-local symbol (%lx)\n", 707 printk(KERN_ERR "%s: %s reloc against "
705 __func__, reloc_name[r_type], val); 708 "non-local symbol (%lx)\n", __func__,
709 reloc_name[r_type], (unsigned long)val);
706 return -ENOEXEC; 710 return -ENOEXEC;
707 } 711 }
708 format = RF_INSN21B; 712 format = RF_INSN21B;
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 2b15e233f7fe..6c8922856049 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -12,7 +12,7 @@
12static struct irq_chip ia64_msi_chip; 12static struct irq_chip ia64_msi_chip;
13 13
14#ifdef CONFIG_SMP 14#ifdef CONFIG_SMP
15static void ia64_set_msi_irq_affinity(unsigned int irq, 15static int ia64_set_msi_irq_affinity(unsigned int irq,
16 const cpumask_t *cpu_mask) 16 const cpumask_t *cpu_mask)
17{ 17{
18 struct msi_msg msg; 18 struct msi_msg msg;
@@ -20,10 +20,10 @@ static void ia64_set_msi_irq_affinity(unsigned int irq,
20 int cpu = first_cpu(*cpu_mask); 20 int cpu = first_cpu(*cpu_mask);
21 21
22 if (!cpu_online(cpu)) 22 if (!cpu_online(cpu))
23 return; 23 return -1;
24 24
25 if (irq_prepare_move(irq, cpu)) 25 if (irq_prepare_move(irq, cpu))
26 return; 26 return -1;
27 27
28 read_msi_msg(irq, &msg); 28 read_msi_msg(irq, &msg);
29 29
@@ -39,6 +39,8 @@ static void ia64_set_msi_irq_affinity(unsigned int irq,
39 39
40 write_msi_msg(irq, &msg); 40 write_msi_msg(irq, &msg);
41 cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu)); 41 cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu));
42
43 return 0;
42} 44}
43#endif /* CONFIG_SMP */ 45#endif /* CONFIG_SMP */
44 46
@@ -130,17 +132,17 @@ void arch_teardown_msi_irq(unsigned int irq)
130 132
131#ifdef CONFIG_DMAR 133#ifdef CONFIG_DMAR
132#ifdef CONFIG_SMP 134#ifdef CONFIG_SMP
133static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) 135static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
134{ 136{
135 struct irq_cfg *cfg = irq_cfg + irq; 137 struct irq_cfg *cfg = irq_cfg + irq;
136 struct msi_msg msg; 138 struct msi_msg msg;
137 int cpu = cpumask_first(mask); 139 int cpu = cpumask_first(mask);
138 140
139 if (!cpu_online(cpu)) 141 if (!cpu_online(cpu))
140 return; 142 return -1;
141 143
142 if (irq_prepare_move(irq, cpu)) 144 if (irq_prepare_move(irq, cpu))
143 return; 145 return -1;
144 146
145 dmar_msi_read(irq, &msg); 147 dmar_msi_read(irq, &msg);
146 148
@@ -151,10 +153,12 @@ static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
151 153
152 dmar_msi_write(irq, &msg); 154 dmar_msi_write(irq, &msg);
153 cpumask_copy(irq_desc[irq].affinity, mask); 155 cpumask_copy(irq_desc[irq].affinity, mask);
156
157 return 0;
154} 158}
155#endif /* CONFIG_SMP */ 159#endif /* CONFIG_SMP */
156 160
157struct irq_chip dmar_msi_type = { 161static struct irq_chip dmar_msi_type = {
158 .name = "DMAR_MSI", 162 .name = "DMAR_MSI",
159 .unmask = dmar_msi_unmask, 163 .unmask = dmar_msi_unmask,
160 .mask = dmar_msi_mask, 164 .mask = dmar_msi_mask,
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index a4f19c70aadd..fdf6f9d013e5 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -218,10 +218,10 @@ static int
218cache_info(char *page) 218cache_info(char *page)
219{ 219{
220 char *p = page; 220 char *p = page;
221 u64 i, levels, unique_caches; 221 unsigned long i, levels, unique_caches;
222 pal_cache_config_info_t cci; 222 pal_cache_config_info_t cci;
223 int j, k; 223 int j, k;
224 s64 status; 224 long status;
225 225
226 if ((status = ia64_pal_cache_summary(&levels, &unique_caches)) != 0) { 226 if ((status = ia64_pal_cache_summary(&levels, &unique_caches)) != 0) {
227 printk(KERN_ERR "ia64_pal_cache_summary=%ld\n", status); 227 printk(KERN_ERR "ia64_pal_cache_summary=%ld\n", status);
@@ -303,7 +303,7 @@ vm_info(char *page)
303 ia64_ptce_info_t ptce; 303 ia64_ptce_info_t ptce;
304 const char *sep; 304 const char *sep;
305 int i, j; 305 int i, j;
306 s64 status; 306 long status;
307 307
308 if ((status = ia64_pal_vm_summary(&vm_info_1, &vm_info_2)) !=0) { 308 if ((status = ia64_pal_vm_summary(&vm_info_1, &vm_info_2)) !=0) {
309 printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status); 309 printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status);
@@ -431,9 +431,9 @@ register_info(char *page)
431 char *p = page; 431 char *p = page;
432 u64 reg_info[2]; 432 u64 reg_info[2];
433 u64 info; 433 u64 info;
434 u64 phys_stacked; 434 unsigned long phys_stacked;
435 pal_hints_u_t hints; 435 pal_hints_u_t hints;
436 u64 iregs, dregs; 436 unsigned long iregs, dregs;
437 char *info_type[]={ 437 char *info_type[]={
438 "Implemented AR(s)", 438 "Implemented AR(s)",
439 "AR(s) with read side-effects", 439 "AR(s) with read side-effects",
@@ -530,8 +530,8 @@ static char **proc_features[]={
530 NULL, NULL, NULL, NULL, 530 NULL, NULL, NULL, NULL,
531}; 531};
532 532
533static char * 533static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,
534feature_set_info(char *page, u64 avail, u64 status, u64 control, u64 set) 534 unsigned long set)
535{ 535{
536 char *p = page; 536 char *p = page;
537 char **vf, **v; 537 char **vf, **v;
@@ -714,7 +714,7 @@ frequency_info(char *page)
714{ 714{
715 char *p = page; 715 char *p = page;
716 struct pal_freq_ratio proc, itc, bus; 716 struct pal_freq_ratio proc, itc, bus;
717 u64 base; 717 unsigned long base;
718 718
719 if (ia64_pal_freq_base(&base) == -1) 719 if (ia64_pal_freq_base(&base) == -1)
720 p += sprintf(p, "Output clock : not implemented\n"); 720 p += sprintf(p, "Output clock : not implemented\n");
@@ -736,43 +736,43 @@ static int
736tr_info(char *page) 736tr_info(char *page)
737{ 737{
738 char *p = page; 738 char *p = page;
739 s64 status; 739 long status;
740 pal_tr_valid_u_t tr_valid; 740 pal_tr_valid_u_t tr_valid;
741 u64 tr_buffer[4]; 741 u64 tr_buffer[4];
742 pal_vm_info_1_u_t vm_info_1; 742 pal_vm_info_1_u_t vm_info_1;
743 pal_vm_info_2_u_t vm_info_2; 743 pal_vm_info_2_u_t vm_info_2;
744 u64 i, j; 744 unsigned long i, j;
745 u64 max[3], pgm; 745 unsigned long max[3], pgm;
746 struct ifa_reg { 746 struct ifa_reg {
747 u64 valid:1; 747 unsigned long valid:1;
748 u64 ig:11; 748 unsigned long ig:11;
749 u64 vpn:52; 749 unsigned long vpn:52;
750 } *ifa_reg; 750 } *ifa_reg;
751 struct itir_reg { 751 struct itir_reg {
752 u64 rv1:2; 752 unsigned long rv1:2;
753 u64 ps:6; 753 unsigned long ps:6;
754 u64 key:24; 754 unsigned long key:24;
755 u64 rv2:32; 755 unsigned long rv2:32;
756 } *itir_reg; 756 } *itir_reg;
757 struct gr_reg { 757 struct gr_reg {
758 u64 p:1; 758 unsigned long p:1;
759 u64 rv1:1; 759 unsigned long rv1:1;
760 u64 ma:3; 760 unsigned long ma:3;
761 u64 a:1; 761 unsigned long a:1;
762 u64 d:1; 762 unsigned long d:1;
763 u64 pl:2; 763 unsigned long pl:2;
764 u64 ar:3; 764 unsigned long ar:3;
765 u64 ppn:38; 765 unsigned long ppn:38;
766 u64 rv2:2; 766 unsigned long rv2:2;
767 u64 ed:1; 767 unsigned long ed:1;
768 u64 ig:11; 768 unsigned long ig:11;
769 } *gr_reg; 769 } *gr_reg;
770 struct rid_reg { 770 struct rid_reg {
771 u64 ig1:1; 771 unsigned long ig1:1;
772 u64 rv1:1; 772 unsigned long rv1:1;
773 u64 ig2:6; 773 unsigned long ig2:6;
774 u64 rid:24; 774 unsigned long rid:24;
775 u64 rv2:32; 775 unsigned long rv2:32;
776 } *rid_reg; 776 } *rid_reg;
777 777
778 if ((status = ia64_pal_vm_summary(&vm_info_1, &vm_info_2)) !=0) { 778 if ((status = ia64_pal_vm_summary(&vm_info_1, &vm_info_2)) !=0) {
diff --git a/arch/ia64/kernel/paravirt_patchlist.c b/arch/ia64/kernel/paravirt_patchlist.c
index b28082a95d45..0a70720662ed 100644
--- a/arch/ia64/kernel/paravirt_patchlist.c
+++ b/arch/ia64/kernel/paravirt_patchlist.c
@@ -19,6 +19,8 @@
19 */ 19 */
20 20
21#include <linux/bug.h> 21#include <linux/bug.h>
22#include <linux/init.h>
23#include <linux/kernel.h>
22#include <asm/paravirt.h> 24#include <asm/paravirt.h>
23 25
24#define DECLARE(name) \ 26#define DECLARE(name) \
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index eb987386f691..05695962fe44 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -32,6 +32,8 @@ int force_iommu __read_mostly = 1;
32int force_iommu __read_mostly; 32int force_iommu __read_mostly;
33#endif 33#endif
34 34
35int iommu_pass_through;
36
35/* Dummy device used for NULL arguments (normally ISA). Better would 37/* Dummy device used for NULL arguments (normally ISA). Better would
36 be probably a smaller DMA mask, but this is bug-to-bug compatible 38 be probably a smaller DMA mask, but this is bug-to-bug compatible
37 to i386. */ 39 to i386. */
@@ -91,7 +93,7 @@ int iommu_dma_supported(struct device *dev, u64 mask)
91 type. Normally this doesn't make any difference, but gives 93 type. Normally this doesn't make any difference, but gives
92 more gentle handling of IOMMU overflow. */ 94 more gentle handling of IOMMU overflow. */
93 if (iommu_sac_force && (mask >= DMA_BIT_MASK(40))) { 95 if (iommu_sac_force && (mask >= DMA_BIT_MASK(40))) {
94 dev_info(dev, "Force SAC with mask %lx\n", mask); 96 dev_info(dev, "Force SAC with mask %llx\n", mask);
95 return 0; 97 return 0;
96 } 98 }
97 99
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c
index 285aae8431c6..223abb134105 100644
--- a/arch/ia64/kernel/pci-swiotlb.c
+++ b/arch/ia64/kernel/pci-swiotlb.c
@@ -46,7 +46,7 @@ void __init swiotlb_dma_init(void)
46 46
47void __init pci_swiotlb_init(void) 47void __init pci_swiotlb_init(void)
48{ 48{
49 if (!iommu_detected) { 49 if (!iommu_detected || iommu_pass_through) {
50#ifdef CONFIG_IA64_GENERIC 50#ifdef CONFIG_IA64_GENERIC
51 swiotlb = 1; 51 swiotlb = 1;
52 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n"); 52 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 8a06dc480594..abce2468a40b 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -312,7 +312,7 @@ typedef struct pfm_context {
312 unsigned long th_pmcs[PFM_NUM_PMC_REGS]; /* PMC thread save state */ 312 unsigned long th_pmcs[PFM_NUM_PMC_REGS]; /* PMC thread save state */
313 unsigned long th_pmds[PFM_NUM_PMD_REGS]; /* PMD thread save state */ 313 unsigned long th_pmds[PFM_NUM_PMD_REGS]; /* PMD thread save state */
314 314
315 u64 ctx_saved_psr_up; /* only contains psr.up value */ 315 unsigned long ctx_saved_psr_up; /* only contains psr.up value */
316 316
317 unsigned long ctx_last_activation; /* context last activation number for last_cpu */ 317 unsigned long ctx_last_activation; /* context last activation number for last_cpu */
318 unsigned int ctx_last_cpu; /* CPU id of current or last CPU used (SMP only) */ 318 unsigned int ctx_last_cpu; /* CPU id of current or last CPU used (SMP only) */
@@ -5213,8 +5213,8 @@ pfm_end_notify_user(pfm_context_t *ctx)
5213 * main overflow processing routine. 5213 * main overflow processing routine.
5214 * it can be called from the interrupt path or explicitly during the context switch code 5214 * it can be called from the interrupt path or explicitly during the context switch code
5215 */ 5215 */
5216static void 5216static void pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx,
5217pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, struct pt_regs *regs) 5217 unsigned long pmc0, struct pt_regs *regs)
5218{ 5218{
5219 pfm_ovfl_arg_t *ovfl_arg; 5219 pfm_ovfl_arg_t *ovfl_arg;
5220 unsigned long mask; 5220 unsigned long mask;
@@ -5595,7 +5595,7 @@ pfm_interrupt_handler(int irq, void *arg)
5595 (*pfm_alt_intr_handler->handler)(irq, arg, regs); 5595 (*pfm_alt_intr_handler->handler)(irq, arg, regs);
5596 } 5596 }
5597 5597
5598 put_cpu_no_resched(); 5598 put_cpu();
5599 return IRQ_HANDLED; 5599 return IRQ_HANDLED;
5600} 5600}
5601 5601
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 714066aeda7f..1b23ec126b63 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -151,9 +151,9 @@ int num_rsvd_regions __initdata;
151 * This routine does not assume the incoming segments are sorted. 151 * This routine does not assume the incoming segments are sorted.
152 */ 152 */
153int __init 153int __init
154filter_rsvd_memory (unsigned long start, unsigned long end, void *arg) 154filter_rsvd_memory (u64 start, u64 end, void *arg)
155{ 155{
156 unsigned long range_start, range_end, prev_start; 156 u64 range_start, range_end, prev_start;
157 void (*func)(unsigned long, unsigned long, int); 157 void (*func)(unsigned long, unsigned long, int);
158 int i; 158 int i;
159 159
@@ -191,7 +191,7 @@ filter_rsvd_memory (unsigned long start, unsigned long end, void *arg)
191 * are not filtered out. 191 * are not filtered out.
192 */ 192 */
193int __init 193int __init
194filter_memory(unsigned long start, unsigned long end, void *arg) 194filter_memory(u64 start, u64 end, void *arg)
195{ 195{
196 void (*func)(unsigned long, unsigned long, int); 196 void (*func)(unsigned long, unsigned long, int);
197 197
@@ -397,7 +397,7 @@ find_initrd (void)
397 initrd_start = (unsigned long)__va(ia64_boot_param->initrd_start); 397 initrd_start = (unsigned long)__va(ia64_boot_param->initrd_start);
398 initrd_end = initrd_start+ia64_boot_param->initrd_size; 398 initrd_end = initrd_start+ia64_boot_param->initrd_size;
399 399
400 printk(KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n", 400 printk(KERN_INFO "Initial ramdisk at: 0x%lx (%llu bytes)\n",
401 initrd_start, ia64_boot_param->initrd_size); 401 initrd_start, ia64_boot_param->initrd_size);
402 } 402 }
403#endif 403#endif
@@ -505,9 +505,9 @@ static int __init parse_elfcorehdr(char *arg)
505} 505}
506early_param("elfcorehdr", parse_elfcorehdr); 506early_param("elfcorehdr", parse_elfcorehdr);
507 507
508int __init reserve_elfcorehdr(unsigned long *start, unsigned long *end) 508int __init reserve_elfcorehdr(u64 *start, u64 *end)
509{ 509{
510 unsigned long length; 510 u64 length;
511 511
512 /* We get the address using the kernel command line, 512 /* We get the address using the kernel command line,
513 * but the size is extracted from the EFI tables. 513 * but the size is extracted from the EFI tables.
@@ -588,7 +588,7 @@ setup_arch (char **cmdline_p)
588 ia64_patch_rse((u64) __start___rse_patchlist, (u64) __end___rse_patchlist); 588 ia64_patch_rse((u64) __start___rse_patchlist, (u64) __end___rse_patchlist);
589#else 589#else
590 { 590 {
591 u64 num_phys_stacked; 591 unsigned long num_phys_stacked;
592 592
593 if (ia64_pal_rse_info(&num_phys_stacked, 0) == 0 && num_phys_stacked > 96) 593 if (ia64_pal_rse_info(&num_phys_stacked, 0) == 0 && num_phys_stacked > 96)
594 ia64_patch_rse((u64) __start___rse_patchlist, (u64) __end___rse_patchlist); 594 ia64_patch_rse((u64) __start___rse_patchlist, (u64) __end___rse_patchlist);
@@ -872,9 +872,9 @@ static void __cpuinit
872get_cache_info(void) 872get_cache_info(void)
873{ 873{
874 unsigned long line_size, max = 1; 874 unsigned long line_size, max = 1;
875 u64 l, levels, unique_caches; 875 unsigned long l, levels, unique_caches;
876 pal_cache_config_info_t cci; 876 pal_cache_config_info_t cci;
877 s64 status; 877 long status;
878 878
879 status = ia64_pal_cache_summary(&levels, &unique_caches); 879 status = ia64_pal_cache_summary(&levels, &unique_caches);
880 if (status != 0) { 880 if (status != 0) {
@@ -892,9 +892,9 @@ get_cache_info(void)
892 /* cache_type (data_or_unified)=2 */ 892 /* cache_type (data_or_unified)=2 */
893 status = ia64_pal_cache_config_info(l, 2, &cci); 893 status = ia64_pal_cache_config_info(l, 2, &cci);
894 if (status != 0) { 894 if (status != 0) {
895 printk(KERN_ERR 895 printk(KERN_ERR "%s: ia64_pal_cache_config_info"
896 "%s: ia64_pal_cache_config_info(l=%lu, 2) failed (status=%ld)\n", 896 "(l=%lu, 2) failed (status=%ld)\n",
897 __func__, l, status); 897 __func__, l, status);
898 max = SMP_CACHE_BYTES; 898 max = SMP_CACHE_BYTES;
899 /* The safest setup for "flush_icache_range()" */ 899 /* The safest setup for "flush_icache_range()" */
900 cci.pcci_stride = I_CACHE_STRIDE_SHIFT; 900 cci.pcci_stride = I_CACHE_STRIDE_SHIFT;
@@ -914,10 +914,10 @@ get_cache_info(void)
914 /* cache_type (instruction)=1*/ 914 /* cache_type (instruction)=1*/
915 status = ia64_pal_cache_config_info(l, 1, &cci); 915 status = ia64_pal_cache_config_info(l, 1, &cci);
916 if (status != 0) { 916 if (status != 0) {
917 printk(KERN_ERR 917 printk(KERN_ERR "%s: ia64_pal_cache_config_info"
918 "%s: ia64_pal_cache_config_info(l=%lu, 1) failed (status=%ld)\n", 918 "(l=%lu, 1) failed (status=%ld)\n",
919 __func__, l, status); 919 __func__, l, status);
920 /* The safest setup for "flush_icache_range()" */ 920 /* The safest setup for flush_icache_range() */
921 cci.pcci_stride = I_CACHE_STRIDE_SHIFT; 921 cci.pcci_stride = I_CACHE_STRIDE_SHIFT;
922 } 922 }
923 } 923 }
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 5230eaafd83f..f0c521b0ba4c 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -66,7 +66,7 @@ static DEFINE_PER_CPU(unsigned short, shadow_flush_counts[NR_CPUS]) ____cachelin
66#define IPI_KDUMP_CPU_STOP 3 66#define IPI_KDUMP_CPU_STOP 3
67 67
68/* This needs to be cacheline aligned because it is written to by *other* CPUs. */ 68/* This needs to be cacheline aligned because it is written to by *other* CPUs. */
69static DEFINE_PER_CPU_SHARED_ALIGNED(u64, ipi_operation); 69static DEFINE_PER_CPU_SHARED_ALIGNED(unsigned long, ipi_operation);
70 70
71extern void cpu_halt (void); 71extern void cpu_halt (void);
72 72
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 7700e23034bb..de100aa7ff03 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -678,7 +678,7 @@ extern void fixup_irqs(void);
678int migrate_platform_irqs(unsigned int cpu) 678int migrate_platform_irqs(unsigned int cpu)
679{ 679{
680 int new_cpei_cpu; 680 int new_cpei_cpu;
681 irq_desc_t *desc = NULL; 681 struct irq_desc *desc = NULL;
682 const struct cpumask *mask; 682 const struct cpumask *mask;
683 int retval = 0; 683 int retval = 0;
684 684
@@ -865,7 +865,7 @@ init_smp_config(void)
865void __devinit 865void __devinit
866identify_siblings(struct cpuinfo_ia64 *c) 866identify_siblings(struct cpuinfo_ia64 *c)
867{ 867{
868 s64 status; 868 long status;
869 u16 pltid; 869 u16 pltid;
870 pal_logical_to_physical_t info; 870 pal_logical_to_physical_t info;
871 871
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 604c1a35db33..4990495d7531 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -385,7 +385,7 @@ ia64_init_itm (void)
385 385
386static cycle_t itc_get_cycles(struct clocksource *cs) 386static cycle_t itc_get_cycles(struct clocksource *cs)
387{ 387{
388 u64 lcycle, now, ret; 388 unsigned long lcycle, now, ret;
389 389
390 if (!itc_jitter_data.itc_jitter) 390 if (!itc_jitter_data.itc_jitter)
391 return get_cycles(); 391 return get_cycles();
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index a8d61a3e9a94..bc80dff1df7a 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -306,10 +306,10 @@ static void __cpuinit cpu_cache_sysfs_exit(unsigned int cpu)
306 306
307static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu) 307static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu)
308{ 308{
309 u64 i, levels, unique_caches; 309 unsigned long i, levels, unique_caches;
310 pal_cache_config_info_t cci; 310 pal_cache_config_info_t cci;
311 int j; 311 int j;
312 s64 status; 312 long status;
313 struct cache_info *this_cache; 313 struct cache_info *this_cache;
314 int num_cache_leaves = 0; 314 int num_cache_leaves = 0;
315 315
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index 8eff8c1d40a6..a595823582d9 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -98,7 +98,8 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
98 98
99 /* attempt to allocate a granule's worth of cached memory pages */ 99 /* attempt to allocate a granule's worth of cached memory pages */
100 100
101 page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, 101 page = alloc_pages_exact_node(nid,
102 GFP_KERNEL | __GFP_ZERO | GFP_THISNODE,
102 IA64_GRANULE_SHIFT-PAGE_SHIFT); 103 IA64_GRANULE_SHIFT-PAGE_SHIFT);
103 if (!page) { 104 if (!page) {
104 mutex_unlock(&uc_pool->add_chunk_mutex); 105 mutex_unlock(&uc_pool->add_chunk_mutex);
@@ -249,8 +250,7 @@ EXPORT_SYMBOL(uncached_free_page);
249 * Called at boot time to build a map of pages that can be used for 250 * Called at boot time to build a map of pages that can be used for
250 * memory special operations. 251 * memory special operations.
251 */ 252 */
252static int __init uncached_build_memmap(unsigned long uc_start, 253static int __init uncached_build_memmap(u64 uc_start, u64 uc_end, void *arg)
253 unsigned long uc_end, void *arg)
254{ 254{
255 int nid = paddr_to_nid(uc_start - __IA64_UNCACHED_OFFSET); 255 int nid = paddr_to_nid(uc_start - __IA64_UNCACHED_OFFSET);
256 struct gen_pool *pool = uncached_pools[nid].pool; 256 struct gen_pool *pool = uncached_pools[nid].pool;
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig
index 0a2d6b86075a..64d520937874 100644
--- a/arch/ia64/kvm/Kconfig
+++ b/arch/ia64/kvm/Kconfig
@@ -23,7 +23,7 @@ if VIRTUALIZATION
23 23
24config KVM 24config KVM
25 tristate "Kernel-based Virtual Machine (KVM) support" 25 tristate "Kernel-based Virtual Machine (KVM) support"
26 depends on HAVE_KVM && EXPERIMENTAL 26 depends on HAVE_KVM && MODULES && EXPERIMENTAL
27 # for device assignment: 27 # for device assignment:
28 depends on PCI 28 depends on PCI
29 select PREEMPT_NOTIFIERS 29 select PREEMPT_NOTIFIERS
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index d20a5db4c4dd..80c57b0a21c4 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -41,6 +41,9 @@
41#include <asm/div64.h> 41#include <asm/div64.h>
42#include <asm/tlb.h> 42#include <asm/tlb.h>
43#include <asm/elf.h> 43#include <asm/elf.h>
44#include <asm/sn/addrs.h>
45#include <asm/sn/clksupport.h>
46#include <asm/sn/shub_mmr.h>
44 47
45#include "misc.h" 48#include "misc.h"
46#include "vti.h" 49#include "vti.h"
@@ -65,6 +68,16 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
65 { NULL } 68 { NULL }
66}; 69};
67 70
71static unsigned long kvm_get_itc(struct kvm_vcpu *vcpu)
72{
73#if defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
74 if (vcpu->kvm->arch.is_sn2)
75 return rtc_time();
76 else
77#endif
78 return ia64_getreg(_IA64_REG_AR_ITC);
79}
80
68static void kvm_flush_icache(unsigned long start, unsigned long len) 81static void kvm_flush_icache(unsigned long start, unsigned long len)
69{ 82{
70 int l; 83 int l;
@@ -119,8 +132,7 @@ void kvm_arch_hardware_enable(void *garbage)
119 unsigned long saved_psr; 132 unsigned long saved_psr;
120 int slot; 133 int slot;
121 134
122 pte = pte_val(mk_pte_phys(__pa(kvm_vmm_base), 135 pte = pte_val(mk_pte_phys(__pa(kvm_vmm_base), PAGE_KERNEL));
123 PAGE_KERNEL));
124 local_irq_save(saved_psr); 136 local_irq_save(saved_psr);
125 slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT); 137 slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT);
126 local_irq_restore(saved_psr); 138 local_irq_restore(saved_psr);
@@ -283,6 +295,18 @@ static int handle_sal_call(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
283 295
284} 296}
285 297
298static int __apic_accept_irq(struct kvm_vcpu *vcpu, uint64_t vector)
299{
300 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
301
302 if (!test_and_set_bit(vector, &vpd->irr[0])) {
303 vcpu->arch.irq_new_pending = 1;
304 kvm_vcpu_kick(vcpu);
305 return 1;
306 }
307 return 0;
308}
309
286/* 310/*
287 * offset: address offset to IPI space. 311 * offset: address offset to IPI space.
288 * value: deliver value. 312 * value: deliver value.
@@ -292,20 +316,20 @@ static void vcpu_deliver_ipi(struct kvm_vcpu *vcpu, uint64_t dm,
292{ 316{
293 switch (dm) { 317 switch (dm) {
294 case SAPIC_FIXED: 318 case SAPIC_FIXED:
295 kvm_apic_set_irq(vcpu, vector, 0);
296 break; 319 break;
297 case SAPIC_NMI: 320 case SAPIC_NMI:
298 kvm_apic_set_irq(vcpu, 2, 0); 321 vector = 2;
299 break; 322 break;
300 case SAPIC_EXTINT: 323 case SAPIC_EXTINT:
301 kvm_apic_set_irq(vcpu, 0, 0); 324 vector = 0;
302 break; 325 break;
303 case SAPIC_INIT: 326 case SAPIC_INIT:
304 case SAPIC_PMI: 327 case SAPIC_PMI:
305 default: 328 default:
306 printk(KERN_ERR"kvm: Unimplemented Deliver reserved IPI!\n"); 329 printk(KERN_ERR"kvm: Unimplemented Deliver reserved IPI!\n");
307 break; 330 return;
308 } 331 }
332 __apic_accept_irq(vcpu, vector);
309} 333}
310 334
311static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id, 335static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id,
@@ -413,6 +437,23 @@ static int handle_switch_rr6(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
413 return 1; 437 return 1;
414} 438}
415 439
440static int kvm_sn2_setup_mappings(struct kvm_vcpu *vcpu)
441{
442 unsigned long pte, rtc_phys_addr, map_addr;
443 int slot;
444
445 map_addr = KVM_VMM_BASE + (1UL << KVM_VMM_SHIFT);
446 rtc_phys_addr = LOCAL_MMR_OFFSET | SH_RTC;
447 pte = pte_val(mk_pte_phys(rtc_phys_addr, PAGE_KERNEL_UC));
448 slot = ia64_itr_entry(0x3, map_addr, pte, PAGE_SHIFT);
449 vcpu->arch.sn_rtc_tr_slot = slot;
450 if (slot < 0) {
451 printk(KERN_ERR "Mayday mayday! RTC mapping failed!\n");
452 slot = 0;
453 }
454 return slot;
455}
456
416int kvm_emulate_halt(struct kvm_vcpu *vcpu) 457int kvm_emulate_halt(struct kvm_vcpu *vcpu)
417{ 458{
418 459
@@ -426,7 +467,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu)
426 467
427 if (irqchip_in_kernel(vcpu->kvm)) { 468 if (irqchip_in_kernel(vcpu->kvm)) {
428 469
429 vcpu_now_itc = ia64_getreg(_IA64_REG_AR_ITC) + vcpu->arch.itc_offset; 470 vcpu_now_itc = kvm_get_itc(vcpu) + vcpu->arch.itc_offset;
430 471
431 if (time_after(vcpu_now_itc, vpd->itm)) { 472 if (time_after(vcpu_now_itc, vpd->itm)) {
432 vcpu->arch.timer_check = 1; 473 vcpu->arch.timer_check = 1;
@@ -447,10 +488,10 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu)
447 hrtimer_cancel(p_ht); 488 hrtimer_cancel(p_ht);
448 vcpu->arch.ht_active = 0; 489 vcpu->arch.ht_active = 0;
449 490
450 if (test_and_clear_bit(KVM_REQ_UNHALT, &vcpu->requests)) 491 if (test_and_clear_bit(KVM_REQ_UNHALT, &vcpu->requests) ||
492 kvm_cpu_has_pending_timer(vcpu))
451 if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED) 493 if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED)
452 vcpu->arch.mp_state = 494 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
453 KVM_MP_STATE_RUNNABLE;
454 495
455 if (vcpu->arch.mp_state != KVM_MP_STATE_RUNNABLE) 496 if (vcpu->arch.mp_state != KVM_MP_STATE_RUNNABLE)
456 return -EINTR; 497 return -EINTR;
@@ -551,22 +592,35 @@ static int kvm_insert_vmm_mapping(struct kvm_vcpu *vcpu)
551 if (r < 0) 592 if (r < 0)
552 goto out; 593 goto out;
553 vcpu->arch.vm_tr_slot = r; 594 vcpu->arch.vm_tr_slot = r;
595
596#if defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
597 if (kvm->arch.is_sn2) {
598 r = kvm_sn2_setup_mappings(vcpu);
599 if (r < 0)
600 goto out;
601 }
602#endif
603
554 r = 0; 604 r = 0;
555out: 605out:
556 return r; 606 return r;
557
558} 607}
559 608
560static void kvm_purge_vmm_mapping(struct kvm_vcpu *vcpu) 609static void kvm_purge_vmm_mapping(struct kvm_vcpu *vcpu)
561{ 610{
562 611 struct kvm *kvm = vcpu->kvm;
563 ia64_ptr_entry(0x3, vcpu->arch.vmm_tr_slot); 612 ia64_ptr_entry(0x3, vcpu->arch.vmm_tr_slot);
564 ia64_ptr_entry(0x3, vcpu->arch.vm_tr_slot); 613 ia64_ptr_entry(0x3, vcpu->arch.vm_tr_slot);
565 614#if defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
615 if (kvm->arch.is_sn2)
616 ia64_ptr_entry(0x3, vcpu->arch.sn_rtc_tr_slot);
617#endif
566} 618}
567 619
568static int kvm_vcpu_pre_transition(struct kvm_vcpu *vcpu) 620static int kvm_vcpu_pre_transition(struct kvm_vcpu *vcpu)
569{ 621{
622 unsigned long psr;
623 int r;
570 int cpu = smp_processor_id(); 624 int cpu = smp_processor_id();
571 625
572 if (vcpu->arch.last_run_cpu != cpu || 626 if (vcpu->arch.last_run_cpu != cpu ||
@@ -578,36 +632,27 @@ static int kvm_vcpu_pre_transition(struct kvm_vcpu *vcpu)
578 632
579 vcpu->arch.host_rr6 = ia64_get_rr(RR6); 633 vcpu->arch.host_rr6 = ia64_get_rr(RR6);
580 vti_set_rr6(vcpu->arch.vmm_rr); 634 vti_set_rr6(vcpu->arch.vmm_rr);
581 return kvm_insert_vmm_mapping(vcpu); 635 local_irq_save(psr);
636 r = kvm_insert_vmm_mapping(vcpu);
637 local_irq_restore(psr);
638 return r;
582} 639}
640
583static void kvm_vcpu_post_transition(struct kvm_vcpu *vcpu) 641static void kvm_vcpu_post_transition(struct kvm_vcpu *vcpu)
584{ 642{
585 kvm_purge_vmm_mapping(vcpu); 643 kvm_purge_vmm_mapping(vcpu);
586 vti_set_rr6(vcpu->arch.host_rr6); 644 vti_set_rr6(vcpu->arch.host_rr6);
587} 645}
588 646
589static int vti_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 647static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
590{ 648{
591 union context *host_ctx, *guest_ctx; 649 union context *host_ctx, *guest_ctx;
592 int r; 650 int r;
593 651
594 /*Get host and guest context with guest address space.*/ 652 /*
595 host_ctx = kvm_get_host_context(vcpu); 653 * down_read() may sleep and return with interrupts enabled
596 guest_ctx = kvm_get_guest_context(vcpu); 654 */
597 655 down_read(&vcpu->kvm->slots_lock);
598 r = kvm_vcpu_pre_transition(vcpu);
599 if (r < 0)
600 goto out;
601 kvm_vmm_info->tramp_entry(host_ctx, guest_ctx);
602 kvm_vcpu_post_transition(vcpu);
603 r = 0;
604out:
605 return r;
606}
607
608static int __vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
609{
610 int r;
611 656
612again: 657again:
613 if (signal_pending(current)) { 658 if (signal_pending(current)) {
@@ -616,26 +661,31 @@ again:
616 goto out; 661 goto out;
617 } 662 }
618 663
619 /*
620 * down_read() may sleep and return with interrupts enabled
621 */
622 down_read(&vcpu->kvm->slots_lock);
623
624 preempt_disable(); 664 preempt_disable();
625 local_irq_disable(); 665 local_irq_disable();
626 666
627 vcpu->guest_mode = 1; 667 /*Get host and guest context with guest address space.*/
668 host_ctx = kvm_get_host_context(vcpu);
669 guest_ctx = kvm_get_guest_context(vcpu);
670
671 clear_bit(KVM_REQ_KICK, &vcpu->requests);
672
673 r = kvm_vcpu_pre_transition(vcpu);
674 if (r < 0)
675 goto vcpu_run_fail;
676
677 up_read(&vcpu->kvm->slots_lock);
628 kvm_guest_enter(); 678 kvm_guest_enter();
629 r = vti_vcpu_run(vcpu, kvm_run); 679
630 if (r < 0) { 680 /*
631 local_irq_enable(); 681 * Transition to the guest
632 preempt_enable(); 682 */
633 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; 683 kvm_vmm_info->tramp_entry(host_ctx, guest_ctx);
634 goto out; 684
635 } 685 kvm_vcpu_post_transition(vcpu);
636 686
637 vcpu->arch.launched = 1; 687 vcpu->arch.launched = 1;
638 vcpu->guest_mode = 0; 688 set_bit(KVM_REQ_KICK, &vcpu->requests);
639 local_irq_enable(); 689 local_irq_enable();
640 690
641 /* 691 /*
@@ -646,9 +696,10 @@ again:
646 */ 696 */
647 barrier(); 697 barrier();
648 kvm_guest_exit(); 698 kvm_guest_exit();
649 up_read(&vcpu->kvm->slots_lock);
650 preempt_enable(); 699 preempt_enable();
651 700
701 down_read(&vcpu->kvm->slots_lock);
702
652 r = kvm_handle_exit(kvm_run, vcpu); 703 r = kvm_handle_exit(kvm_run, vcpu);
653 704
654 if (r > 0) { 705 if (r > 0) {
@@ -657,12 +708,20 @@ again:
657 } 708 }
658 709
659out: 710out:
711 up_read(&vcpu->kvm->slots_lock);
660 if (r > 0) { 712 if (r > 0) {
661 kvm_resched(vcpu); 713 kvm_resched(vcpu);
714 down_read(&vcpu->kvm->slots_lock);
662 goto again; 715 goto again;
663 } 716 }
664 717
665 return r; 718 return r;
719
720vcpu_run_fail:
721 local_irq_enable();
722 preempt_enable();
723 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
724 goto out;
666} 725}
667 726
668static void kvm_set_mmio_data(struct kvm_vcpu *vcpu) 727static void kvm_set_mmio_data(struct kvm_vcpu *vcpu)
@@ -788,6 +847,9 @@ struct kvm *kvm_arch_create_vm(void)
788 847
789 if (IS_ERR(kvm)) 848 if (IS_ERR(kvm))
790 return ERR_PTR(-ENOMEM); 849 return ERR_PTR(-ENOMEM);
850
851 kvm->arch.is_sn2 = ia64_platform_is("sn2");
852
791 kvm_init_vm(kvm); 853 kvm_init_vm(kvm);
792 854
793 kvm->arch.online_vcpus = 0; 855 kvm->arch.online_vcpus = 0;
@@ -884,7 +946,7 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
884 RESTORE_REGS(saved_gp); 946 RESTORE_REGS(saved_gp);
885 947
886 vcpu->arch.irq_new_pending = 1; 948 vcpu->arch.irq_new_pending = 1;
887 vcpu->arch.itc_offset = regs->saved_itc - ia64_getreg(_IA64_REG_AR_ITC); 949 vcpu->arch.itc_offset = regs->saved_itc - kvm_get_itc(vcpu);
888 set_bit(KVM_REQ_RESUME, &vcpu->requests); 950 set_bit(KVM_REQ_RESUME, &vcpu->requests);
889 951
890 vcpu_put(vcpu); 952 vcpu_put(vcpu);
@@ -1043,10 +1105,6 @@ static void kvm_free_vmm_area(void)
1043 } 1105 }
1044} 1106}
1045 1107
1046static void vti_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1047{
1048}
1049
1050static int vti_init_vpd(struct kvm_vcpu *vcpu) 1108static int vti_init_vpd(struct kvm_vcpu *vcpu)
1051{ 1109{
1052 int i; 1110 int i;
@@ -1165,7 +1223,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1165 regs->cr_iip = PALE_RESET_ENTRY; 1223 regs->cr_iip = PALE_RESET_ENTRY;
1166 1224
1167 /*Initialize itc offset for vcpus*/ 1225 /*Initialize itc offset for vcpus*/
1168 itc_offset = 0UL - ia64_getreg(_IA64_REG_AR_ITC); 1226 itc_offset = 0UL - kvm_get_itc(vcpu);
1169 for (i = 0; i < kvm->arch.online_vcpus; i++) { 1227 for (i = 0; i < kvm->arch.online_vcpus; i++) {
1170 v = (struct kvm_vcpu *)((char *)vcpu + 1228 v = (struct kvm_vcpu *)((char *)vcpu +
1171 sizeof(struct kvm_vcpu_data) * i); 1229 sizeof(struct kvm_vcpu_data) * i);
@@ -1237,6 +1295,7 @@ static int vti_vcpu_setup(struct kvm_vcpu *vcpu, int id)
1237 1295
1238 local_irq_save(psr); 1296 local_irq_save(psr);
1239 r = kvm_insert_vmm_mapping(vcpu); 1297 r = kvm_insert_vmm_mapping(vcpu);
1298 local_irq_restore(psr);
1240 if (r) 1299 if (r)
1241 goto fail; 1300 goto fail;
1242 r = kvm_vcpu_init(vcpu, vcpu->kvm, id); 1301 r = kvm_vcpu_init(vcpu, vcpu->kvm, id);
@@ -1254,13 +1313,11 @@ static int vti_vcpu_setup(struct kvm_vcpu *vcpu, int id)
1254 goto uninit; 1313 goto uninit;
1255 1314
1256 kvm_purge_vmm_mapping(vcpu); 1315 kvm_purge_vmm_mapping(vcpu);
1257 local_irq_restore(psr);
1258 1316
1259 return 0; 1317 return 0;
1260uninit: 1318uninit:
1261 kvm_vcpu_uninit(vcpu); 1319 kvm_vcpu_uninit(vcpu);
1262fail: 1320fail:
1263 local_irq_restore(psr);
1264 return r; 1321 return r;
1265} 1322}
1266 1323
@@ -1291,7 +1348,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
1291 vcpu->kvm = kvm; 1348 vcpu->kvm = kvm;
1292 1349
1293 cpu = get_cpu(); 1350 cpu = get_cpu();
1294 vti_vcpu_load(vcpu, cpu);
1295 r = vti_vcpu_setup(vcpu, id); 1351 r = vti_vcpu_setup(vcpu, id);
1296 put_cpu(); 1352 put_cpu();
1297 1353
@@ -1427,7 +1483,7 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1427 } 1483 }
1428 for (i = 0; i < 4; i++) 1484 for (i = 0; i < 4; i++)
1429 regs->insvc[i] = vcpu->arch.insvc[i]; 1485 regs->insvc[i] = vcpu->arch.insvc[i];
1430 regs->saved_itc = vcpu->arch.itc_offset + ia64_getreg(_IA64_REG_AR_ITC); 1486 regs->saved_itc = vcpu->arch.itc_offset + kvm_get_itc(vcpu);
1431 SAVE_REGS(xtp); 1487 SAVE_REGS(xtp);
1432 SAVE_REGS(metaphysical_rr0); 1488 SAVE_REGS(metaphysical_rr0);
1433 SAVE_REGS(metaphysical_rr4); 1489 SAVE_REGS(metaphysical_rr4);
@@ -1574,6 +1630,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
1574 1630
1575void kvm_arch_flush_shadow(struct kvm *kvm) 1631void kvm_arch_flush_shadow(struct kvm *kvm)
1576{ 1632{
1633 kvm_flush_remote_tlbs(kvm);
1577} 1634}
1578 1635
1579long kvm_arch_dev_ioctl(struct file *filp, 1636long kvm_arch_dev_ioctl(struct file *filp,
@@ -1616,8 +1673,37 @@ out:
1616 return 0; 1673 return 0;
1617} 1674}
1618 1675
1676
1677/*
1678 * On SN2, the ITC isn't stable, so copy in fast path code to use the
1679 * SN2 RTC, replacing the ITC based default verion.
1680 */
1681static void kvm_patch_vmm(struct kvm_vmm_info *vmm_info,
1682 struct module *module)
1683{
1684 unsigned long new_ar, new_ar_sn2;
1685 unsigned long module_base;
1686
1687 if (!ia64_platform_is("sn2"))
1688 return;
1689
1690 module_base = (unsigned long)module->module_core;
1691
1692 new_ar = kvm_vmm_base + vmm_info->patch_mov_ar - module_base;
1693 new_ar_sn2 = kvm_vmm_base + vmm_info->patch_mov_ar_sn2 - module_base;
1694
1695 printk(KERN_INFO "kvm: Patching ITC emulation to use SGI SN2 RTC "
1696 "as source\n");
1697
1698 /*
1699 * Copy the SN2 version of mov_ar into place. They are both
1700 * the same size, so 6 bundles is sufficient (6 * 0x10).
1701 */
1702 memcpy((void *)new_ar, (void *)new_ar_sn2, 0x60);
1703}
1704
1619static int kvm_relocate_vmm(struct kvm_vmm_info *vmm_info, 1705static int kvm_relocate_vmm(struct kvm_vmm_info *vmm_info,
1620 struct module *module) 1706 struct module *module)
1621{ 1707{
1622 unsigned long module_base; 1708 unsigned long module_base;
1623 unsigned long vmm_size; 1709 unsigned long vmm_size;
@@ -1639,6 +1725,7 @@ static int kvm_relocate_vmm(struct kvm_vmm_info *vmm_info,
1639 return -EFAULT; 1725 return -EFAULT;
1640 1726
1641 memcpy((void *)kvm_vmm_base, (void *)module_base, vmm_size); 1727 memcpy((void *)kvm_vmm_base, (void *)module_base, vmm_size);
1728 kvm_patch_vmm(vmm_info, module);
1642 kvm_flush_icache(kvm_vmm_base, vmm_size); 1729 kvm_flush_icache(kvm_vmm_base, vmm_size);
1643 1730
1644 /*Recalculate kvm_vmm_info based on new VMM*/ 1731 /*Recalculate kvm_vmm_info based on new VMM*/
@@ -1792,38 +1879,24 @@ void kvm_arch_hardware_unsetup(void)
1792{ 1879{
1793} 1880}
1794 1881
1795static void vcpu_kick_intr(void *info)
1796{
1797#ifdef DEBUG
1798 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)info;
1799 printk(KERN_DEBUG"vcpu_kick_intr %p \n", vcpu);
1800#endif
1801}
1802
1803void kvm_vcpu_kick(struct kvm_vcpu *vcpu) 1882void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
1804{ 1883{
1805 int ipi_pcpu = vcpu->cpu; 1884 int me;
1806 int cpu = get_cpu(); 1885 int cpu = vcpu->cpu;
1807 1886
1808 if (waitqueue_active(&vcpu->wq)) 1887 if (waitqueue_active(&vcpu->wq))
1809 wake_up_interruptible(&vcpu->wq); 1888 wake_up_interruptible(&vcpu->wq);
1810 1889
1811 if (vcpu->guest_mode && cpu != ipi_pcpu) 1890 me = get_cpu();
1812 smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0); 1891 if (cpu != me && (unsigned) cpu < nr_cpu_ids && cpu_online(cpu))
1892 if (!test_and_set_bit(KVM_REQ_KICK, &vcpu->requests))
1893 smp_send_reschedule(cpu);
1813 put_cpu(); 1894 put_cpu();
1814} 1895}
1815 1896
1816int kvm_apic_set_irq(struct kvm_vcpu *vcpu, u8 vec, u8 trig) 1897int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq)
1817{ 1898{
1818 1899 return __apic_accept_irq(vcpu, irq->vector);
1819 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
1820
1821 if (!test_and_set_bit(vec, &vpd->irr[0])) {
1822 vcpu->arch.irq_new_pending = 1;
1823 kvm_vcpu_kick(vcpu);
1824 return 1;
1825 }
1826 return 0;
1827} 1900}
1828 1901
1829int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest) 1902int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest)
@@ -1836,20 +1909,18 @@ int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda)
1836 return 0; 1909 return 0;
1837} 1910}
1838 1911
1839struct kvm_vcpu *kvm_get_lowest_prio_vcpu(struct kvm *kvm, u8 vector, 1912int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2)
1840 unsigned long bitmap)
1841{ 1913{
1842 struct kvm_vcpu *lvcpu = kvm->vcpus[0]; 1914 return vcpu1->arch.xtp - vcpu2->arch.xtp;
1843 int i; 1915}
1844
1845 for (i = 1; i < kvm->arch.online_vcpus; i++) {
1846 if (!kvm->vcpus[i])
1847 continue;
1848 if (lvcpu->arch.xtp > kvm->vcpus[i]->arch.xtp)
1849 lvcpu = kvm->vcpus[i];
1850 }
1851 1916
1852 return lvcpu; 1917int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
1918 int short_hand, int dest, int dest_mode)
1919{
1920 struct kvm_lapic *target = vcpu->arch.apic;
1921 return (dest_mode == 0) ?
1922 kvm_apic_match_physical_addr(target, dest) :
1923 kvm_apic_match_logical_addr(target, dest);
1853} 1924}
1854 1925
1855static int find_highest_bits(int *dat) 1926static int find_highest_bits(int *dat)
@@ -1888,6 +1959,12 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
1888 return 0; 1959 return 0;
1889} 1960}
1890 1961
1962int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu)
1963{
1964 /* do real check here */
1965 return 1;
1966}
1967
1891int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) 1968int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
1892{ 1969{
1893 return vcpu->arch.timer_fired; 1970 return vcpu->arch.timer_fired;
@@ -1918,6 +1995,7 @@ static int vcpu_reset(struct kvm_vcpu *vcpu)
1918 long psr; 1995 long psr;
1919 local_irq_save(psr); 1996 local_irq_save(psr);
1920 r = kvm_insert_vmm_mapping(vcpu); 1997 r = kvm_insert_vmm_mapping(vcpu);
1998 local_irq_restore(psr);
1921 if (r) 1999 if (r)
1922 goto fail; 2000 goto fail;
1923 2001
@@ -1930,7 +2008,6 @@ static int vcpu_reset(struct kvm_vcpu *vcpu)
1930 kvm_purge_vmm_mapping(vcpu); 2008 kvm_purge_vmm_mapping(vcpu);
1931 r = 0; 2009 r = 0;
1932fail: 2010fail:
1933 local_irq_restore(psr);
1934 return r; 2011 return r;
1935} 2012}
1936 2013
diff --git a/arch/ia64/kvm/kvm_fw.c b/arch/ia64/kvm/kvm_fw.c
index a8ae52ed5635..e4b82319881d 100644
--- a/arch/ia64/kvm/kvm_fw.c
+++ b/arch/ia64/kvm/kvm_fw.c
@@ -21,6 +21,9 @@
21 21
22#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
23#include <linux/smp.h> 23#include <linux/smp.h>
24#include <asm/sn/addrs.h>
25#include <asm/sn/clksupport.h>
26#include <asm/sn/shub_mmr.h>
24 27
25#include "vti.h" 28#include "vti.h"
26#include "misc.h" 29#include "misc.h"
@@ -188,12 +191,35 @@ static struct ia64_pal_retval pal_freq_base(struct kvm_vcpu *vcpu)
188 return result; 191 return result;
189} 192}
190 193
191static struct ia64_pal_retval pal_freq_ratios(struct kvm_vcpu *vcpu) 194/*
195 * On the SGI SN2, the ITC isn't stable. Emulation backed by the SN2
196 * RTC is used instead. This function patches the ratios from SAL
197 * to match the RTC before providing them to the guest.
198 */
199static void sn2_patch_itc_freq_ratios(struct ia64_pal_retval *result)
192{ 200{
201 struct pal_freq_ratio *ratio;
202 unsigned long sal_freq, sal_drift, factor;
203
204 result->status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM,
205 &sal_freq, &sal_drift);
206 ratio = (struct pal_freq_ratio *)&result->v2;
207 factor = ((sal_freq * 3) + (sn_rtc_cycles_per_second / 2)) /
208 sn_rtc_cycles_per_second;
209
210 ratio->num = 3;
211 ratio->den = factor;
212}
193 213
214static struct ia64_pal_retval pal_freq_ratios(struct kvm_vcpu *vcpu)
215{
194 struct ia64_pal_retval result; 216 struct ia64_pal_retval result;
195 217
196 PAL_CALL(result, PAL_FREQ_RATIOS, 0, 0, 0); 218 PAL_CALL(result, PAL_FREQ_RATIOS, 0, 0, 0);
219
220 if (vcpu->kvm->arch.is_sn2)
221 sn2_patch_itc_freq_ratios(&result);
222
197 return result; 223 return result;
198} 224}
199 225
diff --git a/arch/ia64/kvm/lapic.h b/arch/ia64/kvm/lapic.h
index 6d6cbcb14893..ee541cebcd78 100644
--- a/arch/ia64/kvm/lapic.h
+++ b/arch/ia64/kvm/lapic.h
@@ -20,6 +20,10 @@ void kvm_free_lapic(struct kvm_vcpu *vcpu);
20 20
21int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest); 21int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest);
22int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda); 22int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda);
23int kvm_apic_set_irq(struct kvm_vcpu *vcpu, u8 vec, u8 trig); 23int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
24 int short_hand, int dest, int dest_mode);
25int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2);
26int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq);
27#define kvm_apic_present(x) (true)
24 28
25#endif 29#endif
diff --git a/arch/ia64/kvm/optvfault.S b/arch/ia64/kvm/optvfault.S
index 32254ce9a1bd..f793be3effff 100644
--- a/arch/ia64/kvm/optvfault.S
+++ b/arch/ia64/kvm/optvfault.S
@@ -11,6 +11,7 @@
11 11
12#include <asm/asmmacro.h> 12#include <asm/asmmacro.h>
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/kvm_host.h>
14 15
15#include "vti.h" 16#include "vti.h"
16#include "asm-offsets.h" 17#include "asm-offsets.h"
@@ -140,6 +141,35 @@ GLOBAL_ENTRY(kvm_asm_mov_from_ar)
140 ;; 141 ;;
141END(kvm_asm_mov_from_ar) 142END(kvm_asm_mov_from_ar)
142 143
144/*
145 * Special SGI SN2 optimized version of mov_from_ar using the SN2 RTC
146 * clock as it's source for emulating the ITC. This version will be
147 * copied on top of the original version if the host is determined to
148 * be an SN2.
149 */
150GLOBAL_ENTRY(kvm_asm_mov_from_ar_sn2)
151 add r18=VMM_VCPU_ITC_OFS_OFFSET, r21
152 movl r19 = (KVM_VMM_BASE+(1<<KVM_VMM_SHIFT))
153
154 add r16=VMM_VCPU_LAST_ITC_OFFSET,r21
155 extr.u r17=r25,6,7
156 mov r24=b0
157 ;;
158 ld8 r18=[r18]
159 ld8 r19=[r19]
160 addl r20=@gprel(asm_mov_to_reg),gp
161 ;;
162 add r19=r19,r18
163 shladd r17=r17,4,r20
164 ;;
165 adds r30=kvm_resume_to_guest-asm_mov_to_reg,r20
166 st8 [r16] = r19
167 mov b0=r17
168 br.sptk.few b0
169 ;;
170END(kvm_asm_mov_from_ar_sn2)
171
172
143 173
144// mov r1=rr[r3] 174// mov r1=rr[r3]
145GLOBAL_ENTRY(kvm_asm_mov_from_rr) 175GLOBAL_ENTRY(kvm_asm_mov_from_rr)
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c
index b1dc80952d91..a8f84da04b49 100644
--- a/arch/ia64/kvm/process.c
+++ b/arch/ia64/kvm/process.c
@@ -652,20 +652,25 @@ void kvm_ia64_handle_break(unsigned long ifa, struct kvm_pt_regs *regs,
652 unsigned long isr, unsigned long iim) 652 unsigned long isr, unsigned long iim)
653{ 653{
654 struct kvm_vcpu *v = current_vcpu; 654 struct kvm_vcpu *v = current_vcpu;
655 long psr;
655 656
656 if (ia64_psr(regs)->cpl == 0) { 657 if (ia64_psr(regs)->cpl == 0) {
657 /* Allow hypercalls only when cpl = 0. */ 658 /* Allow hypercalls only when cpl = 0. */
658 if (iim == DOMN_PAL_REQUEST) { 659 if (iim == DOMN_PAL_REQUEST) {
660 local_irq_save(psr);
659 set_pal_call_data(v); 661 set_pal_call_data(v);
660 vmm_transition(v); 662 vmm_transition(v);
661 get_pal_call_result(v); 663 get_pal_call_result(v);
662 vcpu_increment_iip(v); 664 vcpu_increment_iip(v);
665 local_irq_restore(psr);
663 return; 666 return;
664 } else if (iim == DOMN_SAL_REQUEST) { 667 } else if (iim == DOMN_SAL_REQUEST) {
668 local_irq_save(psr);
665 set_sal_call_data(v); 669 set_sal_call_data(v);
666 vmm_transition(v); 670 vmm_transition(v);
667 get_sal_call_result(v); 671 get_sal_call_result(v);
668 vcpu_increment_iip(v); 672 vcpu_increment_iip(v);
673 local_irq_restore(psr);
669 return; 674 return;
670 } 675 }
671 } 676 }
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c
index a18ee17b9192..a2c6c15e4761 100644
--- a/arch/ia64/kvm/vcpu.c
+++ b/arch/ia64/kvm/vcpu.c
@@ -788,13 +788,29 @@ void vcpu_set_fpreg(struct kvm_vcpu *vcpu, unsigned long reg,
788 setfpreg(reg, val, regs); /* FIXME: handle NATs later*/ 788 setfpreg(reg, val, regs); /* FIXME: handle NATs later*/
789} 789}
790 790
791/*
792 * The Altix RTC is mapped specially here for the vmm module
793 */
794#define SN_RTC_BASE (u64 *)(KVM_VMM_BASE+(1UL<<KVM_VMM_SHIFT))
795static long kvm_get_itc(struct kvm_vcpu *vcpu)
796{
797#if defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
798 struct kvm *kvm = (struct kvm *)KVM_VM_BASE;
799
800 if (kvm->arch.is_sn2)
801 return (*SN_RTC_BASE);
802 else
803#endif
804 return ia64_getreg(_IA64_REG_AR_ITC);
805}
806
791/************************************************************************ 807/************************************************************************
792 * lsapic timer 808 * lsapic timer
793 ***********************************************************************/ 809 ***********************************************************************/
794u64 vcpu_get_itc(struct kvm_vcpu *vcpu) 810u64 vcpu_get_itc(struct kvm_vcpu *vcpu)
795{ 811{
796 unsigned long guest_itc; 812 unsigned long guest_itc;
797 guest_itc = VMX(vcpu, itc_offset) + ia64_getreg(_IA64_REG_AR_ITC); 813 guest_itc = VMX(vcpu, itc_offset) + kvm_get_itc(vcpu);
798 814
799 if (guest_itc >= VMX(vcpu, last_itc)) { 815 if (guest_itc >= VMX(vcpu, last_itc)) {
800 VMX(vcpu, last_itc) = guest_itc; 816 VMX(vcpu, last_itc) = guest_itc;
@@ -809,7 +825,7 @@ static void vcpu_set_itc(struct kvm_vcpu *vcpu, u64 val)
809 struct kvm_vcpu *v; 825 struct kvm_vcpu *v;
810 struct kvm *kvm; 826 struct kvm *kvm;
811 int i; 827 int i;
812 long itc_offset = val - ia64_getreg(_IA64_REG_AR_ITC); 828 long itc_offset = val - kvm_get_itc(vcpu);
813 unsigned long vitv = VCPU(vcpu, itv); 829 unsigned long vitv = VCPU(vcpu, itv);
814 830
815 kvm = (struct kvm *)KVM_VM_BASE; 831 kvm = (struct kvm *)KVM_VM_BASE;
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c
index 9eee5c04bacc..f4b4c899bb6c 100644
--- a/arch/ia64/kvm/vmm.c
+++ b/arch/ia64/kvm/vmm.c
@@ -30,15 +30,19 @@ MODULE_AUTHOR("Intel");
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
31 31
32extern char kvm_ia64_ivt; 32extern char kvm_ia64_ivt;
33extern char kvm_asm_mov_from_ar;
34extern char kvm_asm_mov_from_ar_sn2;
33extern fpswa_interface_t *vmm_fpswa_interface; 35extern fpswa_interface_t *vmm_fpswa_interface;
34 36
35long vmm_sanity = 1; 37long vmm_sanity = 1;
36 38
37struct kvm_vmm_info vmm_info = { 39struct kvm_vmm_info vmm_info = {
38 .module = THIS_MODULE, 40 .module = THIS_MODULE,
39 .vmm_entry = vmm_entry, 41 .vmm_entry = vmm_entry,
40 .tramp_entry = vmm_trampoline, 42 .tramp_entry = vmm_trampoline,
41 .vmm_ivt = (unsigned long)&kvm_ia64_ivt, 43 .vmm_ivt = (unsigned long)&kvm_ia64_ivt,
44 .patch_mov_ar = (unsigned long)&kvm_asm_mov_from_ar,
45 .patch_mov_ar_sn2 = (unsigned long)&kvm_asm_mov_from_ar_sn2,
42}; 46};
43 47
44static int __init kvm_vmm_init(void) 48static int __init kvm_vmm_init(void)
diff --git a/arch/ia64/kvm/vmm_ivt.S b/arch/ia64/kvm/vmm_ivt.S
index 3ef1a017a318..40920c630649 100644
--- a/arch/ia64/kvm/vmm_ivt.S
+++ b/arch/ia64/kvm/vmm_ivt.S
@@ -95,7 +95,7 @@ GLOBAL_ENTRY(kvm_vmm_panic)
95 ;; 95 ;;
96 srlz.i // guarantee that interruption collection is on 96 srlz.i // guarantee that interruption collection is on
97 ;; 97 ;;
98 //(p15) ssm psr.i // restore psr.i 98 (p15) ssm psr.i // restore psr.
99 addl r14=@gprel(ia64_leave_hypervisor),gp 99 addl r14=@gprel(ia64_leave_hypervisor),gp
100 ;; 100 ;;
101 KVM_SAVE_REST 101 KVM_SAVE_REST
@@ -249,7 +249,7 @@ ENTRY(kvm_break_fault)
249 ;; 249 ;;
250 srlz.i // guarantee that interruption collection is on 250 srlz.i // guarantee that interruption collection is on
251 ;; 251 ;;
252 //(p15)ssm psr.i // restore psr.i 252 (p15)ssm psr.i // restore psr.i
253 addl r14=@gprel(ia64_leave_hypervisor),gp 253 addl r14=@gprel(ia64_leave_hypervisor),gp
254 ;; 254 ;;
255 KVM_SAVE_REST 255 KVM_SAVE_REST
@@ -439,7 +439,7 @@ kvm_dispatch_vexirq:
439 ;; 439 ;;
440 srlz.i // guarantee that interruption collection is on 440 srlz.i // guarantee that interruption collection is on
441 ;; 441 ;;
442 //(p15) ssm psr.i // restore psr.i 442 (p15) ssm psr.i // restore psr.i
443 adds r3=8,r2 // set up second base pointer 443 adds r3=8,r2 // set up second base pointer
444 ;; 444 ;;
445 KVM_SAVE_REST 445 KVM_SAVE_REST
@@ -819,7 +819,7 @@ ENTRY(kvm_dtlb_miss_dispatch)
819 ;; 819 ;;
820 srlz.i // guarantee that interruption collection is on 820 srlz.i // guarantee that interruption collection is on
821 ;; 821 ;;
822 //(p15) ssm psr.i // restore psr.i 822 (p15) ssm psr.i // restore psr.i
823 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp 823 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp
824 ;; 824 ;;
825 KVM_SAVE_REST 825 KVM_SAVE_REST
@@ -842,7 +842,7 @@ ENTRY(kvm_itlb_miss_dispatch)
842 ;; 842 ;;
843 srlz.i // guarantee that interruption collection is on 843 srlz.i // guarantee that interruption collection is on
844 ;; 844 ;;
845 //(p15) ssm psr.i // restore psr.i 845 (p15) ssm psr.i // restore psr.i
846 addl r14=@gprel(ia64_leave_hypervisor),gp 846 addl r14=@gprel(ia64_leave_hypervisor),gp
847 ;; 847 ;;
848 KVM_SAVE_REST 848 KVM_SAVE_REST
@@ -871,7 +871,7 @@ ENTRY(kvm_dispatch_reflection)
871 ;; 871 ;;
872 srlz.i // guarantee that interruption collection is on 872 srlz.i // guarantee that interruption collection is on
873 ;; 873 ;;
874 //(p15) ssm psr.i // restore psr.i 874 (p15) ssm psr.i // restore psr.i
875 addl r14=@gprel(ia64_leave_hypervisor),gp 875 addl r14=@gprel(ia64_leave_hypervisor),gp
876 ;; 876 ;;
877 KVM_SAVE_REST 877 KVM_SAVE_REST
@@ -898,7 +898,7 @@ ENTRY(kvm_dispatch_virtualization_fault)
898 ;; 898 ;;
899 srlz.i // guarantee that interruption collection is on 899 srlz.i // guarantee that interruption collection is on
900 ;; 900 ;;
901 //(p15) ssm psr.i // restore psr.i 901 (p15) ssm psr.i // restore psr.i
902 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp 902 addl r14=@gprel(ia64_leave_hypervisor_prepare),gp
903 ;; 903 ;;
904 KVM_SAVE_REST 904 KVM_SAVE_REST
@@ -920,7 +920,7 @@ ENTRY(kvm_dispatch_interrupt)
920 ;; 920 ;;
921 srlz.i 921 srlz.i
922 ;; 922 ;;
923 //(p15) ssm psr.i 923 (p15) ssm psr.i
924 addl r14=@gprel(ia64_leave_hypervisor),gp 924 addl r14=@gprel(ia64_leave_hypervisor),gp
925 ;; 925 ;;
926 KVM_SAVE_REST 926 KVM_SAVE_REST
@@ -1333,7 +1333,7 @@ hostret = r24
1333 ;; 1333 ;;
1334(p7) srlz.i 1334(p7) srlz.i
1335 ;; 1335 ;;
1336//(p6) ssm psr.i 1336(p6) ssm psr.i
1337 ;; 1337 ;;
1338 mov rp=rpsave 1338 mov rp=rpsave
1339 mov ar.pfs=pfssave 1339 mov ar.pfs=pfssave
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index 2c2501f13159..4290a429bf7c 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -254,7 +254,8 @@ u64 guest_vhpt_lookup(u64 iha, u64 *pte)
254 "(p7) st8 [%2]=r9;;" 254 "(p7) st8 [%2]=r9;;"
255 "ssm psr.ic;;" 255 "ssm psr.ic;;"
256 "srlz.d;;" 256 "srlz.d;;"
257 /* "ssm psr.i;;" Once interrupts in vmm open, need fix*/ 257 "ssm psr.i;;"
258 "srlz.d;;"
258 : "=r"(ret) : "r"(iha), "r"(pte):"memory"); 259 : "=r"(ret) : "r"(iha), "r"(pte):"memory");
259 260
260 return ret; 261 return ret;
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 0ee085efbe29..2f724d2bf299 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -107,10 +107,10 @@ unsigned long bootmap_start;
107 * bootmap_start. This address must be page-aligned. 107 * bootmap_start. This address must be page-aligned.
108 */ 108 */
109static int __init 109static int __init
110find_bootmap_location (unsigned long start, unsigned long end, void *arg) 110find_bootmap_location (u64 start, u64 end, void *arg)
111{ 111{
112 unsigned long needed = *(unsigned long *)arg; 112 u64 needed = *(unsigned long *)arg;
113 unsigned long range_start, range_end, free_start; 113 u64 range_start, range_end, free_start;
114 int i; 114 int i;
115 115
116#if IGNORE_PFN0 116#if IGNORE_PFN0
@@ -229,8 +229,7 @@ find_memory (void)
229 alloc_per_cpu_data(); 229 alloc_per_cpu_data();
230} 230}
231 231
232static int 232static int count_pages(u64 start, u64 end, void *arg)
233count_pages (u64 start, u64 end, void *arg)
234{ 233{
235 unsigned long *count = arg; 234 unsigned long *count = arg;
236 235
diff --git a/arch/ia64/mm/extable.c b/arch/ia64/mm/extable.c
index 71c50dd8f870..c99a41e29fe8 100644
--- a/arch/ia64/mm/extable.c
+++ b/arch/ia64/mm/extable.c
@@ -8,7 +8,7 @@
8#include <linux/sort.h> 8#include <linux/sort.h>
9 9
10#include <asm/uaccess.h> 10#include <asm/uaccess.h>
11#include <asm/module.h> 11#include <linux/module.h>
12 12
13static int cmp_ex(const void *a, const void *b) 13static int cmp_ex(const void *a, const void *b)
14{ 14{
@@ -53,6 +53,32 @@ void sort_extable (struct exception_table_entry *start,
53 cmp_ex, swap_ex); 53 cmp_ex, swap_ex);
54} 54}
55 55
56static inline unsigned long ex_to_addr(const struct exception_table_entry *x)
57{
58 return (unsigned long)&x->addr + x->addr;
59}
60
61#ifdef CONFIG_MODULES
62/*
63 * Any entry referring to the module init will be at the beginning or
64 * the end.
65 */
66void trim_init_extable(struct module *m)
67{
68 /*trim the beginning*/
69 while (m->num_exentries &&
70 within_module_init(ex_to_addr(&m->extable[0]), m)) {
71 m->extable++;
72 m->num_exentries--;
73 }
74 /*trim the end*/
75 while (m->num_exentries &&
76 within_module_init(ex_to_addr(&m->extable[m->num_exentries-1]),
77 m))
78 m->num_exentries--;
79}
80#endif /* CONFIG_MODULES */
81
56const struct exception_table_entry * 82const struct exception_table_entry *
57search_extable (const struct exception_table_entry *first, 83search_extable (const struct exception_table_entry *first,
58 const struct exception_table_entry *last, 84 const struct exception_table_entry *last,
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 23088bed111e..19261a99e623 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -154,7 +154,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
154 * sure we exit gracefully rather than endlessly redo the 154 * sure we exit gracefully rather than endlessly redo the
155 * fault. 155 * fault.
156 */ 156 */
157 fault = handle_mm_fault(mm, vma, address, (mask & VM_WRITE) != 0); 157 fault = handle_mm_fault(mm, vma, address, (mask & VM_WRITE) ? FAULT_FLAG_WRITE : 0);
158 if (unlikely(fault & VM_FAULT_ERROR)) { 158 if (unlikely(fault & VM_FAULT_ERROR)) {
159 /* 159 /*
160 * We ran out of memory, or some other thing happened 160 * We ran out of memory, or some other thing happened
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index c0f3bee69042..b115b3bbf04a 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -422,8 +422,7 @@ retry_pte:
422 return hole_next_pfn - pgdat->node_start_pfn; 422 return hole_next_pfn - pgdat->node_start_pfn;
423} 423}
424 424
425int __init 425int __init create_mem_map_page_table(u64 start, u64 end, void *arg)
426create_mem_map_page_table (u64 start, u64 end, void *arg)
427{ 426{
428 unsigned long address, start_page, end_page; 427 unsigned long address, start_page, end_page;
429 struct page *map_start, *map_end; 428 struct page *map_start, *map_end;
@@ -469,7 +468,7 @@ struct memmap_init_callback_data {
469}; 468};
470 469
471static int __meminit 470static int __meminit
472virtual_memmap_init (u64 start, u64 end, void *arg) 471virtual_memmap_init(u64 start, u64 end, void *arg)
473{ 472{
474 struct memmap_init_callback_data *args; 473 struct memmap_init_callback_data *args;
475 struct page *map_start, *map_end; 474 struct page *map_start, *map_end;
@@ -531,8 +530,7 @@ ia64_pfn_valid (unsigned long pfn)
531} 530}
532EXPORT_SYMBOL(ia64_pfn_valid); 531EXPORT_SYMBOL(ia64_pfn_valid);
533 532
534int __init 533int __init find_largest_hole(u64 start, u64 end, void *arg)
535find_largest_hole (u64 start, u64 end, void *arg)
536{ 534{
537 u64 *max_gap = arg; 535 u64 *max_gap = arg;
538 536
@@ -548,8 +546,7 @@ find_largest_hole (u64 start, u64 end, void *arg)
548 546
549#endif /* CONFIG_VIRTUAL_MEM_MAP */ 547#endif /* CONFIG_VIRTUAL_MEM_MAP */
550 548
551int __init 549int __init register_active_ranges(u64 start, u64 len, int nid)
552register_active_ranges(u64 start, u64 len, int nid)
553{ 550{
554 u64 end = start + len; 551 u64 end = start + len;
555 552
@@ -567,7 +564,7 @@ register_active_ranges(u64 start, u64 len, int nid)
567} 564}
568 565
569static int __init 566static int __init
570count_reserved_pages (u64 start, u64 end, void *arg) 567count_reserved_pages(u64 start, u64 end, void *arg)
571{ 568{
572 unsigned long num_reserved = 0; 569 unsigned long num_reserved = 0;
573 unsigned long *count = arg; 570 unsigned long *count = arg;
@@ -580,7 +577,7 @@ count_reserved_pages (u64 start, u64 end, void *arg)
580} 577}
581 578
582int 579int
583find_max_min_low_pfn (unsigned long start, unsigned long end, void *arg) 580find_max_min_low_pfn (u64 start, u64 end, void *arg)
584{ 581{
585 unsigned long pfn_start, pfn_end; 582 unsigned long pfn_start, pfn_end;
586#ifdef CONFIG_FLATMEM 583#ifdef CONFIG_FLATMEM
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index b9f3d7bbb338..f426dc78d959 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -34,7 +34,7 @@
34#include <asm/tlb.h> 34#include <asm/tlb.h>
35 35
36static struct { 36static struct {
37 unsigned long mask; /* mask of supported purge page-sizes */ 37 u64 mask; /* mask of supported purge page-sizes */
38 unsigned long max_bits; /* log2 of largest supported purge page-size */ 38 unsigned long max_bits; /* log2 of largest supported purge page-size */
39} purge; 39} purge;
40 40
@@ -328,7 +328,7 @@ void __devinit
328ia64_tlb_init (void) 328ia64_tlb_init (void)
329{ 329{
330 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */ 330 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */
331 unsigned long tr_pgbits; 331 u64 tr_pgbits;
332 long status; 332 long status;
333 pal_vm_info_1_u_t vm_info_1; 333 pal_vm_info_1_u_t vm_info_1;
334 pal_vm_info_2_u_t vm_info_2; 334 pal_vm_info_2_u_t vm_info_2;
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 61f1af5c23c1..729298f4b234 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -163,7 +163,7 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
163{ 163{
164 struct resource *resource; 164 struct resource *resource;
165 char *name; 165 char *name;
166 u64 base, min, max, base_port; 166 unsigned long base, min, max, base_port;
167 unsigned int sparse = 0, space_nr, len; 167 unsigned int sparse = 0, space_nr, len;
168 168
169 resource = kzalloc(sizeof(*resource), GFP_KERNEL); 169 resource = kzalloc(sizeof(*resource), GFP_KERNEL);
@@ -292,7 +292,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
292 window->offset = offset; 292 window->offset = offset;
293 293
294 if (insert_resource(root, &window->resource)) { 294 if (insert_resource(root, &window->resource)) {
295 printk(KERN_ERR "alloc 0x%lx-0x%lx from %s for %s failed\n", 295 printk(KERN_ERR "alloc 0x%llx-0x%llx from %s for %s failed\n",
296 window->resource.start, window->resource.end, 296 window->resource.start, window->resource.end,
297 root->name, info->name); 297 root->name, info->name);
298 } 298 }
@@ -314,8 +314,8 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
314 (res->end - res->start < 16)) 314 (res->end - res->start < 16))
315 continue; 315 continue;
316 if (j >= PCI_BUS_NUM_RESOURCES) { 316 if (j >= PCI_BUS_NUM_RESOURCES) {
317 printk("Ignoring range [%lx-%lx] (%lx)\n", res->start, 317 printk("Ignoring range [%#llx-%#llx] (%lx)\n",
318 res->end, res->flags); 318 res->start, res->end, res->flags);
319 continue; 319 continue;
320 } 320 }
321 bus->resource[j++] = res; 321 bus->resource[j++] = res;
@@ -371,8 +371,6 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
371 * such quirk. So we just ignore the case now. 371 * such quirk. So we just ignore the case now.
372 */ 372 */
373 pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller); 373 pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller);
374 if (pbus)
375 pcibios_setup_root_windows(pbus, controller);
376 374
377 return pbus; 375 return pbus;
378 376
@@ -490,6 +488,8 @@ pcibios_fixup_bus (struct pci_bus *b)
490 if (b->self) { 488 if (b->self) {
491 pci_read_bridge_bases(b); 489 pci_read_bridge_bases(b);
492 pcibios_fixup_bridge_resources(b->self); 490 pcibios_fixup_bridge_resources(b->self);
491 } else {
492 pcibios_setup_root_windows(b, b->sysdata);
493 } 493 }
494 list_for_each_entry(dev, &b->devices, bus_list) 494 list_for_each_entry(dev, &b->devices, bus_list)
495 pcibios_fixup_device_resources(dev); 495 pcibios_fixup_device_resources(dev);
@@ -728,8 +728,8 @@ extern u8 pci_cache_line_size;
728 */ 728 */
729static void __init set_pci_cacheline_size(void) 729static void __init set_pci_cacheline_size(void)
730{ 730{
731 u64 levels, unique_caches; 731 unsigned long levels, unique_caches;
732 s64 status; 732 long status;
733 pal_cache_config_info_t cci; 733 pal_cache_config_info_t cci;
734 734
735 status = ia64_pal_cache_summary(&levels, &unique_caches); 735 status = ia64_pal_cache_summary(&levels, &unique_caches);
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index d0223abbbbd4..fd50ff94302b 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -40,7 +40,7 @@ struct sn_pcidev_match {
40/* 40/*
41 * Perform the early IO init in PROM. 41 * Perform the early IO init in PROM.
42 */ 42 */
43static s64 43static long
44sal_ioif_init(u64 *result) 44sal_ioif_init(u64 *result)
45{ 45{
46 struct ia64_sal_retval isrv = {0,0,0,0}; 46 struct ia64_sal_retval isrv = {0,0,0,0};
@@ -492,7 +492,7 @@ void __init
492sn_io_acpi_init(void) 492sn_io_acpi_init(void)
493{ 493{
494 u64 result; 494 u64 result;
495 s64 status; 495 long status;
496 496
497 /* SN Altix does not follow the IOSAPIC IRQ routing model */ 497 /* SN Altix does not follow the IOSAPIC IRQ routing model */
498 acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; 498 acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 57f280dd9def..76645cf6ac5d 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -342,7 +342,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
342 struct pcibus_bussoft *b = SN_PCIBUS_BUSSOFT(bus); 342 struct pcibus_bussoft *b = SN_PCIBUS_BUSSOFT(bus);
343 343
344 printk(KERN_WARNING "Device ASIC=%u XID=%u PBUSNUM=%u " 344 printk(KERN_WARNING "Device ASIC=%u XID=%u PBUSNUM=%u "
345 "L_IO=%lx L_MEM=%lx BASE=%lx\n", 345 "L_IO=%llx L_MEM=%llx BASE=%llx\n",
346 b->bs_asic_type, b->bs_xid, b->bs_persist_busnum, 346 b->bs_asic_type, b->bs_xid, b->bs_persist_busnum,
347 b->bs_legacy_io, b->bs_legacy_mem, b->bs_base); 347 b->bs_legacy_io, b->bs_legacy_mem, b->bs_base);
348 printk(KERN_WARNING "on node %d but only %d nodes online." 348 printk(KERN_WARNING "on node %d but only %d nodes online."
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 66fd705e82c0..40d6eeda1c4b 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -227,7 +227,7 @@ finish_up:
227 return new_irq_info; 227 return new_irq_info;
228} 228}
229 229
230static void sn_set_affinity_irq(unsigned int irq, const struct cpumask *mask) 230static int sn_set_affinity_irq(unsigned int irq, const struct cpumask *mask)
231{ 231{
232 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe; 232 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;
233 nasid_t nasid; 233 nasid_t nasid;
@@ -239,6 +239,8 @@ static void sn_set_affinity_irq(unsigned int irq, const struct cpumask *mask)
239 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe, 239 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe,
240 sn_irq_lh[irq], list) 240 sn_irq_lh[irq], list)
241 (void)sn_retarget_vector(sn_irq_info, nasid, slice); 241 (void)sn_retarget_vector(sn_irq_info, nasid, slice);
242
243 return 0;
242} 244}
243 245
244#ifdef CONFIG_SMP 246#ifdef CONFIG_SMP
@@ -293,13 +295,13 @@ unsigned int sn_local_vector_to_irq(u8 vector)
293void sn_irq_init(void) 295void sn_irq_init(void)
294{ 296{
295 int i; 297 int i;
296 irq_desc_t *base_desc = irq_desc; 298 struct irq_desc *base_desc = irq_desc;
297 299
298 ia64_first_device_vector = IA64_SN2_FIRST_DEVICE_VECTOR; 300 ia64_first_device_vector = IA64_SN2_FIRST_DEVICE_VECTOR;
299 ia64_last_device_vector = IA64_SN2_LAST_DEVICE_VECTOR; 301 ia64_last_device_vector = IA64_SN2_LAST_DEVICE_VECTOR;
300 302
301 for (i = 0; i < NR_IRQS; i++) { 303 for (i = 0; i < NR_IRQS; i++) {
302 if (base_desc[i].chip == &no_irq_type) { 304 if (base_desc[i].chip == &no_irq_chip) {
303 base_desc[i].chip = &irq_type_sn; 305 base_desc[i].chip = &irq_type_sn;
304 } 306 }
305 } 307 }
@@ -375,7 +377,7 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
375 int cpu = nasid_slice_to_cpuid(nasid, slice); 377 int cpu = nasid_slice_to_cpuid(nasid, slice);
376#ifdef CONFIG_SMP 378#ifdef CONFIG_SMP
377 int cpuphys; 379 int cpuphys;
378 irq_desc_t *desc; 380 struct irq_desc *desc;
379#endif 381#endif
380 382
381 pci_dev_get(pci_dev); 383 pci_dev_get(pci_dev);
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index 81e428943d73..fbbfb9701201 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -151,7 +151,7 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
151} 151}
152 152
153#ifdef CONFIG_SMP 153#ifdef CONFIG_SMP
154static void sn_set_msi_irq_affinity(unsigned int irq, 154static int sn_set_msi_irq_affinity(unsigned int irq,
155 const struct cpumask *cpu_mask) 155 const struct cpumask *cpu_mask)
156{ 156{
157 struct msi_msg msg; 157 struct msi_msg msg;
@@ -168,7 +168,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq,
168 cpu = cpumask_first(cpu_mask); 168 cpu = cpumask_first(cpu_mask);
169 sn_irq_info = sn_msi_info[irq].sn_irq_info; 169 sn_irq_info = sn_msi_info[irq].sn_irq_info;
170 if (sn_irq_info == NULL || sn_irq_info->irq_int_bit >= 0) 170 if (sn_irq_info == NULL || sn_irq_info->irq_int_bit >= 0)
171 return; 171 return -1;
172 172
173 /* 173 /*
174 * Release XIO resources for the old MSI PCI address 174 * Release XIO resources for the old MSI PCI address
@@ -189,7 +189,7 @@ static void sn_set_msi_irq_affinity(unsigned int irq,
189 new_irq_info = sn_retarget_vector(sn_irq_info, nasid, slice); 189 new_irq_info = sn_retarget_vector(sn_irq_info, nasid, slice);
190 sn_msi_info[irq].sn_irq_info = new_irq_info; 190 sn_msi_info[irq].sn_irq_info = new_irq_info;
191 if (new_irq_info == NULL) 191 if (new_irq_info == NULL)
192 return; 192 return -1;
193 193
194 /* 194 /*
195 * Map the xio address into bus space 195 * Map the xio address into bus space
@@ -206,6 +206,8 @@ static void sn_set_msi_irq_affinity(unsigned int irq,
206 206
207 write_msi_msg(irq, &msg); 207 write_msi_msg(irq, &msg);
208 cpumask_copy(irq_desc[irq].affinity, cpu_mask); 208 cpumask_copy(irq_desc[irq].affinity, cpu_mask);
209
210 return 0;
209} 211}
210#endif /* CONFIG_SMP */ 212#endif /* CONFIG_SMP */
211 213
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 9e6491cf72bd..4c7e74790958 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -414,7 +414,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
414 } 414 }
415 seq_printf(s, "partition %u %s local " 415 seq_printf(s, "partition %u %s local "
416 "shubtype %s, " 416 "shubtype %s, "
417 "nasid_mask 0x%016lx, " 417 "nasid_mask 0x%016llx, "
418 "nasid_bits %d:%d, " 418 "nasid_bits %d:%d, "
419 "system_size %d, " 419 "system_size %d, "
420 "sharing_size %d, " 420 "sharing_size %d, "
@@ -683,7 +683,7 @@ static int sn_hwperf_map_err(int hwperf_err)
683 * ioctl for "sn_hwperf" misc device 683 * ioctl for "sn_hwperf" misc device
684 */ 684 */
685static int 685static int
686sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, u64 arg) 686sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, unsigned long arg)
687{ 687{
688 struct sn_hwperf_ioctl_args a; 688 struct sn_hwperf_ioctl_args a;
689 struct cpuinfo_ia64 *cdata; 689 struct cpuinfo_ia64 *cdata;
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index 2526e5c783a4..c76d8dc3aea3 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -36,7 +36,7 @@ static int system_serial_number_open(struct inode *inode, struct file *file)
36 36
37static int licenseID_show(struct seq_file *s, void *p) 37static int licenseID_show(struct seq_file *s, void *p)
38{ 38{
39 seq_printf(s, "0x%lx\n", sn_partition_serial_number_val()); 39 seq_printf(s, "0x%llx\n", sn_partition_serial_number_val());
40 return 0; 40 return 0;
41} 41}
42 42
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 3f864238566d..c1bd1cfda327 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -368,7 +368,7 @@ static void tio_corelet_reset(nasid_t nasid, int corelet)
368static int is_fpga_tio(int nasid, int *bt) 368static int is_fpga_tio(int nasid, int *bt)
369{ 369{
370 u16 uninitialized_var(ioboard_type); /* GCC be quiet */ 370 u16 uninitialized_var(ioboard_type); /* GCC be quiet */
371 s64 rc; 371 long rc;
372 372
373 rc = ia64_sn_sysctl_ioboard_get(nasid, &ioboard_type); 373 rc = ia64_sn_sysctl_ioboard_get(nasid, &ioboard_type);
374 if (rc) { 374 if (rc) {
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index d876423e4e75..98b684928e12 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -90,7 +90,8 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size,
90 */ 90 */
91 node = pcibus_to_node(pdev->bus); 91 node = pcibus_to_node(pdev->bus);
92 if (likely(node >=0)) { 92 if (likely(node >=0)) {
93 struct page *p = alloc_pages_node(node, flags, get_order(size)); 93 struct page *p = alloc_pages_exact_node(node,
94 flags, get_order(size));
94 95
95 if (likely(p)) 96 if (likely(p))
96 cpuaddr = page_address(p); 97 cpuaddr = page_address(p);
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 2c676cc05418..d13e5a22a558 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -79,7 +79,7 @@ static int sal_pcibr_error_interrupt(struct pcibus_info *soft)
79 79
80u16 sn_ioboard_to_pci_bus(struct pci_bus *pci_bus) 80u16 sn_ioboard_to_pci_bus(struct pci_bus *pci_bus)
81{ 81{
82 s64 rc; 82 long rc;
83 u16 uninitialized_var(ioboard); /* GCC be quiet */ 83 u16 uninitialized_var(ioboard); /* GCC be quiet */
84 nasid_t nasid = NASID_GET(SN_PCIBUS_BUSSOFT(pci_bus)->bs_base); 84 nasid_t nasid = NASID_GET(SN_PCIBUS_BUSSOFT(pci_bus)->bs_base);
85 85
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 79165122501c..35b2a27d2e77 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -123,7 +123,7 @@ tioca_gart_init(struct tioca_kernel *tioca_kern)
123 123
124 if (!tmp) { 124 if (!tmp) {
125 printk(KERN_ERR "%s: Could not allocate " 125 printk(KERN_ERR "%s: Could not allocate "
126 "%lu bytes (order %d) for GART\n", 126 "%llu bytes (order %d) for GART\n",
127 __func__, 127 __func__,
128 tioca_kern->ca_gart_size, 128 tioca_kern->ca_gart_size,
129 get_order(tioca_kern->ca_gart_size)); 129 get_order(tioca_kern->ca_gart_size));
@@ -348,7 +348,7 @@ tioca_dma_d48(struct pci_dev *pdev, u64 paddr)
348 agp_dma_extn = __sn_readq_relaxed(&ca_base->ca_agp_dma_addr_extn); 348 agp_dma_extn = __sn_readq_relaxed(&ca_base->ca_agp_dma_addr_extn);
349 if (node_upper != (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT)) { 349 if (node_upper != (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT)) {
350 printk(KERN_ERR "%s: coretalk upper node (%u) " 350 printk(KERN_ERR "%s: coretalk upper node (%u) "
351 "mismatch with ca_agp_dma_addr_extn (%lu)\n", 351 "mismatch with ca_agp_dma_addr_extn (%llu)\n",
352 __func__, 352 __func__,
353 node_upper, (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT)); 353 node_upper, (agp_dma_extn >> CA_AGP_DMA_NODE_ID_SHFT));
354 return 0; 354 return 0;
@@ -367,7 +367,7 @@ tioca_dma_d48(struct pci_dev *pdev, u64 paddr)
367 * dma_addr_t is guaranteed to be contiguous in CA bus space. 367 * dma_addr_t is guaranteed to be contiguous in CA bus space.
368 */ 368 */
369static dma_addr_t 369static dma_addr_t
370tioca_dma_mapped(struct pci_dev *pdev, u64 paddr, size_t req_size) 370tioca_dma_mapped(struct pci_dev *pdev, unsigned long paddr, size_t req_size)
371{ 371{
372 int i, ps, ps_shift, entry, entries, mapsize, last_entry; 372 int i, ps, ps_shift, entry, entries, mapsize, last_entry;
373 u64 xio_addr, end_xio_addr; 373 u64 xio_addr, end_xio_addr;
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index 94e584527f48..012f3b82ee55 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -493,7 +493,7 @@ tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
493 493
494 if (&map->ce_dmamap_list == &ce_kern->ce_dmamap_list) { 494 if (&map->ce_dmamap_list == &ce_kern->ce_dmamap_list) {
495 printk(KERN_WARNING 495 printk(KERN_WARNING
496 "%s: %s - no map found for bus_addr 0x%lx\n", 496 "%s: %s - no map found for bus_addr 0x%llx\n",
497 __func__, pci_name(pdev), bus_addr); 497 __func__, pci_name(pdev), bus_addr);
498 } else if (--map->refcnt == 0) { 498 } else if (--map->refcnt == 0) {
499 for (i = 0; i < map->ate_count; i++) { 499 for (i = 0; i < map->ate_count; i++) {
@@ -642,7 +642,7 @@ dma_map_done:
642 * in the address. 642 * in the address.
643 */ 643 */
644static u64 644static u64
645tioce_dma(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags) 645tioce_dma(struct pci_dev *pdev, unsigned long paddr, size_t byte_count, int dma_flags)
646{ 646{
647 return tioce_do_dma_map(pdev, paddr, byte_count, 0, dma_flags); 647 return tioce_do_dma_map(pdev, paddr, byte_count, 0, dma_flags);
648} 648}
@@ -657,7 +657,7 @@ tioce_dma(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
657 * in the address. 657 * in the address.
658 */ 658 */
659static u64 659static u64
660tioce_dma_consistent(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags) 660tioce_dma_consistent(struct pci_dev *pdev, unsigned long paddr, size_t byte_count, int dma_flags)
661{ 661{
662 return tioce_do_dma_map(pdev, paddr, byte_count, 1, dma_flags); 662 return tioce_do_dma_map(pdev, paddr, byte_count, 1, dma_flags);
663} 663}
diff --git a/arch/ia64/xen/irq_xen.c b/arch/ia64/xen/irq_xen.c
index af93aadb68bb..f042e192d2fe 100644
--- a/arch/ia64/xen/irq_xen.c
+++ b/arch/ia64/xen/irq_xen.c
@@ -138,7 +138,7 @@ static void
138__xen_register_percpu_irq(unsigned int cpu, unsigned int vec, 138__xen_register_percpu_irq(unsigned int cpu, unsigned int vec,
139 struct irqaction *action, int save) 139 struct irqaction *action, int save)
140{ 140{
141 irq_desc_t *desc; 141 struct irq_desc *desc;
142 int irq = 0; 142 int irq = 0;
143 143
144 if (xen_slab_ready) { 144 if (xen_slab_ready) {