aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/oprofile/common.c2
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/common/Kconfig2
-rw-r--r--arch/arm/common/sa1111.c4
-rw-r--r--arch/arm/configs/trizeps4_defconfig1
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h2
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig5
-rw-r--r--arch/arm/mach-kirkwood/common.c35
-rw-r--r--arch/arm/mach-kirkwood/common.h2
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c11
-rw-r--r--arch/arm/mach-mv78xx0/db78x00-bp-setup.c5
-rw-r--r--arch/arm/mach-orion5x/common.c38
-rw-r--r--arch/arm/mach-orion5x/common.h2
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c11
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c11
-rw-r--r--arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c11
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c11
-rw-r--r--arch/arm/mach-pxa/Kconfig1
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-pxa/include/mach/spitz.h2
-rw-r--r--arch/arm/mach-pxa/pwm.c2
-rw-r--r--arch/arm/mach-pxa/trizeps4.c2
-rw-r--r--arch/arm/mach-s3c2443/clock.c3
-rw-r--r--arch/arm/mm/cache-v4.S6
-rw-r--r--arch/arm/plat-s3c24xx/pwm-clock.c2
-rw-r--r--arch/arm/plat-s3c24xx/pwm.c12
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/ia64/Kconfig50
-rw-r--r--arch/ia64/Makefile3
-rw-r--r--arch/ia64/configs/generic_defconfig2
-rw-r--r--arch/ia64/configs/tiger_defconfig2
-rw-r--r--arch/ia64/dig/Makefile5
-rw-r--r--arch/ia64/dig/dig_vtd_iommu.c59
-rw-r--r--arch/ia64/dig/machvec_vtd.c3
-rw-r--r--arch/ia64/ia32/ia32_entry.S11
-rw-r--r--arch/ia64/ia32/sys_ia32.c106
-rw-r--r--arch/ia64/include/asm/break.h9
-rw-r--r--arch/ia64/include/asm/cacheflush.h2
-rw-r--r--arch/ia64/include/asm/device.h3
-rw-r--r--arch/ia64/include/asm/dma-mapping.h50
-rw-r--r--arch/ia64/include/asm/iommu.h16
-rw-r--r--arch/ia64/include/asm/kregs.h2
-rw-r--r--arch/ia64/include/asm/machvec.h4
-rw-r--r--arch/ia64/include/asm/machvec_dig_vtd.h38
-rw-r--r--arch/ia64/include/asm/machvec_init.h1
-rw-r--r--arch/ia64/include/asm/machvec_xen.h22
-rw-r--r--arch/ia64/include/asm/meminit.h3
-rw-r--r--arch/ia64/include/asm/native/inst.h10
-rw-r--r--arch/ia64/include/asm/native/pvchk_inst.h263
-rw-r--r--arch/ia64/include/asm/paravirt.h4
-rw-r--r--arch/ia64/include/asm/pci.h3
-rw-r--r--arch/ia64/include/asm/ptrace.h8
-rw-r--r--arch/ia64/include/asm/pvclock-abi.h48
-rw-r--r--arch/ia64/include/asm/swiotlb.h56
-rw-r--r--arch/ia64/include/asm/sync_bitops.h51
-rw-r--r--arch/ia64/include/asm/syscall.h163
-rw-r--r--arch/ia64/include/asm/thread_info.h3
-rw-r--r--arch/ia64/include/asm/timex.h2
-rw-r--r--arch/ia64/include/asm/unistd.h1
-rw-r--r--arch/ia64/include/asm/xen/events.h50
-rw-r--r--arch/ia64/include/asm/xen/grant_table.h29
-rw-r--r--arch/ia64/include/asm/xen/hypercall.h265
-rw-r--r--arch/ia64/include/asm/xen/hypervisor.h89
-rw-r--r--arch/ia64/include/asm/xen/inst.h458
-rw-r--r--arch/ia64/include/asm/xen/interface.h346
-rw-r--r--arch/ia64/include/asm/xen/irq.h44
-rw-r--r--arch/ia64/include/asm/xen/minstate.h134
-rw-r--r--arch/ia64/include/asm/xen/page.h65
-rw-r--r--arch/ia64/include/asm/xen/privop.h129
-rw-r--r--arch/ia64/include/asm/xen/xcom_hcall.h51
-rw-r--r--arch/ia64/include/asm/xen/xencomm.h42
-rw-r--r--arch/ia64/kernel/Makefile22
-rw-r--r--arch/ia64/kernel/acpi.c22
-rw-r--r--arch/ia64/kernel/asm-offsets.c31
-rw-r--r--arch/ia64/kernel/entry.S5
-rw-r--r--arch/ia64/kernel/ivt.S6
-rw-r--r--arch/ia64/kernel/msi_ia64.c80
-rw-r--r--arch/ia64/kernel/nr-irqs.c1
-rw-r--r--arch/ia64/kernel/paravirt.c2
-rw-r--r--arch/ia64/kernel/paravirt_inst.h4
-rw-r--r--arch/ia64/kernel/pci-dma.c129
-rw-r--r--arch/ia64/kernel/pci-swiotlb.c46
-rw-r--r--arch/ia64/kernel/perfmon.c7
-rw-r--r--arch/ia64/kernel/process.c22
-rw-r--r--arch/ia64/kernel/ptrace.c112
-rw-r--r--arch/ia64/kernel/setup.c42
-rw-r--r--arch/ia64/kernel/signal.c8
-rw-r--r--arch/ia64/lib/flush.S55
-rw-r--r--arch/ia64/mm/tlb.c8
-rw-r--r--arch/ia64/oprofile/init.c4
-rw-r--r--arch/ia64/oprofile/perfmon.c4
-rw-r--r--arch/ia64/scripts/pvcheck.sed32
-rw-r--r--arch/ia64/xen/Kconfig26
-rw-r--r--arch/ia64/xen/Makefile22
-rw-r--r--arch/ia64/xen/grant-table.c155
-rw-r--r--arch/ia64/xen/hypercall.S91
-rw-r--r--arch/ia64/xen/hypervisor.c96
-rw-r--r--arch/ia64/xen/irq_xen.c435
-rw-r--r--arch/ia64/xen/irq_xen.h34
-rw-r--r--arch/ia64/xen/machvec.c4
-rw-r--r--arch/ia64/xen/suspend.c64
-rw-r--r--arch/ia64/xen/time.c213
-rw-r--r--arch/ia64/xen/time.h24
-rw-r--r--arch/ia64/xen/xcom_hcall.c441
-rw-r--r--arch/ia64/xen/xen_pv_ops.c364
-rw-r--r--arch/ia64/xen/xencomm.c105
-rw-r--r--arch/ia64/xen/xenivt.S52
-rw-r--r--arch/ia64/xen/xensetup.S83
-rw-r--r--arch/m32r/oprofile/init.c2
-rw-r--r--arch/mips/oprofile/common.c2
-rw-r--r--arch/mips/oprofile/op_impl.h2
-rw-r--r--arch/mips/oprofile/op_model_rm9000.c2
-rw-r--r--arch/parisc/oprofile/init.c2
-rw-r--r--arch/powerpc/Kconfig13
-rw-r--r--arch/powerpc/boot/Makefile7
-rw-r--r--arch/powerpc/boot/addnote.c41
-rw-r--r--arch/powerpc/boot/cuboot-52xx.c4
-rw-r--r--arch/powerpc/boot/cuboot-acadia.c174
-rw-r--r--arch/powerpc/boot/dts/acadia.dts224
-rw-r--r--arch/powerpc/boot/dts/hcu4.dts168
-rw-r--r--arch/powerpc/boot/dts/mpc8315erdb.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts16
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitxgp.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8377_rdb.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8378_rdb.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8379_rdb.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dts12
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dts27
-rw-r--r--arch/powerpc/boot/libfdt-wrapper.c22
-rw-r--r--arch/powerpc/boot/main.c14
-rw-r--r--arch/powerpc/boot/ops.h6
-rw-r--r--arch/powerpc/boot/string.S4
-rwxr-xr-xarch/powerpc/boot/wrapper5
-rw-r--r--arch/powerpc/configs/40x/acadia_defconfig921
-rw-r--r--arch/powerpc/configs/40x/hcu4_defconfig929
-rw-r--r--arch/powerpc/include/asm/kdump.h17
-rw-r--r--arch/powerpc/include/asm/page.h1
-rw-r--r--arch/powerpc/kernel/cputable.c13
-rw-r--r--arch/powerpc/kernel/crash_dump.c2
-rw-r--r--arch/powerpc/kernel/head_64.S39
-rw-r--r--arch/powerpc/kernel/iommu.c69
-rw-r--r--arch/powerpc/kernel/machine_kexec.c2
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c26
-rw-r--r--arch/powerpc/kernel/misc_64.S9
-rw-r--r--arch/powerpc/kernel/pci-common.c3
-rw-r--r--arch/powerpc/kernel/prom_init.c61
-rw-r--r--arch/powerpc/kernel/prom_init_check.sh2
-rw-r--r--arch/powerpc/kernel/setup-common.c7
-rw-r--r--arch/powerpc/kernel/signal_64.c2
-rw-r--r--arch/powerpc/kernel/udbg_16550.c2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c6
-rw-r--r--arch/powerpc/mm/numa.c21
-rw-r--r--arch/powerpc/oprofile/cell/pr_util.h13
-rw-r--r--arch/powerpc/oprofile/cell/spu_profiler.c4
-rw-r--r--arch/powerpc/oprofile/cell/spu_task_sync.c236
-rw-r--r--arch/powerpc/oprofile/op_model_cell.c2
-rw-r--r--arch/powerpc/platforms/40x/Kconfig38
-rw-r--r--arch/powerpc/platforms/40x/Makefile2
-rw-r--r--arch/powerpc/platforms/40x/hcu4.c61
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c80
-rw-r--r--arch/powerpc/platforms/44x/Kconfig8
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c7
-rw-r--r--arch/powerpc/platforms/85xx/ksi8560.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c4
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c4
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c4
-rw-r--r--arch/powerpc/platforms/85xx/stx_gp3.c4
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c4
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c2
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c2
-rw-r--r--arch/powerpc/platforms/86xx/sbc8641d.c2
-rw-r--r--arch/powerpc/platforms/cell/ras.c6
-rw-r--r--arch/powerpc/platforms/cell/smp.c10
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c155
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c3
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c24
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sputrace.c37
-rw-r--r--arch/powerpc/platforms/embedded6xx/c2k.c3
-rw-r--r--arch/powerpc/platforms/embedded6xx/prpmc2800.c3
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c6
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c6
-rw-r--r--arch/powerpc/platforms/pseries/smp.c13
-rw-r--r--arch/powerpc/sysdev/Makefile1
-rw-r--r--arch/powerpc/sysdev/ppc4xx_gpio.c217
-rw-r--r--arch/sparc/oprofile/init.c2
-rw-r--r--arch/sparc64/oprofile/init.c2
-rw-r--r--arch/x86/kernel/amd_iommu_init.c2
-rw-r--r--arch/x86/kernel/irq.c4
-rw-r--r--arch/x86/kernel/pci-dma.c16
-rw-r--r--arch/x86/oprofile/backtrace.c3
-rw-r--r--arch/x86/oprofile/nmi_int.c173
-rw-r--r--arch/x86/oprofile/op_counter.h18
-rw-r--r--arch/x86/oprofile/op_model_amd.c59
-rw-r--r--arch/x86/oprofile/op_model_p4.c32
-rw-r--r--arch/x86/oprofile/op_model_ppro.c120
-rw-r--r--arch/x86/oprofile/op_x86_model.h13
-rw-r--r--arch/xtensa/Kconfig7
-rw-r--r--arch/xtensa/Makefile1
-rw-r--r--arch/xtensa/kernel/irq.c2
-rw-r--r--arch/xtensa/platforms/iss/network.c2
207 files changed, 9336 insertions, 769 deletions
diff --git a/arch/alpha/oprofile/common.c b/arch/alpha/oprofile/common.c
index 7c3d5ec6ec67..bd8ac533a504 100644
--- a/arch/alpha/oprofile/common.c
+++ b/arch/alpha/oprofile/common.c
@@ -106,7 +106,7 @@ op_axp_stop(void)
106} 106}
107 107
108static int 108static int
109op_axp_create_files(struct super_block * sb, struct dentry * root) 109op_axp_create_files(struct super_block *sb, struct dentry *root)
110{ 110{
111 int i; 111 int i;
112 112
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index df39d20f7425..f504c801792f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -356,7 +356,7 @@ config ARCH_IXP4XX
356 select GENERIC_GPIO 356 select GENERIC_GPIO
357 select GENERIC_TIME 357 select GENERIC_TIME
358 select GENERIC_CLOCKEVENTS 358 select GENERIC_CLOCKEVENTS
359 select ZONE_DMA if PCI 359 select DMABOUNCE if PCI
360 help 360 help
361 Support for Intel's IXP4XX (XScale) family of processors. 361 Support for Intel's IXP4XX (XScale) family of processors.
362 362
@@ -1256,6 +1256,8 @@ source "drivers/hid/Kconfig"
1256 1256
1257source "drivers/usb/Kconfig" 1257source "drivers/usb/Kconfig"
1258 1258
1259source "drivers/uwb/Kconfig"
1260
1259source "drivers/mmc/Kconfig" 1261source "drivers/mmc/Kconfig"
1260 1262
1261source "drivers/memstick/Kconfig" 1263source "drivers/memstick/Kconfig"
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 2e32acca02fb..86b5e6982660 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -13,10 +13,10 @@ config ICST307
13config SA1111 13config SA1111
14 bool 14 bool
15 select DMABOUNCE if !ARCH_PXA 15 select DMABOUNCE if !ARCH_PXA
16 select ZONE_DMA if !ARCH_PXA
17 16
18config DMABOUNCE 17config DMABOUNCE
19 bool 18 bool
19 select ZONE_DMA
20 20
21config TIMER_ACORN 21config TIMER_ACORN
22 bool 22 bool
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index fb86f248aab8..47ccec95f3e8 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -581,6 +581,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
581 goto out; 581 goto out;
582 } 582 }
583 583
584#ifdef CONFIG_DMABOUNCE
584 /* 585 /*
585 * If the parent device has a DMA mask associated with it, 586 * If the parent device has a DMA mask associated with it,
586 * propagate it down to the children. 587 * propagate it down to the children.
@@ -598,6 +599,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
598 } 599 }
599 } 600 }
600 } 601 }
602#endif
601 603
602out: 604out:
603 return ret; 605 return ret;
@@ -937,7 +939,7 @@ static int sa1111_resume(struct platform_device *dev)
937#define sa1111_resume NULL 939#define sa1111_resume NULL
938#endif 940#endif
939 941
940static int sa1111_probe(struct platform_device *pdev) 942static int __devinit sa1111_probe(struct platform_device *pdev)
941{ 943{
942 struct resource *mem; 944 struct resource *mem;
943 int irq; 945 int irq;
diff --git a/arch/arm/configs/trizeps4_defconfig b/arch/arm/configs/trizeps4_defconfig
index 8b7a431a8bfc..9033d147f052 100644
--- a/arch/arm/configs/trizeps4_defconfig
+++ b/arch/arm/configs/trizeps4_defconfig
@@ -147,6 +147,7 @@ CONFIG_ARCH_PXA=y
147# CONFIG_MACH_MAINSTONE is not set 147# CONFIG_MACH_MAINSTONE is not set
148# CONFIG_ARCH_PXA_IDP is not set 148# CONFIG_ARCH_PXA_IDP is not set
149# CONFIG_PXA_SHARPSL is not set 149# CONFIG_PXA_SHARPSL is not set
150CONFIG_TRIZEPS_PXA=y
150CONFIG_MACH_TRIZEPS4=y 151CONFIG_MACH_TRIZEPS4=y
151CONFIG_MACH_TRIZEPS4_CONXS=y 152CONFIG_MACH_TRIZEPS4_CONXS=y
152# CONFIG_MACH_TRIZEPS4_ANY is not set 153# CONFIG_MACH_TRIZEPS4_ANY is not set
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
index 71c2fa70c8e8..98ec30c97bbe 100644
--- a/arch/arm/mach-clps711x/include/mach/memory.h
+++ b/arch/arm/mach-clps711x/include/mach/memory.h
@@ -89,6 +89,8 @@
89 * node 3: 0xd8000000 - 0xdfffffff 89 * node 3: 0xd8000000 - 0xdfffffff
90 */ 90 */
91#define NODE_MEM_SIZE_BITS 24 91#define NODE_MEM_SIZE_BITS 24
92#define SECTION_SIZE_BITS 24
93#define MAX_PHYSMEM_BITS 32
92 94
93#endif 95#endif
94 96
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index db8b5fe06c0d..2c5a02b8520e 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -167,11 +167,6 @@ config MACH_GTWX5715
167 167
168comment "IXP4xx Options" 168comment "IXP4xx Options"
169 169
170config DMABOUNCE
171 bool
172 default y
173 depends on PCI
174
175config IXP4XX_INDIRECT_PCI 170config IXP4XX_INDIRECT_PCI
176 bool "Use indirect PCI memory access" 171 bool "Use indirect PCI memory access"
177 depends on PCI 172 depends on PCI
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 85cad05d8c5b..0bb1fbd84ccb 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -16,6 +16,7 @@
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
18#include <linux/spi/orion_spi.h> 18#include <linux/spi/orion_spi.h>
19#include <net/dsa.h>
19#include <asm/page.h> 20#include <asm/page.h>
20#include <asm/timex.h> 21#include <asm/timex.h>
21#include <asm/mach/map.h> 22#include <asm/mach/map.h>
@@ -152,6 +153,40 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
152 153
153 154
154/***************************************************************************** 155/*****************************************************************************
156 * Ethernet switch
157 ****************************************************************************/
158static struct resource kirkwood_switch_resources[] = {
159 {
160 .start = 0,
161 .end = 0,
162 .flags = IORESOURCE_IRQ,
163 },
164};
165
166static struct platform_device kirkwood_switch_device = {
167 .name = "dsa",
168 .id = 0,
169 .num_resources = 0,
170 .resource = kirkwood_switch_resources,
171};
172
173void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
174{
175 if (irq != NO_IRQ) {
176 kirkwood_switch_resources[0].start = irq;
177 kirkwood_switch_resources[0].end = irq;
178 kirkwood_switch_device.num_resources = 1;
179 }
180
181 d->mii_bus = &kirkwood_ge00_shared.dev;
182 d->netdev = &kirkwood_ge00.dev;
183 kirkwood_switch_device.dev.platform_data = d;
184
185 platform_device_register(&kirkwood_switch_device);
186}
187
188
189/*****************************************************************************
155 * SoC RTC 190 * SoC RTC
156 ****************************************************************************/ 191 ****************************************************************************/
157static struct resource kirkwood_rtc_resource = { 192static struct resource kirkwood_rtc_resource = {
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 8fa0f6a27635..5774632a67e3 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -11,6 +11,7 @@
11#ifndef __ARCH_KIRKWOOD_COMMON_H 11#ifndef __ARCH_KIRKWOOD_COMMON_H
12#define __ARCH_KIRKWOOD_COMMON_H 12#define __ARCH_KIRKWOOD_COMMON_H
13 13
14struct dsa_platform_data;
14struct mv643xx_eth_platform_data; 15struct mv643xx_eth_platform_data;
15struct mv_sata_platform_data; 16struct mv_sata_platform_data;
16 17
@@ -29,6 +30,7 @@ void kirkwood_pcie_id(u32 *dev, u32 *rev);
29 30
30void kirkwood_ehci_init(void); 31void kirkwood_ehci_init(void);
31void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data); 32void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data);
33void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq);
32void kirkwood_pcie_init(void); 34void kirkwood_pcie_init(void);
33void kirkwood_rtc_init(void); 35void kirkwood_rtc_init(void);
34void kirkwood_sata_init(struct mv_sata_platform_data *sata_data); 36void kirkwood_sata_init(struct mv_sata_platform_data *sata_data);
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
index f785093e433f..175054abd630 100644
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -19,6 +19,7 @@
19#include <linux/ata_platform.h> 19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h> 20#include <linux/mv643xx_eth.h>
21#include <linux/ethtool.h> 21#include <linux/ethtool.h>
22#include <net/dsa.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
@@ -74,6 +75,15 @@ static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
74 .duplex = DUPLEX_FULL, 75 .duplex = DUPLEX_FULL,
75}; 76};
76 77
78static struct dsa_platform_data rd88f6281_switch_data = {
79 .port_names[0] = "lan1",
80 .port_names[1] = "lan2",
81 .port_names[2] = "lan3",
82 .port_names[3] = "lan4",
83 .port_names[4] = "wan",
84 .port_names[5] = "cpu",
85};
86
77static struct mv_sata_platform_data rd88f6281_sata_data = { 87static struct mv_sata_platform_data rd88f6281_sata_data = {
78 .n_ports = 2, 88 .n_ports = 2,
79}; 89};
@@ -87,6 +97,7 @@ static void __init rd88f6281_init(void)
87 97
88 kirkwood_ehci_init(); 98 kirkwood_ehci_init();
89 kirkwood_ge00_init(&rd88f6281_ge00_data); 99 kirkwood_ge00_init(&rd88f6281_ge00_data);
100 kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ);
90 kirkwood_rtc_init(); 101 kirkwood_rtc_init();
91 kirkwood_sata_init(&rd88f6281_sata_data); 102 kirkwood_sata_init(&rd88f6281_sata_data);
92 kirkwood_uart0_init(); 103 kirkwood_uart0_init();
diff --git a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
index 49f434c39eb7..2e285bbb7bbd 100644
--- a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
+++ b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
@@ -13,6 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/ata_platform.h> 14#include <linux/ata_platform.h>
15#include <linux/mv643xx_eth.h> 15#include <linux/mv643xx_eth.h>
16#include <linux/ethtool.h>
16#include <mach/mv78xx0.h> 17#include <mach/mv78xx0.h>
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
@@ -28,10 +29,14 @@ static struct mv643xx_eth_platform_data db78x00_ge01_data = {
28 29
29static struct mv643xx_eth_platform_data db78x00_ge10_data = { 30static struct mv643xx_eth_platform_data db78x00_ge10_data = {
30 .phy_addr = MV643XX_ETH_PHY_NONE, 31 .phy_addr = MV643XX_ETH_PHY_NONE,
32 .speed = SPEED_1000,
33 .duplex = DUPLEX_FULL,
31}; 34};
32 35
33static struct mv643xx_eth_platform_data db78x00_ge11_data = { 36static struct mv643xx_eth_platform_data db78x00_ge11_data = {
34 .phy_addr = MV643XX_ETH_PHY_NONE, 37 .phy_addr = MV643XX_ETH_PHY_NONE,
38 .speed = SPEED_1000,
39 .duplex = DUPLEX_FULL,
35}; 40};
36 41
37static struct mv_sata_platform_data db78x00_sata_data = { 42static struct mv_sata_platform_data db78x00_sata_data = {
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 9625ef5975d0..437065c25c9c 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -19,6 +19,7 @@
19#include <linux/mv643xx_i2c.h> 19#include <linux/mv643xx_i2c.h>
20#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
21#include <linux/spi/orion_spi.h> 21#include <linux/spi/orion_spi.h>
22#include <net/dsa.h>
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/timex.h> 25#include <asm/timex.h>
@@ -198,6 +199,40 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
198 199
199 200
200/***************************************************************************** 201/*****************************************************************************
202 * Ethernet switch
203 ****************************************************************************/
204static struct resource orion5x_switch_resources[] = {
205 {
206 .start = 0,
207 .end = 0,
208 .flags = IORESOURCE_IRQ,
209 },
210};
211
212static struct platform_device orion5x_switch_device = {
213 .name = "dsa",
214 .id = 0,
215 .num_resources = 0,
216 .resource = orion5x_switch_resources,
217};
218
219void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
220{
221 if (irq != NO_IRQ) {
222 orion5x_switch_resources[0].start = irq;
223 orion5x_switch_resources[0].end = irq;
224 orion5x_switch_device.num_resources = 1;
225 }
226
227 d->mii_bus = &orion5x_eth_shared.dev;
228 d->netdev = &orion5x_eth.dev;
229 orion5x_switch_device.dev.platform_data = d;
230
231 platform_device_register(&orion5x_switch_device);
232}
233
234
235/*****************************************************************************
201 * I2C 236 * I2C
202 ****************************************************************************/ 237 ****************************************************************************/
203static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = { 238static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
@@ -275,7 +310,8 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
275 * SPI 310 * SPI
276 ****************************************************************************/ 311 ****************************************************************************/
277static struct orion_spi_info orion5x_spi_plat_data = { 312static struct orion_spi_info orion5x_spi_plat_data = {
278 .tclk = 0, 313 .tclk = 0,
314 .enable_clock_fix = 1,
279}; 315};
280 316
281static struct resource orion5x_spi_resources[] = { 317static struct resource orion5x_spi_resources[] = {
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index 1f8b2da676a5..a000c7c6ee96 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -1,6 +1,7 @@
1#ifndef __ARCH_ORION5X_COMMON_H 1#ifndef __ARCH_ORION5X_COMMON_H
2#define __ARCH_ORION5X_COMMON_H 2#define __ARCH_ORION5X_COMMON_H
3 3
4struct dsa_platform_data;
4struct mv643xx_eth_platform_data; 5struct mv643xx_eth_platform_data;
5struct mv_sata_platform_data; 6struct mv_sata_platform_data;
6 7
@@ -29,6 +30,7 @@ void orion5x_setup_pcie_wa_win(u32 base, u32 size);
29void orion5x_ehci0_init(void); 30void orion5x_ehci0_init(void);
30void orion5x_ehci1_init(void); 31void orion5x_ehci1_init(void);
31void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data); 32void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
33void orion5x_eth_switch_init(struct dsa_platform_data *d, int irq);
32void orion5x_i2c_init(void); 34void orion5x_i2c_init(void);
33void orion5x_sata_init(struct mv_sata_platform_data *sata_data); 35void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
34void orion5x_spi_init(void); 36void orion5x_spi_init(void);
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 500cdadaf09c..15f53235ee30 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -16,6 +16,7 @@
16#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/ethtool.h> 18#include <linux/ethtool.h>
19#include <net/dsa.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/gpio.h> 21#include <asm/gpio.h>
21#include <asm/leds.h> 22#include <asm/leds.h>
@@ -93,6 +94,15 @@ static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
93 .duplex = DUPLEX_FULL, 94 .duplex = DUPLEX_FULL,
94}; 95};
95 96
97static struct dsa_platform_data rd88f5181l_fxo_switch_data = {
98 .port_names[0] = "lan2",
99 .port_names[1] = "lan1",
100 .port_names[2] = "wan",
101 .port_names[3] = "cpu",
102 .port_names[5] = "lan4",
103 .port_names[7] = "lan3",
104};
105
96static void __init rd88f5181l_fxo_init(void) 106static void __init rd88f5181l_fxo_init(void)
97{ 107{
98 /* 108 /*
@@ -107,6 +117,7 @@ static void __init rd88f5181l_fxo_init(void)
107 */ 117 */
108 orion5x_ehci0_init(); 118 orion5x_ehci0_init();
109 orion5x_eth_init(&rd88f5181l_fxo_eth_data); 119 orion5x_eth_init(&rd88f5181l_fxo_eth_data);
120 orion5x_eth_switch_init(&rd88f5181l_fxo_switch_data, NO_IRQ);
110 orion5x_uart0_init(); 121 orion5x_uart0_init();
111 122
112 orion5x_setup_dev_boot_win(RD88F5181L_FXO_NOR_BOOT_BASE, 123 orion5x_setup_dev_boot_win(RD88F5181L_FXO_NOR_BOOT_BASE,
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index ebde81416499..8ad3934399d4 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -17,6 +17,7 @@
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/ethtool.h> 18#include <linux/ethtool.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <net/dsa.h>
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21#include <asm/gpio.h> 22#include <asm/gpio.h>
22#include <asm/leds.h> 23#include <asm/leds.h>
@@ -94,6 +95,15 @@ static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
94 .duplex = DUPLEX_FULL, 95 .duplex = DUPLEX_FULL,
95}; 96};
96 97
98static struct dsa_platform_data rd88f5181l_ge_switch_data = {
99 .port_names[0] = "lan2",
100 .port_names[1] = "lan1",
101 .port_names[2] = "wan",
102 .port_names[3] = "cpu",
103 .port_names[5] = "lan4",
104 .port_names[7] = "lan3",
105};
106
97static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = { 107static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
98 I2C_BOARD_INFO("ds1338", 0x68), 108 I2C_BOARD_INFO("ds1338", 0x68),
99}; 109};
@@ -112,6 +122,7 @@ static void __init rd88f5181l_ge_init(void)
112 */ 122 */
113 orion5x_ehci0_init(); 123 orion5x_ehci0_init();
114 orion5x_eth_init(&rd88f5181l_ge_eth_data); 124 orion5x_eth_init(&rd88f5181l_ge_eth_data);
125 orion5x_eth_switch_init(&rd88f5181l_ge_switch_data, gpio_to_irq(8));
115 orion5x_i2c_init(); 126 orion5x_i2c_init();
116 orion5x_uart0_init(); 127 orion5x_uart0_init();
117 128
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
index 40e049539091..262e25e4dace 100644
--- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
@@ -19,6 +19,7 @@
19#include <linux/spi/orion_spi.h> 19#include <linux/spi/orion_spi.h>
20#include <linux/spi/flash.h> 20#include <linux/spi/flash.h>
21#include <linux/ethtool.h> 21#include <linux/ethtool.h>
22#include <net/dsa.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/gpio.h> 24#include <asm/gpio.h>
24#include <asm/leds.h> 25#include <asm/leds.h>
@@ -34,6 +35,15 @@ static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
34 .duplex = DUPLEX_FULL, 35 .duplex = DUPLEX_FULL,
35}; 36};
36 37
38static struct dsa_platform_data rd88f6183ap_ge_switch_data = {
39 .port_names[0] = "lan1",
40 .port_names[1] = "lan2",
41 .port_names[2] = "lan3",
42 .port_names[3] = "lan4",
43 .port_names[4] = "wan",
44 .port_names[5] = "cpu",
45};
46
37static struct mtd_partition rd88f6183ap_ge_partitions[] = { 47static struct mtd_partition rd88f6183ap_ge_partitions[] = {
38 { 48 {
39 .name = "kernel", 49 .name = "kernel",
@@ -79,6 +89,7 @@ static void __init rd88f6183ap_ge_init(void)
79 */ 89 */
80 orion5x_ehci0_init(); 90 orion5x_ehci0_init();
81 orion5x_eth_init(&rd88f6183ap_ge_eth_data); 91 orion5x_eth_init(&rd88f6183ap_ge_eth_data);
92 orion5x_eth_switch_init(&rd88f6183ap_ge_switch_data, gpio_to_irq(3));
82 spi_register_board_info(rd88f6183ap_ge_spi_slave_info, 93 spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
83 ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info)); 94 ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
84 orion5x_spi_init(); 95 orion5x_spi_init();
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 9a4fd5256462..cc8f89200865 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -15,6 +15,7 @@
15#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/ethtool.h> 17#include <linux/ethtool.h>
18#include <net/dsa.h>
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <asm/gpio.h> 20#include <asm/gpio.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
@@ -105,6 +106,15 @@ static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
105 .duplex = DUPLEX_FULL, 106 .duplex = DUPLEX_FULL,
106}; 107};
107 108
109static struct dsa_platform_data wrt350n_v2_switch_data = {
110 .port_names[0] = "lan2",
111 .port_names[1] = "lan1",
112 .port_names[2] = "wan",
113 .port_names[3] = "cpu",
114 .port_names[5] = "lan3",
115 .port_names[7] = "lan4",
116};
117
108static void __init wrt350n_v2_init(void) 118static void __init wrt350n_v2_init(void)
109{ 119{
110 /* 120 /*
@@ -119,6 +129,7 @@ static void __init wrt350n_v2_init(void)
119 */ 129 */
120 orion5x_ehci0_init(); 130 orion5x_ehci0_init();
121 orion5x_eth_init(&wrt350n_v2_eth_data); 131 orion5x_eth_init(&wrt350n_v2_eth_data);
132 orion5x_eth_switch_init(&wrt350n_v2_switch_data, NO_IRQ);
122 orion5x_uart0_init(); 133 orion5x_uart0_init();
123 134
124 orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE, 135 orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index f27f6b3d6e6f..f781873431f3 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -257,7 +257,6 @@ config MACH_ARMCORE
257 bool "CompuLab CM-X255/CM-X270 modules" 257 bool "CompuLab CM-X255/CM-X270 modules"
258 select PXA27x 258 select PXA27x
259 select IWMMXT 259 select IWMMXT
260 select ZONE_DMA if PCI
261 select PXA25x 260 select PXA25x
262 select PXA_SSP 261 select PXA_SSP
263 262
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 9c163e19ada9..32bb4a2eb7f1 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -9,7 +9,8 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12#ifndef __ASM_MACH_IRQS_H
13#define __ASM_MACH_IRQS_H
13 14
14#ifdef CONFIG_PXA_HAVE_ISA_IRQS 15#ifdef CONFIG_PXA_HAVE_ISA_IRQS
15#define PXA_ISA_IRQ(x) (x) 16#define PXA_ISA_IRQ(x) (x)
@@ -264,3 +265,5 @@
264#endif 265#endif
265 266
266#endif /* CONFIG_PCI_HOST_ITE8152 */ 267#endif /* CONFIG_PCI_HOST_ITE8152 */
268
269#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
index 31ac26b55bc1..e8488dfb7e91 100644
--- a/arch/arm/mach-pxa/include/mach/spitz.h
+++ b/arch/arm/mach-pxa/include/mach/spitz.h
@@ -142,7 +142,7 @@
142 142
143#define SPITZ_SCP2_GPIO_BASE (NR_BUILTIN_GPIO + 12) 143#define SPITZ_SCP2_GPIO_BASE (NR_BUILTIN_GPIO + 12)
144#define SPITZ_GPIO_IR_ON (SPITZ_SCP2_GPIO_BASE + 0) 144#define SPITZ_GPIO_IR_ON (SPITZ_SCP2_GPIO_BASE + 0)
145#define SPITZ_GPIO_AKIN_PULLUP (SPITZ_SCP2_GPIO_BASE + 1 145#define SPITZ_GPIO_AKIN_PULLUP (SPITZ_SCP2_GPIO_BASE + 1)
146#define SPITZ_GPIO_RESERVED_1 (SPITZ_SCP2_GPIO_BASE + 2) 146#define SPITZ_GPIO_RESERVED_1 (SPITZ_SCP2_GPIO_BASE + 2)
147#define SPITZ_GPIO_RESERVED_2 (SPITZ_SCP2_GPIO_BASE + 3) 147#define SPITZ_GPIO_RESERVED_2 (SPITZ_SCP2_GPIO_BASE + 3)
148#define SPITZ_GPIO_RESERVED_3 (SPITZ_SCP2_GPIO_BASE + 4) 148#define SPITZ_GPIO_RESERVED_3 (SPITZ_SCP2_GPIO_BASE + 4)
diff --git a/arch/arm/mach-pxa/pwm.c b/arch/arm/mach-pxa/pwm.c
index 316cd986da5c..74e2ead8cee8 100644
--- a/arch/arm/mach-pxa/pwm.c
+++ b/arch/arm/mach-pxa/pwm.c
@@ -60,7 +60,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
60 do_div(c, 1000000000); 60 do_div(c, 1000000000);
61 period_cycles = c; 61 period_cycles = c;
62 62
63 if (period_cycles < 0) 63 if (period_cycles < 1)
64 period_cycles = 1; 64 period_cycles = 1;
65 prescale = (period_cycles - 1) / 1024; 65 prescale = (period_cycles - 1) / 1024;
66 pv = period_cycles / (prescale + 1) - 1; 66 pv = period_cycles / (prescale + 1) - 1;
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index a13dbf3c2c05..a72e3add743c 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -399,7 +399,7 @@ static void trizeps4_irda_transceiver_mode(struct device *dev, int mode)
399 /* Switch mode */ 399 /* Switch mode */
400 if (mode & IR_SIRMODE) 400 if (mode & IR_SIRMODE)
401 trizeps_conxs_ircr &= ~ConXS_IRCR_MODE; /* Slow mode */ 401 trizeps_conxs_ircr &= ~ConXS_IRCR_MODE; /* Slow mode */
402 else if (mode & IR_FIRMODE) { 402 else if (mode & IR_FIRMODE)
403 trizeps_conxs_ircr |= ConXS_IRCR_MODE; /* Fast mode */ 403 trizeps_conxs_ircr |= ConXS_IRCR_MODE; /* Fast mode */
404 404
405 /* Switch power */ 405 /* Switch power */
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index 2f60bf6b8d43..f854e7385e3c 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -1033,8 +1033,7 @@ void __init s3c2443_init_clocks(int xtal)
1033 1033
1034 fclk = pll / s3c2443_fclk_div(clkdiv0); 1034 fclk = pll / s3c2443_fclk_div(clkdiv0);
1035 hclk = s3c2443_prediv_getrate(&clk_prediv); 1035 hclk = s3c2443_prediv_getrate(&clk_prediv);
1036 hclk = hclk / s3c2443_get_hdiv(clkdiv0); 1036 hclk /= s3c2443_get_hdiv(clkdiv0);
1037 hclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_HCLK) ? 2 : 1);
1038 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1); 1037 pclk = hclk / ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 2 : 1);
1039 1038
1040 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk); 1039 s3c24xx_setup_clocks(xtal, fclk, hclk, pclk);
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S
index 33926c9fcda6..5786adf10040 100644
--- a/arch/arm/mm/cache-v4.S
+++ b/arch/arm/mm/cache-v4.S
@@ -29,7 +29,7 @@ ENTRY(v4_flush_user_cache_all)
29 * Clean and invalidate the entire cache. 29 * Clean and invalidate the entire cache.
30 */ 30 */
31ENTRY(v4_flush_kern_cache_all) 31ENTRY(v4_flush_kern_cache_all)
32#ifdef CPU_CP15 32#ifdef CONFIG_CPU_CP15
33 mov r0, #0 33 mov r0, #0
34 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache 34 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
35 mov pc, lr 35 mov pc, lr
@@ -48,7 +48,7 @@ ENTRY(v4_flush_kern_cache_all)
48 * - flags - vma_area_struct flags describing address space 48 * - flags - vma_area_struct flags describing address space
49 */ 49 */
50ENTRY(v4_flush_user_cache_range) 50ENTRY(v4_flush_user_cache_range)
51#ifdef CPU_CP15 51#ifdef CONFIG_CPU_CP15
52 mov ip, #0 52 mov ip, #0
53 mcreq p15, 0, ip, c7, c7, 0 @ flush ID cache 53 mcreq p15, 0, ip, c7, c7, 0 @ flush ID cache
54 mov pc, lr 54 mov pc, lr
@@ -116,7 +116,7 @@ ENTRY(v4_dma_inv_range)
116 * - end - virtual end address 116 * - end - virtual end address
117 */ 117 */
118ENTRY(v4_dma_flush_range) 118ENTRY(v4_dma_flush_range)
119#ifdef CPU_CP15 119#ifdef CONFIG_CPU_CP15
120 mov r0, #0 120 mov r0, #0
121 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache 121 mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
122#endif 122#endif
diff --git a/arch/arm/plat-s3c24xx/pwm-clock.c b/arch/arm/plat-s3c24xx/pwm-clock.c
index b8e854f1b1d5..3fad68a1e6bc 100644
--- a/arch/arm/plat-s3c24xx/pwm-clock.c
+++ b/arch/arm/plat-s3c24xx/pwm-clock.c
@@ -315,7 +315,7 @@ static int clk_pwm_tin_set_parent(struct clk *clk, struct clk *parent)
315 if (parent == s3c24xx_pwmclk_tclk(id)) 315 if (parent == s3c24xx_pwmclk_tclk(id))
316 bits = S3C2410_TCFG1_MUX_TCLK << shift; 316 bits = S3C2410_TCFG1_MUX_TCLK << shift;
317 else if (parent == s3c24xx_pwmclk_tdiv(id)) 317 else if (parent == s3c24xx_pwmclk_tdiv(id))
318 bits = clk_pwm_tdiv_bits(to_tdiv(clk)) << shift; 318 bits = clk_pwm_tdiv_bits(to_tdiv(parent)) << shift;
319 else 319 else
320 return -EINVAL; 320 return -EINVAL;
321 321
diff --git a/arch/arm/plat-s3c24xx/pwm.c b/arch/arm/plat-s3c24xx/pwm.c
index feb770f2e84e..ec56b88866c4 100644
--- a/arch/arm/plat-s3c24xx/pwm.c
+++ b/arch/arm/plat-s3c24xx/pwm.c
@@ -56,7 +56,7 @@ static struct clk *clk_scaler[2];
56 } \ 56 } \
57 } 57 }
58 58
59#define DEFINE_TIMER(_tmr_no, _irq) \ 59#define DEFINE_S3C_TIMER(_tmr_no, _irq) \
60 .name = "s3c24xx-pwm", \ 60 .name = "s3c24xx-pwm", \
61 .id = _tmr_no, \ 61 .id = _tmr_no, \
62 .num_resources = TIMER_RESOURCE_SIZE, \ 62 .num_resources = TIMER_RESOURCE_SIZE, \
@@ -67,11 +67,11 @@ static struct clk *clk_scaler[2];
67 */ 67 */
68 68
69struct platform_device s3c_device_timer[] = { 69struct platform_device s3c_device_timer[] = {
70 [0] = { DEFINE_TIMER(0, IRQ_TIMER0) }, 70 [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
71 [1] = { DEFINE_TIMER(1, IRQ_TIMER1) }, 71 [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
72 [2] = { DEFINE_TIMER(2, IRQ_TIMER2) }, 72 [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
73 [3] = { DEFINE_TIMER(3, IRQ_TIMER3) }, 73 [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
74 [4] = { DEFINE_TIMER(4, IRQ_TIMER4) }, 74 [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
75}; 75};
76 76
77static inline int pwm_is_tdiv(struct pwm_device *pwm) 77static inline int pwm_is_tdiv(struct pwm_device *pwm)
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 07335e719bf8..b17aeea8d620 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -679,6 +679,8 @@ source "fs/Kconfig"
679 679
680source "drivers/usb/Kconfig" 680source "drivers/usb/Kconfig"
681 681
682source "drivers/uwb/Kconfig"
683
682source "arch/cris/Kconfig.debug" 684source "arch/cris/Kconfig.debug"
683 685
684source "security/Kconfig" 686source "security/Kconfig"
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index bd1995403c67..28f06fd9b7b7 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -216,6 +216,8 @@ source "drivers/hwmon/Kconfig"
216 216
217source "drivers/usb/Kconfig" 217source "drivers/usb/Kconfig"
218 218
219source "drivers/uwb/Kconfig"
220
219endmenu 221endmenu
220 222
221source "fs/Kconfig" 223source "fs/Kconfig"
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 912c57db2d21..27eec71429b0 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -23,6 +23,7 @@ config IA64
23 select HAVE_KRETPROBES 23 select HAVE_KRETPROBES
24 select HAVE_DMA_ATTRS 24 select HAVE_DMA_ATTRS
25 select HAVE_KVM 25 select HAVE_KVM
26 select HAVE_ARCH_TRACEHOOK
26 default y 27 default y
27 help 28 help
28 The Itanium Processor Family is Intel's 64-bit successor to 29 The Itanium Processor Family is Intel's 64-bit successor to
@@ -110,6 +111,33 @@ config AUDIT_ARCH
110 bool 111 bool
111 default y 112 default y
112 113
114menuconfig PARAVIRT_GUEST
115 bool "Paravirtualized guest support"
116 help
117 Say Y here to get to see options related to running Linux under
118 various hypervisors. This option alone does not add any kernel code.
119
120 If you say N, all options in this submenu will be skipped and disabled.
121
122if PARAVIRT_GUEST
123
124config PARAVIRT
125 bool "Enable paravirtualization code"
126 depends on PARAVIRT_GUEST
127 default y
128 bool
129 default y
130 help
131 This changes the kernel so it can modify itself when it is run
132 under a hypervisor, potentially improving performance significantly
133 over full virtualization. However, when run without a hypervisor
134 the kernel is theoretically slower and slightly larger.
135
136
137source "arch/ia64/xen/Kconfig"
138
139endif
140
113choice 141choice
114 prompt "System type" 142 prompt "System type"
115 default IA64_GENERIC 143 default IA64_GENERIC
@@ -119,6 +147,7 @@ config IA64_GENERIC
119 select NUMA 147 select NUMA
120 select ACPI_NUMA 148 select ACPI_NUMA
121 select SWIOTLB 149 select SWIOTLB
150 select PCI_MSI
122 help 151 help
123 This selects the system type of your hardware. A "generic" kernel 152 This selects the system type of your hardware. A "generic" kernel
124 will run on any supported IA-64 system. However, if you configure 153 will run on any supported IA-64 system. However, if you configure
@@ -126,11 +155,13 @@ config IA64_GENERIC
126 155
127 generic For any supported IA-64 system 156 generic For any supported IA-64 system
128 DIG-compliant For DIG ("Developer's Interface Guide") compliant systems 157 DIG-compliant For DIG ("Developer's Interface Guide") compliant systems
158 DIG+Intel+IOMMU For DIG systems with Intel IOMMU
129 HP-zx1/sx1000 For HP systems 159 HP-zx1/sx1000 For HP systems
130 HP-zx1/sx1000+swiotlb For HP systems with (broken) DMA-constrained devices. 160 HP-zx1/sx1000+swiotlb For HP systems with (broken) DMA-constrained devices.
131 SGI-SN2 For SGI Altix systems 161 SGI-SN2 For SGI Altix systems
132 SGI-UV For SGI UV systems 162 SGI-UV For SGI UV systems
133 Ski-simulator For the HP simulator <http://www.hpl.hp.com/research/linux/ski/> 163 Ski-simulator For the HP simulator <http://www.hpl.hp.com/research/linux/ski/>
164 Xen-domU For xen domU system
134 165
135 If you don't know what to do, choose "generic". 166 If you don't know what to do, choose "generic".
136 167
@@ -138,6 +169,11 @@ config IA64_DIG
138 bool "DIG-compliant" 169 bool "DIG-compliant"
139 select SWIOTLB 170 select SWIOTLB
140 171
172config IA64_DIG_VTD
173 bool "DIG+Intel+IOMMU"
174 select DMAR
175 select PCI_MSI
176
141config IA64_HP_ZX1 177config IA64_HP_ZX1
142 bool "HP-zx1/sx1000" 178 bool "HP-zx1/sx1000"
143 help 179 help
@@ -181,6 +217,10 @@ config IA64_HP_SIM
181 bool "Ski-simulator" 217 bool "Ski-simulator"
182 select SWIOTLB 218 select SWIOTLB
183 219
220config IA64_XEN_GUEST
221 bool "Xen guest"
222 depends on XEN
223
184endchoice 224endchoice
185 225
186choice 226choice
@@ -583,6 +623,16 @@ source "drivers/pci/hotplug/Kconfig"
583 623
584source "drivers/pcmcia/Kconfig" 624source "drivers/pcmcia/Kconfig"
585 625
626config DMAR
627 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
628 depends on IA64_GENERIC && ACPI && EXPERIMENTAL
629 help
630 DMA remapping (DMAR) devices support enables independent address
631 translations for Direct Memory Access (DMA) from devices.
632 These DMA remapping devices are reported via ACPI tables
633 and include PCI device scope covered by these DMA
634 remapping devices.
635
586endmenu 636endmenu
587 637
588endif 638endif
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index 905d25b13d5a..58a7e46affda 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -53,12 +53,15 @@ libs-y += arch/ia64/lib/
53core-y += arch/ia64/kernel/ arch/ia64/mm/ 53core-y += arch/ia64/kernel/ arch/ia64/mm/
54core-$(CONFIG_IA32_SUPPORT) += arch/ia64/ia32/ 54core-$(CONFIG_IA32_SUPPORT) += arch/ia64/ia32/
55core-$(CONFIG_IA64_DIG) += arch/ia64/dig/ 55core-$(CONFIG_IA64_DIG) += arch/ia64/dig/
56core-$(CONFIG_IA64_DIG_VTD) += arch/ia64/dig/
56core-$(CONFIG_IA64_GENERIC) += arch/ia64/dig/ 57core-$(CONFIG_IA64_GENERIC) += arch/ia64/dig/
57core-$(CONFIG_IA64_HP_ZX1) += arch/ia64/dig/ 58core-$(CONFIG_IA64_HP_ZX1) += arch/ia64/dig/
58core-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/dig/ 59core-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/dig/
60core-$(CONFIG_IA64_XEN_GUEST) += arch/ia64/dig/
59core-$(CONFIG_IA64_SGI_SN2) += arch/ia64/sn/ 61core-$(CONFIG_IA64_SGI_SN2) += arch/ia64/sn/
60core-$(CONFIG_IA64_SGI_UV) += arch/ia64/uv/ 62core-$(CONFIG_IA64_SGI_UV) += arch/ia64/uv/
61core-$(CONFIG_KVM) += arch/ia64/kvm/ 63core-$(CONFIG_KVM) += arch/ia64/kvm/
64core-$(CONFIG_XEN) += arch/ia64/xen/
62 65
63drivers-$(CONFIG_PCI) += arch/ia64/pci/ 66drivers-$(CONFIG_PCI) += arch/ia64/pci/
64drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/ 67drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 9f483976228f..e05f9e1d3faa 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -233,6 +233,8 @@ CONFIG_DMIID=y
233CONFIG_BINFMT_ELF=y 233CONFIG_BINFMT_ELF=y
234CONFIG_BINFMT_MISC=m 234CONFIG_BINFMT_MISC=m
235 235
236# CONFIG_DMAR is not set
237
236# 238#
237# Power management and ACPI 239# Power management and ACPI
238# 240#
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index 797acf9066c1..c522edf23c62 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -172,6 +172,8 @@ CONFIG_DMIID=y
172CONFIG_BINFMT_ELF=y 172CONFIG_BINFMT_ELF=y
173CONFIG_BINFMT_MISC=m 173CONFIG_BINFMT_MISC=m
174 174
175# CONFIG_DMAR is not set
176
175# 177#
176# Power management and ACPI 178# Power management and ACPI
177# 179#
diff --git a/arch/ia64/dig/Makefile b/arch/ia64/dig/Makefile
index 971cd7870dd4..5c0283830bd6 100644
--- a/arch/ia64/dig/Makefile
+++ b/arch/ia64/dig/Makefile
@@ -6,4 +6,9 @@
6# 6#
7 7
8obj-y := setup.o 8obj-y := setup.o
9ifeq ($(CONFIG_DMAR), y)
10obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o dig_vtd_iommu.o
11else
9obj-$(CONFIG_IA64_GENERIC) += machvec.o 12obj-$(CONFIG_IA64_GENERIC) += machvec.o
13endif
14obj-$(CONFIG_IA64_DIG_VTD) += dig_vtd_iommu.o
diff --git a/arch/ia64/dig/dig_vtd_iommu.c b/arch/ia64/dig/dig_vtd_iommu.c
new file mode 100644
index 000000000000..1c8a079017a3
--- /dev/null
+++ b/arch/ia64/dig/dig_vtd_iommu.c
@@ -0,0 +1,59 @@
1#include <linux/types.h>
2#include <linux/kernel.h>
3#include <linux/module.h>
4#include <linux/intel-iommu.h>
5
6void *
7vtd_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
8 gfp_t flags)
9{
10 return intel_alloc_coherent(dev, size, dma_handle, flags);
11}
12EXPORT_SYMBOL_GPL(vtd_alloc_coherent);
13
14void
15vtd_free_coherent(struct device *dev, size_t size, void *vaddr,
16 dma_addr_t dma_handle)
17{
18 intel_free_coherent(dev, size, vaddr, dma_handle);
19}
20EXPORT_SYMBOL_GPL(vtd_free_coherent);
21
22dma_addr_t
23vtd_map_single_attrs(struct device *dev, void *addr, size_t size,
24 int dir, struct dma_attrs *attrs)
25{
26 return intel_map_single(dev, (phys_addr_t)addr, size, dir);
27}
28EXPORT_SYMBOL_GPL(vtd_map_single_attrs);
29
30void
31vtd_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
32 int dir, struct dma_attrs *attrs)
33{
34 intel_unmap_single(dev, iova, size, dir);
35}
36EXPORT_SYMBOL_GPL(vtd_unmap_single_attrs);
37
38int
39vtd_map_sg_attrs(struct device *dev, struct scatterlist *sglist, int nents,
40 int dir, struct dma_attrs *attrs)
41{
42 return intel_map_sg(dev, sglist, nents, dir);
43}
44EXPORT_SYMBOL_GPL(vtd_map_sg_attrs);
45
46void
47vtd_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
48 int nents, int dir, struct dma_attrs *attrs)
49{
50 intel_unmap_sg(dev, sglist, nents, dir);
51}
52EXPORT_SYMBOL_GPL(vtd_unmap_sg_attrs);
53
54int
55vtd_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
56{
57 return 0;
58}
59EXPORT_SYMBOL_GPL(vtd_dma_mapping_error);
diff --git a/arch/ia64/dig/machvec_vtd.c b/arch/ia64/dig/machvec_vtd.c
new file mode 100644
index 000000000000..7cd3eb471cad
--- /dev/null
+++ b/arch/ia64/dig/machvec_vtd.c
@@ -0,0 +1,3 @@
1#define MACHVEC_PLATFORM_NAME dig_vtd
2#define MACHVEC_PLATFORM_HEADER <asm/machvec_dig_vtd.h>
3#include <asm/machvec_init.h>
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index 53505bb04771..a8cf19958850 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -108,6 +108,11 @@ GLOBAL_ENTRY(ia32_trace_syscall)
108 ;; 108 ;;
109 st8 [r2]=r3 // initialize return code to -ENOSYS 109 st8 [r2]=r3 // initialize return code to -ENOSYS
110 br.call.sptk.few rp=syscall_trace_enter // give parent a chance to catch syscall args 110 br.call.sptk.few rp=syscall_trace_enter // give parent a chance to catch syscall args
111 cmp.lt p6,p0=r8,r0 // check tracehook
112 adds r2=IA64_PT_REGS_R8_OFFSET+16,sp // r2 = &pt_regs.r8
113 ;;
114(p6) st8.spill [r2]=r8 // store return value in slot for r8
115(p6) br.spnt.few .ret4
111.ret2: // Need to reload arguments (they may be changed by the tracing process) 116.ret2: // Need to reload arguments (they may be changed by the tracing process)
112 adds r2=IA64_PT_REGS_R1_OFFSET+16,sp // r2 = &pt_regs.r1 117 adds r2=IA64_PT_REGS_R1_OFFSET+16,sp // r2 = &pt_regs.r1
113 adds r3=IA64_PT_REGS_R13_OFFSET+16,sp // r3 = &pt_regs.r13 118 adds r3=IA64_PT_REGS_R13_OFFSET+16,sp // r3 = &pt_regs.r13
@@ -199,10 +204,10 @@ ia32_syscall_table:
199 data8 sys_setuid /* 16-bit version */ 204 data8 sys_setuid /* 16-bit version */
200 data8 sys_getuid /* 16-bit version */ 205 data8 sys_getuid /* 16-bit version */
201 data8 compat_sys_stime /* 25 */ 206 data8 compat_sys_stime /* 25 */
202 data8 sys32_ptrace 207 data8 compat_sys_ptrace
203 data8 sys32_alarm 208 data8 sys32_alarm
204 data8 sys_ni_syscall 209 data8 sys_ni_syscall
205 data8 sys32_pause 210 data8 sys_pause
206 data8 compat_sys_utime /* 30 */ 211 data8 compat_sys_utime /* 30 */
207 data8 sys_ni_syscall /* old stty syscall holder */ 212 data8 sys_ni_syscall /* old stty syscall holder */
208 data8 sys_ni_syscall /* old gtty syscall holder */ 213 data8 sys_ni_syscall /* old gtty syscall holder */
@@ -215,7 +220,7 @@ ia32_syscall_table:
215 data8 sys_mkdir 220 data8 sys_mkdir
216 data8 sys_rmdir /* 40 */ 221 data8 sys_rmdir /* 40 */
217 data8 sys_dup 222 data8 sys_dup
218 data8 sys32_pipe 223 data8 sys_pipe
219 data8 compat_sys_times 224 data8 compat_sys_times
220 data8 sys_ni_syscall /* old prof syscall holder */ 225 data8 sys_ni_syscall /* old prof syscall holder */
221 data8 sys32_brk /* 45 */ 226 data8 sys32_brk /* 45 */
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index f4430bb4bbdc..5e92ae00bdbb 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -1098,21 +1098,6 @@ sys32_mremap (unsigned int addr, unsigned int old_len, unsigned int new_len,
1098 return ret; 1098 return ret;
1099} 1099}
1100 1100
1101asmlinkage long
1102sys32_pipe (int __user *fd)
1103{
1104 int retval;
1105 int fds[2];
1106
1107 retval = do_pipe_flags(fds, 0);
1108 if (retval)
1109 goto out;
1110 if (copy_to_user(fd, fds, sizeof(fds)))
1111 retval = -EFAULT;
1112 out:
1113 return retval;
1114}
1115
1116asmlinkage unsigned long 1101asmlinkage unsigned long
1117sys32_alarm (unsigned int seconds) 1102sys32_alarm (unsigned int seconds)
1118{ 1103{
@@ -1209,25 +1194,6 @@ sys32_waitpid (int pid, unsigned int *stat_addr, int options)
1209 return compat_sys_wait4(pid, stat_addr, options, NULL); 1194 return compat_sys_wait4(pid, stat_addr, options, NULL);
1210} 1195}
1211 1196
1212static unsigned int
1213ia32_peek (struct task_struct *child, unsigned long addr, unsigned int *val)
1214{
1215 size_t copied;
1216 unsigned int ret;
1217
1218 copied = access_process_vm(child, addr, val, sizeof(*val), 0);
1219 return (copied != sizeof(ret)) ? -EIO : 0;
1220}
1221
1222static unsigned int
1223ia32_poke (struct task_struct *child, unsigned long addr, unsigned int val)
1224{
1225
1226 if (access_process_vm(child, addr, &val, sizeof(val), 1) != sizeof(val))
1227 return -EIO;
1228 return 0;
1229}
1230
1231/* 1197/*
1232 * The order in which registers are stored in the ptrace regs structure 1198 * The order in which registers are stored in the ptrace regs structure
1233 */ 1199 */
@@ -1525,49 +1491,15 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __u
1525 return 0; 1491 return 0;
1526} 1492}
1527 1493
1528asmlinkage long 1494long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
1529sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data) 1495 compat_ulong_t caddr, compat_ulong_t cdata)
1530{ 1496{
1531 struct task_struct *child; 1497 unsigned long addr = caddr;
1532 unsigned int value, tmp; 1498 unsigned long data = cdata;
1499 unsigned int tmp;
1533 long i, ret; 1500 long i, ret;
1534 1501
1535 lock_kernel();
1536 if (request == PTRACE_TRACEME) {
1537 ret = ptrace_traceme();
1538 goto out;
1539 }
1540
1541 child = ptrace_get_task_struct(pid);
1542 if (IS_ERR(child)) {
1543 ret = PTR_ERR(child);
1544 goto out;
1545 }
1546
1547 if (request == PTRACE_ATTACH) {
1548 ret = sys_ptrace(request, pid, addr, data);
1549 goto out_tsk;
1550 }
1551
1552 ret = ptrace_check_attach(child, request == PTRACE_KILL);
1553 if (ret < 0)
1554 goto out_tsk;
1555
1556 switch (request) { 1502 switch (request) {
1557 case PTRACE_PEEKTEXT:
1558 case PTRACE_PEEKDATA: /* read word at location addr */
1559 ret = ia32_peek(child, addr, &value);
1560 if (ret == 0)
1561 ret = put_user(value, (unsigned int __user *) compat_ptr(data));
1562 else
1563 ret = -EIO;
1564 goto out_tsk;
1565
1566 case PTRACE_POKETEXT:
1567 case PTRACE_POKEDATA: /* write the word at location addr */
1568 ret = ia32_poke(child, addr, data);
1569 goto out_tsk;
1570
1571 case PTRACE_PEEKUSR: /* read word at addr in USER area */ 1503 case PTRACE_PEEKUSR: /* read word at addr in USER area */
1572 ret = -EIO; 1504 ret = -EIO;
1573 if ((addr & 3) || addr > 17*sizeof(int)) 1505 if ((addr & 3) || addr > 17*sizeof(int))
@@ -1632,27 +1564,9 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data)
1632 compat_ptr(data)); 1564 compat_ptr(data));
1633 break; 1565 break;
1634 1566
1635 case PTRACE_GETEVENTMSG:
1636 ret = put_user(child->ptrace_message, (unsigned int __user *) compat_ptr(data));
1637 break;
1638
1639 case PTRACE_SYSCALL: /* continue, stop after next syscall */
1640 case PTRACE_CONT: /* restart after signal. */
1641 case PTRACE_KILL:
1642 case PTRACE_SINGLESTEP: /* execute chile for one instruction */
1643 case PTRACE_DETACH: /* detach a process */
1644 ret = sys_ptrace(request, pid, addr, data);
1645 break;
1646
1647 default: 1567 default:
1648 ret = ptrace_request(child, request, addr, data); 1568 return compat_ptrace_request(child, request, caddr, cdata);
1649 break;
1650
1651 } 1569 }
1652 out_tsk:
1653 put_task_struct(child);
1654 out:
1655 unlock_kernel();
1656 return ret; 1570 return ret;
1657} 1571}
1658 1572
@@ -1704,14 +1618,6 @@ out:
1704} 1618}
1705 1619
1706asmlinkage int 1620asmlinkage int
1707sys32_pause (void)
1708{
1709 current->state = TASK_INTERRUPTIBLE;
1710 schedule();
1711 return -ERESTARTNOHAND;
1712}
1713
1714asmlinkage int
1715sys32_msync (unsigned int start, unsigned int len, int flags) 1621sys32_msync (unsigned int start, unsigned int len, int flags)
1716{ 1622{
1717 unsigned int addr; 1623 unsigned int addr;
diff --git a/arch/ia64/include/asm/break.h b/arch/ia64/include/asm/break.h
index f03402039896..e90c40ec9edf 100644
--- a/arch/ia64/include/asm/break.h
+++ b/arch/ia64/include/asm/break.h
@@ -20,4 +20,13 @@
20 */ 20 */
21#define __IA64_BREAK_SYSCALL 0x100000 21#define __IA64_BREAK_SYSCALL 0x100000
22 22
23/*
24 * Xen specific break numbers:
25 */
26#define __IA64_XEN_HYPERCALL 0x1000
27/* [__IA64_XEN_HYPERPRIVOP_START, __IA64_XEN_HYPERPRIVOP_MAX] is used
28 for xen hyperprivops */
29#define __IA64_XEN_HYPERPRIVOP_START 0x1
30#define __IA64_XEN_HYPERPRIVOP_MAX 0x1a
31
23#endif /* _ASM_IA64_BREAK_H */ 32#endif /* _ASM_IA64_BREAK_H */
diff --git a/arch/ia64/include/asm/cacheflush.h b/arch/ia64/include/asm/cacheflush.h
index afcfbda76e20..c8ce2719fee8 100644
--- a/arch/ia64/include/asm/cacheflush.h
+++ b/arch/ia64/include/asm/cacheflush.h
@@ -34,6 +34,8 @@ do { \
34#define flush_dcache_mmap_unlock(mapping) do { } while (0) 34#define flush_dcache_mmap_unlock(mapping) do { } while (0)
35 35
36extern void flush_icache_range (unsigned long start, unsigned long end); 36extern void flush_icache_range (unsigned long start, unsigned long end);
37extern void clflush_cache_range(void *addr, int size);
38
37 39
38#define flush_icache_user_range(vma, page, user_addr, len) \ 40#define flush_icache_user_range(vma, page, user_addr, len) \
39do { \ 41do { \
diff --git a/arch/ia64/include/asm/device.h b/arch/ia64/include/asm/device.h
index 3db6daf7f251..41ab85d66f33 100644
--- a/arch/ia64/include/asm/device.h
+++ b/arch/ia64/include/asm/device.h
@@ -10,6 +10,9 @@ struct dev_archdata {
10#ifdef CONFIG_ACPI 10#ifdef CONFIG_ACPI
11 void *acpi_handle; 11 void *acpi_handle;
12#endif 12#endif
13#ifdef CONFIG_DMAR
14 void *iommu; /* hook for IOMMU specific extension */
15#endif
13}; 16};
14 17
15#endif /* _ASM_IA64_DEVICE_H */ 18#endif /* _ASM_IA64_DEVICE_H */
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 06ff1ba21465..bbab7e2b0fc9 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -7,6 +7,49 @@
7 */ 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>
11
12struct dma_mapping_ops {
13 int (*mapping_error)(struct device *dev,
14 dma_addr_t dma_addr);
15 void* (*alloc_coherent)(struct device *dev, size_t size,
16 dma_addr_t *dma_handle, gfp_t gfp);
17 void (*free_coherent)(struct device *dev, size_t size,
18 void *vaddr, dma_addr_t dma_handle);
19 dma_addr_t (*map_single)(struct device *hwdev, unsigned long ptr,
20 size_t size, int direction);
21 void (*unmap_single)(struct device *dev, dma_addr_t addr,
22 size_t size, int direction);
23 void (*sync_single_for_cpu)(struct device *hwdev,
24 dma_addr_t dma_handle, size_t size,
25 int direction);
26 void (*sync_single_for_device)(struct device *hwdev,
27 dma_addr_t dma_handle, size_t size,
28 int direction);
29 void (*sync_single_range_for_cpu)(struct device *hwdev,
30 dma_addr_t dma_handle, unsigned long offset,
31 size_t size, int direction);
32 void (*sync_single_range_for_device)(struct device *hwdev,
33 dma_addr_t dma_handle, unsigned long offset,
34 size_t size, int direction);
35 void (*sync_sg_for_cpu)(struct device *hwdev,
36 struct scatterlist *sg, int nelems,
37 int direction);
38 void (*sync_sg_for_device)(struct device *hwdev,
39 struct scatterlist *sg, int nelems,
40 int direction);
41 int (*map_sg)(struct device *hwdev, struct scatterlist *sg,
42 int nents, int direction);
43 void (*unmap_sg)(struct device *hwdev,
44 struct scatterlist *sg, int nents,
45 int direction);
46 int (*dma_supported_op)(struct device *hwdev, u64 mask);
47 int is_phys;
48};
49
50extern struct dma_mapping_ops *dma_ops;
51extern struct ia64_machine_vector ia64_mv;
52extern void set_iommu_machvec(void);
10 53
11#define dma_alloc_coherent(dev, size, handle, gfp) \ 54#define dma_alloc_coherent(dev, size, handle, gfp) \
12 platform_dma_alloc_coherent(dev, size, handle, (gfp) | GFP_DMA) 55 platform_dma_alloc_coherent(dev, size, handle, (gfp) | GFP_DMA)
@@ -96,4 +139,11 @@ dma_cache_sync (struct device *dev, void *vaddr, size_t size,
96 139
97#define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */ 140#define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */
98 141
142static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
143{
144 return dma_ops;
145}
146
147
148
99#endif /* _ASM_IA64_DMA_MAPPING_H */ 149#endif /* _ASM_IA64_DMA_MAPPING_H */
diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h
new file mode 100644
index 000000000000..5fb2bb93de3b
--- /dev/null
+++ b/arch/ia64/include/asm/iommu.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_IA64_IOMMU_H
2#define _ASM_IA64_IOMMU_H 1
3
4#define cpu_has_x2apic 0
5/* 10 seconds */
6#define DMAR_OPERATION_TIMEOUT (((cycles_t) local_cpu_data->itc_freq)*10)
7
8extern void pci_iommu_shutdown(void);
9extern void no_iommu_init(void);
10extern int force_iommu, no_iommu;
11extern int iommu_detected;
12extern void iommu_dma_init(void);
13extern void machvec_init(const char *name);
14extern int forbid_dac;
15
16#endif
diff --git a/arch/ia64/include/asm/kregs.h b/arch/ia64/include/asm/kregs.h
index aefcdfee7f23..39e65f6639f5 100644
--- a/arch/ia64/include/asm/kregs.h
+++ b/arch/ia64/include/asm/kregs.h
@@ -32,7 +32,7 @@
32#define IA64_TR_CURRENT_STACK 1 /* dtr1: maps kernel's memory- & register-stacks */ 32#define IA64_TR_CURRENT_STACK 1 /* dtr1: maps kernel's memory- & register-stacks */
33 33
34#define IA64_TR_ALLOC_BASE 2 /* itr&dtr: Base of dynamic TR resource*/ 34#define IA64_TR_ALLOC_BASE 2 /* itr&dtr: Base of dynamic TR resource*/
35#define IA64_TR_ALLOC_MAX 32 /* Max number for dynamic use*/ 35#define IA64_TR_ALLOC_MAX 64 /* Max number for dynamic use*/
36 36
37/* Processor status register bits: */ 37/* Processor status register bits: */
38#define IA64_PSR_BE_BIT 1 38#define IA64_PSR_BE_BIT 1
diff --git a/arch/ia64/include/asm/machvec.h b/arch/ia64/include/asm/machvec.h
index 2b850ccafef5..1ea28bcee33b 100644
--- a/arch/ia64/include/asm/machvec.h
+++ b/arch/ia64/include/asm/machvec.h
@@ -120,6 +120,8 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
120# include <asm/machvec_hpsim.h> 120# include <asm/machvec_hpsim.h>
121# elif defined (CONFIG_IA64_DIG) 121# elif defined (CONFIG_IA64_DIG)
122# include <asm/machvec_dig.h> 122# include <asm/machvec_dig.h>
123# elif defined(CONFIG_IA64_DIG_VTD)
124# include <asm/machvec_dig_vtd.h>
123# elif defined (CONFIG_IA64_HP_ZX1) 125# elif defined (CONFIG_IA64_HP_ZX1)
124# include <asm/machvec_hpzx1.h> 126# include <asm/machvec_hpzx1.h>
125# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB) 127# elif defined (CONFIG_IA64_HP_ZX1_SWIOTLB)
@@ -128,6 +130,8 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
128# include <asm/machvec_sn2.h> 130# include <asm/machvec_sn2.h>
129# elif defined (CONFIG_IA64_SGI_UV) 131# elif defined (CONFIG_IA64_SGI_UV)
130# include <asm/machvec_uv.h> 132# include <asm/machvec_uv.h>
133# elif defined (CONFIG_IA64_XEN_GUEST)
134# include <asm/machvec_xen.h>
131# elif defined (CONFIG_IA64_GENERIC) 135# elif defined (CONFIG_IA64_GENERIC)
132 136
133# ifdef MACHVEC_PLATFORM_HEADER 137# ifdef MACHVEC_PLATFORM_HEADER
diff --git a/arch/ia64/include/asm/machvec_dig_vtd.h b/arch/ia64/include/asm/machvec_dig_vtd.h
new file mode 100644
index 000000000000..3400b561e711
--- /dev/null
+++ b/arch/ia64/include/asm/machvec_dig_vtd.h
@@ -0,0 +1,38 @@
1#ifndef _ASM_IA64_MACHVEC_DIG_VTD_h
2#define _ASM_IA64_MACHVEC_DIG_VTD_h
3
4extern ia64_mv_setup_t dig_setup;
5extern ia64_mv_dma_alloc_coherent vtd_alloc_coherent;
6extern ia64_mv_dma_free_coherent vtd_free_coherent;
7extern ia64_mv_dma_map_single_attrs vtd_map_single_attrs;
8extern ia64_mv_dma_unmap_single_attrs vtd_unmap_single_attrs;
9extern ia64_mv_dma_map_sg_attrs vtd_map_sg_attrs;
10extern ia64_mv_dma_unmap_sg_attrs vtd_unmap_sg_attrs;
11extern ia64_mv_dma_supported iommu_dma_supported;
12extern ia64_mv_dma_mapping_error vtd_dma_mapping_error;
13extern ia64_mv_dma_init pci_iommu_alloc;
14
15/*
16 * This stuff has dual use!
17 *
18 * For a generic kernel, the macros are used to initialize the
19 * platform's machvec structure. When compiling a non-generic kernel,
20 * the macros are used directly.
21 */
22#define platform_name "dig_vtd"
23#define platform_setup dig_setup
24#define platform_dma_init pci_iommu_alloc
25#define platform_dma_alloc_coherent vtd_alloc_coherent
26#define platform_dma_free_coherent vtd_free_coherent
27#define platform_dma_map_single_attrs vtd_map_single_attrs
28#define platform_dma_unmap_single_attrs vtd_unmap_single_attrs
29#define platform_dma_map_sg_attrs vtd_map_sg_attrs
30#define platform_dma_unmap_sg_attrs vtd_unmap_sg_attrs
31#define platform_dma_sync_single_for_cpu machvec_dma_sync_single
32#define platform_dma_sync_sg_for_cpu machvec_dma_sync_sg
33#define platform_dma_sync_single_for_device machvec_dma_sync_single
34#define platform_dma_sync_sg_for_device machvec_dma_sync_sg
35#define platform_dma_supported iommu_dma_supported
36#define platform_dma_mapping_error vtd_dma_mapping_error
37
38#endif /* _ASM_IA64_MACHVEC_DIG_VTD_h */
diff --git a/arch/ia64/include/asm/machvec_init.h b/arch/ia64/include/asm/machvec_init.h
index 7f21249fba3f..ef964b286842 100644
--- a/arch/ia64/include/asm/machvec_init.h
+++ b/arch/ia64/include/asm/machvec_init.h
@@ -1,3 +1,4 @@
1#include <asm/iommu.h>
1#include <asm/machvec.h> 2#include <asm/machvec.h>
2 3
3extern ia64_mv_send_ipi_t ia64_send_ipi; 4extern ia64_mv_send_ipi_t ia64_send_ipi;
diff --git a/arch/ia64/include/asm/machvec_xen.h b/arch/ia64/include/asm/machvec_xen.h
new file mode 100644
index 000000000000..55f9228056cd
--- /dev/null
+++ b/arch/ia64/include/asm/machvec_xen.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_IA64_MACHVEC_XEN_h
2#define _ASM_IA64_MACHVEC_XEN_h
3
4extern ia64_mv_setup_t dig_setup;
5extern ia64_mv_cpu_init_t xen_cpu_init;
6extern ia64_mv_irq_init_t xen_irq_init;
7extern ia64_mv_send_ipi_t xen_platform_send_ipi;
8
9/*
10 * This stuff has dual use!
11 *
12 * For a generic kernel, the macros are used to initialize the
13 * platform's machvec structure. When compiling a non-generic kernel,
14 * the macros are used directly.
15 */
16#define platform_name "xen"
17#define platform_setup dig_setup
18#define platform_cpu_init xen_cpu_init
19#define platform_irq_init xen_irq_init
20#define platform_send_ipi xen_platform_send_ipi
21
22#endif /* _ASM_IA64_MACHVEC_XEN_h */
diff --git a/arch/ia64/include/asm/meminit.h b/arch/ia64/include/asm/meminit.h
index 7245a5781594..6bc96ee54327 100644
--- a/arch/ia64/include/asm/meminit.h
+++ b/arch/ia64/include/asm/meminit.h
@@ -18,10 +18,11 @@
18 * - crash dumping code reserved region 18 * - crash dumping code reserved region
19 * - Kernel memory map built from EFI memory map 19 * - Kernel memory map built from EFI memory map
20 * - ELF core header 20 * - ELF core header
21 * - xen start info if CONFIG_XEN
21 * 22 *
22 * More could be added if necessary 23 * More could be added if necessary
23 */ 24 */
24#define IA64_MAX_RSVD_REGIONS 8 25#define IA64_MAX_RSVD_REGIONS 9
25 26
26struct rsvd_region { 27struct rsvd_region {
27 unsigned long start; /* virtual address of beginning of element */ 28 unsigned long start; /* virtual address of beginning of element */
diff --git a/arch/ia64/include/asm/native/inst.h b/arch/ia64/include/asm/native/inst.h
index c8efbf7b849e..0a1026cca4fa 100644
--- a/arch/ia64/include/asm/native/inst.h
+++ b/arch/ia64/include/asm/native/inst.h
@@ -36,8 +36,13 @@
36 ;; \ 36 ;; \
37 movl clob = PARAVIRT_POISON; \ 37 movl clob = PARAVIRT_POISON; \
38 ;; 38 ;;
39# define CLOBBER_PRED(pred_clob) \
40 ;; \
41 cmp.eq pred_clob, p0 = r0, r0 \
42 ;;
39#else 43#else
40# define CLOBBER(clob) /* nothing */ 44# define CLOBBER(clob) /* nothing */
45# define CLOBBER_PRED(pred_clob) /* nothing */
41#endif 46#endif
42 47
43#define MOV_FROM_IFA(reg) \ 48#define MOV_FROM_IFA(reg) \
@@ -136,7 +141,8 @@
136 141
137#define SSM_PSR_I(pred, pred_clob, clob) \ 142#define SSM_PSR_I(pred, pred_clob, clob) \
138(pred) ssm psr.i \ 143(pred) ssm psr.i \
139 CLOBBER(clob) 144 CLOBBER(clob) \
145 CLOBBER_PRED(pred_clob)
140 146
141#define RSM_PSR_I(pred, clob0, clob1) \ 147#define RSM_PSR_I(pred, clob0, clob1) \
142(pred) rsm psr.i \ 148(pred) rsm psr.i \
diff --git a/arch/ia64/include/asm/native/pvchk_inst.h b/arch/ia64/include/asm/native/pvchk_inst.h
new file mode 100644
index 000000000000..b8e6eb1090d7
--- /dev/null
+++ b/arch/ia64/include/asm/native/pvchk_inst.h
@@ -0,0 +1,263 @@
1#ifndef _ASM_NATIVE_PVCHK_INST_H
2#define _ASM_NATIVE_PVCHK_INST_H
3
4/******************************************************************************
5 * arch/ia64/include/asm/native/pvchk_inst.h
6 * Checker for paravirtualizations of privileged operations.
7 *
8 * Copyright (C) 2005 Hewlett-Packard Co
9 * Dan Magenheimer <dan.magenheimer@hp.com>
10 *
11 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
12 * VA Linux Systems Japan K.K.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30/**********************************************
31 * Instructions paravirtualized for correctness
32 **********************************************/
33
34/* "fc" and "thash" are privilege-sensitive instructions, meaning they
35 * may have different semantics depending on whether they are executed
36 * at PL0 vs PL!=0. When paravirtualized, these instructions mustn't
37 * be allowed to execute directly, lest incorrect semantics result.
38 */
39
40#define fc .error "fc should not be used directly."
41#define thash .error "thash should not be used directly."
42
43/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
44 * is not currently used (though it may be in a long-format VHPT system!)
45 * and the semantics of cover only change if psr.ic is off which is very
46 * rare (and currently non-existent outside of assembly code
47 */
48#define ttag .error "ttag should not be used directly."
49#define cover .error "cover should not be used directly."
50
51/* There are also privilege-sensitive registers. These registers are
52 * readable at any privilege level but only writable at PL0.
53 */
54#define cpuid .error "cpuid should not be used directly."
55#define pmd .error "pmd should not be used directly."
56
57/*
58 * mov ar.eflag =
59 * mov = ar.eflag
60 */
61
62/**********************************************
63 * Instructions paravirtualized for performance
64 **********************************************/
65/*
66 * Those instructions include '.' which can't be handled by cpp.
67 * or can't be handled by cpp easily.
68 * They are handled by sed instead of cpp.
69 */
70
71/* for .S
72 * itc.i
73 * itc.d
74 *
75 * bsw.0
76 * bsw.1
77 *
78 * ssm psr.ic | PSR_DEFAULT_BITS
79 * ssm psr.ic
80 * rsm psr.ic
81 * ssm psr.i
82 * rsm psr.i
83 * rsm psr.i | psr.ic
84 * rsm psr.dt
85 * ssm psr.dt
86 *
87 * mov = cr.ifa
88 * mov = cr.itir
89 * mov = cr.isr
90 * mov = cr.iha
91 * mov = cr.ipsr
92 * mov = cr.iim
93 * mov = cr.iip
94 * mov = cr.ivr
95 * mov = psr
96 *
97 * mov cr.ifa =
98 * mov cr.itir =
99 * mov cr.iha =
100 * mov cr.ipsr =
101 * mov cr.ifs =
102 * mov cr.iip =
103 * mov cr.kr =
104 */
105
106/* for intrinsics
107 * ssm psr.i
108 * rsm psr.i
109 * mov = psr
110 * mov = ivr
111 * mov = tpr
112 * mov cr.itm =
113 * mov eoi =
114 * mov rr[] =
115 * mov = rr[]
116 * mov = kr
117 * mov kr =
118 * ptc.ga
119 */
120
121/*************************************************************
122 * define paravirtualized instrcution macros as nop to ingore.
123 * and check whether arguments are appropriate.
124 *************************************************************/
125
126/* check whether reg is a regular register */
127.macro is_rreg_in reg
128 .ifc "\reg", "r0"
129 nop 0
130 .exitm
131 .endif
132 ;;
133 mov \reg = r0
134 ;;
135.endm
136#define IS_RREG_IN(reg) is_rreg_in reg ;
137
138#define IS_RREG_OUT(reg) \
139 ;; \
140 mov reg = r0 \
141 ;;
142
143#define IS_RREG_CLOB(reg) IS_RREG_OUT(reg)
144
145/* check whether pred is a predicate register */
146#define IS_PRED_IN(pred) \
147 ;; \
148 (pred) nop 0 \
149 ;;
150
151#define IS_PRED_OUT(pred) \
152 ;; \
153 cmp.eq pred, p0 = r0, r0 \
154 ;;
155
156#define IS_PRED_CLOB(pred) IS_PRED_OUT(pred)
157
158
159#define DO_SAVE_MIN(__COVER, SAVE_IFS, EXTRA, WORKAROUND) \
160 nop 0
161#define MOV_FROM_IFA(reg) \
162 IS_RREG_OUT(reg)
163#define MOV_FROM_ITIR(reg) \
164 IS_RREG_OUT(reg)
165#define MOV_FROM_ISR(reg) \
166 IS_RREG_OUT(reg)
167#define MOV_FROM_IHA(reg) \
168 IS_RREG_OUT(reg)
169#define MOV_FROM_IPSR(pred, reg) \
170 IS_PRED_IN(pred) \
171 IS_RREG_OUT(reg)
172#define MOV_FROM_IIM(reg) \
173 IS_RREG_OUT(reg)
174#define MOV_FROM_IIP(reg) \
175 IS_RREG_OUT(reg)
176#define MOV_FROM_IVR(reg, clob) \
177 IS_RREG_OUT(reg) \
178 IS_RREG_CLOB(clob)
179#define MOV_FROM_PSR(pred, reg, clob) \
180 IS_PRED_IN(pred) \
181 IS_RREG_OUT(reg) \
182 IS_RREG_CLOB(clob)
183#define MOV_TO_IFA(reg, clob) \
184 IS_RREG_IN(reg) \
185 IS_RREG_CLOB(clob)
186#define MOV_TO_ITIR(pred, reg, clob) \
187 IS_PRED_IN(pred) \
188 IS_RREG_IN(reg) \
189 IS_RREG_CLOB(clob)
190#define MOV_TO_IHA(pred, reg, clob) \
191 IS_PRED_IN(pred) \
192 IS_RREG_IN(reg) \
193 IS_RREG_CLOB(clob)
194#define MOV_TO_IPSR(pred, reg, clob) \
195 IS_PRED_IN(pred) \
196 IS_RREG_IN(reg) \
197 IS_RREG_CLOB(clob)
198#define MOV_TO_IFS(pred, reg, clob) \
199 IS_PRED_IN(pred) \
200 IS_RREG_IN(reg) \
201 IS_RREG_CLOB(clob)
202#define MOV_TO_IIP(reg, clob) \
203 IS_RREG_IN(reg) \
204 IS_RREG_CLOB(clob)
205#define MOV_TO_KR(kr, reg, clob0, clob1) \
206 IS_RREG_IN(reg) \
207 IS_RREG_CLOB(clob0) \
208 IS_RREG_CLOB(clob1)
209#define ITC_I(pred, reg, clob) \
210 IS_PRED_IN(pred) \
211 IS_RREG_IN(reg) \
212 IS_RREG_CLOB(clob)
213#define ITC_D(pred, reg, clob) \
214 IS_PRED_IN(pred) \
215 IS_RREG_IN(reg) \
216 IS_RREG_CLOB(clob)
217#define ITC_I_AND_D(pred_i, pred_d, reg, clob) \
218 IS_PRED_IN(pred_i) \
219 IS_PRED_IN(pred_d) \
220 IS_RREG_IN(reg) \
221 IS_RREG_CLOB(clob)
222#define THASH(pred, reg0, reg1, clob) \
223 IS_PRED_IN(pred) \
224 IS_RREG_OUT(reg0) \
225 IS_RREG_IN(reg1) \
226 IS_RREG_CLOB(clob)
227#define SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(clob0, clob1) \
228 IS_RREG_CLOB(clob0) \
229 IS_RREG_CLOB(clob1)
230#define SSM_PSR_IC_AND_SRLZ_D(clob0, clob1) \
231 IS_RREG_CLOB(clob0) \
232 IS_RREG_CLOB(clob1)
233#define RSM_PSR_IC(clob) \
234 IS_RREG_CLOB(clob)
235#define SSM_PSR_I(pred, pred_clob, clob) \
236 IS_PRED_IN(pred) \
237 IS_PRED_CLOB(pred_clob) \
238 IS_RREG_CLOB(clob)
239#define RSM_PSR_I(pred, clob0, clob1) \
240 IS_PRED_IN(pred) \
241 IS_RREG_CLOB(clob0) \
242 IS_RREG_CLOB(clob1)
243#define RSM_PSR_I_IC(clob0, clob1, clob2) \
244 IS_RREG_CLOB(clob0) \
245 IS_RREG_CLOB(clob1) \
246 IS_RREG_CLOB(clob2)
247#define RSM_PSR_DT \
248 nop 0
249#define SSM_PSR_DT_AND_SRLZ_I \
250 nop 0
251#define BSW_0(clob0, clob1, clob2) \
252 IS_RREG_CLOB(clob0) \
253 IS_RREG_CLOB(clob1) \
254 IS_RREG_CLOB(clob2)
255#define BSW_1(clob0, clob1) \
256 IS_RREG_CLOB(clob0) \
257 IS_RREG_CLOB(clob1)
258#define COVER \
259 nop 0
260#define RFI \
261 br.ret.sptk.many rp /* defining nop causes dependency error */
262
263#endif /* _ASM_NATIVE_PVCHK_INST_H */
diff --git a/arch/ia64/include/asm/paravirt.h b/arch/ia64/include/asm/paravirt.h
index 660cab044834..2bf3636473fe 100644
--- a/arch/ia64/include/asm/paravirt.h
+++ b/arch/ia64/include/asm/paravirt.h
@@ -117,7 +117,7 @@ static inline void paravirt_post_smp_prepare_boot_cpu(void)
117struct pv_iosapic_ops { 117struct pv_iosapic_ops {
118 void (*pcat_compat_init)(void); 118 void (*pcat_compat_init)(void);
119 119
120 struct irq_chip *(*get_irq_chip)(unsigned long trigger); 120 struct irq_chip *(*__get_irq_chip)(unsigned long trigger);
121 121
122 unsigned int (*__read)(char __iomem *iosapic, unsigned int reg); 122 unsigned int (*__read)(char __iomem *iosapic, unsigned int reg);
123 void (*__write)(char __iomem *iosapic, unsigned int reg, u32 val); 123 void (*__write)(char __iomem *iosapic, unsigned int reg, u32 val);
@@ -135,7 +135,7 @@ iosapic_pcat_compat_init(void)
135static inline struct irq_chip* 135static inline struct irq_chip*
136iosapic_get_irq_chip(unsigned long trigger) 136iosapic_get_irq_chip(unsigned long trigger)
137{ 137{
138 return pv_iosapic_ops.get_irq_chip(trigger); 138 return pv_iosapic_ops.__get_irq_chip(trigger);
139} 139}
140 140
141static inline unsigned int 141static inline unsigned int
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index ce342fb74246..1d660d89db0d 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -156,4 +156,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
156 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14); 156 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14);
157} 157}
158 158
159#ifdef CONFIG_DMAR
160extern void pci_iommu_alloc(void);
161#endif
159#endif /* _ASM_IA64_PCI_H */ 162#endif /* _ASM_IA64_PCI_H */
diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h
index 15f8dcfe6eee..6417c1ecb44e 100644
--- a/arch/ia64/include/asm/ptrace.h
+++ b/arch/ia64/include/asm/ptrace.h
@@ -240,6 +240,12 @@ struct switch_stack {
240 */ 240 */
241# define instruction_pointer(regs) ((regs)->cr_iip + ia64_psr(regs)->ri) 241# define instruction_pointer(regs) ((regs)->cr_iip + ia64_psr(regs)->ri)
242 242
243static inline unsigned long user_stack_pointer(struct pt_regs *regs)
244{
245 /* FIXME: should this be bspstore + nr_dirty regs? */
246 return regs->ar_bspstore;
247}
248
243#define regs_return_value(regs) ((regs)->r8) 249#define regs_return_value(regs) ((regs)->r8)
244 250
245/* Conserve space in histogram by encoding slot bits in address 251/* Conserve space in histogram by encoding slot bits in address
@@ -319,6 +325,8 @@ struct switch_stack {
319 #define arch_has_block_step() (1) 325 #define arch_has_block_step() (1)
320 extern void user_enable_block_step(struct task_struct *); 326 extern void user_enable_block_step(struct task_struct *);
321 327
328#define __ARCH_WANT_COMPAT_SYS_PTRACE
329
322#endif /* !__KERNEL__ */ 330#endif /* !__KERNEL__ */
323 331
324/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ 332/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */
diff --git a/arch/ia64/include/asm/pvclock-abi.h b/arch/ia64/include/asm/pvclock-abi.h
new file mode 100644
index 000000000000..44ef9ef8f5b3
--- /dev/null
+++ b/arch/ia64/include/asm/pvclock-abi.h
@@ -0,0 +1,48 @@
1/*
2 * same structure to x86's
3 * Hopefully asm-x86/pvclock-abi.h would be moved to somewhere more generic.
4 * For now, define same duplicated definitions.
5 */
6
7#ifndef _ASM_IA64__PVCLOCK_ABI_H
8#define _ASM_IA64__PVCLOCK_ABI_H
9#ifndef __ASSEMBLY__
10
11/*
12 * These structs MUST NOT be changed.
13 * They are the ABI between hypervisor and guest OS.
14 * Both Xen and KVM are using this.
15 *
16 * pvclock_vcpu_time_info holds the system time and the tsc timestamp
17 * of the last update. So the guest can use the tsc delta to get a
18 * more precise system time. There is one per virtual cpu.
19 *
20 * pvclock_wall_clock references the point in time when the system
21 * time was zero (usually boot time), thus the guest calculates the
22 * current wall clock by adding the system time.
23 *
24 * Protocol for the "version" fields is: hypervisor raises it (making
25 * it uneven) before it starts updating the fields and raises it again
26 * (making it even) when it is done. Thus the guest can make sure the
27 * time values it got are consistent by checking the version before
28 * and after reading them.
29 */
30
31struct pvclock_vcpu_time_info {
32 u32 version;
33 u32 pad0;
34 u64 tsc_timestamp;
35 u64 system_time;
36 u32 tsc_to_system_mul;
37 s8 tsc_shift;
38 u8 pad[3];
39} __attribute__((__packed__)); /* 32 bytes */
40
41struct pvclock_wall_clock {
42 u32 version;
43 u32 sec;
44 u32 nsec;
45} __attribute__((__packed__));
46
47#endif /* __ASSEMBLY__ */
48#endif /* _ASM_IA64__PVCLOCK_ABI_H */
diff --git a/arch/ia64/include/asm/swiotlb.h b/arch/ia64/include/asm/swiotlb.h
new file mode 100644
index 000000000000..fb79423834d0
--- /dev/null
+++ b/arch/ia64/include/asm/swiotlb.h
@@ -0,0 +1,56 @@
1#ifndef ASM_IA64__SWIOTLB_H
2#define ASM_IA64__SWIOTLB_H
3
4#include <linux/dma-mapping.h>
5
6/* SWIOTLB interface */
7
8extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
9 size_t size, int dir);
10extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
11 dma_addr_t *dma_handle, gfp_t flags);
12extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
13 size_t size, int dir);
14extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
15 dma_addr_t dev_addr,
16 size_t size, int dir);
17extern void swiotlb_sync_single_for_device(struct device *hwdev,
18 dma_addr_t dev_addr,
19 size_t size, int dir);
20extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev,
21 dma_addr_t dev_addr,
22 unsigned long offset,
23 size_t size, int dir);
24extern void swiotlb_sync_single_range_for_device(struct device *hwdev,
25 dma_addr_t dev_addr,
26 unsigned long offset,
27 size_t size, int dir);
28extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
29 struct scatterlist *sg, int nelems,
30 int dir);
31extern void swiotlb_sync_sg_for_device(struct device *hwdev,
32 struct scatterlist *sg, int nelems,
33 int dir);
34extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
35 int nents, int direction);
36extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
37 int nents, int direction);
38extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
39extern void swiotlb_free_coherent(struct device *hwdev, size_t size,
40 void *vaddr, dma_addr_t dma_handle);
41extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
42extern void swiotlb_init(void);
43
44extern int swiotlb_force;
45
46#ifdef CONFIG_SWIOTLB
47extern int swiotlb;
48extern void pci_swiotlb_init(void);
49#else
50#define swiotlb 0
51static inline void pci_swiotlb_init(void)
52{
53}
54#endif
55
56#endif /* ASM_IA64__SWIOTLB_H */
diff --git a/arch/ia64/include/asm/sync_bitops.h b/arch/ia64/include/asm/sync_bitops.h
new file mode 100644
index 000000000000..593c12eeb270
--- /dev/null
+++ b/arch/ia64/include/asm/sync_bitops.h
@@ -0,0 +1,51 @@
1#ifndef _ASM_IA64_SYNC_BITOPS_H
2#define _ASM_IA64_SYNC_BITOPS_H
3
4/*
5 * Copyright (C) 2008 Isaku Yamahata <yamahata at valinux co jp>
6 *
7 * Based on synch_bitops.h which Dan Magenhaimer wrote.
8 *
9 * bit operations which provide guaranteed strong synchronisation
10 * when communicating with Xen or other guest OSes running on other CPUs.
11 */
12
13static inline void sync_set_bit(int nr, volatile void *addr)
14{
15 set_bit(nr, addr);
16}
17
18static inline void sync_clear_bit(int nr, volatile void *addr)
19{
20 clear_bit(nr, addr);
21}
22
23static inline void sync_change_bit(int nr, volatile void *addr)
24{
25 change_bit(nr, addr);
26}
27
28static inline int sync_test_and_set_bit(int nr, volatile void *addr)
29{
30 return test_and_set_bit(nr, addr);
31}
32
33static inline int sync_test_and_clear_bit(int nr, volatile void *addr)
34{
35 return test_and_clear_bit(nr, addr);
36}
37
38static inline int sync_test_and_change_bit(int nr, volatile void *addr)
39{
40 return test_and_change_bit(nr, addr);
41}
42
43static inline int sync_test_bit(int nr, const volatile void *addr)
44{
45 return test_bit(nr, addr);
46}
47
48#define sync_cmpxchg(ptr, old, new) \
49 ((__typeof__(*(ptr)))cmpxchg_acq((ptr), (old), (new)))
50
51#endif /* _ASM_IA64_SYNC_BITOPS_H */
diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
new file mode 100644
index 000000000000..2f758a42f94b
--- /dev/null
+++ b/arch/ia64/include/asm/syscall.h
@@ -0,0 +1,163 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * Copyright (C) 2008 Intel Corp. Shaohua Li <shaohua.li@intel.com>
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * See asm-generic/syscall.h for descriptions of what we must do here.
11 */
12
13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1
15
16#include <linux/sched.h>
17#include <linux/err.h>
18
19static inline long syscall_get_nr(struct task_struct *task,
20 struct pt_regs *regs)
21{
22 if ((long)regs->cr_ifs < 0) /* Not a syscall */
23 return -1;
24
25#ifdef CONFIG_IA32_SUPPORT
26 if (IS_IA32_PROCESS(regs))
27 return regs->r1;
28#endif
29
30 return regs->r15;
31}
32
33static inline void syscall_rollback(struct task_struct *task,
34 struct pt_regs *regs)
35{
36#ifdef CONFIG_IA32_SUPPORT
37 if (IS_IA32_PROCESS(regs))
38 regs->r8 = regs->r1;
39#endif
40
41 /* do nothing */
42}
43
44static inline long syscall_get_error(struct task_struct *task,
45 struct pt_regs *regs)
46{
47#ifdef CONFIG_IA32_SUPPORT
48 if (IS_IA32_PROCESS(regs))
49 return regs->r8;
50#endif
51
52 return regs->r10 == -1 ? regs->r8:0;
53}
54
55static inline long syscall_get_return_value(struct task_struct *task,
56 struct pt_regs *regs)
57{
58 return regs->r8;
59}
60
61static inline void syscall_set_return_value(struct task_struct *task,
62 struct pt_regs *regs,
63 int error, long val)
64{
65#ifdef CONFIG_IA32_SUPPORT
66 if (IS_IA32_PROCESS(regs)) {
67 regs->r8 = (long) error ? error : val;
68 return;
69 }
70#endif
71
72 if (error) {
73 /* error < 0, but ia64 uses > 0 return value */
74 regs->r8 = -error;
75 regs->r10 = -1;
76 } else {
77 regs->r8 = val;
78 regs->r10 = 0;
79 }
80}
81
82extern void ia64_syscall_get_set_arguments(struct task_struct *task,
83 struct pt_regs *regs, unsigned int i, unsigned int n,
84 unsigned long *args, int rw);
85static inline void syscall_get_arguments(struct task_struct *task,
86 struct pt_regs *regs,
87 unsigned int i, unsigned int n,
88 unsigned long *args)
89{
90 BUG_ON(i + n > 6);
91
92#ifdef CONFIG_IA32_SUPPORT
93 if (IS_IA32_PROCESS(regs)) {
94 switch (i + n) {
95 case 6:
96 if (!n--) break;
97 *args++ = regs->r13;
98 case 5:
99 if (!n--) break;
100 *args++ = regs->r15;
101 case 4:
102 if (!n--) break;
103 *args++ = regs->r14;
104 case 3:
105 if (!n--) break;
106 *args++ = regs->r10;
107 case 2:
108 if (!n--) break;
109 *args++ = regs->r9;
110 case 1:
111 if (!n--) break;
112 *args++ = regs->r11;
113 case 0:
114 if (!n--) break;
115 default:
116 BUG();
117 break;
118 }
119
120 return;
121 }
122#endif
123 ia64_syscall_get_set_arguments(task, regs, i, n, args, 0);
124}
125
126static inline void syscall_set_arguments(struct task_struct *task,
127 struct pt_regs *regs,
128 unsigned int i, unsigned int n,
129 unsigned long *args)
130{
131 BUG_ON(i + n > 6);
132
133#ifdef CONFIG_IA32_SUPPORT
134 if (IS_IA32_PROCESS(regs)) {
135 switch (i + n) {
136 case 6:
137 if (!n--) break;
138 regs->r13 = *args++;
139 case 5:
140 if (!n--) break;
141 regs->r15 = *args++;
142 case 4:
143 if (!n--) break;
144 regs->r14 = *args++;
145 case 3:
146 if (!n--) break;
147 regs->r10 = *args++;
148 case 2:
149 if (!n--) break;
150 regs->r9 = *args++;
151 case 1:
152 if (!n--) break;
153 regs->r11 = *args++;
154 case 0:
155 if (!n--) break;
156 }
157
158 return;
159 }
160#endif
161 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
162}
163#endif /* _ASM_SYSCALL_H */
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h
index 7c60fcdd2efd..ae6922626bf4 100644
--- a/arch/ia64/include/asm/thread_info.h
+++ b/arch/ia64/include/asm/thread_info.h
@@ -87,9 +87,6 @@ struct thread_info {
87#define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL | __GFP_COMP, KERNEL_STACK_SIZE_ORDER)) 87#define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL | __GFP_COMP, KERNEL_STACK_SIZE_ORDER))
88#define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER) 88#define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER)
89 89
90#define tsk_set_notify_resume(tsk) \
91 set_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME)
92extern void tsk_clear_notify_resume(struct task_struct *tsk);
93#endif /* !__ASSEMBLY */ 90#endif /* !__ASSEMBLY */
94 91
95/* 92/*
diff --git a/arch/ia64/include/asm/timex.h b/arch/ia64/include/asm/timex.h
index 05a6baf8a472..4e03cfe74a0c 100644
--- a/arch/ia64/include/asm/timex.h
+++ b/arch/ia64/include/asm/timex.h
@@ -39,4 +39,6 @@ get_cycles (void)
39 return ret; 39 return ret;
40} 40}
41 41
42extern void ia64_cpu_local_tick (void);
43
42#endif /* _ASM_IA64_TIMEX_H */ 44#endif /* _ASM_IA64_TIMEX_H */
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index d535833aab5e..f791576355ad 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -337,6 +337,7 @@
337# define __ARCH_WANT_SYS_NICE 337# define __ARCH_WANT_SYS_NICE
338# define __ARCH_WANT_SYS_OLD_GETRLIMIT 338# define __ARCH_WANT_SYS_OLD_GETRLIMIT
339# define __ARCH_WANT_SYS_OLDUMOUNT 339# define __ARCH_WANT_SYS_OLDUMOUNT
340# define __ARCH_WANT_SYS_PAUSE
340# define __ARCH_WANT_SYS_SIGPENDING 341# define __ARCH_WANT_SYS_SIGPENDING
341# define __ARCH_WANT_SYS_SIGPROCMASK 342# define __ARCH_WANT_SYS_SIGPROCMASK
342# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 343# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
diff --git a/arch/ia64/include/asm/xen/events.h b/arch/ia64/include/asm/xen/events.h
new file mode 100644
index 000000000000..73248781fba8
--- /dev/null
+++ b/arch/ia64/include/asm/xen/events.h
@@ -0,0 +1,50 @@
1/******************************************************************************
2 * arch/ia64/include/asm/xen/events.h
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef _ASM_IA64_XEN_EVENTS_H
23#define _ASM_IA64_XEN_EVENTS_H
24
25enum ipi_vector {
26 XEN_RESCHEDULE_VECTOR,
27 XEN_IPI_VECTOR,
28 XEN_CMCP_VECTOR,
29 XEN_CPEP_VECTOR,
30
31 XEN_NR_IPIS,
32};
33
34static inline int xen_irqs_disabled(struct pt_regs *regs)
35{
36 return !(ia64_psr(regs)->i);
37}
38
39static inline void xen_do_IRQ(int irq, struct pt_regs *regs)
40{
41 struct pt_regs *old_regs;
42 old_regs = set_irq_regs(regs);
43 irq_enter();
44 __do_IRQ(irq);
45 irq_exit();
46 set_irq_regs(old_regs);
47}
48#define irq_ctx_init(cpu) do { } while (0)
49
50#endif /* _ASM_IA64_XEN_EVENTS_H */
diff --git a/arch/ia64/include/asm/xen/grant_table.h b/arch/ia64/include/asm/xen/grant_table.h
new file mode 100644
index 000000000000..2b1fae0e2d11
--- /dev/null
+++ b/arch/ia64/include/asm/xen/grant_table.h
@@ -0,0 +1,29 @@
1/******************************************************************************
2 * arch/ia64/include/asm/xen/grant_table.h
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef _ASM_IA64_XEN_GRANT_TABLE_H
24#define _ASM_IA64_XEN_GRANT_TABLE_H
25
26struct vm_struct *xen_alloc_vm_area(unsigned long size);
27void xen_free_vm_area(struct vm_struct *area);
28
29#endif /* _ASM_IA64_XEN_GRANT_TABLE_H */
diff --git a/arch/ia64/include/asm/xen/hypercall.h b/arch/ia64/include/asm/xen/hypercall.h
new file mode 100644
index 000000000000..96fc62366aa4
--- /dev/null
+++ b/arch/ia64/include/asm/xen/hypercall.h
@@ -0,0 +1,265 @@
1/******************************************************************************
2 * hypercall.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef _ASM_IA64_XEN_HYPERCALL_H
34#define _ASM_IA64_XEN_HYPERCALL_H
35
36#include <xen/interface/xen.h>
37#include <xen/interface/physdev.h>
38#include <xen/interface/sched.h>
39#include <asm/xen/xcom_hcall.h>
40struct xencomm_handle;
41extern unsigned long __hypercall(unsigned long a1, unsigned long a2,
42 unsigned long a3, unsigned long a4,
43 unsigned long a5, unsigned long cmd);
44
45/*
46 * Assembler stubs for hyper-calls.
47 */
48
49#define _hypercall0(type, name) \
50({ \
51 long __res; \
52 __res = __hypercall(0, 0, 0, 0, 0, __HYPERVISOR_##name);\
53 (type)__res; \
54})
55
56#define _hypercall1(type, name, a1) \
57({ \
58 long __res; \
59 __res = __hypercall((unsigned long)a1, \
60 0, 0, 0, 0, __HYPERVISOR_##name); \
61 (type)__res; \
62})
63
64#define _hypercall2(type, name, a1, a2) \
65({ \
66 long __res; \
67 __res = __hypercall((unsigned long)a1, \
68 (unsigned long)a2, \
69 0, 0, 0, __HYPERVISOR_##name); \
70 (type)__res; \
71})
72
73#define _hypercall3(type, name, a1, a2, a3) \
74({ \
75 long __res; \
76 __res = __hypercall((unsigned long)a1, \
77 (unsigned long)a2, \
78 (unsigned long)a3, \
79 0, 0, __HYPERVISOR_##name); \
80 (type)__res; \
81})
82
83#define _hypercall4(type, name, a1, a2, a3, a4) \
84({ \
85 long __res; \
86 __res = __hypercall((unsigned long)a1, \
87 (unsigned long)a2, \
88 (unsigned long)a3, \
89 (unsigned long)a4, \
90 0, __HYPERVISOR_##name); \
91 (type)__res; \
92})
93
94#define _hypercall5(type, name, a1, a2, a3, a4, a5) \
95({ \
96 long __res; \
97 __res = __hypercall((unsigned long)a1, \
98 (unsigned long)a2, \
99 (unsigned long)a3, \
100 (unsigned long)a4, \
101 (unsigned long)a5, \
102 __HYPERVISOR_##name); \
103 (type)__res; \
104})
105
106
107static inline int
108xencomm_arch_hypercall_sched_op(int cmd, struct xencomm_handle *arg)
109{
110 return _hypercall2(int, sched_op_new, cmd, arg);
111}
112
113static inline long
114HYPERVISOR_set_timer_op(u64 timeout)
115{
116 unsigned long timeout_hi = (unsigned long)(timeout >> 32);
117 unsigned long timeout_lo = (unsigned long)timeout;
118 return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
119}
120
121static inline int
122xencomm_arch_hypercall_multicall(struct xencomm_handle *call_list,
123 int nr_calls)
124{
125 return _hypercall2(int, multicall, call_list, nr_calls);
126}
127
128static inline int
129xencomm_arch_hypercall_memory_op(unsigned int cmd, struct xencomm_handle *arg)
130{
131 return _hypercall2(int, memory_op, cmd, arg);
132}
133
134static inline int
135xencomm_arch_hypercall_event_channel_op(int cmd, struct xencomm_handle *arg)
136{
137 return _hypercall2(int, event_channel_op, cmd, arg);
138}
139
140static inline int
141xencomm_arch_hypercall_xen_version(int cmd, struct xencomm_handle *arg)
142{
143 return _hypercall2(int, xen_version, cmd, arg);
144}
145
146static inline int
147xencomm_arch_hypercall_console_io(int cmd, int count,
148 struct xencomm_handle *str)
149{
150 return _hypercall3(int, console_io, cmd, count, str);
151}
152
153static inline int
154xencomm_arch_hypercall_physdev_op(int cmd, struct xencomm_handle *arg)
155{
156 return _hypercall2(int, physdev_op, cmd, arg);
157}
158
159static inline int
160xencomm_arch_hypercall_grant_table_op(unsigned int cmd,
161 struct xencomm_handle *uop,
162 unsigned int count)
163{
164 return _hypercall3(int, grant_table_op, cmd, uop, count);
165}
166
167int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
168
169extern int xencomm_arch_hypercall_suspend(struct xencomm_handle *arg);
170
171static inline int
172xencomm_arch_hypercall_callback_op(int cmd, struct xencomm_handle *arg)
173{
174 return _hypercall2(int, callback_op, cmd, arg);
175}
176
177static inline long
178xencomm_arch_hypercall_vcpu_op(int cmd, int cpu, void *arg)
179{
180 return _hypercall3(long, vcpu_op, cmd, cpu, arg);
181}
182
183static inline int
184HYPERVISOR_physdev_op(int cmd, void *arg)
185{
186 switch (cmd) {
187 case PHYSDEVOP_eoi:
188 return _hypercall1(int, ia64_fast_eoi,
189 ((struct physdev_eoi *)arg)->irq);
190 default:
191 return xencomm_hypercall_physdev_op(cmd, arg);
192 }
193}
194
195static inline long
196xencomm_arch_hypercall_opt_feature(struct xencomm_handle *arg)
197{
198 return _hypercall1(long, opt_feature, arg);
199}
200
201/* for balloon driver */
202#define HYPERVISOR_update_va_mapping(va, new_val, flags) (0)
203
204/* Use xencomm to do hypercalls. */
205#define HYPERVISOR_sched_op xencomm_hypercall_sched_op
206#define HYPERVISOR_event_channel_op xencomm_hypercall_event_channel_op
207#define HYPERVISOR_callback_op xencomm_hypercall_callback_op
208#define HYPERVISOR_multicall xencomm_hypercall_multicall
209#define HYPERVISOR_xen_version xencomm_hypercall_xen_version
210#define HYPERVISOR_console_io xencomm_hypercall_console_io
211#define HYPERVISOR_memory_op xencomm_hypercall_memory_op
212#define HYPERVISOR_suspend xencomm_hypercall_suspend
213#define HYPERVISOR_vcpu_op xencomm_hypercall_vcpu_op
214#define HYPERVISOR_opt_feature xencomm_hypercall_opt_feature
215
216/* to compile gnttab_copy_grant_page() in drivers/xen/core/gnttab.c */
217#define HYPERVISOR_mmu_update(req, count, success_count, domid) ({ BUG(); 0; })
218
219static inline int
220HYPERVISOR_shutdown(
221 unsigned int reason)
222{
223 struct sched_shutdown sched_shutdown = {
224 .reason = reason
225 };
226
227 int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
228
229 return rc;
230}
231
232/* for netfront.c, netback.c */
233#define MULTI_UVMFLAGS_INDEX 0 /* XXX any value */
234
235static inline void
236MULTI_update_va_mapping(
237 struct multicall_entry *mcl, unsigned long va,
238 pte_t new_val, unsigned long flags)
239{
240 mcl->op = __HYPERVISOR_update_va_mapping;
241 mcl->result = 0;
242}
243
244static inline void
245MULTI_grant_table_op(struct multicall_entry *mcl, unsigned int cmd,
246 void *uop, unsigned int count)
247{
248 mcl->op = __HYPERVISOR_grant_table_op;
249 mcl->args[0] = cmd;
250 mcl->args[1] = (unsigned long)uop;
251 mcl->args[2] = count;
252}
253
254static inline void
255MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
256 int count, int *success_count, domid_t domid)
257{
258 mcl->op = __HYPERVISOR_mmu_update;
259 mcl->args[0] = (unsigned long)req;
260 mcl->args[1] = count;
261 mcl->args[2] = (unsigned long)success_count;
262 mcl->args[3] = domid;
263}
264
265#endif /* _ASM_IA64_XEN_HYPERCALL_H */
diff --git a/arch/ia64/include/asm/xen/hypervisor.h b/arch/ia64/include/asm/xen/hypervisor.h
new file mode 100644
index 000000000000..7a804e80fc67
--- /dev/null
+++ b/arch/ia64/include/asm/xen/hypervisor.h
@@ -0,0 +1,89 @@
1/******************************************************************************
2 * hypervisor.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef _ASM_IA64_XEN_HYPERVISOR_H
34#define _ASM_IA64_XEN_HYPERVISOR_H
35
36#ifdef CONFIG_XEN
37
38#include <linux/init.h>
39#include <xen/interface/xen.h>
40#include <xen/interface/version.h> /* to compile feature.c */
41#include <xen/features.h> /* to comiple xen-netfront.c */
42#include <asm/xen/hypercall.h>
43
44/* xen_domain_type is set before executing any C code by early_xen_setup */
45enum xen_domain_type {
46 XEN_NATIVE,
47 XEN_PV_DOMAIN,
48 XEN_HVM_DOMAIN,
49};
50
51extern enum xen_domain_type xen_domain_type;
52
53#define xen_domain() (xen_domain_type != XEN_NATIVE)
54#define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN)
55#define xen_initial_domain() (xen_pv_domain() && \
56 (xen_start_info->flags & SIF_INITDOMAIN))
57#define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN)
58
59/* deprecated. remove this */
60#define is_running_on_xen() (xen_domain_type == XEN_PV_DOMAIN)
61
62extern struct shared_info *HYPERVISOR_shared_info;
63extern struct start_info *xen_start_info;
64
65void __init xen_setup_vcpu_info_placement(void);
66void force_evtchn_callback(void);
67
68/* for drivers/xen/balloon/balloon.c */
69#ifdef CONFIG_XEN_SCRUB_PAGES
70#define scrub_pages(_p, _n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
71#else
72#define scrub_pages(_p, _n) ((void)0)
73#endif
74
75/* For setup_arch() in arch/ia64/kernel/setup.c */
76void xen_ia64_enable_opt_feature(void);
77
78#else /* CONFIG_XEN */
79
80#define xen_domain() (0)
81#define xen_pv_domain() (0)
82#define xen_initial_domain() (0)
83#define xen_hvm_domain() (0)
84#define is_running_on_xen() (0) /* deprecated. remove this */
85#endif
86
87#define is_initial_xendomain() (0) /* deprecated. remove this */
88
89#endif /* _ASM_IA64_XEN_HYPERVISOR_H */
diff --git a/arch/ia64/include/asm/xen/inst.h b/arch/ia64/include/asm/xen/inst.h
new file mode 100644
index 000000000000..19c2ae1d878a
--- /dev/null
+++ b/arch/ia64/include/asm/xen/inst.h
@@ -0,0 +1,458 @@
1/******************************************************************************
2 * arch/ia64/include/asm/xen/inst.h
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include <asm/xen/privop.h>
24
25#define ia64_ivt xen_ivt
26#define DO_SAVE_MIN XEN_DO_SAVE_MIN
27
28#define __paravirt_switch_to xen_switch_to
29#define __paravirt_leave_syscall xen_leave_syscall
30#define __paravirt_work_processed_syscall xen_work_processed_syscall
31#define __paravirt_leave_kernel xen_leave_kernel
32#define __paravirt_pending_syscall_end xen_work_pending_syscall_end
33#define __paravirt_work_processed_syscall_target \
34 xen_work_processed_syscall
35
36#define MOV_FROM_IFA(reg) \
37 movl reg = XSI_IFA; \
38 ;; \
39 ld8 reg = [reg]
40
41#define MOV_FROM_ITIR(reg) \
42 movl reg = XSI_ITIR; \
43 ;; \
44 ld8 reg = [reg]
45
46#define MOV_FROM_ISR(reg) \
47 movl reg = XSI_ISR; \
48 ;; \
49 ld8 reg = [reg]
50
51#define MOV_FROM_IHA(reg) \
52 movl reg = XSI_IHA; \
53 ;; \
54 ld8 reg = [reg]
55
56#define MOV_FROM_IPSR(pred, reg) \
57(pred) movl reg = XSI_IPSR; \
58 ;; \
59(pred) ld8 reg = [reg]
60
61#define MOV_FROM_IIM(reg) \
62 movl reg = XSI_IIM; \
63 ;; \
64 ld8 reg = [reg]
65
66#define MOV_FROM_IIP(reg) \
67 movl reg = XSI_IIP; \
68 ;; \
69 ld8 reg = [reg]
70
71.macro __MOV_FROM_IVR reg, clob
72 .ifc "\reg", "r8"
73 XEN_HYPER_GET_IVR
74 .exitm
75 .endif
76 .ifc "\clob", "r8"
77 XEN_HYPER_GET_IVR
78 ;;
79 mov \reg = r8
80 .exitm
81 .endif
82
83 mov \clob = r8
84 ;;
85 XEN_HYPER_GET_IVR
86 ;;
87 mov \reg = r8
88 ;;
89 mov r8 = \clob
90.endm
91#define MOV_FROM_IVR(reg, clob) __MOV_FROM_IVR reg, clob
92
93.macro __MOV_FROM_PSR pred, reg, clob
94 .ifc "\reg", "r8"
95 (\pred) XEN_HYPER_GET_PSR;
96 .exitm
97 .endif
98 .ifc "\clob", "r8"
99 (\pred) XEN_HYPER_GET_PSR
100 ;;
101 (\pred) mov \reg = r8
102 .exitm
103 .endif
104
105 (\pred) mov \clob = r8
106 (\pred) XEN_HYPER_GET_PSR
107 ;;
108 (\pred) mov \reg = r8
109 (\pred) mov r8 = \clob
110.endm
111#define MOV_FROM_PSR(pred, reg, clob) __MOV_FROM_PSR pred, reg, clob
112
113
114#define MOV_TO_IFA(reg, clob) \
115 movl clob = XSI_IFA; \
116 ;; \
117 st8 [clob] = reg \
118
119#define MOV_TO_ITIR(pred, reg, clob) \
120(pred) movl clob = XSI_ITIR; \
121 ;; \
122(pred) st8 [clob] = reg
123
124#define MOV_TO_IHA(pred, reg, clob) \
125(pred) movl clob = XSI_IHA; \
126 ;; \
127(pred) st8 [clob] = reg
128
129#define MOV_TO_IPSR(pred, reg, clob) \
130(pred) movl clob = XSI_IPSR; \
131 ;; \
132(pred) st8 [clob] = reg; \
133 ;;
134
135#define MOV_TO_IFS(pred, reg, clob) \
136(pred) movl clob = XSI_IFS; \
137 ;; \
138(pred) st8 [clob] = reg; \
139 ;;
140
141#define MOV_TO_IIP(reg, clob) \
142 movl clob = XSI_IIP; \
143 ;; \
144 st8 [clob] = reg
145
146.macro ____MOV_TO_KR kr, reg, clob0, clob1
147 .ifc "\clob0", "r9"
148 .error "clob0 \clob0 must not be r9"
149 .endif
150 .ifc "\clob1", "r8"
151 .error "clob1 \clob1 must not be r8"
152 .endif
153
154 .ifnc "\reg", "r9"
155 .ifnc "\clob1", "r9"
156 mov \clob1 = r9
157 .endif
158 mov r9 = \reg
159 .endif
160 .ifnc "\clob0", "r8"
161 mov \clob0 = r8
162 .endif
163 mov r8 = \kr
164 ;;
165 XEN_HYPER_SET_KR
166
167 .ifnc "\reg", "r9"
168 .ifnc "\clob1", "r9"
169 mov r9 = \clob1
170 .endif
171 .endif
172 .ifnc "\clob0", "r8"
173 mov r8 = \clob0
174 .endif
175.endm
176
177.macro __MOV_TO_KR kr, reg, clob0, clob1
178 .ifc "\clob0", "r9"
179 ____MOV_TO_KR \kr, \reg, \clob1, \clob0
180 .exitm
181 .endif
182 .ifc "\clob1", "r8"
183 ____MOV_TO_KR \kr, \reg, \clob1, \clob0
184 .exitm
185 .endif
186
187 ____MOV_TO_KR \kr, \reg, \clob0, \clob1
188.endm
189
190#define MOV_TO_KR(kr, reg, clob0, clob1) \
191 __MOV_TO_KR IA64_KR_ ## kr, reg, clob0, clob1
192
193
194.macro __ITC_I pred, reg, clob
195 .ifc "\reg", "r8"
196 (\pred) XEN_HYPER_ITC_I
197 .exitm
198 .endif
199 .ifc "\clob", "r8"
200 (\pred) mov r8 = \reg
201 ;;
202 (\pred) XEN_HYPER_ITC_I
203 .exitm
204 .endif
205
206 (\pred) mov \clob = r8
207 (\pred) mov r8 = \reg
208 ;;
209 (\pred) XEN_HYPER_ITC_I
210 ;;
211 (\pred) mov r8 = \clob
212 ;;
213.endm
214#define ITC_I(pred, reg, clob) __ITC_I pred, reg, clob
215
216.macro __ITC_D pred, reg, clob
217 .ifc "\reg", "r8"
218 (\pred) XEN_HYPER_ITC_D
219 ;;
220 .exitm
221 .endif
222 .ifc "\clob", "r8"
223 (\pred) mov r8 = \reg
224 ;;
225 (\pred) XEN_HYPER_ITC_D
226 ;;
227 .exitm
228 .endif
229
230 (\pred) mov \clob = r8
231 (\pred) mov r8 = \reg
232 ;;
233 (\pred) XEN_HYPER_ITC_D
234 ;;
235 (\pred) mov r8 = \clob
236 ;;
237.endm
238#define ITC_D(pred, reg, clob) __ITC_D pred, reg, clob
239
240.macro __ITC_I_AND_D pred_i, pred_d, reg, clob
241 .ifc "\reg", "r8"
242 (\pred_i)XEN_HYPER_ITC_I
243 ;;
244 (\pred_d)XEN_HYPER_ITC_D
245 ;;
246 .exitm
247 .endif
248 .ifc "\clob", "r8"
249 mov r8 = \reg
250 ;;
251 (\pred_i)XEN_HYPER_ITC_I
252 ;;
253 (\pred_d)XEN_HYPER_ITC_D
254 ;;
255 .exitm
256 .endif
257
258 mov \clob = r8
259 mov r8 = \reg
260 ;;
261 (\pred_i)XEN_HYPER_ITC_I
262 ;;
263 (\pred_d)XEN_HYPER_ITC_D
264 ;;
265 mov r8 = \clob
266 ;;
267.endm
268#define ITC_I_AND_D(pred_i, pred_d, reg, clob) \
269 __ITC_I_AND_D pred_i, pred_d, reg, clob
270
271.macro __THASH pred, reg0, reg1, clob
272 .ifc "\reg0", "r8"
273 (\pred) mov r8 = \reg1
274 (\pred) XEN_HYPER_THASH
275 .exitm
276 .endc
277 .ifc "\reg1", "r8"
278 (\pred) XEN_HYPER_THASH
279 ;;
280 (\pred) mov \reg0 = r8
281 ;;
282 .exitm
283 .endif
284 .ifc "\clob", "r8"
285 (\pred) mov r8 = \reg1
286 (\pred) XEN_HYPER_THASH
287 ;;
288 (\pred) mov \reg0 = r8
289 ;;
290 .exitm
291 .endif
292
293 (\pred) mov \clob = r8
294 (\pred) mov r8 = \reg1
295 (\pred) XEN_HYPER_THASH
296 ;;
297 (\pred) mov \reg0 = r8
298 (\pred) mov r8 = \clob
299 ;;
300.endm
301#define THASH(pred, reg0, reg1, clob) __THASH pred, reg0, reg1, clob
302
303#define SSM_PSR_IC_AND_DEFAULT_BITS_AND_SRLZ_I(clob0, clob1) \
304 mov clob0 = 1; \
305 movl clob1 = XSI_PSR_IC; \
306 ;; \
307 st4 [clob1] = clob0 \
308 ;;
309
310#define SSM_PSR_IC_AND_SRLZ_D(clob0, clob1) \
311 ;; \
312 srlz.d; \
313 mov clob1 = 1; \
314 movl clob0 = XSI_PSR_IC; \
315 ;; \
316 st4 [clob0] = clob1
317
318#define RSM_PSR_IC(clob) \
319 movl clob = XSI_PSR_IC; \
320 ;; \
321 st4 [clob] = r0; \
322 ;;
323
324/* pred will be clobbered */
325#define MASK_TO_PEND_OFS (-1)
326#define SSM_PSR_I(pred, pred_clob, clob) \
327(pred) movl clob = XSI_PSR_I_ADDR \
328 ;; \
329(pred) ld8 clob = [clob] \
330 ;; \
331 /* if (pred) vpsr.i = 1 */ \
332 /* if (pred) (vcpu->vcpu_info->evtchn_upcall_mask)=0 */ \
333(pred) st1 [clob] = r0, MASK_TO_PEND_OFS \
334 ;; \
335 /* if (vcpu->vcpu_info->evtchn_upcall_pending) */ \
336(pred) ld1 clob = [clob] \
337 ;; \
338(pred) cmp.ne.unc pred_clob, p0 = clob, r0 \
339 ;; \
340(pred_clob)XEN_HYPER_SSM_I /* do areal ssm psr.i */
341
342#define RSM_PSR_I(pred, clob0, clob1) \
343 movl clob0 = XSI_PSR_I_ADDR; \
344 mov clob1 = 1; \
345 ;; \
346 ld8 clob0 = [clob0]; \
347 ;; \
348(pred) st1 [clob0] = clob1
349
350#define RSM_PSR_I_IC(clob0, clob1, clob2) \
351 movl clob0 = XSI_PSR_I_ADDR; \
352 movl clob1 = XSI_PSR_IC; \
353 ;; \
354 ld8 clob0 = [clob0]; \
355 mov clob2 = 1; \
356 ;; \
357 /* note: clears both vpsr.i and vpsr.ic! */ \
358 st1 [clob0] = clob2; \
359 st4 [clob1] = r0; \
360 ;;
361
362#define RSM_PSR_DT \
363 XEN_HYPER_RSM_PSR_DT
364
365#define SSM_PSR_DT_AND_SRLZ_I \
366 XEN_HYPER_SSM_PSR_DT
367
368#define BSW_0(clob0, clob1, clob2) \
369 ;; \
370 /* r16-r31 all now hold bank1 values */ \
371 mov clob2 = ar.unat; \
372 movl clob0 = XSI_BANK1_R16; \
373 movl clob1 = XSI_BANK1_R16 + 8; \
374 ;; \
375.mem.offset 0, 0; st8.spill [clob0] = r16, 16; \
376.mem.offset 8, 0; st8.spill [clob1] = r17, 16; \
377 ;; \
378.mem.offset 0, 0; st8.spill [clob0] = r18, 16; \
379.mem.offset 8, 0; st8.spill [clob1] = r19, 16; \
380 ;; \
381.mem.offset 0, 0; st8.spill [clob0] = r20, 16; \
382.mem.offset 8, 0; st8.spill [clob1] = r21, 16; \
383 ;; \
384.mem.offset 0, 0; st8.spill [clob0] = r22, 16; \
385.mem.offset 8, 0; st8.spill [clob1] = r23, 16; \
386 ;; \
387.mem.offset 0, 0; st8.spill [clob0] = r24, 16; \
388.mem.offset 8, 0; st8.spill [clob1] = r25, 16; \
389 ;; \
390.mem.offset 0, 0; st8.spill [clob0] = r26, 16; \
391.mem.offset 8, 0; st8.spill [clob1] = r27, 16; \
392 ;; \
393.mem.offset 0, 0; st8.spill [clob0] = r28, 16; \
394.mem.offset 8, 0; st8.spill [clob1] = r29, 16; \
395 ;; \
396.mem.offset 0, 0; st8.spill [clob0] = r30, 16; \
397.mem.offset 8, 0; st8.spill [clob1] = r31, 16; \
398 ;; \
399 mov clob1 = ar.unat; \
400 movl clob0 = XSI_B1NAT; \
401 ;; \
402 st8 [clob0] = clob1; \
403 mov ar.unat = clob2; \
404 movl clob0 = XSI_BANKNUM; \
405 ;; \
406 st4 [clob0] = r0
407
408
409 /* FIXME: THIS CODE IS NOT NaT SAFE! */
410#define XEN_BSW_1(clob) \
411 mov clob = ar.unat; \
412 movl r30 = XSI_B1NAT; \
413 ;; \
414 ld8 r30 = [r30]; \
415 mov r31 = 1; \
416 ;; \
417 mov ar.unat = r30; \
418 movl r30 = XSI_BANKNUM; \
419 ;; \
420 st4 [r30] = r31; \
421 movl r30 = XSI_BANK1_R16; \
422 movl r31 = XSI_BANK1_R16+8; \
423 ;; \
424 ld8.fill r16 = [r30], 16; \
425 ld8.fill r17 = [r31], 16; \
426 ;; \
427 ld8.fill r18 = [r30], 16; \
428 ld8.fill r19 = [r31], 16; \
429 ;; \
430 ld8.fill r20 = [r30], 16; \
431 ld8.fill r21 = [r31], 16; \
432 ;; \
433 ld8.fill r22 = [r30], 16; \
434 ld8.fill r23 = [r31], 16; \
435 ;; \
436 ld8.fill r24 = [r30], 16; \
437 ld8.fill r25 = [r31], 16; \
438 ;; \
439 ld8.fill r26 = [r30], 16; \
440 ld8.fill r27 = [r31], 16; \
441 ;; \
442 ld8.fill r28 = [r30], 16; \
443 ld8.fill r29 = [r31], 16; \
444 ;; \
445 ld8.fill r30 = [r30]; \
446 ld8.fill r31 = [r31]; \
447 ;; \
448 mov ar.unat = clob
449
450#define BSW_1(clob0, clob1) XEN_BSW_1(clob1)
451
452
453#define COVER \
454 XEN_HYPER_COVER
455
456#define RFI \
457 XEN_HYPER_RFI; \
458 dv_serialize_data
diff --git a/arch/ia64/include/asm/xen/interface.h b/arch/ia64/include/asm/xen/interface.h
new file mode 100644
index 000000000000..f00fab40854d
--- /dev/null
+++ b/arch/ia64/include/asm/xen/interface.h
@@ -0,0 +1,346 @@
1/******************************************************************************
2 * arch-ia64/hypervisor-if.h
3 *
4 * Guest OS interface to IA64 Xen.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright by those who contributed. (in alphabetical order)
25 *
26 * Anthony Xu <anthony.xu@intel.com>
27 * Eddie Dong <eddie.dong@intel.com>
28 * Fred Yang <fred.yang@intel.com>
29 * Kevin Tian <kevin.tian@intel.com>
30 * Alex Williamson <alex.williamson@hp.com>
31 * Chris Wright <chrisw@sous-sol.org>
32 * Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
33 * Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
34 * Hollis Blanchard <hollisb@us.ibm.com>
35 * Isaku Yamahata <yamahata@valinux.co.jp>
36 * Jan Beulich <jbeulich@novell.com>
37 * John Levon <john.levon@sun.com>
38 * Kazuhiro Suzuki <kaz@jp.fujitsu.com>
39 * Keir Fraser <keir.fraser@citrix.com>
40 * Kouya Shimura <kouya@jp.fujitsu.com>
41 * Masaki Kanno <kanno.masaki@jp.fujitsu.com>
42 * Matt Chapman <matthewc@hp.com>
43 * Matthew Chapman <matthewc@hp.com>
44 * Samuel Thibault <samuel.thibault@eu.citrix.com>
45 * Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
46 * Tristan Gingold <tgingold@free.fr>
47 * Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
48 * Yutaka Ezaki <yutaka.ezaki@jp.fujitsu.com>
49 * Zhang Xin <xing.z.zhang@intel.com>
50 * Zhang xiantao <xiantao.zhang@intel.com>
51 * dan.magenheimer@hp.com
52 * ian.pratt@cl.cam.ac.uk
53 * michael.fetterman@cl.cam.ac.uk
54 */
55
56#ifndef _ASM_IA64_XEN_INTERFACE_H
57#define _ASM_IA64_XEN_INTERFACE_H
58
59#define __DEFINE_GUEST_HANDLE(name, type) \
60 typedef struct { type *p; } __guest_handle_ ## name
61
62#define DEFINE_GUEST_HANDLE_STRUCT(name) \
63 __DEFINE_GUEST_HANDLE(name, struct name)
64#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
65#define GUEST_HANDLE(name) __guest_handle_ ## name
66#define GUEST_HANDLE_64(name) GUEST_HANDLE(name)
67#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
68
69#ifndef __ASSEMBLY__
70/* Guest handles for primitive C types. */
71__DEFINE_GUEST_HANDLE(uchar, unsigned char);
72__DEFINE_GUEST_HANDLE(uint, unsigned int);
73__DEFINE_GUEST_HANDLE(ulong, unsigned long);
74__DEFINE_GUEST_HANDLE(u64, unsigned long);
75DEFINE_GUEST_HANDLE(char);
76DEFINE_GUEST_HANDLE(int);
77DEFINE_GUEST_HANDLE(long);
78DEFINE_GUEST_HANDLE(void);
79
80typedef unsigned long xen_pfn_t;
81DEFINE_GUEST_HANDLE(xen_pfn_t);
82#define PRI_xen_pfn "lx"
83#endif
84
85/* Arch specific VIRQs definition */
86#define VIRQ_ITC VIRQ_ARCH_0 /* V. Virtual itc timer */
87#define VIRQ_MCA_CMC VIRQ_ARCH_1 /* MCA cmc interrupt */
88#define VIRQ_MCA_CPE VIRQ_ARCH_2 /* MCA cpe interrupt */
89
90/* Maximum number of virtual CPUs in multi-processor guests. */
91/* keep sizeof(struct shared_page) <= PAGE_SIZE.
92 * this is checked in arch/ia64/xen/hypervisor.c. */
93#define MAX_VIRT_CPUS 64
94
95#ifndef __ASSEMBLY__
96
97#define INVALID_MFN (~0UL)
98
99union vac {
100 unsigned long value;
101 struct {
102 int a_int:1;
103 int a_from_int_cr:1;
104 int a_to_int_cr:1;
105 int a_from_psr:1;
106 int a_from_cpuid:1;
107 int a_cover:1;
108 int a_bsw:1;
109 long reserved:57;
110 };
111};
112
113union vdc {
114 unsigned long value;
115 struct {
116 int d_vmsw:1;
117 int d_extint:1;
118 int d_ibr_dbr:1;
119 int d_pmc:1;
120 int d_to_pmd:1;
121 int d_itm:1;
122 long reserved:58;
123 };
124};
125
126struct mapped_regs {
127 union vac vac;
128 union vdc vdc;
129 unsigned long virt_env_vaddr;
130 unsigned long reserved1[29];
131 unsigned long vhpi;
132 unsigned long reserved2[95];
133 union {
134 unsigned long vgr[16];
135 unsigned long bank1_regs[16]; /* bank1 regs (r16-r31)
136 when bank0 active */
137 };
138 union {
139 unsigned long vbgr[16];
140 unsigned long bank0_regs[16]; /* bank0 regs (r16-r31)
141 when bank1 active */
142 };
143 unsigned long vnat;
144 unsigned long vbnat;
145 unsigned long vcpuid[5];
146 unsigned long reserved3[11];
147 unsigned long vpsr;
148 unsigned long vpr;
149 unsigned long reserved4[76];
150 union {
151 unsigned long vcr[128];
152 struct {
153 unsigned long dcr; /* CR0 */
154 unsigned long itm;
155 unsigned long iva;
156 unsigned long rsv1[5];
157 unsigned long pta; /* CR8 */
158 unsigned long rsv2[7];
159 unsigned long ipsr; /* CR16 */
160 unsigned long isr;
161 unsigned long rsv3;
162 unsigned long iip;
163 unsigned long ifa;
164 unsigned long itir;
165 unsigned long iipa;
166 unsigned long ifs;
167 unsigned long iim; /* CR24 */
168 unsigned long iha;
169 unsigned long rsv4[38];
170 unsigned long lid; /* CR64 */
171 unsigned long ivr;
172 unsigned long tpr;
173 unsigned long eoi;
174 unsigned long irr[4];
175 unsigned long itv; /* CR72 */
176 unsigned long pmv;
177 unsigned long cmcv;
178 unsigned long rsv5[5];
179 unsigned long lrr0; /* CR80 */
180 unsigned long lrr1;
181 unsigned long rsv6[46];
182 };
183 };
184 union {
185 unsigned long reserved5[128];
186 struct {
187 unsigned long precover_ifs;
188 unsigned long unat; /* not sure if this is needed
189 until NaT arch is done */
190 int interrupt_collection_enabled; /* virtual psr.ic */
191
192 /* virtual interrupt deliverable flag is
193 * evtchn_upcall_mask in shared info area now.
194 * interrupt_mask_addr is the address
195 * of evtchn_upcall_mask for current vcpu
196 */
197 unsigned char *interrupt_mask_addr;
198 int pending_interruption;
199 unsigned char vpsr_pp;
200 unsigned char vpsr_dfh;
201 unsigned char hpsr_dfh;
202 unsigned char hpsr_mfh;
203 unsigned long reserved5_1[4];
204 int metaphysical_mode; /* 1 = use metaphys mapping
205 0 = use virtual */
206 int banknum; /* 0 or 1, which virtual
207 register bank is active */
208 unsigned long rrs[8]; /* region registers */
209 unsigned long krs[8]; /* kernel registers */
210 unsigned long tmp[16]; /* temp registers
211 (e.g. for hyperprivops) */
212 };
213 };
214};
215
216struct arch_vcpu_info {
217 /* nothing */
218};
219
220/*
221 * This structure is used for magic page in domain pseudo physical address
222 * space and the result of XENMEM_machine_memory_map.
223 * As the XENMEM_machine_memory_map result,
224 * xen_memory_map::nr_entries indicates the size in bytes
225 * including struct xen_ia64_memmap_info. Not the number of entries.
226 */
227struct xen_ia64_memmap_info {
228 uint64_t efi_memmap_size; /* size of EFI memory map */
229 uint64_t efi_memdesc_size; /* size of an EFI memory map
230 * descriptor */
231 uint32_t efi_memdesc_version; /* memory descriptor version */
232 void *memdesc[0]; /* array of efi_memory_desc_t */
233};
234
235struct arch_shared_info {
236 /* PFN of the start_info page. */
237 unsigned long start_info_pfn;
238
239 /* Interrupt vector for event channel. */
240 int evtchn_vector;
241
242 /* PFN of memmap_info page */
243 unsigned int memmap_info_num_pages; /* currently only = 1 case is
244 supported. */
245 unsigned long memmap_info_pfn;
246
247 uint64_t pad[31];
248};
249
250struct xen_callback {
251 unsigned long ip;
252};
253typedef struct xen_callback xen_callback_t;
254
255#endif /* !__ASSEMBLY__ */
256
257/* Size of the shared_info area (this is not related to page size). */
258#define XSI_SHIFT 14
259#define XSI_SIZE (1 << XSI_SHIFT)
260/* Log size of mapped_regs area (64 KB - only 4KB is used). */
261#define XMAPPEDREGS_SHIFT 12
262#define XMAPPEDREGS_SIZE (1 << XMAPPEDREGS_SHIFT)
263/* Offset of XASI (Xen arch shared info) wrt XSI_BASE. */
264#define XMAPPEDREGS_OFS XSI_SIZE
265
266/* Hyperprivops. */
267#define HYPERPRIVOP_START 0x1
268#define HYPERPRIVOP_RFI (HYPERPRIVOP_START + 0x0)
269#define HYPERPRIVOP_RSM_DT (HYPERPRIVOP_START + 0x1)
270#define HYPERPRIVOP_SSM_DT (HYPERPRIVOP_START + 0x2)
271#define HYPERPRIVOP_COVER (HYPERPRIVOP_START + 0x3)
272#define HYPERPRIVOP_ITC_D (HYPERPRIVOP_START + 0x4)
273#define HYPERPRIVOP_ITC_I (HYPERPRIVOP_START + 0x5)
274#define HYPERPRIVOP_SSM_I (HYPERPRIVOP_START + 0x6)
275#define HYPERPRIVOP_GET_IVR (HYPERPRIVOP_START + 0x7)
276#define HYPERPRIVOP_GET_TPR (HYPERPRIVOP_START + 0x8)
277#define HYPERPRIVOP_SET_TPR (HYPERPRIVOP_START + 0x9)
278#define HYPERPRIVOP_EOI (HYPERPRIVOP_START + 0xa)
279#define HYPERPRIVOP_SET_ITM (HYPERPRIVOP_START + 0xb)
280#define HYPERPRIVOP_THASH (HYPERPRIVOP_START + 0xc)
281#define HYPERPRIVOP_PTC_GA (HYPERPRIVOP_START + 0xd)
282#define HYPERPRIVOP_ITR_D (HYPERPRIVOP_START + 0xe)
283#define HYPERPRIVOP_GET_RR (HYPERPRIVOP_START + 0xf)
284#define HYPERPRIVOP_SET_RR (HYPERPRIVOP_START + 0x10)
285#define HYPERPRIVOP_SET_KR (HYPERPRIVOP_START + 0x11)
286#define HYPERPRIVOP_FC (HYPERPRIVOP_START + 0x12)
287#define HYPERPRIVOP_GET_CPUID (HYPERPRIVOP_START + 0x13)
288#define HYPERPRIVOP_GET_PMD (HYPERPRIVOP_START + 0x14)
289#define HYPERPRIVOP_GET_EFLAG (HYPERPRIVOP_START + 0x15)
290#define HYPERPRIVOP_SET_EFLAG (HYPERPRIVOP_START + 0x16)
291#define HYPERPRIVOP_RSM_BE (HYPERPRIVOP_START + 0x17)
292#define HYPERPRIVOP_GET_PSR (HYPERPRIVOP_START + 0x18)
293#define HYPERPRIVOP_SET_RR0_TO_RR4 (HYPERPRIVOP_START + 0x19)
294#define HYPERPRIVOP_MAX (0x1a)
295
296/* Fast and light hypercalls. */
297#define __HYPERVISOR_ia64_fast_eoi __HYPERVISOR_arch_1
298
299/* Xencomm macros. */
300#define XENCOMM_INLINE_MASK 0xf800000000000000UL
301#define XENCOMM_INLINE_FLAG 0x8000000000000000UL
302
303#ifndef __ASSEMBLY__
304
305/*
306 * Optimization features.
307 * The hypervisor may do some special optimizations for guests. This hypercall
308 * can be used to switch on/of these special optimizations.
309 */
310#define __HYPERVISOR_opt_feature 0x700UL
311
312#define XEN_IA64_OPTF_OFF 0x0
313#define XEN_IA64_OPTF_ON 0x1
314
315/*
316 * If this feature is switched on, the hypervisor inserts the
317 * tlb entries without calling the guests traphandler.
318 * This is useful in guests using region 7 for identity mapping
319 * like the linux kernel does.
320 */
321#define XEN_IA64_OPTF_IDENT_MAP_REG7 1
322
323/* Identity mapping of region 4 addresses in HVM. */
324#define XEN_IA64_OPTF_IDENT_MAP_REG4 2
325
326/* Identity mapping of region 5 addresses in HVM. */
327#define XEN_IA64_OPTF_IDENT_MAP_REG5 3
328
329#define XEN_IA64_OPTF_IDENT_MAP_NOT_SET (0)
330
331struct xen_ia64_opt_feature {
332 unsigned long cmd; /* Which feature */
333 unsigned char on; /* Switch feature on/off */
334 union {
335 struct {
336 /* The page protection bit mask of the pte.
337 * This will be or'ed with the pte. */
338 unsigned long pgprot;
339 unsigned long key; /* A protection key for itir.*/
340 };
341 };
342};
343
344#endif /* __ASSEMBLY__ */
345
346#endif /* _ASM_IA64_XEN_INTERFACE_H */
diff --git a/arch/ia64/include/asm/xen/irq.h b/arch/ia64/include/asm/xen/irq.h
new file mode 100644
index 000000000000..a90450983003
--- /dev/null
+++ b/arch/ia64/include/asm/xen/irq.h
@@ -0,0 +1,44 @@
1/******************************************************************************
2 * arch/ia64/include/asm/xen/irq.h
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef _ASM_IA64_XEN_IRQ_H
24#define _ASM_IA64_XEN_IRQ_H
25
26/*
27 * The flat IRQ space is divided into two regions:
28 * 1. A one-to-one mapping of real physical IRQs. This space is only used
29 * if we have physical device-access privilege. This region is at the
30 * start of the IRQ space so that existing device drivers do not need
31 * to be modified to translate physical IRQ numbers into our IRQ space.
32 * 3. A dynamic mapping of inter-domain and Xen-sourced virtual IRQs. These
33 * are bound using the provided bind/unbind functions.
34 */
35
36#define XEN_PIRQ_BASE 0
37#define XEN_NR_PIRQS 256
38
39#define XEN_DYNIRQ_BASE (XEN_PIRQ_BASE + XEN_NR_PIRQS)
40#define XEN_NR_DYNIRQS (NR_CPUS * 8)
41
42#define XEN_NR_IRQS (XEN_NR_PIRQS + XEN_NR_DYNIRQS)
43
44#endif /* _ASM_IA64_XEN_IRQ_H */
diff --git a/arch/ia64/include/asm/xen/minstate.h b/arch/ia64/include/asm/xen/minstate.h
new file mode 100644
index 000000000000..4d92d9bbda7b
--- /dev/null
+++ b/arch/ia64/include/asm/xen/minstate.h
@@ -0,0 +1,134 @@
1/*
2 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
3 * the minimum state necessary that allows us to turn psr.ic back
4 * on.
5 *
6 * Assumed state upon entry:
7 * psr.ic: off
8 * r31: contains saved predicates (pr)
9 *
10 * Upon exit, the state is as follows:
11 * psr.ic: off
12 * r2 = points to &pt_regs.r16
13 * r8 = contents of ar.ccv
14 * r9 = contents of ar.csd
15 * r10 = contents of ar.ssd
16 * r11 = FPSR_DEFAULT
17 * r12 = kernel sp (kernel virtual address)
18 * r13 = points to current task_struct (kernel virtual address)
19 * p15 = TRUE if psr.i is set in cr.ipsr
20 * predicate registers (other than p2, p3, and p15), b6, r3, r14, r15:
21 * preserved
22 * CONFIG_XEN note: p6/p7 are not preserved
23 *
24 * Note that psr.ic is NOT turned on by this macro. This is so that
25 * we can pass interruption state as arguments to a handler.
26 */
27#define XEN_DO_SAVE_MIN(__COVER,SAVE_IFS,EXTRA,WORKAROUND) \
28 mov r16=IA64_KR(CURRENT); /* M */ \
29 mov r27=ar.rsc; /* M */ \
30 mov r20=r1; /* A */ \
31 mov r25=ar.unat; /* M */ \
32 MOV_FROM_IPSR(p0,r29); /* M */ \
33 MOV_FROM_IIP(r28); /* M */ \
34 mov r21=ar.fpsr; /* M */ \
35 mov r26=ar.pfs; /* I */ \
36 __COVER; /* B;; (or nothing) */ \
37 adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16; \
38 ;; \
39 ld1 r17=[r16]; /* load current->thread.on_ustack flag */ \
40 st1 [r16]=r0; /* clear current->thread.on_ustack flag */ \
41 adds r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 \
42 /* switch from user to kernel RBS: */ \
43 ;; \
44 invala; /* M */ \
45 /* SAVE_IFS;*/ /* see xen special handling below */ \
46 cmp.eq pKStk,pUStk=r0,r17; /* are we in kernel mode already? */ \
47 ;; \
48(pUStk) mov ar.rsc=0; /* set enforced lazy mode, pl 0, little-endian, loadrs=0 */ \
49 ;; \
50(pUStk) mov.m r24=ar.rnat; \
51(pUStk) addl r22=IA64_RBS_OFFSET,r1; /* compute base of RBS */ \
52(pKStk) mov r1=sp; /* get sp */ \
53 ;; \
54(pUStk) lfetch.fault.excl.nt1 [r22]; \
55(pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1; /* compute base of memory stack */ \
56(pUStk) mov r23=ar.bspstore; /* save ar.bspstore */ \
57 ;; \
58(pUStk) mov ar.bspstore=r22; /* switch to kernel RBS */ \
59(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1; /* if in kernel mode, use sp (r12) */ \
60 ;; \
61(pUStk) mov r18=ar.bsp; \
62(pUStk) mov ar.rsc=0x3; /* set eager mode, pl 0, little-endian, loadrs=0 */ \
63 adds r17=2*L1_CACHE_BYTES,r1; /* really: biggest cache-line size */ \
64 adds r16=PT(CR_IPSR),r1; \
65 ;; \
66 lfetch.fault.excl.nt1 [r17],L1_CACHE_BYTES; \
67 st8 [r16]=r29; /* save cr.ipsr */ \
68 ;; \
69 lfetch.fault.excl.nt1 [r17]; \
70 tbit.nz p15,p0=r29,IA64_PSR_I_BIT; \
71 mov r29=b0 \
72 ;; \
73 WORKAROUND; \
74 adds r16=PT(R8),r1; /* initialize first base pointer */ \
75 adds r17=PT(R9),r1; /* initialize second base pointer */ \
76(pKStk) mov r18=r0; /* make sure r18 isn't NaT */ \
77 ;; \
78.mem.offset 0,0; st8.spill [r16]=r8,16; \
79.mem.offset 8,0; st8.spill [r17]=r9,16; \
80 ;; \
81.mem.offset 0,0; st8.spill [r16]=r10,24; \
82 movl r8=XSI_PRECOVER_IFS; \
83.mem.offset 8,0; st8.spill [r17]=r11,24; \
84 ;; \
85 /* xen special handling for possibly lazy cover */ \
86 /* SAVE_MIN case in dispatch_ia32_handler: mov r30=r0 */ \
87 ld8 r30=[r8]; \
88(pUStk) sub r18=r18,r22; /* r18=RSE.ndirty*8 */ \
89 st8 [r16]=r28,16; /* save cr.iip */ \
90 ;; \
91 st8 [r17]=r30,16; /* save cr.ifs */ \
92 mov r8=ar.ccv; \
93 mov r9=ar.csd; \
94 mov r10=ar.ssd; \
95 movl r11=FPSR_DEFAULT; /* L-unit */ \
96 ;; \
97 st8 [r16]=r25,16; /* save ar.unat */ \
98 st8 [r17]=r26,16; /* save ar.pfs */ \
99 shl r18=r18,16; /* compute ar.rsc to be used for "loadrs" */ \
100 ;; \
101 st8 [r16]=r27,16; /* save ar.rsc */ \
102(pUStk) st8 [r17]=r24,16; /* save ar.rnat */ \
103(pKStk) adds r17=16,r17; /* skip over ar_rnat field */ \
104 ;; /* avoid RAW on r16 & r17 */ \
105(pUStk) st8 [r16]=r23,16; /* save ar.bspstore */ \
106 st8 [r17]=r31,16; /* save predicates */ \
107(pKStk) adds r16=16,r16; /* skip over ar_bspstore field */ \
108 ;; \
109 st8 [r16]=r29,16; /* save b0 */ \
110 st8 [r17]=r18,16; /* save ar.rsc value for "loadrs" */ \
111 cmp.eq pNonSys,pSys=r0,r0 /* initialize pSys=0, pNonSys=1 */ \
112 ;; \
113.mem.offset 0,0; st8.spill [r16]=r20,16; /* save original r1 */ \
114.mem.offset 8,0; st8.spill [r17]=r12,16; \
115 adds r12=-16,r1; /* switch to kernel memory stack (with 16 bytes of scratch) */ \
116 ;; \
117.mem.offset 0,0; st8.spill [r16]=r13,16; \
118.mem.offset 8,0; st8.spill [r17]=r21,16; /* save ar.fpsr */ \
119 mov r13=IA64_KR(CURRENT); /* establish `current' */ \
120 ;; \
121.mem.offset 0,0; st8.spill [r16]=r15,16; \
122.mem.offset 8,0; st8.spill [r17]=r14,16; \
123 ;; \
124.mem.offset 0,0; st8.spill [r16]=r2,16; \
125.mem.offset 8,0; st8.spill [r17]=r3,16; \
126 ACCOUNT_GET_STAMP \
127 adds r2=IA64_PT_REGS_R16_OFFSET,r1; \
128 ;; \
129 EXTRA; \
130 movl r1=__gp; /* establish kernel global pointer */ \
131 ;; \
132 ACCOUNT_SYS_ENTER \
133 BSW_1(r3,r14); /* switch back to bank 1 (must be last in insn group) */ \
134 ;;
diff --git a/arch/ia64/include/asm/xen/page.h b/arch/ia64/include/asm/xen/page.h
new file mode 100644
index 000000000000..03441a780b5b
--- /dev/null
+++ b/arch/ia64/include/asm/xen/page.h
@@ -0,0 +1,65 @@
1/******************************************************************************
2 * arch/ia64/include/asm/xen/page.h
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef _ASM_IA64_XEN_PAGE_H
24#define _ASM_IA64_XEN_PAGE_H
25
26#define INVALID_P2M_ENTRY (~0UL)
27
28static inline unsigned long mfn_to_pfn(unsigned long mfn)
29{
30 return mfn;
31}
32
33static inline unsigned long pfn_to_mfn(unsigned long pfn)
34{
35 return pfn;
36}
37
38#define phys_to_machine_mapping_valid(_x) (1)
39
40static inline void *mfn_to_virt(unsigned long mfn)
41{
42 return __va(mfn << PAGE_SHIFT);
43}
44
45static inline unsigned long virt_to_mfn(void *virt)
46{
47 return __pa(virt) >> PAGE_SHIFT;
48}
49
50/* for tpmfront.c */
51static inline unsigned long virt_to_machine(void *virt)
52{
53 return __pa(virt);
54}
55
56static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
57{
58 /* nothing */
59}
60
61#define pte_mfn(_x) pte_pfn(_x)
62#define mfn_pte(_x, _y) __pte_ma(0) /* unmodified use */
63#define __pte_ma(_x) ((pte_t) {(_x)}) /* unmodified use */
64
65#endif /* _ASM_IA64_XEN_PAGE_H */
diff --git a/arch/ia64/include/asm/xen/privop.h b/arch/ia64/include/asm/xen/privop.h
new file mode 100644
index 000000000000..71ec7546e100
--- /dev/null
+++ b/arch/ia64/include/asm/xen/privop.h
@@ -0,0 +1,129 @@
1#ifndef _ASM_IA64_XEN_PRIVOP_H
2#define _ASM_IA64_XEN_PRIVOP_H
3
4/*
5 * Copyright (C) 2005 Hewlett-Packard Co
6 * Dan Magenheimer <dan.magenheimer@hp.com>
7 *
8 * Paravirtualizations of privileged operations for Xen/ia64
9 *
10 *
11 * inline privop and paravirt_alt support
12 * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
13 * VA Linux Systems Japan K.K.
14 *
15 */
16
17#ifndef __ASSEMBLY__
18#include <linux/types.h> /* arch-ia64.h requires uint64_t */
19#endif
20#include <asm/xen/interface.h>
21
22/* At 1 MB, before per-cpu space but still addressable using addl instead
23 of movl. */
24#define XSI_BASE 0xfffffffffff00000
25
26/* Address of mapped regs. */
27#define XMAPPEDREGS_BASE (XSI_BASE + XSI_SIZE)
28
29#ifdef __ASSEMBLY__
30#define XEN_HYPER_RFI break HYPERPRIVOP_RFI
31#define XEN_HYPER_RSM_PSR_DT break HYPERPRIVOP_RSM_DT
32#define XEN_HYPER_SSM_PSR_DT break HYPERPRIVOP_SSM_DT
33#define XEN_HYPER_COVER break HYPERPRIVOP_COVER
34#define XEN_HYPER_ITC_D break HYPERPRIVOP_ITC_D
35#define XEN_HYPER_ITC_I break HYPERPRIVOP_ITC_I
36#define XEN_HYPER_SSM_I break HYPERPRIVOP_SSM_I
37#define XEN_HYPER_GET_IVR break HYPERPRIVOP_GET_IVR
38#define XEN_HYPER_THASH break HYPERPRIVOP_THASH
39#define XEN_HYPER_ITR_D break HYPERPRIVOP_ITR_D
40#define XEN_HYPER_SET_KR break HYPERPRIVOP_SET_KR
41#define XEN_HYPER_GET_PSR break HYPERPRIVOP_GET_PSR
42#define XEN_HYPER_SET_RR0_TO_RR4 break HYPERPRIVOP_SET_RR0_TO_RR4
43
44#define XSI_IFS (XSI_BASE + XSI_IFS_OFS)
45#define XSI_PRECOVER_IFS (XSI_BASE + XSI_PRECOVER_IFS_OFS)
46#define XSI_IFA (XSI_BASE + XSI_IFA_OFS)
47#define XSI_ISR (XSI_BASE + XSI_ISR_OFS)
48#define XSI_IIM (XSI_BASE + XSI_IIM_OFS)
49#define XSI_ITIR (XSI_BASE + XSI_ITIR_OFS)
50#define XSI_PSR_I_ADDR (XSI_BASE + XSI_PSR_I_ADDR_OFS)
51#define XSI_PSR_IC (XSI_BASE + XSI_PSR_IC_OFS)
52#define XSI_IPSR (XSI_BASE + XSI_IPSR_OFS)
53#define XSI_IIP (XSI_BASE + XSI_IIP_OFS)
54#define XSI_B1NAT (XSI_BASE + XSI_B1NATS_OFS)
55#define XSI_BANK1_R16 (XSI_BASE + XSI_BANK1_R16_OFS)
56#define XSI_BANKNUM (XSI_BASE + XSI_BANKNUM_OFS)
57#define XSI_IHA (XSI_BASE + XSI_IHA_OFS)
58#endif
59
60#ifndef __ASSEMBLY__
61
62/************************************************/
63/* Instructions paravirtualized for correctness */
64/************************************************/
65
66/* "fc" and "thash" are privilege-sensitive instructions, meaning they
67 * may have different semantics depending on whether they are executed
68 * at PL0 vs PL!=0. When paravirtualized, these instructions mustn't
69 * be allowed to execute directly, lest incorrect semantics result. */
70extern void xen_fc(unsigned long addr);
71extern unsigned long xen_thash(unsigned long addr);
72
73/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
74 * is not currently used (though it may be in a long-format VHPT system!)
75 * and the semantics of cover only change if psr.ic is off which is very
76 * rare (and currently non-existent outside of assembly code */
77
78/* There are also privilege-sensitive registers. These registers are
79 * readable at any privilege level but only writable at PL0. */
80extern unsigned long xen_get_cpuid(int index);
81extern unsigned long xen_get_pmd(int index);
82
83extern unsigned long xen_get_eflag(void); /* see xen_ia64_getreg */
84extern void xen_set_eflag(unsigned long); /* see xen_ia64_setreg */
85
86/************************************************/
87/* Instructions paravirtualized for performance */
88/************************************************/
89
90/* Xen uses memory-mapped virtual privileged registers for access to many
91 * performance-sensitive privileged registers. Some, like the processor
92 * status register (psr), are broken up into multiple memory locations.
93 * Others, like "pend", are abstractions based on privileged registers.
94 * "Pend" is guaranteed to be set if reading cr.ivr would return a
95 * (non-spurious) interrupt. */
96#define XEN_MAPPEDREGS ((struct mapped_regs *)XMAPPEDREGS_BASE)
97
98#define XSI_PSR_I \
99 (*XEN_MAPPEDREGS->interrupt_mask_addr)
100#define xen_get_virtual_psr_i() \
101 (!XSI_PSR_I)
102#define xen_set_virtual_psr_i(_val) \
103 ({ XSI_PSR_I = (uint8_t)(_val) ? 0 : 1; })
104#define xen_set_virtual_psr_ic(_val) \
105 ({ XEN_MAPPEDREGS->interrupt_collection_enabled = _val ? 1 : 0; })
106#define xen_get_virtual_pend() \
107 (*(((uint8_t *)XEN_MAPPEDREGS->interrupt_mask_addr) - 1))
108
109/* Although all privileged operations can be left to trap and will
110 * be properly handled by Xen, some are frequent enough that we use
111 * hyperprivops for performance. */
112extern unsigned long xen_get_psr(void);
113extern unsigned long xen_get_ivr(void);
114extern unsigned long xen_get_tpr(void);
115extern void xen_hyper_ssm_i(void);
116extern void xen_set_itm(unsigned long);
117extern void xen_set_tpr(unsigned long);
118extern void xen_eoi(unsigned long);
119extern unsigned long xen_get_rr(unsigned long index);
120extern void xen_set_rr(unsigned long index, unsigned long val);
121extern void xen_set_rr0_to_rr4(unsigned long val0, unsigned long val1,
122 unsigned long val2, unsigned long val3,
123 unsigned long val4);
124extern void xen_set_kr(unsigned long index, unsigned long val);
125extern void xen_ptcga(unsigned long addr, unsigned long size);
126
127#endif /* !__ASSEMBLY__ */
128
129#endif /* _ASM_IA64_XEN_PRIVOP_H */
diff --git a/arch/ia64/include/asm/xen/xcom_hcall.h b/arch/ia64/include/asm/xen/xcom_hcall.h
new file mode 100644
index 000000000000..20b2950c71b6
--- /dev/null
+++ b/arch/ia64/include/asm/xen/xcom_hcall.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2006 Tristan Gingold <tristan.gingold@bull.net>, Bull SAS
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef _ASM_IA64_XEN_XCOM_HCALL_H
20#define _ASM_IA64_XEN_XCOM_HCALL_H
21
22/* These function creates inline or mini descriptor for the parameters and
23 calls the corresponding xencomm_arch_hypercall_X.
24 Architectures should defines HYPERVISOR_xxx as xencomm_hypercall_xxx unless
25 they want to use their own wrapper. */
26extern int xencomm_hypercall_console_io(int cmd, int count, char *str);
27
28extern int xencomm_hypercall_event_channel_op(int cmd, void *op);
29
30extern int xencomm_hypercall_xen_version(int cmd, void *arg);
31
32extern int xencomm_hypercall_physdev_op(int cmd, void *op);
33
34extern int xencomm_hypercall_grant_table_op(unsigned int cmd, void *op,
35 unsigned int count);
36
37extern int xencomm_hypercall_sched_op(int cmd, void *arg);
38
39extern int xencomm_hypercall_multicall(void *call_list, int nr_calls);
40
41extern int xencomm_hypercall_callback_op(int cmd, void *arg);
42
43extern int xencomm_hypercall_memory_op(unsigned int cmd, void *arg);
44
45extern int xencomm_hypercall_suspend(unsigned long srec);
46
47extern long xencomm_hypercall_vcpu_op(int cmd, int cpu, void *arg);
48
49extern long xencomm_hypercall_opt_feature(void *arg);
50
51#endif /* _ASM_IA64_XEN_XCOM_HCALL_H */
diff --git a/arch/ia64/include/asm/xen/xencomm.h b/arch/ia64/include/asm/xen/xencomm.h
new file mode 100644
index 000000000000..cded677bebf2
--- /dev/null
+++ b/arch/ia64/include/asm/xen/xencomm.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2006 Hollis Blanchard <hollisb@us.ibm.com>, IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef _ASM_IA64_XEN_XENCOMM_H
20#define _ASM_IA64_XEN_XENCOMM_H
21
22#include <xen/xencomm.h>
23#include <asm/pgtable.h>
24
25/* Must be called before any hypercall. */
26extern void xencomm_initialize(void);
27extern int xencomm_is_initialized(void);
28
29/* Check if virtual contiguity means physical contiguity
30 * where the passed address is a pointer value in virtual address.
31 * On ia64, identity mapping area in region 7 or the piece of region 5
32 * that is mapped by itr[IA64_TR_KERNEL]/dtr[IA64_TR_KERNEL]
33 */
34static inline int xencomm_is_phys_contiguous(unsigned long addr)
35{
36 return (PAGE_OFFSET <= addr &&
37 addr < (PAGE_OFFSET + (1UL << IA64_MAX_PHYS_BITS))) ||
38 (KERNEL_START <= addr &&
39 addr < KERNEL_START + KERNEL_TR_PAGE_SIZE);
40}
41
42#endif /* _ASM_IA64_XEN_XENCOMM_H */
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 87fea11aecb7..c381ea954892 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -42,6 +42,10 @@ obj-$(CONFIG_IA64_ESI) += esi.o
42ifneq ($(CONFIG_IA64_ESI),) 42ifneq ($(CONFIG_IA64_ESI),)
43obj-y += esi_stub.o # must be in kernel proper 43obj-y += esi_stub.o # must be in kernel proper
44endif 44endif
45obj-$(CONFIG_DMAR) += pci-dma.o
46ifeq ($(CONFIG_DMAR), y)
47obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
48endif
45 49
46# The gate DSO image is built using a special linker script. 50# The gate DSO image is built using a special linker script.
47targets += gate.so gate-syms.o 51targets += gate.so gate-syms.o
@@ -112,5 +116,23 @@ clean-files += $(objtree)/include/asm-ia64/nr-irqs.h
112ASM_PARAVIRT_OBJS = ivt.o entry.o 116ASM_PARAVIRT_OBJS = ivt.o entry.o
113define paravirtualized_native 117define paravirtualized_native
114AFLAGS_$(1) += -D__IA64_ASM_PARAVIRTUALIZED_NATIVE 118AFLAGS_$(1) += -D__IA64_ASM_PARAVIRTUALIZED_NATIVE
119AFLAGS_pvchk-sed-$(1) += -D__IA64_ASM_PARAVIRTUALIZED_PVCHECK
120extra-y += pvchk-$(1)
115endef 121endef
116$(foreach obj,$(ASM_PARAVIRT_OBJS),$(eval $(call paravirtualized_native,$(obj)))) 122$(foreach obj,$(ASM_PARAVIRT_OBJS),$(eval $(call paravirtualized_native,$(obj))))
123
124#
125# Checker for paravirtualizations of privileged operations.
126#
127quiet_cmd_pv_check_sed = PVCHK $@
128define cmd_pv_check_sed
129 sed -f $(srctree)/arch/$(SRCARCH)/scripts/pvcheck.sed $< > $@
130endef
131
132$(obj)/pvchk-sed-%.s: $(src)/%.S $(srctree)/arch/$(SRCARCH)/scripts/pvcheck.sed FORCE
133 $(call if_changed_dep,as_s_S)
134$(obj)/pvchk-%.s: $(obj)/pvchk-sed-%.s FORCE
135 $(call if_changed,pv_check_sed)
136$(obj)/pvchk-%.o: $(obj)/pvchk-%.s FORCE
137 $(call if_changed,as_o_S)
138.PRECIOUS: $(obj)/pvchk-sed-%.s $(obj)/pvchk-%.s $(obj)/pvchk-%.o
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 5d1eb7ee2bf6..0635015d0aaa 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -52,6 +52,7 @@
52#include <asm/numa.h> 52#include <asm/numa.h>
53#include <asm/sal.h> 53#include <asm/sal.h>
54#include <asm/cyclone.h> 54#include <asm/cyclone.h>
55#include <asm/xen/hypervisor.h>
55 56
56#define BAD_MADT_ENTRY(entry, end) ( \ 57#define BAD_MADT_ENTRY(entry, end) ( \
57 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ 58 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
@@ -91,6 +92,9 @@ acpi_get_sysname(void)
91 struct acpi_table_rsdp *rsdp; 92 struct acpi_table_rsdp *rsdp;
92 struct acpi_table_xsdt *xsdt; 93 struct acpi_table_xsdt *xsdt;
93 struct acpi_table_header *hdr; 94 struct acpi_table_header *hdr;
95#ifdef CONFIG_DMAR
96 u64 i, nentries;
97#endif
94 98
95 rsdp_phys = acpi_find_rsdp(); 99 rsdp_phys = acpi_find_rsdp();
96 if (!rsdp_phys) { 100 if (!rsdp_phys) {
@@ -121,7 +125,21 @@ acpi_get_sysname(void)
121 return "uv"; 125 return "uv";
122 else 126 else
123 return "sn2"; 127 return "sn2";
128 } else if (xen_pv_domain() && !strcmp(hdr->oem_id, "XEN")) {
129 return "xen";
130 }
131
132#ifdef CONFIG_DMAR
133 /* Look for Intel IOMMU */
134 nentries = (hdr->length - sizeof(*hdr)) /
135 sizeof(xsdt->table_offset_entry[0]);
136 for (i = 0; i < nentries; i++) {
137 hdr = __va(xsdt->table_offset_entry[i]);
138 if (strncmp(hdr->signature, ACPI_SIG_DMAR,
139 sizeof(ACPI_SIG_DMAR) - 1) == 0)
140 return "dig_vtd";
124 } 141 }
142#endif
125 143
126 return "dig"; 144 return "dig";
127#else 145#else
@@ -137,6 +155,10 @@ acpi_get_sysname(void)
137 return "uv"; 155 return "uv";
138# elif defined (CONFIG_IA64_DIG) 156# elif defined (CONFIG_IA64_DIG)
139 return "dig"; 157 return "dig";
158# elif defined (CONFIG_IA64_XEN_GUEST)
159 return "xen";
160# elif defined(CONFIG_IA64_DIG_VTD)
161 return "dig_vtd";
140# else 162# else
141# error Unknown platform. Fix acpi.c. 163# error Unknown platform. Fix acpi.c.
142# endif 164# endif
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index 94c44b1ccfd0..742dbb1d5a4f 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -16,6 +16,9 @@
16#include <asm/sigcontext.h> 16#include <asm/sigcontext.h>
17#include <asm/mca.h> 17#include <asm/mca.h>
18 18
19#include <asm/xen/interface.h>
20#include <asm/xen/hypervisor.h>
21
19#include "../kernel/sigframe.h" 22#include "../kernel/sigframe.h"
20#include "../kernel/fsyscall_gtod_data.h" 23#include "../kernel/fsyscall_gtod_data.h"
21 24
@@ -286,4 +289,32 @@ void foo(void)
286 offsetof (struct itc_jitter_data_t, itc_jitter)); 289 offsetof (struct itc_jitter_data_t, itc_jitter));
287 DEFINE(IA64_ITC_LASTCYCLE_OFFSET, 290 DEFINE(IA64_ITC_LASTCYCLE_OFFSET,
288 offsetof (struct itc_jitter_data_t, itc_lastcycle)); 291 offsetof (struct itc_jitter_data_t, itc_lastcycle));
292
293#ifdef CONFIG_XEN
294 BLANK();
295
296 DEFINE(XEN_NATIVE_ASM, XEN_NATIVE);
297 DEFINE(XEN_PV_DOMAIN_ASM, XEN_PV_DOMAIN);
298
299#define DEFINE_MAPPED_REG_OFS(sym, field) \
300 DEFINE(sym, (XMAPPEDREGS_OFS + offsetof(struct mapped_regs, field)))
301
302 DEFINE_MAPPED_REG_OFS(XSI_PSR_I_ADDR_OFS, interrupt_mask_addr);
303 DEFINE_MAPPED_REG_OFS(XSI_IPSR_OFS, ipsr);
304 DEFINE_MAPPED_REG_OFS(XSI_IIP_OFS, iip);
305 DEFINE_MAPPED_REG_OFS(XSI_IFS_OFS, ifs);
306 DEFINE_MAPPED_REG_OFS(XSI_PRECOVER_IFS_OFS, precover_ifs);
307 DEFINE_MAPPED_REG_OFS(XSI_ISR_OFS, isr);
308 DEFINE_MAPPED_REG_OFS(XSI_IFA_OFS, ifa);
309 DEFINE_MAPPED_REG_OFS(XSI_IIPA_OFS, iipa);
310 DEFINE_MAPPED_REG_OFS(XSI_IIM_OFS, iim);
311 DEFINE_MAPPED_REG_OFS(XSI_IHA_OFS, iha);
312 DEFINE_MAPPED_REG_OFS(XSI_ITIR_OFS, itir);
313 DEFINE_MAPPED_REG_OFS(XSI_PSR_IC_OFS, interrupt_collection_enabled);
314 DEFINE_MAPPED_REG_OFS(XSI_BANKNUM_OFS, banknum);
315 DEFINE_MAPPED_REG_OFS(XSI_BANK0_R16_OFS, bank0_regs[0]);
316 DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]);
317 DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat);
318 DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat);
319#endif /* CONFIG_XEN */
289} 320}
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 0dd6c1419d8d..7ef0c594f5ed 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -534,6 +534,11 @@ GLOBAL_ENTRY(ia64_trace_syscall)
534 stf.spill [r16]=f10 534 stf.spill [r16]=f10
535 stf.spill [r17]=f11 535 stf.spill [r17]=f11
536 br.call.sptk.many rp=syscall_trace_enter // give parent a chance to catch syscall args 536 br.call.sptk.many rp=syscall_trace_enter // give parent a chance to catch syscall args
537 cmp.lt p6,p0=r8,r0 // check tracehook
538 adds r2=PT(R8)+16,sp // r2 = &pt_regs.r8
539 adds r3=PT(R10)+16,sp // r3 = &pt_regs.r10
540 mov r10=0
541(p6) br.cond.sptk strace_error // syscall failed ->
537 adds r16=PT(F6)+16,sp 542 adds r16=PT(F6)+16,sp
538 adds r17=PT(F7)+16,sp 543 adds r17=PT(F7)+16,sp
539 ;; 544 ;;
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index 416a952b19bd..f675d8e33853 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -580,7 +580,7 @@ ENTRY(dirty_bit)
580 mov b0=r29 // restore b0 580 mov b0=r29 // restore b0
581 ;; 581 ;;
582 st8 [r17]=r18 // store back updated PTE 582 st8 [r17]=r18 // store back updated PTE
583 itc.d r18 // install updated PTE 583 ITC_D(p0, r18, r16) // install updated PTE
584#endif 584#endif
585 mov pr=r31,-1 // restore pr 585 mov pr=r31,-1 // restore pr
586 RFI 586 RFI
@@ -646,7 +646,7 @@ ENTRY(iaccess_bit)
646 mov b0=r29 // restore b0 646 mov b0=r29 // restore b0
647 ;; 647 ;;
648 st8 [r17]=r18 // store back updated PTE 648 st8 [r17]=r18 // store back updated PTE
649 itc.i r18 // install updated PTE 649 ITC_I(p0, r18, r16) // install updated PTE
650#endif /* !CONFIG_SMP */ 650#endif /* !CONFIG_SMP */
651 mov pr=r31,-1 651 mov pr=r31,-1
652 RFI 652 RFI
@@ -698,7 +698,7 @@ ENTRY(daccess_bit)
698 or r18=_PAGE_A,r18 // set the accessed bit 698 or r18=_PAGE_A,r18 // set the accessed bit
699 ;; 699 ;;
700 st8 [r17]=r18 // store back updated PTE 700 st8 [r17]=r18 // store back updated PTE
701 itc.d r18 // install updated PTE 701 ITC_D(p0, r18, r16) // install updated PTE
702#endif 702#endif
703 mov b0=r29 // restore b0 703 mov b0=r29 // restore b0
704 mov pr=r31,-1 704 mov pr=r31,-1
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 60c6ef67ebb2..702a09c13238 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -5,6 +5,7 @@
5#include <linux/pci.h> 5#include <linux/pci.h>
6#include <linux/irq.h> 6#include <linux/irq.h>
7#include <linux/msi.h> 7#include <linux/msi.h>
8#include <linux/dmar.h>
8#include <asm/smp.h> 9#include <asm/smp.h>
9 10
10/* 11/*
@@ -162,3 +163,82 @@ void arch_teardown_msi_irq(unsigned int irq)
162 163
163 return ia64_teardown_msi_irq(irq); 164 return ia64_teardown_msi_irq(irq);
164} 165}
166
167#ifdef CONFIG_DMAR
168#ifdef CONFIG_SMP
169static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask)
170{
171 struct irq_cfg *cfg = irq_cfg + irq;
172 struct msi_msg msg;
173 int cpu = first_cpu(mask);
174
175
176 if (!cpu_online(cpu))
177 return;
178
179 if (irq_prepare_move(irq, cpu))
180 return;
181
182 dmar_msi_read(irq, &msg);
183
184 msg.data &= ~MSI_DATA_VECTOR_MASK;
185 msg.data |= MSI_DATA_VECTOR(cfg->vector);
186 msg.address_lo &= ~MSI_ADDR_DESTID_MASK;
187 msg.address_lo |= MSI_ADDR_DESTID_CPU(cpu_physical_id(cpu));
188
189 dmar_msi_write(irq, &msg);
190 irq_desc[irq].affinity = mask;
191}
192#endif /* CONFIG_SMP */
193
194struct irq_chip dmar_msi_type = {
195 .name = "DMAR_MSI",
196 .unmask = dmar_msi_unmask,
197 .mask = dmar_msi_mask,
198 .ack = ia64_ack_msi_irq,
199#ifdef CONFIG_SMP
200 .set_affinity = dmar_msi_set_affinity,
201#endif
202 .retrigger = ia64_msi_retrigger_irq,
203};
204
205static int
206msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
207{
208 struct irq_cfg *cfg = irq_cfg + irq;
209 unsigned dest;
210 cpumask_t mask;
211
212 cpus_and(mask, irq_to_domain(irq), cpu_online_map);
213 dest = cpu_physical_id(first_cpu(mask));
214
215 msg->address_hi = 0;
216 msg->address_lo =
217 MSI_ADDR_HEADER |
218 MSI_ADDR_DESTMODE_PHYS |
219 MSI_ADDR_REDIRECTION_CPU |
220 MSI_ADDR_DESTID_CPU(dest);
221
222 msg->data =
223 MSI_DATA_TRIGGER_EDGE |
224 MSI_DATA_LEVEL_ASSERT |
225 MSI_DATA_DELIVERY_FIXED |
226 MSI_DATA_VECTOR(cfg->vector);
227 return 0;
228}
229
230int arch_setup_dmar_msi(unsigned int irq)
231{
232 int ret;
233 struct msi_msg msg;
234
235 ret = msi_compose_msg(NULL, irq, &msg);
236 if (ret < 0)
237 return ret;
238 dmar_msi_write(irq, &msg);
239 set_irq_chip_and_handler_name(irq, &dmar_msi_type, handle_edge_irq,
240 "edge");
241 return 0;
242}
243#endif /* CONFIG_DMAR */
244
diff --git a/arch/ia64/kernel/nr-irqs.c b/arch/ia64/kernel/nr-irqs.c
index 8273afc32db8..ee564575148e 100644
--- a/arch/ia64/kernel/nr-irqs.c
+++ b/arch/ia64/kernel/nr-irqs.c
@@ -10,6 +10,7 @@
10#include <linux/kbuild.h> 10#include <linux/kbuild.h>
11#include <linux/threads.h> 11#include <linux/threads.h>
12#include <asm/native/irq.h> 12#include <asm/native/irq.h>
13#include <asm/xen/irq.h>
13 14
14void foo(void) 15void foo(void)
15{ 16{
diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c
index afaf5b9a2cf0..de35d8e8b7d2 100644
--- a/arch/ia64/kernel/paravirt.c
+++ b/arch/ia64/kernel/paravirt.c
@@ -332,7 +332,7 @@ ia64_native_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
332 332
333struct pv_iosapic_ops pv_iosapic_ops = { 333struct pv_iosapic_ops pv_iosapic_ops = {
334 .pcat_compat_init = ia64_native_iosapic_pcat_compat_init, 334 .pcat_compat_init = ia64_native_iosapic_pcat_compat_init,
335 .get_irq_chip = ia64_native_iosapic_get_irq_chip, 335 .__get_irq_chip = ia64_native_iosapic_get_irq_chip,
336 336
337 .__read = ia64_native_iosapic_read, 337 .__read = ia64_native_iosapic_read,
338 .__write = ia64_native_iosapic_write, 338 .__write = ia64_native_iosapic_write,
diff --git a/arch/ia64/kernel/paravirt_inst.h b/arch/ia64/kernel/paravirt_inst.h
index 5cad6fb2ed19..64d6d810c64b 100644
--- a/arch/ia64/kernel/paravirt_inst.h
+++ b/arch/ia64/kernel/paravirt_inst.h
@@ -20,7 +20,9 @@
20 * 20 *
21 */ 21 */
22 22
23#ifdef __IA64_ASM_PARAVIRTUALIZED_XEN 23#ifdef __IA64_ASM_PARAVIRTUALIZED_PVCHECK
24#include <asm/native/pvchk_inst.h>
25#elif defined(__IA64_ASM_PARAVIRTUALIZED_XEN)
24#include <asm/xen/inst.h> 26#include <asm/xen/inst.h>
25#include <asm/xen/minstate.h> 27#include <asm/xen/minstate.h>
26#else 28#else
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
new file mode 100644
index 000000000000..10a75b557650
--- /dev/null
+++ b/arch/ia64/kernel/pci-dma.c
@@ -0,0 +1,129 @@
1/*
2 * Dynamic DMA mapping support.
3 */
4
5#include <linux/types.h>
6#include <linux/mm.h>
7#include <linux/string.h>
8#include <linux/pci.h>
9#include <linux/module.h>
10#include <linux/dmar.h>
11#include <asm/iommu.h>
12#include <asm/machvec.h>
13#include <linux/dma-mapping.h>
14
15#include <asm/machvec.h>
16#include <asm/system.h>
17
18#ifdef CONFIG_DMAR
19
20#include <linux/kernel.h>
21#include <linux/string.h>
22
23#include <asm/page.h>
24#include <asm/iommu.h>
25
26dma_addr_t bad_dma_address __read_mostly;
27EXPORT_SYMBOL(bad_dma_address);
28
29static int iommu_sac_force __read_mostly;
30
31int no_iommu __read_mostly;
32#ifdef CONFIG_IOMMU_DEBUG
33int force_iommu __read_mostly = 1;
34#else
35int force_iommu __read_mostly;
36#endif
37
38/* Set this to 1 if there is a HW IOMMU in the system */
39int iommu_detected __read_mostly;
40
41/* Dummy device used for NULL arguments (normally ISA). Better would
42 be probably a smaller DMA mask, but this is bug-to-bug compatible
43 to i386. */
44struct device fallback_dev = {
45 .bus_id = "fallback device",
46 .coherent_dma_mask = DMA_32BIT_MASK,
47 .dma_mask = &fallback_dev.coherent_dma_mask,
48};
49
50void __init pci_iommu_alloc(void)
51{
52 /*
53 * The order of these functions is important for
54 * fall-back/fail-over reasons
55 */
56 detect_intel_iommu();
57
58#ifdef CONFIG_SWIOTLB
59 pci_swiotlb_init();
60#endif
61}
62
63static int __init pci_iommu_init(void)
64{
65 if (iommu_detected)
66 intel_iommu_init();
67
68 return 0;
69}
70
71/* Must execute after PCI subsystem */
72fs_initcall(pci_iommu_init);
73
74void pci_iommu_shutdown(void)
75{
76 return;
77}
78
79void __init
80iommu_dma_init(void)
81{
82 return;
83}
84
85struct dma_mapping_ops *dma_ops;
86EXPORT_SYMBOL(dma_ops);
87
88int iommu_dma_supported(struct device *dev, u64 mask)
89{
90 struct dma_mapping_ops *ops = get_dma_ops(dev);
91
92#ifdef CONFIG_PCI
93 if (mask > 0xffffffff && forbid_dac > 0) {
94 dev_info(dev, "Disallowing DAC for device\n");
95 return 0;
96 }
97#endif
98
99 if (ops->dma_supported_op)
100 return ops->dma_supported_op(dev, mask);
101
102 /* Copied from i386. Doesn't make much sense, because it will
103 only work for pci_alloc_coherent.
104 The caller just has to use GFP_DMA in this case. */
105 if (mask < DMA_24BIT_MASK)
106 return 0;
107
108 /* Tell the device to use SAC when IOMMU force is on. This
109 allows the driver to use cheaper accesses in some cases.
110
111 Problem with this is that if we overflow the IOMMU area and
112 return DAC as fallback address the device may not handle it
113 correctly.
114
115 As a special case some controllers have a 39bit address
116 mode that is as efficient as 32bit (aic79xx). Don't force
117 SAC for these. Assume all masks <= 40 bits are of this
118 type. Normally this doesn't make any difference, but gives
119 more gentle handling of IOMMU overflow. */
120 if (iommu_sac_force && (mask >= DMA_40BIT_MASK)) {
121 dev_info(dev, "Force SAC with mask %lx\n", mask);
122 return 0;
123 }
124
125 return 1;
126}
127EXPORT_SYMBOL(iommu_dma_supported);
128
129#endif
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c
new file mode 100644
index 000000000000..16c50516dbc1
--- /dev/null
+++ b/arch/ia64/kernel/pci-swiotlb.c
@@ -0,0 +1,46 @@
1/* Glue code to lib/swiotlb.c */
2
3#include <linux/pci.h>
4#include <linux/cache.h>
5#include <linux/module.h>
6#include <linux/dma-mapping.h>
7
8#include <asm/swiotlb.h>
9#include <asm/dma.h>
10#include <asm/iommu.h>
11#include <asm/machvec.h>
12
13int swiotlb __read_mostly;
14EXPORT_SYMBOL(swiotlb);
15
16struct dma_mapping_ops swiotlb_dma_ops = {
17 .mapping_error = swiotlb_dma_mapping_error,
18 .alloc_coherent = swiotlb_alloc_coherent,
19 .free_coherent = swiotlb_free_coherent,
20 .map_single = swiotlb_map_single,
21 .unmap_single = swiotlb_unmap_single,
22 .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
23 .sync_single_for_device = swiotlb_sync_single_for_device,
24 .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
25 .sync_single_range_for_device = swiotlb_sync_single_range_for_device,
26 .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
27 .sync_sg_for_device = swiotlb_sync_sg_for_device,
28 .map_sg = swiotlb_map_sg,
29 .unmap_sg = swiotlb_unmap_sg,
30 .dma_supported_op = swiotlb_dma_supported,
31};
32
33void __init pci_swiotlb_init(void)
34{
35 if (!iommu_detected) {
36#ifdef CONFIG_IA64_GENERIC
37 swiotlb = 1;
38 printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
39 machvec_init("dig");
40 swiotlb_init();
41 dma_ops = &swiotlb_dma_ops;
42#else
43 panic("Unable to find Intel IOMMU");
44#endif
45 }
46}
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index fc8f3509df27..ada4605d1223 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -40,6 +40,7 @@
40#include <linux/capability.h> 40#include <linux/capability.h>
41#include <linux/rcupdate.h> 41#include <linux/rcupdate.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/tracehook.h>
43 44
44#include <asm/errno.h> 45#include <asm/errno.h>
45#include <asm/intrinsics.h> 46#include <asm/intrinsics.h>
@@ -3684,7 +3685,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
3684 3685
3685 PFM_SET_WORK_PENDING(task, 1); 3686 PFM_SET_WORK_PENDING(task, 1);
3686 3687
3687 tsk_set_notify_resume(task); 3688 set_notify_resume(task);
3688 3689
3689 /* 3690 /*
3690 * XXX: send reschedule if task runs on another CPU 3691 * XXX: send reschedule if task runs on another CPU
@@ -5044,8 +5045,6 @@ pfm_handle_work(void)
5044 5045
5045 PFM_SET_WORK_PENDING(current, 0); 5046 PFM_SET_WORK_PENDING(current, 0);
5046 5047
5047 tsk_clear_notify_resume(current);
5048
5049 regs = task_pt_regs(current); 5048 regs = task_pt_regs(current);
5050 5049
5051 /* 5050 /*
@@ -5414,7 +5413,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
5414 * when coming from ctxsw, current still points to the 5413 * when coming from ctxsw, current still points to the
5415 * previous task, therefore we must work with task and not current. 5414 * previous task, therefore we must work with task and not current.
5416 */ 5415 */
5417 tsk_set_notify_resume(task); 5416 set_notify_resume(task);
5418 } 5417 }
5419 /* 5418 /*
5420 * defer until state is changed (shorten spin window). the context is locked 5419 * defer until state is changed (shorten spin window). the context is locked
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 3ab8373103ec..c57162705147 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -28,6 +28,7 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/kdebug.h> 29#include <linux/kdebug.h>
30#include <linux/utsname.h> 30#include <linux/utsname.h>
31#include <linux/tracehook.h>
31 32
32#include <asm/cpu.h> 33#include <asm/cpu.h>
33#include <asm/delay.h> 34#include <asm/delay.h>
@@ -160,21 +161,6 @@ show_regs (struct pt_regs *regs)
160 show_stack(NULL, NULL); 161 show_stack(NULL, NULL);
161} 162}
162 163
163void tsk_clear_notify_resume(struct task_struct *tsk)
164{
165#ifdef CONFIG_PERFMON
166 if (tsk->thread.pfm_needs_checking)
167 return;
168#endif
169 if (test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_RSE))
170 return;
171 clear_ti_thread_flag(task_thread_info(tsk), TIF_NOTIFY_RESUME);
172}
173
174/*
175 * do_notify_resume_user():
176 * Called from notify_resume_user at entry.S, with interrupts disabled.
177 */
178void 164void
179do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall) 165do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
180{ 166{
@@ -203,6 +189,11 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
203 ia64_do_signal(scr, in_syscall); 189 ia64_do_signal(scr, in_syscall);
204 } 190 }
205 191
192 if (test_thread_flag(TIF_NOTIFY_RESUME)) {
193 clear_thread_flag(TIF_NOTIFY_RESUME);
194 tracehook_notify_resume(&scr->pt);
195 }
196
206 /* copy user rbs to kernel rbs */ 197 /* copy user rbs to kernel rbs */
207 if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) { 198 if (unlikely(test_thread_flag(TIF_RESTORE_RSE))) {
208 local_irq_enable(); /* force interrupt enable */ 199 local_irq_enable(); /* force interrupt enable */
@@ -251,7 +242,6 @@ default_idle (void)
251/* We don't actually take CPU down, just spin without interrupts. */ 242/* We don't actually take CPU down, just spin without interrupts. */
252static inline void play_dead(void) 243static inline void play_dead(void)
253{ 244{
254 extern void ia64_cpu_local_tick (void);
255 unsigned int this_cpu = smp_processor_id(); 245 unsigned int this_cpu = smp_processor_id();
256 246
257 /* Ack it */ 247 /* Ack it */
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 2a9943b5947f..92c9689b7d97 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -22,6 +22,7 @@
22#include <linux/signal.h> 22#include <linux/signal.h>
23#include <linux/regset.h> 23#include <linux/regset.h>
24#include <linux/elf.h> 24#include <linux/elf.h>
25#include <linux/tracehook.h>
25 26
26#include <asm/pgtable.h> 27#include <asm/pgtable.h>
27#include <asm/processor.h> 28#include <asm/processor.h>
@@ -603,7 +604,7 @@ void ia64_ptrace_stop(void)
603{ 604{
604 if (test_and_set_tsk_thread_flag(current, TIF_RESTORE_RSE)) 605 if (test_and_set_tsk_thread_flag(current, TIF_RESTORE_RSE))
605 return; 606 return;
606 tsk_set_notify_resume(current); 607 set_notify_resume(current);
607 unw_init_running(do_sync_rbs, ia64_sync_user_rbs); 608 unw_init_running(do_sync_rbs, ia64_sync_user_rbs);
608} 609}
609 610
@@ -613,7 +614,6 @@ void ia64_ptrace_stop(void)
613void ia64_sync_krbs(void) 614void ia64_sync_krbs(void)
614{ 615{
615 clear_tsk_thread_flag(current, TIF_RESTORE_RSE); 616 clear_tsk_thread_flag(current, TIF_RESTORE_RSE);
616 tsk_clear_notify_resume(current);
617 617
618 unw_init_running(do_sync_rbs, ia64_sync_kernel_rbs); 618 unw_init_running(do_sync_rbs, ia64_sync_kernel_rbs);
619} 619}
@@ -644,7 +644,7 @@ ptrace_attach_sync_user_rbs (struct task_struct *child)
644 spin_lock_irq(&child->sighand->siglock); 644 spin_lock_irq(&child->sighand->siglock);
645 if (child->state == TASK_STOPPED && 645 if (child->state == TASK_STOPPED &&
646 !test_and_set_tsk_thread_flag(child, TIF_RESTORE_RSE)) { 646 !test_and_set_tsk_thread_flag(child, TIF_RESTORE_RSE)) {
647 tsk_set_notify_resume(child); 647 set_notify_resume(child);
648 648
649 child->state = TASK_TRACED; 649 child->state = TASK_TRACED;
650 stopped = 1; 650 stopped = 1;
@@ -1232,37 +1232,16 @@ arch_ptrace (struct task_struct *child, long request, long addr, long data)
1232} 1232}
1233 1233
1234 1234
1235static void
1236syscall_trace (void)
1237{
1238 /*
1239 * The 0x80 provides a way for the tracing parent to
1240 * distinguish between a syscall stop and SIGTRAP delivery.
1241 */
1242 ptrace_notify(SIGTRAP
1243 | ((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
1244
1245 /*
1246 * This isn't the same as continuing with a signal, but it
1247 * will do for normal use. strace only continues with a
1248 * signal if the stopping signal is not SIGTRAP. -brl
1249 */
1250 if (current->exit_code) {
1251 send_sig(current->exit_code, current, 1);
1252 current->exit_code = 0;
1253 }
1254}
1255
1256/* "asmlinkage" so the input arguments are preserved... */ 1235/* "asmlinkage" so the input arguments are preserved... */
1257 1236
1258asmlinkage void 1237asmlinkage long
1259syscall_trace_enter (long arg0, long arg1, long arg2, long arg3, 1238syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
1260 long arg4, long arg5, long arg6, long arg7, 1239 long arg4, long arg5, long arg6, long arg7,
1261 struct pt_regs regs) 1240 struct pt_regs regs)
1262{ 1241{
1263 if (test_thread_flag(TIF_SYSCALL_TRACE) 1242 if (test_thread_flag(TIF_SYSCALL_TRACE))
1264 && (current->ptrace & PT_PTRACED)) 1243 if (tracehook_report_syscall_entry(&regs))
1265 syscall_trace(); 1244 return -ENOSYS;
1266 1245
1267 /* copy user rbs to kernel rbs */ 1246 /* copy user rbs to kernel rbs */
1268 if (test_thread_flag(TIF_RESTORE_RSE)) 1247 if (test_thread_flag(TIF_RESTORE_RSE))
@@ -1283,6 +1262,7 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
1283 audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3); 1262 audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3);
1284 } 1263 }
1285 1264
1265 return 0;
1286} 1266}
1287 1267
1288/* "asmlinkage" so the input arguments are preserved... */ 1268/* "asmlinkage" so the input arguments are preserved... */
@@ -1292,6 +1272,8 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
1292 long arg4, long arg5, long arg6, long arg7, 1272 long arg4, long arg5, long arg6, long arg7,
1293 struct pt_regs regs) 1273 struct pt_regs regs)
1294{ 1274{
1275 int step;
1276
1295 if (unlikely(current->audit_context)) { 1277 if (unlikely(current->audit_context)) {
1296 int success = AUDITSC_RESULT(regs.r10); 1278 int success = AUDITSC_RESULT(regs.r10);
1297 long result = regs.r8; 1279 long result = regs.r8;
@@ -1301,10 +1283,9 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
1301 audit_syscall_exit(success, result); 1283 audit_syscall_exit(success, result);
1302 } 1284 }
1303 1285
1304 if ((test_thread_flag(TIF_SYSCALL_TRACE) 1286 step = test_thread_flag(TIF_SINGLESTEP);
1305 || test_thread_flag(TIF_SINGLESTEP)) 1287 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
1306 && (current->ptrace & PT_PTRACED)) 1288 tracehook_report_syscall_exit(&regs, step);
1307 syscall_trace();
1308 1289
1309 /* copy user rbs to kernel rbs */ 1290 /* copy user rbs to kernel rbs */
1310 if (test_thread_flag(TIF_RESTORE_RSE)) 1291 if (test_thread_flag(TIF_RESTORE_RSE))
@@ -1940,7 +1921,7 @@ gpregs_writeback(struct task_struct *target,
1940{ 1921{
1941 if (test_and_set_tsk_thread_flag(target, TIF_RESTORE_RSE)) 1922 if (test_and_set_tsk_thread_flag(target, TIF_RESTORE_RSE))
1942 return 0; 1923 return 0;
1943 tsk_set_notify_resume(target); 1924 set_notify_resume(target);
1944 return do_regset_call(do_gpregs_writeback, target, regset, 0, 0, 1925 return do_regset_call(do_gpregs_writeback, target, regset, 0, 0,
1945 NULL, NULL); 1926 NULL, NULL);
1946} 1927}
@@ -2199,3 +2180,68 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *tsk)
2199#endif 2180#endif
2200 return &user_ia64_view; 2181 return &user_ia64_view;
2201} 2182}
2183
2184struct syscall_get_set_args {
2185 unsigned int i;
2186 unsigned int n;
2187 unsigned long *args;
2188 struct pt_regs *regs;
2189 int rw;
2190};
2191
2192static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data)
2193{
2194 struct syscall_get_set_args *args = data;
2195 struct pt_regs *pt = args->regs;
2196 unsigned long *krbs, cfm, ndirty;
2197 int i, count;
2198
2199 if (unw_unwind_to_user(info) < 0)
2200 return;
2201
2202 cfm = pt->cr_ifs;
2203 krbs = (unsigned long *)info->task + IA64_RBS_OFFSET/8;
2204 ndirty = ia64_rse_num_regs(krbs, krbs + (pt->loadrs >> 19));
2205
2206 count = 0;
2207 if (in_syscall(pt))
2208 count = min_t(int, args->n, cfm & 0x7f);
2209
2210 for (i = 0; i < count; i++) {
2211 if (args->rw)
2212 *ia64_rse_skip_regs(krbs, ndirty + i + args->i) =
2213 args->args[i];
2214 else
2215 args->args[i] = *ia64_rse_skip_regs(krbs,
2216 ndirty + i + args->i);
2217 }
2218
2219 if (!args->rw) {
2220 while (i < args->n) {
2221 args->args[i] = 0;
2222 i++;
2223 }
2224 }
2225}
2226
2227void ia64_syscall_get_set_arguments(struct task_struct *task,
2228 struct pt_regs *regs, unsigned int i, unsigned int n,
2229 unsigned long *args, int rw)
2230{
2231 struct syscall_get_set_args data = {
2232 .i = i,
2233 .n = n,
2234 .args = args,
2235 .regs = regs,
2236 .rw = rw,
2237 };
2238
2239 if (task == current)
2240 unw_init_running(syscall_get_set_args_cb, &data);
2241 else {
2242 struct unw_frame_info ufi;
2243 memset(&ufi, 0, sizeof(ufi));
2244 unw_init_from_blocked_task(&ufi, task);
2245 syscall_get_set_args_cb(&ufi, &data);
2246 }
2247}
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 916ba898237f..ae7911702bf8 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -116,6 +116,13 @@ unsigned int num_io_spaces;
116 */ 116 */
117#define I_CACHE_STRIDE_SHIFT 5 /* Safest way to go: 32 bytes by 32 bytes */ 117#define I_CACHE_STRIDE_SHIFT 5 /* Safest way to go: 32 bytes by 32 bytes */
118unsigned long ia64_i_cache_stride_shift = ~0; 118unsigned long ia64_i_cache_stride_shift = ~0;
119/*
120 * "clflush_cache_range()" needs to know what processor dependent stride size to
121 * use when it flushes cache lines including both d-cache and i-cache.
122 */
123/* Safest way to go: 32 bytes by 32 bytes */
124#define CACHE_STRIDE_SHIFT 5
125unsigned long ia64_cache_stride_shift = ~0;
119 126
120/* 127/*
121 * The merge_mask variable needs to be set to (max(iommu_page_size(iommu)) - 1). This 128 * The merge_mask variable needs to be set to (max(iommu_page_size(iommu)) - 1). This
@@ -852,13 +859,14 @@ setup_per_cpu_areas (void)
852} 859}
853 860
854/* 861/*
855 * Calculate the max. cache line size. 862 * Do the following calculations:
856 * 863 *
857 * In addition, the minimum of the i-cache stride sizes is calculated for 864 * 1. the max. cache line size.
858 * "flush_icache_range()". 865 * 2. the minimum of the i-cache stride sizes for "flush_icache_range()".
866 * 3. the minimum of the cache stride sizes for "clflush_cache_range()".
859 */ 867 */
860static void __cpuinit 868static void __cpuinit
861get_max_cacheline_size (void) 869get_cache_info(void)
862{ 870{
863 unsigned long line_size, max = 1; 871 unsigned long line_size, max = 1;
864 u64 l, levels, unique_caches; 872 u64 l, levels, unique_caches;
@@ -872,12 +880,14 @@ get_max_cacheline_size (void)
872 max = SMP_CACHE_BYTES; 880 max = SMP_CACHE_BYTES;
873 /* Safest setup for "flush_icache_range()" */ 881 /* Safest setup for "flush_icache_range()" */
874 ia64_i_cache_stride_shift = I_CACHE_STRIDE_SHIFT; 882 ia64_i_cache_stride_shift = I_CACHE_STRIDE_SHIFT;
883 /* Safest setup for "clflush_cache_range()" */
884 ia64_cache_stride_shift = CACHE_STRIDE_SHIFT;
875 goto out; 885 goto out;
876 } 886 }
877 887
878 for (l = 0; l < levels; ++l) { 888 for (l = 0; l < levels; ++l) {
879 status = ia64_pal_cache_config_info(l, /* cache_type (data_or_unified)= */ 2, 889 /* cache_type (data_or_unified)=2 */
880 &cci); 890 status = ia64_pal_cache_config_info(l, 2, &cci);
881 if (status != 0) { 891 if (status != 0) {
882 printk(KERN_ERR 892 printk(KERN_ERR
883 "%s: ia64_pal_cache_config_info(l=%lu, 2) failed (status=%ld)\n", 893 "%s: ia64_pal_cache_config_info(l=%lu, 2) failed (status=%ld)\n",
@@ -885,15 +895,21 @@ get_max_cacheline_size (void)
885 max = SMP_CACHE_BYTES; 895 max = SMP_CACHE_BYTES;
886 /* The safest setup for "flush_icache_range()" */ 896 /* The safest setup for "flush_icache_range()" */
887 cci.pcci_stride = I_CACHE_STRIDE_SHIFT; 897 cci.pcci_stride = I_CACHE_STRIDE_SHIFT;
898 /* The safest setup for "clflush_cache_range()" */
899 ia64_cache_stride_shift = CACHE_STRIDE_SHIFT;
888 cci.pcci_unified = 1; 900 cci.pcci_unified = 1;
901 } else {
902 if (cci.pcci_stride < ia64_cache_stride_shift)
903 ia64_cache_stride_shift = cci.pcci_stride;
904
905 line_size = 1 << cci.pcci_line_size;
906 if (line_size > max)
907 max = line_size;
889 } 908 }
890 line_size = 1 << cci.pcci_line_size; 909
891 if (line_size > max)
892 max = line_size;
893 if (!cci.pcci_unified) { 910 if (!cci.pcci_unified) {
894 status = ia64_pal_cache_config_info(l, 911 /* cache_type (instruction)=1*/
895 /* cache_type (instruction)= */ 1, 912 status = ia64_pal_cache_config_info(l, 1, &cci);
896 &cci);
897 if (status != 0) { 913 if (status != 0) {
898 printk(KERN_ERR 914 printk(KERN_ERR
899 "%s: ia64_pal_cache_config_info(l=%lu, 1) failed (status=%ld)\n", 915 "%s: ia64_pal_cache_config_info(l=%lu, 1) failed (status=%ld)\n",
@@ -947,7 +963,7 @@ cpu_init (void)
947 } 963 }
948#endif 964#endif
949 965
950 get_max_cacheline_size(); 966 get_cache_info();
951 967
952 /* 968 /*
953 * We can't pass "local_cpu_data" to identify_cpu() because we haven't called 969 * We can't pass "local_cpu_data" to identify_cpu() because we haven't called
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 19c5a78636fc..e12500a9c443 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/ptrace.h> 13#include <linux/ptrace.h>
14#include <linux/tracehook.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15#include <linux/signal.h> 16#include <linux/signal.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
@@ -439,6 +440,13 @@ handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, sigse
439 sigaddset(&current->blocked, sig); 440 sigaddset(&current->blocked, sig);
440 recalc_sigpending(); 441 recalc_sigpending();
441 spin_unlock_irq(&current->sighand->siglock); 442 spin_unlock_irq(&current->sighand->siglock);
443
444 /*
445 * Let tracing know that we've done the handler setup.
446 */
447 tracehook_signal_handler(sig, info, ka, &scr->pt,
448 test_thread_flag(TIF_SINGLESTEP));
449
442 return 1; 450 return 1;
443} 451}
444 452
diff --git a/arch/ia64/lib/flush.S b/arch/ia64/lib/flush.S
index 2a0d27f2f21b..1d8c88860063 100644
--- a/arch/ia64/lib/flush.S
+++ b/arch/ia64/lib/flush.S
@@ -60,3 +60,58 @@ GLOBAL_ENTRY(flush_icache_range)
60 mov ar.lc=r3 // restore ar.lc 60 mov ar.lc=r3 // restore ar.lc
61 br.ret.sptk.many rp 61 br.ret.sptk.many rp
62END(flush_icache_range) 62END(flush_icache_range)
63
64 /*
65 * clflush_cache_range(start,size)
66 *
67 * Flush cache lines from start to start+size-1.
68 *
69 * Must deal with range from start to start+size-1 but nothing else
70 * (need to be careful not to touch addresses that may be
71 * unmapped).
72 *
73 * Note: "in0" and "in1" are preserved for debugging purposes.
74 */
75 .section .kprobes.text,"ax"
76GLOBAL_ENTRY(clflush_cache_range)
77
78 .prologue
79 alloc r2=ar.pfs,2,0,0,0
80 movl r3=ia64_cache_stride_shift
81 mov r21=1
82 add r22=in1,in0
83 ;;
84 ld8 r20=[r3] // r20: stride shift
85 sub r22=r22,r0,1 // last byte address
86 ;;
87 shr.u r23=in0,r20 // start / (stride size)
88 shr.u r22=r22,r20 // (last byte address) / (stride size)
89 shl r21=r21,r20 // r21: stride size of the i-cache(s)
90 ;;
91 sub r8=r22,r23 // number of strides - 1
92 shl r24=r23,r20 // r24: addresses for "fc" =
93 // "start" rounded down to stride
94 // boundary
95 .save ar.lc,r3
96 mov r3=ar.lc // save ar.lc
97 ;;
98
99 .body
100 mov ar.lc=r8
101 ;;
102 /*
103 * 32 byte aligned loop, even number of (actually 2) bundles
104 */
105.Loop_fc:
106 fc r24 // issuable on M0 only
107 add r24=r21,r24 // we flush "stride size" bytes per iteration
108 nop.i 0
109 br.cloop.sptk.few .Loop_fc
110 ;;
111 sync.i
112 ;;
113 srlz.i
114 ;;
115 mov ar.lc=r3 // restore ar.lc
116 br.ret.sptk.many rp
117END(clflush_cache_range)
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 8caf42471f0d..bd9818a36b47 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -362,9 +362,13 @@ ia64_tlb_init (void)
362 per_cpu(ia64_tr_num, cpu) = 362 per_cpu(ia64_tr_num, cpu) =
363 vm_info_1.pal_vm_info_1_s.max_dtr_entry+1; 363 vm_info_1.pal_vm_info_1_s.max_dtr_entry+1;
364 if (per_cpu(ia64_tr_num, cpu) > IA64_TR_ALLOC_MAX) { 364 if (per_cpu(ia64_tr_num, cpu) > IA64_TR_ALLOC_MAX) {
365 static int justonce = 1;
365 per_cpu(ia64_tr_num, cpu) = IA64_TR_ALLOC_MAX; 366 per_cpu(ia64_tr_num, cpu) = IA64_TR_ALLOC_MAX;
366 printk(KERN_DEBUG "TR register number exceeds IA64_TR_ALLOC_MAX!" 367 if (justonce) {
367 "IA64_TR_ALLOC_MAX should be extended\n"); 368 justonce = 0;
369 printk(KERN_DEBUG "TR register number exceeds "
370 "IA64_TR_ALLOC_MAX!\n");
371 }
368 } 372 }
369} 373}
370 374
diff --git a/arch/ia64/oprofile/init.c b/arch/ia64/oprofile/init.c
index 125a602a660d..31b545c35460 100644
--- a/arch/ia64/oprofile/init.c
+++ b/arch/ia64/oprofile/init.c
@@ -12,11 +12,11 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14 14
15extern int perfmon_init(struct oprofile_operations * ops); 15extern int perfmon_init(struct oprofile_operations *ops);
16extern void perfmon_exit(void); 16extern void perfmon_exit(void);
17extern void ia64_backtrace(struct pt_regs * const regs, unsigned int depth); 17extern void ia64_backtrace(struct pt_regs * const regs, unsigned int depth);
18 18
19int __init oprofile_arch_init(struct oprofile_operations * ops) 19int __init oprofile_arch_init(struct oprofile_operations *ops)
20{ 20{
21 int ret = -ENODEV; 21 int ret = -ENODEV;
22 22
diff --git a/arch/ia64/oprofile/perfmon.c b/arch/ia64/oprofile/perfmon.c
index bc41dd32fec6..192d3e8e1f65 100644
--- a/arch/ia64/oprofile/perfmon.c
+++ b/arch/ia64/oprofile/perfmon.c
@@ -56,7 +56,7 @@ static pfm_buffer_fmt_t oprofile_fmt = {
56}; 56};
57 57
58 58
59static char * get_cpu_type(void) 59static char *get_cpu_type(void)
60{ 60{
61 __u8 family = local_cpu_data->family; 61 __u8 family = local_cpu_data->family;
62 62
@@ -75,7 +75,7 @@ static char * get_cpu_type(void)
75 75
76static int using_perfmon; 76static int using_perfmon;
77 77
78int perfmon_init(struct oprofile_operations * ops) 78int perfmon_init(struct oprofile_operations *ops)
79{ 79{
80 int ret = pfm_register_buffer_fmt(&oprofile_fmt); 80 int ret = pfm_register_buffer_fmt(&oprofile_fmt);
81 if (ret) 81 if (ret)
diff --git a/arch/ia64/scripts/pvcheck.sed b/arch/ia64/scripts/pvcheck.sed
new file mode 100644
index 000000000000..ba66ac2e4c60
--- /dev/null
+++ b/arch/ia64/scripts/pvcheck.sed
@@ -0,0 +1,32 @@
1#
2# Checker for paravirtualizations of privileged operations.
3#
4s/ssm.*psr\.ic.*/.warning \"ssm psr.ic should not be used directly\"/g
5s/rsm.*psr\.ic.*/.warning \"rsm psr.ic should not be used directly\"/g
6s/ssm.*psr\.i.*/.warning \"ssm psr.i should not be used directly\"/g
7s/rsm.*psr\.i.*/.warning \"rsm psr.i should not be used directly\"/g
8s/ssm.*psr\.dt.*/.warning \"ssm psr.dt should not be used directly\"/g
9s/rsm.*psr\.dt.*/.warning \"rsm psr.dt should not be used directly\"/g
10s/mov.*=.*cr\.ifa/.warning \"cr.ifa should not used directly\"/g
11s/mov.*=.*cr\.itir/.warning \"cr.itir should not used directly\"/g
12s/mov.*=.*cr\.isr/.warning \"cr.isr should not used directly\"/g
13s/mov.*=.*cr\.iha/.warning \"cr.iha should not used directly\"/g
14s/mov.*=.*cr\.ipsr/.warning \"cr.ipsr should not used directly\"/g
15s/mov.*=.*cr\.iim/.warning \"cr.iim should not used directly\"/g
16s/mov.*=.*cr\.iip/.warning \"cr.iip should not used directly\"/g
17s/mov.*=.*cr\.ivr/.warning \"cr.ivr should not used directly\"/g
18s/mov.*=[^\.]*psr/.warning \"psr should not used directly\"/g # avoid ar.fpsr
19s/mov.*=.*ar\.eflags/.warning \"ar.eflags should not used directly\"/g
20s/mov.*cr\.ifa.*=.*/.warning \"cr.ifa should not used directly\"/g
21s/mov.*cr\.itir.*=.*/.warning \"cr.itir should not used directly\"/g
22s/mov.*cr\.iha.*=.*/.warning \"cr.iha should not used directly\"/g
23s/mov.*cr\.ipsr.*=.*/.warning \"cr.ipsr should not used directly\"/g
24s/mov.*cr\.ifs.*=.*/.warning \"cr.ifs should not used directly\"/g
25s/mov.*cr\.iip.*=.*/.warning \"cr.iip should not used directly\"/g
26s/mov.*cr\.kr.*=.*/.warning \"cr.kr should not used directly\"/g
27s/mov.*ar\.eflags.*=.*/.warning \"ar.eflags should not used directly\"/g
28s/itc\.i.*/.warning \"itc.i should not be used directly.\"/g
29s/itc\.d.*/.warning \"itc.d should not be used directly.\"/g
30s/bsw\.0/.warning \"bsw.0 should not be used directly.\"/g
31s/bsw\.1/.warning \"bsw.1 should not be used directly.\"/g
32s/ptc\.ga.*/.warning \"ptc.ga should not be used directly.\"/g
diff --git a/arch/ia64/xen/Kconfig b/arch/ia64/xen/Kconfig
new file mode 100644
index 000000000000..f1683a20275b
--- /dev/null
+++ b/arch/ia64/xen/Kconfig
@@ -0,0 +1,26 @@
1#
2# This Kconfig describes xen/ia64 options
3#
4
5config XEN
6 bool "Xen hypervisor support"
7 default y
8 depends on PARAVIRT && MCKINLEY && IA64_PAGE_SIZE_16KB && EXPERIMENTAL
9 select XEN_XENCOMM
10 select NO_IDLE_HZ
11
12 # those are required to save/restore.
13 select ARCH_SUSPEND_POSSIBLE
14 select SUSPEND
15 select PM_SLEEP
16 help
17 Enable Xen hypervisor support. Resulting kernel runs
18 both as a guest OS on Xen and natively on hardware.
19
20config XEN_XENCOMM
21 depends on XEN
22 bool
23
24config NO_IDLE_HZ
25 depends on XEN
26 bool
diff --git a/arch/ia64/xen/Makefile b/arch/ia64/xen/Makefile
new file mode 100644
index 000000000000..0ad0224693d9
--- /dev/null
+++ b/arch/ia64/xen/Makefile
@@ -0,0 +1,22 @@
1#
2# Makefile for Xen components
3#
4
5obj-y := hypercall.o xenivt.o xensetup.o xen_pv_ops.o irq_xen.o \
6 hypervisor.o xencomm.o xcom_hcall.o grant-table.o time.o suspend.o
7
8obj-$(CONFIG_IA64_GENERIC) += machvec.o
9
10AFLAGS_xenivt.o += -D__IA64_ASM_PARAVIRTUALIZED_XEN
11
12# xen multi compile
13ASM_PARAVIRT_MULTI_COMPILE_SRCS = ivt.S entry.S
14ASM_PARAVIRT_OBJS = $(addprefix xen-,$(ASM_PARAVIRT_MULTI_COMPILE_SRCS:.S=.o))
15obj-y += $(ASM_PARAVIRT_OBJS)
16define paravirtualized_xen
17AFLAGS_$(1) += -D__IA64_ASM_PARAVIRTUALIZED_XEN
18endef
19$(foreach o,$(ASM_PARAVIRT_OBJS),$(eval $(call paravirtualized_xen,$(o))))
20
21$(obj)/xen-%.o: $(src)/../kernel/%.S FORCE
22 $(call if_changed_dep,as_o_S)
diff --git a/arch/ia64/xen/grant-table.c b/arch/ia64/xen/grant-table.c
new file mode 100644
index 000000000000..777dd9a9108b
--- /dev/null
+++ b/arch/ia64/xen/grant-table.c
@@ -0,0 +1,155 @@
1/******************************************************************************
2 * arch/ia64/xen/grant-table.c
3 *
4 * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include <linux/module.h>
24#include <linux/vmalloc.h>
25#include <linux/mm.h>
26
27#include <xen/interface/xen.h>
28#include <xen/interface/memory.h>
29#include <xen/grant_table.h>
30
31#include <asm/xen/hypervisor.h>
32
33struct vm_struct *xen_alloc_vm_area(unsigned long size)
34{
35 int order;
36 unsigned long virt;
37 unsigned long nr_pages;
38 struct vm_struct *area;
39
40 order = get_order(size);
41 virt = __get_free_pages(GFP_KERNEL, order);
42 if (virt == 0)
43 goto err0;
44 nr_pages = 1 << order;
45 scrub_pages(virt, nr_pages);
46
47 area = kmalloc(sizeof(*area), GFP_KERNEL);
48 if (area == NULL)
49 goto err1;
50
51 area->flags = VM_IOREMAP;
52 area->addr = (void *)virt;
53 area->size = size;
54 area->pages = NULL;
55 area->nr_pages = nr_pages;
56 area->phys_addr = 0; /* xenbus_map_ring_valloc uses this field! */
57
58 return area;
59
60err1:
61 free_pages(virt, order);
62err0:
63 return NULL;
64}
65EXPORT_SYMBOL_GPL(xen_alloc_vm_area);
66
67void xen_free_vm_area(struct vm_struct *area)
68{
69 unsigned int order = get_order(area->size);
70 unsigned long i;
71 unsigned long phys_addr = __pa(area->addr);
72
73 /* This area is used for foreign page mappping.
74 * So underlying machine page may not be assigned. */
75 for (i = 0; i < (1 << order); i++) {
76 unsigned long ret;
77 unsigned long gpfn = (phys_addr >> PAGE_SHIFT) + i;
78 struct xen_memory_reservation reservation = {
79 .nr_extents = 1,
80 .address_bits = 0,
81 .extent_order = 0,
82 .domid = DOMID_SELF
83 };
84 set_xen_guest_handle(reservation.extent_start, &gpfn);
85 ret = HYPERVISOR_memory_op(XENMEM_populate_physmap,
86 &reservation);
87 BUG_ON(ret != 1);
88 }
89 free_pages((unsigned long)area->addr, order);
90 kfree(area);
91}
92EXPORT_SYMBOL_GPL(xen_free_vm_area);
93
94
95/****************************************************************************
96 * grant table hack
97 * cmd: GNTTABOP_xxx
98 */
99
100int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
101 unsigned long max_nr_gframes,
102 struct grant_entry **__shared)
103{
104 *__shared = __va(frames[0] << PAGE_SHIFT);
105 return 0;
106}
107
108void arch_gnttab_unmap_shared(struct grant_entry *shared,
109 unsigned long nr_gframes)
110{
111 /* nothing */
112}
113
114static void
115gnttab_map_grant_ref_pre(struct gnttab_map_grant_ref *uop)
116{
117 uint32_t flags;
118
119 flags = uop->flags;
120
121 if (flags & GNTMAP_host_map) {
122 if (flags & GNTMAP_application_map) {
123 printk(KERN_DEBUG
124 "GNTMAP_application_map is not supported yet: "
125 "flags 0x%x\n", flags);
126 BUG();
127 }
128 if (flags & GNTMAP_contains_pte) {
129 printk(KERN_DEBUG
130 "GNTMAP_contains_pte is not supported yet: "
131 "flags 0x%x\n", flags);
132 BUG();
133 }
134 } else if (flags & GNTMAP_device_map) {
135 printk("GNTMAP_device_map is not supported yet 0x%x\n", flags);
136 BUG(); /* not yet. actually this flag is not used. */
137 } else {
138 BUG();
139 }
140}
141
142int
143HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
144{
145 if (cmd == GNTTABOP_map_grant_ref) {
146 unsigned int i;
147 for (i = 0; i < count; i++) {
148 gnttab_map_grant_ref_pre(
149 (struct gnttab_map_grant_ref *)uop + i);
150 }
151 }
152 return xencomm_hypercall_grant_table_op(cmd, uop, count);
153}
154
155EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
diff --git a/arch/ia64/xen/hypercall.S b/arch/ia64/xen/hypercall.S
new file mode 100644
index 000000000000..d4ff0b9e79f1
--- /dev/null
+++ b/arch/ia64/xen/hypercall.S
@@ -0,0 +1,91 @@
1/*
2 * Support routines for Xen hypercalls
3 *
4 * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer@hp.com>
5 * Copyright (C) 2008 Yaozu (Eddie) Dong <eddie.dong@intel.com>
6 */
7
8#include <asm/asmmacro.h>
9#include <asm/intrinsics.h>
10#include <asm/xen/privop.h>
11
12/*
13 * Hypercalls without parameter.
14 */
15#define __HCALL0(name,hcall) \
16 GLOBAL_ENTRY(name); \
17 break hcall; \
18 br.ret.sptk.many rp; \
19 END(name)
20
21/*
22 * Hypercalls with 1 parameter.
23 */
24#define __HCALL1(name,hcall) \
25 GLOBAL_ENTRY(name); \
26 mov r8=r32; \
27 break hcall; \
28 br.ret.sptk.many rp; \
29 END(name)
30
31/*
32 * Hypercalls with 2 parameters.
33 */
34#define __HCALL2(name,hcall) \
35 GLOBAL_ENTRY(name); \
36 mov r8=r32; \
37 mov r9=r33; \
38 break hcall; \
39 br.ret.sptk.many rp; \
40 END(name)
41
42__HCALL0(xen_get_psr, HYPERPRIVOP_GET_PSR)
43__HCALL0(xen_get_ivr, HYPERPRIVOP_GET_IVR)
44__HCALL0(xen_get_tpr, HYPERPRIVOP_GET_TPR)
45__HCALL0(xen_hyper_ssm_i, HYPERPRIVOP_SSM_I)
46
47__HCALL1(xen_set_tpr, HYPERPRIVOP_SET_TPR)
48__HCALL1(xen_eoi, HYPERPRIVOP_EOI)
49__HCALL1(xen_thash, HYPERPRIVOP_THASH)
50__HCALL1(xen_set_itm, HYPERPRIVOP_SET_ITM)
51__HCALL1(xen_get_rr, HYPERPRIVOP_GET_RR)
52__HCALL1(xen_fc, HYPERPRIVOP_FC)
53__HCALL1(xen_get_cpuid, HYPERPRIVOP_GET_CPUID)
54__HCALL1(xen_get_pmd, HYPERPRIVOP_GET_PMD)
55
56__HCALL2(xen_ptcga, HYPERPRIVOP_PTC_GA)
57__HCALL2(xen_set_rr, HYPERPRIVOP_SET_RR)
58__HCALL2(xen_set_kr, HYPERPRIVOP_SET_KR)
59
60#ifdef CONFIG_IA32_SUPPORT
61__HCALL1(xen_get_eflag, HYPERPRIVOP_GET_EFLAG)
62__HCALL1(xen_set_eflag, HYPERPRIVOP_SET_EFLAG) // refer SDM vol1 3.1.8
63#endif /* CONFIG_IA32_SUPPORT */
64
65GLOBAL_ENTRY(xen_set_rr0_to_rr4)
66 mov r8=r32
67 mov r9=r33
68 mov r10=r34
69 mov r11=r35
70 mov r14=r36
71 XEN_HYPER_SET_RR0_TO_RR4
72 br.ret.sptk.many rp
73 ;;
74END(xen_set_rr0_to_rr4)
75
76GLOBAL_ENTRY(xen_send_ipi)
77 mov r14=r32
78 mov r15=r33
79 mov r2=0x400
80 break 0x1000
81 ;;
82 br.ret.sptk.many rp
83 ;;
84END(xen_send_ipi)
85
86GLOBAL_ENTRY(__hypercall)
87 mov r2=r37
88 break 0x1000
89 br.ret.sptk.many b0
90 ;;
91END(__hypercall)
diff --git a/arch/ia64/xen/hypervisor.c b/arch/ia64/xen/hypervisor.c
new file mode 100644
index 000000000000..cac4d97c0b5a
--- /dev/null
+++ b/arch/ia64/xen/hypervisor.c
@@ -0,0 +1,96 @@
1/******************************************************************************
2 * arch/ia64/xen/hypervisor.c
3 *
4 * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include <linux/efi.h>
24#include <asm/xen/hypervisor.h>
25#include <asm/xen/privop.h>
26
27#include "irq_xen.h"
28
29struct shared_info *HYPERVISOR_shared_info __read_mostly =
30 (struct shared_info *)XSI_BASE;
31EXPORT_SYMBOL(HYPERVISOR_shared_info);
32
33DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
34
35struct start_info *xen_start_info;
36EXPORT_SYMBOL(xen_start_info);
37
38EXPORT_SYMBOL(xen_domain_type);
39
40EXPORT_SYMBOL(__hypercall);
41
42/* Stolen from arch/x86/xen/enlighten.c */
43/*
44 * Flag to determine whether vcpu info placement is available on all
45 * VCPUs. We assume it is to start with, and then set it to zero on
46 * the first failure. This is because it can succeed on some VCPUs
47 * and not others, since it can involve hypervisor memory allocation,
48 * or because the guest failed to guarantee all the appropriate
49 * constraints on all VCPUs (ie buffer can't cross a page boundary).
50 *
51 * Note that any particular CPU may be using a placed vcpu structure,
52 * but we can only optimise if the all are.
53 *
54 * 0: not available, 1: available
55 */
56
57static void __init xen_vcpu_setup(int cpu)
58{
59 /*
60 * WARNING:
61 * before changing MAX_VIRT_CPUS,
62 * check that shared_info fits on a page
63 */
64 BUILD_BUG_ON(sizeof(struct shared_info) > PAGE_SIZE);
65 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
66}
67
68void __init xen_setup_vcpu_info_placement(void)
69{
70 int cpu;
71
72 for_each_possible_cpu(cpu)
73 xen_vcpu_setup(cpu);
74}
75
76void __cpuinit
77xen_cpu_init(void)
78{
79 xen_smp_intr_init();
80}
81
82/**************************************************************************
83 * opt feature
84 */
85void
86xen_ia64_enable_opt_feature(void)
87{
88 /* Enable region 7 identity map optimizations in Xen */
89 struct xen_ia64_opt_feature optf;
90
91 optf.cmd = XEN_IA64_OPTF_IDENT_MAP_REG7;
92 optf.on = XEN_IA64_OPTF_ON;
93 optf.pgprot = pgprot_val(PAGE_KERNEL);
94 optf.key = 0; /* No key on linux. */
95 HYPERVISOR_opt_feature(&optf);
96}
diff --git a/arch/ia64/xen/irq_xen.c b/arch/ia64/xen/irq_xen.c
new file mode 100644
index 000000000000..af93aadb68bb
--- /dev/null
+++ b/arch/ia64/xen/irq_xen.c
@@ -0,0 +1,435 @@
1/******************************************************************************
2 * arch/ia64/xen/irq_xen.c
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include <linux/cpu.h>
24
25#include <xen/interface/xen.h>
26#include <xen/interface/callback.h>
27#include <xen/events.h>
28
29#include <asm/xen/privop.h>
30
31#include "irq_xen.h"
32
33/***************************************************************************
34 * pv_irq_ops
35 * irq operations
36 */
37
38static int
39xen_assign_irq_vector(int irq)
40{
41 struct physdev_irq irq_op;
42
43 irq_op.irq = irq;
44 if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
45 return -ENOSPC;
46
47 return irq_op.vector;
48}
49
50static void
51xen_free_irq_vector(int vector)
52{
53 struct physdev_irq irq_op;
54
55 if (vector < IA64_FIRST_DEVICE_VECTOR ||
56 vector > IA64_LAST_DEVICE_VECTOR)
57 return;
58
59 irq_op.vector = vector;
60 if (HYPERVISOR_physdev_op(PHYSDEVOP_free_irq_vector, &irq_op))
61 printk(KERN_WARNING "%s: xen_free_irq_vecotr fail vector=%d\n",
62 __func__, vector);
63}
64
65
66static DEFINE_PER_CPU(int, timer_irq) = -1;
67static DEFINE_PER_CPU(int, ipi_irq) = -1;
68static DEFINE_PER_CPU(int, resched_irq) = -1;
69static DEFINE_PER_CPU(int, cmc_irq) = -1;
70static DEFINE_PER_CPU(int, cmcp_irq) = -1;
71static DEFINE_PER_CPU(int, cpep_irq) = -1;
72#define NAME_SIZE 15
73static DEFINE_PER_CPU(char[NAME_SIZE], timer_name);
74static DEFINE_PER_CPU(char[NAME_SIZE], ipi_name);
75static DEFINE_PER_CPU(char[NAME_SIZE], resched_name);
76static DEFINE_PER_CPU(char[NAME_SIZE], cmc_name);
77static DEFINE_PER_CPU(char[NAME_SIZE], cmcp_name);
78static DEFINE_PER_CPU(char[NAME_SIZE], cpep_name);
79#undef NAME_SIZE
80
81struct saved_irq {
82 unsigned int irq;
83 struct irqaction *action;
84};
85/* 16 should be far optimistic value, since only several percpu irqs
86 * are registered early.
87 */
88#define MAX_LATE_IRQ 16
89static struct saved_irq saved_percpu_irqs[MAX_LATE_IRQ];
90static unsigned short late_irq_cnt;
91static unsigned short saved_irq_cnt;
92static int xen_slab_ready;
93
94#ifdef CONFIG_SMP
95/* Dummy stub. Though we may check XEN_RESCHEDULE_VECTOR before __do_IRQ,
96 * it ends up to issue several memory accesses upon percpu data and
97 * thus adds unnecessary traffic to other paths.
98 */
99static irqreturn_t
100xen_dummy_handler(int irq, void *dev_id)
101{
102
103 return IRQ_HANDLED;
104}
105
106static struct irqaction xen_ipi_irqaction = {
107 .handler = handle_IPI,
108 .flags = IRQF_DISABLED,
109 .name = "IPI"
110};
111
112static struct irqaction xen_resched_irqaction = {
113 .handler = xen_dummy_handler,
114 .flags = IRQF_DISABLED,
115 .name = "resched"
116};
117
118static struct irqaction xen_tlb_irqaction = {
119 .handler = xen_dummy_handler,
120 .flags = IRQF_DISABLED,
121 .name = "tlb_flush"
122};
123#endif
124
125/*
126 * This is xen version percpu irq registration, which needs bind
127 * to xen specific evtchn sub-system. One trick here is that xen
128 * evtchn binding interface depends on kmalloc because related
129 * port needs to be freed at device/cpu down. So we cache the
130 * registration on BSP before slab is ready and then deal them
131 * at later point. For rest instances happening after slab ready,
132 * we hook them to xen evtchn immediately.
133 *
134 * FIXME: MCA is not supported by far, and thus "nomca" boot param is
135 * required.
136 */
137static void
138__xen_register_percpu_irq(unsigned int cpu, unsigned int vec,
139 struct irqaction *action, int save)
140{
141 irq_desc_t *desc;
142 int irq = 0;
143
144 if (xen_slab_ready) {
145 switch (vec) {
146 case IA64_TIMER_VECTOR:
147 snprintf(per_cpu(timer_name, cpu),
148 sizeof(per_cpu(timer_name, cpu)),
149 "%s%d", action->name, cpu);
150 irq = bind_virq_to_irqhandler(VIRQ_ITC, cpu,
151 action->handler, action->flags,
152 per_cpu(timer_name, cpu), action->dev_id);
153 per_cpu(timer_irq, cpu) = irq;
154 break;
155 case IA64_IPI_RESCHEDULE:
156 snprintf(per_cpu(resched_name, cpu),
157 sizeof(per_cpu(resched_name, cpu)),
158 "%s%d", action->name, cpu);
159 irq = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu,
160 action->handler, action->flags,
161 per_cpu(resched_name, cpu), action->dev_id);
162 per_cpu(resched_irq, cpu) = irq;
163 break;
164 case IA64_IPI_VECTOR:
165 snprintf(per_cpu(ipi_name, cpu),
166 sizeof(per_cpu(ipi_name, cpu)),
167 "%s%d", action->name, cpu);
168 irq = bind_ipi_to_irqhandler(XEN_IPI_VECTOR, cpu,
169 action->handler, action->flags,
170 per_cpu(ipi_name, cpu), action->dev_id);
171 per_cpu(ipi_irq, cpu) = irq;
172 break;
173 case IA64_CMC_VECTOR:
174 snprintf(per_cpu(cmc_name, cpu),
175 sizeof(per_cpu(cmc_name, cpu)),
176 "%s%d", action->name, cpu);
177 irq = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu,
178 action->handler,
179 action->flags,
180 per_cpu(cmc_name, cpu),
181 action->dev_id);
182 per_cpu(cmc_irq, cpu) = irq;
183 break;
184 case IA64_CMCP_VECTOR:
185 snprintf(per_cpu(cmcp_name, cpu),
186 sizeof(per_cpu(cmcp_name, cpu)),
187 "%s%d", action->name, cpu);
188 irq = bind_ipi_to_irqhandler(XEN_CMCP_VECTOR, cpu,
189 action->handler,
190 action->flags,
191 per_cpu(cmcp_name, cpu),
192 action->dev_id);
193 per_cpu(cmcp_irq, cpu) = irq;
194 break;
195 case IA64_CPEP_VECTOR:
196 snprintf(per_cpu(cpep_name, cpu),
197 sizeof(per_cpu(cpep_name, cpu)),
198 "%s%d", action->name, cpu);
199 irq = bind_ipi_to_irqhandler(XEN_CPEP_VECTOR, cpu,
200 action->handler,
201 action->flags,
202 per_cpu(cpep_name, cpu),
203 action->dev_id);
204 per_cpu(cpep_irq, cpu) = irq;
205 break;
206 case IA64_CPE_VECTOR:
207 case IA64_MCA_RENDEZ_VECTOR:
208 case IA64_PERFMON_VECTOR:
209 case IA64_MCA_WAKEUP_VECTOR:
210 case IA64_SPURIOUS_INT_VECTOR:
211 /* No need to complain, these aren't supported. */
212 break;
213 default:
214 printk(KERN_WARNING "Percpu irq %d is unsupported "
215 "by xen!\n", vec);
216 break;
217 }
218 BUG_ON(irq < 0);
219
220 if (irq > 0) {
221 /*
222 * Mark percpu. Without this, migrate_irqs() will
223 * mark the interrupt for migrations and trigger it
224 * on cpu hotplug.
225 */
226 desc = irq_desc + irq;
227 desc->status |= IRQ_PER_CPU;
228 }
229 }
230
231 /* For BSP, we cache registered percpu irqs, and then re-walk
232 * them when initializing APs
233 */
234 if (!cpu && save) {
235 BUG_ON(saved_irq_cnt == MAX_LATE_IRQ);
236 saved_percpu_irqs[saved_irq_cnt].irq = vec;
237 saved_percpu_irqs[saved_irq_cnt].action = action;
238 saved_irq_cnt++;
239 if (!xen_slab_ready)
240 late_irq_cnt++;
241 }
242}
243
244static void
245xen_register_percpu_irq(ia64_vector vec, struct irqaction *action)
246{
247 __xen_register_percpu_irq(smp_processor_id(), vec, action, 1);
248}
249
250static void
251xen_bind_early_percpu_irq(void)
252{
253 int i;
254
255 xen_slab_ready = 1;
256 /* There's no race when accessing this cached array, since only
257 * BSP will face with such step shortly
258 */
259 for (i = 0; i < late_irq_cnt; i++)
260 __xen_register_percpu_irq(smp_processor_id(),
261 saved_percpu_irqs[i].irq,
262 saved_percpu_irqs[i].action, 0);
263}
264
265/* FIXME: There's no obvious point to check whether slab is ready. So
266 * a hack is used here by utilizing a late time hook.
267 */
268
269#ifdef CONFIG_HOTPLUG_CPU
270static int __devinit
271unbind_evtchn_callback(struct notifier_block *nfb,
272 unsigned long action, void *hcpu)
273{
274 unsigned int cpu = (unsigned long)hcpu;
275
276 if (action == CPU_DEAD) {
277 /* Unregister evtchn. */
278 if (per_cpu(cpep_irq, cpu) >= 0) {
279 unbind_from_irqhandler(per_cpu(cpep_irq, cpu), NULL);
280 per_cpu(cpep_irq, cpu) = -1;
281 }
282 if (per_cpu(cmcp_irq, cpu) >= 0) {
283 unbind_from_irqhandler(per_cpu(cmcp_irq, cpu), NULL);
284 per_cpu(cmcp_irq, cpu) = -1;
285 }
286 if (per_cpu(cmc_irq, cpu) >= 0) {
287 unbind_from_irqhandler(per_cpu(cmc_irq, cpu), NULL);
288 per_cpu(cmc_irq, cpu) = -1;
289 }
290 if (per_cpu(ipi_irq, cpu) >= 0) {
291 unbind_from_irqhandler(per_cpu(ipi_irq, cpu), NULL);
292 per_cpu(ipi_irq, cpu) = -1;
293 }
294 if (per_cpu(resched_irq, cpu) >= 0) {
295 unbind_from_irqhandler(per_cpu(resched_irq, cpu),
296 NULL);
297 per_cpu(resched_irq, cpu) = -1;
298 }
299 if (per_cpu(timer_irq, cpu) >= 0) {
300 unbind_from_irqhandler(per_cpu(timer_irq, cpu), NULL);
301 per_cpu(timer_irq, cpu) = -1;
302 }
303 }
304 return NOTIFY_OK;
305}
306
307static struct notifier_block unbind_evtchn_notifier = {
308 .notifier_call = unbind_evtchn_callback,
309 .priority = 0
310};
311#endif
312
313void xen_smp_intr_init_early(unsigned int cpu)
314{
315#ifdef CONFIG_SMP
316 unsigned int i;
317
318 for (i = 0; i < saved_irq_cnt; i++)
319 __xen_register_percpu_irq(cpu, saved_percpu_irqs[i].irq,
320 saved_percpu_irqs[i].action, 0);
321#endif
322}
323
324void xen_smp_intr_init(void)
325{
326#ifdef CONFIG_SMP
327 unsigned int cpu = smp_processor_id();
328 struct callback_register event = {
329 .type = CALLBACKTYPE_event,
330 .address = { .ip = (unsigned long)&xen_event_callback },
331 };
332
333 if (cpu == 0) {
334 /* Initialization was already done for boot cpu. */
335#ifdef CONFIG_HOTPLUG_CPU
336 /* Register the notifier only once. */
337 register_cpu_notifier(&unbind_evtchn_notifier);
338#endif
339 return;
340 }
341
342 /* This should be piggyback when setup vcpu guest context */
343 BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
344#endif /* CONFIG_SMP */
345}
346
347void __init
348xen_irq_init(void)
349{
350 struct callback_register event = {
351 .type = CALLBACKTYPE_event,
352 .address = { .ip = (unsigned long)&xen_event_callback },
353 };
354
355 xen_init_IRQ();
356 BUG_ON(HYPERVISOR_callback_op(CALLBACKOP_register, &event));
357 late_time_init = xen_bind_early_percpu_irq;
358}
359
360void
361xen_platform_send_ipi(int cpu, int vector, int delivery_mode, int redirect)
362{
363#ifdef CONFIG_SMP
364 /* TODO: we need to call vcpu_up here */
365 if (unlikely(vector == ap_wakeup_vector)) {
366 /* XXX
367 * This should be in __cpu_up(cpu) in ia64 smpboot.c
368 * like x86. But don't want to modify it,
369 * keep it untouched.
370 */
371 xen_smp_intr_init_early(cpu);
372
373 xen_send_ipi(cpu, vector);
374 /* vcpu_prepare_and_up(cpu); */
375 return;
376 }
377#endif
378
379 switch (vector) {
380 case IA64_IPI_VECTOR:
381 xen_send_IPI_one(cpu, XEN_IPI_VECTOR);
382 break;
383 case IA64_IPI_RESCHEDULE:
384 xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR);
385 break;
386 case IA64_CMCP_VECTOR:
387 xen_send_IPI_one(cpu, XEN_CMCP_VECTOR);
388 break;
389 case IA64_CPEP_VECTOR:
390 xen_send_IPI_one(cpu, XEN_CPEP_VECTOR);
391 break;
392 case IA64_TIMER_VECTOR: {
393 /* this is used only once by check_sal_cache_flush()
394 at boot time */
395 static int used = 0;
396 if (!used) {
397 xen_send_ipi(cpu, IA64_TIMER_VECTOR);
398 used = 1;
399 break;
400 }
401 /* fallthrough */
402 }
403 default:
404 printk(KERN_WARNING "Unsupported IPI type 0x%x\n",
405 vector);
406 notify_remote_via_irq(0); /* defaults to 0 irq */
407 break;
408 }
409}
410
411static void __init
412xen_register_ipi(void)
413{
414#ifdef CONFIG_SMP
415 register_percpu_irq(IA64_IPI_VECTOR, &xen_ipi_irqaction);
416 register_percpu_irq(IA64_IPI_RESCHEDULE, &xen_resched_irqaction);
417 register_percpu_irq(IA64_IPI_LOCAL_TLB_FLUSH, &xen_tlb_irqaction);
418#endif
419}
420
421static void
422xen_resend_irq(unsigned int vector)
423{
424 (void)resend_irq_on_evtchn(vector);
425}
426
427const struct pv_irq_ops xen_irq_ops __initdata = {
428 .register_ipi = xen_register_ipi,
429
430 .assign_irq_vector = xen_assign_irq_vector,
431 .free_irq_vector = xen_free_irq_vector,
432 .register_percpu_irq = xen_register_percpu_irq,
433
434 .resend_irq = xen_resend_irq,
435};
diff --git a/arch/ia64/xen/irq_xen.h b/arch/ia64/xen/irq_xen.h
new file mode 100644
index 000000000000..26110f330c87
--- /dev/null
+++ b/arch/ia64/xen/irq_xen.h
@@ -0,0 +1,34 @@
1/******************************************************************************
2 * arch/ia64/xen/irq_xen.h
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef IRQ_XEN_H
24#define IRQ_XEN_H
25
26extern void (*late_time_init)(void);
27extern char xen_event_callback;
28void __init xen_init_IRQ(void);
29
30extern const struct pv_irq_ops xen_irq_ops __initdata;
31extern void xen_smp_intr_init(void);
32extern void xen_send_ipi(int cpu, int vec);
33
34#endif /* IRQ_XEN_H */
diff --git a/arch/ia64/xen/machvec.c b/arch/ia64/xen/machvec.c
new file mode 100644
index 000000000000..4ad588a7c279
--- /dev/null
+++ b/arch/ia64/xen/machvec.c
@@ -0,0 +1,4 @@
1#define MACHVEC_PLATFORM_NAME xen
2#define MACHVEC_PLATFORM_HEADER <asm/machvec_xen.h>
3#include <asm/machvec_init.h>
4
diff --git a/arch/ia64/xen/suspend.c b/arch/ia64/xen/suspend.c
new file mode 100644
index 000000000000..fd66b048c6fa
--- /dev/null
+++ b/arch/ia64/xen/suspend.c
@@ -0,0 +1,64 @@
1/******************************************************************************
2 * arch/ia64/xen/suspend.c
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * suspend/resume
22 */
23
24#include <xen/xen-ops.h>
25#include <asm/xen/hypervisor.h>
26#include "time.h"
27
28void
29xen_mm_pin_all(void)
30{
31 /* nothing */
32}
33
34void
35xen_mm_unpin_all(void)
36{
37 /* nothing */
38}
39
40void xen_pre_device_suspend(void)
41{
42 /* nothing */
43}
44
45void
46xen_pre_suspend()
47{
48 /* nothing */
49}
50
51void
52xen_post_suspend(int suspend_cancelled)
53{
54 if (suspend_cancelled)
55 return;
56
57 xen_ia64_enable_opt_feature();
58 /* add more if necessary */
59}
60
61void xen_arch_resume(void)
62{
63 xen_timer_resume_on_aps();
64}
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
new file mode 100644
index 000000000000..d15a94c330fb
--- /dev/null
+++ b/arch/ia64/xen/time.c
@@ -0,0 +1,213 @@
1/******************************************************************************
2 * arch/ia64/xen/time.c
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include <linux/delay.h>
24#include <linux/kernel_stat.h>
25#include <linux/posix-timers.h>
26#include <linux/irq.h>
27#include <linux/clocksource.h>
28
29#include <asm/timex.h>
30
31#include <asm/xen/hypervisor.h>
32
33#include <xen/interface/vcpu.h>
34
35#include "../kernel/fsyscall_gtod_data.h"
36
37DEFINE_PER_CPU(struct vcpu_runstate_info, runstate);
38DEFINE_PER_CPU(unsigned long, processed_stolen_time);
39DEFINE_PER_CPU(unsigned long, processed_blocked_time);
40
41/* taken from i386/kernel/time-xen.c */
42static void xen_init_missing_ticks_accounting(int cpu)
43{
44 struct vcpu_register_runstate_memory_area area;
45 struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu);
46 int rc;
47
48 memset(runstate, 0, sizeof(*runstate));
49
50 area.addr.v = runstate;
51 rc = HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, cpu,
52 &area);
53 WARN_ON(rc && rc != -ENOSYS);
54
55 per_cpu(processed_blocked_time, cpu) = runstate->time[RUNSTATE_blocked];
56 per_cpu(processed_stolen_time, cpu) = runstate->time[RUNSTATE_runnable]
57 + runstate->time[RUNSTATE_offline];
58}
59
60/*
61 * Runstate accounting
62 */
63/* stolen from arch/x86/xen/time.c */
64static void get_runstate_snapshot(struct vcpu_runstate_info *res)
65{
66 u64 state_time;
67 struct vcpu_runstate_info *state;
68
69 BUG_ON(preemptible());
70
71 state = &__get_cpu_var(runstate);
72
73 /*
74 * The runstate info is always updated by the hypervisor on
75 * the current CPU, so there's no need to use anything
76 * stronger than a compiler barrier when fetching it.
77 */
78 do {
79 state_time = state->state_entry_time;
80 rmb();
81 *res = *state;
82 rmb();
83 } while (state->state_entry_time != state_time);
84}
85
86#define NS_PER_TICK (1000000000LL/HZ)
87
88static unsigned long
89consider_steal_time(unsigned long new_itm)
90{
91 unsigned long stolen, blocked;
92 unsigned long delta_itm = 0, stolentick = 0;
93 int cpu = smp_processor_id();
94 struct vcpu_runstate_info runstate;
95 struct task_struct *p = current;
96
97 get_runstate_snapshot(&runstate);
98
99 /*
100 * Check for vcpu migration effect
101 * In this case, itc value is reversed.
102 * This causes huge stolen value.
103 * This function just checks and reject this effect.
104 */
105 if (!time_after_eq(runstate.time[RUNSTATE_blocked],
106 per_cpu(processed_blocked_time, cpu)))
107 blocked = 0;
108
109 if (!time_after_eq(runstate.time[RUNSTATE_runnable] +
110 runstate.time[RUNSTATE_offline],
111 per_cpu(processed_stolen_time, cpu)))
112 stolen = 0;
113
114 if (!time_after(delta_itm + new_itm, ia64_get_itc()))
115 stolentick = ia64_get_itc() - new_itm;
116
117 do_div(stolentick, NS_PER_TICK);
118 stolentick++;
119
120 do_div(stolen, NS_PER_TICK);
121
122 if (stolen > stolentick)
123 stolen = stolentick;
124
125 stolentick -= stolen;
126 do_div(blocked, NS_PER_TICK);
127
128 if (blocked > stolentick)
129 blocked = stolentick;
130
131 if (stolen > 0 || blocked > 0) {
132 account_steal_time(NULL, jiffies_to_cputime(stolen));
133 account_steal_time(idle_task(cpu), jiffies_to_cputime(blocked));
134 run_local_timers();
135
136 if (rcu_pending(cpu))
137 rcu_check_callbacks(cpu, user_mode(get_irq_regs()));
138
139 scheduler_tick();
140 run_posix_cpu_timers(p);
141 delta_itm += local_cpu_data->itm_delta * (stolen + blocked);
142
143 if (cpu == time_keeper_id) {
144 write_seqlock(&xtime_lock);
145 do_timer(stolen + blocked);
146 local_cpu_data->itm_next = delta_itm + new_itm;
147 write_sequnlock(&xtime_lock);
148 } else {
149 local_cpu_data->itm_next = delta_itm + new_itm;
150 }
151 per_cpu(processed_stolen_time, cpu) += NS_PER_TICK * stolen;
152 per_cpu(processed_blocked_time, cpu) += NS_PER_TICK * blocked;
153 }
154 return delta_itm;
155}
156
157static int xen_do_steal_accounting(unsigned long *new_itm)
158{
159 unsigned long delta_itm;
160 delta_itm = consider_steal_time(*new_itm);
161 *new_itm += delta_itm;
162 if (time_after(*new_itm, ia64_get_itc()) && delta_itm)
163 return 1;
164
165 return 0;
166}
167
168static void xen_itc_jitter_data_reset(void)
169{
170 u64 lcycle, ret;
171
172 do {
173 lcycle = itc_jitter_data.itc_lastcycle;
174 ret = cmpxchg(&itc_jitter_data.itc_lastcycle, lcycle, 0);
175 } while (unlikely(ret != lcycle));
176}
177
178struct pv_time_ops xen_time_ops __initdata = {
179 .init_missing_ticks_accounting = xen_init_missing_ticks_accounting,
180 .do_steal_accounting = xen_do_steal_accounting,
181 .clocksource_resume = xen_itc_jitter_data_reset,
182};
183
184/* Called after suspend, to resume time. */
185static void xen_local_tick_resume(void)
186{
187 /* Just trigger a tick. */
188 ia64_cpu_local_tick();
189 touch_softlockup_watchdog();
190}
191
192void
193xen_timer_resume(void)
194{
195 unsigned int cpu;
196
197 xen_local_tick_resume();
198
199 for_each_online_cpu(cpu)
200 xen_init_missing_ticks_accounting(cpu);
201}
202
203static void ia64_cpu_local_tick_fn(void *unused)
204{
205 xen_local_tick_resume();
206 xen_init_missing_ticks_accounting(smp_processor_id());
207}
208
209void
210xen_timer_resume_on_aps(void)
211{
212 smp_call_function(&ia64_cpu_local_tick_fn, NULL, 1);
213}
diff --git a/arch/ia64/xen/time.h b/arch/ia64/xen/time.h
new file mode 100644
index 000000000000..f98d7e1a42f0
--- /dev/null
+++ b/arch/ia64/xen/time.h
@@ -0,0 +1,24 @@
1/******************************************************************************
2 * arch/ia64/xen/time.h
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23extern struct pv_time_ops xen_time_ops __initdata;
24void xen_timer_resume_on_aps(void);
diff --git a/arch/ia64/xen/xcom_hcall.c b/arch/ia64/xen/xcom_hcall.c
new file mode 100644
index 000000000000..ccaf7431f7c8
--- /dev/null
+++ b/arch/ia64/xen/xcom_hcall.c
@@ -0,0 +1,441 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 *
16 * Tristan Gingold <tristan.gingold@bull.net>
17 *
18 * Copyright (c) 2007
19 * Isaku Yamahata <yamahata at valinux co jp>
20 * VA Linux Systems Japan K.K.
21 * consolidate mini and inline version.
22 */
23
24#include <linux/module.h>
25#include <xen/interface/xen.h>
26#include <xen/interface/memory.h>
27#include <xen/interface/grant_table.h>
28#include <xen/interface/callback.h>
29#include <xen/interface/vcpu.h>
30#include <asm/xen/hypervisor.h>
31#include <asm/xen/xencomm.h>
32
33/* Xencomm notes:
34 * This file defines hypercalls to be used by xencomm. The hypercalls simply
35 * create inlines or mini descriptors for pointers and then call the raw arch
36 * hypercall xencomm_arch_hypercall_XXX
37 *
38 * If the arch wants to directly use these hypercalls, simply define macros
39 * in asm/xen/hypercall.h, eg:
40 * #define HYPERVISOR_sched_op xencomm_hypercall_sched_op
41 *
42 * The arch may also define HYPERVISOR_xxx as a function and do more operations
43 * before/after doing the hypercall.
44 *
45 * Note: because only inline or mini descriptors are created these functions
46 * must only be called with in kernel memory parameters.
47 */
48
49int
50xencomm_hypercall_console_io(int cmd, int count, char *str)
51{
52 /* xen early printk uses console io hypercall before
53 * xencomm initialization. In that case, we just ignore it.
54 */
55 if (!xencomm_is_initialized())
56 return 0;
57
58 return xencomm_arch_hypercall_console_io
59 (cmd, count, xencomm_map_no_alloc(str, count));
60}
61EXPORT_SYMBOL_GPL(xencomm_hypercall_console_io);
62
63int
64xencomm_hypercall_event_channel_op(int cmd, void *op)
65{
66 struct xencomm_handle *desc;
67 desc = xencomm_map_no_alloc(op, sizeof(struct evtchn_op));
68 if (desc == NULL)
69 return -EINVAL;
70
71 return xencomm_arch_hypercall_event_channel_op(cmd, desc);
72}
73EXPORT_SYMBOL_GPL(xencomm_hypercall_event_channel_op);
74
75int
76xencomm_hypercall_xen_version(int cmd, void *arg)
77{
78 struct xencomm_handle *desc;
79 unsigned int argsize;
80
81 switch (cmd) {
82 case XENVER_version:
83 /* do not actually pass an argument */
84 return xencomm_arch_hypercall_xen_version(cmd, 0);
85 case XENVER_extraversion:
86 argsize = sizeof(struct xen_extraversion);
87 break;
88 case XENVER_compile_info:
89 argsize = sizeof(struct xen_compile_info);
90 break;
91 case XENVER_capabilities:
92 argsize = sizeof(struct xen_capabilities_info);
93 break;
94 case XENVER_changeset:
95 argsize = sizeof(struct xen_changeset_info);
96 break;
97 case XENVER_platform_parameters:
98 argsize = sizeof(struct xen_platform_parameters);
99 break;
100 case XENVER_get_features:
101 argsize = (arg == NULL) ? 0 : sizeof(struct xen_feature_info);
102 break;
103
104 default:
105 printk(KERN_DEBUG
106 "%s: unknown version op %d\n", __func__, cmd);
107 return -ENOSYS;
108 }
109
110 desc = xencomm_map_no_alloc(arg, argsize);
111 if (desc == NULL)
112 return -EINVAL;
113
114 return xencomm_arch_hypercall_xen_version(cmd, desc);
115}
116EXPORT_SYMBOL_GPL(xencomm_hypercall_xen_version);
117
118int
119xencomm_hypercall_physdev_op(int cmd, void *op)
120{
121 unsigned int argsize;
122
123 switch (cmd) {
124 case PHYSDEVOP_apic_read:
125 case PHYSDEVOP_apic_write:
126 argsize = sizeof(struct physdev_apic);
127 break;
128 case PHYSDEVOP_alloc_irq_vector:
129 case PHYSDEVOP_free_irq_vector:
130 argsize = sizeof(struct physdev_irq);
131 break;
132 case PHYSDEVOP_irq_status_query:
133 argsize = sizeof(struct physdev_irq_status_query);
134 break;
135
136 default:
137 printk(KERN_DEBUG
138 "%s: unknown physdev op %d\n", __func__, cmd);
139 return -ENOSYS;
140 }
141
142 return xencomm_arch_hypercall_physdev_op
143 (cmd, xencomm_map_no_alloc(op, argsize));
144}
145
146static int
147xencommize_grant_table_op(struct xencomm_mini **xc_area,
148 unsigned int cmd, void *op, unsigned int count,
149 struct xencomm_handle **desc)
150{
151 struct xencomm_handle *desc1;
152 unsigned int argsize;
153
154 switch (cmd) {
155 case GNTTABOP_map_grant_ref:
156 argsize = sizeof(struct gnttab_map_grant_ref);
157 break;
158 case GNTTABOP_unmap_grant_ref:
159 argsize = sizeof(struct gnttab_unmap_grant_ref);
160 break;
161 case GNTTABOP_setup_table:
162 {
163 struct gnttab_setup_table *setup = op;
164
165 argsize = sizeof(*setup);
166
167 if (count != 1)
168 return -EINVAL;
169 desc1 = __xencomm_map_no_alloc
170 (xen_guest_handle(setup->frame_list),
171 setup->nr_frames *
172 sizeof(*xen_guest_handle(setup->frame_list)),
173 *xc_area);
174 if (desc1 == NULL)
175 return -EINVAL;
176 (*xc_area)++;
177 set_xen_guest_handle(setup->frame_list, (void *)desc1);
178 break;
179 }
180 case GNTTABOP_dump_table:
181 argsize = sizeof(struct gnttab_dump_table);
182 break;
183 case GNTTABOP_transfer:
184 argsize = sizeof(struct gnttab_transfer);
185 break;
186 case GNTTABOP_copy:
187 argsize = sizeof(struct gnttab_copy);
188 break;
189 case GNTTABOP_query_size:
190 argsize = sizeof(struct gnttab_query_size);
191 break;
192 default:
193 printk(KERN_DEBUG "%s: unknown hypercall grant table op %d\n",
194 __func__, cmd);
195 BUG();
196 }
197
198 *desc = __xencomm_map_no_alloc(op, count * argsize, *xc_area);
199 if (*desc == NULL)
200 return -EINVAL;
201 (*xc_area)++;
202
203 return 0;
204}
205
206int
207xencomm_hypercall_grant_table_op(unsigned int cmd, void *op,
208 unsigned int count)
209{
210 int rc;
211 struct xencomm_handle *desc;
212 XENCOMM_MINI_ALIGNED(xc_area, 2);
213
214 rc = xencommize_grant_table_op(&xc_area, cmd, op, count, &desc);
215 if (rc)
216 return rc;
217
218 return xencomm_arch_hypercall_grant_table_op(cmd, desc, count);
219}
220EXPORT_SYMBOL_GPL(xencomm_hypercall_grant_table_op);
221
222int
223xencomm_hypercall_sched_op(int cmd, void *arg)
224{
225 struct xencomm_handle *desc;
226 unsigned int argsize;
227
228 switch (cmd) {
229 case SCHEDOP_yield:
230 case SCHEDOP_block:
231 argsize = 0;
232 break;
233 case SCHEDOP_shutdown:
234 argsize = sizeof(struct sched_shutdown);
235 break;
236 case SCHEDOP_poll:
237 {
238 struct sched_poll *poll = arg;
239 struct xencomm_handle *ports;
240
241 argsize = sizeof(struct sched_poll);
242 ports = xencomm_map_no_alloc(xen_guest_handle(poll->ports),
243 sizeof(*xen_guest_handle(poll->ports)));
244
245 set_xen_guest_handle(poll->ports, (void *)ports);
246 break;
247 }
248 default:
249 printk(KERN_DEBUG "%s: unknown sched op %d\n", __func__, cmd);
250 return -ENOSYS;
251 }
252
253 desc = xencomm_map_no_alloc(arg, argsize);
254 if (desc == NULL)
255 return -EINVAL;
256
257 return xencomm_arch_hypercall_sched_op(cmd, desc);
258}
259EXPORT_SYMBOL_GPL(xencomm_hypercall_sched_op);
260
261int
262xencomm_hypercall_multicall(void *call_list, int nr_calls)
263{
264 int rc;
265 int i;
266 struct multicall_entry *mce;
267 struct xencomm_handle *desc;
268 XENCOMM_MINI_ALIGNED(xc_area, nr_calls * 2);
269
270 for (i = 0; i < nr_calls; i++) {
271 mce = (struct multicall_entry *)call_list + i;
272
273 switch (mce->op) {
274 case __HYPERVISOR_update_va_mapping:
275 case __HYPERVISOR_mmu_update:
276 /* No-op on ia64. */
277 break;
278 case __HYPERVISOR_grant_table_op:
279 rc = xencommize_grant_table_op
280 (&xc_area,
281 mce->args[0], (void *)mce->args[1],
282 mce->args[2], &desc);
283 if (rc)
284 return rc;
285 mce->args[1] = (unsigned long)desc;
286 break;
287 case __HYPERVISOR_memory_op:
288 default:
289 printk(KERN_DEBUG
290 "%s: unhandled multicall op entry op %lu\n",
291 __func__, mce->op);
292 return -ENOSYS;
293 }
294 }
295
296 desc = xencomm_map_no_alloc(call_list,
297 nr_calls * sizeof(struct multicall_entry));
298 if (desc == NULL)
299 return -EINVAL;
300
301 return xencomm_arch_hypercall_multicall(desc, nr_calls);
302}
303EXPORT_SYMBOL_GPL(xencomm_hypercall_multicall);
304
305int
306xencomm_hypercall_callback_op(int cmd, void *arg)
307{
308 unsigned int argsize;
309 switch (cmd) {
310 case CALLBACKOP_register:
311 argsize = sizeof(struct callback_register);
312 break;
313 case CALLBACKOP_unregister:
314 argsize = sizeof(struct callback_unregister);
315 break;
316 default:
317 printk(KERN_DEBUG
318 "%s: unknown callback op %d\n", __func__, cmd);
319 return -ENOSYS;
320 }
321
322 return xencomm_arch_hypercall_callback_op
323 (cmd, xencomm_map_no_alloc(arg, argsize));
324}
325
326static int
327xencommize_memory_reservation(struct xencomm_mini *xc_area,
328 struct xen_memory_reservation *mop)
329{
330 struct xencomm_handle *desc;
331
332 desc = __xencomm_map_no_alloc(xen_guest_handle(mop->extent_start),
333 mop->nr_extents *
334 sizeof(*xen_guest_handle(mop->extent_start)),
335 xc_area);
336 if (desc == NULL)
337 return -EINVAL;
338
339 set_xen_guest_handle(mop->extent_start, (void *)desc);
340 return 0;
341}
342
343int
344xencomm_hypercall_memory_op(unsigned int cmd, void *arg)
345{
346 GUEST_HANDLE(xen_pfn_t) extent_start_va[2] = { {NULL}, {NULL} };
347 struct xen_memory_reservation *xmr = NULL;
348 int rc;
349 struct xencomm_handle *desc;
350 unsigned int argsize;
351 XENCOMM_MINI_ALIGNED(xc_area, 2);
352
353 switch (cmd) {
354 case XENMEM_increase_reservation:
355 case XENMEM_decrease_reservation:
356 case XENMEM_populate_physmap:
357 xmr = (struct xen_memory_reservation *)arg;
358 set_xen_guest_handle(extent_start_va[0],
359 xen_guest_handle(xmr->extent_start));
360
361 argsize = sizeof(*xmr);
362 rc = xencommize_memory_reservation(xc_area, xmr);
363 if (rc)
364 return rc;
365 xc_area++;
366 break;
367
368 case XENMEM_maximum_ram_page:
369 argsize = 0;
370 break;
371
372 case XENMEM_add_to_physmap:
373 argsize = sizeof(struct xen_add_to_physmap);
374 break;
375
376 default:
377 printk(KERN_DEBUG "%s: unknown memory op %d\n", __func__, cmd);
378 return -ENOSYS;
379 }
380
381 desc = xencomm_map_no_alloc(arg, argsize);
382 if (desc == NULL)
383 return -EINVAL;
384
385 rc = xencomm_arch_hypercall_memory_op(cmd, desc);
386
387 switch (cmd) {
388 case XENMEM_increase_reservation:
389 case XENMEM_decrease_reservation:
390 case XENMEM_populate_physmap:
391 set_xen_guest_handle(xmr->extent_start,
392 xen_guest_handle(extent_start_va[0]));
393 break;
394 }
395
396 return rc;
397}
398EXPORT_SYMBOL_GPL(xencomm_hypercall_memory_op);
399
400int
401xencomm_hypercall_suspend(unsigned long srec)
402{
403 struct sched_shutdown arg;
404
405 arg.reason = SHUTDOWN_suspend;
406
407 return xencomm_arch_hypercall_sched_op(
408 SCHEDOP_shutdown, xencomm_map_no_alloc(&arg, sizeof(arg)));
409}
410
411long
412xencomm_hypercall_vcpu_op(int cmd, int cpu, void *arg)
413{
414 unsigned int argsize;
415 switch (cmd) {
416 case VCPUOP_register_runstate_memory_area: {
417 struct vcpu_register_runstate_memory_area *area =
418 (struct vcpu_register_runstate_memory_area *)arg;
419 argsize = sizeof(*arg);
420 set_xen_guest_handle(area->addr.h,
421 (void *)xencomm_map_no_alloc(area->addr.v,
422 sizeof(area->addr.v)));
423 break;
424 }
425
426 default:
427 printk(KERN_DEBUG "%s: unknown vcpu op %d\n", __func__, cmd);
428 return -ENOSYS;
429 }
430
431 return xencomm_arch_hypercall_vcpu_op(cmd, cpu,
432 xencomm_map_no_alloc(arg, argsize));
433}
434
435long
436xencomm_hypercall_opt_feature(void *arg)
437{
438 return xencomm_arch_hypercall_opt_feature(
439 xencomm_map_no_alloc(arg,
440 sizeof(struct xen_ia64_opt_feature)));
441}
diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c
new file mode 100644
index 000000000000..04cd12350455
--- /dev/null
+++ b/arch/ia64/xen/xen_pv_ops.c
@@ -0,0 +1,364 @@
1/******************************************************************************
2 * arch/ia64/xen/xen_pv_ops.c
3 *
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include <linux/console.h>
24#include <linux/irq.h>
25#include <linux/kernel.h>
26#include <linux/pm.h>
27
28#include <asm/xen/hypervisor.h>
29#include <asm/xen/xencomm.h>
30#include <asm/xen/privop.h>
31
32#include "irq_xen.h"
33#include "time.h"
34
35/***************************************************************************
36 * general info
37 */
38static struct pv_info xen_info __initdata = {
39 .kernel_rpl = 2, /* or 1: determin at runtime */
40 .paravirt_enabled = 1,
41 .name = "Xen/ia64",
42};
43
44#define IA64_RSC_PL_SHIFT 2
45#define IA64_RSC_PL_BIT_SIZE 2
46#define IA64_RSC_PL_MASK \
47 (((1UL << IA64_RSC_PL_BIT_SIZE) - 1) << IA64_RSC_PL_SHIFT)
48
49static void __init
50xen_info_init(void)
51{
52 /* Xenified Linux/ia64 may run on pl = 1 or 2.
53 * determin at run time. */
54 unsigned long rsc = ia64_getreg(_IA64_REG_AR_RSC);
55 unsigned int rpl = (rsc & IA64_RSC_PL_MASK) >> IA64_RSC_PL_SHIFT;
56 xen_info.kernel_rpl = rpl;
57}
58
59/***************************************************************************
60 * pv_init_ops
61 * initialization hooks.
62 */
63
64static void
65xen_panic_hypercall(struct unw_frame_info *info, void *arg)
66{
67 current->thread.ksp = (__u64)info->sw - 16;
68 HYPERVISOR_shutdown(SHUTDOWN_crash);
69 /* we're never actually going to get here... */
70}
71
72static int
73xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
74{
75 unw_init_running(xen_panic_hypercall, NULL);
76 /* we're never actually going to get here... */
77 return NOTIFY_DONE;
78}
79
80static struct notifier_block xen_panic_block = {
81 xen_panic_event, NULL, 0 /* try to go last */
82};
83
84static void xen_pm_power_off(void)
85{
86 local_irq_disable();
87 HYPERVISOR_shutdown(SHUTDOWN_poweroff);
88}
89
90static void __init
91xen_banner(void)
92{
93 printk(KERN_INFO
94 "Running on Xen! pl = %d start_info_pfn=0x%lx nr_pages=%ld "
95 "flags=0x%x\n",
96 xen_info.kernel_rpl,
97 HYPERVISOR_shared_info->arch.start_info_pfn,
98 xen_start_info->nr_pages, xen_start_info->flags);
99}
100
101static int __init
102xen_reserve_memory(struct rsvd_region *region)
103{
104 region->start = (unsigned long)__va(
105 (HYPERVISOR_shared_info->arch.start_info_pfn << PAGE_SHIFT));
106 region->end = region->start + PAGE_SIZE;
107 return 1;
108}
109
110static void __init
111xen_arch_setup_early(void)
112{
113 struct shared_info *s;
114 BUG_ON(!xen_pv_domain());
115
116 s = HYPERVISOR_shared_info;
117 xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
118
119 /* Must be done before any hypercall. */
120 xencomm_initialize();
121
122 xen_setup_features();
123 /* Register a call for panic conditions. */
124 atomic_notifier_chain_register(&panic_notifier_list,
125 &xen_panic_block);
126 pm_power_off = xen_pm_power_off;
127
128 xen_ia64_enable_opt_feature();
129}
130
131static void __init
132xen_arch_setup_console(char **cmdline_p)
133{
134 add_preferred_console("xenboot", 0, NULL);
135 add_preferred_console("tty", 0, NULL);
136 /* use hvc_xen */
137 add_preferred_console("hvc", 0, NULL);
138
139#if !defined(CONFIG_VT) || !defined(CONFIG_DUMMY_CONSOLE)
140 conswitchp = NULL;
141#endif
142}
143
144static int __init
145xen_arch_setup_nomca(void)
146{
147 return 1;
148}
149
150static void __init
151xen_post_smp_prepare_boot_cpu(void)
152{
153 xen_setup_vcpu_info_placement();
154}
155
156static const struct pv_init_ops xen_init_ops __initdata = {
157 .banner = xen_banner,
158
159 .reserve_memory = xen_reserve_memory,
160
161 .arch_setup_early = xen_arch_setup_early,
162 .arch_setup_console = xen_arch_setup_console,
163 .arch_setup_nomca = xen_arch_setup_nomca,
164
165 .post_smp_prepare_boot_cpu = xen_post_smp_prepare_boot_cpu,
166};
167
168/***************************************************************************
169 * pv_cpu_ops
170 * intrinsics hooks.
171 */
172
173static void xen_setreg(int regnum, unsigned long val)
174{
175 switch (regnum) {
176 case _IA64_REG_AR_KR0 ... _IA64_REG_AR_KR7:
177 xen_set_kr(regnum - _IA64_REG_AR_KR0, val);
178 break;
179#ifdef CONFIG_IA32_SUPPORT
180 case _IA64_REG_AR_EFLAG:
181 xen_set_eflag(val);
182 break;
183#endif
184 case _IA64_REG_CR_TPR:
185 xen_set_tpr(val);
186 break;
187 case _IA64_REG_CR_ITM:
188 xen_set_itm(val);
189 break;
190 case _IA64_REG_CR_EOI:
191 xen_eoi(val);
192 break;
193 default:
194 ia64_native_setreg_func(regnum, val);
195 break;
196 }
197}
198
199static unsigned long xen_getreg(int regnum)
200{
201 unsigned long res;
202
203 switch (regnum) {
204 case _IA64_REG_PSR:
205 res = xen_get_psr();
206 break;
207#ifdef CONFIG_IA32_SUPPORT
208 case _IA64_REG_AR_EFLAG:
209 res = xen_get_eflag();
210 break;
211#endif
212 case _IA64_REG_CR_IVR:
213 res = xen_get_ivr();
214 break;
215 case _IA64_REG_CR_TPR:
216 res = xen_get_tpr();
217 break;
218 default:
219 res = ia64_native_getreg_func(regnum);
220 break;
221 }
222 return res;
223}
224
225/* turning on interrupts is a bit more complicated.. write to the
226 * memory-mapped virtual psr.i bit first (to avoid race condition),
227 * then if any interrupts were pending, we have to execute a hyperprivop
228 * to ensure the pending interrupt gets delivered; else we're done! */
229static void
230xen_ssm_i(void)
231{
232 int old = xen_get_virtual_psr_i();
233 xen_set_virtual_psr_i(1);
234 barrier();
235 if (!old && xen_get_virtual_pend())
236 xen_hyper_ssm_i();
237}
238
239/* turning off interrupts can be paravirtualized simply by writing
240 * to a memory-mapped virtual psr.i bit (implemented as a 16-bit bool) */
241static void
242xen_rsm_i(void)
243{
244 xen_set_virtual_psr_i(0);
245 barrier();
246}
247
248static unsigned long
249xen_get_psr_i(void)
250{
251 return xen_get_virtual_psr_i() ? IA64_PSR_I : 0;
252}
253
254static void
255xen_intrin_local_irq_restore(unsigned long mask)
256{
257 if (mask & IA64_PSR_I)
258 xen_ssm_i();
259 else
260 xen_rsm_i();
261}
262
263static const struct pv_cpu_ops xen_cpu_ops __initdata = {
264 .fc = xen_fc,
265 .thash = xen_thash,
266 .get_cpuid = xen_get_cpuid,
267 .get_pmd = xen_get_pmd,
268 .getreg = xen_getreg,
269 .setreg = xen_setreg,
270 .ptcga = xen_ptcga,
271 .get_rr = xen_get_rr,
272 .set_rr = xen_set_rr,
273 .set_rr0_to_rr4 = xen_set_rr0_to_rr4,
274 .ssm_i = xen_ssm_i,
275 .rsm_i = xen_rsm_i,
276 .get_psr_i = xen_get_psr_i,
277 .intrin_local_irq_restore
278 = xen_intrin_local_irq_restore,
279};
280
281/******************************************************************************
282 * replacement of hand written assembly codes.
283 */
284
285extern char xen_switch_to;
286extern char xen_leave_syscall;
287extern char xen_work_processed_syscall;
288extern char xen_leave_kernel;
289
290const struct pv_cpu_asm_switch xen_cpu_asm_switch = {
291 .switch_to = (unsigned long)&xen_switch_to,
292 .leave_syscall = (unsigned long)&xen_leave_syscall,
293 .work_processed_syscall = (unsigned long)&xen_work_processed_syscall,
294 .leave_kernel = (unsigned long)&xen_leave_kernel,
295};
296
297/***************************************************************************
298 * pv_iosapic_ops
299 * iosapic read/write hooks.
300 */
301static void
302xen_pcat_compat_init(void)
303{
304 /* nothing */
305}
306
307static struct irq_chip*
308xen_iosapic_get_irq_chip(unsigned long trigger)
309{
310 return NULL;
311}
312
313static unsigned int
314xen_iosapic_read(char __iomem *iosapic, unsigned int reg)
315{
316 struct physdev_apic apic_op;
317 int ret;
318
319 apic_op.apic_physbase = (unsigned long)iosapic -
320 __IA64_UNCACHED_OFFSET;
321 apic_op.reg = reg;
322 ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
323 if (ret)
324 return ret;
325 return apic_op.value;
326}
327
328static void
329xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
330{
331 struct physdev_apic apic_op;
332
333 apic_op.apic_physbase = (unsigned long)iosapic -
334 __IA64_UNCACHED_OFFSET;
335 apic_op.reg = reg;
336 apic_op.value = val;
337 HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
338}
339
340static const struct pv_iosapic_ops xen_iosapic_ops __initdata = {
341 .pcat_compat_init = xen_pcat_compat_init,
342 .__get_irq_chip = xen_iosapic_get_irq_chip,
343
344 .__read = xen_iosapic_read,
345 .__write = xen_iosapic_write,
346};
347
348/***************************************************************************
349 * pv_ops initialization
350 */
351
352void __init
353xen_setup_pv_ops(void)
354{
355 xen_info_init();
356 pv_info = xen_info;
357 pv_init_ops = xen_init_ops;
358 pv_cpu_ops = xen_cpu_ops;
359 pv_iosapic_ops = xen_iosapic_ops;
360 pv_irq_ops = xen_irq_ops;
361 pv_time_ops = xen_time_ops;
362
363 paravirt_cpu_asm_init(&xen_cpu_asm_switch);
364}
diff --git a/arch/ia64/xen/xencomm.c b/arch/ia64/xen/xencomm.c
new file mode 100644
index 000000000000..1f5d7ac82e97
--- /dev/null
+++ b/arch/ia64/xen/xencomm.c
@@ -0,0 +1,105 @@
1/*
2 * Copyright (C) 2006 Hollis Blanchard <hollisb@us.ibm.com>, IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/mm.h>
20
21static unsigned long kernel_virtual_offset;
22static int is_xencomm_initialized;
23
24/* for xen early printk. It uses console io hypercall which uses xencomm.
25 * However early printk may use it before xencomm initialization.
26 */
27int
28xencomm_is_initialized(void)
29{
30 return is_xencomm_initialized;
31}
32
33void
34xencomm_initialize(void)
35{
36 kernel_virtual_offset = KERNEL_START - ia64_tpa(KERNEL_START);
37 is_xencomm_initialized = 1;
38}
39
40/* Translate virtual address to physical address. */
41unsigned long
42xencomm_vtop(unsigned long vaddr)
43{
44 struct page *page;
45 struct vm_area_struct *vma;
46
47 if (vaddr == 0)
48 return 0UL;
49
50 if (REGION_NUMBER(vaddr) == 5) {
51 pgd_t *pgd;
52 pud_t *pud;
53 pmd_t *pmd;
54 pte_t *ptep;
55
56 /* On ia64, TASK_SIZE refers to current. It is not initialized
57 during boot.
58 Furthermore the kernel is relocatable and __pa() doesn't
59 work on addresses. */
60 if (vaddr >= KERNEL_START
61 && vaddr < (KERNEL_START + KERNEL_TR_PAGE_SIZE))
62 return vaddr - kernel_virtual_offset;
63
64 /* In kernel area -- virtually mapped. */
65 pgd = pgd_offset_k(vaddr);
66 if (pgd_none(*pgd) || pgd_bad(*pgd))
67 return ~0UL;
68
69 pud = pud_offset(pgd, vaddr);
70 if (pud_none(*pud) || pud_bad(*pud))
71 return ~0UL;
72
73 pmd = pmd_offset(pud, vaddr);
74 if (pmd_none(*pmd) || pmd_bad(*pmd))
75 return ~0UL;
76
77 ptep = pte_offset_kernel(pmd, vaddr);
78 if (!ptep)
79 return ~0UL;
80
81 return (pte_val(*ptep) & _PFN_MASK) | (vaddr & ~PAGE_MASK);
82 }
83
84 if (vaddr > TASK_SIZE) {
85 /* percpu variables */
86 if (REGION_NUMBER(vaddr) == 7 &&
87 REGION_OFFSET(vaddr) >= (1ULL << IA64_MAX_PHYS_BITS))
88 ia64_tpa(vaddr);
89
90 /* kernel address */
91 return __pa(vaddr);
92 }
93
94 /* XXX double-check (lack of) locking */
95 vma = find_extend_vma(current->mm, vaddr);
96 if (!vma)
97 return ~0UL;
98
99 /* We assume the page is modified. */
100 page = follow_page(vma, vaddr, FOLL_WRITE | FOLL_TOUCH);
101 if (!page)
102 return ~0UL;
103
104 return (page_to_pfn(page) << PAGE_SHIFT) | (vaddr & ~PAGE_MASK);
105}
diff --git a/arch/ia64/xen/xenivt.S b/arch/ia64/xen/xenivt.S
new file mode 100644
index 000000000000..3e71d50584d9
--- /dev/null
+++ b/arch/ia64/xen/xenivt.S
@@ -0,0 +1,52 @@
1/*
2 * arch/ia64/xen/ivt.S
3 *
4 * Copyright (C) 2005 Hewlett-Packard Co
5 * Dan Magenheimer <dan.magenheimer@hp.com>
6 *
7 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
8 * VA Linux Systems Japan K.K.
9 * pv_ops.
10 */
11
12#include <asm/asmmacro.h>
13#include <asm/kregs.h>
14#include <asm/pgtable.h>
15
16#include "../kernel/minstate.h"
17
18 .section .text,"ax"
19GLOBAL_ENTRY(xen_event_callback)
20 mov r31=pr // prepare to save predicates
21 ;;
22 SAVE_MIN_WITH_COVER // uses r31; defines r2 and r3
23 ;;
24 movl r3=XSI_PSR_IC
25 mov r14=1
26 ;;
27 st4 [r3]=r14
28 ;;
29 adds r3=8,r2 // set up second base pointer for SAVE_REST
30 srlz.i // ensure everybody knows psr.ic is back on
31 ;;
32 SAVE_REST
33 ;;
341:
35 alloc r14=ar.pfs,0,0,1,0 // must be first in an insn group
36 add out0=16,sp // pass pointer to pt_regs as first arg
37 ;;
38 br.call.sptk.many b0=xen_evtchn_do_upcall
39 ;;
40 movl r20=XSI_PSR_I_ADDR
41 ;;
42 ld8 r20=[r20]
43 ;;
44 adds r20=-1,r20 // vcpu_info->evtchn_upcall_pending
45 ;;
46 ld1 r20=[r20]
47 ;;
48 cmp.ne p6,p0=r20,r0 // if there are pending events,
49 (p6) br.spnt.few 1b // call evtchn_do_upcall again.
50 br.sptk.many xen_leave_kernel // we know ia64_leave_kernel is
51 // paravirtualized as xen_leave_kernel
52END(xen_event_callback)
diff --git a/arch/ia64/xen/xensetup.S b/arch/ia64/xen/xensetup.S
new file mode 100644
index 000000000000..28fed1fcc079
--- /dev/null
+++ b/arch/ia64/xen/xensetup.S
@@ -0,0 +1,83 @@
1/*
2 * Support routines for Xen
3 *
4 * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer@hp.com>
5 */
6
7#include <asm/processor.h>
8#include <asm/asmmacro.h>
9#include <asm/pgtable.h>
10#include <asm/system.h>
11#include <asm/paravirt.h>
12#include <asm/xen/privop.h>
13#include <linux/elfnote.h>
14#include <linux/init.h>
15#include <xen/interface/elfnote.h>
16
17 .section .data.read_mostly
18 .align 8
19 .global xen_domain_type
20xen_domain_type:
21 data4 XEN_NATIVE_ASM
22 .previous
23
24 __INIT
25ENTRY(startup_xen)
26 // Calculate load offset.
27 // The constant, LOAD_OFFSET, can't be used because the boot
28 // loader doesn't always load to the LMA specified by the vmlinux.lds.
29 mov r9=ip // must be the first instruction to make sure
30 // that r9 = the physical address of startup_xen.
31 // Usually r9 = startup_xen - LOAD_OFFSET
32 movl r8=startup_xen
33 ;;
34 sub r9=r9,r8 // Usually r9 = -LOAD_OFFSET.
35
36 mov r10=PARAVIRT_HYPERVISOR_TYPE_XEN
37 movl r11=_start
38 ;;
39 add r11=r11,r9
40 movl r8=hypervisor_type
41 ;;
42 add r8=r8,r9
43 mov b0=r11
44 ;;
45 st8 [r8]=r10
46 br.cond.sptk.many b0
47 ;;
48END(startup_xen)
49
50 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
51 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
52 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
53 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, data8.ua startup_xen - LOAD_OFFSET)
54
55#define isBP p3 // are we the Bootstrap Processor?
56
57 .text
58
59GLOBAL_ENTRY(xen_setup_hook)
60 mov r8=XEN_PV_DOMAIN_ASM
61(isBP) movl r9=xen_domain_type;;
62(isBP) st4 [r9]=r8
63 movl r10=xen_ivt;;
64
65 mov cr.iva=r10
66
67 /* Set xsi base. */
68#define FW_HYPERCALL_SET_SHARED_INFO_VA 0x600
69(isBP) mov r2=FW_HYPERCALL_SET_SHARED_INFO_VA
70(isBP) movl r28=XSI_BASE;;
71(isBP) break 0x1000;;
72
73 /* setup pv_ops */
74(isBP) mov r4=rp
75 ;;
76(isBP) br.call.sptk.many rp=xen_setup_pv_ops
77 ;;
78(isBP) mov rp=r4
79 ;;
80
81 br.ret.sptk.many rp
82 ;;
83END(xen_setup_hook)
diff --git a/arch/m32r/oprofile/init.c b/arch/m32r/oprofile/init.c
index b7773e45c43f..fa56860f4258 100644
--- a/arch/m32r/oprofile/init.c
+++ b/arch/m32r/oprofile/init.c
@@ -12,7 +12,7 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15int __init oprofile_arch_init(struct oprofile_operations * ops) 15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{ 16{
17 return -ENODEV; 17 return -ENODEV;
18} 18}
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index dd2fbd6645c1..3bf3354547f6 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -32,7 +32,7 @@ static int op_mips_setup(void)
32 return 0; 32 return 0;
33} 33}
34 34
35static int op_mips_create_files(struct super_block * sb, struct dentry * root) 35static int op_mips_create_files(struct super_block *sb, struct dentry *root)
36{ 36{
37 int i; 37 int i;
38 38
diff --git a/arch/mips/oprofile/op_impl.h b/arch/mips/oprofile/op_impl.h
index 2bfc17c30106..f04b54fb37d1 100644
--- a/arch/mips/oprofile/op_impl.h
+++ b/arch/mips/oprofile/op_impl.h
@@ -27,7 +27,7 @@ struct op_counter_config {
27/* Per-architecture configury and hooks. */ 27/* Per-architecture configury and hooks. */
28struct op_mips_model { 28struct op_mips_model {
29 void (*reg_setup) (struct op_counter_config *); 29 void (*reg_setup) (struct op_counter_config *);
30 void (*cpu_setup) (void * dummy); 30 void (*cpu_setup) (void *dummy);
31 int (*init)(void); 31 int (*init)(void);
32 void (*exit)(void); 32 void (*exit)(void);
33 void (*cpu_start)(void *args); 33 void (*cpu_start)(void *args);
diff --git a/arch/mips/oprofile/op_model_rm9000.c b/arch/mips/oprofile/op_model_rm9000.c
index a45d3202894f..3aa81384966d 100644
--- a/arch/mips/oprofile/op_model_rm9000.c
+++ b/arch/mips/oprofile/op_model_rm9000.c
@@ -80,7 +80,7 @@ static void rm9000_cpu_stop(void *args)
80 write_c0_perfcontrol(0); 80 write_c0_perfcontrol(0);
81} 81}
82 82
83static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id) 83static irqreturn_t rm9000_perfcount_handler(int irq, void *dev_id)
84{ 84{
85 unsigned int control = read_c0_perfcontrol(); 85 unsigned int control = read_c0_perfcontrol();
86 struct pt_regs *regs = get_irq_regs(); 86 struct pt_regs *regs = get_irq_regs();
diff --git a/arch/parisc/oprofile/init.c b/arch/parisc/oprofile/init.c
index 113f5139f551..026cba2af07a 100644
--- a/arch/parisc/oprofile/init.c
+++ b/arch/parisc/oprofile/init.c
@@ -12,7 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/oprofile.h> 13#include <linux/oprofile.h>
14 14
15int __init oprofile_arch_init(struct oprofile_operations * ops) 15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{ 16{
17 return -ENODEV; 17 return -ENODEV;
18} 18}
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9391199d9e77..5b1527883fcb 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -19,9 +19,6 @@ config WORD_SIZE
19 default 64 if PPC64 19 default 64 if PPC64
20 default 32 if !PPC64 20 default 32 if !PPC64
21 21
22config PPC_MERGE
23 def_bool y
24
25config ARCH_PHYS_ADDR_T_64BIT 22config ARCH_PHYS_ADDR_T_64BIT
26 def_bool PPC64 || PHYS_64BIT 23 def_bool PPC64 || PHYS_64BIT
27 24
@@ -326,13 +323,11 @@ config KEXEC
326 323
327config CRASH_DUMP 324config CRASH_DUMP
328 bool "Build a kdump crash kernel" 325 bool "Build a kdump crash kernel"
329 depends on PPC_MULTIPLATFORM && PPC64 326 depends on PPC_MULTIPLATFORM && PPC64 && RELOCATABLE
330 help 327 help
331 Build a kernel suitable for use as a kdump capture kernel. 328 Build a kernel suitable for use as a kdump capture kernel.
332 The kernel will be linked at a different address than normal, and 329 The same kernel binary can be used as production kernel and dump
333 so can only be used for Kdump. 330 capture kernel.
334
335 Don't change this unless you know what you are doing.
336 331
337config PHYP_DUMP 332config PHYP_DUMP
338 bool "Hypervisor-assisted dump (EXPERIMENTAL)" 333 bool "Hypervisor-assisted dump (EXPERIMENTAL)"
@@ -832,11 +827,9 @@ config PAGE_OFFSET
832 default "0xc000000000000000" 827 default "0xc000000000000000"
833config KERNEL_START 828config KERNEL_START
834 hex 829 hex
835 default "0xc000000002000000" if CRASH_DUMP
836 default "0xc000000000000000" 830 default "0xc000000000000000"
837config PHYSICAL_START 831config PHYSICAL_START
838 hex 832 hex
839 default "0x02000000" if CRASH_DUMP
840 default "0x00000000" 833 default "0x00000000"
841endif 834endif
842 835
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index aac1406ccba5..8fc6d72849ae 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -68,7 +68,8 @@ src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c
68 fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \ 68 fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \
69 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ 69 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
70 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ 70 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
71 virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c 71 virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
72 cuboot-acadia.c
72src-boot := $(src-wlib) $(src-plat) empty.c 73src-boot := $(src-wlib) $(src-plat) empty.c
73 74
74src-boot := $(addprefix $(obj)/, $(src-boot)) 75src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -211,6 +212,7 @@ image-$(CONFIG_DEFAULT_UIMAGE) += uImage
211# Board ports in arch/powerpc/platform/40x/Kconfig 212# Board ports in arch/powerpc/platform/40x/Kconfig
212image-$(CONFIG_EP405) += dtbImage.ep405 213image-$(CONFIG_EP405) += dtbImage.ep405
213image-$(CONFIG_WALNUT) += treeImage.walnut 214image-$(CONFIG_WALNUT) += treeImage.walnut
215image-$(CONFIG_ACADIA) += cuImage.acadia
214 216
215# Board ports in arch/powerpc/platform/44x/Kconfig 217# Board ports in arch/powerpc/platform/44x/Kconfig
216image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony 218image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
@@ -319,6 +321,9 @@ $(obj)/zImage.iseries: vmlinux
319$(obj)/uImage: vmlinux $(wrapperbits) 321$(obj)/uImage: vmlinux $(wrapperbits)
320 $(call if_changed,wrap,uboot) 322 $(call if_changed,wrap,uboot)
321 323
324$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
325 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
326
322$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) 327$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
323 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb) 328 $(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
324 329
diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c
index dcc9ab2ca823..3091d1d21aef 100644
--- a/arch/powerpc/boot/addnote.c
+++ b/arch/powerpc/boot/addnote.c
@@ -11,7 +11,7 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 * 13 *
14 * Usage: addnote zImage [note.elf] 14 * Usage: addnote [-r realbase] zImage [note.elf]
15 * 15 *
16 * If note.elf is supplied, it is the name of an ELF file that contains 16 * If note.elf is supplied, it is the name of an ELF file that contains
17 * an RPA note to use instead of the built-in one. Alternatively, the 17 * an RPA note to use instead of the built-in one. Alternatively, the
@@ -153,18 +153,31 @@ unsigned char *read_rpanote(const char *fname, int *nnp)
153int 153int
154main(int ac, char **av) 154main(int ac, char **av)
155{ 155{
156 int fd, n, i; 156 int fd, n, i, ai;
157 int ph, ps, np; 157 int ph, ps, np;
158 int nnote, nnote2, ns; 158 int nnote, nnote2, ns;
159 unsigned char *rpap; 159 unsigned char *rpap;
160 160 char *p, *endp;
161 if (ac != 2 && ac != 3) { 161
162 fprintf(stderr, "Usage: %s elf-file [rpanote.elf]\n", av[0]); 162 ai = 1;
163 if (ac >= ai + 2 && strcmp(av[ai], "-r") == 0) {
164 /* process -r realbase */
165 p = av[ai + 1];
166 descr[1] = strtol(p, &endp, 16);
167 if (endp == p || *endp != 0) {
168 fprintf(stderr, "Can't parse -r argument '%s' as hex\n",
169 p);
170 exit(1);
171 }
172 ai += 2;
173 }
174 if (ac != ai + 1 && ac != ai + 2) {
175 fprintf(stderr, "Usage: %s [-r realbase] elf-file [rpanote.elf]\n", av[0]);
163 exit(1); 176 exit(1);
164 } 177 }
165 fd = open(av[1], O_RDWR); 178 fd = open(av[ai], O_RDWR);
166 if (fd < 0) { 179 if (fd < 0) {
167 perror(av[1]); 180 perror(av[ai]);
168 exit(1); 181 exit(1);
169 } 182 }
170 183
@@ -184,12 +197,12 @@ main(int ac, char **av)
184 if (buf[E_IDENT+EI_CLASS] != ELFCLASS32 197 if (buf[E_IDENT+EI_CLASS] != ELFCLASS32
185 || buf[E_IDENT+EI_DATA] != ELFDATA2MSB) { 198 || buf[E_IDENT+EI_DATA] != ELFDATA2MSB) {
186 fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n", 199 fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n",
187 av[1]); 200 av[ai]);
188 exit(1); 201 exit(1);
189 } 202 }
190 203
191 if (ac == 3) 204 if (ac == ai + 2)
192 rpap = read_rpanote(av[2], &nnote2); 205 rpap = read_rpanote(av[ai + 1], &nnote2);
193 206
194 ph = GET_32BE(buf, E_PHOFF); 207 ph = GET_32BE(buf, E_PHOFF);
195 ps = GET_16BE(buf, E_PHENTSIZE); 208 ps = GET_16BE(buf, E_PHENTSIZE);
@@ -202,7 +215,7 @@ main(int ac, char **av)
202 for (i = 0; i < np; ++i) { 215 for (i = 0; i < np; ++i) {
203 if (GET_32BE(buf, ph + PH_TYPE) == PT_NOTE) { 216 if (GET_32BE(buf, ph + PH_TYPE) == PT_NOTE) {
204 fprintf(stderr, "%s already has a note entry\n", 217 fprintf(stderr, "%s already has a note entry\n",
205 av[1]); 218 av[ai]);
206 exit(0); 219 exit(0);
207 } 220 }
208 ph += ps; 221 ph += ps;
@@ -260,18 +273,18 @@ main(int ac, char **av)
260 exit(1); 273 exit(1);
261 } 274 }
262 if (i < n) { 275 if (i < n) {
263 fprintf(stderr, "%s: write truncated\n", av[1]); 276 fprintf(stderr, "%s: write truncated\n", av[ai]);
264 exit(1); 277 exit(1);
265 } 278 }
266 279
267 exit(0); 280 exit(0);
268 281
269 notelf: 282 notelf:
270 fprintf(stderr, "%s does not appear to be an ELF file\n", av[1]); 283 fprintf(stderr, "%s does not appear to be an ELF file\n", av[ai]);
271 exit(1); 284 exit(1);
272 285
273 nospace: 286 nospace:
274 fprintf(stderr, "sorry, I can't find space in %s to put the note\n", 287 fprintf(stderr, "sorry, I can't find space in %s to put the note\n",
275 av[1]); 288 av[ai]);
276 exit(1); 289 exit(1);
277} 290}
diff --git a/arch/powerpc/boot/cuboot-52xx.c b/arch/powerpc/boot/cuboot-52xx.c
index a8611546a656..4c42ec8687be 100644
--- a/arch/powerpc/boot/cuboot-52xx.c
+++ b/arch/powerpc/boot/cuboot-52xx.c
@@ -37,6 +37,10 @@ static void platform_fixups(void)
37 * this can do a simple path lookup. 37 * this can do a simple path lookup.
38 */ 38 */
39 soc = find_node_by_devtype(NULL, "soc"); 39 soc = find_node_by_devtype(NULL, "soc");
40 if (!soc)
41 soc = find_node_by_compatible(NULL, "fsl,mpc5200-immr");
42 if (!soc)
43 soc = find_node_by_compatible(NULL, "fsl,mpc5200b-immr");
40 if (soc) { 44 if (soc) {
41 setprop(soc, "bus-frequency", &bd.bi_ipbfreq, 45 setprop(soc, "bus-frequency", &bd.bi_ipbfreq,
42 sizeof(bd.bi_ipbfreq)); 46 sizeof(bd.bi_ipbfreq));
diff --git a/arch/powerpc/boot/cuboot-acadia.c b/arch/powerpc/boot/cuboot-acadia.c
new file mode 100644
index 000000000000..0634aba6348a
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-acadia.c
@@ -0,0 +1,174 @@
1/*
2 * Old U-boot compatibility for Acadia
3 *
4 * Author: Josh Boyer <jwboyer@linux.vnet.ibm.com>
5 *
6 * Copyright 2008 IBM Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
11 */
12
13#include "ops.h"
14#include "io.h"
15#include "dcr.h"
16#include "stdio.h"
17#include "4xx.h"
18#include "44x.h"
19#include "cuboot.h"
20
21#define TARGET_4xx
22#include "ppcboot.h"
23
24static bd_t bd;
25
26#define CPR_PERD0_SPIDV_MASK 0x000F0000 /* SPI Clock Divider */
27
28#define PLLC_SRC_MASK 0x20000000 /* PLL feedback source */
29
30#define PLLD_FBDV_MASK 0x1F000000 /* PLL feedback divider value */
31#define PLLD_FWDVA_MASK 0x000F0000 /* PLL forward divider A value */
32#define PLLD_FWDVB_MASK 0x00000700 /* PLL forward divider B value */
33
34#define PRIMAD_CPUDV_MASK 0x0F000000 /* CPU Clock Divisor Mask */
35#define PRIMAD_PLBDV_MASK 0x000F0000 /* PLB Clock Divisor Mask */
36#define PRIMAD_OPBDV_MASK 0x00000F00 /* OPB Clock Divisor Mask */
37#define PRIMAD_EBCDV_MASK 0x0000000F /* EBC Clock Divisor Mask */
38
39#define PERD0_PWMDV_MASK 0xFF000000 /* PWM Divider Mask */
40#define PERD0_SPIDV_MASK 0x000F0000 /* SPI Divider Mask */
41#define PERD0_U0DV_MASK 0x0000FF00 /* UART 0 Divider Mask */
42#define PERD0_U1DV_MASK 0x000000FF /* UART 1 Divider Mask */
43
44static void get_clocks(void)
45{
46 unsigned long sysclk, cpr_plld, cpr_pllc, cpr_primad, plloutb, i;
47 unsigned long pllFwdDiv, pllFwdDivB, pllFbkDiv, pllPlbDiv, pllExtBusDiv;
48 unsigned long pllOpbDiv, freqEBC, freqUART, freqOPB;
49 unsigned long div; /* total divisor udiv * bdiv */
50 unsigned long umin; /* minimum udiv */
51 unsigned short diff; /* smallest diff */
52 unsigned long udiv; /* best udiv */
53 unsigned short idiff; /* current diff */
54 unsigned short ibdiv; /* current bdiv */
55 unsigned long est; /* current estimate */
56 unsigned long baud;
57 void *np;
58
59 /* read the sysclk value from the CPLD */
60 sysclk = (in_8((unsigned char *)0x80000000) == 0xc) ? 66666666 : 33333000;
61
62 /*
63 * Read PLL Mode registers
64 */
65 cpr_plld = CPR0_READ(DCRN_CPR0_PLLD);
66 cpr_pllc = CPR0_READ(DCRN_CPR0_PLLC);
67
68 /*
69 * Determine forward divider A
70 */
71 pllFwdDiv = ((cpr_plld & PLLD_FWDVA_MASK) >> 16);
72
73 /*
74 * Determine forward divider B
75 */
76 pllFwdDivB = ((cpr_plld & PLLD_FWDVB_MASK) >> 8);
77 if (pllFwdDivB == 0)
78 pllFwdDivB = 8;
79
80 /*
81 * Determine FBK_DIV.
82 */
83 pllFbkDiv = ((cpr_plld & PLLD_FBDV_MASK) >> 24);
84 if (pllFbkDiv == 0)
85 pllFbkDiv = 256;
86
87 /*
88 * Read CPR_PRIMAD register
89 */
90 cpr_primad = CPR0_READ(DCRN_CPR0_PRIMAD);
91
92 /*
93 * Determine PLB_DIV.
94 */
95 pllPlbDiv = ((cpr_primad & PRIMAD_PLBDV_MASK) >> 16);
96 if (pllPlbDiv == 0)
97 pllPlbDiv = 16;
98
99 /*
100 * Determine EXTBUS_DIV.
101 */
102 pllExtBusDiv = (cpr_primad & PRIMAD_EBCDV_MASK);
103 if (pllExtBusDiv == 0)
104 pllExtBusDiv = 16;
105
106 /*
107 * Determine OPB_DIV.
108 */
109 pllOpbDiv = ((cpr_primad & PRIMAD_OPBDV_MASK) >> 8);
110 if (pllOpbDiv == 0)
111 pllOpbDiv = 16;
112
113 /* There is a bug in U-Boot that prevents us from using
114 * bd.bi_opbfreq because U-Boot doesn't populate it for
115 * 405EZ. We get to calculate it, yay!
116 */
117 freqOPB = (sysclk *pllFbkDiv) /pllOpbDiv;
118
119 freqEBC = (sysclk * pllFbkDiv) / pllExtBusDiv;
120
121 plloutb = ((sysclk * ((cpr_pllc & PLLC_SRC_MASK) ?
122 pllFwdDivB : pllFwdDiv) *
123 pllFbkDiv) / pllFwdDivB);
124
125 np = find_node_by_alias("serial0");
126 if (getprop(np, "current-speed", &baud, sizeof(baud)) != sizeof(baud))
127 fatal("no current-speed property\n\r");
128
129 udiv = 256; /* Assume lowest possible serial clk */
130 div = plloutb / (16 * baud); /* total divisor */
131 umin = (plloutb / freqOPB) << 1; /* 2 x OPB divisor */
132 diff = 256; /* highest possible */
133
134 /* i is the test udiv value -- start with the largest
135 * possible (256) to minimize serial clock and constrain
136 * search to umin.
137 */
138 for (i = 256; i > umin; i--) {
139 ibdiv = div / i;
140 est = i * ibdiv;
141 idiff = (est > div) ? (est-div) : (div-est);
142 if (idiff == 0) {
143 udiv = i;
144 break; /* can't do better */
145 } else if (idiff < diff) {
146 udiv = i; /* best so far */
147 diff = idiff; /* update lowest diff*/
148 }
149 }
150 freqUART = plloutb / udiv;
151
152 dt_fixup_cpu_clocks(bd.bi_procfreq, bd.bi_intfreq, bd.bi_plb_busfreq);
153 dt_fixup_clock("/plb/ebc", freqEBC);
154 dt_fixup_clock("/plb/opb", freqOPB);
155 dt_fixup_clock("/plb/opb/serial@ef600300", freqUART);
156 dt_fixup_clock("/plb/opb/serial@ef600400", freqUART);
157}
158
159static void acadia_fixups(void)
160{
161 dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
162 get_clocks();
163 dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
164}
165
166void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
167 unsigned long r6, unsigned long r7)
168{
169 CUBOOT_INIT();
170 platform_ops.fixups = acadia_fixups;
171 platform_ops.exit = ibm40x_dbcr_reset;
172 fdt_init(_dtb_start);
173 serial_console_init();
174}
diff --git a/arch/powerpc/boot/dts/acadia.dts b/arch/powerpc/boot/dts/acadia.dts
new file mode 100644
index 000000000000..57291f61ffe7
--- /dev/null
+++ b/arch/powerpc/boot/dts/acadia.dts
@@ -0,0 +1,224 @@
1/*
2 * Device Tree Source for AMCC Acadia (405EZ)
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/dts-v1/;
12
13/ {
14 #address-cells = <1>;
15 #size-cells = <1>;
16 model = "amcc,acadia";
17 compatible = "amcc,acadia";
18 dcr-parent = <&{/cpus/cpu@0}>;
19
20 aliases {
21 ethernet0 = &EMAC0;
22 serial0 = &UART0;
23 serial1 = &UART1;
24 };
25
26 cpus {
27 #address-cells = <1>;
28 #size-cells = <0>;
29
30 cpu@0 {
31 device_type = "cpu";
32 model = "PowerPC,405EZ";
33 reg = <0x0>;
34 clock-frequency = <0>; /* Filled in by wrapper */
35 timebase-frequency = <0>; /* Filled in by wrapper */
36 i-cache-line-size = <32>;
37 d-cache-line-size = <32>;
38 i-cache-size = <16384>;
39 d-cache-size = <16384>;
40 dcr-controller;
41 dcr-access-method = "native";
42 };
43 };
44
45 memory {
46 device_type = "memory";
47 reg = <0x0 0x0>; /* Filled in by wrapper */
48 };
49
50 UIC0: interrupt-controller {
51 compatible = "ibm,uic-405ez", "ibm,uic";
52 interrupt-controller;
53 dcr-reg = <0x0c0 0x009>;
54 cell-index = <0>;
55 #address-cells = <0>;
56 #size-cells = <0>;
57 #interrupt-cells = <2>;
58 };
59
60 plb {
61 compatible = "ibm,plb-405ez", "ibm,plb3";
62 #address-cells = <1>;
63 #size-cells = <1>;
64 ranges;
65 clock-frequency = <0>; /* Filled in by wrapper */
66
67 MAL0: mcmal {
68 compatible = "ibm,mcmal-405ez", "ibm,mcmal";
69 dcr-reg = <0x380 0x62>;
70 num-tx-chans = <1>;
71 num-rx-chans = <1>;
72 interrupt-parent = <&UIC0>;
73 /* 405EZ has only 3 interrupts to the UIC, as
74 * SERR, TXDE, and RXDE are or'd together into
75 * one UIC bit
76 */
77 interrupts = <
78 0x13 0x4 /* TXEOB */
79 0x15 0x4 /* RXEOB */
80 0x12 0x4 /* SERR, TXDE, RXDE */>;
81 };
82
83 POB0: opb {
84 compatible = "ibm,opb-405ez", "ibm,opb";
85 #address-cells = <1>;
86 #size-cells = <1>;
87 ranges;
88 dcr-reg = <0x0a 0x05>;
89 clock-frequency = <0>; /* Filled in by wrapper */
90
91 UART0: serial@ef600300 {
92 device_type = "serial";
93 compatible = "ns16550";
94 reg = <0xef600300 0x8>;
95 virtual-reg = <0xef600300>;
96 clock-frequency = <0>; /* Filled in by wrapper */
97 current-speed = <115200>;
98 interrupt-parent = <&UIC0>;
99 interrupts = <0x5 0x4>;
100 };
101
102 UART1: serial@ef600400 {
103 device_type = "serial";
104 compatible = "ns16550";
105 reg = <0xef600400 0x8>;
106 clock-frequency = <0>; /* Filled in by wrapper */
107 current-speed = <115200>;
108 interrupt-parent = <&UIC0>;
109 interrupts = <0x6 0x4>;
110 };
111
112 IIC: i2c@ef600500 {
113 compatible = "ibm,iic-405ez", "ibm,iic";
114 reg = <0xef600500 0x11>;
115 interrupt-parent = <&UIC0>;
116 interrupts = <0xa 0x4>;
117 };
118
119 GPIO0: gpio@ef600700 {
120 compatible = "ibm,gpio-405ez";
121 reg = <0xef600700 0x20>;
122 };
123
124 GPIO1: gpio@ef600800 {
125 compatible = "ibm,gpio-405ez";
126 reg = <0xef600800 0x20>;
127 };
128
129 EMAC0: ethernet@ef600900 {
130 device_type = "network";
131 compatible = "ibm,emac-405ez", "ibm,emac";
132 interrupt-parent = <&UIC0>;
133 interrupts = <
134 0x10 0x4 /* Ethernet */
135 0x11 0x4 /* Ethernet Wake up */>;
136 local-mac-address = [000000000000]; /* Filled in by wrapper */
137 reg = <0xef600900 0x70>;
138 mal-device = <&MAL0>;
139 mal-tx-channel = <0>;
140 mal-rx-channel = <0>;
141 cell-index = <0>;
142 max-frame-size = <1500>;
143 rx-fifo-size = <4096>;
144 tx-fifo-size = <2048>;
145 phy-mode = "mii";
146 phy-map = <0x0>;
147 };
148
149 CAN0: can@ef601000 {
150 compatible = "amcc,can-405ez";
151 reg = <0xef601000 0x620>;
152 interrupt-parent = <&UIC0>;
153 interrupts = <0x7 0x4>;
154 };
155
156 CAN1: can@ef601800 {
157 compatible = "amcc,can-405ez";
158 reg = <0xef601800 0x620>;
159 interrupt-parent = <&UIC0>;
160 interrupts = <0x8 0x4>;
161 };
162
163 cameleon@ef602000 {
164 compatible = "amcc,cameleon-405ez";
165 reg = <0xef602000 0x800>;
166 interrupt-parent = <&UIC0>;
167 interrupts = <0xb 0x4 0xc 0x4>;
168 };
169
170 ieee1588@ef602800 {
171 compatible = "amcc,ieee1588-405ez";
172 reg = <0xef602800 0x60>;
173 interrupt-parent = <&UIC0>;
174 interrupts = <0x4 0x4>;
175 /* This thing is a bit weird. It has it's own UIC
176 * that it uses to generate snapshot triggers. We
177 * don't really support this device yet, and it needs
178 * work to figure this out.
179 */
180 dcr-reg = <0xe0 0x9>;
181 };
182
183 usb@ef603000 {
184 compatible = "ohci-be";
185 reg = <0xef603000 0x80>;
186 interrupts-parent = <&UIC0>;
187 interrupts = <0xd 0x4 0xe 0x4>;
188 };
189
190 dac@ef603300 {
191 compatible = "amcc,dac-405ez";
192 reg = <0xef603300 0x40>;
193 interrupt-parent = <&UIC0>;
194 interrupts = <0x18 0x4>;
195 };
196
197 adc@ef603400 {
198 compatible = "amcc,adc-405ez";
199 reg = <0xef603400 0x40>;
200 interrupt-parent = <&UIC0>;
201 interrupts = <0x17 0x4>;
202 };
203
204 spi@ef603500 {
205 compatible = "amcc,spi-405ez";
206 reg = <0xef603500 0x100>;
207 interrupt-parent = <&UIC0>;
208 interrupts = <0x9 0x4>;
209 };
210 };
211
212 EBC0: ebc {
213 compatible = "ibm,ebc-405ez", "ibm,ebc";
214 dcr-reg = <0x12 0x2>;
215 #address-cells = <2>;
216 #size-cells = <1>;
217 clock-frequency = <0>; /* Filled in by wrapper */
218 };
219 };
220
221 chosen {
222 linux,stdout-path = "/plb/opb/serial@ef600300";
223 };
224};
diff --git a/arch/powerpc/boot/dts/hcu4.dts b/arch/powerpc/boot/dts/hcu4.dts
new file mode 100644
index 000000000000..7988598da4c9
--- /dev/null
+++ b/arch/powerpc/boot/dts/hcu4.dts
@@ -0,0 +1,168 @@
1/*
2* Device Tree Source for Netstal Maschinen HCU4
3* based on the IBM Walnut
4*
5* Copyright 2008
6* Niklaus Giger <niklaus.giger@member.fsf.org>
7*
8* Copyright 2007 IBM Corp.
9* Josh Boyer <jwboyer@linux.vnet.ibm.com>
10*
11* This file is licensed under the terms of the GNU General Public
12* License version 2. This program is licensed "as is" without
13* any warranty of any kind, whether express or implied.
14*/
15
16/dts-v1/;
17
18/ {
19 #address-cells = <0x1>;
20 #size-cells = <0x1>;
21 model = "netstal,hcu4";
22 compatible = "netstal,hcu4";
23 dcr-parent = <0x1>;
24
25 aliases {
26 ethernet0 = "/plb/opb/ethernet@ef600800";
27 serial0 = "/plb/opb/serial@ef600300";
28 };
29
30 cpus {
31 #address-cells = <0x1>;
32 #size-cells = <0x0>;
33
34 cpu@0 {
35 device_type = "cpu";
36 model = "PowerPC,405GPr";
37 reg = <0x0>;
38 clock-frequency = <0>; /* Filled in by U-Boot */
39 timebase-frequency = <0x0>; /* Filled in by U-Boot */
40 i-cache-line-size = <0x20>;
41 d-cache-line-size = <0x20>;
42 i-cache-size = <0x4000>;
43 d-cache-size = <0x4000>;
44 dcr-controller;
45 dcr-access-method = "native";
46 linux,phandle = <0x1>;
47 };
48 };
49
50 memory {
51 device_type = "memory";
52 reg = <0x0 0x0>; /* Filled in by U-Boot */
53 };
54
55 UIC0: interrupt-controller {
56 compatible = "ibm,uic";
57 interrupt-controller;
58 cell-index = <0x0>;
59 dcr-reg = <0xc0 0x9>;
60 #address-cells = <0x0>;
61 #size-cells = <0x0>;
62 #interrupt-cells = <0x2>;
63 linux,phandle = <0x2>;
64 };
65
66 plb {
67 compatible = "ibm,plb3";
68 #address-cells = <0x1>;
69 #size-cells = <0x1>;
70 ranges;
71 clock-frequency = <0x0>; /* Filled in by U-Boot */
72
73 SDRAM0: memory-controller {
74 compatible = "ibm,sdram-405gp";
75 dcr-reg = <0x10 0x2>;
76 };
77
78 MAL: mcmal {
79 compatible = "ibm,mcmal-405gp", "ibm,mcmal";
80 dcr-reg = <0x180 0x62>;
81 num-tx-chans = <0x1>;
82 num-rx-chans = <0x1>;
83 interrupt-parent = <0x2>;
84 interrupts = <0xb 0x4 0xc 0x4 0xa 0x4 0xd 0x4 0xe 0x4>;
85 linux,phandle = <0x3>;
86 };
87
88 POB0: opb {
89 compatible = "ibm,opb-405gp", "ibm,opb";
90 #address-cells = <0x1>;
91 #size-cells = <0x1>;
92 ranges = <0xef600000 0xef600000 0xa00000>;
93 dcr-reg = <0xa0 0x5>;
94 clock-frequency = <0x0>; /* Filled in by U-Boot */
95
96 UART0: serial@ef600300 {
97 device_type = "serial";
98 compatible = "ns16550";
99 reg = <0xef600300 0x8>;
100 virtual-reg = <0xef600300>;
101 clock-frequency = <0x0>;/* Filled in by U-Boot */
102 current-speed = <0>; /* Filled in by U-Boot */
103 interrupt-parent = <0x2>;
104 interrupts = <0x0 0x4>;
105 };
106
107 IIC: i2c@ef600500 {
108 compatible = "ibm,iic-405gp", "ibm,iic";
109 reg = <0xef600500 0x11>;
110 interrupt-parent = <0x2>;
111 interrupts = <0x2 0x4>;
112 };
113
114 GPIO: gpio@ef600700 {
115 compatible = "ibm,gpio-405gp";
116 reg = <0xef600700 0x20>;
117 };
118
119 EMAC: ethernet@ef600800 {
120 device_type = "network";
121 compatible = "ibm,emac-405gp", "ibm,emac";
122 interrupt-parent = <0x2>;
123 interrupts = <0xf 0x4 0x9 0x4>;
124 local-mac-address = [00 00 00 00 00 00];
125 reg = <0xef600800 0x70>;
126 mal-device = <0x3>;
127 mal-tx-channel = <0x0>;
128 mal-rx-channel = <0x0>;
129 cell-index = <0x0>;
130 max-frame-size = <0x5dc>;
131 rx-fifo-size = <0x1000>;
132 tx-fifo-size = <0x800>;
133 phy-mode = "rmii";
134 phy-map = <0x1>;
135 };
136 };
137
138 EBC0: ebc {
139 compatible = "ibm,ebc-405gp", "ibm,ebc";
140 dcr-reg = <0x12 0x2>;
141 #address-cells = <0x2>;
142 #size-cells = <0x1>;
143 clock-frequency = <0x0>; /* Filled in by U-Boot */
144
145 sram@0,0 {
146 reg = <0x0 0x0 0x80000>;
147 };
148
149 flash@0,80000 {
150 compatible = "jedec-flash";
151 bank-width = <0x1>;
152 reg = <0x0 0x80000 0x80000>;
153 #address-cells = <0x1>;
154 #size-cells = <0x1>;
155
156 partition@0 {
157 label = "OpenBIOS";
158 reg = <0x0 0x80000>;
159 read-only;
160 };
161 };
162 };
163 };
164
165 chosen {
166 linux,stdout-path = "/plb/opb/serial@ef600300";
167 };
168};
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 7449e54c1a90..6b850670de1d 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -121,6 +121,14 @@
121 compatible = "dallas,ds1339"; 121 compatible = "dallas,ds1339";
122 reg = <0x68>; 122 reg = <0x68>;
123 }; 123 };
124
125 mcu_pio: mcu@a {
126 #gpio-cells = <2>;
127 compatible = "fsl,mc9s08qg8-mpc8315erdb",
128 "fsl,mcu-mpc8349emitx";
129 reg = <0x0a>;
130 gpio-controller;
131 };
124 }; 132 };
125 133
126 spi@7000 { 134 spi@7000 {
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index e4cc1768f241..57c595bf1071 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -60,7 +60,7 @@
60 }; 60 };
61 61
62 bcsr@f8000000 { 62 bcsr@f8000000 {
63 device_type = "board-control"; 63 compatible = "fsl,mpc8323mds-bcsr";
64 reg = <0xf8000000 0x8000>; 64 reg = <0xf8000000 0x8000>;
65 }; 65 };
66 66
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 5cedf373a1d8..2c9d54a35bc3 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -83,6 +83,14 @@
83 interrupts = <15 0x8>; 83 interrupts = <15 0x8>;
84 interrupt-parent = <&ipic>; 84 interrupt-parent = <&ipic>;
85 dfsrr; 85 dfsrr;
86
87 rtc@68 {
88 device_type = "rtc";
89 compatible = "dallas,ds1339";
90 reg = <0x68>;
91 interrupts = <18 0x8>;
92 interrupt-parent = <&ipic>;
93 };
86 }; 94 };
87 95
88 spi@7000 { 96 spi@7000 {
@@ -131,6 +139,14 @@
131 interrupt-parent = <&ipic>; 139 interrupt-parent = <&ipic>;
132 interrupts = <71 8>; 140 interrupts = <71 8>;
133 }; 141 };
142
143 mcu_pio: mcu@a {
144 #gpio-cells = <2>;
145 compatible = "fsl,mc9s08qg8-mpc8349emitx",
146 "fsl,mcu-mpc8349emitx";
147 reg = <0x0a>;
148 gpio-controller;
149 };
134 }; 150 };
135 151
136 usb@22000 { 152 usb@22000 {
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index 81ae1d3e9440..fa40647ee62e 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -81,6 +81,14 @@
81 interrupts = <15 0x8>; 81 interrupts = <15 0x8>;
82 interrupt-parent = <&ipic>; 82 interrupt-parent = <&ipic>;
83 dfsrr; 83 dfsrr;
84
85 rtc@68 {
86 device_type = "rtc";
87 compatible = "dallas,ds1339";
88 reg = <0x68>;
89 interrupts = <18 0x8>;
90 interrupt-parent = <&ipic>;
91 };
84 }; 92 };
85 93
86 spi@7000 { 94 spi@7000 {
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 04bfde3ea605..c986c541e9bb 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -49,7 +49,7 @@
49 }; 49 };
50 50
51 bcsr@e2400000 { 51 bcsr@e2400000 {
52 device_type = "board-control"; 52 compatible = "fsl,mpc8349mds-bcsr";
53 reg = <0xe2400000 0x8000>; 53 reg = <0xe2400000 0x8000>;
54 }; 54 };
55 55
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 66a12d2631fb..14534d04e4db 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -69,7 +69,7 @@
69 }; 69 };
70 70
71 bcsr@1,0 { 71 bcsr@1,0 {
72 device_type = "board-control"; 72 compatible = "fsl,mpc8360mds-bcsr";
73 reg = <1 0 0x8000>; 73 reg = <1 0 0x8000>;
74 }; 74 };
75 }; 75 };
diff --git a/arch/powerpc/boot/dts/mpc8377_rdb.dts b/arch/powerpc/boot/dts/mpc8377_rdb.dts
index 53191ba67aaa..435ef3dd022d 100644
--- a/arch/powerpc/boot/dts/mpc8377_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8377_rdb.dts
@@ -121,6 +121,14 @@
121 compatible = "dallas,ds1339"; 121 compatible = "dallas,ds1339";
122 reg = <0x68>; 122 reg = <0x68>;
123 }; 123 };
124
125 mcu_pio: mcu@a {
126 #gpio-cells = <2>;
127 compatible = "fsl,mc9s08qg8-mpc8377erdb",
128 "fsl,mcu-mpc8349emitx";
129 reg = <0x0a>;
130 gpio-controller;
131 };
124 }; 132 };
125 133
126 i2c@3100 { 134 i2c@3100 {
diff --git a/arch/powerpc/boot/dts/mpc8378_rdb.dts b/arch/powerpc/boot/dts/mpc8378_rdb.dts
index 4a09153d160c..b11e68f56a06 100644
--- a/arch/powerpc/boot/dts/mpc8378_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8378_rdb.dts
@@ -121,6 +121,14 @@
121 compatible = "dallas,ds1339"; 121 compatible = "dallas,ds1339";
122 reg = <0x68>; 122 reg = <0x68>;
123 }; 123 };
124
125 mcu_pio: mcu@a {
126 #gpio-cells = <2>;
127 compatible = "fsl,mc9s08qg8-mpc8378erdb",
128 "fsl,mcu-mpc8349emitx";
129 reg = <0x0a>;
130 gpio-controller;
131 };
124 }; 132 };
125 133
126 i2c@3100 { 134 i2c@3100 {
diff --git a/arch/powerpc/boot/dts/mpc8379_rdb.dts b/arch/powerpc/boot/dts/mpc8379_rdb.dts
index bbd884ac9dc0..337af6ea26d3 100644
--- a/arch/powerpc/boot/dts/mpc8379_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8379_rdb.dts
@@ -121,6 +121,14 @@
121 compatible = "dallas,ds1339"; 121 compatible = "dallas,ds1339";
122 reg = <0x68>; 122 reg = <0x68>;
123 }; 123 };
124
125 mcu_pio: mcu@a {
126 #gpio-cells = <2>;
127 compatible = "fsl,mc9s08qg8-mpc8379erdb",
128 "fsl,mcu-mpc8349emitx";
129 reg = <0x0a>;
130 gpio-controller;
131 };
124 }; 132 };
125 133
126 i2c@3100 { 134 i2c@3100 {
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dts b/arch/powerpc/boot/dts/mpc8536ds.dts
index 93fdd99901b6..35db1e5440c7 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds.dts
@@ -109,7 +109,7 @@
109 reg = <0x0 0x80>; 109 reg = <0x0 0x80>;
110 cell-index = <0>; 110 cell-index = <0>;
111 interrupt-parent = <&mpic>; 111 interrupt-parent = <&mpic>;
112 interrupts = <14 0x2>; 112 interrupts = <20 2>;
113 }; 113 };
114 dma-channel@80 { 114 dma-channel@80 {
115 compatible = "fsl,mpc8536-dma-channel", 115 compatible = "fsl,mpc8536-dma-channel",
@@ -117,7 +117,7 @@
117 reg = <0x80 0x80>; 117 reg = <0x80 0x80>;
118 cell-index = <1>; 118 cell-index = <1>;
119 interrupt-parent = <&mpic>; 119 interrupt-parent = <&mpic>;
120 interrupts = <15 0x2>; 120 interrupts = <21 2>;
121 }; 121 };
122 dma-channel@100 { 122 dma-channel@100 {
123 compatible = "fsl,mpc8536-dma-channel", 123 compatible = "fsl,mpc8536-dma-channel",
@@ -125,7 +125,7 @@
125 reg = <0x100 0x80>; 125 reg = <0x100 0x80>;
126 cell-index = <2>; 126 cell-index = <2>;
127 interrupt-parent = <&mpic>; 127 interrupt-parent = <&mpic>;
128 interrupts = <16 0x2>; 128 interrupts = <22 2>;
129 }; 129 };
130 dma-channel@180 { 130 dma-channel@180 {
131 compatible = "fsl,mpc8536-dma-channel", 131 compatible = "fsl,mpc8536-dma-channel",
@@ -133,7 +133,7 @@
133 reg = <0x180 0x80>; 133 reg = <0x180 0x80>;
134 cell-index = <3>; 134 cell-index = <3>;
135 interrupt-parent = <&mpic>; 135 interrupt-parent = <&mpic>;
136 interrupts = <17 0x2>; 136 interrupts = <23 2>;
137 }; 137 };
138 }; 138 };
139 139
@@ -180,7 +180,7 @@
180 enet0: ethernet@24000 { 180 enet0: ethernet@24000 {
181 cell-index = <0>; 181 cell-index = <0>;
182 device_type = "network"; 182 device_type = "network";
183 model = "TSEC"; 183 model = "eTSEC";
184 compatible = "gianfar"; 184 compatible = "gianfar";
185 reg = <0x24000 0x1000>; 185 reg = <0x24000 0x1000>;
186 local-mac-address = [ 00 00 00 00 00 00 ]; 186 local-mac-address = [ 00 00 00 00 00 00 ];
@@ -193,7 +193,7 @@
193 enet1: ethernet@26000 { 193 enet1: ethernet@26000 {
194 cell-index = <1>; 194 cell-index = <1>;
195 device_type = "network"; 195 device_type = "network";
196 model = "TSEC"; 196 model = "eTSEC";
197 compatible = "gianfar"; 197 compatible = "gianfar";
198 reg = <0x26000 0x1000>; 198 reg = <0x26000 0x1000>;
199 local-mac-address = [ 00 00 00 00 00 00 ]; 199 local-mac-address = [ 00 00 00 00 00 00 ];
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index a15f10343f53..c80158f7741d 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -52,7 +52,7 @@
52 }; 52 };
53 53
54 bcsr@f8000000 { 54 bcsr@f8000000 {
55 device_type = "board-control"; 55 compatible = "fsl,mpc8568mds-bcsr";
56 reg = <0xf8000000 0x8000>; 56 reg = <0xf8000000 0x8000>;
57 }; 57 };
58 58
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts b/arch/powerpc/boot/dts/mpc8572ds.dts
index e124dd18fb5a..cadd4652a695 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -13,8 +13,8 @@
13/ { 13/ {
14 model = "fsl,MPC8572DS"; 14 model = "fsl,MPC8572DS";
15 compatible = "fsl,MPC8572DS"; 15 compatible = "fsl,MPC8572DS";
16 #address-cells = <1>; 16 #address-cells = <2>;
17 #size-cells = <1>; 17 #size-cells = <2>;
18 18
19 aliases { 19 aliases {
20 ethernet0 = &enet0; 20 ethernet0 = &enet0;
@@ -61,7 +61,6 @@
61 61
62 memory { 62 memory {
63 device_type = "memory"; 63 device_type = "memory";
64 reg = <0x0 0x0>; // Filled by U-Boot
65 }; 64 };
66 65
67 soc8572@ffe00000 { 66 soc8572@ffe00000 {
@@ -69,8 +68,8 @@
69 #size-cells = <1>; 68 #size-cells = <1>;
70 device_type = "soc"; 69 device_type = "soc";
71 compatible = "simple-bus"; 70 compatible = "simple-bus";
72 ranges = <0x0 0xffe00000 0x100000>; 71 ranges = <0x0 0 0xffe00000 0x100000>;
73 reg = <0xffe00000 0x1000>; // CCSRBAR & soc regs, remove once parse code for immrbase fixed 72 reg = <0 0xffe00000 0 0x1000>; // CCSRBAR & soc regs, remove once parse code for immrbase fixed
74 bus-frequency = <0>; // Filled out by uboot. 73 bus-frequency = <0>; // Filled out by uboot.
75 74
76 memory-controller@2000 { 75 memory-controller@2000 {
@@ -351,10 +350,10 @@
351 #interrupt-cells = <1>; 350 #interrupt-cells = <1>;
352 #size-cells = <2>; 351 #size-cells = <2>;
353 #address-cells = <3>; 352 #address-cells = <3>;
354 reg = <0xffe08000 0x1000>; 353 reg = <0 0xffe08000 0 0x1000>;
355 bus-range = <0 255>; 354 bus-range = <0 255>;
356 ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 355 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
357 0x1000000 0x0 0x0 0xffc00000 0x0 0x10000>; 356 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x00010000>;
358 clock-frequency = <33333333>; 357 clock-frequency = <33333333>;
359 interrupt-parent = <&mpic>; 358 interrupt-parent = <&mpic>;
360 interrupts = <24 2>; 359 interrupts = <24 2>;
@@ -561,10 +560,10 @@
561 #interrupt-cells = <1>; 560 #interrupt-cells = <1>;
562 #size-cells = <2>; 561 #size-cells = <2>;
563 #address-cells = <3>; 562 #address-cells = <3>;
564 reg = <0xffe09000 0x1000>; 563 reg = <0 0xffe09000 0 0x1000>;
565 bus-range = <0 255>; 564 bus-range = <0 255>;
566 ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x20000000 565 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
567 0x1000000 0x0 0x0 0xffc10000 0x0 0x10000>; 566 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x00010000>;
568 clock-frequency = <33333333>; 567 clock-frequency = <33333333>;
569 interrupt-parent = <&mpic>; 568 interrupt-parent = <&mpic>;
570 interrupts = <26 2>; 569 interrupts = <26 2>;
@@ -598,10 +597,10 @@
598 #interrupt-cells = <1>; 597 #interrupt-cells = <1>;
599 #size-cells = <2>; 598 #size-cells = <2>;
600 #address-cells = <3>; 599 #address-cells = <3>;
601 reg = <0xffe0a000 0x1000>; 600 reg = <0 0xffe0a000 0 0x1000>;
602 bus-range = <0 255>; 601 bus-range = <0 255>;
603 ranges = <0x2000000 0x0 0xc0000000 0xc0000000 0x0 0x20000000 602 ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000
604 0x1000000 0x0 0x0 0xffc20000 0x0 0x10000>; 603 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x00010000>;
605 clock-frequency = <33333333>; 604 clock-frequency = <33333333>;
606 interrupt-parent = <&mpic>; 605 interrupt-parent = <&mpic>;
607 interrupts = <27 2>; 606 interrupts = <27 2>;
diff --git a/arch/powerpc/boot/libfdt-wrapper.c b/arch/powerpc/boot/libfdt-wrapper.c
index c541fd8a95d4..9276327bc2bb 100644
--- a/arch/powerpc/boot/libfdt-wrapper.c
+++ b/arch/powerpc/boot/libfdt-wrapper.c
@@ -105,6 +105,11 @@ static int fdt_wrapper_setprop(const void *devp, const char *name,
105 return check_err(rc); 105 return check_err(rc);
106} 106}
107 107
108static int fdt_wrapper_del_node(const void *devp)
109{
110 return fdt_del_node(fdt, devp_offset(devp));
111}
112
108static void *fdt_wrapper_get_parent(const void *devp) 113static void *fdt_wrapper_get_parent(const void *devp)
109{ 114{
110 return offset_devp(fdt_parent_offset(fdt, devp_offset(devp))); 115 return offset_devp(fdt_parent_offset(fdt, devp_offset(devp)));
@@ -165,6 +170,7 @@ static unsigned long fdt_wrapper_finalize(void)
165void fdt_init(void *blob) 170void fdt_init(void *blob)
166{ 171{
167 int err; 172 int err;
173 int bufsize;
168 174
169 dt_ops.finddevice = fdt_wrapper_finddevice; 175 dt_ops.finddevice = fdt_wrapper_finddevice;
170 dt_ops.getprop = fdt_wrapper_getprop; 176 dt_ops.getprop = fdt_wrapper_getprop;
@@ -173,21 +179,21 @@ void fdt_init(void *blob)
173 dt_ops.create_node = fdt_wrapper_create_node; 179 dt_ops.create_node = fdt_wrapper_create_node;
174 dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value; 180 dt_ops.find_node_by_prop_value = fdt_wrapper_find_node_by_prop_value;
175 dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible; 181 dt_ops.find_node_by_compatible = fdt_wrapper_find_node_by_compatible;
182 dt_ops.del_node = fdt_wrapper_del_node;
176 dt_ops.get_path = fdt_wrapper_get_path; 183 dt_ops.get_path = fdt_wrapper_get_path;
177 dt_ops.finalize = fdt_wrapper_finalize; 184 dt_ops.finalize = fdt_wrapper_finalize;
178 185
179 /* Make sure the dt blob is the right version and so forth */ 186 /* Make sure the dt blob is the right version and so forth */
180 fdt = blob; 187 fdt = blob;
181 err = fdt_open_into(fdt, fdt, fdt_totalsize(blob)); 188 bufsize = fdt_totalsize(fdt) + 4;
182 if (err == -FDT_ERR_NOSPACE) { 189 buf = malloc(bufsize);
183 int bufsize = fdt_totalsize(fdt) + 4; 190 if(!buf)
184 buf = malloc(bufsize); 191 fatal("malloc failed. can't relocate the device tree\n\r");
185 err = fdt_open_into(fdt, buf, bufsize); 192
186 } 193 err = fdt_open_into(fdt, buf, bufsize);
187 194
188 if (err != 0) 195 if (err != 0)
189 fatal("fdt_init(): %s\n\r", fdt_strerror(err)); 196 fatal("fdt_init(): %s\n\r", fdt_strerror(err));
190 197
191 if (buf) 198 fdt = buf;
192 fdt = buf;
193} 199}
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 9e7f3ddd9913..ae32801ebd69 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -56,9 +56,19 @@ static struct addr_range prep_kernel(void)
56 if (platform_ops.vmlinux_alloc) { 56 if (platform_ops.vmlinux_alloc) {
57 addr = platform_ops.vmlinux_alloc(ei.memsize); 57 addr = platform_ops.vmlinux_alloc(ei.memsize);
58 } else { 58 } else {
59 if ((unsigned long)_start < ei.memsize) 59 /*
60 * Check if the kernel image (without bss) would overwrite the
61 * bootwrapper. The device tree has been moved in fdt_init()
62 * to an area allocated with malloc() (somewhere past _end).
63 */
64 if ((unsigned long)_start < ei.loadsize)
60 fatal("Insufficient memory for kernel at address 0!" 65 fatal("Insufficient memory for kernel at address 0!"
61 " (_start=%p)\n\r", _start); 66 " (_start=%p, uncomressed size=%08x)\n\r",
67 _start, ei.loadsize);
68
69 if ((unsigned long)_end < ei.memsize)
70 fatal("The final kernel image would overwrite the "
71 "device tree\n\r");
62 } 72 }
63 73
64 /* Finally, gunzip the kernel */ 74 /* Finally, gunzip the kernel */
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 321e2f5afe71..b3218ce451bb 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -40,6 +40,7 @@ struct dt_ops {
40 const int buflen); 40 const int buflen);
41 int (*setprop)(const void *phandle, const char *name, 41 int (*setprop)(const void *phandle, const char *name,
42 const void *buf, const int buflen); 42 const void *buf, const int buflen);
43 int (*del_node)(const void *phandle);
43 void *(*get_parent)(const void *phandle); 44 void *(*get_parent)(const void *phandle);
44 /* The node must not already exist. */ 45 /* The node must not already exist. */
45 void *(*create_node)(const void *parent, const char *name); 46 void *(*create_node)(const void *parent, const char *name);
@@ -126,6 +127,11 @@ static inline int setprop_str(void *devp, const char *name, const char *buf)
126 return -1; 127 return -1;
127} 128}
128 129
130static inline int del_node(const void *devp)
131{
132 return dt_ops.del_node ? dt_ops.del_node(devp) : -1;
133}
134
129static inline void *get_parent(const char *devp) 135static inline void *get_parent(const char *devp)
130{ 136{
131 return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL; 137 return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL;
diff --git a/arch/powerpc/boot/string.S b/arch/powerpc/boot/string.S
index 643e4cb2f11d..acc9428f2789 100644
--- a/arch/powerpc/boot/string.S
+++ b/arch/powerpc/boot/string.S
@@ -235,7 +235,7 @@ memchr:
235 .globl memcmp 235 .globl memcmp
236memcmp: 236memcmp:
237 cmpwi 0,r5,0 237 cmpwi 0,r5,0
238 blelr 238 ble 2f
239 mtctr r5 239 mtctr r5
240 addi r6,r3,-1 240 addi r6,r3,-1
241 addi r4,r4,-1 241 addi r4,r4,-1
@@ -244,6 +244,8 @@ memcmp:
244 subf. r3,r0,r3 244 subf. r3,r0,r3
245 bdnzt 2,1b 245 bdnzt 2,1b
246 blr 246 blr
2472: li r3,0
248 blr
247 249
248 250
249/* 251/*
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index ee0dc41d7c56..f39073511a49 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -306,11 +306,14 @@ fi
306 306
307# post-processing needed for some platforms 307# post-processing needed for some platforms
308case "$platform" in 308case "$platform" in
309pseries|chrp) 309pseries)
310 ${CROSS}objcopy -O binary -j .fakeelf "$kernel" "$ofile".rpanote 310 ${CROSS}objcopy -O binary -j .fakeelf "$kernel" "$ofile".rpanote
311 $objbin/addnote "$ofile" "$ofile".rpanote 311 $objbin/addnote "$ofile" "$ofile".rpanote
312 rm -r "$ofile".rpanote 312 rm -r "$ofile".rpanote
313 ;; 313 ;;
314chrp)
315 $objbin/addnote -r c00000 "$ofile"
316 ;;
314coff) 317coff)
315 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" 318 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
316 $objbin/hack-coff "$ofile" 319 $objbin/hack-coff "$ofile"
diff --git a/arch/powerpc/configs/40x/acadia_defconfig b/arch/powerpc/configs/40x/acadia_defconfig
new file mode 100644
index 000000000000..39bd9eb453f0
--- /dev/null
+++ b/arch/powerpc/configs/40x/acadia_defconfig
@@ -0,0 +1,921 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc5
4# Mon Oct 13 13:47:16 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11# CONFIG_6xx is not set
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14CONFIG_40x=y
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_4xx=y
18# CONFIG_PPC_MM_SLICES is not set
19CONFIG_NOT_COHERENT_CACHE=y
20CONFIG_PPC32=y
21CONFIG_WORD_SIZE=32
22CONFIG_PPC_MERGE=y
23CONFIG_MMU=y
24CONFIG_GENERIC_CMOS_UPDATE=y
25CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y
29# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
30CONFIG_IRQ_PER_CPU=y
31CONFIG_STACKTRACE_SUPPORT=y
32CONFIG_HAVE_LATENCYTOP_SUPPORT=y
33CONFIG_LOCKDEP_SUPPORT=y
34CONFIG_RWSEM_XCHGADD_ALGORITHM=y
35CONFIG_ARCH_HAS_ILOG2_U32=y
36CONFIG_GENERIC_HWEIGHT=y
37CONFIG_GENERIC_CALIBRATE_DELAY=y
38CONFIG_GENERIC_FIND_NEXT_BIT=y
39# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
40CONFIG_PPC=y
41CONFIG_EARLY_PRINTK=y
42CONFIG_GENERIC_NVRAM=y
43CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
44CONFIG_ARCH_MAY_HAVE_PC_FDC=y
45CONFIG_PPC_OF=y
46CONFIG_OF=y
47CONFIG_PPC_UDBG_16550=y
48# CONFIG_GENERIC_TBSYNC is not set
49CONFIG_AUDIT_ARCH=y
50CONFIG_GENERIC_BUG=y
51# CONFIG_DEFAULT_UIMAGE is not set
52CONFIG_PPC_DCR_NATIVE=y
53# CONFIG_PPC_DCR_MMIO is not set
54CONFIG_PPC_DCR=y
55CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
56
57#
58# General setup
59#
60CONFIG_EXPERIMENTAL=y
61CONFIG_BROKEN_ON_SMP=y
62CONFIG_INIT_ENV_ARG_LIMIT=32
63CONFIG_LOCALVERSION=""
64CONFIG_LOCALVERSION_AUTO=y
65CONFIG_SWAP=y
66CONFIG_SYSVIPC=y
67CONFIG_SYSVIPC_SYSCTL=y
68CONFIG_POSIX_MQUEUE=y
69# CONFIG_BSD_PROCESS_ACCT is not set
70# CONFIG_TASKSTATS is not set
71# CONFIG_AUDIT is not set
72# CONFIG_IKCONFIG is not set
73CONFIG_LOG_BUF_SHIFT=14
74# CONFIG_CGROUPS is not set
75CONFIG_GROUP_SCHED=y
76# CONFIG_FAIR_GROUP_SCHED is not set
77# CONFIG_RT_GROUP_SCHED is not set
78CONFIG_USER_SCHED=y
79# CONFIG_CGROUP_SCHED is not set
80CONFIG_SYSFS_DEPRECATED=y
81CONFIG_SYSFS_DEPRECATED_V2=y
82# CONFIG_RELAY is not set
83# CONFIG_NAMESPACES is not set
84CONFIG_BLK_DEV_INITRD=y
85CONFIG_INITRAMFS_SOURCE=""
86# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
87CONFIG_SYSCTL=y
88CONFIG_EMBEDDED=y
89CONFIG_SYSCTL_SYSCALL=y
90CONFIG_KALLSYMS=y
91CONFIG_KALLSYMS_ALL=y
92CONFIG_KALLSYMS_EXTRA_PASS=y
93CONFIG_HOTPLUG=y
94CONFIG_PRINTK=y
95CONFIG_BUG=y
96CONFIG_ELF_CORE=y
97CONFIG_COMPAT_BRK=y
98CONFIG_BASE_FULL=y
99CONFIG_FUTEX=y
100CONFIG_ANON_INODES=y
101CONFIG_EPOLL=y
102CONFIG_SIGNALFD=y
103CONFIG_TIMERFD=y
104CONFIG_EVENTFD=y
105CONFIG_SHMEM=y
106CONFIG_VM_EVENT_COUNTERS=y
107CONFIG_SLUB_DEBUG=y
108# CONFIG_SLAB is not set
109CONFIG_SLUB=y
110# CONFIG_SLOB is not set
111# CONFIG_PROFILING is not set
112# CONFIG_MARKERS is not set
113CONFIG_HAVE_OPROFILE=y
114# CONFIG_KPROBES is not set
115CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
116CONFIG_HAVE_IOREMAP_PROT=y
117CONFIG_HAVE_KPROBES=y
118CONFIG_HAVE_KRETPROBES=y
119CONFIG_HAVE_ARCH_TRACEHOOK=y
120# CONFIG_HAVE_DMA_ATTRS is not set
121# CONFIG_USE_GENERIC_SMP_HELPERS is not set
122# CONFIG_HAVE_CLK is not set
123CONFIG_PROC_PAGE_MONITOR=y
124# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
125CONFIG_SLABINFO=y
126CONFIG_RT_MUTEXES=y
127# CONFIG_TINY_SHMEM is not set
128CONFIG_BASE_SMALL=0
129CONFIG_MODULES=y
130# CONFIG_MODULE_FORCE_LOAD is not set
131CONFIG_MODULE_UNLOAD=y
132# CONFIG_MODULE_FORCE_UNLOAD is not set
133# CONFIG_MODVERSIONS is not set
134# CONFIG_MODULE_SRCVERSION_ALL is not set
135CONFIG_KMOD=y
136CONFIG_BLOCK=y
137CONFIG_LBD=y
138# CONFIG_BLK_DEV_IO_TRACE is not set
139# CONFIG_LSF is not set
140# CONFIG_BLK_DEV_BSG is not set
141# CONFIG_BLK_DEV_INTEGRITY is not set
142
143#
144# IO Schedulers
145#
146CONFIG_IOSCHED_NOOP=y
147CONFIG_IOSCHED_AS=y
148CONFIG_IOSCHED_DEADLINE=y
149CONFIG_IOSCHED_CFQ=y
150CONFIG_DEFAULT_AS=y
151# CONFIG_DEFAULT_DEADLINE is not set
152# CONFIG_DEFAULT_CFQ is not set
153# CONFIG_DEFAULT_NOOP is not set
154CONFIG_DEFAULT_IOSCHED="anticipatory"
155CONFIG_CLASSIC_RCU=y
156# CONFIG_PPC4xx_PCI_EXPRESS is not set
157
158#
159# Platform support
160#
161# CONFIG_PPC_CELL is not set
162# CONFIG_PPC_CELL_NATIVE is not set
163# CONFIG_PQ2ADS is not set
164CONFIG_ACADIA=y
165# CONFIG_EP405 is not set
166# CONFIG_KILAUEA is not set
167# CONFIG_MAKALU is not set
168# CONFIG_WALNUT is not set
169# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
170CONFIG_PPC40x_SIMPLE=y
171CONFIG_405EZ=y
172# CONFIG_IPIC is not set
173# CONFIG_MPIC is not set
174# CONFIG_MPIC_WEIRD is not set
175# CONFIG_PPC_I8259 is not set
176# CONFIG_PPC_RTAS is not set
177# CONFIG_MMIO_NVRAM is not set
178# CONFIG_PPC_MPC106 is not set
179# CONFIG_PPC_970_NAP is not set
180# CONFIG_PPC_INDIRECT_IO is not set
181# CONFIG_GENERIC_IOMAP is not set
182# CONFIG_CPU_FREQ is not set
183# CONFIG_FSL_ULI1575 is not set
184
185#
186# Kernel options
187#
188# CONFIG_HIGHMEM is not set
189# CONFIG_TICK_ONESHOT is not set
190# CONFIG_NO_HZ is not set
191# CONFIG_HIGH_RES_TIMERS is not set
192CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
193# CONFIG_HZ_100 is not set
194CONFIG_HZ_250=y
195# CONFIG_HZ_300 is not set
196# CONFIG_HZ_1000 is not set
197CONFIG_HZ=250
198# CONFIG_SCHED_HRTICK is not set
199CONFIG_PREEMPT_NONE=y
200# CONFIG_PREEMPT_VOLUNTARY is not set
201# CONFIG_PREEMPT is not set
202CONFIG_BINFMT_ELF=y
203# CONFIG_BINFMT_MISC is not set
204# CONFIG_MATH_EMULATION is not set
205# CONFIG_IOMMU_HELPER is not set
206CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
207CONFIG_ARCH_HAS_WALK_MEMORY=y
208CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
209CONFIG_ARCH_FLATMEM_ENABLE=y
210CONFIG_ARCH_POPULATES_NODE_MAP=y
211CONFIG_SELECT_MEMORY_MODEL=y
212CONFIG_FLATMEM_MANUAL=y
213# CONFIG_DISCONTIGMEM_MANUAL is not set
214# CONFIG_SPARSEMEM_MANUAL is not set
215CONFIG_FLATMEM=y
216CONFIG_FLAT_NODE_MEM_MAP=y
217# CONFIG_SPARSEMEM_STATIC is not set
218# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
219CONFIG_PAGEFLAGS_EXTENDED=y
220CONFIG_SPLIT_PTLOCK_CPUS=4
221CONFIG_MIGRATION=y
222# CONFIG_RESOURCES_64BIT is not set
223CONFIG_ZONE_DMA_FLAG=1
224CONFIG_BOUNCE=y
225CONFIG_VIRT_TO_BUS=y
226CONFIG_FORCE_MAX_ZONEORDER=11
227CONFIG_PROC_DEVICETREE=y
228# CONFIG_CMDLINE_BOOL is not set
229CONFIG_EXTRA_TARGETS=""
230# CONFIG_PM is not set
231CONFIG_SECCOMP=y
232CONFIG_ISA_DMA_API=y
233
234#
235# Bus options
236#
237CONFIG_ZONE_DMA=y
238CONFIG_PPC_INDIRECT_PCI=y
239CONFIG_4xx_SOC=y
240CONFIG_PPC_PCI_CHOICE=y
241CONFIG_PCI=y
242CONFIG_PCI_DOMAINS=y
243CONFIG_PCI_SYSCALL=y
244# CONFIG_PCIEPORTBUS is not set
245CONFIG_ARCH_SUPPORTS_MSI=y
246# CONFIG_PCI_MSI is not set
247CONFIG_PCI_LEGACY=y
248# CONFIG_PCI_DEBUG is not set
249# CONFIG_PCCARD is not set
250# CONFIG_HOTPLUG_PCI is not set
251# CONFIG_HAS_RAPIDIO is not set
252
253#
254# Advanced setup
255#
256# CONFIG_ADVANCED_OPTIONS is not set
257
258#
259# Default settings for advanced configuration options are used
260#
261CONFIG_LOWMEM_SIZE=0x30000000
262CONFIG_PAGE_OFFSET=0xc0000000
263CONFIG_KERNEL_START=0xc0000000
264CONFIG_PHYSICAL_START=0x00000000
265CONFIG_TASK_SIZE=0xc0000000
266CONFIG_CONSISTENT_START=0xff100000
267CONFIG_CONSISTENT_SIZE=0x00200000
268CONFIG_NET=y
269
270#
271# Networking options
272#
273CONFIG_PACKET=y
274# CONFIG_PACKET_MMAP is not set
275CONFIG_UNIX=y
276# CONFIG_NET_KEY is not set
277CONFIG_INET=y
278# CONFIG_IP_MULTICAST is not set
279# CONFIG_IP_ADVANCED_ROUTER is not set
280CONFIG_IP_FIB_HASH=y
281CONFIG_IP_PNP=y
282CONFIG_IP_PNP_DHCP=y
283CONFIG_IP_PNP_BOOTP=y
284# CONFIG_IP_PNP_RARP is not set
285# CONFIG_NET_IPIP is not set
286# CONFIG_NET_IPGRE is not set
287# CONFIG_ARPD is not set
288# CONFIG_SYN_COOKIES is not set
289# CONFIG_INET_AH is not set
290# CONFIG_INET_ESP is not set
291# CONFIG_INET_IPCOMP is not set
292# CONFIG_INET_XFRM_TUNNEL is not set
293# CONFIG_INET_TUNNEL is not set
294# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
295# CONFIG_INET_XFRM_MODE_TUNNEL is not set
296# CONFIG_INET_XFRM_MODE_BEET is not set
297# CONFIG_INET_LRO is not set
298CONFIG_INET_DIAG=y
299CONFIG_INET_TCP_DIAG=y
300# CONFIG_TCP_CONG_ADVANCED is not set
301CONFIG_TCP_CONG_CUBIC=y
302CONFIG_DEFAULT_TCP_CONG="cubic"
303# CONFIG_TCP_MD5SIG is not set
304# CONFIG_IPV6 is not set
305# CONFIG_NETWORK_SECMARK is not set
306# CONFIG_NETFILTER is not set
307# CONFIG_IP_DCCP is not set
308# CONFIG_IP_SCTP is not set
309# CONFIG_TIPC is not set
310# CONFIG_ATM is not set
311# CONFIG_BRIDGE is not set
312# CONFIG_VLAN_8021Q is not set
313# CONFIG_DECNET is not set
314# CONFIG_LLC2 is not set
315# CONFIG_IPX is not set
316# CONFIG_ATALK is not set
317# CONFIG_X25 is not set
318# CONFIG_LAPB is not set
319# CONFIG_ECONET is not set
320# CONFIG_WAN_ROUTER is not set
321# CONFIG_NET_SCHED is not set
322
323#
324# Network testing
325#
326# CONFIG_NET_PKTGEN is not set
327# CONFIG_HAMRADIO is not set
328# CONFIG_CAN is not set
329# CONFIG_IRDA is not set
330# CONFIG_BT is not set
331# CONFIG_AF_RXRPC is not set
332
333#
334# Wireless
335#
336# CONFIG_CFG80211 is not set
337# CONFIG_WIRELESS_EXT is not set
338# CONFIG_MAC80211 is not set
339# CONFIG_IEEE80211 is not set
340# CONFIG_RFKILL is not set
341# CONFIG_NET_9P is not set
342
343#
344# Device Drivers
345#
346
347#
348# Generic Driver Options
349#
350CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
351CONFIG_STANDALONE=y
352CONFIG_PREVENT_FIRMWARE_BUILD=y
353CONFIG_FW_LOADER=y
354CONFIG_FIRMWARE_IN_KERNEL=y
355CONFIG_EXTRA_FIRMWARE=""
356# CONFIG_DEBUG_DRIVER is not set
357# CONFIG_DEBUG_DEVRES is not set
358# CONFIG_SYS_HYPERVISOR is not set
359CONFIG_CONNECTOR=y
360CONFIG_PROC_EVENTS=y
361CONFIG_MTD=y
362# CONFIG_MTD_DEBUG is not set
363# CONFIG_MTD_CONCAT is not set
364CONFIG_MTD_PARTITIONS=y
365# CONFIG_MTD_REDBOOT_PARTS is not set
366CONFIG_MTD_CMDLINE_PARTS=y
367CONFIG_MTD_OF_PARTS=y
368# CONFIG_MTD_AR7_PARTS is not set
369
370#
371# User Modules And Translation Layers
372#
373CONFIG_MTD_CHAR=y
374CONFIG_MTD_BLKDEVS=m
375CONFIG_MTD_BLOCK=m
376# CONFIG_MTD_BLOCK_RO is not set
377# CONFIG_FTL is not set
378# CONFIG_NFTL is not set
379# CONFIG_INFTL is not set
380# CONFIG_RFD_FTL is not set
381# CONFIG_SSFDC is not set
382# CONFIG_MTD_OOPS is not set
383
384#
385# RAM/ROM/Flash chip drivers
386#
387CONFIG_MTD_CFI=y
388CONFIG_MTD_JEDECPROBE=y
389CONFIG_MTD_GEN_PROBE=y
390# CONFIG_MTD_CFI_ADV_OPTIONS is not set
391CONFIG_MTD_MAP_BANK_WIDTH_1=y
392CONFIG_MTD_MAP_BANK_WIDTH_2=y
393CONFIG_MTD_MAP_BANK_WIDTH_4=y
394# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
395# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
396# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
397CONFIG_MTD_CFI_I1=y
398CONFIG_MTD_CFI_I2=y
399# CONFIG_MTD_CFI_I4 is not set
400# CONFIG_MTD_CFI_I8 is not set
401# CONFIG_MTD_CFI_INTELEXT is not set
402CONFIG_MTD_CFI_AMDSTD=y
403# CONFIG_MTD_CFI_STAA is not set
404CONFIG_MTD_CFI_UTIL=y
405# CONFIG_MTD_RAM is not set
406# CONFIG_MTD_ROM is not set
407# CONFIG_MTD_ABSENT is not set
408
409#
410# Mapping drivers for chip access
411#
412# CONFIG_MTD_COMPLEX_MAPPINGS is not set
413# CONFIG_MTD_PHYSMAP is not set
414CONFIG_MTD_PHYSMAP_OF=y
415# CONFIG_MTD_INTEL_VR_NOR is not set
416# CONFIG_MTD_PLATRAM is not set
417
418#
419# Self-contained MTD device drivers
420#
421# CONFIG_MTD_PMC551 is not set
422# CONFIG_MTD_SLRAM is not set
423# CONFIG_MTD_PHRAM is not set
424# CONFIG_MTD_MTDRAM is not set
425# CONFIG_MTD_BLOCK2MTD is not set
426
427#
428# Disk-On-Chip Device Drivers
429#
430# CONFIG_MTD_DOC2000 is not set
431# CONFIG_MTD_DOC2001 is not set
432# CONFIG_MTD_DOC2001PLUS is not set
433# CONFIG_MTD_NAND is not set
434# CONFIG_MTD_ONENAND is not set
435
436#
437# UBI - Unsorted block images
438#
439# CONFIG_MTD_UBI is not set
440CONFIG_OF_DEVICE=y
441# CONFIG_PARPORT is not set
442CONFIG_BLK_DEV=y
443# CONFIG_BLK_DEV_FD is not set
444# CONFIG_BLK_CPQ_DA is not set
445# CONFIG_BLK_CPQ_CISS_DA is not set
446# CONFIG_BLK_DEV_DAC960 is not set
447# CONFIG_BLK_DEV_UMEM is not set
448# CONFIG_BLK_DEV_COW_COMMON is not set
449# CONFIG_BLK_DEV_LOOP is not set
450# CONFIG_BLK_DEV_NBD is not set
451# CONFIG_BLK_DEV_SX8 is not set
452CONFIG_BLK_DEV_RAM=y
453CONFIG_BLK_DEV_RAM_COUNT=16
454CONFIG_BLK_DEV_RAM_SIZE=35000
455# CONFIG_BLK_DEV_XIP is not set
456# CONFIG_CDROM_PKTCDVD is not set
457# CONFIG_ATA_OVER_ETH is not set
458# CONFIG_XILINX_SYSACE is not set
459# CONFIG_BLK_DEV_HD is not set
460# CONFIG_MISC_DEVICES is not set
461CONFIG_HAVE_IDE=y
462# CONFIG_IDE is not set
463
464#
465# SCSI device support
466#
467# CONFIG_RAID_ATTRS is not set
468# CONFIG_SCSI is not set
469# CONFIG_SCSI_DMA is not set
470# CONFIG_SCSI_NETLINK is not set
471# CONFIG_ATA is not set
472# CONFIG_MD is not set
473# CONFIG_FUSION is not set
474
475#
476# IEEE 1394 (FireWire) support
477#
478
479#
480# Enable only one of the two stacks, unless you know what you are doing
481#
482# CONFIG_FIREWIRE is not set
483# CONFIG_IEEE1394 is not set
484# CONFIG_I2O is not set
485# CONFIG_MACINTOSH_DRIVERS is not set
486CONFIG_NETDEVICES=y
487# CONFIG_DUMMY is not set
488# CONFIG_BONDING is not set
489# CONFIG_MACVLAN is not set
490# CONFIG_EQUALIZER is not set
491# CONFIG_TUN is not set
492# CONFIG_VETH is not set
493# CONFIG_ARCNET is not set
494# CONFIG_PHYLIB is not set
495CONFIG_NET_ETHERNET=y
496CONFIG_MII=y
497# CONFIG_HAPPYMEAL is not set
498# CONFIG_SUNGEM is not set
499# CONFIG_CASSINI is not set
500# CONFIG_NET_VENDOR_3COM is not set
501# CONFIG_NET_TULIP is not set
502# CONFIG_HP100 is not set
503CONFIG_IBM_NEW_EMAC=y
504CONFIG_IBM_NEW_EMAC_RXB=256
505CONFIG_IBM_NEW_EMAC_TXB=256
506CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32
507CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256
508CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
509CONFIG_IBM_NEW_EMAC_DEBUG=y
510# CONFIG_IBM_NEW_EMAC_ZMII is not set
511# CONFIG_IBM_NEW_EMAC_RGMII is not set
512# CONFIG_IBM_NEW_EMAC_TAH is not set
513# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
514CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL=y
515CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT=y
516CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR=y
517# CONFIG_NET_PCI is not set
518# CONFIG_B44 is not set
519# CONFIG_NETDEV_1000 is not set
520# CONFIG_NETDEV_10000 is not set
521# CONFIG_TR is not set
522
523#
524# Wireless LAN
525#
526# CONFIG_WLAN_PRE80211 is not set
527# CONFIG_WLAN_80211 is not set
528# CONFIG_IWLWIFI_LEDS is not set
529# CONFIG_WAN is not set
530# CONFIG_FDDI is not set
531# CONFIG_HIPPI is not set
532# CONFIG_PPP is not set
533# CONFIG_SLIP is not set
534# CONFIG_NETCONSOLE is not set
535# CONFIG_NETPOLL is not set
536# CONFIG_NET_POLL_CONTROLLER is not set
537# CONFIG_ISDN is not set
538# CONFIG_PHONE is not set
539
540#
541# Input device support
542#
543# CONFIG_INPUT is not set
544
545#
546# Hardware I/O ports
547#
548# CONFIG_SERIO is not set
549# CONFIG_GAMEPORT is not set
550
551#
552# Character devices
553#
554# CONFIG_VT is not set
555CONFIG_DEVKMEM=y
556# CONFIG_SERIAL_NONSTANDARD is not set
557# CONFIG_NOZOMI is not set
558
559#
560# Serial drivers
561#
562CONFIG_SERIAL_8250=y
563CONFIG_SERIAL_8250_CONSOLE=y
564CONFIG_SERIAL_8250_PCI=y
565CONFIG_SERIAL_8250_NR_UARTS=4
566CONFIG_SERIAL_8250_RUNTIME_UARTS=4
567CONFIG_SERIAL_8250_EXTENDED=y
568# CONFIG_SERIAL_8250_MANY_PORTS is not set
569CONFIG_SERIAL_8250_SHARE_IRQ=y
570# CONFIG_SERIAL_8250_DETECT_IRQ is not set
571# CONFIG_SERIAL_8250_RSA is not set
572
573#
574# Non-8250 serial port support
575#
576# CONFIG_SERIAL_UARTLITE is not set
577CONFIG_SERIAL_CORE=y
578CONFIG_SERIAL_CORE_CONSOLE=y
579# CONFIG_SERIAL_JSM is not set
580CONFIG_SERIAL_OF_PLATFORM=y
581CONFIG_UNIX98_PTYS=y
582CONFIG_LEGACY_PTYS=y
583CONFIG_LEGACY_PTY_COUNT=256
584# CONFIG_IPMI_HANDLER is not set
585# CONFIG_HW_RANDOM is not set
586# CONFIG_NVRAM is not set
587# CONFIG_GEN_RTC is not set
588# CONFIG_R3964 is not set
589# CONFIG_APPLICOM is not set
590# CONFIG_RAW_DRIVER is not set
591# CONFIG_TCG_TPM is not set
592CONFIG_DEVPORT=y
593# CONFIG_I2C is not set
594# CONFIG_SPI is not set
595CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
596# CONFIG_GPIOLIB is not set
597# CONFIG_W1 is not set
598# CONFIG_POWER_SUPPLY is not set
599# CONFIG_HWMON is not set
600CONFIG_THERMAL=y
601# CONFIG_WATCHDOG is not set
602
603#
604# Sonics Silicon Backplane
605#
606CONFIG_SSB_POSSIBLE=y
607# CONFIG_SSB is not set
608
609#
610# Multifunction device drivers
611#
612# CONFIG_MFD_CORE is not set
613# CONFIG_MFD_SM501 is not set
614# CONFIG_HTC_PASIC3 is not set
615# CONFIG_MFD_TMIO is not set
616
617#
618# Multimedia devices
619#
620
621#
622# Multimedia core support
623#
624# CONFIG_VIDEO_DEV is not set
625# CONFIG_DVB_CORE is not set
626# CONFIG_VIDEO_MEDIA is not set
627
628#
629# Multimedia drivers
630#
631# CONFIG_DAB is not set
632
633#
634# Graphics support
635#
636# CONFIG_AGP is not set
637# CONFIG_DRM is not set
638# CONFIG_VGASTATE is not set
639# CONFIG_VIDEO_OUTPUT_CONTROL is not set
640# CONFIG_FB is not set
641# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
642
643#
644# Display device support
645#
646# CONFIG_DISPLAY_SUPPORT is not set
647# CONFIG_SOUND is not set
648# CONFIG_USB_SUPPORT is not set
649# CONFIG_MMC is not set
650# CONFIG_MEMSTICK is not set
651# CONFIG_NEW_LEDS is not set
652# CONFIG_ACCESSIBILITY is not set
653# CONFIG_INFINIBAND is not set
654# CONFIG_EDAC is not set
655# CONFIG_RTC_CLASS is not set
656# CONFIG_DMADEVICES is not set
657# CONFIG_UIO is not set
658
659#
660# File systems
661#
662CONFIG_EXT2_FS=y
663# CONFIG_EXT2_FS_XATTR is not set
664# CONFIG_EXT2_FS_XIP is not set
665# CONFIG_EXT3_FS is not set
666# CONFIG_EXT4DEV_FS is not set
667# CONFIG_REISERFS_FS is not set
668# CONFIG_JFS_FS is not set
669# CONFIG_FS_POSIX_ACL is not set
670# CONFIG_XFS_FS is not set
671# CONFIG_OCFS2_FS is not set
672CONFIG_DNOTIFY=y
673CONFIG_INOTIFY=y
674CONFIG_INOTIFY_USER=y
675# CONFIG_QUOTA is not set
676# CONFIG_AUTOFS_FS is not set
677# CONFIG_AUTOFS4_FS is not set
678# CONFIG_FUSE_FS is not set
679
680#
681# CD-ROM/DVD Filesystems
682#
683# CONFIG_ISO9660_FS is not set
684# CONFIG_UDF_FS is not set
685
686#
687# DOS/FAT/NT Filesystems
688#
689# CONFIG_MSDOS_FS is not set
690# CONFIG_VFAT_FS is not set
691# CONFIG_NTFS_FS is not set
692
693#
694# Pseudo filesystems
695#
696CONFIG_PROC_FS=y
697CONFIG_PROC_KCORE=y
698CONFIG_PROC_SYSCTL=y
699CONFIG_SYSFS=y
700CONFIG_TMPFS=y
701# CONFIG_TMPFS_POSIX_ACL is not set
702# CONFIG_HUGETLB_PAGE is not set
703# CONFIG_CONFIGFS_FS is not set
704
705#
706# Miscellaneous filesystems
707#
708# CONFIG_ADFS_FS is not set
709# CONFIG_AFFS_FS is not set
710# CONFIG_HFS_FS is not set
711# CONFIG_HFSPLUS_FS is not set
712# CONFIG_BEFS_FS is not set
713# CONFIG_BFS_FS is not set
714# CONFIG_EFS_FS is not set
715# CONFIG_JFFS2_FS is not set
716CONFIG_CRAMFS=y
717# CONFIG_VXFS_FS is not set
718# CONFIG_MINIX_FS is not set
719# CONFIG_OMFS_FS is not set
720# CONFIG_HPFS_FS is not set
721# CONFIG_QNX4FS_FS is not set
722# CONFIG_ROMFS_FS is not set
723# CONFIG_SYSV_FS is not set
724# CONFIG_UFS_FS is not set
725CONFIG_NETWORK_FILESYSTEMS=y
726CONFIG_NFS_FS=y
727CONFIG_NFS_V3=y
728# CONFIG_NFS_V3_ACL is not set
729# CONFIG_NFS_V4 is not set
730CONFIG_ROOT_NFS=y
731# CONFIG_NFSD is not set
732CONFIG_LOCKD=y
733CONFIG_LOCKD_V4=y
734CONFIG_NFS_COMMON=y
735CONFIG_SUNRPC=y
736# CONFIG_RPCSEC_GSS_KRB5 is not set
737# CONFIG_RPCSEC_GSS_SPKM3 is not set
738# CONFIG_SMB_FS is not set
739# CONFIG_CIFS is not set
740# CONFIG_NCP_FS is not set
741# CONFIG_CODA_FS is not set
742# CONFIG_AFS_FS is not set
743
744#
745# Partition Types
746#
747# CONFIG_PARTITION_ADVANCED is not set
748CONFIG_MSDOS_PARTITION=y
749# CONFIG_NLS is not set
750# CONFIG_DLM is not set
751
752#
753# Library routines
754#
755CONFIG_BITREVERSE=y
756# CONFIG_GENERIC_FIND_FIRST_BIT is not set
757# CONFIG_CRC_CCITT is not set
758# CONFIG_CRC16 is not set
759# CONFIG_CRC_T10DIF is not set
760# CONFIG_CRC_ITU_T is not set
761CONFIG_CRC32=y
762# CONFIG_CRC7 is not set
763# CONFIG_LIBCRC32C is not set
764CONFIG_ZLIB_INFLATE=y
765CONFIG_PLIST=y
766CONFIG_HAS_IOMEM=y
767CONFIG_HAS_IOPORT=y
768CONFIG_HAS_DMA=y
769CONFIG_HAVE_LMB=y
770
771#
772# Kernel hacking
773#
774# CONFIG_PRINTK_TIME is not set
775CONFIG_ENABLE_WARN_DEPRECATED=y
776CONFIG_ENABLE_MUST_CHECK=y
777CONFIG_FRAME_WARN=1024
778CONFIG_MAGIC_SYSRQ=y
779# CONFIG_UNUSED_SYMBOLS is not set
780CONFIG_DEBUG_FS=y
781# CONFIG_HEADERS_CHECK is not set
782CONFIG_DEBUG_KERNEL=y
783# CONFIG_DEBUG_SHIRQ is not set
784CONFIG_DETECT_SOFTLOCKUP=y
785# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
786CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
787CONFIG_SCHED_DEBUG=y
788# CONFIG_SCHEDSTATS is not set
789# CONFIG_TIMER_STATS is not set
790# CONFIG_DEBUG_OBJECTS is not set
791# CONFIG_SLUB_DEBUG_ON is not set
792# CONFIG_SLUB_STATS is not set
793# CONFIG_DEBUG_RT_MUTEXES is not set
794# CONFIG_RT_MUTEX_TESTER is not set
795# CONFIG_DEBUG_SPINLOCK is not set
796# CONFIG_DEBUG_MUTEXES is not set
797# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
798# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
799# CONFIG_DEBUG_KOBJECT is not set
800CONFIG_DEBUG_BUGVERBOSE=y
801# CONFIG_DEBUG_INFO is not set
802# CONFIG_DEBUG_VM is not set
803# CONFIG_DEBUG_WRITECOUNT is not set
804# CONFIG_DEBUG_MEMORY_INIT is not set
805# CONFIG_DEBUG_LIST is not set
806# CONFIG_DEBUG_SG is not set
807# CONFIG_BOOT_PRINTK_DELAY is not set
808# CONFIG_RCU_TORTURE_TEST is not set
809# CONFIG_BACKTRACE_SELF_TEST is not set
810# CONFIG_FAULT_INJECTION is not set
811# CONFIG_LATENCYTOP is not set
812CONFIG_SYSCTL_SYSCALL_CHECK=y
813CONFIG_HAVE_FTRACE=y
814CONFIG_HAVE_DYNAMIC_FTRACE=y
815# CONFIG_FTRACE is not set
816# CONFIG_SCHED_TRACER is not set
817# CONFIG_CONTEXT_SWITCH_TRACER is not set
818# CONFIG_SAMPLES is not set
819CONFIG_HAVE_ARCH_KGDB=y
820# CONFIG_KGDB is not set
821# CONFIG_DEBUG_STACKOVERFLOW is not set
822# CONFIG_DEBUG_STACK_USAGE is not set
823# CONFIG_DEBUG_PAGEALLOC is not set
824# CONFIG_CODE_PATCHING_SELFTEST is not set
825# CONFIG_FTR_FIXUP_SELFTEST is not set
826# CONFIG_MSI_BITMAP_SELFTEST is not set
827# CONFIG_XMON is not set
828# CONFIG_IRQSTACKS is not set
829# CONFIG_VIRQ_DEBUG is not set
830# CONFIG_BDI_SWITCH is not set
831# CONFIG_PPC_EARLY_DEBUG is not set
832
833#
834# Security options
835#
836# CONFIG_KEYS is not set
837# CONFIG_SECURITY is not set
838# CONFIG_SECURITY_FILE_CAPABILITIES is not set
839CONFIG_CRYPTO=y
840
841#
842# Crypto core or helper
843#
844CONFIG_CRYPTO_ALGAPI=y
845CONFIG_CRYPTO_BLKCIPHER=y
846CONFIG_CRYPTO_MANAGER=y
847# CONFIG_CRYPTO_GF128MUL is not set
848# CONFIG_CRYPTO_NULL is not set
849# CONFIG_CRYPTO_CRYPTD is not set
850# CONFIG_CRYPTO_AUTHENC is not set
851# CONFIG_CRYPTO_TEST is not set
852
853#
854# Authenticated Encryption with Associated Data
855#
856# CONFIG_CRYPTO_CCM is not set
857# CONFIG_CRYPTO_GCM is not set
858# CONFIG_CRYPTO_SEQIV is not set
859
860#
861# Block modes
862#
863CONFIG_CRYPTO_CBC=y
864# CONFIG_CRYPTO_CTR is not set
865# CONFIG_CRYPTO_CTS is not set
866CONFIG_CRYPTO_ECB=y
867# CONFIG_CRYPTO_LRW is not set
868CONFIG_CRYPTO_PCBC=y
869# CONFIG_CRYPTO_XTS is not set
870
871#
872# Hash modes
873#
874# CONFIG_CRYPTO_HMAC is not set
875# CONFIG_CRYPTO_XCBC is not set
876
877#
878# Digest
879#
880# CONFIG_CRYPTO_CRC32C is not set
881# CONFIG_CRYPTO_MD4 is not set
882CONFIG_CRYPTO_MD5=y
883# CONFIG_CRYPTO_MICHAEL_MIC is not set
884# CONFIG_CRYPTO_RMD128 is not set
885# CONFIG_CRYPTO_RMD160 is not set
886# CONFIG_CRYPTO_RMD256 is not set
887# CONFIG_CRYPTO_RMD320 is not set
888# CONFIG_CRYPTO_SHA1 is not set
889# CONFIG_CRYPTO_SHA256 is not set
890# CONFIG_CRYPTO_SHA512 is not set
891# CONFIG_CRYPTO_TGR192 is not set
892# CONFIG_CRYPTO_WP512 is not set
893
894#
895# Ciphers
896#
897# CONFIG_CRYPTO_AES is not set
898# CONFIG_CRYPTO_ANUBIS is not set
899# CONFIG_CRYPTO_ARC4 is not set
900# CONFIG_CRYPTO_BLOWFISH is not set
901# CONFIG_CRYPTO_CAMELLIA is not set
902# CONFIG_CRYPTO_CAST5 is not set
903# CONFIG_CRYPTO_CAST6 is not set
904CONFIG_CRYPTO_DES=y
905# CONFIG_CRYPTO_FCRYPT is not set
906# CONFIG_CRYPTO_KHAZAD is not set
907# CONFIG_CRYPTO_SALSA20 is not set
908# CONFIG_CRYPTO_SEED is not set
909# CONFIG_CRYPTO_SERPENT is not set
910# CONFIG_CRYPTO_TEA is not set
911# CONFIG_CRYPTO_TWOFISH is not set
912
913#
914# Compression
915#
916# CONFIG_CRYPTO_DEFLATE is not set
917# CONFIG_CRYPTO_LZO is not set
918CONFIG_CRYPTO_HW=y
919# CONFIG_CRYPTO_DEV_HIFN_795X is not set
920# CONFIG_PPC_CLOCK is not set
921# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/configs/40x/hcu4_defconfig b/arch/powerpc/configs/40x/hcu4_defconfig
new file mode 100644
index 000000000000..682fce02c73a
--- /dev/null
+++ b/arch/powerpc/configs/40x/hcu4_defconfig
@@ -0,0 +1,929 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26.5
4# Tue Sep 16 00:44:33 2008
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11# CONFIG_6xx is not set
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14CONFIG_40x=y
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_4xx=y
18# CONFIG_PPC_MM_SLICES is not set
19CONFIG_NOT_COHERENT_CACHE=y
20CONFIG_PPC32=y
21CONFIG_WORD_SIZE=32
22CONFIG_PPC_MERGE=y
23CONFIG_MMU=y
24CONFIG_GENERIC_CMOS_UPDATE=y
25CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y
29# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
30CONFIG_IRQ_PER_CPU=y
31CONFIG_STACKTRACE_SUPPORT=y
32CONFIG_LOCKDEP_SUPPORT=y
33CONFIG_RWSEM_XCHGADD_ALGORITHM=y
34CONFIG_ARCH_HAS_ILOG2_U32=y
35CONFIG_GENERIC_HWEIGHT=y
36CONFIG_GENERIC_CALIBRATE_DELAY=y
37CONFIG_GENERIC_FIND_NEXT_BIT=y
38# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
39CONFIG_PPC=y
40CONFIG_EARLY_PRINTK=y
41CONFIG_GENERIC_NVRAM=y
42CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
43CONFIG_ARCH_MAY_HAVE_PC_FDC=y
44CONFIG_PPC_OF=y
45CONFIG_OF=y
46CONFIG_PPC_UDBG_16550=y
47# CONFIG_GENERIC_TBSYNC is not set
48CONFIG_AUDIT_ARCH=y
49CONFIG_GENERIC_BUG=y
50# CONFIG_DEFAULT_UIMAGE is not set
51CONFIG_PPC_DCR_NATIVE=y
52# CONFIG_PPC_DCR_MMIO is not set
53CONFIG_PPC_DCR=y
54CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
55
56#
57# General setup
58#
59CONFIG_EXPERIMENTAL=y
60CONFIG_BROKEN_ON_SMP=y
61CONFIG_INIT_ENV_ARG_LIMIT=32
62CONFIG_LOCALVERSION=""
63CONFIG_LOCALVERSION_AUTO=y
64CONFIG_SWAP=y
65CONFIG_SYSVIPC=y
66CONFIG_SYSVIPC_SYSCTL=y
67CONFIG_POSIX_MQUEUE=y
68# CONFIG_BSD_PROCESS_ACCT is not set
69# CONFIG_TASKSTATS is not set
70# CONFIG_AUDIT is not set
71# CONFIG_IKCONFIG is not set
72CONFIG_LOG_BUF_SHIFT=14
73# CONFIG_CGROUPS is not set
74CONFIG_GROUP_SCHED=y
75CONFIG_FAIR_GROUP_SCHED=y
76# CONFIG_RT_GROUP_SCHED is not set
77CONFIG_USER_SCHED=y
78# CONFIG_CGROUP_SCHED is not set
79CONFIG_SYSFS_DEPRECATED=y
80CONFIG_SYSFS_DEPRECATED_V2=y
81# CONFIG_RELAY is not set
82# CONFIG_NAMESPACES is not set
83CONFIG_BLK_DEV_INITRD=y
84CONFIG_INITRAMFS_SOURCE=""
85# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
86CONFIG_SYSCTL=y
87CONFIG_EMBEDDED=y
88CONFIG_SYSCTL_SYSCALL=y
89CONFIG_SYSCTL_SYSCALL_CHECK=y
90CONFIG_KALLSYMS=y
91CONFIG_KALLSYMS_ALL=y
92CONFIG_KALLSYMS_EXTRA_PASS=y
93CONFIG_HOTPLUG=y
94CONFIG_PRINTK=y
95# CONFIG_LOGBUFFER is not set
96CONFIG_BUG=y
97CONFIG_ELF_CORE=y
98CONFIG_COMPAT_BRK=y
99CONFIG_BASE_FULL=y
100CONFIG_FUTEX=y
101CONFIG_ANON_INODES=y
102CONFIG_EPOLL=y
103CONFIG_SIGNALFD=y
104CONFIG_TIMERFD=y
105CONFIG_EVENTFD=y
106CONFIG_SHMEM=y
107CONFIG_VM_EVENT_COUNTERS=y
108CONFIG_SLUB_DEBUG=y
109# CONFIG_SLAB is not set
110CONFIG_SLUB=y
111# CONFIG_SLOB is not set
112# CONFIG_PROFILING is not set
113# CONFIG_MARKERS is not set
114CONFIG_HAVE_OPROFILE=y
115# CONFIG_KPROBES is not set
116CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y
118# CONFIG_HAVE_DMA_ATTRS is not set
119CONFIG_PROC_PAGE_MONITOR=y
120CONFIG_SLABINFO=y
121CONFIG_RT_MUTEXES=y
122# CONFIG_TINY_SHMEM is not set
123CONFIG_BASE_SMALL=0
124CONFIG_MODULES=y
125# CONFIG_MODULE_FORCE_LOAD is not set
126CONFIG_MODULE_UNLOAD=y
127# CONFIG_MODULE_FORCE_UNLOAD is not set
128# CONFIG_MODVERSIONS is not set
129# CONFIG_MODULE_SRCVERSION_ALL is not set
130CONFIG_KMOD=y
131CONFIG_BLOCK=y
132CONFIG_LBD=y
133# CONFIG_BLK_DEV_IO_TRACE is not set
134# CONFIG_LSF is not set
135# CONFIG_BLK_DEV_BSG is not set
136
137#
138# IO Schedulers
139#
140CONFIG_IOSCHED_NOOP=y
141CONFIG_IOSCHED_AS=y
142CONFIG_IOSCHED_DEADLINE=y
143CONFIG_IOSCHED_CFQ=y
144CONFIG_DEFAULT_AS=y
145# CONFIG_DEFAULT_DEADLINE is not set
146# CONFIG_DEFAULT_CFQ is not set
147# CONFIG_DEFAULT_NOOP is not set
148CONFIG_DEFAULT_IOSCHED="anticipatory"
149CONFIG_CLASSIC_RCU=y
150# CONFIG_PPC4xx_PCI_EXPRESS is not set
151
152#
153# Platform support
154#
155# CONFIG_PPC_MPC512x is not set
156# CONFIG_PPC_MPC5121 is not set
157# CONFIG_PPC_CELL is not set
158# CONFIG_PPC_CELL_NATIVE is not set
159# CONFIG_PQ2ADS is not set
160# CONFIG_EP405 is not set
161CONFIG_HCU4=y
162# CONFIG_KILAUEA is not set
163# CONFIG_MAKALU is not set
164# CONFIG_WALNUT is not set
165# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
166# CONFIG_IPIC is not set
167# CONFIG_MPIC is not set
168# CONFIG_MPIC_WEIRD is not set
169# CONFIG_PPC_I8259 is not set
170# CONFIG_PPC_RTAS is not set
171# CONFIG_MMIO_NVRAM is not set
172# CONFIG_PPC_MPC106 is not set
173# CONFIG_PPC_970_NAP is not set
174# CONFIG_PPC_INDIRECT_IO is not set
175# CONFIG_GENERIC_IOMAP is not set
176# CONFIG_CPU_FREQ is not set
177# CONFIG_FSL_ULI1575 is not set
178
179#
180# Kernel options
181#
182# CONFIG_HIGHMEM is not set
183# CONFIG_TICK_ONESHOT is not set
184# CONFIG_NO_HZ is not set
185# CONFIG_HIGH_RES_TIMERS is not set
186CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
187# CONFIG_HZ_100 is not set
188CONFIG_HZ_250=y
189# CONFIG_HZ_300 is not set
190# CONFIG_HZ_1000 is not set
191CONFIG_HZ=250
192# CONFIG_SCHED_HRTICK is not set
193CONFIG_PREEMPT_NONE=y
194# CONFIG_PREEMPT_VOLUNTARY is not set
195# CONFIG_PREEMPT is not set
196CONFIG_BINFMT_ELF=y
197# CONFIG_BINFMT_MISC is not set
198# CONFIG_MATH_EMULATION is not set
199# CONFIG_IOMMU_HELPER is not set
200CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
201CONFIG_ARCH_HAS_WALK_MEMORY=y
202CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
203CONFIG_ARCH_FLATMEM_ENABLE=y
204CONFIG_ARCH_POPULATES_NODE_MAP=y
205CONFIG_SELECT_MEMORY_MODEL=y
206CONFIG_FLATMEM_MANUAL=y
207# CONFIG_DISCONTIGMEM_MANUAL is not set
208# CONFIG_SPARSEMEM_MANUAL is not set
209CONFIG_FLATMEM=y
210CONFIG_FLAT_NODE_MEM_MAP=y
211# CONFIG_SPARSEMEM_STATIC is not set
212# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
213CONFIG_PAGEFLAGS_EXTENDED=y
214CONFIG_SPLIT_PTLOCK_CPUS=4
215CONFIG_RESOURCES_64BIT=y
216CONFIG_ZONE_DMA_FLAG=1
217CONFIG_BOUNCE=y
218CONFIG_VIRT_TO_BUS=y
219CONFIG_FORCE_MAX_ZONEORDER=11
220CONFIG_PROC_DEVICETREE=y
221# CONFIG_CMDLINE_BOOL is not set
222# CONFIG_PM is not set
223CONFIG_SECCOMP=y
224CONFIG_ISA_DMA_API=y
225
226#
227# Bus options
228#
229CONFIG_ZONE_DMA=y
230CONFIG_PPC_INDIRECT_PCI=y
231CONFIG_4xx_SOC=y
232CONFIG_PCI=y
233CONFIG_PCI_DOMAINS=y
234CONFIG_PCI_SYSCALL=y
235# CONFIG_PCIEPORTBUS is not set
236CONFIG_ARCH_SUPPORTS_MSI=y
237# CONFIG_PCI_MSI is not set
238# CONFIG_PCI_LEGACY is not set
239# CONFIG_PCI_DEBUG is not set
240# CONFIG_PCCARD is not set
241# CONFIG_HOTPLUG_PCI is not set
242# CONFIG_HAS_RAPIDIO is not set
243
244#
245# Advanced setup
246#
247# CONFIG_ADVANCED_OPTIONS is not set
248
249#
250# Default settings for advanced configuration options are used
251#
252CONFIG_LOWMEM_SIZE=0x30000000
253CONFIG_PAGE_OFFSET=0xc0000000
254CONFIG_KERNEL_START=0xc0000000
255CONFIG_PHYSICAL_START=0x00000000
256CONFIG_TASK_SIZE=0xc0000000
257CONFIG_CONSISTENT_START=0xff100000
258CONFIG_CONSISTENT_SIZE=0x00200000
259
260#
261# Networking
262#
263CONFIG_NET=y
264
265#
266# Networking options
267#
268CONFIG_PACKET=y
269# CONFIG_PACKET_MMAP is not set
270CONFIG_UNIX=y
271# CONFIG_NET_KEY is not set
272CONFIG_INET=y
273# CONFIG_IP_MULTICAST is not set
274# CONFIG_IP_ADVANCED_ROUTER is not set
275CONFIG_IP_FIB_HASH=y
276CONFIG_IP_PNP=y
277CONFIG_IP_PNP_DHCP=y
278CONFIG_IP_PNP_BOOTP=y
279# CONFIG_IP_PNP_RARP is not set
280# CONFIG_NET_IPIP is not set
281# CONFIG_NET_IPGRE is not set
282# CONFIG_ARPD is not set
283# CONFIG_SYN_COOKIES is not set
284# CONFIG_INET_AH is not set
285# CONFIG_INET_ESP is not set
286# CONFIG_INET_IPCOMP is not set
287# CONFIG_INET_XFRM_TUNNEL is not set
288# CONFIG_INET_TUNNEL is not set
289# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
290# CONFIG_INET_XFRM_MODE_TUNNEL is not set
291# CONFIG_INET_XFRM_MODE_BEET is not set
292# CONFIG_INET_LRO is not set
293CONFIG_INET_DIAG=y
294CONFIG_INET_TCP_DIAG=y
295# CONFIG_TCP_CONG_ADVANCED is not set
296CONFIG_TCP_CONG_CUBIC=y
297CONFIG_DEFAULT_TCP_CONG="cubic"
298# CONFIG_TCP_MD5SIG is not set
299# CONFIG_IPV6 is not set
300# CONFIG_NETWORK_SECMARK is not set
301# CONFIG_NETFILTER is not set
302# CONFIG_IP_DCCP is not set
303# CONFIG_IP_SCTP is not set
304# CONFIG_TIPC is not set
305# CONFIG_ATM is not set
306# CONFIG_BRIDGE is not set
307# CONFIG_VLAN_8021Q is not set
308# CONFIG_DECNET is not set
309# CONFIG_LLC2 is not set
310# CONFIG_IPX is not set
311# CONFIG_ATALK is not set
312# CONFIG_X25 is not set
313# CONFIG_LAPB is not set
314# CONFIG_ECONET is not set
315# CONFIG_WAN_ROUTER is not set
316# CONFIG_NET_SCHED is not set
317
318#
319# Network testing
320#
321# CONFIG_NET_PKTGEN is not set
322# CONFIG_HAMRADIO is not set
323# CONFIG_CAN is not set
324# CONFIG_IRDA is not set
325# CONFIG_BT is not set
326# CONFIG_AF_RXRPC is not set
327
328#
329# Wireless
330#
331# CONFIG_CFG80211 is not set
332# CONFIG_WIRELESS_EXT is not set
333# CONFIG_MAC80211 is not set
334# CONFIG_IEEE80211 is not set
335# CONFIG_RFKILL is not set
336# CONFIG_NET_9P is not set
337
338#
339# Device Drivers
340#
341
342#
343# Generic Driver Options
344#
345CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
346CONFIG_STANDALONE=y
347CONFIG_PREVENT_FIRMWARE_BUILD=y
348CONFIG_FW_LOADER=y
349# CONFIG_DEBUG_DRIVER is not set
350# CONFIG_DEBUG_DEVRES is not set
351# CONFIG_SYS_HYPERVISOR is not set
352CONFIG_CONNECTOR=y
353CONFIG_PROC_EVENTS=y
354CONFIG_MTD=y
355# CONFIG_MTD_DEBUG is not set
356# CONFIG_MTD_CONCAT is not set
357CONFIG_MTD_PARTITIONS=y
358# CONFIG_MTD_REDBOOT_PARTS is not set
359CONFIG_MTD_CMDLINE_PARTS=y
360CONFIG_MTD_OF_PARTS=y
361# CONFIG_MTD_AR7_PARTS is not set
362
363#
364# User Modules And Translation Layers
365#
366CONFIG_MTD_CHAR=y
367CONFIG_MTD_BLKDEVS=m
368CONFIG_MTD_BLOCK=m
369# CONFIG_MTD_BLOCK_RO is not set
370# CONFIG_FTL is not set
371# CONFIG_NFTL is not set
372# CONFIG_INFTL is not set
373# CONFIG_RFD_FTL is not set
374# CONFIG_SSFDC is not set
375# CONFIG_MTD_OOPS is not set
376
377#
378# RAM/ROM/Flash chip drivers
379#
380CONFIG_MTD_CFI=y
381CONFIG_MTD_JEDECPROBE=y
382CONFIG_MTD_GEN_PROBE=y
383# CONFIG_MTD_CFI_ADV_OPTIONS is not set
384CONFIG_MTD_MAP_BANK_WIDTH_1=y
385CONFIG_MTD_MAP_BANK_WIDTH_2=y
386CONFIG_MTD_MAP_BANK_WIDTH_4=y
387# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
388# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
389# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
390CONFIG_MTD_CFI_I1=y
391CONFIG_MTD_CFI_I2=y
392# CONFIG_MTD_CFI_I4 is not set
393# CONFIG_MTD_CFI_I8 is not set
394# CONFIG_MTD_CFI_INTELEXT is not set
395CONFIG_MTD_CFI_AMDSTD=y
396# CONFIG_MTD_CFI_STAA is not set
397CONFIG_MTD_CFI_UTIL=y
398# CONFIG_MTD_RAM is not set
399# CONFIG_MTD_ROM is not set
400# CONFIG_MTD_ABSENT is not set
401
402#
403# Mapping drivers for chip access
404#
405# CONFIG_MTD_COMPLEX_MAPPINGS is not set
406# CONFIG_MTD_PHYSMAP is not set
407CONFIG_MTD_PHYSMAP_OF=y
408# CONFIG_MTD_INTEL_VR_NOR is not set
409# CONFIG_MTD_PLATRAM is not set
410
411#
412# Self-contained MTD device drivers
413#
414# CONFIG_MTD_PMC551 is not set
415# CONFIG_MTD_SLRAM is not set
416# CONFIG_MTD_PHRAM is not set
417# CONFIG_MTD_MTDRAM is not set
418# CONFIG_MTD_BLOCK2MTD is not set
419
420#
421# Disk-On-Chip Device Drivers
422#
423# CONFIG_MTD_DOC2000 is not set
424# CONFIG_MTD_DOC2001 is not set
425# CONFIG_MTD_DOC2001PLUS is not set
426# CONFIG_MTD_NAND is not set
427# CONFIG_MTD_ONENAND is not set
428
429#
430# UBI - Unsorted block images
431#
432# CONFIG_MTD_UBI is not set
433CONFIG_OF_DEVICE=y
434# CONFIG_PARPORT is not set
435CONFIG_BLK_DEV=y
436# CONFIG_BLK_DEV_FD is not set
437# CONFIG_BLK_CPQ_DA is not set
438# CONFIG_BLK_CPQ_CISS_DA is not set
439# CONFIG_BLK_DEV_DAC960 is not set
440# CONFIG_BLK_DEV_UMEM is not set
441# CONFIG_BLK_DEV_COW_COMMON is not set
442# CONFIG_BLK_DEV_LOOP is not set
443# CONFIG_BLK_DEV_NBD is not set
444# CONFIG_BLK_DEV_SX8 is not set
445CONFIG_BLK_DEV_RAM=y
446CONFIG_BLK_DEV_RAM_COUNT=16
447CONFIG_BLK_DEV_RAM_SIZE=35000
448# CONFIG_BLK_DEV_XIP is not set
449# CONFIG_CDROM_PKTCDVD is not set
450# CONFIG_ATA_OVER_ETH is not set
451# CONFIG_XILINX_SYSACE is not set
452CONFIG_MISC_DEVICES=y
453# CONFIG_PHANTOM is not set
454# CONFIG_EEPROM_93CX6 is not set
455# CONFIG_SGI_IOC4 is not set
456# CONFIG_TIFM_CORE is not set
457# CONFIG_ENCLOSURE_SERVICES is not set
458CONFIG_HAVE_IDE=y
459# CONFIG_IDE is not set
460
461#
462# SCSI device support
463#
464# CONFIG_RAID_ATTRS is not set
465# CONFIG_SCSI is not set
466# CONFIG_SCSI_DMA is not set
467# CONFIG_SCSI_NETLINK is not set
468# CONFIG_ATA is not set
469# CONFIG_MD is not set
470# CONFIG_FUSION is not set
471
472#
473# IEEE 1394 (FireWire) support
474#
475
476#
477# Enable only one of the two stacks, unless you know what you are doing
478#
479# CONFIG_FIREWIRE is not set
480# CONFIG_IEEE1394 is not set
481# CONFIG_I2O is not set
482# CONFIG_MACINTOSH_DRIVERS is not set
483CONFIG_NETDEVICES=y
484# CONFIG_NETDEVICES_MULTIQUEUE is not set
485# CONFIG_DUMMY is not set
486# CONFIG_BONDING is not set
487# CONFIG_MACVLAN is not set
488# CONFIG_EQUALIZER is not set
489# CONFIG_TUN is not set
490# CONFIG_VETH is not set
491# CONFIG_ARCNET is not set
492# CONFIG_PHYLIB is not set
493CONFIG_NET_ETHERNET=y
494# CONFIG_MII is not set
495# CONFIG_HAPPYMEAL is not set
496# CONFIG_SUNGEM is not set
497# CONFIG_CASSINI is not set
498# CONFIG_NET_VENDOR_3COM is not set
499# CONFIG_NET_TULIP is not set
500# CONFIG_HP100 is not set
501CONFIG_IBM_NEW_EMAC=y
502CONFIG_IBM_NEW_EMAC_RXB=128
503CONFIG_IBM_NEW_EMAC_TXB=64
504CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32
505CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256
506CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
507# CONFIG_IBM_NEW_EMAC_DEBUG is not set
508# CONFIG_IBM_NEW_EMAC_ZMII is not set
509# CONFIG_IBM_NEW_EMAC_RGMII is not set
510# CONFIG_IBM_NEW_EMAC_TAH is not set
511# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
512# CONFIG_NET_PCI is not set
513# CONFIG_B44 is not set
514CONFIG_NETDEV_1000=y
515# CONFIG_ACENIC is not set
516# CONFIG_DL2K is not set
517# CONFIG_E1000 is not set
518# CONFIG_E1000E is not set
519# CONFIG_E1000E_ENABLED is not set
520# CONFIG_IP1000 is not set
521# CONFIG_IGB is not set
522# CONFIG_NS83820 is not set
523# CONFIG_HAMACHI is not set
524# CONFIG_YELLOWFIN is not set
525# CONFIG_R8169 is not set
526# CONFIG_SIS190 is not set
527# CONFIG_SKGE is not set
528# CONFIG_SKY2 is not set
529# CONFIG_VIA_VELOCITY is not set
530# CONFIG_TIGON3 is not set
531# CONFIG_BNX2 is not set
532# CONFIG_QLA3XXX is not set
533# CONFIG_ATL1 is not set
534CONFIG_NETDEV_10000=y
535# CONFIG_CHELSIO_T1 is not set
536# CONFIG_CHELSIO_T3 is not set
537# CONFIG_IXGBE is not set
538# CONFIG_IXGB is not set
539# CONFIG_S2IO is not set
540# CONFIG_MYRI10GE is not set
541# CONFIG_NETXEN_NIC is not set
542# CONFIG_NIU is not set
543# CONFIG_MLX4_CORE is not set
544# CONFIG_TEHUTI is not set
545# CONFIG_BNX2X is not set
546# CONFIG_SFC is not set
547# CONFIG_TR is not set
548
549#
550# Wireless LAN
551#
552# CONFIG_WLAN_PRE80211 is not set
553# CONFIG_WLAN_80211 is not set
554# CONFIG_IWLWIFI_LEDS is not set
555# CONFIG_WAN is not set
556# CONFIG_FDDI is not set
557# CONFIG_HIPPI is not set
558# CONFIG_PPP is not set
559# CONFIG_SLIP is not set
560# CONFIG_NETCONSOLE is not set
561# CONFIG_NETPOLL is not set
562# CONFIG_NET_POLL_CONTROLLER is not set
563# CONFIG_ISDN is not set
564# CONFIG_PHONE is not set
565
566#
567# Input device support
568#
569# CONFIG_INPUT is not set
570
571#
572# Hardware I/O ports
573#
574# CONFIG_SERIO is not set
575# CONFIG_GAMEPORT is not set
576
577#
578# Character devices
579#
580# CONFIG_VT is not set
581CONFIG_DEVKMEM=y
582# CONFIG_SERIAL_NONSTANDARD is not set
583# CONFIG_NOZOMI is not set
584
585#
586# Serial drivers
587#
588CONFIG_SERIAL_8250=y
589CONFIG_SERIAL_8250_CONSOLE=y
590CONFIG_SERIAL_8250_PCI=y
591CONFIG_SERIAL_8250_NR_UARTS=4
592CONFIG_SERIAL_8250_RUNTIME_UARTS=4
593CONFIG_SERIAL_8250_EXTENDED=y
594# CONFIG_SERIAL_8250_MANY_PORTS is not set
595CONFIG_SERIAL_8250_SHARE_IRQ=y
596# CONFIG_SERIAL_8250_DETECT_IRQ is not set
597# CONFIG_SERIAL_8250_RSA is not set
598
599#
600# Non-8250 serial port support
601#
602# CONFIG_SERIAL_UARTLITE is not set
603CONFIG_SERIAL_CORE=y
604CONFIG_SERIAL_CORE_CONSOLE=y
605# CONFIG_SERIAL_JSM is not set
606CONFIG_SERIAL_OF_PLATFORM=y
607CONFIG_UNIX98_PTYS=y
608CONFIG_LEGACY_PTYS=y
609CONFIG_LEGACY_PTY_COUNT=256
610# CONFIG_IPMI_HANDLER is not set
611# CONFIG_HW_RANDOM is not set
612# CONFIG_NVRAM is not set
613# CONFIG_GEN_RTC is not set
614# CONFIG_R3964 is not set
615# CONFIG_APPLICOM is not set
616# CONFIG_RAW_DRIVER is not set
617# CONFIG_TCG_TPM is not set
618CONFIG_DEVPORT=y
619# CONFIG_I2C is not set
620# CONFIG_SPI is not set
621# CONFIG_W1 is not set
622# CONFIG_POWER_SUPPLY is not set
623# CONFIG_HWMON is not set
624# CONFIG_THERMAL is not set
625# CONFIG_THERMAL_HWMON is not set
626# CONFIG_WATCHDOG is not set
627
628#
629# Sonics Silicon Backplane
630#
631CONFIG_SSB_POSSIBLE=y
632# CONFIG_SSB is not set
633
634#
635# Multifunction device drivers
636#
637# CONFIG_MFD_SM501 is not set
638# CONFIG_HTC_PASIC3 is not set
639
640#
641# Multimedia devices
642#
643
644#
645# Multimedia core support
646#
647# CONFIG_VIDEO_DEV is not set
648# CONFIG_DVB_CORE is not set
649# CONFIG_VIDEO_MEDIA is not set
650
651#
652# Multimedia drivers
653#
654# CONFIG_DAB is not set
655
656#
657# Graphics support
658#
659# CONFIG_AGP is not set
660# CONFIG_DRM is not set
661# CONFIG_VGASTATE is not set
662CONFIG_VIDEO_OUTPUT_CONTROL=m
663# CONFIG_FB is not set
664# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
665
666#
667# Display device support
668#
669# CONFIG_DISPLAY_SUPPORT is not set
670
671#
672# Sound
673#
674# CONFIG_SOUND is not set
675# CONFIG_USB_SUPPORT is not set
676# CONFIG_MMC is not set
677# CONFIG_MEMSTICK is not set
678# CONFIG_NEW_LEDS is not set
679# CONFIG_ACCESSIBILITY is not set
680# CONFIG_INFINIBAND is not set
681# CONFIG_EDAC is not set
682# CONFIG_RTC_CLASS is not set
683# CONFIG_DMADEVICES is not set
684# CONFIG_UIO is not set
685
686#
687# File systems
688#
689CONFIG_EXT2_FS=y
690# CONFIG_EXT2_FS_XATTR is not set
691# CONFIG_EXT2_FS_XIP is not set
692# CONFIG_EXT3_FS is not set
693# CONFIG_EXT4DEV_FS is not set
694# CONFIG_REISERFS_FS is not set
695# CONFIG_JFS_FS is not set
696# CONFIG_FS_POSIX_ACL is not set
697# CONFIG_XFS_FS is not set
698# CONFIG_OCFS2_FS is not set
699CONFIG_DNOTIFY=y
700CONFIG_INOTIFY=y
701CONFIG_INOTIFY_USER=y
702# CONFIG_QUOTA is not set
703# CONFIG_AUTOFS_FS is not set
704# CONFIG_AUTOFS4_FS is not set
705# CONFIG_FUSE_FS is not set
706
707#
708# CD-ROM/DVD Filesystems
709#
710# CONFIG_ISO9660_FS is not set
711# CONFIG_UDF_FS is not set
712
713#
714# DOS/FAT/NT Filesystems
715#
716# CONFIG_MSDOS_FS is not set
717# CONFIG_VFAT_FS is not set
718# CONFIG_NTFS_FS is not set
719
720#
721# Pseudo filesystems
722#
723CONFIG_PROC_FS=y
724CONFIG_PROC_KCORE=y
725CONFIG_PROC_SYSCTL=y
726CONFIG_SYSFS=y
727CONFIG_TMPFS=y
728# CONFIG_TMPFS_POSIX_ACL is not set
729# CONFIG_HUGETLB_PAGE is not set
730# CONFIG_CONFIGFS_FS is not set
731
732#
733# Miscellaneous filesystems
734#
735# CONFIG_ADFS_FS is not set
736# CONFIG_AFFS_FS is not set
737# CONFIG_HFS_FS is not set
738# CONFIG_HFSPLUS_FS is not set
739# CONFIG_BEFS_FS is not set
740# CONFIG_BFS_FS is not set
741# CONFIG_EFS_FS is not set
742# CONFIG_YAFFS_FS is not set
743# CONFIG_JFFS2_FS is not set
744CONFIG_CRAMFS=y
745# CONFIG_VXFS_FS is not set
746# CONFIG_MINIX_FS is not set
747# CONFIG_HPFS_FS is not set
748# CONFIG_QNX4FS_FS is not set
749# CONFIG_ROMFS_FS is not set
750# CONFIG_SYSV_FS is not set
751# CONFIG_UFS_FS is not set
752CONFIG_NETWORK_FILESYSTEMS=y
753CONFIG_NFS_FS=y
754CONFIG_NFS_V3=y
755# CONFIG_NFS_V3_ACL is not set
756# CONFIG_NFS_V4 is not set
757# CONFIG_NFSD is not set
758CONFIG_ROOT_NFS=y
759CONFIG_LOCKD=y
760CONFIG_LOCKD_V4=y
761CONFIG_NFS_COMMON=y
762CONFIG_SUNRPC=y
763# CONFIG_SUNRPC_BIND34 is not set
764# CONFIG_RPCSEC_GSS_KRB5 is not set
765# CONFIG_RPCSEC_GSS_SPKM3 is not set
766# CONFIG_SMB_FS is not set
767# CONFIG_CIFS is not set
768# CONFIG_NCP_FS is not set
769# CONFIG_CODA_FS is not set
770# CONFIG_AFS_FS is not set
771
772#
773# Partition Types
774#
775# CONFIG_PARTITION_ADVANCED is not set
776CONFIG_MSDOS_PARTITION=y
777# CONFIG_NLS is not set
778# CONFIG_DLM is not set
779
780#
781# Library routines
782#
783CONFIG_BITREVERSE=y
784# CONFIG_GENERIC_FIND_FIRST_BIT is not set
785# CONFIG_CRC_CCITT is not set
786# CONFIG_CRC16 is not set
787# CONFIG_CRC_ITU_T is not set
788CONFIG_CRC32=y
789# CONFIG_CRC7 is not set
790# CONFIG_LIBCRC32C is not set
791CONFIG_ZLIB_INFLATE=y
792CONFIG_PLIST=y
793CONFIG_HAS_IOMEM=y
794CONFIG_HAS_IOPORT=y
795CONFIG_HAS_DMA=y
796CONFIG_HAVE_LMB=y
797
798#
799# Kernel hacking
800#
801# CONFIG_PRINTK_TIME is not set
802CONFIG_ENABLE_WARN_DEPRECATED=y
803CONFIG_ENABLE_MUST_CHECK=y
804CONFIG_FRAME_WARN=1024
805CONFIG_MAGIC_SYSRQ=y
806# CONFIG_UNUSED_SYMBOLS is not set
807CONFIG_DEBUG_FS=y
808# CONFIG_HEADERS_CHECK is not set
809CONFIG_DEBUG_KERNEL=y
810# CONFIG_DEBUG_SHIRQ is not set
811CONFIG_DETECT_SOFTLOCKUP=y
812CONFIG_SCHED_DEBUG=y
813# CONFIG_SCHEDSTATS is not set
814# CONFIG_TIMER_STATS is not set
815# CONFIG_DEBUG_OBJECTS is not set
816# CONFIG_SLUB_DEBUG_ON is not set
817# CONFIG_SLUB_STATS is not set
818# CONFIG_DEBUG_RT_MUTEXES is not set
819# CONFIG_RT_MUTEX_TESTER is not set
820# CONFIG_DEBUG_SPINLOCK is not set
821# CONFIG_DEBUG_MUTEXES is not set
822# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
823# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
824# CONFIG_DEBUG_KOBJECT is not set
825CONFIG_DEBUG_BUGVERBOSE=y
826# CONFIG_DEBUG_INFO is not set
827# CONFIG_DEBUG_VM is not set
828# CONFIG_DEBUG_WRITECOUNT is not set
829# CONFIG_DEBUG_LIST is not set
830# CONFIG_DEBUG_SG is not set
831# CONFIG_BOOT_PRINTK_DELAY is not set
832# CONFIG_RCU_TORTURE_TEST is not set
833# CONFIG_BACKTRACE_SELF_TEST is not set
834# CONFIG_FAULT_INJECTION is not set
835# CONFIG_SAMPLES is not set
836# CONFIG_DEBUG_STACKOVERFLOW is not set
837# CONFIG_DEBUG_STACK_USAGE is not set
838# CONFIG_DEBUG_PAGEALLOC is not set
839# CONFIG_DEBUGGER is not set
840# CONFIG_IRQSTACKS is not set
841# CONFIG_VIRQ_DEBUG is not set
842# CONFIG_BDI_SWITCH is not set
843# CONFIG_PPC_EARLY_DEBUG is not set
844
845#
846# Security options
847#
848# CONFIG_KEYS is not set
849# CONFIG_SECURITY is not set
850# CONFIG_SECURITY_FILE_CAPABILITIES is not set
851CONFIG_CRYPTO=y
852
853#
854# Crypto core or helper
855#
856CONFIG_CRYPTO_ALGAPI=y
857CONFIG_CRYPTO_BLKCIPHER=y
858CONFIG_CRYPTO_MANAGER=y
859# CONFIG_CRYPTO_GF128MUL is not set
860# CONFIG_CRYPTO_NULL is not set
861# CONFIG_CRYPTO_CRYPTD is not set
862# CONFIG_CRYPTO_AUTHENC is not set
863# CONFIG_CRYPTO_TEST is not set
864
865#
866# Authenticated Encryption with Associated Data
867#
868# CONFIG_CRYPTO_CCM is not set
869# CONFIG_CRYPTO_GCM is not set
870# CONFIG_CRYPTO_SEQIV is not set
871
872#
873# Block modes
874#
875CONFIG_CRYPTO_CBC=y
876# CONFIG_CRYPTO_CTR is not set
877# CONFIG_CRYPTO_CTS is not set
878CONFIG_CRYPTO_ECB=y
879# CONFIG_CRYPTO_LRW is not set
880CONFIG_CRYPTO_PCBC=y
881# CONFIG_CRYPTO_XTS is not set
882
883#
884# Hash modes
885#
886# CONFIG_CRYPTO_HMAC is not set
887# CONFIG_CRYPTO_XCBC is not set
888
889#
890# Digest
891#
892# CONFIG_CRYPTO_CRC32C is not set
893# CONFIG_CRYPTO_MD4 is not set
894CONFIG_CRYPTO_MD5=y
895# CONFIG_CRYPTO_MICHAEL_MIC is not set
896# CONFIG_CRYPTO_SHA1 is not set
897# CONFIG_CRYPTO_SHA256 is not set
898# CONFIG_CRYPTO_SHA512 is not set
899# CONFIG_CRYPTO_TGR192 is not set
900# CONFIG_CRYPTO_WP512 is not set
901
902#
903# Ciphers
904#
905# CONFIG_CRYPTO_AES is not set
906# CONFIG_CRYPTO_ANUBIS is not set
907# CONFIG_CRYPTO_ARC4 is not set
908# CONFIG_CRYPTO_BLOWFISH is not set
909# CONFIG_CRYPTO_CAMELLIA is not set
910# CONFIG_CRYPTO_CAST5 is not set
911# CONFIG_CRYPTO_CAST6 is not set
912CONFIG_CRYPTO_DES=y
913# CONFIG_CRYPTO_FCRYPT is not set
914# CONFIG_CRYPTO_KHAZAD is not set
915# CONFIG_CRYPTO_SALSA20 is not set
916# CONFIG_CRYPTO_SEED is not set
917# CONFIG_CRYPTO_SERPENT is not set
918# CONFIG_CRYPTO_TEA is not set
919# CONFIG_CRYPTO_TWOFISH is not set
920
921#
922# Compression
923#
924# CONFIG_CRYPTO_DEFLATE is not set
925# CONFIG_CRYPTO_LZO is not set
926CONFIG_CRYPTO_HW=y
927# CONFIG_CRYPTO_DEV_HIFN_795X is not set
928# CONFIG_PPC_CLOCK is not set
929# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/include/asm/kdump.h b/arch/powerpc/include/asm/kdump.h
index f6c93c716898..a503da9d56f3 100644
--- a/arch/powerpc/include/asm/kdump.h
+++ b/arch/powerpc/include/asm/kdump.h
@@ -9,6 +9,12 @@
9 * Reserve to the end of the FWNMI area, see head_64.S */ 9 * Reserve to the end of the FWNMI area, see head_64.S */
10#define KDUMP_RESERVE_LIMIT 0x10000 /* 64K */ 10#define KDUMP_RESERVE_LIMIT 0x10000 /* 64K */
11 11
12/*
13 * Used to differentiate between relocatable kdump kernel and other
14 * kernels
15 */
16#define KDUMP_SIGNATURE 0xfeed1234
17
12#ifdef CONFIG_CRASH_DUMP 18#ifdef CONFIG_CRASH_DUMP
13 19
14#define KDUMP_TRAMPOLINE_START 0x0100 20#define KDUMP_TRAMPOLINE_START 0x0100
@@ -19,17 +25,18 @@
19#endif /* CONFIG_CRASH_DUMP */ 25#endif /* CONFIG_CRASH_DUMP */
20 26
21#ifndef __ASSEMBLY__ 27#ifndef __ASSEMBLY__
22#ifdef CONFIG_CRASH_DUMP
23 28
29extern unsigned long __kdump_flag;
30
31#if defined(CONFIG_CRASH_DUMP) && !defined(CONFIG_RELOCATABLE)
24extern void reserve_kdump_trampoline(void); 32extern void reserve_kdump_trampoline(void);
25extern void setup_kdump_trampoline(void); 33extern void setup_kdump_trampoline(void);
26 34#else
27#else /* !CONFIG_CRASH_DUMP */ 35/* !CRASH_DUMP || RELOCATABLE */
28
29static inline void reserve_kdump_trampoline(void) { ; } 36static inline void reserve_kdump_trampoline(void) { ; }
30static inline void setup_kdump_trampoline(void) { ; } 37static inline void setup_kdump_trampoline(void) { ; }
38#endif
31 39
32#endif /* CONFIG_CRASH_DUMP */
33#endif /* __ASSEMBLY__ */ 40#endif /* __ASSEMBLY__ */
34 41
35#endif /* __PPC64_KDUMP_H */ 42#endif /* __PPC64_KDUMP_H */
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 5ac51e6efc1d..c0b8d4a29a91 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -77,6 +77,7 @@
77 77
78#if defined(CONFIG_RELOCATABLE) 78#if defined(CONFIG_RELOCATABLE)
79#ifndef __ASSEMBLY__ 79#ifndef __ASSEMBLY__
80
80extern phys_addr_t memstart_addr; 81extern phys_addr_t memstart_addr;
81extern phys_addr_t kernstart_addr; 82extern phys_addr_t kernstart_addr;
82#endif 83#endif
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index e70d0483fb4e..b1eb834bc0fc 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1277,6 +1277,19 @@ static struct cpu_spec __initdata cpu_specs[] = {
1277 .machine_check = machine_check_4xx, 1277 .machine_check = machine_check_4xx,
1278 .platform = "ppc405", 1278 .platform = "ppc405",
1279 }, 1279 },
1280 {
1281 /* 405EZ */
1282 .pvr_mask = 0xffff0000,
1283 .pvr_value = 0x41510000,
1284 .cpu_name = "405EZ",
1285 .cpu_features = CPU_FTRS_40X,
1286 .cpu_user_features = PPC_FEATURE_32 |
1287 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1288 .icache_bsize = 32,
1289 .dcache_bsize = 32,
1290 .machine_check = machine_check_4xx,
1291 .platform = "ppc405",
1292 },
1280 { /* default match */ 1293 { /* default match */
1281 .pvr_mask = 0x00000000, 1294 .pvr_mask = 0x00000000,
1282 .pvr_value = 0x00000000, 1295 .pvr_value = 0x00000000,
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 97e056379728..19671aca6591 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -30,6 +30,7 @@
30/* Stores the physical address of elf header of crash image. */ 30/* Stores the physical address of elf header of crash image. */
31unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; 31unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
32 32
33#ifndef CONFIG_RELOCATABLE
33void __init reserve_kdump_trampoline(void) 34void __init reserve_kdump_trampoline(void)
34{ 35{
35 lmb_reserve(0, KDUMP_RESERVE_LIMIT); 36 lmb_reserve(0, KDUMP_RESERVE_LIMIT);
@@ -68,6 +69,7 @@ void __init setup_kdump_trampoline(void)
68 69
69 DBG(" <- setup_kdump_trampoline()\n"); 70 DBG(" <- setup_kdump_trampoline()\n");
70} 71}
72#endif /* CONFIG_RELOCATABLE */
71 73
72/* 74/*
73 * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by 75 * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 84856bee33a5..69489bd3210c 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -97,6 +97,12 @@ __secondary_hold_spinloop:
97__secondary_hold_acknowledge: 97__secondary_hold_acknowledge:
98 .llong 0x0 98 .llong 0x0
99 99
100 /* This flag is set by purgatory if we should be a kdump kernel. */
101 /* Do not move this variable as purgatory knows about it. */
102 .globl __kdump_flag
103__kdump_flag:
104 .llong 0x0
105
100#ifdef CONFIG_PPC_ISERIES 106#ifdef CONFIG_PPC_ISERIES
101 /* 107 /*
102 * At offset 0x20, there is a pointer to iSeries LPAR data. 108 * At offset 0x20, there is a pointer to iSeries LPAR data.
@@ -1384,7 +1390,13 @@ _STATIC(__after_prom_start)
1384 /* process relocations for the final address of the kernel */ 1390 /* process relocations for the final address of the kernel */
1385 lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */ 1391 lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */
1386 sldi r25,r25,32 1392 sldi r25,r25,32
1387 mr r3,r25 1393#ifdef CONFIG_CRASH_DUMP
1394 ld r7,__kdump_flag-_stext(r26)
1395 cmpldi cr0,r7,1 /* kdump kernel ? - stay where we are */
1396 bne 1f
1397 add r25,r25,r26
1398#endif
13991: mr r3,r25
1388 bl .relocate 1400 bl .relocate
1389#endif 1401#endif
1390 1402
@@ -1398,11 +1410,26 @@ _STATIC(__after_prom_start)
1398 li r3,0 /* target addr */ 1410 li r3,0 /* target addr */
1399 mr. r4,r26 /* In some cases the loader may */ 1411 mr. r4,r26 /* In some cases the loader may */
1400 beq 9f /* have already put us at zero */ 1412 beq 9f /* have already put us at zero */
1401 lis r5,(copy_to_here - _stext)@ha
1402 addi r5,r5,(copy_to_here - _stext)@l /* # bytes of memory to copy */
1403 li r6,0x100 /* Start offset, the first 0x100 */ 1413 li r6,0x100 /* Start offset, the first 0x100 */
1404 /* bytes were copied earlier. */ 1414 /* bytes were copied earlier. */
1405 1415
1416#ifdef CONFIG_CRASH_DUMP
1417/*
1418 * Check if the kernel has to be running as relocatable kernel based on the
1419 * variable __kdump_flag, if it is set the kernel is treated as relocatable
1420 * kernel, otherwise it will be moved to PHYSICAL_START
1421 */
1422 ld r7,__kdump_flag-_stext(r26)
1423 cmpldi cr0,r7,1
1424 bne 3f
1425
1426 li r5,__end_interrupts - _stext /* just copy interrupts */
1427 b 5f
14283:
1429#endif
1430 lis r5,(copy_to_here - _stext)@ha
1431 addi r5,r5,(copy_to_here - _stext)@l /* # bytes of memory to copy */
1432
1406 bl .copy_and_flush /* copy the first n bytes */ 1433 bl .copy_and_flush /* copy the first n bytes */
1407 /* this includes the code being */ 1434 /* this includes the code being */
1408 /* executed here. */ 1435 /* executed here. */
@@ -1411,15 +1438,15 @@ _STATIC(__after_prom_start)
1411 mtctr r8 1438 mtctr r8
1412 bctr 1439 bctr
1413 1440
1441p_end: .llong _end - _stext
1442
14144: /* Now copy the rest of the kernel up to _end */ 14434: /* Now copy the rest of the kernel up to _end */
1415 addis r5,r26,(p_end - _stext)@ha 1444 addis r5,r26,(p_end - _stext)@ha
1416 ld r5,(p_end - _stext)@l(r5) /* get _end */ 1445 ld r5,(p_end - _stext)@l(r5) /* get _end */
1417 bl .copy_and_flush /* copy the rest */ 14465: bl .copy_and_flush /* copy the rest */
1418 1447
14199: b .start_here_multiplatform 14489: b .start_here_multiplatform
1420 1449
1421p_end: .llong _end - _stext
1422
1423/* 1450/*
1424 * Copy routine used to copy the kernel to start at physical address 0 1451 * Copy routine used to copy the kernel to start at physical address 0
1425 * and flush and invalidate the caches as needed. 1452 * and flush and invalidate the caches as needed.
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index ea1ba89f9c90..3857d7e2af0c 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -458,6 +458,42 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
458 spin_unlock_irqrestore(&(tbl->it_lock), flags); 458 spin_unlock_irqrestore(&(tbl->it_lock), flags);
459} 459}
460 460
461static void iommu_table_clear(struct iommu_table *tbl)
462{
463 if (!__kdump_flag) {
464 /* Clear the table in case firmware left allocations in it */
465 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
466 return;
467 }
468
469#ifdef CONFIG_CRASH_DUMP
470 if (ppc_md.tce_get) {
471 unsigned long index, tceval, tcecount = 0;
472
473 /* Reserve the existing mappings left by the first kernel. */
474 for (index = 0; index < tbl->it_size; index++) {
475 tceval = ppc_md.tce_get(tbl, index + tbl->it_offset);
476 /*
477 * Freed TCE entry contains 0x7fffffffffffffff on JS20
478 */
479 if (tceval && (tceval != 0x7fffffffffffffffUL)) {
480 __set_bit(index, tbl->it_map);
481 tcecount++;
482 }
483 }
484
485 if ((tbl->it_size - tcecount) < KDUMP_MIN_TCE_ENTRIES) {
486 printk(KERN_WARNING "TCE table is full; freeing ");
487 printk(KERN_WARNING "%d entries for the kdump boot\n",
488 KDUMP_MIN_TCE_ENTRIES);
489 for (index = tbl->it_size - KDUMP_MIN_TCE_ENTRIES;
490 index < tbl->it_size; index++)
491 __clear_bit(index, tbl->it_map);
492 }
493 }
494#endif
495}
496
461/* 497/*
462 * Build a iommu_table structure. This contains a bit map which 498 * Build a iommu_table structure. This contains a bit map which
463 * is used to manage allocation of the tce space. 499 * is used to manage allocation of the tce space.
@@ -484,38 +520,7 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
484 tbl->it_largehint = tbl->it_halfpoint; 520 tbl->it_largehint = tbl->it_halfpoint;
485 spin_lock_init(&tbl->it_lock); 521 spin_lock_init(&tbl->it_lock);
486 522
487#ifdef CONFIG_CRASH_DUMP 523 iommu_table_clear(tbl);
488 if (ppc_md.tce_get) {
489 unsigned long index;
490 unsigned long tceval;
491 unsigned long tcecount = 0;
492
493 /*
494 * Reserve the existing mappings left by the first kernel.
495 */
496 for (index = 0; index < tbl->it_size; index++) {
497 tceval = ppc_md.tce_get(tbl, index + tbl->it_offset);
498 /*
499 * Freed TCE entry contains 0x7fffffffffffffff on JS20
500 */
501 if (tceval && (tceval != 0x7fffffffffffffffUL)) {
502 __set_bit(index, tbl->it_map);
503 tcecount++;
504 }
505 }
506 if ((tbl->it_size - tcecount) < KDUMP_MIN_TCE_ENTRIES) {
507 printk(KERN_WARNING "TCE table is full; ");
508 printk(KERN_WARNING "freeing %d entries for the kdump boot\n",
509 KDUMP_MIN_TCE_ENTRIES);
510 for (index = tbl->it_size - KDUMP_MIN_TCE_ENTRIES;
511 index < tbl->it_size; index++)
512 __clear_bit(index, tbl->it_map);
513 }
514 }
515#else
516 /* Clear the hardware table in case firmware left allocations in it */
517 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
518#endif
519 524
520 if (!welcomed) { 525 if (!welcomed) {
521 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n", 526 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n",
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index aab76887a842..ac2a21f45c75 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -88,11 +88,13 @@ void __init reserve_crashkernel(void)
88 88
89 crash_size = crashk_res.end - crashk_res.start + 1; 89 crash_size = crashk_res.end - crashk_res.start + 1;
90 90
91#ifndef CONFIG_RELOCATABLE
91 if (crashk_res.start != KDUMP_KERNELBASE) 92 if (crashk_res.start != KDUMP_KERNELBASE)
92 printk("Crash kernel location must be 0x%x\n", 93 printk("Crash kernel location must be 0x%x\n",
93 KDUMP_KERNELBASE); 94 KDUMP_KERNELBASE);
94 95
95 crashk_res.start = KDUMP_KERNELBASE; 96 crashk_res.start = KDUMP_KERNELBASE;
97#endif
96 crash_size = PAGE_ALIGN(crash_size); 98 crash_size = PAGE_ALIGN(crash_size);
97 crashk_res.end = crashk_res.start + crash_size - 1; 99 crashk_res.end = crashk_res.start + crash_size - 1;
98 100
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index a168514d8609..e6efec788c4d 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -255,11 +255,14 @@ static union thread_union kexec_stack
255/* Our assembly helper, in kexec_stub.S */ 255/* Our assembly helper, in kexec_stub.S */
256extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start, 256extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start,
257 void *image, void *control, 257 void *image, void *control,
258 void (*clear_all)(void)) ATTRIB_NORET; 258 void (*clear_all)(void),
259 unsigned long kdump_flag) ATTRIB_NORET;
259 260
260/* too late to fail here */ 261/* too late to fail here */
261void default_machine_kexec(struct kimage *image) 262void default_machine_kexec(struct kimage *image)
262{ 263{
264 unsigned long kdump_flag = 0;
265
263 /* prepare control code if any */ 266 /* prepare control code if any */
264 267
265 /* 268 /*
@@ -270,8 +273,10 @@ void default_machine_kexec(struct kimage *image)
270 * using debugger IPI. 273 * using debugger IPI.
271 */ 274 */
272 275
273 if (crashing_cpu == -1) 276 if (crashing_cpu == -1)
274 kexec_prepare_cpus(); 277 kexec_prepare_cpus();
278 else
279 kdump_flag = KDUMP_SIGNATURE;
275 280
276 /* switch to a staticly allocated stack. Based on irq stack code. 281 /* switch to a staticly allocated stack. Based on irq stack code.
277 * XXX: the task struct will likely be invalid once we do the copy! 282 * XXX: the task struct will likely be invalid once we do the copy!
@@ -284,7 +289,7 @@ void default_machine_kexec(struct kimage *image)
284 */ 289 */
285 kexec_sequence(&kexec_stack, image->start, image, 290 kexec_sequence(&kexec_stack, image->start, image,
286 page_address(image->control_code_page), 291 page_address(image->control_code_page),
287 ppc_md.hpte_clear_all); 292 ppc_md.hpte_clear_all, kdump_flag);
288 /* NOTREACHED */ 293 /* NOTREACHED */
289} 294}
290 295
@@ -312,11 +317,24 @@ static struct property kernel_end_prop = {
312static void __init export_htab_values(void) 317static void __init export_htab_values(void)
313{ 318{
314 struct device_node *node; 319 struct device_node *node;
320 struct property *prop;
315 321
316 node = of_find_node_by_path("/chosen"); 322 node = of_find_node_by_path("/chosen");
317 if (!node) 323 if (!node)
318 return; 324 return;
319 325
326 /* remove any stale propertys so ours can be found */
327 prop = of_find_property(node, kernel_end_prop.name, NULL);
328 if (prop)
329 prom_remove_property(node, prop);
330 prop = of_find_property(node, htab_base_prop.name, NULL);
331 if (prop)
332 prom_remove_property(node, prop);
333 prop = of_find_property(node, htab_size_prop.name, NULL);
334 if (prop)
335 prom_remove_property(node, prop);
336
337 /* information needed by userspace when using default_machine_kexec */
320 kernel_end = __pa(_end); 338 kernel_end = __pa(_end);
321 prom_add_property(node, &kernel_end_prop); 339 prom_add_property(node, &kernel_end_prop);
322 340
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 3053fe5c62f2..a243fd072a77 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -611,10 +611,12 @@ real_mode: /* assume normal blr return */
611 611
612 612
613/* 613/*
614 * kexec_sequence(newstack, start, image, control, clear_all()) 614 * kexec_sequence(newstack, start, image, control, clear_all(), kdump_flag)
615 * 615 *
616 * does the grungy work with stack switching and real mode switches 616 * does the grungy work with stack switching and real mode switches
617 * also does simple calls to other code 617 * also does simple calls to other code
618 *
619 * kdump_flag says whether the next kernel should be a kdump kernel.
618 */ 620 */
619 621
620_GLOBAL(kexec_sequence) 622_GLOBAL(kexec_sequence)
@@ -647,7 +649,7 @@ _GLOBAL(kexec_sequence)
647 mr r29,r5 /* image (virt) */ 649 mr r29,r5 /* image (virt) */
648 mr r28,r6 /* control, unused */ 650 mr r28,r6 /* control, unused */
649 mr r27,r7 /* clear_all() fn desc */ 651 mr r27,r7 /* clear_all() fn desc */
650 mr r26,r8 /* spare */ 652 mr r26,r8 /* kdump flag */
651 lhz r25,PACAHWCPUID(r13) /* get our phys cpu from paca */ 653 lhz r25,PACAHWCPUID(r13) /* get our phys cpu from paca */
652 654
653 /* disable interrupts, we are overwriting kernel data next */ 655 /* disable interrupts, we are overwriting kernel data next */
@@ -709,5 +711,6 @@ _GLOBAL(kexec_sequence)
709 mr r4,r30 # start, aka phys mem offset 711 mr r4,r30 # start, aka phys mem offset
710 mtlr 4 712 mtlr 4
711 li r5,0 713 li r5,0
712 blr /* image->start(physid, image->start, 0); */ 714 mr r6,r26 /* kdump_flag */
715 blr /* image->start(physid, image->start, 0, kdump_flag); */
713#endif /* CONFIG_KEXEC */ 716#endif /* CONFIG_KEXEC */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 3815d84a1ef4..1ec73938a00f 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -610,7 +610,8 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus,
610 pr_debug(" -> mapping phys %llx\n", (unsigned long long)offset); 610 pr_debug(" -> mapping phys %llx\n", (unsigned long long)offset);
611 611
612 vma->vm_pgoff = offset >> PAGE_SHIFT; 612 vma->vm_pgoff = offset >> PAGE_SHIFT;
613 vma->vm_page_prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; 613 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
614 | _PAGE_NO_CACHE | _PAGE_GUARDED);
614 return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 615 return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
615 vma->vm_end - vma->vm_start, 616 vma->vm_end - vma->vm_start,
616 vma->vm_page_prot); 617 vma->vm_page_prot);
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 2fdbc18ae94a..23e0db203329 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -487,67 +487,6 @@ static int __init prom_setprop(phandle node, const char *nodename,
487 return call_prom("interpret", 1, 1, (u32)(unsigned long) cmd); 487 return call_prom("interpret", 1, 1, (u32)(unsigned long) cmd);
488} 488}
489 489
490/* We can't use the standard versions because of RELOC headaches. */
491#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
492 || ('a' <= (c) && (c) <= 'f') \
493 || ('A' <= (c) && (c) <= 'F'))
494
495#define isdigit(c) ('0' <= (c) && (c) <= '9')
496#define islower(c) ('a' <= (c) && (c) <= 'z')
497#define toupper(c) (islower(c) ? ((c) - 'a' + 'A') : (c))
498
499unsigned long prom_strtoul(const char *cp, const char **endp)
500{
501 unsigned long result = 0, base = 10, value;
502
503 if (*cp == '0') {
504 base = 8;
505 cp++;
506 if (toupper(*cp) == 'X') {
507 cp++;
508 base = 16;
509 }
510 }
511
512 while (isxdigit(*cp) &&
513 (value = isdigit(*cp) ? *cp - '0' : toupper(*cp) - 'A' + 10) < base) {
514 result = result * base + value;
515 cp++;
516 }
517
518 if (endp)
519 *endp = cp;
520
521 return result;
522}
523
524unsigned long prom_memparse(const char *ptr, const char **retptr)
525{
526 unsigned long ret = prom_strtoul(ptr, retptr);
527 int shift = 0;
528
529 /*
530 * We can't use a switch here because GCC *may* generate a
531 * jump table which won't work, because we're not running at
532 * the address we're linked at.
533 */
534 if ('G' == **retptr || 'g' == **retptr)
535 shift = 30;
536
537 if ('M' == **retptr || 'm' == **retptr)
538 shift = 20;
539
540 if ('K' == **retptr || 'k' == **retptr)
541 shift = 10;
542
543 if (shift) {
544 ret <<= shift;
545 (*retptr)++;
546 }
547
548 return ret;
549}
550
551/* 490/*
552 * Early parsing of the command line passed to the kernel, used for 491 * Early parsing of the command line passed to the kernel, used for
553 * "mem=x" and the options that affect the iommu 492 * "mem=x" and the options that affect the iommu
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index 2c7e8e87f770..ea3a2ec03ffa 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -20,7 +20,7 @@ WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush
20_end enter_prom memcpy memset reloc_offset __secondary_hold 20_end enter_prom memcpy memset reloc_offset __secondary_hold
21__secondary_hold_acknowledge __secondary_hold_spinloop __start 21__secondary_hold_acknowledge __secondary_hold_spinloop __start
22strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 22strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
23reloc_got2 kernstart_addr" 23reloc_got2 kernstart_addr memstart_addr"
24 24
25NM="$1" 25NM="$1"
26OBJ="$2" 26OBJ="$2"
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 5ec56ff03e86..705fc4bf3800 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -59,6 +59,7 @@
59#include <asm/mmu.h> 59#include <asm/mmu.h>
60#include <asm/xmon.h> 60#include <asm/xmon.h>
61#include <asm/cputhreads.h> 61#include <asm/cputhreads.h>
62#include <mm/mmu_decl.h>
62 63
63#include "setup.h" 64#include "setup.h"
64 65
@@ -190,6 +191,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
190 if (ppc_md.show_cpuinfo != NULL) 191 if (ppc_md.show_cpuinfo != NULL)
191 ppc_md.show_cpuinfo(m); 192 ppc_md.show_cpuinfo(m);
192 193
194#ifdef CONFIG_PPC32
195 /* Display the amount of memory */
196 seq_printf(m, "Memory\t\t: %d MB\n",
197 (unsigned int)(total_memory / (1024 * 1024)));
198#endif
199
193 return 0; 200 return 0;
194 } 201 }
195 202
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 65ad925c3a8f..c6a8f2326b6f 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -235,8 +235,6 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
235 else 235 else
236 for (i = 0; i < 32 ; i++) 236 for (i = 0; i < 32 ; i++)
237 current->thread.fpr[i][TS_VSRLOWOFFSET] = 0; 237 current->thread.fpr[i][TS_VSRLOWOFFSET] = 0;
238
239#else
240#endif 238#endif
241 return err; 239 return err;
242} 240}
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index cb01ebc59387..7b7da8cfd5e8 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -142,7 +142,7 @@ unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock)
142 speed = (clock / prescaler) / (divisor * 16); 142 speed = (clock / prescaler) / (divisor * 16);
143 143
144 /* sanity check */ 144 /* sanity check */
145 if (speed < 0 || speed > (clock / 16)) 145 if (speed > (clock / 16))
146 speed = 9600; 146 speed = 9600;
147 147
148 return speed; 148 return speed;
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 5c64af174752..8d5b4758c13a 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -382,8 +382,10 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
382 printk(KERN_INFO "Huge page(16GB) memory: " 382 printk(KERN_INFO "Huge page(16GB) memory: "
383 "addr = 0x%lX size = 0x%lX pages = %d\n", 383 "addr = 0x%lX size = 0x%lX pages = %d\n",
384 phys_addr, block_size, expected_pages); 384 phys_addr, block_size, expected_pages);
385 lmb_reserve(phys_addr, block_size * expected_pages); 385 if (phys_addr + (16 * GB) <= lmb_end_of_DRAM()) {
386 add_gpage(phys_addr, block_size, expected_pages); 386 lmb_reserve(phys_addr, block_size * expected_pages);
387 add_gpage(phys_addr, block_size, expected_pages);
388 }
387 return 0; 389 return 0;
388} 390}
389#endif /* CONFIG_HUGETLB_PAGE */ 391#endif /* CONFIG_HUGETLB_PAGE */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 6cf5c71c431f..eb505ad34a85 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -116,6 +116,7 @@ static int __init get_active_region_work_fn(unsigned long start_pfn,
116 116
117/* 117/*
118 * get_node_active_region - Return active region containing start_pfn 118 * get_node_active_region - Return active region containing start_pfn
119 * Active range returned is empty if none found.
119 * @start_pfn: The page to return the region for. 120 * @start_pfn: The page to return the region for.
120 * @node_ar: Returned set to the active region containing start_pfn 121 * @node_ar: Returned set to the active region containing start_pfn
121 */ 122 */
@@ -126,6 +127,7 @@ static void __init get_node_active_region(unsigned long start_pfn,
126 127
127 node_ar->nid = nid; 128 node_ar->nid = nid;
128 node_ar->start_pfn = start_pfn; 129 node_ar->start_pfn = start_pfn;
130 node_ar->end_pfn = start_pfn;
129 work_with_active_regions(nid, get_active_region_work_fn, node_ar); 131 work_with_active_regions(nid, get_active_region_work_fn, node_ar);
130} 132}
131 133
@@ -526,12 +528,10 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start,
526 /* 528 /*
527 * We use lmb_end_of_DRAM() in here instead of memory_limit because 529 * We use lmb_end_of_DRAM() in here instead of memory_limit because
528 * we've already adjusted it for the limit and it takes care of 530 * we've already adjusted it for the limit and it takes care of
529 * having memory holes below the limit. 531 * having memory holes below the limit. Also, in the case of
532 * iommu_is_off, memory_limit is not set but is implicitly enforced.
530 */ 533 */
531 534
532 if (! memory_limit)
533 return size;
534
535 if (start + size <= lmb_end_of_DRAM()) 535 if (start + size <= lmb_end_of_DRAM())
536 return size; 536 return size;
537 537
@@ -933,18 +933,20 @@ void __init do_init_bootmem(void)
933 struct node_active_region node_ar; 933 struct node_active_region node_ar;
934 934
935 get_node_active_region(start_pfn, &node_ar); 935 get_node_active_region(start_pfn, &node_ar);
936 while (start_pfn < end_pfn) { 936 while (start_pfn < end_pfn &&
937 node_ar.start_pfn < node_ar.end_pfn) {
938 unsigned long reserve_size = size;
937 /* 939 /*
938 * if reserved region extends past active region 940 * if reserved region extends past active region
939 * then trim size to active region 941 * then trim size to active region
940 */ 942 */
941 if (end_pfn > node_ar.end_pfn) 943 if (end_pfn > node_ar.end_pfn)
942 size = (node_ar.end_pfn << PAGE_SHIFT) 944 reserve_size = (node_ar.end_pfn << PAGE_SHIFT)
943 - (start_pfn << PAGE_SHIFT); 945 - (start_pfn << PAGE_SHIFT);
944 dbg("reserve_bootmem %lx %lx nid=%d\n", physbase, size, 946 dbg("reserve_bootmem %lx %lx nid=%d\n", physbase,
945 node_ar.nid); 947 reserve_size, node_ar.nid);
946 reserve_bootmem_node(NODE_DATA(node_ar.nid), physbase, 948 reserve_bootmem_node(NODE_DATA(node_ar.nid), physbase,
947 size, BOOTMEM_DEFAULT); 949 reserve_size, BOOTMEM_DEFAULT);
948 /* 950 /*
949 * if reserved region is contained in the active region 951 * if reserved region is contained in the active region
950 * then done. 952 * then done.
@@ -959,6 +961,7 @@ void __init do_init_bootmem(void)
959 */ 961 */
960 start_pfn = node_ar.end_pfn; 962 start_pfn = node_ar.end_pfn;
961 physbase = start_pfn << PAGE_SHIFT; 963 physbase = start_pfn << PAGE_SHIFT;
964 size = size - reserve_size;
962 get_node_active_region(start_pfn, &node_ar); 965 get_node_active_region(start_pfn, &node_ar);
963 } 966 }
964 967
diff --git a/arch/powerpc/oprofile/cell/pr_util.h b/arch/powerpc/oprofile/cell/pr_util.h
index 22e4e8d4eb2c..628009c01958 100644
--- a/arch/powerpc/oprofile/cell/pr_util.h
+++ b/arch/powerpc/oprofile/cell/pr_util.h
@@ -24,6 +24,11 @@
24#define SKIP_GENERIC_SYNC 0 24#define SKIP_GENERIC_SYNC 0
25#define SYNC_START_ERROR -1 25#define SYNC_START_ERROR -1
26#define DO_GENERIC_SYNC 1 26#define DO_GENERIC_SYNC 1
27#define SPUS_PER_NODE 8
28#define DEFAULT_TIMER_EXPIRE (HZ / 10)
29
30extern struct delayed_work spu_work;
31extern int spu_prof_running;
27 32
28struct spu_overlay_info { /* map of sections within an SPU overlay */ 33struct spu_overlay_info { /* map of sections within an SPU overlay */
29 unsigned int vma; /* SPU virtual memory address from elf */ 34 unsigned int vma; /* SPU virtual memory address from elf */
@@ -62,6 +67,14 @@ struct vma_to_fileoffset_map { /* map of sections within an SPU program */
62 67
63}; 68};
64 69
70struct spu_buffer {
71 int last_guard_val;
72 int ctx_sw_seen;
73 unsigned long *buff;
74 unsigned int head, tail;
75};
76
77
65/* The three functions below are for maintaining and accessing 78/* The three functions below are for maintaining and accessing
66 * the vma-to-fileoffset map. 79 * the vma-to-fileoffset map.
67 */ 80 */
diff --git a/arch/powerpc/oprofile/cell/spu_profiler.c b/arch/powerpc/oprofile/cell/spu_profiler.c
index 380d7e217531..6edaebd5099a 100644
--- a/arch/powerpc/oprofile/cell/spu_profiler.c
+++ b/arch/powerpc/oprofile/cell/spu_profiler.c
@@ -23,12 +23,11 @@
23 23
24static u32 *samples; 24static u32 *samples;
25 25
26static int spu_prof_running; 26int spu_prof_running;
27static unsigned int profiling_interval; 27static unsigned int profiling_interval;
28 28
29#define NUM_SPU_BITS_TRBUF 16 29#define NUM_SPU_BITS_TRBUF 16
30#define SPUS_PER_TB_ENTRY 4 30#define SPUS_PER_TB_ENTRY 4
31#define SPUS_PER_NODE 8
32 31
33#define SPU_PC_MASK 0xFFFF 32#define SPU_PC_MASK 0xFFFF
34 33
@@ -208,6 +207,7 @@ int start_spu_profiling(unsigned int cycles_reset)
208 207
209 spu_prof_running = 1; 208 spu_prof_running = 1;
210 hrtimer_start(&timer, kt, HRTIMER_MODE_REL); 209 hrtimer_start(&timer, kt, HRTIMER_MODE_REL);
210 schedule_delayed_work(&spu_work, DEFAULT_TIMER_EXPIRE);
211 211
212 return 0; 212 return 0;
213} 213}
diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c
index 2a9b4a049329..2949126d28d1 100644
--- a/arch/powerpc/oprofile/cell/spu_task_sync.c
+++ b/arch/powerpc/oprofile/cell/spu_task_sync.c
@@ -35,7 +35,102 @@ static DEFINE_SPINLOCK(buffer_lock);
35static DEFINE_SPINLOCK(cache_lock); 35static DEFINE_SPINLOCK(cache_lock);
36static int num_spu_nodes; 36static int num_spu_nodes;
37int spu_prof_num_nodes; 37int spu_prof_num_nodes;
38int last_guard_val[MAX_NUMNODES * 8]; 38
39struct spu_buffer spu_buff[MAX_NUMNODES * SPUS_PER_NODE];
40struct delayed_work spu_work;
41static unsigned max_spu_buff;
42
43static void spu_buff_add(unsigned long int value, int spu)
44{
45 /* spu buff is a circular buffer. Add entries to the
46 * head. Head is the index to store the next value.
47 * The buffer is full when there is one available entry
48 * in the queue, i.e. head and tail can't be equal.
49 * That way we can tell the difference between the
50 * buffer being full versus empty.
51 *
52 * ASSUPTION: the buffer_lock is held when this function
53 * is called to lock the buffer, head and tail.
54 */
55 int full = 1;
56
57 if (spu_buff[spu].head >= spu_buff[spu].tail) {
58 if ((spu_buff[spu].head - spu_buff[spu].tail)
59 < (max_spu_buff - 1))
60 full = 0;
61
62 } else if (spu_buff[spu].tail > spu_buff[spu].head) {
63 if ((spu_buff[spu].tail - spu_buff[spu].head)
64 > 1)
65 full = 0;
66 }
67
68 if (!full) {
69 spu_buff[spu].buff[spu_buff[spu].head] = value;
70 spu_buff[spu].head++;
71
72 if (spu_buff[spu].head >= max_spu_buff)
73 spu_buff[spu].head = 0;
74 } else {
75 /* From the user's perspective make the SPU buffer
76 * size management/overflow look like we are using
77 * per cpu buffers. The user uses the same
78 * per cpu parameter to adjust the SPU buffer size.
79 * Increment the sample_lost_overflow to inform
80 * the user the buffer size needs to be increased.
81 */
82 oprofile_cpu_buffer_inc_smpl_lost();
83 }
84}
85
86/* This function copies the per SPU buffers to the
87 * OProfile kernel buffer.
88 */
89void sync_spu_buff(void)
90{
91 int spu;
92 unsigned long flags;
93 int curr_head;
94
95 for (spu = 0; spu < num_spu_nodes; spu++) {
96 /* In case there was an issue and the buffer didn't
97 * get created skip it.
98 */
99 if (spu_buff[spu].buff == NULL)
100 continue;
101
102 /* Hold the lock to make sure the head/tail
103 * doesn't change while spu_buff_add() is
104 * deciding if the buffer is full or not.
105 * Being a little paranoid.
106 */
107 spin_lock_irqsave(&buffer_lock, flags);
108 curr_head = spu_buff[spu].head;
109 spin_unlock_irqrestore(&buffer_lock, flags);
110
111 /* Transfer the current contents to the kernel buffer.
112 * data can still be added to the head of the buffer.
113 */
114 oprofile_put_buff(spu_buff[spu].buff,
115 spu_buff[spu].tail,
116 curr_head, max_spu_buff);
117
118 spin_lock_irqsave(&buffer_lock, flags);
119 spu_buff[spu].tail = curr_head;
120 spin_unlock_irqrestore(&buffer_lock, flags);
121 }
122
123}
124
125static void wq_sync_spu_buff(struct work_struct *work)
126{
127 /* move data from spu buffers to kernel buffer */
128 sync_spu_buff();
129
130 /* only reschedule if profiling is not done */
131 if (spu_prof_running)
132 schedule_delayed_work(&spu_work, DEFAULT_TIMER_EXPIRE);
133}
39 134
40/* Container for caching information about an active SPU task. */ 135/* Container for caching information about an active SPU task. */
41struct cached_info { 136struct cached_info {
@@ -305,14 +400,21 @@ static int process_context_switch(struct spu *spu, unsigned long objectId)
305 400
306 /* Record context info in event buffer */ 401 /* Record context info in event buffer */
307 spin_lock_irqsave(&buffer_lock, flags); 402 spin_lock_irqsave(&buffer_lock, flags);
308 add_event_entry(ESCAPE_CODE); 403 spu_buff_add(ESCAPE_CODE, spu->number);
309 add_event_entry(SPU_CTX_SWITCH_CODE); 404 spu_buff_add(SPU_CTX_SWITCH_CODE, spu->number);
310 add_event_entry(spu->number); 405 spu_buff_add(spu->number, spu->number);
311 add_event_entry(spu->pid); 406 spu_buff_add(spu->pid, spu->number);
312 add_event_entry(spu->tgid); 407 spu_buff_add(spu->tgid, spu->number);
313 add_event_entry(app_dcookie); 408 spu_buff_add(app_dcookie, spu->number);
314 add_event_entry(spu_cookie); 409 spu_buff_add(spu_cookie, spu->number);
315 add_event_entry(offset); 410 spu_buff_add(offset, spu->number);
411
412 /* Set flag to indicate SPU PC data can now be written out. If
413 * the SPU program counter data is seen before an SPU context
414 * record is seen, the postprocessing will fail.
415 */
416 spu_buff[spu->number].ctx_sw_seen = 1;
417
316 spin_unlock_irqrestore(&buffer_lock, flags); 418 spin_unlock_irqrestore(&buffer_lock, flags);
317 smp_wmb(); /* insure spu event buffer updates are written */ 419 smp_wmb(); /* insure spu event buffer updates are written */
318 /* don't want entries intermingled... */ 420 /* don't want entries intermingled... */
@@ -360,6 +462,47 @@ static int number_of_online_nodes(void)
360 return nodes; 462 return nodes;
361} 463}
362 464
465static int oprofile_spu_buff_create(void)
466{
467 int spu;
468
469 max_spu_buff = oprofile_get_cpu_buffer_size();
470
471 for (spu = 0; spu < num_spu_nodes; spu++) {
472 /* create circular buffers to store the data in.
473 * use locks to manage accessing the buffers
474 */
475 spu_buff[spu].head = 0;
476 spu_buff[spu].tail = 0;
477
478 /*
479 * Create a buffer for each SPU. Can't reliably
480 * create a single buffer for all spus due to not
481 * enough contiguous kernel memory.
482 */
483
484 spu_buff[spu].buff = kzalloc((max_spu_buff
485 * sizeof(unsigned long)),
486 GFP_KERNEL);
487
488 if (!spu_buff[spu].buff) {
489 printk(KERN_ERR "SPU_PROF: "
490 "%s, line %d: oprofile_spu_buff_create "
491 "failed to allocate spu buffer %d.\n",
492 __func__, __LINE__, spu);
493
494 /* release the spu buffers that have been allocated */
495 while (spu >= 0) {
496 kfree(spu_buff[spu].buff);
497 spu_buff[spu].buff = 0;
498 spu--;
499 }
500 return -ENOMEM;
501 }
502 }
503 return 0;
504}
505
363/* The main purpose of this function is to synchronize 506/* The main purpose of this function is to synchronize
364 * OProfile with SPUFS by registering to be notified of 507 * OProfile with SPUFS by registering to be notified of
365 * SPU task switches. 508 * SPU task switches.
@@ -372,20 +515,35 @@ static int number_of_online_nodes(void)
372 */ 515 */
373int spu_sync_start(void) 516int spu_sync_start(void)
374{ 517{
375 int k; 518 int spu;
376 int ret = SKIP_GENERIC_SYNC; 519 int ret = SKIP_GENERIC_SYNC;
377 int register_ret; 520 int register_ret;
378 unsigned long flags = 0; 521 unsigned long flags = 0;
379 522
380 spu_prof_num_nodes = number_of_online_nodes(); 523 spu_prof_num_nodes = number_of_online_nodes();
381 num_spu_nodes = spu_prof_num_nodes * 8; 524 num_spu_nodes = spu_prof_num_nodes * 8;
525 INIT_DELAYED_WORK(&spu_work, wq_sync_spu_buff);
526
527 /* create buffer for storing the SPU data to put in
528 * the kernel buffer.
529 */
530 ret = oprofile_spu_buff_create();
531 if (ret)
532 goto out;
382 533
383 spin_lock_irqsave(&buffer_lock, flags); 534 spin_lock_irqsave(&buffer_lock, flags);
384 add_event_entry(ESCAPE_CODE); 535 for (spu = 0; spu < num_spu_nodes; spu++) {
385 add_event_entry(SPU_PROFILING_CODE); 536 spu_buff_add(ESCAPE_CODE, spu);
386 add_event_entry(num_spu_nodes); 537 spu_buff_add(SPU_PROFILING_CODE, spu);
538 spu_buff_add(num_spu_nodes, spu);
539 }
387 spin_unlock_irqrestore(&buffer_lock, flags); 540 spin_unlock_irqrestore(&buffer_lock, flags);
388 541
542 for (spu = 0; spu < num_spu_nodes; spu++) {
543 spu_buff[spu].ctx_sw_seen = 0;
544 spu_buff[spu].last_guard_val = 0;
545 }
546
389 /* Register for SPU events */ 547 /* Register for SPU events */
390 register_ret = spu_switch_event_register(&spu_active); 548 register_ret = spu_switch_event_register(&spu_active);
391 if (register_ret) { 549 if (register_ret) {
@@ -393,8 +551,6 @@ int spu_sync_start(void)
393 goto out; 551 goto out;
394 } 552 }
395 553
396 for (k = 0; k < (MAX_NUMNODES * 8); k++)
397 last_guard_val[k] = 0;
398 pr_debug("spu_sync_start -- running.\n"); 554 pr_debug("spu_sync_start -- running.\n");
399out: 555out:
400 return ret; 556 return ret;
@@ -446,13 +602,20 @@ void spu_sync_buffer(int spu_num, unsigned int *samples,
446 * use. We need to discard samples taken during the time 602 * use. We need to discard samples taken during the time
447 * period which an overlay occurs (i.e., guard value changes). 603 * period which an overlay occurs (i.e., guard value changes).
448 */ 604 */
449 if (grd_val && grd_val != last_guard_val[spu_num]) { 605 if (grd_val && grd_val != spu_buff[spu_num].last_guard_val) {
450 last_guard_val[spu_num] = grd_val; 606 spu_buff[spu_num].last_guard_val = grd_val;
451 /* Drop the rest of the samples. */ 607 /* Drop the rest of the samples. */
452 break; 608 break;
453 } 609 }
454 610
455 add_event_entry(file_offset | spu_num_shifted); 611 /* We must ensure that the SPU context switch has been written
612 * out before samples for the SPU. Otherwise, the SPU context
613 * information is not available and the postprocessing of the
614 * SPU PC will fail with no available anonymous map information.
615 */
616 if (spu_buff[spu_num].ctx_sw_seen)
617 spu_buff_add((file_offset | spu_num_shifted),
618 spu_num);
456 } 619 }
457 spin_unlock(&buffer_lock); 620 spin_unlock(&buffer_lock);
458out: 621out:
@@ -463,20 +626,41 @@ out:
463int spu_sync_stop(void) 626int spu_sync_stop(void)
464{ 627{
465 unsigned long flags = 0; 628 unsigned long flags = 0;
466 int ret = spu_switch_event_unregister(&spu_active); 629 int ret;
467 if (ret) { 630 int k;
631
632 ret = spu_switch_event_unregister(&spu_active);
633
634 if (ret)
468 printk(KERN_ERR "SPU_PROF: " 635 printk(KERN_ERR "SPU_PROF: "
469 "%s, line %d: spu_switch_event_unregister returned %d\n", 636 "%s, line %d: spu_switch_event_unregister " \
470 __func__, __LINE__, ret); 637 "returned %d\n",
471 goto out; 638 __func__, __LINE__, ret);
472 } 639
640 /* flush any remaining data in the per SPU buffers */
641 sync_spu_buff();
473 642
474 spin_lock_irqsave(&cache_lock, flags); 643 spin_lock_irqsave(&cache_lock, flags);
475 ret = release_cached_info(RELEASE_ALL); 644 ret = release_cached_info(RELEASE_ALL);
476 spin_unlock_irqrestore(&cache_lock, flags); 645 spin_unlock_irqrestore(&cache_lock, flags);
477out: 646
647 /* remove scheduled work queue item rather then waiting
648 * for every queued entry to execute. Then flush pending
649 * system wide buffer to event buffer.
650 */
651 cancel_delayed_work(&spu_work);
652
653 for (k = 0; k < num_spu_nodes; k++) {
654 spu_buff[k].ctx_sw_seen = 0;
655
656 /*
657 * spu_sys_buff will be null if there was a problem
658 * allocating the buffer. Only delete if it exists.
659 */
660 kfree(spu_buff[k].buff);
661 spu_buff[k].buff = 0;
662 }
478 pr_debug("spu_sync_stop -- done.\n"); 663 pr_debug("spu_sync_stop -- done.\n");
479 return ret; 664 return ret;
480} 665}
481 666
482
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
index 5ff4de3eb3be..35141a8bc3d9 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -404,7 +404,7 @@ set_count_mode(u32 kernel, u32 user)
404 } 404 }
405} 405}
406 406
407static inline void enable_ctr(u32 cpu, u32 ctr, u32 * pm07_cntrl) 407static inline void enable_ctr(u32 cpu, u32 ctr, u32 *pm07_cntrl)
408{ 408{
409 409
410 pm07_cntrl[ctr] |= CBE_PM_CTR_ENABLE; 410 pm07_cntrl[ctr] |= CBE_PM_CTR_ENABLE;
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index a9260e21451e..65730275e012 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -14,6 +14,15 @@
14# help 14# help
15# This option enables support for the CPCI405 board. 15# This option enables support for the CPCI405 board.
16 16
17config ACADIA
18 bool "Acadia"
19 depends on 40x
20 default n
21 select PPC40x_SIMPLE
22 select 405EZ
23 help
24 This option enables support for the AMCC 405EZ Acadia evaluation board.
25
17config EP405 26config EP405
18 bool "EP405/EP405PC" 27 bool "EP405/EP405PC"
19 depends on 40x 28 depends on 40x
@@ -23,6 +32,14 @@ config EP405
23 help 32 help
24 This option enables support for the EP405/EP405PC boards. 33 This option enables support for the EP405/EP405PC boards.
25 34
35config HCU4
36 bool "Hcu4"
37 depends on 40x
38 default y
39 select 405GPR
40 help
41 This option enables support for the Nestal Maschinen HCU4 board.
42
26config KILAUEA 43config KILAUEA
27 bool "Kilauea" 44 bool "Kilauea"
28 depends on 40x 45 depends on 40x
@@ -93,6 +110,13 @@ config XILINX_VIRTEX_GENERIC_BOARD
93 Most Virtex designs should use this unless it needs to do some 110 Most Virtex designs should use this unless it needs to do some
94 special configuration at board probe time. 111 special configuration at board probe time.
95 112
113config PPC40x_SIMPLE
114 bool "Simple PowerPC 40x board support"
115 depends on 40x
116 default n
117 help
118 This option enables the simple PowerPC 40x platform support.
119
96# 40x specific CPU modules, selected based on the board above. 120# 40x specific CPU modules, selected based on the board above.
97config NP405H 121config NP405H
98 bool 122 bool
@@ -118,6 +142,12 @@ config 405EX
118 select IBM_NEW_EMAC_EMAC4 142 select IBM_NEW_EMAC_EMAC4
119 select IBM_NEW_EMAC_RGMII 143 select IBM_NEW_EMAC_RGMII
120 144
145config 405EZ
146 bool
147 select IBM_NEW_EMAC_NO_FLOW_CTRL
148 select IBM_NEW_EMAC_MAL_CLR_ICINTSTAT
149 select IBM_NEW_EMAC_MAL_COMMON_ERR
150
121config 405GPR 151config 405GPR
122 bool 152 bool
123 153
@@ -139,6 +169,14 @@ config STB03xxx
139 select IBM405_ERR77 169 select IBM405_ERR77
140 select IBM405_ERR51 170 select IBM405_ERR51
141 171
172config PPC4xx_GPIO
173 bool "PPC4xx GPIO support"
174 depends on 40x
175 select ARCH_REQUIRE_GPIOLIB
176 select GENERIC_GPIO
177 help
178 Enable gpiolib support for ppc40x based boards
179
142# 40x errata/workaround config symbols, selected by the CPU models above 180# 40x errata/workaround config symbols, selected by the CPU models above
143 181
144# All 405-based cores up until the 405GPR and 405EP have this errata. 182# All 405-based cores up until the 405GPR and 405EP have this errata.
diff --git a/arch/powerpc/platforms/40x/Makefile b/arch/powerpc/platforms/40x/Makefile
index 5533a5c8ce4e..9bab76a652a6 100644
--- a/arch/powerpc/platforms/40x/Makefile
+++ b/arch/powerpc/platforms/40x/Makefile
@@ -1,5 +1,7 @@
1obj-$(CONFIG_KILAUEA) += kilauea.o 1obj-$(CONFIG_KILAUEA) += kilauea.o
2obj-$(CONFIG_HCU4) += hcu4.o
2obj-$(CONFIG_MAKALU) += makalu.o 3obj-$(CONFIG_MAKALU) += makalu.o
3obj-$(CONFIG_WALNUT) += walnut.o 4obj-$(CONFIG_WALNUT) += walnut.o
4obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o 5obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o
5obj-$(CONFIG_EP405) += ep405.o 6obj-$(CONFIG_EP405) += ep405.o
7obj-$(CONFIG_PPC40x_SIMPLE) += ppc40x_simple.o
diff --git a/arch/powerpc/platforms/40x/hcu4.c b/arch/powerpc/platforms/40x/hcu4.c
new file mode 100644
index 000000000000..60b2afecab75
--- /dev/null
+++ b/arch/powerpc/platforms/40x/hcu4.c
@@ -0,0 +1,61 @@
1/*
2 * Architecture- / platform-specific boot-time initialization code for
3 * IBM PowerPC 4xx based boards. Adapted from original
4 * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek
5 * <dan@net4x.com>.
6 *
7 * Copyright(c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
8 *
9 * Rewritten and ported to the merged powerpc tree:
10 * Copyright 2007 IBM Corporation
11 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
12 *
13 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
14 * the terms of the GNU General Public License version 2. This program
15 * is licensed "as is" without any warranty of any kind, whether express
16 * or implied.
17 */
18
19#include <linux/init.h>
20#include <linux/of_platform.h>
21
22#include <asm/machdep.h>
23#include <asm/prom.h>
24#include <asm/udbg.h>
25#include <asm/time.h>
26#include <asm/uic.h>
27#include <asm/ppc4xx.h>
28
29static __initdata struct of_device_id hcu4_of_bus[] = {
30 { .compatible = "ibm,plb3", },
31 { .compatible = "ibm,opb", },
32 { .compatible = "ibm,ebc", },
33 {},
34};
35
36static int __init hcu4_device_probe(void)
37{
38 of_platform_bus_probe(NULL, hcu4_of_bus, NULL);
39 return 0;
40}
41machine_device_initcall(hcu4, hcu4_device_probe);
42
43static int __init hcu4_probe(void)
44{
45 unsigned long root = of_get_flat_dt_root();
46
47 if (!of_flat_dt_is_compatible(root, "netstal,hcu4"))
48 return 0;
49
50 return 1;
51}
52
53define_machine(hcu4) {
54 .name = "HCU4",
55 .probe = hcu4_probe,
56 .progress = udbg_progress,
57 .init_IRQ = uic_init_tree,
58 .get_irq = uic_get_irq,
59 .restart = ppc4xx_reset_system,
60 .calibrate_decr = generic_calibrate_decr,
61};
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
new file mode 100644
index 000000000000..4498a86b46c3
--- /dev/null
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -0,0 +1,80 @@
1/*
2 * Generic PowerPC 40x platform support
3 *
4 * Copyright 2008 IBM Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; version 2 of the License.
9 *
10 * This implements simple platform support for PowerPC 44x chips. This is
11 * mostly used for eval boards or other simple and "generic" 44x boards. If
12 * your board has custom functions or hardware, then you will likely want to
13 * implement your own board.c file to accommodate it.
14 */
15
16#include <asm/machdep.h>
17#include <asm/pci-bridge.h>
18#include <asm/ppc4xx.h>
19#include <asm/prom.h>
20#include <asm/time.h>
21#include <asm/udbg.h>
22#include <asm/uic.h>
23
24#include <linux/init.h>
25#include <linux/of_platform.h>
26
27static __initdata struct of_device_id ppc40x_of_bus[] = {
28 { .compatible = "ibm,plb3", },
29 { .compatible = "ibm,plb4", },
30 { .compatible = "ibm,opb", },
31 { .compatible = "ibm,ebc", },
32 { .compatible = "simple-bus", },
33 {},
34};
35
36static int __init ppc40x_device_probe(void)
37{
38 of_platform_bus_probe(NULL, ppc40x_of_bus, NULL);
39
40 return 0;
41}
42machine_device_initcall(ppc40x_simple, ppc40x_device_probe);
43
44/* This is the list of boards that can be supported by this simple
45 * platform code. This does _not_ mean the boards are compatible,
46 * as they most certainly are not from a device tree perspective.
47 * However, their differences are handled by the device tree and the
48 * drivers and therefore they don't need custom board support files.
49 *
50 * Again, if your board needs to do things differently then create a
51 * board.c file for it rather than adding it to this list.
52 */
53static char *board[] __initdata = {
54 "amcc,acadia"
55};
56
57static int __init ppc40x_probe(void)
58{
59 unsigned long root = of_get_flat_dt_root();
60 int i = 0;
61
62 for (i = 0; i < ARRAY_SIZE(board); i++) {
63 if (of_flat_dt_is_compatible(root, board[i])) {
64 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
65 return 1;
66 }
67 }
68
69 return 0;
70}
71
72define_machine(ppc40x_simple) {
73 .name = "PowerPC 40x Platform",
74 .probe = ppc40x_probe,
75 .progress = udbg_progress,
76 .init_IRQ = uic_init_tree,
77 .get_irq = uic_get_irq,
78 .restart = ppc4xx_reset_system,
79 .calibrate_decr = generic_calibrate_decr,
80};
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 79c1154f88d4..3496bc05058e 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -167,6 +167,14 @@ config PPC44x_SIMPLE
167 help 167 help
168 This option enables the simple PowerPC 44x platform support. 168 This option enables the simple PowerPC 44x platform support.
169 169
170config PPC4xx_GPIO
171 bool "PPC4xx GPIO support"
172 depends on 44x
173 select ARCH_REQUIRE_GPIOLIB
174 select GENERIC_GPIO
175 help
176 Enable gpiolib support for ppc440 based boards
177
170# 44x specific CPU modules, selected based on the board above. 178# 44x specific CPU modules, selected based on the board above.
171config 440EP 179config 440EP
172 bool 180 bool
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 044b4e6e8743..ae7c34f37e1c 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -99,11 +99,14 @@ mpc5200_setup_xlb_arbiter(void)
99 out_be32(&xlb->master_pri_enable, 0xff); 99 out_be32(&xlb->master_pri_enable, 0xff);
100 out_be32(&xlb->master_priority, 0x11111111); 100 out_be32(&xlb->master_priority, 0x11111111);
101 101
102 /* Disable XLB pipelining 102 /*
103 * Disable XLB pipelining
103 * (cfr errate 292. We could do this only just before ATA PIO 104 * (cfr errate 292. We could do this only just before ATA PIO
104 * transaction and re-enable it afterwards ...) 105 * transaction and re-enable it afterwards ...)
106 * Not needed on MPC5200B.
105 */ 107 */
106 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS); 108 if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR)
109 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
107 110
108 iounmap(xlb); 111 iounmap(xlb);
109} 112}
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c
index 8a3b117b6ce2..81cee7bbf2d2 100644
--- a/arch/powerpc/platforms/85xx/ksi8560.c
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -193,7 +193,6 @@ static void __init ksi8560_setup_arch(void)
193static void ksi8560_show_cpuinfo(struct seq_file *m) 193static void ksi8560_show_cpuinfo(struct seq_file *m)
194{ 194{
195 uint pvid, svid, phid1; 195 uint pvid, svid, phid1;
196 uint memsize = total_memory;
197 196
198 pvid = mfspr(SPRN_PVR); 197 pvid = mfspr(SPRN_PVR);
199 svid = mfspr(SPRN_SVR); 198 svid = mfspr(SPRN_SVR);
@@ -215,9 +214,6 @@ static void ksi8560_show_cpuinfo(struct seq_file *m)
215 /* Display cpu Pll setting */ 214 /* Display cpu Pll setting */
216 phid1 = mfspr(SPRN_HID1); 215 phid1 = mfspr(SPRN_HID1);
217 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 216 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
218
219 /* Display the amount of memory */
220 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
221} 217}
222 218
223static struct of_device_id __initdata of_bus_ids[] = { 219static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 0293e3d3580f..21f009023e26 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -207,7 +207,6 @@ static void __init mpc85xx_ads_setup_arch(void)
207static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) 207static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
208{ 208{
209 uint pvid, svid, phid1; 209 uint pvid, svid, phid1;
210 uint memsize = total_memory;
211 210
212 pvid = mfspr(SPRN_PVR); 211 pvid = mfspr(SPRN_PVR);
213 svid = mfspr(SPRN_SVR); 212 svid = mfspr(SPRN_SVR);
@@ -219,9 +218,6 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
219 /* Display cpu Pll setting */ 218 /* Display cpu Pll setting */
220 phid1 = mfspr(SPRN_HID1); 219 phid1 = mfspr(SPRN_HID1);
221 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 220 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
222
223 /* Display the amount of memory */
224 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
225} 221}
226 222
227static struct of_device_id __initdata of_bus_ids[] = { 223static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 50d7ea8f922b..aeb6a5bc5522 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -307,7 +307,6 @@ static void __init mpc85xx_cds_setup_arch(void)
307static void mpc85xx_cds_show_cpuinfo(struct seq_file *m) 307static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
308{ 308{
309 uint pvid, svid, phid1; 309 uint pvid, svid, phid1;
310 uint memsize = total_memory;
311 310
312 pvid = mfspr(SPRN_PVR); 311 pvid = mfspr(SPRN_PVR);
313 svid = mfspr(SPRN_SVR); 312 svid = mfspr(SPRN_SVR);
@@ -320,9 +319,6 @@ static void mpc85xx_cds_show_cpuinfo(struct seq_file *m)
320 /* Display cpu Pll setting */ 319 /* Display cpu Pll setting */
321 phid1 = mfspr(SPRN_HID1); 320 phid1 = mfspr(SPRN_HID1);
322 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 321 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
323
324 /* Display the amount of memory */
325 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
326} 322}
327 323
328 324
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index b9246ea0928a..7ec77ce12dad 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -136,7 +136,6 @@ static void __init sbc8548_setup_arch(void)
136static void sbc8548_show_cpuinfo(struct seq_file *m) 136static void sbc8548_show_cpuinfo(struct seq_file *m)
137{ 137{
138 uint pvid, svid, phid1; 138 uint pvid, svid, phid1;
139 uint memsize = total_memory;
140 139
141 pvid = mfspr(SPRN_PVR); 140 pvid = mfspr(SPRN_PVR);
142 svid = mfspr(SPRN_SVR); 141 svid = mfspr(SPRN_SVR);
@@ -149,9 +148,6 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
149 /* Display cpu Pll setting */ 148 /* Display cpu Pll setting */
150 phid1 = mfspr(SPRN_HID1); 149 phid1 = mfspr(SPRN_HID1);
151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 150 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
152
153 /* Display the amount of memory */
154 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
155} 151}
156 152
157static struct of_device_id __initdata of_bus_ids[] = { 153static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index 0c9a856f66b6..472f254a19d2 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -194,7 +194,6 @@ static void __init sbc8560_setup_arch(void)
194static void sbc8560_show_cpuinfo(struct seq_file *m) 194static void sbc8560_show_cpuinfo(struct seq_file *m)
195{ 195{
196 uint pvid, svid, phid1; 196 uint pvid, svid, phid1;
197 uint memsize = total_memory;
198 197
199 pvid = mfspr(SPRN_PVR); 198 pvid = mfspr(SPRN_PVR);
200 svid = mfspr(SPRN_SVR); 199 svid = mfspr(SPRN_SVR);
@@ -206,9 +205,6 @@ static void sbc8560_show_cpuinfo(struct seq_file *m)
206 /* Display cpu Pll setting */ 205 /* Display cpu Pll setting */
207 phid1 = mfspr(SPRN_HID1); 206 phid1 = mfspr(SPRN_HID1);
208 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 207 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
209
210 /* Display the amount of memory */
211 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
212} 208}
213 209
214static struct of_device_id __initdata of_bus_ids[] = { 210static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/stx_gp3.c b/arch/powerpc/platforms/85xx/stx_gp3.c
index 18499d7c9d9e..0cca8f5cb272 100644
--- a/arch/powerpc/platforms/85xx/stx_gp3.c
+++ b/arch/powerpc/platforms/85xx/stx_gp3.c
@@ -130,7 +130,6 @@ static void __init stx_gp3_setup_arch(void)
130static void stx_gp3_show_cpuinfo(struct seq_file *m) 130static void stx_gp3_show_cpuinfo(struct seq_file *m)
131{ 131{
132 uint pvid, svid, phid1; 132 uint pvid, svid, phid1;
133 uint memsize = total_memory;
134 133
135 pvid = mfspr(SPRN_PVR); 134 pvid = mfspr(SPRN_PVR);
136 svid = mfspr(SPRN_SVR); 135 svid = mfspr(SPRN_SVR);
@@ -142,9 +141,6 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)
142 /* Display cpu Pll setting */ 141 /* Display cpu Pll setting */
143 phid1 = mfspr(SPRN_HID1); 142 phid1 = mfspr(SPRN_HID1);
144 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 143 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
145
146 /* Display the amount of memory */
147 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
148} 144}
149 145
150static struct of_device_id __initdata of_bus_ids[] = { 146static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index d850880d6964..2933a8e827d9 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -138,7 +138,6 @@ static void __init tqm85xx_setup_arch(void)
138static void tqm85xx_show_cpuinfo(struct seq_file *m) 138static void tqm85xx_show_cpuinfo(struct seq_file *m)
139{ 139{
140 uint pvid, svid, phid1; 140 uint pvid, svid, phid1;
141 uint memsize = total_memory;
142 141
143 pvid = mfspr(SPRN_PVR); 142 pvid = mfspr(SPRN_PVR);
144 svid = mfspr(SPRN_SVR); 143 svid = mfspr(SPRN_SVR);
@@ -150,9 +149,6 @@ static void tqm85xx_show_cpuinfo(struct seq_file *m)
150 /* Display cpu Pll setting */ 149 /* Display cpu Pll setting */
151 phid1 = mfspr(SPRN_HID1); 150 phid1 = mfspr(SPRN_HID1);
152 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
153
154 /* Display the amount of memory */
155 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
156} 152}
157 153
158static struct of_device_id __initdata of_bus_ids[] = { 154static struct of_device_id __initdata of_bus_ids[] = {
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index 821c45fac18b..fb371f5ce132 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -127,7 +127,6 @@ static unsigned int gef_sbc610_get_fpga_rev(void)
127 127
128static void gef_sbc610_show_cpuinfo(struct seq_file *m) 128static void gef_sbc610_show_cpuinfo(struct seq_file *m)
129{ 129{
130 uint memsize = total_memory;
131 uint svid = mfspr(SPRN_SVR); 130 uint svid = mfspr(SPRN_SVR);
132 131
133 seq_printf(m, "Vendor\t\t: GE Fanuc Intelligent Platforms\n"); 132 seq_printf(m, "Vendor\t\t: GE Fanuc Intelligent Platforms\n");
@@ -137,7 +136,6 @@ static void gef_sbc610_show_cpuinfo(struct seq_file *m)
137 seq_printf(m, "FPGA Revision\t: %u\n", gef_sbc610_get_fpga_rev()); 136 seq_printf(m, "FPGA Revision\t: %u\n", gef_sbc610_get_fpga_rev());
138 137
139 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 138 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
140 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
141} 139}
142 140
143static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev) 141static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev)
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 2672829a71dc..27e0e682d8e1 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -101,13 +101,11 @@ mpc86xx_hpcn_setup_arch(void)
101static void 101static void
102mpc86xx_hpcn_show_cpuinfo(struct seq_file *m) 102mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
103{ 103{
104 uint memsize = total_memory;
105 uint svid = mfspr(SPRN_SVR); 104 uint svid = mfspr(SPRN_SVR);
106 105
107 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n"); 106 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
108 107
109 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 108 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
110 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
111} 109}
112 110
113 111
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
index da677a74e2d1..5fd7ed40986f 100644
--- a/arch/powerpc/platforms/86xx/sbc8641d.c
+++ b/arch/powerpc/platforms/86xx/sbc8641d.c
@@ -63,13 +63,11 @@ sbc8641_setup_arch(void)
63static void 63static void
64sbc8641_show_cpuinfo(struct seq_file *m) 64sbc8641_show_cpuinfo(struct seq_file *m)
65{ 65{
66 uint memsize = total_memory;
67 uint svid = mfspr(SPRN_SVR); 66 uint svid = mfspr(SPRN_SVR);
68 67
69 seq_printf(m, "Vendor\t\t: Wind River Systems\n"); 68 seq_printf(m, "Vendor\t\t: Wind River Systems\n");
70 69
71 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 70 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
72 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
73} 71}
74 72
75 73
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 2a14b052abcd..665af1c4195b 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -21,6 +21,7 @@
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22#include <asm/rtas.h> 22#include <asm/rtas.h>
23#include <asm/cell-regs.h> 23#include <asm/cell-regs.h>
24#include <asm/kdump.h>
24 25
25#include "ras.h" 26#include "ras.h"
26 27
@@ -111,9 +112,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order)
111 int ret = -ENOMEM; 112 int ret = -ENOMEM;
112 unsigned long addr; 113 unsigned long addr;
113 114
114#ifdef CONFIG_CRASH_DUMP 115 if (__kdump_flag)
115 rtas_call(ptcal_stop_tok, 1, 1, NULL, nid); 116 rtas_call(ptcal_stop_tok, 1, 1, NULL, nid);
116#endif
117 117
118 area = kmalloc(sizeof(*area), GFP_KERNEL); 118 area = kmalloc(sizeof(*area), GFP_KERNEL);
119 if (!area) 119 if (!area)
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index efb3964457b1..c0d86e1f56ea 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -54,8 +54,8 @@
54#endif 54#endif
55 55
56/* 56/*
57 * The primary thread of each non-boot processor is recorded here before 57 * The Primary thread of each non-boot processor was started from the OF client
58 * smp init. 58 * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
59 */ 59 */
60static cpumask_t of_spin_map; 60static cpumask_t of_spin_map;
61 61
@@ -208,11 +208,7 @@ void __init smp_init_cell(void)
208 /* Mark threads which are still spinning in hold loops. */ 208 /* Mark threads which are still spinning in hold loops. */
209 if (cpu_has_feature(CPU_FTR_SMT)) { 209 if (cpu_has_feature(CPU_FTR_SMT)) {
210 for_each_present_cpu(i) { 210 for_each_present_cpu(i) {
211 if (i % 2 == 0) 211 if (cpu_thread_in_core(i) == 0)
212 /*
213 * Even-numbered logical cpus correspond to
214 * primary threads.
215 */
216 cpu_set(i, of_spin_map); 212 cpu_set(i, of_spin_map);
217 } 213 }
218 } else { 214 } else {
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 010a51f59796..b73c369cc6f1 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -548,6 +548,11 @@ spufs_regs_read(struct file *file, char __user *buffer,
548 int ret; 548 int ret;
549 struct spu_context *ctx = file->private_data; 549 struct spu_context *ctx = file->private_data;
550 550
551 /* pre-check for file position: if we'd return EOF, there's no point
552 * causing a deschedule */
553 if (*pos >= sizeof(ctx->csa.lscsa->gprs))
554 return 0;
555
551 ret = spu_acquire_saved(ctx); 556 ret = spu_acquire_saved(ctx);
552 if (ret) 557 if (ret)
553 return ret; 558 return ret;
@@ -2426,38 +2431,49 @@ static inline int spufs_switch_log_avail(struct spu_context *ctx)
2426static int spufs_switch_log_open(struct inode *inode, struct file *file) 2431static int spufs_switch_log_open(struct inode *inode, struct file *file)
2427{ 2432{
2428 struct spu_context *ctx = SPUFS_I(inode)->i_ctx; 2433 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2434 int rc;
2435
2436 rc = spu_acquire(ctx);
2437 if (rc)
2438 return rc;
2429 2439
2430 /*
2431 * We (ab-)use the mapping_lock here because it serves the similar
2432 * purpose for synchronizing open/close elsewhere. Maybe it should
2433 * be renamed eventually.
2434 */
2435 mutex_lock(&ctx->mapping_lock);
2436 if (ctx->switch_log) { 2440 if (ctx->switch_log) {
2437 spin_lock(&ctx->switch_log->lock); 2441 rc = -EBUSY;
2438 ctx->switch_log->head = 0; 2442 goto out;
2439 ctx->switch_log->tail = 0;
2440 spin_unlock(&ctx->switch_log->lock);
2441 } else {
2442 /*
2443 * We allocate the switch log data structures on first open.
2444 * They will never be free because we assume a context will
2445 * be traced until it goes away.
2446 */
2447 ctx->switch_log = kzalloc(sizeof(struct switch_log) +
2448 SWITCH_LOG_BUFSIZE * sizeof(struct switch_log_entry),
2449 GFP_KERNEL);
2450 if (!ctx->switch_log)
2451 goto out;
2452 spin_lock_init(&ctx->switch_log->lock);
2453 init_waitqueue_head(&ctx->switch_log->wait);
2454 } 2443 }
2455 mutex_unlock(&ctx->mapping_lock); 2444
2445 ctx->switch_log = kmalloc(sizeof(struct switch_log) +
2446 SWITCH_LOG_BUFSIZE * sizeof(struct switch_log_entry),
2447 GFP_KERNEL);
2448
2449 if (!ctx->switch_log) {
2450 rc = -ENOMEM;
2451 goto out;
2452 }
2453
2454 ctx->switch_log->head = ctx->switch_log->tail = 0;
2455 init_waitqueue_head(&ctx->switch_log->wait);
2456 rc = 0;
2457
2458out:
2459 spu_release(ctx);
2460 return rc;
2461}
2462
2463static int spufs_switch_log_release(struct inode *inode, struct file *file)
2464{
2465 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2466 int rc;
2467
2468 rc = spu_acquire(ctx);
2469 if (rc)
2470 return rc;
2471
2472 kfree(ctx->switch_log);
2473 ctx->switch_log = NULL;
2474 spu_release(ctx);
2456 2475
2457 return 0; 2476 return 0;
2458 out:
2459 mutex_unlock(&ctx->mapping_lock);
2460 return -ENOMEM;
2461} 2477}
2462 2478
2463static int switch_log_sprint(struct spu_context *ctx, char *tbuf, int n) 2479static int switch_log_sprint(struct spu_context *ctx, char *tbuf, int n)
@@ -2485,42 +2501,54 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
2485 if (!buf || len < 0) 2501 if (!buf || len < 0)
2486 return -EINVAL; 2502 return -EINVAL;
2487 2503
2504 error = spu_acquire(ctx);
2505 if (error)
2506 return error;
2507
2488 while (cnt < len) { 2508 while (cnt < len) {
2489 char tbuf[128]; 2509 char tbuf[128];
2490 int width; 2510 int width;
2491 2511
2492 if (file->f_flags & O_NONBLOCK) { 2512 if (spufs_switch_log_used(ctx) == 0) {
2493 if (spufs_switch_log_used(ctx) <= 0) 2513 if (cnt > 0) {
2494 return cnt ? cnt : -EAGAIN; 2514 /* If there's data ready to go, we can
2495 } else { 2515 * just return straight away */
2496 /* Wait for data in buffer */ 2516 break;
2497 error = wait_event_interruptible(ctx->switch_log->wait, 2517
2498 spufs_switch_log_used(ctx) > 0); 2518 } else if (file->f_flags & O_NONBLOCK) {
2499 if (error) 2519 error = -EAGAIN;
2500 break; 2520 break;
2501 }
2502 2521
2503 spin_lock(&ctx->switch_log->lock); 2522 } else {
2504 if (ctx->switch_log->head == ctx->switch_log->tail) { 2523 /* spufs_wait will drop the mutex and
2505 /* multiple readers race? */ 2524 * re-acquire, but since we're in read(), the
2506 spin_unlock(&ctx->switch_log->lock); 2525 * file cannot be _released (and so
2507 continue; 2526 * ctx->switch_log is stable).
2527 */
2528 error = spufs_wait(ctx->switch_log->wait,
2529 spufs_switch_log_used(ctx) > 0);
2530
2531 /* On error, spufs_wait returns without the
2532 * state mutex held */
2533 if (error)
2534 return error;
2535
2536 /* We may have had entries read from underneath
2537 * us while we dropped the mutex in spufs_wait,
2538 * so re-check */
2539 if (spufs_switch_log_used(ctx) == 0)
2540 continue;
2541 }
2508 } 2542 }
2509 2543
2510 width = switch_log_sprint(ctx, tbuf, sizeof(tbuf)); 2544 width = switch_log_sprint(ctx, tbuf, sizeof(tbuf));
2511 if (width < len) { 2545 if (width < len)
2512 ctx->switch_log->tail = 2546 ctx->switch_log->tail =
2513 (ctx->switch_log->tail + 1) % 2547 (ctx->switch_log->tail + 1) %
2514 SWITCH_LOG_BUFSIZE; 2548 SWITCH_LOG_BUFSIZE;
2515 } 2549 else
2516 2550 /* If the record is greater than space available return
2517 spin_unlock(&ctx->switch_log->lock); 2551 * partial buffer (so far) */
2518
2519 /*
2520 * If the record is greater than space available return
2521 * partial buffer (so far)
2522 */
2523 if (width >= len)
2524 break; 2552 break;
2525 2553
2526 error = copy_to_user(buf + cnt, tbuf, width); 2554 error = copy_to_user(buf + cnt, tbuf, width);
@@ -2529,6 +2557,8 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
2529 cnt += width; 2557 cnt += width;
2530 } 2558 }
2531 2559
2560 spu_release(ctx);
2561
2532 return cnt == 0 ? error : cnt; 2562 return cnt == 0 ? error : cnt;
2533} 2563}
2534 2564
@@ -2537,29 +2567,41 @@ static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait)
2537 struct inode *inode = file->f_path.dentry->d_inode; 2567 struct inode *inode = file->f_path.dentry->d_inode;
2538 struct spu_context *ctx = SPUFS_I(inode)->i_ctx; 2568 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2539 unsigned int mask = 0; 2569 unsigned int mask = 0;
2570 int rc;
2540 2571
2541 poll_wait(file, &ctx->switch_log->wait, wait); 2572 poll_wait(file, &ctx->switch_log->wait, wait);
2542 2573
2574 rc = spu_acquire(ctx);
2575 if (rc)
2576 return rc;
2577
2543 if (spufs_switch_log_used(ctx) > 0) 2578 if (spufs_switch_log_used(ctx) > 0)
2544 mask |= POLLIN; 2579 mask |= POLLIN;
2545 2580
2581 spu_release(ctx);
2582
2546 return mask; 2583 return mask;
2547} 2584}
2548 2585
2549static const struct file_operations spufs_switch_log_fops = { 2586static const struct file_operations spufs_switch_log_fops = {
2550 .owner = THIS_MODULE, 2587 .owner = THIS_MODULE,
2551 .open = spufs_switch_log_open, 2588 .open = spufs_switch_log_open,
2552 .read = spufs_switch_log_read, 2589 .read = spufs_switch_log_read,
2553 .poll = spufs_switch_log_poll, 2590 .poll = spufs_switch_log_poll,
2591 .release = spufs_switch_log_release,
2554}; 2592};
2555 2593
2594/**
2595 * Log a context switch event to a switch log reader.
2596 *
2597 * Must be called with ctx->state_mutex held.
2598 */
2556void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx, 2599void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
2557 u32 type, u32 val) 2600 u32 type, u32 val)
2558{ 2601{
2559 if (!ctx->switch_log) 2602 if (!ctx->switch_log)
2560 return; 2603 return;
2561 2604
2562 spin_lock(&ctx->switch_log->lock);
2563 if (spufs_switch_log_avail(ctx) > 1) { 2605 if (spufs_switch_log_avail(ctx) > 1) {
2564 struct switch_log_entry *p; 2606 struct switch_log_entry *p;
2565 2607
@@ -2573,7 +2615,6 @@ void spu_switch_log_notify(struct spu *spu, struct spu_context *ctx,
2573 ctx->switch_log->head = 2615 ctx->switch_log->head =
2574 (ctx->switch_log->head + 1) % SWITCH_LOG_BUFSIZE; 2616 (ctx->switch_log->head + 1) % SWITCH_LOG_BUFSIZE;
2575 } 2617 }
2576 spin_unlock(&ctx->switch_log->lock);
2577 2618
2578 wake_up(&ctx->switch_log->wait); 2619 wake_up(&ctx->switch_log->wait);
2579} 2620}
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index c9bb7cfd3dca..c58bd36b0c5b 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -249,6 +249,7 @@ static int spu_run_fini(struct spu_context *ctx, u32 *npc,
249 249
250 spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED); 250 spuctx_switch_state(ctx, SPU_UTIL_IDLE_LOADED);
251 clear_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags); 251 clear_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags);
252 spu_switch_log_notify(NULL, ctx, SWITCH_LOG_EXIT, *status);
252 spu_release(ctx); 253 spu_release(ctx);
253 254
254 if (signal_pending(current)) 255 if (signal_pending(current))
@@ -417,8 +418,6 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event)
417 ret = spu_run_fini(ctx, npc, &status); 418 ret = spu_run_fini(ctx, npc, &status);
418 spu_yield(ctx); 419 spu_yield(ctx);
419 420
420 spu_switch_log_notify(NULL, ctx, SWITCH_LOG_EXIT, status);
421
422 if ((status & SPU_STATUS_STOPPED_BY_STOP) && 421 if ((status & SPU_STATUS_STOPPED_BY_STOP) &&
423 (((status >> SPU_STOP_STATUS_SHIFT) & 0x3f00) == 0x2100)) 422 (((status >> SPU_STOP_STATUS_SHIFT) & 0x3f00) == 0x2100))
424 ctx->stats.libassist++; 423 ctx->stats.libassist++;
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 67595bc380dc..2ad914c47493 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -312,6 +312,15 @@ static struct spu *aff_ref_location(struct spu_context *ctx, int mem_aff,
312 */ 312 */
313 node = cpu_to_node(raw_smp_processor_id()); 313 node = cpu_to_node(raw_smp_processor_id());
314 for (n = 0; n < MAX_NUMNODES; n++, node++) { 314 for (n = 0; n < MAX_NUMNODES; n++, node++) {
315 /*
316 * "available_spus" counts how many spus are not potentially
317 * going to be used by other affinity gangs whose reference
318 * context is already in place. Although this code seeks to
319 * avoid having affinity gangs with a summed amount of
320 * contexts bigger than the amount of spus in the node,
321 * this may happen sporadically. In this case, available_spus
322 * becomes negative, which is harmless.
323 */
315 int available_spus; 324 int available_spus;
316 325
317 node = (node < MAX_NUMNODES) ? node : 0; 326 node = (node < MAX_NUMNODES) ? node : 0;
@@ -321,12 +330,10 @@ static struct spu *aff_ref_location(struct spu_context *ctx, int mem_aff,
321 available_spus = 0; 330 available_spus = 0;
322 mutex_lock(&cbe_spu_info[node].list_mutex); 331 mutex_lock(&cbe_spu_info[node].list_mutex);
323 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) { 332 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
324 if (spu->ctx && spu->ctx->gang 333 if (spu->ctx && spu->ctx->gang && !spu->ctx->aff_offset
325 && spu->ctx->aff_offset == 0) 334 && spu->ctx->gang->aff_ref_spu)
326 available_spus -= 335 available_spus -= spu->ctx->gang->contexts;
327 (spu->ctx->gang->contexts - 1); 336 available_spus++;
328 else
329 available_spus++;
330 } 337 }
331 if (available_spus < ctx->gang->contexts) { 338 if (available_spus < ctx->gang->contexts) {
332 mutex_unlock(&cbe_spu_info[node].list_mutex); 339 mutex_unlock(&cbe_spu_info[node].list_mutex);
@@ -437,6 +444,11 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx)
437 atomic_dec(&cbe_spu_info[spu->node].reserved_spus); 444 atomic_dec(&cbe_spu_info[spu->node].reserved_spus);
438 445
439 if (ctx->gang) 446 if (ctx->gang)
447 /*
448 * If ctx->gang->aff_sched_count is positive, SPU affinity is
449 * being considered in this gang. Using atomic_dec_if_positive
450 * allow us to skip an explicit check for affinity in this gang
451 */
440 atomic_dec_if_positive(&ctx->gang->aff_sched_count); 452 atomic_dec_if_positive(&ctx->gang->aff_sched_count);
441 453
442 spu_switch_notify(spu, NULL); 454 spu_switch_notify(spu, NULL);
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 8ae8ef9dfc22..15c62d3ca129 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -65,7 +65,6 @@ enum {
65}; 65};
66 66
67struct switch_log { 67struct switch_log {
68 spinlock_t lock;
69 wait_queue_head_t wait; 68 wait_queue_head_t wait;
70 unsigned long head; 69 unsigned long head;
71 unsigned long tail; 70 unsigned long tail;
diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c
index 2ece399f2862..d0b1f3f4d9c8 100644
--- a/arch/powerpc/platforms/cell/spufs/sputrace.c
+++ b/arch/powerpc/platforms/cell/spufs/sputrace.c
@@ -40,6 +40,7 @@ static DECLARE_WAIT_QUEUE_HEAD(sputrace_wait);
40static ktime_t sputrace_start; 40static ktime_t sputrace_start;
41static unsigned long sputrace_head, sputrace_tail; 41static unsigned long sputrace_head, sputrace_tail;
42static struct sputrace *sputrace_log; 42static struct sputrace *sputrace_log;
43static int sputrace_logging;
43 44
44static int sputrace_used(void) 45static int sputrace_used(void)
45{ 46{
@@ -79,6 +80,11 @@ static ssize_t sputrace_read(struct file *file, char __user *buf,
79 char tbuf[128]; 80 char tbuf[128];
80 int width; 81 int width;
81 82
83 /* If we have data ready to return, don't block waiting
84 * for more */
85 if (cnt > 0 && sputrace_used() == 0)
86 break;
87
82 error = wait_event_interruptible(sputrace_wait, 88 error = wait_event_interruptible(sputrace_wait,
83 sputrace_used() > 0); 89 sputrace_used() > 0);
84 if (error) 90 if (error)
@@ -109,24 +115,49 @@ static ssize_t sputrace_read(struct file *file, char __user *buf,
109 115
110static int sputrace_open(struct inode *inode, struct file *file) 116static int sputrace_open(struct inode *inode, struct file *file)
111{ 117{
118 int rc;
119
112 spin_lock(&sputrace_lock); 120 spin_lock(&sputrace_lock);
121 if (sputrace_logging) {
122 rc = -EBUSY;
123 goto out;
124 }
125
126 sputrace_logging = 1;
113 sputrace_head = sputrace_tail = 0; 127 sputrace_head = sputrace_tail = 0;
114 sputrace_start = ktime_get(); 128 sputrace_start = ktime_get();
129 rc = 0;
130
131out:
115 spin_unlock(&sputrace_lock); 132 spin_unlock(&sputrace_lock);
133 return rc;
134}
116 135
136static int sputrace_release(struct inode *inode, struct file *file)
137{
138 spin_lock(&sputrace_lock);
139 sputrace_logging = 0;
140 spin_unlock(&sputrace_lock);
117 return 0; 141 return 0;
118} 142}
119 143
120static const struct file_operations sputrace_fops = { 144static const struct file_operations sputrace_fops = {
121 .owner = THIS_MODULE, 145 .owner = THIS_MODULE,
122 .open = sputrace_open, 146 .open = sputrace_open,
123 .read = sputrace_read, 147 .read = sputrace_read,
148 .release = sputrace_release,
124}; 149};
125 150
126static void sputrace_log_item(const char *name, struct spu_context *ctx, 151static void sputrace_log_item(const char *name, struct spu_context *ctx,
127 struct spu *spu) 152 struct spu *spu)
128{ 153{
129 spin_lock(&sputrace_lock); 154 spin_lock(&sputrace_lock);
155
156 if (!sputrace_logging) {
157 spin_unlock(&sputrace_lock);
158 return;
159 }
160
130 if (sputrace_avail() > 1) { 161 if (sputrace_avail() > 1) {
131 struct sputrace *t = sputrace_log + sputrace_head; 162 struct sputrace *t = sputrace_log + sputrace_head;
132 163
diff --git a/arch/powerpc/platforms/embedded6xx/c2k.c b/arch/powerpc/platforms/embedded6xx/c2k.c
index d0b25b8c39d1..32ba0fa0ad03 100644
--- a/arch/powerpc/platforms/embedded6xx/c2k.c
+++ b/arch/powerpc/platforms/embedded6xx/c2k.c
@@ -116,10 +116,7 @@ static void c2k_restart(char *cmd)
116 116
117void c2k_show_cpuinfo(struct seq_file *m) 117void c2k_show_cpuinfo(struct seq_file *m)
118{ 118{
119 uint memsize = total_memory;
120
121 seq_printf(m, "Vendor\t\t: GEFanuc\n"); 119 seq_printf(m, "Vendor\t\t: GEFanuc\n");
122 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
123 seq_printf(m, "coherency\t: %s\n", COHERENCY_SETTING); 120 seq_printf(m, "coherency\t: %s\n", COHERENCY_SETTING);
124} 121}
125 122
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index 5a19b9a1457c..4c485e984236 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -119,10 +119,7 @@ static void prpmc2800_restart(char *cmd)
119 119
120void prpmc2800_show_cpuinfo(struct seq_file *m) 120void prpmc2800_show_cpuinfo(struct seq_file *m)
121{ 121{
122 uint memsize = total_memory;
123
124 seq_printf(m, "Vendor\t\t: Motorola\n"); 122 seq_printf(m, "Vendor\t\t: Motorola\n");
125 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
126 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING); 123 seq_printf(m, "coherency\t: %s\n", PPRPM2800_COHERENCY_SETTING);
127} 124}
128 125
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 140d02a5232a..a623ad256e9e 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -22,6 +22,12 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
22 int ret; 22 int ret;
23 23
24 start_pfn = base >> PAGE_SHIFT; 24 start_pfn = base >> PAGE_SHIFT;
25
26 if (!pfn_valid(start_pfn)) {
27 lmb_remove(base, lmb_size);
28 return 0;
29 }
30
25 zone = page_zone(pfn_to_page(start_pfn)); 31 zone = page_zone(pfn_to_page(start_pfn));
26 32
27 /* 33 /*
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index a8c446697f9e..d56491d182d3 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -44,6 +44,7 @@
44#include <asm/tce.h> 44#include <asm/tce.h>
45#include <asm/ppc-pci.h> 45#include <asm/ppc-pci.h>
46#include <asm/udbg.h> 46#include <asm/udbg.h>
47#include <asm/kdump.h>
47 48
48#include "plpar_wrappers.h" 49#include "plpar_wrappers.h"
49 50
@@ -291,9 +292,8 @@ static void iommu_table_setparms(struct pci_controller *phb,
291 292
292 tbl->it_base = (unsigned long)__va(*basep); 293 tbl->it_base = (unsigned long)__va(*basep);
293 294
294#ifndef CONFIG_CRASH_DUMP 295 if (!__kdump_flag)
295 memset((void *)tbl->it_base, 0, *sizep); 296 memset((void *)tbl->it_base, 0, *sizep);
296#endif
297 297
298 tbl->it_busno = phb->bus->number; 298 tbl->it_busno = phb->bus->number;
299 299
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index e00f96baa381..1a231c389ba0 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -52,8 +52,8 @@
52 52
53 53
54/* 54/*
55 * The primary thread of each non-boot processor is recorded here before 55 * The Primary thread of each non-boot processor was started from the OF client
56 * smp init. 56 * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
57 */ 57 */
58static cpumask_t of_spin_map; 58static cpumask_t of_spin_map;
59 59
@@ -161,8 +161,7 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
161static int smp_pSeries_cpu_bootable(unsigned int nr) 161static int smp_pSeries_cpu_bootable(unsigned int nr)
162{ 162{
163 /* Special case - we inhibit secondary thread startup 163 /* Special case - we inhibit secondary thread startup
164 * during boot if the user requests it. Odd-numbered 164 * during boot if the user requests it.
165 * cpus are assumed to be secondary threads.
166 */ 165 */
167 if (system_state < SYSTEM_RUNNING && 166 if (system_state < SYSTEM_RUNNING &&
168 cpu_has_feature(CPU_FTR_SMT) && 167 cpu_has_feature(CPU_FTR_SMT) &&
@@ -199,11 +198,7 @@ static void __init smp_init_pseries(void)
199 /* Mark threads which are still spinning in hold loops. */ 198 /* Mark threads which are still spinning in hold loops. */
200 if (cpu_has_feature(CPU_FTR_SMT)) { 199 if (cpu_has_feature(CPU_FTR_SMT)) {
201 for_each_present_cpu(i) { 200 for_each_present_cpu(i) {
202 if (i % 2 == 0) 201 if (cpu_thread_in_core(i) == 0)
203 /*
204 * Even-numbered logical cpus correspond to
205 * primary threads.
206 */
207 cpu_set(i, of_spin_map); 202 cpu_set(i, of_spin_map);
208 } 203 }
209 } else { 204 } else {
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index a44709a94f97..5afce115ab1f 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_OF_RTC) += of_rtc.o
37ifeq ($(CONFIG_PCI),y) 37ifeq ($(CONFIG_PCI),y)
38obj-$(CONFIG_4xx) += ppc4xx_pci.o 38obj-$(CONFIG_4xx) += ppc4xx_pci.o
39endif 39endif
40obj-$(CONFIG_PPC4xx_GPIO) += ppc4xx_gpio.o
40 41
41obj-$(CONFIG_CPM) += cpm_common.o 42obj-$(CONFIG_CPM) += cpm_common.o
42obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o 43obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o
diff --git a/arch/powerpc/sysdev/ppc4xx_gpio.c b/arch/powerpc/sysdev/ppc4xx_gpio.c
new file mode 100644
index 000000000000..110efe2a54fc
--- /dev/null
+++ b/arch/powerpc/sysdev/ppc4xx_gpio.c
@@ -0,0 +1,217 @@
1/*
2 * PPC4xx gpio driver
3 *
4 * Copyright (c) 2008 Harris Corporation
5 * Copyright (c) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 * Copyright (c) MontaVista Software, Inc. 2008.
7 *
8 * Author: Steve Falco <sfalco@harris.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/spinlock.h>
27#include <linux/io.h>
28#include <linux/of.h>
29#include <linux/of_gpio.h>
30#include <linux/gpio.h>
31#include <linux/types.h>
32
33#define GPIO_MASK(gpio) (0x80000000 >> (gpio))
34#define GPIO_MASK2(gpio) (0xc0000000 >> ((gpio) * 2))
35
36/* Physical GPIO register layout */
37struct ppc4xx_gpio {
38 __be32 or;
39 __be32 tcr;
40 __be32 osrl;
41 __be32 osrh;
42 __be32 tsrl;
43 __be32 tsrh;
44 __be32 odr;
45 __be32 ir;
46 __be32 rr1;
47 __be32 rr2;
48 __be32 rr3;
49 __be32 reserved1;
50 __be32 isr1l;
51 __be32 isr1h;
52 __be32 isr2l;
53 __be32 isr2h;
54 __be32 isr3l;
55 __be32 isr3h;
56};
57
58struct ppc4xx_gpio_chip {
59 struct of_mm_gpio_chip mm_gc;
60 spinlock_t lock;
61};
62
63/*
64 * GPIO LIB API implementation for GPIOs
65 *
66 * There are a maximum of 32 gpios in each gpio controller.
67 */
68
69static inline struct ppc4xx_gpio_chip *
70to_ppc4xx_gpiochip(struct of_mm_gpio_chip *mm_gc)
71{
72 return container_of(mm_gc, struct ppc4xx_gpio_chip, mm_gc);
73}
74
75static int ppc4xx_gpio_get(struct gpio_chip *gc, unsigned int gpio)
76{
77 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
78 struct ppc4xx_gpio __iomem *regs = mm_gc->regs;
79
80 return in_be32(&regs->ir) & GPIO_MASK(gpio);
81}
82
83static inline void
84__ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
85{
86 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
87 struct ppc4xx_gpio __iomem *regs = mm_gc->regs;
88
89 if (val)
90 setbits32(&regs->or, GPIO_MASK(gpio));
91 else
92 clrbits32(&regs->or, GPIO_MASK(gpio));
93}
94
95static void
96ppc4xx_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
97{
98 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
99 struct ppc4xx_gpio_chip *chip = to_ppc4xx_gpiochip(mm_gc);
100 unsigned long flags;
101
102 spin_lock_irqsave(&chip->lock, flags);
103
104 __ppc4xx_gpio_set(gc, gpio, val);
105
106 spin_unlock_irqrestore(&chip->lock, flags);
107
108 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
109}
110
111static int ppc4xx_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
112{
113 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
114 struct ppc4xx_gpio_chip *chip = to_ppc4xx_gpiochip(mm_gc);
115 struct ppc4xx_gpio __iomem *regs = mm_gc->regs;
116 unsigned long flags;
117
118 spin_lock_irqsave(&chip->lock, flags);
119
120 /* Disable open-drain function */
121 clrbits32(&regs->odr, GPIO_MASK(gpio));
122
123 /* Float the pin */
124 clrbits32(&regs->tcr, GPIO_MASK(gpio));
125
126 /* Bits 0-15 use TSRL/OSRL, bits 16-31 use TSRH/OSRH */
127 if (gpio < 16) {
128 clrbits32(&regs->osrl, GPIO_MASK2(gpio));
129 clrbits32(&regs->tsrl, GPIO_MASK2(gpio));
130 } else {
131 clrbits32(&regs->osrh, GPIO_MASK2(gpio));
132 clrbits32(&regs->tsrh, GPIO_MASK2(gpio));
133 }
134
135 spin_unlock_irqrestore(&chip->lock, flags);
136
137 return 0;
138}
139
140static int
141ppc4xx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
142{
143 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
144 struct ppc4xx_gpio_chip *chip = to_ppc4xx_gpiochip(mm_gc);
145 struct ppc4xx_gpio __iomem *regs = mm_gc->regs;
146 unsigned long flags;
147
148 spin_lock_irqsave(&chip->lock, flags);
149
150 /* First set initial value */
151 __ppc4xx_gpio_set(gc, gpio, val);
152
153 /* Disable open-drain function */
154 clrbits32(&regs->odr, GPIO_MASK(gpio));
155
156 /* Drive the pin */
157 setbits32(&regs->tcr, GPIO_MASK(gpio));
158
159 /* Bits 0-15 use TSRL, bits 16-31 use TSRH */
160 if (gpio < 16) {
161 clrbits32(&regs->osrl, GPIO_MASK2(gpio));
162 clrbits32(&regs->tsrl, GPIO_MASK2(gpio));
163 } else {
164 clrbits32(&regs->osrh, GPIO_MASK2(gpio));
165 clrbits32(&regs->tsrh, GPIO_MASK2(gpio));
166 }
167
168 spin_unlock_irqrestore(&chip->lock, flags);
169
170 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
171
172 return 0;
173}
174
175static int __init ppc4xx_add_gpiochips(void)
176{
177 struct device_node *np;
178
179 for_each_compatible_node(np, NULL, "ibm,ppc4xx-gpio") {
180 int ret;
181 struct ppc4xx_gpio_chip *ppc4xx_gc;
182 struct of_mm_gpio_chip *mm_gc;
183 struct of_gpio_chip *of_gc;
184 struct gpio_chip *gc;
185
186 ppc4xx_gc = kzalloc(sizeof(*ppc4xx_gc), GFP_KERNEL);
187 if (!ppc4xx_gc) {
188 ret = -ENOMEM;
189 goto err;
190 }
191
192 spin_lock_init(&ppc4xx_gc->lock);
193
194 mm_gc = &ppc4xx_gc->mm_gc;
195 of_gc = &mm_gc->of_gc;
196 gc = &of_gc->gc;
197
198 of_gc->gpio_cells = 2;
199 gc->ngpio = 32;
200 gc->direction_input = ppc4xx_gpio_dir_in;
201 gc->direction_output = ppc4xx_gpio_dir_out;
202 gc->get = ppc4xx_gpio_get;
203 gc->set = ppc4xx_gpio_set;
204
205 ret = of_mm_gpiochip_add(np, mm_gc);
206 if (ret)
207 goto err;
208 continue;
209err:
210 pr_err("%s: registration failed with status %d\n",
211 np->full_name, ret);
212 kfree(ppc4xx_gc);
213 /* try others anyway */
214 }
215 return 0;
216}
217arch_initcall(ppc4xx_add_gpiochips);
diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c
index 9ab815b95b5a..17bb6035069b 100644
--- a/arch/sparc/oprofile/init.c
+++ b/arch/sparc/oprofile/init.c
@@ -12,7 +12,7 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15int __init oprofile_arch_init(struct oprofile_operations * ops) 15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{ 16{
17 return -ENODEV; 17 return -ENODEV;
18} 18}
diff --git a/arch/sparc64/oprofile/init.c b/arch/sparc64/oprofile/init.c
index 9ab815b95b5a..17bb6035069b 100644
--- a/arch/sparc64/oprofile/init.c
+++ b/arch/sparc64/oprofile/init.c
@@ -12,7 +12,7 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15int __init oprofile_arch_init(struct oprofile_operations * ops) 15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{ 16{
17 return -ENODEV; 17 return -ENODEV;
18} 18}
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 4cd8083c58be..0cdcda35a05f 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -212,7 +212,7 @@ static void __init iommu_set_exclusion_range(struct amd_iommu *iommu)
212/* Programs the physical address of the device table into the IOMMU hardware */ 212/* Programs the physical address of the device table into the IOMMU hardware */
213static void __init iommu_set_device_table(struct amd_iommu *iommu) 213static void __init iommu_set_device_table(struct amd_iommu *iommu)
214{ 214{
215 u32 entry; 215 u64 entry;
216 216
217 BUG_ON(iommu->mmio_base == NULL); 217 BUG_ON(iommu->mmio_base == NULL);
218 218
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index ccf6c503fc3b..d1d4dc52f649 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -36,7 +36,7 @@ void ack_bad_irq(unsigned int irq)
36} 36}
37 37
38#ifdef CONFIG_X86_32 38#ifdef CONFIG_X86_32
39# define irq_stats(x) (&per_cpu(irq_stat,x)) 39# define irq_stats(x) (&per_cpu(irq_stat, x))
40#else 40#else
41# define irq_stats(x) cpu_pda(x) 41# define irq_stats(x) cpu_pda(x)
42#endif 42#endif
@@ -113,7 +113,7 @@ int show_interrupts(struct seq_file *p, void *v)
113 if (i == 0) { 113 if (i == 0) {
114 seq_printf(p, " "); 114 seq_printf(p, " ");
115 for_each_online_cpu(j) 115 for_each_online_cpu(j)
116 seq_printf(p, "CPU%-8d",j); 116 seq_printf(p, "CPU%-8d", j);
117 seq_putc(p, '\n'); 117 seq_putc(p, '\n');
118 } 118 }
119 119
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 192624820217..1972266e8ba5 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -9,8 +9,6 @@
9#include <asm/calgary.h> 9#include <asm/calgary.h>
10#include <asm/amd_iommu.h> 10#include <asm/amd_iommu.h>
11 11
12static int forbid_dac __read_mostly;
13
14struct dma_mapping_ops *dma_ops; 12struct dma_mapping_ops *dma_ops;
15EXPORT_SYMBOL(dma_ops); 13EXPORT_SYMBOL(dma_ops);
16 14
@@ -293,17 +291,3 @@ void pci_iommu_shutdown(void)
293} 291}
294/* Must execute after PCI subsystem */ 292/* Must execute after PCI subsystem */
295fs_initcall(pci_iommu_init); 293fs_initcall(pci_iommu_init);
296
297#ifdef CONFIG_PCI
298/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
299
300static __devinit void via_no_dac(struct pci_dev *dev)
301{
302 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && forbid_dac == 0) {
303 printk(KERN_INFO "PCI: VIA PCI bridge detected."
304 "Disabling DAC.\n");
305 forbid_dac = 1;
306 }
307}
308DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_ANY_ID, via_no_dac);
309#endif
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index e2095cba409f..04df67f8a7ba 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -52,8 +52,7 @@ struct frame_head {
52 unsigned long ret; 52 unsigned long ret;
53} __attribute__((packed)); 53} __attribute__((packed));
54 54
55static struct frame_head * 55static struct frame_head *dump_user_backtrace(struct frame_head *head)
56dump_user_backtrace(struct frame_head * head)
57{ 56{
58 struct frame_head bufhead[2]; 57 struct frame_head bufhead[2];
59 58
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 57f6c9088081..022cd41ea9b4 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -28,85 +28,9 @@ static struct op_x86_model_spec const *model;
28static DEFINE_PER_CPU(struct op_msrs, cpu_msrs); 28static DEFINE_PER_CPU(struct op_msrs, cpu_msrs);
29static DEFINE_PER_CPU(unsigned long, saved_lvtpc); 29static DEFINE_PER_CPU(unsigned long, saved_lvtpc);
30 30
31static int nmi_start(void);
32static void nmi_stop(void);
33static void nmi_cpu_start(void *dummy);
34static void nmi_cpu_stop(void *dummy);
35
36/* 0 == registered but off, 1 == registered and on */ 31/* 0 == registered but off, 1 == registered and on */
37static int nmi_enabled = 0; 32static int nmi_enabled = 0;
38 33
39#ifdef CONFIG_SMP
40static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action,
41 void *data)
42{
43 int cpu = (unsigned long)data;
44 switch (action) {
45 case CPU_DOWN_FAILED:
46 case CPU_ONLINE:
47 smp_call_function_single(cpu, nmi_cpu_start, NULL, 0);
48 break;
49 case CPU_DOWN_PREPARE:
50 smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1);
51 break;
52 }
53 return NOTIFY_DONE;
54}
55
56static struct notifier_block oprofile_cpu_nb = {
57 .notifier_call = oprofile_cpu_notifier
58};
59#endif
60
61#ifdef CONFIG_PM
62
63static int nmi_suspend(struct sys_device *dev, pm_message_t state)
64{
65 /* Only one CPU left, just stop that one */
66 if (nmi_enabled == 1)
67 nmi_cpu_stop(NULL);
68 return 0;
69}
70
71static int nmi_resume(struct sys_device *dev)
72{
73 if (nmi_enabled == 1)
74 nmi_cpu_start(NULL);
75 return 0;
76}
77
78static struct sysdev_class oprofile_sysclass = {
79 .name = "oprofile",
80 .resume = nmi_resume,
81 .suspend = nmi_suspend,
82};
83
84static struct sys_device device_oprofile = {
85 .id = 0,
86 .cls = &oprofile_sysclass,
87};
88
89static int __init init_sysfs(void)
90{
91 int error;
92
93 error = sysdev_class_register(&oprofile_sysclass);
94 if (!error)
95 error = sysdev_register(&device_oprofile);
96 return error;
97}
98
99static void exit_sysfs(void)
100{
101 sysdev_unregister(&device_oprofile);
102 sysdev_class_unregister(&oprofile_sysclass);
103}
104
105#else
106#define init_sysfs() do { } while (0)
107#define exit_sysfs() do { } while (0)
108#endif /* CONFIG_PM */
109
110static int profile_exceptions_notify(struct notifier_block *self, 34static int profile_exceptions_notify(struct notifier_block *self,
111 unsigned long val, void *data) 35 unsigned long val, void *data)
112{ 36{
@@ -361,6 +285,77 @@ static int nmi_create_files(struct super_block *sb, struct dentry *root)
361 return 0; 285 return 0;
362} 286}
363 287
288#ifdef CONFIG_SMP
289static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action,
290 void *data)
291{
292 int cpu = (unsigned long)data;
293 switch (action) {
294 case CPU_DOWN_FAILED:
295 case CPU_ONLINE:
296 smp_call_function_single(cpu, nmi_cpu_start, NULL, 0);
297 break;
298 case CPU_DOWN_PREPARE:
299 smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1);
300 break;
301 }
302 return NOTIFY_DONE;
303}
304
305static struct notifier_block oprofile_cpu_nb = {
306 .notifier_call = oprofile_cpu_notifier
307};
308#endif
309
310#ifdef CONFIG_PM
311
312static int nmi_suspend(struct sys_device *dev, pm_message_t state)
313{
314 /* Only one CPU left, just stop that one */
315 if (nmi_enabled == 1)
316 nmi_cpu_stop(NULL);
317 return 0;
318}
319
320static int nmi_resume(struct sys_device *dev)
321{
322 if (nmi_enabled == 1)
323 nmi_cpu_start(NULL);
324 return 0;
325}
326
327static struct sysdev_class oprofile_sysclass = {
328 .name = "oprofile",
329 .resume = nmi_resume,
330 .suspend = nmi_suspend,
331};
332
333static struct sys_device device_oprofile = {
334 .id = 0,
335 .cls = &oprofile_sysclass,
336};
337
338static int __init init_sysfs(void)
339{
340 int error;
341
342 error = sysdev_class_register(&oprofile_sysclass);
343 if (!error)
344 error = sysdev_register(&device_oprofile);
345 return error;
346}
347
348static void exit_sysfs(void)
349{
350 sysdev_unregister(&device_oprofile);
351 sysdev_class_unregister(&oprofile_sysclass);
352}
353
354#else
355#define init_sysfs() do { } while (0)
356#define exit_sysfs() do { } while (0)
357#endif /* CONFIG_PM */
358
364static int p4force; 359static int p4force;
365module_param(p4force, int, 0); 360module_param(p4force, int, 0);
366 361
@@ -420,9 +415,6 @@ static int __init ppro_init(char **cpu_type)
420 case 15: case 23: 415 case 15: case 23:
421 *cpu_type = "i386/core_2"; 416 *cpu_type = "i386/core_2";
422 break; 417 break;
423 case 26:
424 *cpu_type = "i386/core_2";
425 break;
426 default: 418 default:
427 /* Unknown */ 419 /* Unknown */
428 return 0; 420 return 0;
@@ -432,6 +424,16 @@ static int __init ppro_init(char **cpu_type)
432 return 1; 424 return 1;
433} 425}
434 426
427static int __init arch_perfmon_init(char **cpu_type)
428{
429 if (!cpu_has_arch_perfmon)
430 return 0;
431 *cpu_type = "i386/arch_perfmon";
432 model = &op_arch_perfmon_spec;
433 arch_perfmon_setup_counters();
434 return 1;
435}
436
435/* in order to get sysfs right */ 437/* in order to get sysfs right */
436static int using_nmi; 438static int using_nmi;
437 439
@@ -439,7 +441,7 @@ int __init op_nmi_init(struct oprofile_operations *ops)
439{ 441{
440 __u8 vendor = boot_cpu_data.x86_vendor; 442 __u8 vendor = boot_cpu_data.x86_vendor;
441 __u8 family = boot_cpu_data.x86; 443 __u8 family = boot_cpu_data.x86;
442 char *cpu_type; 444 char *cpu_type = NULL;
443 int ret = 0; 445 int ret = 0;
444 446
445 if (!cpu_has_apic) 447 if (!cpu_has_apic)
@@ -477,19 +479,20 @@ int __init op_nmi_init(struct oprofile_operations *ops)
477 switch (family) { 479 switch (family) {
478 /* Pentium IV */ 480 /* Pentium IV */
479 case 0xf: 481 case 0xf:
480 if (!p4_init(&cpu_type)) 482 p4_init(&cpu_type);
481 return -ENODEV;
482 break; 483 break;
483 484
484 /* A P6-class processor */ 485 /* A P6-class processor */
485 case 6: 486 case 6:
486 if (!ppro_init(&cpu_type)) 487 ppro_init(&cpu_type);
487 return -ENODEV;
488 break; 488 break;
489 489
490 default: 490 default:
491 return -ENODEV; 491 break;
492 } 492 }
493
494 if (!cpu_type && !arch_perfmon_init(&cpu_type))
495 return -ENODEV;
493 break; 496 break;
494 497
495 default: 498 default:
diff --git a/arch/x86/oprofile/op_counter.h b/arch/x86/oprofile/op_counter.h
index 2880b15c4675..91b6a116165e 100644
--- a/arch/x86/oprofile/op_counter.h
+++ b/arch/x86/oprofile/op_counter.h
@@ -6,22 +6,22 @@
6 * 6 *
7 * @author John Levon 7 * @author John Levon
8 */ 8 */
9 9
10#ifndef OP_COUNTER_H 10#ifndef OP_COUNTER_H
11#define OP_COUNTER_H 11#define OP_COUNTER_H
12 12
13#define OP_MAX_COUNTER 8 13#define OP_MAX_COUNTER 8
14 14
15/* Per-perfctr configuration as set via 15/* Per-perfctr configuration as set via
16 * oprofilefs. 16 * oprofilefs.
17 */ 17 */
18struct op_counter_config { 18struct op_counter_config {
19 unsigned long count; 19 unsigned long count;
20 unsigned long enabled; 20 unsigned long enabled;
21 unsigned long event; 21 unsigned long event;
22 unsigned long kernel; 22 unsigned long kernel;
23 unsigned long user; 23 unsigned long user;
24 unsigned long unit_mask; 24 unsigned long unit_mask;
25}; 25};
26 26
27extern struct op_counter_config counter_config[]; 27extern struct op_counter_config counter_config[];
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index d9faf607b3a6..509513760a6e 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -67,8 +67,9 @@ static unsigned long reset_value[NUM_COUNTERS];
67 67
68/* The function interface needs to be fixed, something like add 68/* The function interface needs to be fixed, something like add
69 data. Should then be added to linux/oprofile.h. */ 69 data. Should then be added to linux/oprofile.h. */
70extern void oprofile_add_ibs_sample(struct pt_regs *const regs, 70extern void
71 unsigned int * const ibs_sample, u8 code); 71oprofile_add_ibs_sample(struct pt_regs *const regs,
72 unsigned int *const ibs_sample, int ibs_code);
72 73
73struct ibs_fetch_sample { 74struct ibs_fetch_sample {
74 /* MSRC001_1031 IBS Fetch Linear Address Register */ 75 /* MSRC001_1031 IBS Fetch Linear Address Register */
@@ -309,12 +310,15 @@ static void op_amd_start(struct op_msrs const * const msrs)
309#ifdef CONFIG_OPROFILE_IBS 310#ifdef CONFIG_OPROFILE_IBS
310 if (ibs_allowed && ibs_config.fetch_enabled) { 311 if (ibs_allowed && ibs_config.fetch_enabled) {
311 low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF; 312 low = (ibs_config.max_cnt_fetch >> 4) & 0xFFFF;
312 high = IBS_FETCH_HIGH_ENABLE; 313 high = ((ibs_config.rand_en & 0x1) << 25) /* bit 57 */
314 + IBS_FETCH_HIGH_ENABLE;
313 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high); 315 wrmsr(MSR_AMD64_IBSFETCHCTL, low, high);
314 } 316 }
315 317
316 if (ibs_allowed && ibs_config.op_enabled) { 318 if (ibs_allowed && ibs_config.op_enabled) {
317 low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF) + IBS_OP_LOW_ENABLE; 319 low = ((ibs_config.max_cnt_op >> 4) & 0xFFFF)
320 + ((ibs_config.dispatched_ops & 0x1) << 19) /* bit 19 */
321 + IBS_OP_LOW_ENABLE;
318 high = 0; 322 high = 0;
319 wrmsr(MSR_AMD64_IBSOPCTL, low, high); 323 wrmsr(MSR_AMD64_IBSOPCTL, low, high);
320 } 324 }
@@ -468,11 +472,10 @@ static void clear_ibs_nmi(void)
468 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1); 472 on_each_cpu(apic_clear_ibs_nmi_per_cpu, NULL, 1);
469} 473}
470 474
471static int (*create_arch_files)(struct super_block * sb, struct dentry * root); 475static int (*create_arch_files)(struct super_block *sb, struct dentry *root);
472 476
473static int setup_ibs_files(struct super_block * sb, struct dentry * root) 477static int setup_ibs_files(struct super_block *sb, struct dentry *root)
474{ 478{
475 char buf[12];
476 struct dentry *dir; 479 struct dentry *dir;
477 int ret = 0; 480 int ret = 0;
478 481
@@ -494,22 +497,22 @@ static int setup_ibs_files(struct super_block * sb, struct dentry * root)
494 ibs_config.max_cnt_op = 250000; 497 ibs_config.max_cnt_op = 250000;
495 ibs_config.op_enabled = 0; 498 ibs_config.op_enabled = 0;
496 ibs_config.dispatched_ops = 1; 499 ibs_config.dispatched_ops = 1;
497 snprintf(buf, sizeof(buf), "ibs_fetch"); 500
498 dir = oprofilefs_mkdir(sb, root, buf); 501 dir = oprofilefs_mkdir(sb, root, "ibs_fetch");
499 oprofilefs_create_ulong(sb, dir, "rand_enable",
500 &ibs_config.rand_en);
501 oprofilefs_create_ulong(sb, dir, "enable", 502 oprofilefs_create_ulong(sb, dir, "enable",
502 &ibs_config.fetch_enabled); 503 &ibs_config.fetch_enabled);
503 oprofilefs_create_ulong(sb, dir, "max_count", 504 oprofilefs_create_ulong(sb, dir, "max_count",
504 &ibs_config.max_cnt_fetch); 505 &ibs_config.max_cnt_fetch);
505 snprintf(buf, sizeof(buf), "ibs_uops"); 506 oprofilefs_create_ulong(sb, dir, "rand_enable",
506 dir = oprofilefs_mkdir(sb, root, buf); 507 &ibs_config.rand_en);
508
509 dir = oprofilefs_mkdir(sb, root, "ibs_op");
507 oprofilefs_create_ulong(sb, dir, "enable", 510 oprofilefs_create_ulong(sb, dir, "enable",
508 &ibs_config.op_enabled); 511 &ibs_config.op_enabled);
509 oprofilefs_create_ulong(sb, dir, "max_count", 512 oprofilefs_create_ulong(sb, dir, "max_count",
510 &ibs_config.max_cnt_op); 513 &ibs_config.max_cnt_op);
511 oprofilefs_create_ulong(sb, dir, "dispatched_ops", 514 oprofilefs_create_ulong(sb, dir, "dispatched_ops",
512 &ibs_config.dispatched_ops); 515 &ibs_config.dispatched_ops);
513 516
514 return 0; 517 return 0;
515} 518}
@@ -530,14 +533,14 @@ static void op_amd_exit(void)
530#endif 533#endif
531 534
532struct op_x86_model_spec const op_amd_spec = { 535struct op_x86_model_spec const op_amd_spec = {
533 .init = op_amd_init, 536 .init = op_amd_init,
534 .exit = op_amd_exit, 537 .exit = op_amd_exit,
535 .num_counters = NUM_COUNTERS, 538 .num_counters = NUM_COUNTERS,
536 .num_controls = NUM_CONTROLS, 539 .num_controls = NUM_CONTROLS,
537 .fill_in_addresses = &op_amd_fill_in_addresses, 540 .fill_in_addresses = &op_amd_fill_in_addresses,
538 .setup_ctrs = &op_amd_setup_ctrs, 541 .setup_ctrs = &op_amd_setup_ctrs,
539 .check_ctrs = &op_amd_check_ctrs, 542 .check_ctrs = &op_amd_check_ctrs,
540 .start = &op_amd_start, 543 .start = &op_amd_start,
541 .stop = &op_amd_stop, 544 .stop = &op_amd_stop,
542 .shutdown = &op_amd_shutdown 545 .shutdown = &op_amd_shutdown
543}; 546};
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c
index 43ac5af338d8..4c4a51c90bc2 100644
--- a/arch/x86/oprofile/op_model_p4.c
+++ b/arch/x86/oprofile/op_model_p4.c
@@ -698,24 +698,24 @@ static void p4_shutdown(struct op_msrs const * const msrs)
698 698
699#ifdef CONFIG_SMP 699#ifdef CONFIG_SMP
700struct op_x86_model_spec const op_p4_ht2_spec = { 700struct op_x86_model_spec const op_p4_ht2_spec = {
701 .num_counters = NUM_COUNTERS_HT2, 701 .num_counters = NUM_COUNTERS_HT2,
702 .num_controls = NUM_CONTROLS_HT2, 702 .num_controls = NUM_CONTROLS_HT2,
703 .fill_in_addresses = &p4_fill_in_addresses, 703 .fill_in_addresses = &p4_fill_in_addresses,
704 .setup_ctrs = &p4_setup_ctrs, 704 .setup_ctrs = &p4_setup_ctrs,
705 .check_ctrs = &p4_check_ctrs, 705 .check_ctrs = &p4_check_ctrs,
706 .start = &p4_start, 706 .start = &p4_start,
707 .stop = &p4_stop, 707 .stop = &p4_stop,
708 .shutdown = &p4_shutdown 708 .shutdown = &p4_shutdown
709}; 709};
710#endif 710#endif
711 711
712struct op_x86_model_spec const op_p4_spec = { 712struct op_x86_model_spec const op_p4_spec = {
713 .num_counters = NUM_COUNTERS_NON_HT, 713 .num_counters = NUM_COUNTERS_NON_HT,
714 .num_controls = NUM_CONTROLS_NON_HT, 714 .num_controls = NUM_CONTROLS_NON_HT,
715 .fill_in_addresses = &p4_fill_in_addresses, 715 .fill_in_addresses = &p4_fill_in_addresses,
716 .setup_ctrs = &p4_setup_ctrs, 716 .setup_ctrs = &p4_setup_ctrs,
717 .check_ctrs = &p4_check_ctrs, 717 .check_ctrs = &p4_check_ctrs,
718 .start = &p4_start, 718 .start = &p4_start,
719 .stop = &p4_stop, 719 .stop = &p4_stop,
720 .shutdown = &p4_shutdown 720 .shutdown = &p4_shutdown
721}; 721};
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index eff431f6c57b..0620d6d45f7d 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -1,32 +1,34 @@
1/* 1/*
2 * @file op_model_ppro.h 2 * @file op_model_ppro.h
3 * pentium pro / P6 model-specific MSR operations 3 * Family 6 perfmon and architectural perfmon MSR operations
4 * 4 *
5 * @remark Copyright 2002 OProfile authors 5 * @remark Copyright 2002 OProfile authors
6 * @remark Copyright 2008 Intel Corporation
6 * @remark Read the file COPYING 7 * @remark Read the file COPYING
7 * 8 *
8 * @author John Levon 9 * @author John Levon
9 * @author Philippe Elie 10 * @author Philippe Elie
10 * @author Graydon Hoare 11 * @author Graydon Hoare
12 * @author Andi Kleen
11 */ 13 */
12 14
13#include <linux/oprofile.h> 15#include <linux/oprofile.h>
16#include <linux/slab.h>
14#include <asm/ptrace.h> 17#include <asm/ptrace.h>
15#include <asm/msr.h> 18#include <asm/msr.h>
16#include <asm/apic.h> 19#include <asm/apic.h>
17#include <asm/nmi.h> 20#include <asm/nmi.h>
21#include <asm/intel_arch_perfmon.h>
18 22
19#include "op_x86_model.h" 23#include "op_x86_model.h"
20#include "op_counter.h" 24#include "op_counter.h"
21 25
22#define NUM_COUNTERS 2 26static int num_counters = 2;
23#define NUM_CONTROLS 2 27static int counter_width = 32;
24 28
25#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0) 29#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
26#define CTR_READ(l, h, msrs, c) do {rdmsr(msrs->counters[(c)].addr, (l), (h)); } while (0) 30#define CTR_READ(l, h, msrs, c) do {rdmsr(msrs->counters[(c)].addr, (l), (h)); } while (0)
27#define CTR_32BIT_WRITE(l, msrs, c) \ 31#define CTR_OVERFLOWED(n) (!((n) & (1U<<(counter_width-1))))
28 do {wrmsr(msrs->counters[(c)].addr, -(u32)(l), 0); } while (0)
29#define CTR_OVERFLOWED(n) (!((n) & (1U<<31)))
30 32
31#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0) 33#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
32#define CTRL_READ(l, h, msrs, c) do {rdmsr((msrs->controls[(c)].addr), (l), (h)); } while (0) 34#define CTRL_READ(l, h, msrs, c) do {rdmsr((msrs->controls[(c)].addr), (l), (h)); } while (0)
@@ -40,20 +42,20 @@
40#define CTRL_SET_UM(val, m) (val |= (m << 8)) 42#define CTRL_SET_UM(val, m) (val |= (m << 8))
41#define CTRL_SET_EVENT(val, e) (val |= e) 43#define CTRL_SET_EVENT(val, e) (val |= e)
42 44
43static unsigned long reset_value[NUM_COUNTERS]; 45static u64 *reset_value;
44 46
45static void ppro_fill_in_addresses(struct op_msrs * const msrs) 47static void ppro_fill_in_addresses(struct op_msrs * const msrs)
46{ 48{
47 int i; 49 int i;
48 50
49 for (i = 0; i < NUM_COUNTERS; i++) { 51 for (i = 0; i < num_counters; i++) {
50 if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i)) 52 if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i))
51 msrs->counters[i].addr = MSR_P6_PERFCTR0 + i; 53 msrs->counters[i].addr = MSR_P6_PERFCTR0 + i;
52 else 54 else
53 msrs->counters[i].addr = 0; 55 msrs->counters[i].addr = 0;
54 } 56 }
55 57
56 for (i = 0; i < NUM_CONTROLS; i++) { 58 for (i = 0; i < num_counters; i++) {
57 if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i)) 59 if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i))
58 msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i; 60 msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i;
59 else 61 else
@@ -67,8 +69,22 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
67 unsigned int low, high; 69 unsigned int low, high;
68 int i; 70 int i;
69 71
72 if (!reset_value) {
73 reset_value = kmalloc(sizeof(unsigned) * num_counters,
74 GFP_ATOMIC);
75 if (!reset_value)
76 return;
77 }
78
79 if (cpu_has_arch_perfmon) {
80 union cpuid10_eax eax;
81 eax.full = cpuid_eax(0xa);
82 if (counter_width < eax.split.bit_width)
83 counter_width = eax.split.bit_width;
84 }
85
70 /* clear all counters */ 86 /* clear all counters */
71 for (i = 0 ; i < NUM_CONTROLS; ++i) { 87 for (i = 0 ; i < num_counters; ++i) {
72 if (unlikely(!CTRL_IS_RESERVED(msrs, i))) 88 if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
73 continue; 89 continue;
74 CTRL_READ(low, high, msrs, i); 90 CTRL_READ(low, high, msrs, i);
@@ -77,18 +93,18 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
77 } 93 }
78 94
79 /* avoid a false detection of ctr overflows in NMI handler */ 95 /* avoid a false detection of ctr overflows in NMI handler */
80 for (i = 0; i < NUM_COUNTERS; ++i) { 96 for (i = 0; i < num_counters; ++i) {
81 if (unlikely(!CTR_IS_RESERVED(msrs, i))) 97 if (unlikely(!CTR_IS_RESERVED(msrs, i)))
82 continue; 98 continue;
83 CTR_32BIT_WRITE(1, msrs, i); 99 wrmsrl(msrs->counters[i].addr, -1LL);
84 } 100 }
85 101
86 /* enable active counters */ 102 /* enable active counters */
87 for (i = 0; i < NUM_COUNTERS; ++i) { 103 for (i = 0; i < num_counters; ++i) {
88 if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs, i))) { 104 if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs, i))) {
89 reset_value[i] = counter_config[i].count; 105 reset_value[i] = counter_config[i].count;
90 106
91 CTR_32BIT_WRITE(counter_config[i].count, msrs, i); 107 wrmsrl(msrs->counters[i].addr, -reset_value[i]);
92 108
93 CTRL_READ(low, high, msrs, i); 109 CTRL_READ(low, high, msrs, i);
94 CTRL_CLEAR(low); 110 CTRL_CLEAR(low);
@@ -111,13 +127,13 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
111 unsigned int low, high; 127 unsigned int low, high;
112 int i; 128 int i;
113 129
114 for (i = 0 ; i < NUM_COUNTERS; ++i) { 130 for (i = 0 ; i < num_counters; ++i) {
115 if (!reset_value[i]) 131 if (!reset_value[i])
116 continue; 132 continue;
117 CTR_READ(low, high, msrs, i); 133 CTR_READ(low, high, msrs, i);
118 if (CTR_OVERFLOWED(low)) { 134 if (CTR_OVERFLOWED(low)) {
119 oprofile_add_sample(regs, i); 135 oprofile_add_sample(regs, i);
120 CTR_32BIT_WRITE(reset_value[i], msrs, i); 136 wrmsrl(msrs->counters[i].addr, -reset_value[i]);
121 } 137 }
122 } 138 }
123 139
@@ -141,7 +157,7 @@ static void ppro_start(struct op_msrs const * const msrs)
141 unsigned int low, high; 157 unsigned int low, high;
142 int i; 158 int i;
143 159
144 for (i = 0; i < NUM_COUNTERS; ++i) { 160 for (i = 0; i < num_counters; ++i) {
145 if (reset_value[i]) { 161 if (reset_value[i]) {
146 CTRL_READ(low, high, msrs, i); 162 CTRL_READ(low, high, msrs, i);
147 CTRL_SET_ACTIVE(low); 163 CTRL_SET_ACTIVE(low);
@@ -156,7 +172,7 @@ static void ppro_stop(struct op_msrs const * const msrs)
156 unsigned int low, high; 172 unsigned int low, high;
157 int i; 173 int i;
158 174
159 for (i = 0; i < NUM_COUNTERS; ++i) { 175 for (i = 0; i < num_counters; ++i) {
160 if (!reset_value[i]) 176 if (!reset_value[i])
161 continue; 177 continue;
162 CTRL_READ(low, high, msrs, i); 178 CTRL_READ(low, high, msrs, i);
@@ -169,24 +185,70 @@ static void ppro_shutdown(struct op_msrs const * const msrs)
169{ 185{
170 int i; 186 int i;
171 187
172 for (i = 0 ; i < NUM_COUNTERS ; ++i) { 188 for (i = 0 ; i < num_counters ; ++i) {
173 if (CTR_IS_RESERVED(msrs, i)) 189 if (CTR_IS_RESERVED(msrs, i))
174 release_perfctr_nmi(MSR_P6_PERFCTR0 + i); 190 release_perfctr_nmi(MSR_P6_PERFCTR0 + i);
175 } 191 }
176 for (i = 0 ; i < NUM_CONTROLS ; ++i) { 192 for (i = 0 ; i < num_counters ; ++i) {
177 if (CTRL_IS_RESERVED(msrs, i)) 193 if (CTRL_IS_RESERVED(msrs, i))
178 release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); 194 release_evntsel_nmi(MSR_P6_EVNTSEL0 + i);
179 } 195 }
196 if (reset_value) {
197 kfree(reset_value);
198 reset_value = NULL;
199 }
180} 200}
181 201
182 202
183struct op_x86_model_spec const op_ppro_spec = { 203struct op_x86_model_spec op_ppro_spec = {
184 .num_counters = NUM_COUNTERS, 204 .num_counters = 2, /* can be overriden */
185 .num_controls = NUM_CONTROLS, 205 .num_controls = 2, /* dito */
186 .fill_in_addresses = &ppro_fill_in_addresses, 206 .fill_in_addresses = &ppro_fill_in_addresses,
187 .setup_ctrs = &ppro_setup_ctrs, 207 .setup_ctrs = &ppro_setup_ctrs,
188 .check_ctrs = &ppro_check_ctrs, 208 .check_ctrs = &ppro_check_ctrs,
189 .start = &ppro_start, 209 .start = &ppro_start,
190 .stop = &ppro_stop, 210 .stop = &ppro_stop,
191 .shutdown = &ppro_shutdown 211 .shutdown = &ppro_shutdown
212};
213
214/*
215 * Architectural performance monitoring.
216 *
217 * Newer Intel CPUs (Core1+) have support for architectural
218 * events described in CPUID 0xA. See the IA32 SDM Vol3b.18 for details.
219 * The advantage of this is that it can be done without knowing about
220 * the specific CPU.
221 */
222
223void arch_perfmon_setup_counters(void)
224{
225 union cpuid10_eax eax;
226
227 eax.full = cpuid_eax(0xa);
228
229 /* Workaround for BIOS bugs in 6/15. Taken from perfmon2 */
230 if (eax.split.version_id == 0 && current_cpu_data.x86 == 6 &&
231 current_cpu_data.x86_model == 15) {
232 eax.split.version_id = 2;
233 eax.split.num_counters = 2;
234 eax.split.bit_width = 40;
235 }
236
237 num_counters = eax.split.num_counters;
238
239 op_arch_perfmon_spec.num_counters = num_counters;
240 op_arch_perfmon_spec.num_controls = num_counters;
241 op_ppro_spec.num_counters = num_counters;
242 op_ppro_spec.num_controls = num_counters;
243}
244
245struct op_x86_model_spec op_arch_perfmon_spec = {
246 /* num_counters/num_controls filled in at runtime */
247 .fill_in_addresses = &ppro_fill_in_addresses,
248 /* user space does the cpuid check for available events */
249 .setup_ctrs = &ppro_setup_ctrs,
250 .check_ctrs = &ppro_check_ctrs,
251 .start = &ppro_start,
252 .stop = &ppro_stop,
253 .shutdown = &ppro_shutdown
192}; 254};
diff --git a/arch/x86/oprofile/op_x86_model.h b/arch/x86/oprofile/op_x86_model.h
index 05a0261ba0c3..825e79064d64 100644
--- a/arch/x86/oprofile/op_x86_model.h
+++ b/arch/x86/oprofile/op_x86_model.h
@@ -22,8 +22,8 @@ struct op_msr {
22}; 22};
23 23
24struct op_msrs { 24struct op_msrs {
25 struct op_msr * counters; 25 struct op_msr *counters;
26 struct op_msr * controls; 26 struct op_msr *controls;
27}; 27};
28 28
29struct pt_regs; 29struct pt_regs;
@@ -34,8 +34,8 @@ struct pt_regs;
34struct op_x86_model_spec { 34struct op_x86_model_spec {
35 int (*init)(struct oprofile_operations *ops); 35 int (*init)(struct oprofile_operations *ops);
36 void (*exit)(void); 36 void (*exit)(void);
37 unsigned int const num_counters; 37 unsigned int num_counters;
38 unsigned int const num_controls; 38 unsigned int num_controls;
39 void (*fill_in_addresses)(struct op_msrs * const msrs); 39 void (*fill_in_addresses)(struct op_msrs * const msrs);
40 void (*setup_ctrs)(struct op_msrs const * const msrs); 40 void (*setup_ctrs)(struct op_msrs const * const msrs);
41 int (*check_ctrs)(struct pt_regs * const regs, 41 int (*check_ctrs)(struct pt_regs * const regs,
@@ -45,9 +45,12 @@ struct op_x86_model_spec {
45 void (*shutdown)(struct op_msrs const * const msrs); 45 void (*shutdown)(struct op_msrs const * const msrs);
46}; 46};
47 47
48extern struct op_x86_model_spec const op_ppro_spec; 48extern struct op_x86_model_spec op_ppro_spec;
49extern struct op_x86_model_spec const op_p4_spec; 49extern struct op_x86_model_spec const op_p4_spec;
50extern struct op_x86_model_spec const op_p4_ht2_spec; 50extern struct op_x86_model_spec const op_p4_ht2_spec;
51extern struct op_x86_model_spec const op_amd_spec; 51extern struct op_x86_model_spec const op_amd_spec;
52extern struct op_x86_model_spec op_arch_perfmon_spec;
53
54extern void arch_perfmon_setup_counters(void);
52 55
53#endif /* OP_X86_MODEL_H */ 56#endif /* OP_X86_MODEL_H */
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index a213260b51e5..6c873dceb177 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -64,7 +64,12 @@ choice
64 default XTENSA_VARIANT_FSF 64 default XTENSA_VARIANT_FSF
65 65
66config XTENSA_VARIANT_FSF 66config XTENSA_VARIANT_FSF
67 bool "fsf" 67 bool "fsf - default (not generic) configuration"
68
69config XTENSA_VARIANT_DC232B
70 bool "dc232b - Diamond 232L Standard Core Rev.B (LE)"
71 help
72 This variant refers to Tensilica's Diamond 232L Standard core Rev.B (LE).
68endchoice 73endchoice
69 74
70config MMU 75config MMU
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 4bd1e14c6b90..015b6b2a26b9 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -14,6 +14,7 @@
14# (Use VAR=<xtensa_config> to use another default compiler.) 14# (Use VAR=<xtensa_config> to use another default compiler.)
15 15
16variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf 16variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf
17variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b
17variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom 18variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom
18 19
19VARIANT = $(variant-y) 20VARIANT = $(variant-y)
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index c9ea73b7031b..5fbcde59a92d 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -48,7 +48,7 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
48 48
49 if (irq >= NR_IRQS) { 49 if (irq >= NR_IRQS) {
50 printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 50 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
51 __FUNCTION__, irq); 51 __func__, irq);
52 } 52 }
53 53
54 irq_enter(); 54 irq_enter();
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index a2e252217428..11a20adc1409 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -640,7 +640,7 @@ static int iss_net_configure(int index, char *init)
640 *lp = ((struct iss_net_private) { 640 *lp = ((struct iss_net_private) {
641 .device_list = LIST_HEAD_INIT(lp->device_list), 641 .device_list = LIST_HEAD_INIT(lp->device_list),
642 .opened_list = LIST_HEAD_INIT(lp->opened_list), 642 .opened_list = LIST_HEAD_INIT(lp->opened_list),
643 .lock = SPIN_LOCK_UNLOCKED, 643 .lock = __SPIN_LOCK_UNLOCKED(lp.lock),
644 .dev = dev, 644 .dev = dev,
645 .index = index, 645 .index = index,
646 //.fd = -1, 646 //.fd = -1,